From 146a06667455f6b71ed892defa3054c57bba2672 Mon Sep 17 00:00:00 2001 From: pedromcunha Date: Tue, 13 Jan 2026 21:48:42 -0500 Subject: [PATCH 1/5] Improve status timeout error logs --- packages/sdk/src/errors/DepositTransactionTimeoutError.ts | 5 +++-- packages/sdk/src/errors/SolverStatusTimeoutError.ts | 6 ++++-- packages/sdk/src/utils/transaction.ts | 7 ++++++- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/packages/sdk/src/errors/DepositTransactionTimeoutError.ts b/packages/sdk/src/errors/DepositTransactionTimeoutError.ts index 8de6cad59..8436d91e5 100644 --- a/packages/sdk/src/errors/DepositTransactionTimeoutError.ts +++ b/packages/sdk/src/errors/DepositTransactionTimeoutError.ts @@ -1,11 +1,12 @@ export class DepositTransactionTimeoutError extends Error { txHash: `0x${string}` - constructor(txHash: `0x${string}`, attemptCount: number) { + constructor(txHash: `0x${string}`, requestId: string, attemptCount: number) { super( - `Deposit transaction with hash '${txHash}' is pending after ${attemptCount} attempt(s).` + `Deposit transaction with hash '${txHash}' and request id '${requestId}' is pending after ${attemptCount} attempt(s).` ) this.name = 'DepositTransactionTimeoutError' this.txHash = txHash + this.requestId = requestId } } diff --git a/packages/sdk/src/errors/SolverStatusTimeoutError.ts b/packages/sdk/src/errors/SolverStatusTimeoutError.ts index 820c61fe7..3f2c510d6 100644 --- a/packages/sdk/src/errors/SolverStatusTimeoutError.ts +++ b/packages/sdk/src/errors/SolverStatusTimeoutError.ts @@ -1,11 +1,13 @@ export class SolverStatusTimeoutError extends Error { txHash: `0x${string}` + requestId: string - constructor(txHash: `0x${string}`, attemptCount: number) { + constructor(txHash: `0x${string}`, requestId: string, attemptCount: number) { super( - `Failed to receive a successful response for solver status check with hash '${txHash}' after ${attemptCount} attempt(s).` + `Failed to receive a successful response for solver status check with hash '${txHash}' and request id '${requestId}' after ${attemptCount} attempt(s).` ) this.name = 'SolverStatusTimeoutError' this.txHash = txHash + this.requestId = requestId } } diff --git a/packages/sdk/src/utils/transaction.ts b/packages/sdk/src/utils/transaction.ts index 99397edd1..378892f89 100644 --- a/packages/sdk/src/utils/transaction.ts +++ b/packages/sdk/src/utils/transaction.ts @@ -347,10 +347,15 @@ export async function sendTransactionSafely( if (attemptCount >= maximumAttempts) { if (receipt) { - throw new SolverStatusTimeoutError(txHash as Address, attemptCount) + throw new SolverStatusTimeoutError( + txHash as Address, + step.requestId ?? '', + attemptCount + ) } else { throw new DepositTransactionTimeoutError( txHash as Address, + step.requestId ?? '', attemptCount ) } From d233944a7e90cbbf19afa1208c423decc888ddbd Mon Sep 17 00:00:00 2001 From: pedromcunha Date: Tue, 13 Jan 2026 21:50:02 -0500 Subject: [PATCH 2/5] feat: changeset --- .changeset/social-tires-search.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/social-tires-search.md diff --git a/.changeset/social-tires-search.md b/.changeset/social-tires-search.md new file mode 100644 index 000000000..719b9a933 --- /dev/null +++ b/.changeset/social-tires-search.md @@ -0,0 +1,5 @@ +--- +'@relayprotocol/relay-sdk': patch +--- + +Improve SolverStatusTimeout error log From 2e3f0ed7e1e8a3f9275b2f47aae6bd012b54bbe8 Mon Sep 17 00:00:00 2001 From: pedromcunha Date: Tue, 13 Jan 2026 22:47:16 -0500 Subject: [PATCH 3/5] Fix build error --- packages/sdk/src/errors/DepositTransactionTimeoutError.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/sdk/src/errors/DepositTransactionTimeoutError.ts b/packages/sdk/src/errors/DepositTransactionTimeoutError.ts index 8436d91e5..fa8c3d47e 100644 --- a/packages/sdk/src/errors/DepositTransactionTimeoutError.ts +++ b/packages/sdk/src/errors/DepositTransactionTimeoutError.ts @@ -1,5 +1,6 @@ export class DepositTransactionTimeoutError extends Error { txHash: `0x${string}` + requestId: string constructor(txHash: `0x${string}`, requestId: string, attemptCount: number) { super( From 08f77a1a1282325f7424da15af9041972d948367 Mon Sep 17 00:00:00 2001 From: pedromcunha Date: Wed, 14 Jan 2026 09:42:02 -0500 Subject: [PATCH 4/5] Fix unit tests --- packages/sdk/src/utils/executeSteps/executeSteps.test.ts | 4 ++-- packages/sdk/tests/data/executeBridge.ts | 3 ++- packages/sdk/tests/data/swapWithApproval.ts | 5 +++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/packages/sdk/src/utils/executeSteps/executeSteps.test.ts b/packages/sdk/src/utils/executeSteps/executeSteps.test.ts index 7665156a4..c47ffb8d8 100644 --- a/packages/sdk/src/utils/executeSteps/executeSteps.test.ts +++ b/packages/sdk/src/utils/executeSteps/executeSteps.test.ts @@ -339,7 +339,7 @@ describe('Should test the executeSteps method.', () => { undefined ) ).rejects.toThrow( - `Deposit transaction with hash '0x' is pending after 1 attempt(s).` + `Deposit transaction with hash '0x' and request id '0xabc' is pending after 1 attempt(s).` ) vi.spyOn(axios, 'request').mockRestore() vi.spyOn(axios, 'request').mockClear() @@ -432,7 +432,7 @@ describe('Should test the executeSteps method.', () => { undefined ) ).rejects.toThrow( - `Failed to receive a successful response for solver status check with hash '0x' after 1 attempt(s).` + `Failed to receive a successful response for solver status check with hash '0x' and and request id '0xabc' after 1 attempt(s).` ) vi.spyOn(axios, 'request').mockRestore() diff --git a/packages/sdk/tests/data/executeBridge.ts b/packages/sdk/tests/data/executeBridge.ts index ffb0b2e84..49d8340c4 100644 --- a/packages/sdk/tests/data/executeBridge.ts +++ b/packages/sdk/tests/data/executeBridge.ts @@ -25,7 +25,8 @@ export const executeBridge: Execute = { "method": "GET" } } - ] + ], + "requestId": "0xabc" } ], "fees": { diff --git a/packages/sdk/tests/data/swapWithApproval.ts b/packages/sdk/tests/data/swapWithApproval.ts index 9e3df0a26..c738b909f 100644 --- a/packages/sdk/tests/data/swapWithApproval.ts +++ b/packages/sdk/tests/data/swapWithApproval.ts @@ -1,4 +1,4 @@ -import { Execute } from '../../src/types' +import type { Execute } from '../../src/types' export const swapWithApproval: Execute = { steps: [ @@ -19,7 +19,8 @@ export const swapWithApproval: Execute = { chainId: 1 } } - ] + ], + requestId: '0xabc' }, { id: 'swap', From 1df4f4b70b311eb265642235747a943c792f5cf0 Mon Sep 17 00:00:00 2001 From: pedromcunha Date: Wed, 14 Jan 2026 10:49:25 -0500 Subject: [PATCH 5/5] Fix unit test error --- .../sdk/src/utils/executeSteps/executeSteps.test.ts | 13 ++++++++----- packages/sdk/tests/data/swapWithApproval.ts | 3 ++- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/packages/sdk/src/utils/executeSteps/executeSteps.test.ts b/packages/sdk/src/utils/executeSteps/executeSteps.test.ts index c47ffb8d8..3f08eed17 100644 --- a/packages/sdk/src/utils/executeSteps/executeSteps.test.ts +++ b/packages/sdk/src/utils/executeSteps/executeSteps.test.ts @@ -117,6 +117,7 @@ const mockAxiosRequest = () => { } if ( config.url?.includes('transactions/index') || + config.url?.includes('/transactions/single') || config.url?.includes('/execute/permits') ) { return Promise.resolve({ @@ -432,7 +433,7 @@ describe('Should test the executeSteps method.', () => { undefined ) ).rejects.toThrow( - `Failed to receive a successful response for solver status check with hash '0x' and and request id '0xabc' after 1 attempt(s).` + `Failed to receive a successful response for solver status check with hash '0x' and request id '0xabc' after 1 attempt(s).` ) vi.spyOn(axios, 'request').mockRestore() @@ -495,6 +496,8 @@ describe('Should test the executeSteps method.', () => { it('Should handle step with id of "approve" by waiting on receipt before polling for confirmation', async () => { const axiosRequestSpy = vi.spyOn(axios, 'request') + client.logLevel = 4 + await executeSteps( 1, {}, @@ -506,12 +509,12 @@ describe('Should test the executeSteps method.', () => { const waitForTransactionReceiptCallIndex = wallet.handleConfirmTransactionStep.mock.invocationCallOrder[0] - const pollForConfirmationCallIndices = axiosRequestSpy.mock.calls - .filter((call) => call[0].url?.includes('/intents/status')) - .map((call, index) => axiosRequestSpy.mock.invocationCallOrder[index]) + const pollForConfirmationCallIndex = axiosRequestSpy.mock.calls.findIndex( + (call) => call[0].url?.includes('/intents/status') + ) expect(waitForTransactionReceiptCallIndex).toBeLessThan( - Math.min(...pollForConfirmationCallIndices) + axiosRequestSpy.mock.invocationCallOrder[pollForConfirmationCallIndex] ) expect(wallet.handleConfirmTransactionStep).toHaveBeenCalledTimes(2) }) diff --git a/packages/sdk/tests/data/swapWithApproval.ts b/packages/sdk/tests/data/swapWithApproval.ts index c738b909f..6cbef128f 100644 --- a/packages/sdk/tests/data/swapWithApproval.ts +++ b/packages/sdk/tests/data/swapWithApproval.ts @@ -44,7 +44,8 @@ export const swapWithApproval: Execute = { method: 'GET' } } - ] + ], + requestId: '0xabc' } ], fees: {