Skip to content

Commit 7e1104f

Browse files
fix(check-order-status): fall back to 12s block time for unsupported chains
getAverageBlockTimeSecs throws for chains not yet registered in sdk-core (e.g. Sepolia / chainId 11155111). This causes the check-order-status step function to crash on every retry for any order posted on those chains, surfacing as repeated TaskFailed errors: Error: getAverageBlockTimeSecs: unsupported chainId 11155111; register it in chains.ts before use Wrap the call in a try/catch and fall back to 12 s (Ethereum PoS slot time) so status tracking degrades gracefully instead of looping forever. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent f19a3c3 commit 7e1104f

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

  • lib/handlers/check-order-status

lib/handlers/check-order-status/util.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,16 @@ export function getRelaySettledAmounts(fill: FillInfo, parsedOrder: RelayOrder):
248248
// `calculateDutchRetryWaitSeconds` floor stay correct as chain cadence
249249
// changes. Sub-second values are intentional for accurate block-number
250250
// arithmetic in `timestampToBlockNumber`.
251-
export const AVERAGE_BLOCK_TIME = (chainId: ChainId): number => getAverageBlockTimeSecs(chainId)
251+
// Falls back to 12 s (Ethereum PoS slot time) for chains not yet registered
252+
// in sdk-core (e.g. Sepolia, new L2s added via SUPPORTED_CHAINS before the
253+
// SDK is updated).
254+
export const AVERAGE_BLOCK_TIME = (chainId: ChainId): number => {
255+
try {
256+
return getAverageBlockTimeSecs(chainId)
257+
} catch {
258+
return 12
259+
}
260+
}
252261

253262
// Approximate block number from timestamp
254263
export function timestampToBlockNumber(

0 commit comments

Comments
 (0)