|
|
|
@ -10,6 +10,9 @@ import { |
|
|
|
|
MATIC_SYMBOL, |
|
|
|
|
MATIC_TOKEN_IMAGE_URL, |
|
|
|
|
RINKEBY_CHAIN_ID, |
|
|
|
|
AVALANCHE_CHAIN_ID, |
|
|
|
|
AVALANCHE_SYMBOL, |
|
|
|
|
AVAX_TOKEN_IMAGE_URL, |
|
|
|
|
} from './network'; |
|
|
|
|
|
|
|
|
|
export const QUOTES_EXPIRED_ERROR = 'quotes-expired'; |
|
|
|
@ -47,6 +50,14 @@ export const MATIC_SWAPS_TOKEN_OBJECT = { |
|
|
|
|
iconUrl: MATIC_TOKEN_IMAGE_URL, |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
export const AVAX_SWAPS_TOKEN_OBJECT = { |
|
|
|
|
symbol: AVALANCHE_SYMBOL, |
|
|
|
|
name: 'Avalanche', |
|
|
|
|
address: DEFAULT_TOKEN_ADDRESS, |
|
|
|
|
decimals: 18, |
|
|
|
|
iconUrl: AVAX_TOKEN_IMAGE_URL, |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
export const TEST_ETH_SWAPS_TOKEN_OBJECT = { |
|
|
|
|
symbol: TEST_ETH_SYMBOL, |
|
|
|
|
name: 'Test Ether', |
|
|
|
@ -75,6 +86,8 @@ const BSC_CONTRACT_ADDRESS = '0x1a1ec25dc08e98e5e93f1104b5e5cdd298707d31'; |
|
|
|
|
// It's the same as we use for BSC.
|
|
|
|
|
const POLYGON_CONTRACT_ADDRESS = '0x1a1ec25dc08e98e5e93f1104b5e5cdd298707d31'; |
|
|
|
|
|
|
|
|
|
const AVALANCHE_CONTRACT_ADDRESS = '0x1a1ec25dc08e98e5e93f1104b5e5cdd298707d31'; |
|
|
|
|
|
|
|
|
|
export const WETH_CONTRACT_ADDRESS = |
|
|
|
|
'0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2'; |
|
|
|
|
export const WETH_RINKEBY_CONTRACT_ADDRESS = |
|
|
|
@ -83,12 +96,14 @@ export const WBNB_CONTRACT_ADDRESS = |
|
|
|
|
'0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c'; |
|
|
|
|
export const WMATIC_CONTRACT_ADDRESS = |
|
|
|
|
'0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270'; |
|
|
|
|
export const WAVAX_CONTRACT_ADDRESS = |
|
|
|
|
'0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7'; |
|
|
|
|
|
|
|
|
|
const SWAPS_TESTNET_CHAIN_ID = '0x539'; |
|
|
|
|
|
|
|
|
|
export const SWAPS_API_V2_BASE_URL = 'https://api2.metaswap.codefi.network'; |
|
|
|
|
export const SWAPS_DEV_API_V2_BASE_URL = |
|
|
|
|
'https://api2.metaswap-dev.codefi.network'; |
|
|
|
|
'https://swap.metaswap-dev.codefi.network'; |
|
|
|
|
export const GAS_API_BASE_URL = 'https://gas-api.metaswap.codefi.network'; |
|
|
|
|
export const GAS_DEV_API_BASE_URL = |
|
|
|
|
'https://gas-api.metaswap-dev.codefi.network'; |
|
|
|
@ -97,6 +112,7 @@ const BSC_DEFAULT_BLOCK_EXPLORER_URL = 'https://bscscan.com/'; |
|
|
|
|
const MAINNET_DEFAULT_BLOCK_EXPLORER_URL = 'https://etherscan.io/'; |
|
|
|
|
const RINKEBY_DEFAULT_BLOCK_EXPLORER_URL = 'https://rinkeby.etherscan.io/'; |
|
|
|
|
const POLYGON_DEFAULT_BLOCK_EXPLORER_URL = 'https://polygonscan.com/'; |
|
|
|
|
const AVALANCHE_DEFAULT_BLOCK_EXPLORER_URL = 'https://snowtrace.io/'; |
|
|
|
|
|
|
|
|
|
export const ALLOWED_SWAPS_CHAIN_IDS = { |
|
|
|
|
[MAINNET_CHAIN_ID]: true, |
|
|
|
@ -104,6 +120,7 @@ export const ALLOWED_SWAPS_CHAIN_IDS = { |
|
|
|
|
[BSC_CHAIN_ID]: true, |
|
|
|
|
[POLYGON_CHAIN_ID]: true, |
|
|
|
|
[RINKEBY_CHAIN_ID]: true, |
|
|
|
|
[AVALANCHE_CHAIN_ID]: true, |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
export const SWAPS_CHAINID_CONTRACT_ADDRESS_MAP = { |
|
|
|
@ -112,6 +129,7 @@ export const SWAPS_CHAINID_CONTRACT_ADDRESS_MAP = { |
|
|
|
|
[BSC_CHAIN_ID]: BSC_CONTRACT_ADDRESS, |
|
|
|
|
[POLYGON_CHAIN_ID]: POLYGON_CONTRACT_ADDRESS, |
|
|
|
|
[RINKEBY_CHAIN_ID]: TESTNET_CONTRACT_ADDRESS, |
|
|
|
|
[AVALANCHE_CHAIN_ID]: AVALANCHE_CONTRACT_ADDRESS, |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
export const SWAPS_WRAPPED_TOKENS_ADDRESSES = { |
|
|
|
@ -120,6 +138,7 @@ export const SWAPS_WRAPPED_TOKENS_ADDRESSES = { |
|
|
|
|
[BSC_CHAIN_ID]: WBNB_CONTRACT_ADDRESS, |
|
|
|
|
[POLYGON_CHAIN_ID]: WMATIC_CONTRACT_ADDRESS, |
|
|
|
|
[RINKEBY_CHAIN_ID]: WETH_RINKEBY_CONTRACT_ADDRESS, |
|
|
|
|
[AVALANCHE_CHAIN_ID]: WAVAX_CONTRACT_ADDRESS, |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
export const ALLOWED_CONTRACT_ADDRESSES = { |
|
|
|
@ -143,6 +162,10 @@ export const ALLOWED_CONTRACT_ADDRESSES = { |
|
|
|
|
SWAPS_CHAINID_CONTRACT_ADDRESS_MAP[POLYGON_CHAIN_ID], |
|
|
|
|
SWAPS_WRAPPED_TOKENS_ADDRESSES[POLYGON_CHAIN_ID], |
|
|
|
|
], |
|
|
|
|
[AVALANCHE_CHAIN_ID]: [ |
|
|
|
|
SWAPS_CHAINID_CONTRACT_ADDRESS_MAP[AVALANCHE_CHAIN_ID], |
|
|
|
|
SWAPS_WRAPPED_TOKENS_ADDRESSES[AVALANCHE_CHAIN_ID], |
|
|
|
|
], |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
export const SWAPS_CHAINID_DEFAULT_TOKEN_MAP = { |
|
|
|
@ -151,6 +174,7 @@ export const SWAPS_CHAINID_DEFAULT_TOKEN_MAP = { |
|
|
|
|
[BSC_CHAIN_ID]: BNB_SWAPS_TOKEN_OBJECT, |
|
|
|
|
[POLYGON_CHAIN_ID]: MATIC_SWAPS_TOKEN_OBJECT, |
|
|
|
|
[RINKEBY_CHAIN_ID]: RINKEBY_SWAPS_TOKEN_OBJECT, |
|
|
|
|
[AVALANCHE_CHAIN_ID]: AVAX_SWAPS_TOKEN_OBJECT, |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
export const SWAPS_CHAINID_DEFAULT_BLOCK_EXPLORER_URL_MAP = { |
|
|
|
@ -158,11 +182,13 @@ export const SWAPS_CHAINID_DEFAULT_BLOCK_EXPLORER_URL_MAP = { |
|
|
|
|
[MAINNET_CHAIN_ID]: MAINNET_DEFAULT_BLOCK_EXPLORER_URL, |
|
|
|
|
[POLYGON_CHAIN_ID]: POLYGON_DEFAULT_BLOCK_EXPLORER_URL, |
|
|
|
|
[RINKEBY_CHAIN_ID]: RINKEBY_DEFAULT_BLOCK_EXPLORER_URL, |
|
|
|
|
[AVALANCHE_CHAIN_ID]: AVALANCHE_DEFAULT_BLOCK_EXPLORER_URL, |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
export const ETHEREUM = 'ethereum'; |
|
|
|
|
export const POLYGON = 'polygon'; |
|
|
|
|
export const BSC = 'bsc'; |
|
|
|
|
export const RINKEBY = 'rinkeby'; |
|
|
|
|
export const AVALANCHE = 'avalanche'; |
|
|
|
|
|
|
|
|
|
export const SWAPS_CLIENT_ID = 'extension'; |
|
|
|
|