-
-
Notifications
You must be signed in to change notification settings - Fork 268
feat(bridge-status): add polling for Tron same-chain swaps #7697
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
Tron swaps use async settlement and need polling to get the destination tx hash. This is used to filter duplicate receive transactions in the activity list.
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 3 potential issues.
packages/bridge-status-controller/src/bridge-status-controller.ts
Outdated
Show resolved
Hide resolved
packages/bridge-status-controller/src/bridge-status-controller.ts
Outdated
Show resolved
Hide resolved
| // Tron same-chain swaps use async settlement and need polling | ||
| const isTronSameChainSwap = | ||
| !isBridgeTx && !isIntent && isTronChainId(historyItem.quote.srcChainId); |
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.
Polling needs to be done for Tron bridge txs too so this should just check for isTronChainId
| this.#startPollingForTxId(txMeta.id); | ||
| // Track non-EVM Swap completed event | ||
| if (!isBridgeTx) { | ||
| if (!isBridgeTx && !isTronSameChainSwap) { |
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.
Same here - both swaps and bridges will be polled so the Completed event can't be published until we get a txStatus
| if (!isBridgeTx && !isTronSameChainSwap) { | |
| if (!(isBridgeTx || isTronTx)) { |
Tron swaps use async settlement and need polling to get the destination tx hash. This is used to filter duplicate receive transactions in the activity list.
Explanation
References
Related to: MetaMask/metamask-extension#39446, fixes a bug where async tron swaps are rendered as receives/sends in the activity list.
Checklist
Note
Enables async settlement handling for Tron same-chain swaps by starting status polling and refining when polling is (re)started.
#shouldPollHistoryItemto centralize polling decisions (polls forbridge,intent, and Tron same-chain swaps) and uses it in resume/restart polling pathssubmitTx, detectsisTronSameChainSwap, starts polling for non-EVM, and avoids immediateCompletedtracking for Tron same-chain swaps (will complete via polling)isTronChainIdfrombridge-controllerfor use in status controllerWritten by Cursor Bugbot for commit 1da7003. This will update automatically on new commits. Configure here.