Skip to content

feat(transaction-pay-controller): live token balances#7935

Open
matthewwalsh0 wants to merge 1 commit intomainfrom
feat/transaction-pay-live-balances
Open

feat(transaction-pay-controller): live token balances#7935
matthewwalsh0 wants to merge 1 commit intomainfrom
feat/transaction-pay-live-balances

Conversation

@matthewwalsh0
Copy link
Member

@matthewwalsh0 matthewwalsh0 commented Feb 13, 2026

Explanation

Use live on-chain balance checks to improve stability:

  • Before each quote update, refresh the payment token balance via balanceOf or eth_getBalance.
  • Before submitting relay deposit transactions, validate the source balance is sufficient.

References

Checklist

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

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. updateQuotes now refreshes the selected payment token’s balance via a new getLiveTokenBalance RPC read before building quote requests, and uses that live balance when sending sourceBalanceRaw to 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.raw and throws before submitting single or batched transactions when the balance is too low.

Internally this introduces shared amount formatting via computeTokenAmounts, adds @ethersproject/providers to support the new RPC reads, adjusts payment-token change detection to compare address/chainId (case-insensitive), and updates tests/changelog accordingly.

Written by Cursor Bugbot for commit 3084450. This will update automatically on new commits. Configure here.

@matthewwalsh0 matthewwalsh0 changed the title feat: Add live on-chain balance validation for pay transactions feat(transaction-pay-controller): live token balances Feb 13, 2026
@matthewwalsh0 matthewwalsh0 force-pushed the feat/transaction-pay-live-balances branch from 44986a4 to 3084450 Compare February 13, 2026 23:59
@matthewwalsh0 matthewwalsh0 marked this pull request as ready for review February 14, 2026 00:06
@matthewwalsh0 matthewwalsh0 requested review from a team as code owners February 14, 2026 00:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant