fix(transaction-pay-controller): use Infura endpoint for live token balance queries#8839
Merged
Conversation
77eee8b to
a9de394
Compare
4c70b63 to
8350c8e
Compare
aa7c99a to
2b7b6e0
Compare
…rams with generic return type
…ting after rpcRequest refactor
…pe param name, unused import, unnecessary casts
2472294 to
4ca5364
Compare
OGPoyraz
approved these changes
Jun 1, 2026
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
When querying a live on-chain token balance, the controller previously resolved the network client using
findNetworkClientIdByChainId, which returns whatever endpoint is currently selected for that chain — including custom RPC endpoints. Custom RPC endpoints may not support thependingblock tag used by these calls, causing the query to fail.This change adds a preference for the chain's Infura endpoint when one is configured, falling back to the existing
findNetworkClientIdByChainIdbehaviour if no Infura endpoint is configured or if the lookup throws.References
Checklist
Note
Medium Risk
Changes which RPC endpoint serves balance checks and on-chain amount reads before Relay submit; wrong endpoint selection could block or mis-validate pay deposits, though Infura preference falls back to the default client.
Overview
Introduces shared
providerutilities (getNetworkClientId,rpcRequest) so chain RPC calls go through the controller messenger’sprovider.requestinstead of ethersWeb3Provider/Contract.Live token balances (
getLiveTokenBalance) now calleth_getBalance/eth_callwith thependingblock tag and passpreferInfura: true, picking the chain’s InfuranetworkClientIdwhen configured and otherwise usingfindNetworkClientIdByChainId—addressing failures on custom RPCs that don’t support pending queries.The same RPC helper path is used for fiat source amount resolution and transfer amount from tx hash (receipt logs,
debug_traceTransaction,eth_getTransactionByHash). Across, Relay, and gas estimation call sites switch togetNetworkClientIdfor consistency.Messenger
AllowedActionsand test mocks registerNetworkController:getNetworkConfigurationByChainId. Changelog documents the Infura preference for live balance queries.Reviewed by Cursor Bugbot for commit 4ca5364. Bugbot is set up for automated code reviews on this repo. Configure here.