From 705665af9922332cfd98fe559885934c2188121e Mon Sep 17 00:00:00 2001 From: 0xh3rman <119309671+0xh3rman@users.noreply.github.com> Date: Wed, 25 Mar 2026 09:44:50 +0900 Subject: [PATCH 1/3] feat(okx): enable all supported EVM chains Add 18 new EVM chains: Ethereum, SmartChain, Polygon, Arbitrum, Optimism, AvalancheC, OpBNB, Fantom, Gnosis, Blast, ZkSync, Linea, Celo, Sonic, Abstract, Berachain, Unichain, Monad Use default 800000 gas limit for EVM chains, with overrides only for Manta (600000), ZkSync (2000000), and Mantle (2000000000). --- packages/swapper/src/okx/constants.ts | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/packages/swapper/src/okx/constants.ts b/packages/swapper/src/okx/constants.ts index e2a4526..6347533 100644 --- a/packages/swapper/src/okx/constants.ts +++ b/packages/swapper/src/okx/constants.ts @@ -2,9 +2,27 @@ import { Chain } from "@gemwallet/types"; export const CHAIN_INDEX: Record = { [Chain.Solana]: "501", + [Chain.Ethereum]: "1", + [Chain.SmartChain]: "56", + [Chain.Polygon]: "137", + [Chain.Arbitrum]: "42161", + [Chain.Optimism]: "10", [Chain.Base]: "8453", + [Chain.AvalancheC]: "43114", + [Chain.OpBNB]: "204", + [Chain.Fantom]: "250", + [Chain.Gnosis]: "100", [Chain.Manta]: "169", + [Chain.Blast]: "81457", + [Chain.ZkSync]: "324", + [Chain.Linea]: "59144", [Chain.Mantle]: "5000", + [Chain.Celo]: "42220", + [Chain.Sonic]: "146", + [Chain.Abstract]: "2741", + [Chain.Berachain]: "80094", + [Chain.Unichain]: "130", + [Chain.Monad]: "143", [Chain.XLayer]: "196", }; @@ -31,13 +49,13 @@ export const SOLANA_CHAIN_INDEX = CHAIN_INDEX[Chain.Solana]; export const SOLANA_NATIVE_TOKEN_ADDRESS = "11111111111111111111111111111111"; export const SOLANA_DEX_IDS_PARAM = SOLANA_DEX_IDS.join(","); export const DEFAULT_SLIPPAGE_PERCENT = "1"; +const DEFAULT_EVM_GAS_LIMIT = "800000"; const EVM_GAS_LIMITS: Partial> = { - [Chain.Base]: "800000", [Chain.Manta]: "600000", + [Chain.ZkSync]: "2000000", [Chain.Mantle]: "2000000000", - [Chain.XLayer]: "800000", }; -export function evmGasLimit(chain: Chain): string | undefined { - return EVM_GAS_LIMITS[chain]; +export function evmGasLimit(chain: Chain): string { + return EVM_GAS_LIMITS[chain] ?? DEFAULT_EVM_GAS_LIMIT; } From f425386ec8c9a13a7c0ed11c7e61acb372dc338c Mon Sep 17 00:00:00 2001 From: 0xh3rman <119309671+0xh3rman@users.noreply.github.com> Date: Wed, 25 Mar 2026 21:05:35 +0900 Subject: [PATCH 2/3] Update constants.ts --- packages/swapper/src/okx/constants.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/swapper/src/okx/constants.ts b/packages/swapper/src/okx/constants.ts index 6347533..b6dac87 100644 --- a/packages/swapper/src/okx/constants.ts +++ b/packages/swapper/src/okx/constants.ts @@ -49,7 +49,7 @@ export const SOLANA_CHAIN_INDEX = CHAIN_INDEX[Chain.Solana]; export const SOLANA_NATIVE_TOKEN_ADDRESS = "11111111111111111111111111111111"; export const SOLANA_DEX_IDS_PARAM = SOLANA_DEX_IDS.join(","); export const DEFAULT_SLIPPAGE_PERCENT = "1"; -const DEFAULT_EVM_GAS_LIMIT = "800000"; +const DEFAULT_EVM_GAS_LIMIT = "920000"; const EVM_GAS_LIMITS: Partial> = { [Chain.Manta]: "600000", [Chain.ZkSync]: "2000000", From 97fd5299886aa4dc7598c982ed635556f987ca11 Mon Sep 17 00:00:00 2001 From: 0xh3rman <119309671+0xh3rman@users.noreply.github.com> Date: Wed, 25 Mar 2026 22:14:22 +0900 Subject: [PATCH 3/3] fix tests --- packages/swapper/src/okx/constants.ts | 2 +- packages/swapper/src/okx/integration.test.ts | 4 ++-- packages/swapper/src/okx/provider.test.ts | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/swapper/src/okx/constants.ts b/packages/swapper/src/okx/constants.ts index b6dac87..a6088ae 100644 --- a/packages/swapper/src/okx/constants.ts +++ b/packages/swapper/src/okx/constants.ts @@ -49,7 +49,7 @@ export const SOLANA_CHAIN_INDEX = CHAIN_INDEX[Chain.Solana]; export const SOLANA_NATIVE_TOKEN_ADDRESS = "11111111111111111111111111111111"; export const SOLANA_DEX_IDS_PARAM = SOLANA_DEX_IDS.join(","); export const DEFAULT_SLIPPAGE_PERCENT = "1"; -const DEFAULT_EVM_GAS_LIMIT = "920000"; +export const DEFAULT_EVM_GAS_LIMIT = "920000"; const EVM_GAS_LIMITS: Partial> = { [Chain.Manta]: "600000", [Chain.ZkSync]: "2000000", diff --git a/packages/swapper/src/okx/integration.test.ts b/packages/swapper/src/okx/integration.test.ts index 88e7ca3..e80a8e6 100644 --- a/packages/swapper/src/okx/integration.test.ts +++ b/packages/swapper/src/okx/integration.test.ts @@ -5,7 +5,7 @@ import { Chain, QuoteRequest } from "@gemwallet/types"; import { createOkxEvmQuoteRequest, createSolanaUsdcQuoteRequest } from "../testkit/mock"; import { OkxDexClient } from "./client"; -import { CHAIN_INDEX } from "./constants"; +import { CHAIN_INDEX, DEFAULT_EVM_GAS_LIMIT } from "./constants"; import { OkxProvider } from "./provider"; const OKX_ENV_KEYS = ["OKX_API_KEY", "OKX_SECRET_KEY", "OKX_API_PASSPHRASE", "OKX_PROJECT_ID"]; @@ -88,7 +88,7 @@ describe("OKX live integration", () => { expect(quoteData.dataType).toBe("contract"); expect(quoteData.data).toMatch(/^0x/); - expect(quoteData.gasLimit).toBe("800000"); + expect(quoteData.gasLimit).toBe(DEFAULT_EVM_GAS_LIMIT); expect(quoteData.approval).toBeUndefined(); }); }); diff --git a/packages/swapper/src/okx/provider.test.ts b/packages/swapper/src/okx/provider.test.ts index 626c37e..d44a86f 100644 --- a/packages/swapper/src/okx/provider.test.ts +++ b/packages/swapper/src/okx/provider.test.ts @@ -7,6 +7,7 @@ import { XLAYER_USD0_ADDRESS, } from "../testkit/mock"; import type { OkxDexClient } from "./client"; +import { DEFAULT_EVM_GAS_LIMIT } from "./constants"; import { OkxProvider } from "./provider"; const SOL_MINT = "11111111111111111111111111111111"; @@ -255,7 +256,7 @@ describe("OkxProvider", () => { expect(result.data).toBe("0xswapCalldata"); expect(result.value).toBe("0"); - expect(result.gasLimit).toBe("800000"); + expect(result.gasLimit).toBe(DEFAULT_EVM_GAS_LIMIT); expect(result.approval).toEqual({ token: XLAYER_USD0_ADDRESS, spender: MOCK_APPROVE_ADDRESS,