mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-22 09:23:21 +01:00
Additional swaps network support (#10721)
* Add swaps support for bnc chain * Use single default token address in shared/constants/swaps
This commit is contained in:
parent
9573aa7515
commit
cc55a981d4
BIN
app/images/bnb.png
Normal file
BIN
app/images/bnb.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.2 KiB |
@ -7,21 +7,29 @@ export const QUOTES_NOT_AVAILABLE_ERROR = 'quotes-not-avilable';
|
||||
export const OFFLINE_FOR_MAINTENANCE = 'offline-for-maintenance';
|
||||
export const SWAPS_FETCH_ORDER_CONFLICT = 'swaps-fetch-order-conflict';
|
||||
|
||||
// An address that the metaswap-api recognizes as ETH, in place of the token address that ERC-20 tokens have
|
||||
const ETH_SWAPS_TOKEN_ADDRESS = '0x0000000000000000000000000000000000000000';
|
||||
// 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';
|
||||
|
||||
export const ETH_SWAPS_TOKEN_OBJECT = {
|
||||
symbol: 'ETH',
|
||||
name: 'Ether',
|
||||
address: ETH_SWAPS_TOKEN_ADDRESS,
|
||||
address: DEFAULT_TOKEN_ADDRESS,
|
||||
decimals: 18,
|
||||
iconUrl: 'images/black-eth-logo.svg',
|
||||
};
|
||||
|
||||
const BNB_SWAPS_TOKEN_OBJECT = {
|
||||
symbol: 'BNB',
|
||||
name: 'Binance Coin',
|
||||
address: DEFAULT_TOKEN_ADDRESS,
|
||||
decimals: 18,
|
||||
iconUrl: 'images/bnb.png',
|
||||
};
|
||||
|
||||
const TEST_ETH_SWAPS_TOKEN_OBJECT = {
|
||||
symbol: 'TESTETH',
|
||||
name: 'Test Ether',
|
||||
address: ETH_SWAPS_TOKEN_ADDRESS,
|
||||
address: DEFAULT_TOKEN_ADDRESS,
|
||||
decimals: 18,
|
||||
iconUrl: 'images/black-eth-logo.svg',
|
||||
};
|
||||
@ -33,27 +41,36 @@ const MAINNET_CONTRACT_ADDRESS = '0x881d40237659c251811cec9c364ef91dc08d300c';
|
||||
|
||||
const TESTNET_CONTRACT_ADDRESS = '0x881d40237659c251811cec9c364ef91dc08d300c';
|
||||
|
||||
const BSC_CONTRACT_ADDRESS = '0x1a1ec25DC08e98e5E93F1104B5e5cdD298707d31';
|
||||
|
||||
const METASWAP_ETH_API_HOST = 'https://api.metaswap.codefi.network';
|
||||
|
||||
const METASWAP_BNB_API_HOST = 'https://bsc-api.metaswap.codefi.network';
|
||||
const BNB_CHAIN_ID = '0x38';
|
||||
|
||||
const SWAPS_TESTNET_CHAIN_ID = '0x539';
|
||||
const SWAPS_TESTNET_HOST = 'https://metaswap-api.airswap-dev.codefi.network';
|
||||
|
||||
export const ALLOWED_SWAPS_CHAIN_IDS = {
|
||||
[MAINNET_CHAIN_ID]: true,
|
||||
[SWAPS_TESTNET_CHAIN_ID]: true,
|
||||
[BNB_CHAIN_ID]: true,
|
||||
};
|
||||
|
||||
export const METASWAP_CHAINID_API_HOST_MAP = {
|
||||
[MAINNET_CHAIN_ID]: METASWAP_ETH_API_HOST,
|
||||
[SWAPS_TESTNET_CHAIN_ID]: SWAPS_TESTNET_HOST,
|
||||
[BNB_CHAIN_ID]: METASWAP_BNB_API_HOST,
|
||||
};
|
||||
|
||||
export const SWAPS_CHAINID_CONTRACT_ADDRESS_MAP = {
|
||||
[MAINNET_CHAIN_ID]: MAINNET_CONTRACT_ADDRESS,
|
||||
[SWAPS_TESTNET_CHAIN_ID]: TESTNET_CONTRACT_ADDRESS,
|
||||
[BNB_CHAIN_ID]: BSC_CONTRACT_ADDRESS,
|
||||
};
|
||||
|
||||
export const SWAPS_CHAINID_DEFAULT_TOKEN_MAP = {
|
||||
[MAINNET_CHAIN_ID]: ETH_SWAPS_TOKEN_OBJECT,
|
||||
[SWAPS_TESTNET_CHAIN_ID]: TEST_ETH_SWAPS_TOKEN_OBJECT,
|
||||
[BNB_CHAIN_ID]: BNB_SWAPS_TOKEN_OBJECT,
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user