Merge branch 'main' of http://git.kingsome.cn/yuyongdong/mint-tow
This commit is contained in:
commit
9029b39ddb
@ -2,6 +2,23 @@ import {Deferred} from '../utils/promise.util.js'
|
||||
const MINT_CONTRACT_ADDRESS=import.meta.env.VITE_CLAIMWL_ADDRESS
|
||||
const RPC=import.meta.env.VITE_RPC_API
|
||||
|
||||
const chainCfgs = [{
|
||||
name: 'Immutable zkEVM',
|
||||
type: 'Mainnet',
|
||||
rpc: 'https://rpc.immutable.com',
|
||||
id: 13371,
|
||||
symbol: 'IMX',
|
||||
explorerurl: 'https://explorer.immutable.com'
|
||||
},
|
||||
{
|
||||
name: 'Immutable zkEVM Testnet',
|
||||
type: 'Testnet',
|
||||
rpc: 'https://rpc.testnet.immutable.com',
|
||||
id: 13473,
|
||||
symbol: 'tIMX',
|
||||
explorerurl: 'https://explorer.testnet.immutable.com'
|
||||
}]
|
||||
|
||||
const requestChain = async (rpc, method, params) => {
|
||||
const data = {
|
||||
id: Date.now(),
|
||||
@ -122,7 +139,8 @@ export const switchEthereumChain = async (provider, targetChainId) => {
|
||||
console.log('error switch chain: ', e)
|
||||
if (e.code === 4902 || e.message.indexOf('Unrecognized chain ID') >= 0) {
|
||||
try {
|
||||
const data = chainCfg
|
||||
const chainIdNum = parseInt(hexChainId)
|
||||
const data = chainCfgs.find(o => o.id === chainIdNum)
|
||||
await provider.request({
|
||||
method: 'wallet_addEthereumChain',
|
||||
params: [
|
||||
|
Loading…
x
Reference in New Issue
Block a user