Package Exports
- @portal-hq/tron-protobuf-module
- @portal-hq/tron-protobuf-module/tron-protobuf.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@portal-hq/tron-protobuf-module) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
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.js