From 8535efc4f619bab342ee3bbf9e654bb57479a49e Mon Sep 17 00:00:00 2001 From: gabrielstoica Date: Fri, 27 Feb 2026 18:29:14 +0200 Subject: [PATCH 1/2] fix: handle zero swap tx gas value in 'executeSwapQuote' --- packages/sdk/src/actions/executeSwapQuote.ts | 102 +++++++++---------- 1 file changed, 51 insertions(+), 51 deletions(-) diff --git a/packages/sdk/src/actions/executeSwapQuote.ts b/packages/sdk/src/actions/executeSwapQuote.ts index 7939a31..dd1a71d 100644 --- a/packages/sdk/src/actions/executeSwapQuote.ts +++ b/packages/sdk/src/actions/executeSwapQuote.ts @@ -13,68 +13,68 @@ export type SwapExecutionProgress = SwapTransactionProgress; type SwapTransactionProgress = | { - step: "approve"; - status: "idle"; - } + step: "approve"; + status: "idle"; + } | { - step: "approve"; - status: "simulationPending"; - } + step: "approve"; + status: "simulationPending"; + } | { - step: "approve"; - status: "simulationSuccess"; - } + step: "approve"; + status: "simulationSuccess"; + } | { - step: "approve"; - status: "txPending"; - txHash: Hash; - } + step: "approve"; + status: "txPending"; + txHash: Hash; + } | { - step: "approve"; - status: "txSuccess"; - txReceipt: TransactionReceipt; - } + step: "approve"; + status: "txSuccess"; + txReceipt: TransactionReceipt; + } | { - step: "swap"; - status: "idle"; - } + step: "swap"; + status: "idle"; + } | { - step: "swap"; - status: "simulationPending"; - } + step: "swap"; + status: "simulationPending"; + } | { - step: "swap"; - status: "simulationSuccess"; - } + step: "swap"; + status: "simulationSuccess"; + } | { - step: "swap"; - status: "txPending"; - txHash: Hash; - } + step: "swap"; + status: "txPending"; + txHash: Hash; + } | { - step: "swap"; - status: "txSuccess"; - txReceipt: TransactionReceipt; - depositId: bigint; - depositLog: ReturnType; - } + step: "swap"; + status: "txSuccess"; + txReceipt: TransactionReceipt; + depositId: bigint; + depositLog: ReturnType; + } | { - step: "fill"; - status: "txPending"; - } + step: "fill"; + status: "txPending"; + } | { - step: "fill"; - status: "txSuccess"; - txReceipt: TransactionReceipt; - fillTxTimestamp: bigint; - actionSuccess: boolean | undefined; - fillLog: ReturnType; - } + step: "fill"; + status: "txSuccess"; + txReceipt: TransactionReceipt; + fillTxTimestamp: bigint; + actionSuccess: boolean | undefined; + fillLog: ReturnType; + } | { - step: "approve" | "swap" | "fill"; - status: "txError" | "error" | "simulationError"; - error: Error; - }; + step: "approve" | "swap" | "fill"; + status: "txError" | "error" | "simulationError"; + error: Error; + }; /** * Params for {@link executeSwapQuote}. @@ -269,7 +269,7 @@ export async function executeSwapQuote( to: swapTx.to as Address, data: swapTx.data as Hex, value: swapTx.value ? BigInt(swapTx.value) : 0n, - gas: swapTx.gas ? BigInt(swapTx.gas) : undefined, + gas: swapTx.gas && BigInt(swapTx.gas) > 0n ? BigInt(swapTx.gas) : undefined, maxFeePerGas: swapTx.maxFeePerGas ? BigInt(swapTx.maxFeePerGas) : undefined, From 2b74fbf01e1c687760ea410db0ddf40d26246aa1 Mon Sep 17 00:00:00 2001 From: Dong-Ha Kim Date: Mon, 27 Apr 2026 16:02:17 +0700 Subject: [PATCH 2/2] chore: add changeset for zero swap gas fix Co-Authored-By: Claude Opus 4.7 (1M context) --- .changeset/fix-zero-gas-value.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/fix-zero-gas-value.md diff --git a/.changeset/fix-zero-gas-value.md b/.changeset/fix-zero-gas-value.md new file mode 100644 index 0000000..a11c48f --- /dev/null +++ b/.changeset/fix-zero-gas-value.md @@ -0,0 +1,5 @@ +--- +"@across-protocol/app-sdk": patch +--- + +Fix `executeSwapQuote` passing `gas: 0n` to the simulation call when `swapTx.gas` is zero. Some RPC providers (e.g. Alchemy on testnets) reject `eth_call` with `gas: "0x0"` as `IntrinsicGasTooLowError`. Zero-ish gas values are now treated as unset.