1.0.3 • Published 7 months ago
@portal-hq/tron-protobuf-module v1.0.3
Description
This repo is used to create JS/TS modules for interacting with Tron protobufs.
The tronweb node module has methods that can be used to deserialize raw data based on the tron protobuf definition, however these methods were previously not exposed. Version 6.0.3 exposes tronWeb.utils.transaction.DeserializeTransaction() method, however it only supports 7 different contract types right now, and most importantly does not support TransferContract type which is used for native TRX transfers.
How to use this repo
1. Install dependencies
npm install2. Clone the Tron Protocol repo into the same parent directory as tron-protobuf-module
3. In the Tron Protocol repo, change /core/Tron.proto line 603 to use a decimal value
Before: BELOW_THAN_ME = 0x24;
After: BELOW_THAN_ME = 36;
4. Run these commands, assuming the Tron Protocol repo is in the same directory as this repo:
Example folder structure:
parent-dir/
├── tron-protobuf-module/
└── protocol/Commands to generate JS/TS module:
npx pbjs -t static-module -w commonjs -o tron-protobuf.js -p ../protocol ../protocol/core/**/*.proto
npx pbts -o tron-protobuf.d.ts tron-protobuf.js1.0.3
7 months ago