-
-
Notifications
You must be signed in to change notification settings - Fork 267
feat: add network fallback mechanism to IncomingTransactionHelper #7759
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…ingTransactionHelper
packages/transaction-controller/src/helpers/IncomingTransactionHelper.ts
Outdated
Show resolved
Hide resolved
packages/transaction-controller/src/helpers/IncomingTransactionHelper.test.ts
Outdated
Show resolved
Hide resolved
packages/transaction-controller/src/helpers/IncomingTransactionHelper.ts
Outdated
Show resolved
Hide resolved
packages/transaction-controller/src/helpers/IncomingTransactionHelper.ts
Outdated
Show resolved
Hide resolved
packages/transaction-controller/src/helpers/IncomingTransactionHelper.ts
Outdated
Show resolved
Hide resolved
packages/transaction-controller/src/helpers/IncomingTransactionHelper.ts
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
packages/transaction-controller/src/helpers/IncomingTransactionHelper.ts
Show resolved
Hide resolved
|
|
||
| this.#onInterval().catch((error) => { | ||
| log('Initial polling failed', error); | ||
| log('Polling failed', error); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was intentional to distinguish that the first attempt failed, rather than a future interval based one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR is updated
| for (const caip2ChainId of chainIds) { | ||
| const hexChainId = this.#caip2ToHex(caip2ChainId); | ||
|
|
||
| if (!hexChainId || !SUPPORTED_CHAIN_IDS.includes(hexChainId)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we adding the dynamic supported chains via /supportedNetworks in a separate ticket?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add a log here for helpful debug, maybe separately if chain ID not recognised or if not supported?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For dynamic chain support yes a separate task will be better as it will require changes in AccountsApiRemoteTransactionSource
I added log to the PR
| }); | ||
| } | ||
| } else if (!this.#chainsToPoll.includes(hexChainId)) { | ||
| // status === 'down' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we be explicit in case they ever add more statuses?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR is updated
| } | ||
|
|
||
| if (!hasChanges) { | ||
| return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another log for good debug?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR is updated
Explanation
In incoming transaction helper if any chain goes down on web sockets, start polling for it.
References
Fixes #12345
Checklist
Note
Medium Risk
Changes incoming transaction retrieval control flow by dynamically starting/stopping polling based on backend network status events, which could affect update frequency and chain coverage if status events or chain-ID parsing behave unexpectedly.
Overview
Adds a network fallback for WebSocket-based incoming transaction retrieval. When
isIncomingTransactionsUseWebsocketsEnabledis on,IncomingTransactionHelpernow subscribes toAccountActivityService:statusChanged, tracks which supported chains are currently "down", and starts/stops a polling loop accordingly; interval polls are scoped to only the affectedchainIds.Plumbs chain scoping through the remote fetch path.
RemoteTransactionSourceRequestgains optionalchainIds,AccountsApiRemoteTransactionSource.fetchTransactionsuses it (defaulting toSUPPORTED_CHAIN_IDS),TransactionControllerallows the new status event, and tests/changelog are updated to cover the fallback behavior.Written by Cursor Bugbot for commit efcd59e. This will update automatically on new commits. Configure here.