1
0
mirror of https://github.com/oceanprotocol/market.git synced 2024-12-02 05:57:29 +01:00

add existing chains to wagmi

This commit is contained in:
Matthias Kretschmann 2023-02-09 10:11:59 +00:00
parent 2a4c69b0e8
commit 51470343fd
Signed by: m
GPG Key ID: 606EEEF3C479A91F
2 changed files with 76 additions and 1 deletions

View File

@ -0,0 +1,73 @@
import { Chain } from 'wagmi'
export const energyWeb = {
id: 246,
name: 'Energy Web Chain',
network: 'energyweb',
nativeCurrency: {
decimals: 18,
name: 'EWT',
symbol: 'EWT'
},
rpcUrls: {
public: {
http: ['https://rpc.energyweb.org'],
webSocket: ['wss://rpc.energyweb.org/ws']
},
default: {
http: ['https://rpc.energyweb.org'],
webSocket: ['wss://rpc.energyweb.org/ws']
}
},
blockExplorers: {
default: {
name: 'Energy Web Chain',
url: 'https://explorer.energyweb.org/'
},
blockscout: {
name: 'Energy Web Chain',
url: 'https://explorer.energyweb.org/'
}
},
testnet: false
} as Chain
// TODO: remove once moonriver is shipped in wagmi as it is already in codebase
// https://github.com/wagmi-dev/references/blob/main/packages/chains/src/moonriver.ts
export const moonriver = {
id: 1285,
name: 'Moonriver',
network: 'moonriver',
nativeCurrency: {
decimals: 18,
name: 'MOVR',
symbol: 'MOVR'
},
rpcUrls: {
public: {
http: ['https://moonriver.public.blastapi.io'],
webSocket: ['wss://moonriver.public.blastapi.io']
},
default: {
http: ['https://moonriver.public.blastapi.io'],
webSocket: ['wss://moonriver.public.blastapi.io']
}
},
blockExplorers: {
default: {
name: 'Moonscan',
url: 'https://moonriver.moonscan.io'
},
etherscan: {
name: 'Moonscan',
url: 'https://moonriver.moonscan.io'
}
},
contracts: {
multicall3: {
address: '0xcA11bde05977b3631167028862bE2a173976CA11',
blockCreated: 1597904
}
},
testnet: false
} as Chain

View File

@ -4,13 +4,15 @@ import { mainnet, polygon, bsc, goerli, polygonMumbai } from 'wagmi/chains'
import { ethers, Contract } from 'ethers'
import { formatEther } from 'ethers/lib/utils'
import { getDefaultClient } from 'connectkit'
import { energyWeb, moonriver } from './chains'
// Wagmi client
export const wagmiClient = createClient(
getDefaultClient({
appName: 'Ocean Market',
infuraId: process.env.NEXT_PUBLIC_INFURA_PROJECT_ID,
chains: [mainnet, polygon, bsc, goerli, polygonMumbai]
// TODO: mapping between appConfig.chainIdsSupported and wagmi chainId
chains: [mainnet, polygon, bsc, energyWeb, moonriver, goerli, polygonMumbai]
})
)