Skip to content

Commit

Permalink
Adding chains
Browse files Browse the repository at this point in the history
  • Loading branch information
afa7789 committed Sep 1, 2023
1 parent 54f7e26 commit 73b3e4a
Show file tree
Hide file tree
Showing 7 changed files with 81 additions and 2 deletions.
9 changes: 9 additions & 0 deletions .changeset/add_chains.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
"@usedapp/core": patch
---

⛓ Add Three chains, to chainId

- Mantle Mainnet
- Scroll Sepolia ( Alpha got deprecated - goerli )
- Kroma
9 changes: 9 additions & 0 deletions packages/core/src/constants/chainId.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,11 @@ import {
KlaytnTestnet,
Klaytn,
ScrollAlphaTestnet,
ScrollSepoliaTestnet,
Linea,
LineaTestnet,
MantleTestnet,
KromaSepoliaTestnet,
} from '../model'

// rough alphabet order (put network from the same chain together)
Expand Down Expand Up @@ -130,8 +133,11 @@ export const DEFAULT_SUPPORTED_CHAINS = [
BaseGoerli,
Base,
ScrollAlphaTestnet,
ScrollSepoliaTestnet,
Linea,
LineaTestnet,
MantleTestnet,
KromaSepoliaTestnet,
]

export enum ChainId {
Expand Down Expand Up @@ -187,6 +193,7 @@ export enum ChainId {
AuroraTestnet = 1313161555,
Velas = 106,
VelasTestnet = 111,
ZkSync = 324,
ZkSyncTestnet = 280,
ArbitrumRedditTestnet = 5391184,
RootstockMainnet = 30,
Expand All @@ -196,6 +203,8 @@ export enum ChainId {
BaseGoerli = 84531,
Base = 8453,
ScrollAlpha = 534353,
ScrollSepolia = 534351,
Linea = 59144,
LineaTestnet = 59140,
ArbitrumNova = 42170,
MantleTestnet = 5001,
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/hooks/useConfig.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ describe('useConfig', () => {
const { result, waitForCurrent } = await renderDAppHook(() => useConfig(), { config: setup.config })
await waitForCurrent((val) => val !== undefined)
expect(result.error).to.be.undefined
expect(result.current.networks?.length).to.eq(64)
expect(result.current.networks?.length).to.eq(67)
expect(result.current.notifications?.checkInterval).to.eq(500)
expect(result.current.notifications?.expirationPeriod).to.eq(5000)
})
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/model/chain/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export * from './metis'
export * from './moonbeam'
export * from './moonriver'
export * from './oasis'
export * from './kroma'
export * from './palm'
export * from './polygon'
export * from './songbird'
Expand Down
21 changes: 21 additions & 0 deletions packages/core/src/model/chain/kroma.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { Chain } from '../../constants'
import { getAddressLink, getTransactionLink } from '../../helpers/chainExplorerLink'

const KromaSepoliaExplorerUrl = 'https://blockscout.sepolia.kroma.network/'

export const KromaSepoliaTestnet: Chain = {
chainId: 2358,
chainName: 'Kroma Sepolia Testnet',
isTestChain: true,
isLocalChain: false,
multicallAddress: '0x62FB84bD50b254c5aFB33453a693a6733Ae40a25',
rpcUrl: 'https://api.sepolia.kroma.network/',
nativeCurrency: {
name: 'ETH',
symbol: 'ETH',
decimals: 18,
},
blockExplorerUrl: KromaSepoliaExplorerUrl,
getExplorerAddressLink: getAddressLink(KromaSepoliaExplorerUrl),
getExplorerTransactionLink: getTransactionLink(KromaSepoliaExplorerUrl),
}
21 changes: 20 additions & 1 deletion packages/core/src/model/chain/linea.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Chain } from '../../constants'
import { getAddressLink, getTransactionLink } from '../../helpers/chainExplorerLink'

const lineaExplorerUrl = 'https://explorer.goerli.linea.build'
const lineaExplorerUrlTestnet = 'https://explorer.goerli.linea.build'

export const LineaTestnet: Chain = {
chainId: 59140,
Expand All @@ -15,6 +15,25 @@ export const LineaTestnet: Chain = {
symbol: 'ETH',
decimals: 18,
},
blockExplorerUrl: lineaExplorerUrlTestnet,
getExplorerAddressLink: getAddressLink(lineaExplorerUrlTestnet),
getExplorerTransactionLink: getTransactionLink(lineaExplorerUrlTestnet),
}

const lineaExplorerUrl = 'https://lineascan.build/'

export const Linea: Chain = {
chainId: 59144,
chainName: 'Linea',
isTestChain: false,
isLocalChain: false,
multicallAddress: '0x5D155A04De5bB501f022E44AEd7FF23A6Ff2C1F1',
rpcUrl: 'https://rpc.linea.build',
nativeCurrency: {
name: 'Linea Ether',
symbol: 'ETH',
decimals: 18,
},
blockExplorerUrl: lineaExplorerUrl,
getExplorerAddressLink: getAddressLink(lineaExplorerUrl),
getExplorerTransactionLink: getTransactionLink(lineaExplorerUrl),
Expand Down
20 changes: 20 additions & 0 deletions packages/core/src/model/chain/scroll.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,23 @@ export const ScrollAlphaTestnet: Chain = {
getExplorerAddressLink: getAddressLink(scrollAlphaExplorerUrl),
getExplorerTransactionLink: getTransactionLink(scrollAlphaExplorerUrl),
}

const scrollSepoliaExplorerUrl = 'https://sepolia-blockscout.scroll.io/'

export const ScrollSepoliaTestnet: Chain = {
chainId: 534351,
chainName: 'Scroll Sepolia Testnet',
isTestChain: true,
isLocalChain: false,
multicallAddress: '0xC35fc5CEF2460e31285755F4294eaBC5c7b90341',
multicall2Address: '0xfb671e51109f7fBbFD14401B5edE925e03337e90',
rpcUrl: 'https://sepolia-rpc.scroll.io',
nativeCurrency: {
name: 'ETH',
symbol: 'ETH',
decimals: 18,
},
blockExplorerUrl: scrollSepoliaExplorerUrl,
getExplorerAddressLink: getAddressLink(scrollSepoliaExplorerUrl),
getExplorerTransactionLink: getTransactionLink(scrollSepoliaExplorerUrl),
}

0 comments on commit 73b3e4a

Please sign in to comment.