2021-04-02 00:57:00 +02:00
|
|
|
import {
|
|
|
|
MAINNET_CHAIN_ID,
|
|
|
|
ETH_SYMBOL,
|
|
|
|
TEST_ETH_SYMBOL,
|
|
|
|
BNB_SYMBOL,
|
|
|
|
TEST_ETH_TOKEN_IMAGE_URL,
|
|
|
|
BNB_TOKEN_IMAGE_URL,
|
2021-04-07 17:37:04 +02:00
|
|
|
BSC_CHAIN_ID,
|
2021-04-02 00:57:00 +02:00
|
|
|
} from './network';
|
2021-03-18 11:20:06 +01:00
|
|
|
|
|
|
|
export const QUOTES_EXPIRED_ERROR = 'quotes-expired';
|
|
|
|
export const SWAP_FAILED_ERROR = 'swap-failed-error';
|
|
|
|
export const ERROR_FETCHING_QUOTES = 'error-fetching-quotes';
|
|
|
|
export const QUOTES_NOT_AVAILABLE_ERROR = 'quotes-not-avilable';
|
2021-05-13 21:49:00 +02:00
|
|
|
export const CONTRACT_DATA_DISABLED_ERROR = 'contract-data-disabled';
|
2021-03-18 11:20:06 +01:00
|
|
|
export const OFFLINE_FOR_MAINTENANCE = 'offline-for-maintenance';
|
|
|
|
export const SWAPS_FETCH_ORDER_CONFLICT = 'swaps-fetch-order-conflict';
|
|
|
|
|
2021-03-25 21:52:37 +01:00
|
|
|
// An address that the metaswap-api recognizes as the default token for the current network, in place of the token address that ERC-20 tokens have
|
|
|
|
const DEFAULT_TOKEN_ADDRESS = '0x0000000000000000000000000000000000000000';
|
2020-10-06 20:28:38 +02:00
|
|
|
|
|
|
|
export const ETH_SWAPS_TOKEN_OBJECT = {
|
2021-04-02 00:57:00 +02:00
|
|
|
symbol: ETH_SYMBOL,
|
2020-10-06 20:28:38 +02:00
|
|
|
name: 'Ether',
|
2021-03-25 21:52:37 +01:00
|
|
|
address: DEFAULT_TOKEN_ADDRESS,
|
2020-10-06 20:28:38 +02:00
|
|
|
decimals: 18,
|
2021-04-02 00:57:00 +02:00
|
|
|
iconUrl: './images/black-eth-logo.svg',
|
2021-02-04 19:15:23 +01:00
|
|
|
};
|
2020-10-06 20:28:38 +02:00
|
|
|
|
2021-04-02 00:57:00 +02:00
|
|
|
export const BNB_SWAPS_TOKEN_OBJECT = {
|
|
|
|
symbol: BNB_SYMBOL,
|
2021-03-25 21:52:37 +01:00
|
|
|
name: 'Binance Coin',
|
|
|
|
address: DEFAULT_TOKEN_ADDRESS,
|
|
|
|
decimals: 18,
|
2021-04-02 00:57:00 +02:00
|
|
|
iconUrl: BNB_TOKEN_IMAGE_URL,
|
2021-03-25 21:52:37 +01:00
|
|
|
};
|
|
|
|
|
2021-04-02 00:57:00 +02:00
|
|
|
export const TEST_ETH_SWAPS_TOKEN_OBJECT = {
|
|
|
|
symbol: TEST_ETH_SYMBOL,
|
2021-03-18 11:20:06 +01:00
|
|
|
name: 'Test Ether',
|
2021-03-25 21:52:37 +01:00
|
|
|
address: DEFAULT_TOKEN_ADDRESS,
|
2021-03-18 11:20:06 +01:00
|
|
|
decimals: 18,
|
2021-04-02 00:57:00 +02:00
|
|
|
iconUrl: TEST_ETH_TOKEN_IMAGE_URL,
|
2021-03-18 11:20:06 +01:00
|
|
|
};
|
2020-10-06 20:28:38 +02:00
|
|
|
|
|
|
|
// A gas value for ERC20 approve calls that should be sufficient for all ERC20 approve implementations
|
2021-02-04 19:15:23 +01:00
|
|
|
export const DEFAULT_ERC20_APPROVE_GAS = '0x1d4c0';
|
2020-10-06 20:28:38 +02:00
|
|
|
|
2021-03-18 11:20:06 +01:00
|
|
|
const MAINNET_CONTRACT_ADDRESS = '0x881d40237659c251811cec9c364ef91dc08d300c';
|
|
|
|
|
|
|
|
const TESTNET_CONTRACT_ADDRESS = '0x881d40237659c251811cec9c364ef91dc08d300c';
|
|
|
|
|
2021-04-01 19:31:45 +02:00
|
|
|
const BSC_CONTRACT_ADDRESS = '0x1a1ec25dc08e98e5e93f1104b5e5cdd298707d31';
|
2021-03-25 21:52:37 +01:00
|
|
|
|
2021-04-23 16:53:10 +02:00
|
|
|
export const ETH_WETH_CONTRACT_ADDRESS =
|
|
|
|
'0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2';
|
|
|
|
|
2021-03-18 11:20:06 +01:00
|
|
|
const METASWAP_ETH_API_HOST = 'https://api.metaswap.codefi.network';
|
|
|
|
|
2021-04-07 17:37:04 +02:00
|
|
|
const METASWAP_BSC_API_HOST = 'https://bsc-api.metaswap.codefi.network';
|
2021-03-25 21:52:37 +01:00
|
|
|
|
2021-03-18 11:20:06 +01:00
|
|
|
const SWAPS_TESTNET_CHAIN_ID = '0x539';
|
|
|
|
const SWAPS_TESTNET_HOST = 'https://metaswap-api.airswap-dev.codefi.network';
|
2021-03-09 17:06:44 +01:00
|
|
|
|
2021-03-29 14:54:27 +02:00
|
|
|
const BSC_DEFAULT_BLOCK_EXPLORER_URL = 'https://bscscan.com/';
|
2021-06-03 18:08:37 +02:00
|
|
|
const MAINNET_DEFAULT_BLOCK_EXPLORER_URL = 'https://etherscan.io/';
|
2021-03-29 14:54:27 +02:00
|
|
|
|
2021-03-18 11:20:06 +01:00
|
|
|
export const ALLOWED_SWAPS_CHAIN_IDS = {
|
|
|
|
[MAINNET_CHAIN_ID]: true,
|
|
|
|
[SWAPS_TESTNET_CHAIN_ID]: true,
|
2021-04-07 17:37:04 +02:00
|
|
|
[BSC_CHAIN_ID]: true,
|
2021-03-18 11:20:06 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
export const METASWAP_CHAINID_API_HOST_MAP = {
|
|
|
|
[MAINNET_CHAIN_ID]: METASWAP_ETH_API_HOST,
|
|
|
|
[SWAPS_TESTNET_CHAIN_ID]: SWAPS_TESTNET_HOST,
|
2021-04-07 17:37:04 +02:00
|
|
|
[BSC_CHAIN_ID]: METASWAP_BSC_API_HOST,
|
2021-03-18 11:20:06 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
export const SWAPS_CHAINID_CONTRACT_ADDRESS_MAP = {
|
|
|
|
[MAINNET_CHAIN_ID]: MAINNET_CONTRACT_ADDRESS,
|
|
|
|
[SWAPS_TESTNET_CHAIN_ID]: TESTNET_CONTRACT_ADDRESS,
|
2021-04-07 17:37:04 +02:00
|
|
|
[BSC_CHAIN_ID]: BSC_CONTRACT_ADDRESS,
|
2021-03-18 11:20:06 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
export const SWAPS_CHAINID_DEFAULT_TOKEN_MAP = {
|
|
|
|
[MAINNET_CHAIN_ID]: ETH_SWAPS_TOKEN_OBJECT,
|
|
|
|
[SWAPS_TESTNET_CHAIN_ID]: TEST_ETH_SWAPS_TOKEN_OBJECT,
|
2021-04-07 17:37:04 +02:00
|
|
|
[BSC_CHAIN_ID]: BNB_SWAPS_TOKEN_OBJECT,
|
2021-03-18 11:20:06 +01:00
|
|
|
};
|
2021-03-29 14:54:27 +02:00
|
|
|
|
|
|
|
export const SWAPS_CHAINID_DEFAULT_BLOCK_EXPLORER_URL_MAP = {
|
2021-04-07 17:37:04 +02:00
|
|
|
[BSC_CHAIN_ID]: BSC_DEFAULT_BLOCK_EXPLORER_URL,
|
2021-06-03 18:08:37 +02:00
|
|
|
[MAINNET_CHAIN_ID]: MAINNET_DEFAULT_BLOCK_EXPLORER_URL,
|
2021-03-29 14:54:27 +02:00
|
|
|
};
|