From 7898ce0022226818ae624f2b856a1e0f24f0cb8c Mon Sep 17 00:00:00 2001 From: Stanley Yuen <102275989+stanleyyconsensys@users.noreply.github.com> Date: Tue, 27 May 2025 10:11:47 +0800 Subject: [PATCH 1/2] feat: support sei --- src/SwapsController.test.ts | 3 +++ src/SwapsController.ts | 2 ++ src/constants.ts | 20 ++++++++++++++++++++ 3 files changed, 25 insertions(+) diff --git a/src/SwapsController.test.ts b/src/SwapsController.test.ts index 7fa6b916..0de981c4 100644 --- a/src/SwapsController.test.ts +++ b/src/SwapsController.test.ts @@ -54,6 +54,7 @@ const { LINEA_CHAIN_ID, OPTIMISM_CHAIN_ID, POLYGON_CHAIN_ID, + SEI_CHAIN_ID, SWAPS_CONTRACT_ADDRESSES, SWAPS_TESTNET_CHAIN_ID, ZKSYNC_ERA_CHAIN_ID, @@ -71,6 +72,7 @@ const INITIAL_CONTROLLER_OPTIONS = { swapsUtil.SWAPS_TESTNET_CHAIN_ID, swapsUtil.POLYGON_CHAIN_ID, swapsUtil.AVALANCHE_CHAIN_ID, + swapsUtil.SEI_CHAIN_ID, ], clientId: undefined, }; @@ -3615,6 +3617,7 @@ describe('SwapsController', () => { LINEA_CHAIN_ID, SWAPS_TESTNET_CHAIN_ID, BASE_CHAIN_ID, + SEI_CHAIN_ID, ]) { const chainName = CHAIN_ID_TO_NAME_MAP[chainId]; describe(`given the ID of a network client for ${chainName}`, () => { diff --git a/src/SwapsController.ts b/src/SwapsController.ts index 366d5977..02262653 100644 --- a/src/SwapsController.ts +++ b/src/SwapsController.ts @@ -52,6 +52,7 @@ import { NATIVE_SWAPS_TOKEN_ADDRESS, OPTIMISM_CHAIN_ID, POLYGON_CHAIN_ID, + SEI_CHAIN_ID, shouldEnableDirectWrapping, SWAPS_TESTNET_CHAIN_ID, SwapsError, @@ -541,6 +542,7 @@ export default class SwapsController extends BaseController< SWAPS_TESTNET_CHAIN_ID, POLYGON_CHAIN_ID, AVALANCHE_CHAIN_ID, + SEI_CHAIN_ID, ], clientId, messenger, diff --git a/src/constants.ts b/src/constants.ts index 669f22a3..690d3636 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -23,6 +23,7 @@ export const ZKSYNC_ERA_CHAIN_ID = toHex('324'); export const LINEA_CHAIN_ID = toHex('59144'); export const SWAPS_TESTNET_CHAIN_ID = toHex('1337'); export const BASE_CHAIN_ID = toHex('8453'); +export const SEI_CHAIN_ID = toHex('1329'); export const CHAIN_ID_TO_NAME_MAP: { [key: string]: string } = { [ETH_CHAIN_ID]: 'ethereum', @@ -35,6 +36,7 @@ export const CHAIN_ID_TO_NAME_MAP: { [key: string]: string } = { [LINEA_CHAIN_ID]: 'linea', [SWAPS_TESTNET_CHAIN_ID]: 'ethereum', [BASE_CHAIN_ID]: 'base', + [SEI_CHAIN_ID]: 'sei', }; //* APIs base urls @@ -63,6 +65,8 @@ export const LINEA_SWAPS_CONTRACT_ADDRESS = '0x9dda6ef3d919c9bc8885d5560999a3640431e8e6'; export const BASE_SWAPS_CONTRACT_ADDRESS = '0x9dda6ef3d919c9bc8885d5560999a3640431e8e6'; +export const SEI_SWAPS_CONTRACT_ADDRESS = + '0x962287c9d5B8a682389E61edAE90ec882325d08b'; export const WETH_CONTRACT_ADDRESS = '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2'; @@ -82,6 +86,8 @@ export const WETH_LINEA_CONTRACT_ADDRESS = '0xe5D7C2a44FfDDf6b295A15c148167daaAf5Cf34f'; export const WETH_BASE_CONTRACT_ADDRESS = '0x4200000000000000000000000000000000000006'; +export const WSEI_SEI_CONTRACT_ADDRESS = + '0x027D2E627209f1cebA52ADc8A5aFE9318459b44B'; export const SWAPS_WRAPPED_TOKENS_ADDRESSES: { [key: string]: string } = { [ETH_CHAIN_ID]: WETH_CONTRACT_ADDRESS, @@ -94,6 +100,7 @@ export const SWAPS_WRAPPED_TOKENS_ADDRESSES: { [key: string]: string } = { [ZKSYNC_ERA_CHAIN_ID]: WETH_ZKSYNC_ERA_CONTRACT_ADDRESS, [LINEA_CHAIN_ID]: WETH_LINEA_CONTRACT_ADDRESS, [BASE_CHAIN_ID]: WETH_BASE_CONTRACT_ADDRESS, + [SEI_CHAIN_ID]: WSEI_SEI_CONTRACT_ADDRESS, }; export const SWAPS_CONTRACT_ADDRESSES: { [key: string]: string } = { @@ -107,6 +114,7 @@ export const SWAPS_CONTRACT_ADDRESSES: { [key: string]: string } = { [ZKSYNC_ERA_CHAIN_ID]: ZKSYNC_ERA_SWAPS_CONTRACT_ADDRESS, [LINEA_CHAIN_ID]: LINEA_SWAPS_CONTRACT_ADDRESS, [BASE_CHAIN_ID]: BASE_SWAPS_CONTRACT_ADDRESS, + [SEI_CHAIN_ID]: SEI_SWAPS_CONTRACT_ADDRESS, }; export const ALLOWED_CONTRACT_ADDRESSES: { [key: string]: string[] } = { @@ -150,6 +158,10 @@ export const ALLOWED_CONTRACT_ADDRESSES: { [key: string]: string[] } = { SWAPS_CONTRACT_ADDRESSES[BASE_CHAIN_ID], SWAPS_WRAPPED_TOKENS_ADDRESSES[BASE_CHAIN_ID], ], + [SEI_CHAIN_ID]: [ + SWAPS_CONTRACT_ADDRESSES[SEI_CHAIN_ID], + SWAPS_WRAPPED_TOKENS_ADDRESSES[SEI_CHAIN_ID], + ], }; //* Tokens @@ -185,6 +197,13 @@ export const AVALANCHE_SWAPS_TOKEN_OBJECT: SwapsToken = { decimals: 18, }; +export const SEI_SWAPS_TOKEN_OBJECT: SwapsToken = { + symbol: 'SEI', + name: 'Sei', + address: NATIVE_SWAPS_TOKEN_ADDRESS, + decimals: 18, +}; + export const ARBITRUM_SWAPS_TOKEN_OBJECT: SwapsToken = { ...ETH_SWAPS_TOKEN_OBJECT, }; @@ -216,6 +235,7 @@ export const SWAPS_NATIVE_TOKEN_OBJECTS: { [key: string]: SwapsToken } = { [ZKSYNC_ERA_CHAIN_ID]: ZKSYNC_ERA_SWAPS_TOKEN_OBJECT, [LINEA_CHAIN_ID]: LINEA_SWAPS_TOKEN_OBJECT, [BASE_CHAIN_ID]: BASE_SWAPS_TOKEN_OBJECT, + [SEI_CHAIN_ID]: SEI_SWAPS_TOKEN_OBJECT, }; //* Other From 80dfde624a651eb986ada69cc1e30c672402bd60 Mon Sep 17 00:00:00 2001 From: Stanley Yuen <102275989+stanleyyconsensys@users.noreply.github.com> Date: Tue, 27 May 2025 10:33:05 +0800 Subject: [PATCH 2/2] chore: update wsei address --- src/constants.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/constants.ts b/src/constants.ts index 690d3636..f3154c57 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -87,7 +87,7 @@ export const WETH_LINEA_CONTRACT_ADDRESS = export const WETH_BASE_CONTRACT_ADDRESS = '0x4200000000000000000000000000000000000006'; export const WSEI_SEI_CONTRACT_ADDRESS = - '0x027D2E627209f1cebA52ADc8A5aFE9318459b44B'; + '0xe30fedd158a2e3b13e9badaeabafc5516e95e8c7'; export const SWAPS_WRAPPED_TOKENS_ADDRESSES: { [key: string]: string } = { [ETH_CHAIN_ID]: WETH_CONTRACT_ADDRESS,