diff --git a/src/@utils/wallet/chains.ts b/src/@utils/wallet/chains.ts new file mode 100644 index 000000000..64b030502 --- /dev/null +++ b/src/@utils/wallet/chains.ts @@ -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 diff --git a/src/@utils/wallet.ts b/src/@utils/wallet/index.ts similarity index 93% rename from src/@utils/wallet.ts rename to src/@utils/wallet/index.ts index 01b882771..f2ea30f86 100644 --- a/src/@utils/wallet.ts +++ b/src/@utils/wallet/index.ts @@ -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] }) )