Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
@yongenaelf/protobuf-generator-ts
Advanced tools
`@yongenaelf/protobuf-generator-ts` is an npm library designed to generate TypeScript code from Protocol Buffers (protobuf) definitions. This tool helps streamline the process of integrating protobuf with TypeScript projects.
@yongenaelf/protobuf-generator-ts
is an npm library designed to generate TypeScript code from Protocol Buffers (protobuf) definitions. This tool helps streamline the process of integrating protobuf with TypeScript projects.
To install the library, use npm or yarn:
npm install @yongenaelf/protobuf-generator-ts
import { generateProtoFile, ProtoFile } from '@yongenaelf/protobuf-generator-ts';
const testAST: ProtoFile = {
syntax: "proto3",
package: "", // No package for this file
imports: [
"aelf/options.proto",
"google/protobuf/empty.proto",
"google/protobuf/wrappers.proto",
"Protobuf/reference/acs12.proto"
],
messages: [
{
name: "UpdatedMessage",
fields: [
{ name: "value", type: "string", id: 1 }
],
options: {
"aelf.is_event": "true",
}
}
],
services: [
{
name: "HelloWorld",
options: [
{ key: "aelf.csharp_state", value: `"AElf.Contracts.HelloWorld.HelloWorldState"` },
{ key: "aelf.base", value: `"Protobuf/reference/acs12.proto"` }
],
methods: [
{
name: "Update",
inputType: "google.protobuf.StringValue",
outputType: "google.protobuf.Empty"
},
{
name: "Read",
inputType: "google.protobuf.Empty",
outputType: "google.protobuf.StringValue",
options: [
{ key: "aelf.is_view", value: "true" }
]
}
]
}
],
options: {
"csharp_namespace": `"AElf.Contracts.HelloWorld"`
}
};
generateProtoFile(testAST)
Expected output:
syntax = "proto3";
import "aelf/options.proto";
import "google/protobuf/empty.proto";
import "google/protobuf/wrappers.proto";
import "Protobuf/reference/acs12.proto";
option csharp_namespace = "AElf.Contracts.HelloWorld";
service HelloWorld {
option (aelf.csharp_state) = "AElf.Contracts.HelloWorld.HelloWorldState";
option (aelf.base) = "Protobuf/reference/acs12.proto";
rpc Update (google.protobuf.StringValue) returns (google.protobuf.Empty);
rpc Read (google.protobuf.Empty) returns (google.protobuf.StringValue) {
option (aelf.is_view) = true;
}
}
message UpdatedMessage {
option (aelf.is_event) = true;
string value = 1;
}
FAQs
`@yongenaelf/protobuf-generator-ts` is an npm library designed to generate Protocol Buffer code from TypeScript.
We found that @yongenaelf/protobuf-generator-ts demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.