feat: add typed wallets.tron() interface for signTransaction and sendTransaction#185
Draft
lucasloisp wants to merge 3 commits into
Draft
feat: add typed wallets.tron() interface for signTransaction and sendTransaction#185lucasloisp wants to merge 3 commits into
wallets.tron() interface for signTransaction and sendTransaction#185lucasloisp wants to merge 3 commits into
Conversation
…Transaction Adds PrivyTronService with typed methods mirroring the existing wallets.ethereum() and wallets.solana() pattern: - wallets.tron().signTransaction(walletId, input) - signs a Tron transaction without broadcasting - wallets.tron().sendTransaction(walletId, input) - signs and broadcasts a Tron transaction Both methods leverage the existing typed Tron RPC schemas (TronSignTransactionRpcInput, TronSendTransactionRpcInput) and route through the standard wallets.rpc() infrastructure. Committed-By-Agent: goose
Adds integration tests covering signTransaction and sendTransaction for all wallet ownership configurations (ownerless, key-owned, user-owned, quorum-owned). - signTransaction: verifies the signature cryptographically by parsing the protobuf response, computing the txID (SHA256 of raw_data), and recovering the signer's public key via secp256k1 - sendTransaction: skipped to not expend funds (same pattern as ethereum/solana tests) Also adds test helpers for Tron: - protobuf parser for signed Tron transactions - signature verification using @noble/curves secp256k1 - base58check to hex address conversion - test transaction builder Committed-By-Agent: goose
The signed_transaction response from tron_signTransaction is formatted as raw_data_hex + signature_hex (last 65 bytes), not protobuf-encoded. Also replaced manual base58 decoder with @scure/base which is already a dependency, and switched keccak import to use viem (matching other tests in this repo). Committed-By-Agent: goose
|
Feature branches in this SDK should target |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
PrivyTronServiceexposingwallets().tron().signTransaction()andwallets().tron().sendTransaction(), mirroring the existingwallets().ethereum()andwallets().solana()typed interfaces. Both methods delegate towallets().rpc()with the appropriatemethoddiscriminant and return the already-definedTronSignTransactionRpcResponseData/TronSendTransactionRpcResponseDatatypes.Test plan
npx tsc --noEmit)yarn test:integration)Integration tests cover all four wallet ownership configurations (ownerless, key-owned, user-owned, quorum-owned).
signTransactionis verified cryptographically by recovering the signer's public key from the response via secp256k1 and comparing the derived Tron address.sendTransactionis skipped to avoid expending testnet funds.