feat(transaction-pay-controller): live token balances#7935
Open
matthewwalsh0 wants to merge 1 commit intomainfrom
Open
feat(transaction-pay-controller): live token balances#7935matthewwalsh0 wants to merge 1 commit intomainfrom
matthewwalsh0 wants to merge 1 commit intomainfrom
Conversation
44986a4 to
3084450
Compare
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.
Explanation
Use live on-chain balance checks to improve stability:
balanceOforeth_getBalance.References
Checklist
Note
Medium Risk
Adds new live RPC calls and pre-submit balance gating that can change quote/submit behavior and may surface new failure modes under RPC latency/outages; core transaction submission paths are affected but are covered by updated tests and safe fallback in quoting.
Overview
Adds live on-chain balance checks to pay flows.
updateQuotesnow refreshes the selected payment token’s balance via a newgetLiveTokenBalanceRPC read before building quote requests, and uses that live balance when sendingsourceBalanceRawto strategies (falling back to the existing cached balance if the live fetch fails).Prevents Relay deposits with insufficient funds. Relay submission now validates the current on-chain source token balance against the quote’s required
sourceAmount.rawand throws before submitting single or batched transactions when the balance is too low.Internally this introduces shared amount formatting via
computeTokenAmounts, adds@ethersproject/providersto support the new RPC reads, adjusts payment-token change detection to compareaddress/chainId(case-insensitive), and updates tests/changelog accordingly.Written by Cursor Bugbot for commit 3084450. This will update automatically on new commits. Configure here.