refactor: extract more bridge-status-controller calls to utils#8215
refactor: extract more bridge-status-controller calls to utils#8215
Conversation
8eca356 to
682da9c
Compare
4f33f5d to
8cade9a
Compare
squash accounts squash accounts accounts
non evm submit
fix: gas tests refactor: extract more transaction controller utils transaction refactor: move txDataByType to addTransactionBatch util
71783df to
72a6c00
Compare
| jest.spyOn(Date, 'now').mockReturnValueOnce(1234567890); | ||
| jest.spyOn(Date, 'now').mockReturnValueOnce(1234567891); |
There was a problem hiding this comment.
Added Date.now mocks for more accurate actionId snapshot tests, and to make sure actionId usage is preserved after submitTx and submiIntent are unified
| StatusResponse, | ||
| } from '../types'; | ||
|
|
||
| describe('History Utils', () => { |
There was a problem hiding this comment.
Moved these tests from transaction.test.ts
|
|
||
| describe('getIntentFromQuote', () => { | ||
| it('returns intent when present in quote response', () => { | ||
| const mockIntent = { protocol: 'cowswap', order: { some: 'data' } }; |
There was a problem hiding this comment.
Moved from transaction.test.ts
| clientId: BridgeClientId, | ||
| ): Promise<IntentStatusResponse> { | ||
| const endpoint = `${this.#baseUrl}/submitOrder`; | ||
| try { |
There was a problem hiding this comment.
Replaced this with a pure function postSubmitOrder to decouple it from the IntentApi classes. This is in preparation for submitTx+submitIntent unification
| bridgeTxMeta: txMeta, // Only the id field is used by the BridgeStatusController | ||
| statusRequest: { | ||
| ...getStatusRequestParams(quoteResponse), | ||
| srcTxHash: txMeta.hash, |
There was a problem hiding this comment.
The statusRequest's data is also present in quoteResponse and bridgeTxMeta so this is ok to remove
packages/bridge-status-controller/src/bridge-status-controller.intent.test.ts
Show resolved
Hide resolved
packages/bridge-status-controller/src/bridge-status-controller.intent.ts
Show resolved
Hide resolved
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Explanation
Changes
postSubmitOrdersubmitTx + submitIntentrefactorReferences
Fixes https://consensyssoftware.atlassian.net/browse/SWAPS-4229
Checklist
Note
Medium Risk
Medium risk because it refactors transaction submission, history keying, and intent-order submission/polling paths; behavior changes around
txHash/action IDs and batching could affect bridge/swap tracking if edge cases are missed.Overview
Refactors
bridge-status-controllerby moving more transaction-handling logic intoutils/transaction(e.g.,submitEvmTransaction,addTransactionBatch, tx lookup/update helpers, delegated-account check) and shifting gas-fee estimation helpers out ofutils/gas.Intent order submission is changed from
IntentApiImpl.submitIntentto a purepostSubmitOrderfunction, and intent polling/translation now treats missing hashes asundefined(not empty string) while updating transactions via shared transaction helpers.History handling is tightened:
StartPollingForBridgeTxStatusArgsno longer requires astatusRequest, history keys can fall back tooriginalTransactionId, and newutils/historytests cover rekeying and key selection; snapshots/tests are updated accordingly (including added coverage forhandleNonEvmTxresponse shapes and updated metrics tracking expectations).Written by Cursor Bugbot for commit 3ab2f3b. This will update automatically on new commits. Configure here.