Skip to content

feat(tron): add getMaxSendableAmount client request method - #555

Draft
ulissesferreira wants to merge 2 commits into
WPN-2375-estimate-fees-conservatively-in-onamountinputfrom
WPN-2374-get-max-sendable-amount
Draft

ulissesferreira wants to merge 2 commits into
WPN-2375-estimate-fees-conservatively-in-onamountinputfrom
WPN-2374-get-max-sendable-amount

Conversation

@ulissesferreira

Copy link
Copy Markdown
Contributor

Explanation

Adds the getMaxSendableAmount client request method to the Tron Snap. It returns only { amount }: the maximum amount that can be entered so onAmountInput passes, or 0 when no amount can pass. Fees, balances, and validation errors are intentionally not returned.

The value is derived from the same balance source (getAccountAssetsByIDs), fee limit, and fee/reserve helpers as onAmountInput, without a brute-force search. Native TRX subtracts the network fee and, when toAddress is omitted, the account activation reserve. TRC-20 returns the full token balance when TRX covers the transfer fee, otherwise 0.

References

Ticket: WPN-2374

Stacked on: #554

Checklist

  • I have updated the test suite for new or updated code as appropriate
  • I have communicated my changes to consumers by updating changelogs for packages I have changed
  • I have updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I have introduced breaking changes in this PR and have prepared draft pull requests for clients and consumer packages to resolve them

@ulissesferreira
ulissesferreira force-pushed the WPN-2374-get-max-sendable-amount branch from 9c04a39 to 96c6a10 Compare November 4, 2026 16:52
@ulissesferreira ulissesferreira changed the title feat(tron): add getMaxSendableAmount client request method feat(tron): add getMaxSendableAmount client request method Nov 4, 2026
@ulissesferreira
ulissesferreira force-pushed the WPN-2375-estimate-fees-conservatively-in-onamountinput branch 3 times, most recently from d2514de to d8db631 Compare November 5, 2026 11:23
@ulissesferreira
ulissesferreira force-pushed the WPN-2375-estimate-fees-conservatively-in-onamountinput branch from d8db631 to c5c45f8 Compare November 5, 2026 12:52
Computes the maximum safe amount that can be sent for TRX and TRC-20
assets, with its fee quote. The sent asset and the account resources are
read fresh, so the result never acts on stale balances.

For native TRX sends the maximum leaves enough TRX to cover the network
fees and the account activation; for TRC-20 sends the account must hold
enough TRX to cover the transfer fee. When the destination is omitted,
the conservative case is assumed and the quoted fees include a
conservative account activation reserve.

WPN-2374
@ulissesferreira
ulissesferreira force-pushed the WPN-2374-get-max-sendable-amount branch from 96c6a10 to 5865cae Compare November 5, 2026 15:58
@sonarqubecloud

sonarqubecloud Bot commented Nov 5, 2026

Copy link
Copy Markdown

@ulissesferreira
ulissesferreira force-pushed the WPN-2375-estimate-fees-conservatively-in-onamountinput branch 4 times, most recently from 476d65f to 5366887 Compare November 6, 2026 12:50

This branch has not been deployed

No deployments
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