Skip to content

Commit

Permalink
Merge pull request #36 from router-protocol/add/evm-chains
Browse files Browse the repository at this point in the history
add: evm mainnet chains
  • Loading branch information
jayeshbhole-rp authored Dec 27, 2024
2 parents 516299b + 242b1cc commit 07e1dbd
Show file tree
Hide file tree
Showing 10 changed files with 138 additions and 3 deletions.
5 changes: 5 additions & 0 deletions packages/react/src/chains/evm/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ export const vanar: EVMChain = { ...vVanar, type: 'evm' } as const;
export const xLayer: EVMChain = { ...vxLayer, type: 'evm' } as const;
export const zkSync: EVMChain = { ...vZkSync, type: 'evm' } as const;
export * from './arthera.js';
export * from './nahmii.js';
export * from './nero.js';
export * from './oasisSapphire.js';
export * from './odyssey.js';
export * from './redbelly.js';
export * from './router-evm.js';
export * from './shido.js';
export * from './tangle.js';
23 changes: 23 additions & 0 deletions packages/react/src/chains/evm/nahmii.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { EVMChain } from '../../types/index.js';

export const nahmii: EVMChain = {
id: 4061,
name: 'Nahmii',
type: 'evm',
nativeCurrency: {
decimals: 18,
name: 'Ether',
symbol: 'ETH',
},
rpcUrls: {
default: {
http: ['https://rpc.n3.nahmii.io'],
},
},
blockExplorers: {
default: {
name: 'Nahmii Explorer',
url: 'https://explorer.nahmii.io',
},
},
};
23 changes: 23 additions & 0 deletions packages/react/src/chains/evm/nero.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { EVMChain } from '../../types/index.js';

export const nero: EVMChain = {
id: 1689,
name: 'Nero',
type: 'evm',
nativeCurrency: {
decimals: 18,
name: 'Nero Token',
symbol: 'NERO',
},
rpcUrls: {
default: {
http: ['https://rpc.nerochain.io'],
},
},
blockExplorers: {
default: {
name: 'Nero Explorer',
url: 'https://neroscan.io',
},
},
};
23 changes: 23 additions & 0 deletions packages/react/src/chains/evm/odyssey.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { EVMChain } from '../../types/index.js';

export const odyssey: EVMChain = {
id: 153153,
name: 'Odyssey',
type: 'evm',
nativeCurrency: {
decimals: 18,
name: 'Dione token',
symbol: 'DIONE',
},
rpcUrls: {
default: {
http: ['https://node.dioneprotocol.com/ext/bc/D/rpc'],
},
},
blockExplorers: {
default: {
name: 'Odyssey Explorer',
url: 'https://odyssey-explorer.ithaca.xyz',
},
},
};
23 changes: 23 additions & 0 deletions packages/react/src/chains/evm/redbelly.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { EVMChain } from '../../types/index.js';

export const redbelly: EVMChain = {
id: 151,
name: 'RedBelly Network',
type: 'evm',
nativeCurrency: {
decimals: 18,
name: 'RedBelly Network Token',
symbol: 'RBNT',
},
rpcUrls: {
default: {
http: ['https://governors.mainnet.redbelly.network'],
},
},
blockExplorers: {
default: {
name: 'RedBelly Explorer',
url: 'https://redbelly.routescan.io',
},
},
};
23 changes: 23 additions & 0 deletions packages/react/src/chains/evm/shido.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { EVMChain } from '../../types/index.js';

export const shido: EVMChain = {
id: 9008,
name: 'Shido',
type: 'evm',
nativeCurrency: {
decimals: 18,
name: 'Shido',
symbol: 'SHIDO',
},
rpcUrls: {
default: {
http: ['https://rpc-delta-nodes.shidoscan.com'],
},
},
blockExplorers: {
default: {
name: 'Shido Explorer',
url: 'https://shidoscan.com',
},
},
};
10 changes: 10 additions & 0 deletions packages/react/src/constants/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,20 @@ export const CHAIN_ID = {
matchain: '698',
metis: '1088',
mode: '34443',
nahmii: '4061',
nero: '1689',
oasisSapphire: '23294',
odyssey: '153153',
optimism: '10',
polygon: '137',
polygon_zkevm: '1101',
redbelly: '151',
rollux: '570',
rootstock: '30',
routerEvm: '9600',
saakuru: '7225878',
scroll: '534352',
shido: '9008',
taiko: '167000',
tangle: '5845',
vanar: '2040',
Expand Down Expand Up @@ -99,15 +104,20 @@ export const CHAIN_DATA: Record<ChainId, ChainData> = {
[CHAIN_ID.matchain]: chains.matchain,
[CHAIN_ID.metis]: chains.metis,
[CHAIN_ID.mode]: chains.mode,
[CHAIN_ID.nahmii]: chains.nahmii,
[CHAIN_ID.nero]: chains.nero,
[CHAIN_ID.oasisSapphire]: chains.oasisSapphire,
[CHAIN_ID.odyssey]: chains.odyssey,
[CHAIN_ID.optimism]: chains.optimism,
[CHAIN_ID.polygon]: chains.polygon,
[CHAIN_ID.polygon_zkevm]: chains.polygonZkEvm,
[CHAIN_ID.redbelly]: chains.redbelly,
[CHAIN_ID.rollux]: chains.rollux,
[CHAIN_ID.rootstock]: chains.rootstock,
[CHAIN_ID.routerEvm]: chains.routerEvm,
[CHAIN_ID.saakuru]: chains.saakuru,
[CHAIN_ID.scroll]: chains.scroll,
[CHAIN_ID.shido]: chains.shido,
[CHAIN_ID.taiko]: chains.taiko,
[CHAIN_ID.tangle]: chains.tangle,
[CHAIN_ID.vanar]: chains.vanar,
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export interface TangledConfig {
// Override default supported chains
chains?: SupportedChainsByType;
// Override default chain configs. TODO: Add chain config type
chainConfigs: Partial<Record<Chain, ChainConfig>>;
chainConfigs: Partial<Record<Chain, Partial<ChainConfig>>>;
// Enable testnets. Defaults to false. If true, only testnet chains will be provided in the context.
// testnet?: boolean;

Expand Down
4 changes: 2 additions & 2 deletions packages/react/src/utils/createChainConfigs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import getDefaultSupportedChains from './getDefaultSupportedChains.js';

const createChainConfigs = (
chains: SupportedChainsByType | undefined,
overrides?: Partial<Record<Chain, ChainConfig>>,
overrides?: Partial<Record<Chain, Partial<ChainConfig>>>,
testnet?: boolean,
): SupportedChainsByType => {
let supportedChains: SupportedChainsByType = {
Expand Down Expand Up @@ -33,7 +33,7 @@ const createChainConfigs = (

const overrideChainConfig = (
chainsByType: SupportedChainsByType,
overrides: Partial<Record<Chain, ChainConfig>> | undefined,
overrides: Partial<Record<Chain, Partial<ChainConfig>>> | undefined,
) => {
const supportedChains: SupportedChainsByType = {
bitcoin: [],
Expand Down
5 changes: 5 additions & 0 deletions packages/react/src/utils/getDefaultSupportedChains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,20 @@ const getDefaultSupportedChains = (testnet?: boolean): SupportedChainsByType =>
evm.matchain,
evm.metis,
evm.mode,
evm.nahmii,
evm.nero,
evm.oasisSapphire,
evm.odyssey,
evm.optimism,
evm.polygon,
evm.polygonZkEvm,
evm.redbelly,
evm.routerEvm,
evm.rollux,
evm.rootstock,
evm.saakuru,
evm.scroll,
evm.shido,
evm.taiko,
evm.tangle,
evm.vanar,
Expand Down

0 comments on commit 07e1dbd

Please sign in to comment.