Skip to content

feat: add typed wallets.tron() interface for signTransaction and sendTransaction#185

Draft
lucasloisp wants to merge 3 commits into
mainfrom
llois-c/tron-rpc-wallets-sdk
Draft

feat: add typed wallets.tron() interface for signTransaction and sendTransaction#185
lucasloisp wants to merge 3 commits into
mainfrom
llois-c/tron-rpc-wallets-sdk

Conversation

@lucasloisp

Copy link
Copy Markdown
Collaborator

Summary

Adds PrivyTronService exposing wallets().tron().signTransaction() and wallets().tron().sendTransaction(), mirroring the existing wallets().ethereum() and wallets().solana() typed interfaces. Both methods delegate to wallets().rpc() with the appropriate method discriminant and return the already-defined TronSignTransactionRpcResponseData / TronSendTransactionRpcResponseData types.

Test plan

  • Type-checks clean (npx tsc --noEmit)
  • Integration tests pass (yarn test:integration)

Integration tests cover all four wallet ownership configurations (ownerless, key-owned, user-owned, quorum-owned). signTransaction is verified cryptographically by recovering the signer's public key from the response via secp256k1 and comparing the derived Tron address. sendTransaction is skipped to avoid expending testnet funds.

…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
@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown

⚠️ This PR targets main.

Feature branches in this SDK should target nextmain is reserved for release PRs.
Please change the base branch to next (or another stacked feature branch). If you believe main really is the right target, let a maintainer know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant