Update chain lists

Update wagmi and zustand deps
pull/12/head
J M Rossy 2 years ago
parent aa998a39eb
commit 9611f69ce3
  1. 4
      package.json
  2. 6
      src/components/icons/ChainIcon.tsx
  3. 160
      src/consts/chains.ts
  4. 5
      src/consts/domains.ts
  5. 666
      yarn.lock

@ -18,8 +18,8 @@
"react-dom": "^18.2.0",
"react-toastify": "^9.0.8",
"urql": "^3.0.3",
"wagmi": "^0.6.8",
"zustand": "^4.1.2"
"wagmi": "^0.7.9",
"zustand": "^4.1.4"
},
"devDependencies": {
"@trivago/prettier-plugin-sort-imports": "^3.2.0",

@ -3,11 +3,11 @@ import { memo } from 'react';
import { chain } from 'wagmi';
import {
alfajoresChain,
auroraTestnetChain,
avalancheChain,
bscChain,
bscTestnetChain,
celoAlfajoresChain,
celoMainnetChain,
fujiTestnetChain,
moonbaseAlphaChain,
@ -36,6 +36,7 @@ const CHAIN_TO_ICON = {
[avalancheChain.id]: Avalanche,
[bscChain.id]: Bsc,
[celoMainnetChain.id]: Celo,
[moonbeamChain.id]: Moonbeam,
// Test chains
[chain.goerli.id]: EthMainnet, // TODO
@ -47,9 +48,8 @@ const CHAIN_TO_ICON = {
[chain.polygonMumbai.id]: Polygon,
[fujiTestnetChain.id]: Avalanche,
[bscTestnetChain.id]: Bsc,
[celoAlfajoresChain.id]: Celo,
[alfajoresChain.id]: Celo,
[auroraTestnetChain.id]: Near,
[moonbeamChain.id]: Moonbeam,
[moonbaseAlphaChain.id]: Moonbeam,
};

@ -1,44 +1,71 @@
import { Chain, allChains as allChainsWagmi, chain } from 'wagmi';
export const avalancheChain: Chain = {
id: 43114,
name: 'Avalanche',
network: 'avalanche',
export const alfajoresChain: Chain = {
id: 44787,
name: 'Alfajores',
network: 'alfajores',
nativeCurrency: {
decimals: 18,
name: 'Avalanche',
symbol: 'AVAX',
name: 'CELO',
symbol: 'CELO',
},
rpcUrls: {
default: 'https://api.avax.network/ext/bc/C/rpc',
default: 'https://alfajores-forno.celo-testnet.org',
},
blockExplorers: {
default: { name: 'SnowTrace', url: 'https://snowtrace.io' },
etherscan: { name: 'CeloScan', url: 'https://alfajores.celoscan.io' },
blockscout: {
name: 'Blockscout',
url: 'https://explorer.celo.org/alfajores',
},
default: { name: 'CeloScan', url: 'https://alfajores.celoscan.io' },
},
testnet: false,
testnet: true,
};
export const fujiTestnetChain: Chain = {
id: 43113,
name: 'Fuji Testnet',
network: 'fuji',
export const auroraTestnetChain: Chain = {
id: 1313161555,
name: 'Aurora Testnet',
network: 'auroraTestnet',
nativeCurrency: {
decimals: 18,
name: 'Avalanche',
symbol: 'AVAX',
name: 'ETH',
symbol: 'ETH',
},
rpcUrls: {
default: 'https://api.avax-test.network/ext/bc/C/rpc',
default: 'https://testnet.aurora.dev',
},
blockExplorers: {
etherscan: {
name: 'AuroraScan',
url: 'https://testnet.aurorascan.dev',
},
default: {
name: 'Snowtrace',
url: 'https://testnet.snowtrace.io',
name: 'AuroraScan',
url: 'https://testnet.aurorascan.dev',
},
},
testnet: true,
};
export const avalancheChain: Chain = {
id: 43114,
name: 'Avalanche',
network: 'avalanche',
nativeCurrency: {
decimals: 18,
name: 'Avalanche',
symbol: 'AVAX',
},
rpcUrls: {
default: 'https://api.avax.network/ext/bc/C/rpc',
},
blockExplorers: {
default: { name: 'SnowTrace', url: 'https://snowtrace.io' },
},
testnet: false,
};
export const bscChain: Chain = {
id: 56,
name: 'Binance Smart Chain',
@ -100,49 +127,47 @@ export const celoMainnetChain: Chain = {
testnet: false,
};
export const celoAlfajoresChain: Chain = {
id: 44787,
name: 'Alfajores',
network: 'alfajores',
export const fujiTestnetChain: Chain = {
id: 43113,
name: 'Fuji Testnet',
network: 'fuji',
nativeCurrency: {
decimals: 18,
name: 'CELO',
symbol: 'CELO',
name: 'Avalanche',
symbol: 'AVAX',
},
rpcUrls: {
default: 'https://alfajores-forno.celo-testnet.org',
default: 'https://api.avax-test.network/ext/bc/C/rpc',
},
blockExplorers: {
etherscan: { name: 'CeloScan', url: 'https://alfajores.celoscan.io' },
blockscout: {
name: 'Blockscout',
url: 'https://explorer.celo.org/alfajores',
default: {
name: 'Snowtrace',
url: 'https://testnet.snowtrace.io',
},
default: { name: 'CeloScan', url: 'https://alfajores.celoscan.io' },
},
testnet: true,
};
export const auroraTestnetChain: Chain = {
id: 1313161555,
name: 'Aurora Testnet',
network: 'auroraTestnet',
export const moonbaseAlphaChain: Chain = {
id: 1287,
name: 'Moonbase Alpha',
network: 'moonbaseAlpha',
nativeCurrency: {
decimals: 18,
name: 'ETH',
symbol: 'ETH',
name: 'DEV',
symbol: 'DEV',
},
rpcUrls: {
default: 'https://testnet.aurora.dev',
default: 'https://rpc.api.moonbase.moonbeam.network',
},
blockExplorers: {
etherscan: {
name: 'AuroraScan',
url: 'https://testnet.aurorascan.dev',
name: 'MoonScan',
url: 'https://moonbase.moonscan.io',
},
default: {
name: 'AuroraScan',
url: 'https://testnet.aurorascan.dev',
name: 'MoonScan',
url: 'https://moonbase.moonscan.io',
},
},
testnet: true,
@ -173,26 +198,26 @@ export const moonbeamChain: Chain = {
testnet: false,
};
export const moonbaseAlphaChain: Chain = {
id: 1287,
name: 'Moonbase Alpha',
network: 'moonbaseAlpha',
export const zksync2testnetChain: Chain = {
id: 280,
name: 'ZkSync Testnet',
network: 'zksync2testnet',
nativeCurrency: {
decimals: 18,
name: 'DEV',
symbol: 'DEV',
name: 'ETH',
symbol: 'ETH',
},
rpcUrls: {
default: 'https://rpc.api.moonbase.moonbeam.network',
default: 'https://zksync2-testnet.zksync.dev',
},
blockExplorers: {
etherscan: {
name: 'MoonScan',
url: 'https://moonbase.moonscan.io',
name: 'ZkScan',
url: 'https://zksync2-testnet.zkscan.io',
},
default: {
name: 'MoonScan',
url: 'https://moonbase.moonscan.io',
name: 'ZkScan',
url: 'https://zksync2-testnet.zkscan.io',
},
},
testnet: true,
@ -202,46 +227,51 @@ export const moonbaseAlphaChain: Chain = {
// Would be nice to use wagmi's chain 'name' or 'network' prop
// But doesn't match SDK
export const chainIdToName = {
44787: 'alfajores',
42161: 'arbitrum',
421611: 'arbitrumrinkeby',
421613: 'arbitrumgoerli',
1313161555: 'auroratestnet',
44787: 'alfajores',
42220: 'celo',
43114: 'avalanche',
43113: 'fuji',
56: 'bsc',
97: 'bsctestnet',
42220: 'celo',
1: 'ethereum',
43113: 'fuji',
5: 'goerli',
42: 'kovan',
1284: 'moonbeam',
1287: 'moonbasealpha',
137: 'polygon',
1284: 'moonbeam',
80001: 'mumbai',
10: 'optimism',
420: 'optimismgoerli',
69: 'optimismkovan',
137: 'polygon',
280: 'zksync2testnet',
};
// Some block explorers use diff urls for their explorer
// api vs the ui, so setting overrides here
export const chainIdToExplorerApi = {
44787: 'https://alfajores.celoscan.io',
42161: 'https://api.arbiscan.io',
421611: 'https://api-testnet.arbiscan.io',
42220: 'https://api.celoscan.io',
44787: 'https://alfajores.celoscan.io',
421613: 'https://api-goerli.arbiscan.io',
43114: 'https://api.snowtrace.io',
43113: 'https://api-testnet.snowtrace.io',
56: 'https://api.bscscan.com',
97: 'https://api-testnet.bscscan.com',
42220: 'https://api.celoscan.io',
1: 'https://api.etherscan.io',
43113: 'https://api-testnet.snowtrace.io',
5: 'https://api-goerli.etherscan.io',
42: 'https://api-kovan.etherscan.io',
1284: 'https://api-moonbeam.moonscan.io',
1287: 'https://api-moonbase.moonscan.io',
137: 'https://api.polygonscan.com',
1284: 'https://api-moonbeam.moonscan.io',
80001: 'https://api-testnet.polygonscan.com',
10: 'https://api-optimistic.etherscan.io',
420: 'https://api-goerli-optimism.etherscan.io',
69: 'https://api-kovan-optimistic.etherscan.io',
137: 'https://api.polygonscan.com',
};
export const mainnetChains = [
@ -265,9 +295,10 @@ export const testnetChains = [
chain.polygonMumbai,
fujiTestnetChain,
bscTestnetChain,
celoAlfajoresChain,
alfajoresChain,
auroraTestnetChain,
moonbaseAlphaChain,
zksync2testnetChain,
];
export const prodAndTestChains = [...mainnetChains, ...testnetChains];
@ -280,10 +311,11 @@ export const allChains = [
avalancheChain,
bscChain,
fujiTestnetChain,
celoAlfajoresChain,
alfajoresChain,
bscTestnetChain,
auroraTestnetChain,
moonbaseAlphaChain,
zksync2testnetChain,
];
export const chainIdToChain = allChains.reduce<Record<number, Chain>>((result, chain) => {

@ -7,6 +7,7 @@ export const domainToChain = {
1000: 44787, // alfajores
6386274: 42161, // arbitrum
1634872690: 421611, // arbitrumrinkeby
421613: 421613, // arbitrumgoerli
1635069300: 1313161555, // auroratestnet
1635148152: 43114, // avalanche
6452067: 56, // bsc
@ -16,12 +17,14 @@ export const domainToChain = {
43113: 43113, // fuji
5: 5, // goerli
3000: 42, // kovan
1836002669: 1284, // moonbeam
1836002657: 1287, // moonbasealpha
1836002669: 1284, // moonbeam
80001: 80001, // mumbai
28528: 10, // optimism
420: 420, // optimismgoerli
1869622635: 69, // optimismkovan
1886350457: 137, // polygon
280: 280, // zksync2testnet
};
export const chainToDomain = invertKeysAndValues(domainToChain);

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save