feat(tron): decode WithdrawBalanceContract (claim rewards)#377
Open
prasanna-anchorage wants to merge 1 commit into
Open
feat(tron): decode WithdrawBalanceContract (claim rewards)#377prasanna-anchorage wants to merge 1 commit into
prasanna-anchorage wants to merge 1 commit into
Conversation
Add full decoding for WithdrawBalanceContract, the Tron operation that claims accumulated voting / Super Representative rewards into the owner's balance. Previously it fell through to the "(not fully decoded)" catch-all. The contract carries only the owner address; the reward amount is computed on-chain at execution time, so the payload surfaces the contract type and owner. Distinct from WithdrawExpireUnfreeze (claim unfrozen TRX). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Adds full decoding support for Tron’s WithdrawBalanceContract so VisualSign displays a human-readable contract type and owner address when claiming SR/voting rewards (instead of falling back to the generic “not fully decoded” output).
Changes:
- Import
WithdrawBalanceContractfromanychain_tron::protocol::balance_contract. - Add a
decode_contract()match arm to decode and surfaceContract Type+Ownerfortype.googleapis.com/protocol.WithdrawBalanceContract. - Add a synthetic unit test validating the decoded fields and confirming no
Amount/Resourcefields are emitted.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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 full decoding for Tron's
WithdrawBalanceContract— the operation that claims accumulated voting / Super Representative rewards into the owner's balance. Previously this contract type fell through to the generic(not fully decoded)catch-all, showing the signer only the rawtype.googleapis.com/protocol.WithdrawBalanceContracttype URL.What it decodes
The contract carries only an
owner_address; the reward amount is computed on-chain at execution time and is not part of the transaction. The payload now surfaces:Contract Type: WithdrawBalance (Claim Rewards)Owner: <base58 address>This is distinct from the already-supported
WithdrawExpireUnfreeze(claim unfrozen TRX).Implementation
WithdrawBalanceContractto theanychain_tron::protocol::balance_contractimport group.decode_contract(), following the existingWithdrawExpireUnfreezepattern.Testing
synthetic_withdraw_balance— builds a transaction programmatically and asserts the contract type, owner field, and the absence of amount/resource fields.cargo test -p visualsign-tron— 23 passedcargo clippy -p visualsign-tron --all-targets -- -D warnings— cleancargo fmtapplied🤖 Generated with Claude Code