Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/SwapsController.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
};
Expand Down Expand Up @@ -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}`, () => {
Expand Down
2 changes: 2 additions & 0 deletions src/SwapsController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ import {
NATIVE_SWAPS_TOKEN_ADDRESS,
OPTIMISM_CHAIN_ID,
POLYGON_CHAIN_ID,
SEI_CHAIN_ID,
shouldEnableDirectWrapping,
SWAPS_TESTNET_CHAIN_ID,
SwapsError,
Expand Down Expand Up @@ -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,
Expand Down
20 changes: 20 additions & 0 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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
Expand Down Expand Up @@ -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';
Expand All @@ -82,6 +86,8 @@ export const WETH_LINEA_CONTRACT_ADDRESS =
'0xe5D7C2a44FfDDf6b295A15c148167daaAf5Cf34f';
export const WETH_BASE_CONTRACT_ADDRESS =
'0x4200000000000000000000000000000000000006';
export const WSEI_SEI_CONTRACT_ADDRESS =
'0xe30fedd158a2e3b13e9badaeabafc5516e95e8c7';

export const SWAPS_WRAPPED_TOKENS_ADDRESSES: { [key: string]: string } = {
[ETH_CHAIN_ID]: WETH_CONTRACT_ADDRESS,
Expand All @@ -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 } = {
Expand All @@ -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[] } = {
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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,
};
Expand Down Expand Up @@ -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
Expand Down