
Product
Introducing Tier 1 Reachability: Precision CVE Triage for Enterprise Teams
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.
@waves/protobuf-serialization
Advanced tools
Generated types and methods for encoding and decoding protobuf messages as well as working with gRPC services.
Waves protobuf schemas repository
Add dependency to your pom.xml
<dependency>
<groupId>com.wavesplatform</groupId>
<artifactId>protobuf-schemas</artifactId>
<version>{version}</version>
</dependency>
build.sbt
:libraryDependencies += "com.wavesplatform" % "protobuf-schemas" % "{version}" % "protobuf-src" intransitive()
inConfig(Compile)(Seq(
PB.protoSources in Compile := Seq(PB.externalIncludePath.value),
includeFilter in PB.generate := new SimpleFileFilter((f: File) => f.getName.endsWith(".proto") && f.getParent.endsWith("waves")),
PB.targets += scalapb.gen(flatPackage = true) -> sourceManaged.value
))
resolvers += Resolver.sonatypeRepo("snapshots")
See ScalaPB docs for more info.
Npm package: @waves/protobuf-serialization
.
It contains generated JavaScript classes, TypeScript definitions as well as raw proto files. The default build uses CommonJS and includes all of the proto files. We used pbjs
to build JavaScript and pbts
to build TypeScript definitions.
You could also make your own custom build from raw .proto
files, for example, if you want to use only a subset of proto schemas or gRPC services. They can be found in @waves/protobuf-serialization/proto
directory.
long.js
is used for 64-bit integers: int64
, uint64
, etc.
Example:
npm install --save @waves/protobuf-serialization
import { waves } from '@waves/protobuf-serialization';
const block = new waves.Block();
block.header = // ... set necessary fields
const buffer = waves.Block.encode(block);
const blockDecoded = waves.Block.decode(buffer);
App.config
, packages.config
to your C# solution <ItemGroup>
<Protobuf Include="proto\waves\*.proto" OutputDir="waves\%(RelativePath)" GrpcServices="None" />
<Protobuf Include="proto\waves\events\*.proto" OutputDir="waves\events\%(RelativePath)" GrpcServices="None" />
<Protobuf Include="proto\waves\node\grpc\*.proto" OutputDir="waves\node\grpc\%(RelativePath)" GrpcServices="Both" />
</ItemGroup>
to your .csproj
file. After this just build your project.
or as alternative you can use util protoc, for example:
protoc --csharp_out=RelativePath --proto_path=RelativePathToProtoDir RelativePathToProtoFile
Also there is a NuGet package WavesPlatform.ProtobufSchema with this project.
Add dependency to your Cargo.toml
[dependencies]
waves-protobuf-schemas = { git = "https://github.com/wavesplatform/protobuf-schemas" }
Use mvn package
to create JAR artifacts:
protobuf-schemas-{version}-protobuf-src.jar
- raw .proto filesprotobuf-schemas-{version}.jar
- protoc-generated Java classesGenerating python sources requires python 3 or later. Run the following commands from the root of this repository to generate python sources in /target/python
:
python3 -m venv .venv
. .venv/bin/activate
pip install grpcio grpcio-tools base58
git clone https://github.com/wavesplatform/protobuf-schemas.git
python -m grpc_tools.protoc --proto_path=./protobuf-schemas/proto --python_out=. --grpc_python_out=. `find ./protobuf-schemas/proto -type f`
Tweak --python_out
and --grpc_python_out
parameters to generate files elsewhere. Target path should likely be absolute. Now you can use generated classes:
import grpc
from waves.events.grpc.blockchain_updates_pb2_grpc import BlockchainUpdatesApiStub
from waves.events.grpc.blockchain_updates_pb2 import SubscribeRequest
from base58 import b58encode, b58decode
def asset_id(asset_id_bytes):
return len(asset_id_bytes) > 0 and b58encode(asset_id_bytes) or 'WAVES'
def print_update(update):
update_id = b58encode(update.id)
print(f'block {update_id}:')
for (tx_id, tx_state_update) in zip(update.append.transaction_ids, update.append.transaction_state_updates):
print(f' tx {b58encode(tx_id)}:')
for balance in tx_state_update.balances:
print(f' {b58encode(balance.address)}: {balance.amount_before} -> {balance.amount_after.amount} [{asset_id(balance.amount_after.asset_id)}]')
with grpc.insecure_channel('grpc.wavesnodes.com:6881') as channel:
for block in BlockchainUpdatesApiStub(channel).Subscribe(SubscribeRequest(from_height=3135450, to_height=3135470)):
print_update(block.update)
FAQs
Generated types and methods for encoding and decoding protobuf messages as well as working with gRPC services.
We found that @waves/protobuf-serialization demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 16 open source maintainers 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.
Product
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.
Research
/Security News
Ongoing npm supply chain attack spreads to DuckDB: multiple packages compromised with the same wallet-drainer malware.
Security News
The MCP Steering Committee has launched the official MCP Registry in preview, a central hub for discovering and publishing MCP servers.