Skip to content

Commit

Permalink
🪴 Add Arb-Nova, Mantle and Linea chains (#1114)
Browse files Browse the repository at this point in the history
* adding chains

* Lint

---------

Co-authored-by: yivlad <[email protected]>
  • Loading branch information
afa7789 and yivlad committed May 24, 2023
1 parent d74d6c2 commit 8dad4e5
Show file tree
Hide file tree
Showing 7 changed files with 87 additions and 1 deletion.
8 changes: 8 additions & 0 deletions .changeset/add_three_chains.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
@@ -0,0 +1,5 @@
---
"@usedapp/core": patch
---

⛓ Add Linea Testnet to chain ID
⛓ Add Mantle Testnet to chain ID
⛓ Add Arbitrum Nova to chain ID
9 changes: 9 additions & 0 deletions packages/core/src/constants/chainId.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
Arbitrum,
ArbitrumRinkeby,
ArbitrumGoerli,
ArbitrumNova,
Avalanche,
AvalancheTestnet,
Aurora,
Expand Down Expand Up @@ -60,6 +61,8 @@ import {
KlaytnTestnet,
Klaytn,
ScrollAlphaTestnet,
LineaTestnet,
MantleTestnet,
} from '../model'

// rough alphabet order (put network from the same chain together)
Expand All @@ -71,6 +74,7 @@ export const DEFAULT_SUPPORTED_CHAINS = [
Arbitrum,
ArbitrumRinkeby,
ArbitrumGoerli,
ArbitrumNova,
Aurora,
AuroraTestnet,
Mainnet,
Expand Down Expand Up @@ -124,6 +128,8 @@ export const DEFAULT_SUPPORTED_CHAINS = [
Klaytn,
BaseGoerli,
ScrollAlphaTestnet,
LineaTestnet,
MantleTestnet,
]

export enum ChainId {
Expand Down Expand Up @@ -187,4 +193,7 @@ export enum ChainId {
Klaytn = 8217,
BaseGoerli = 84531,
ScrollAlpha = 534353,
LineaTestnet = 59140,
ArbitrumNova = 42170,
MantleTestnet = 5001,
}
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(60)
expect(result.current.networks?.length).to.eq(63)
expect(result.current.notifications?.checkInterval).to.eq(500)
expect(result.current.notifications?.expirationPeriod).to.eq(5000)
})
Expand Down
20 changes: 20 additions & 0 deletions packages/core/src/model/chain/arbitrum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,27 @@ export const Arbitrum: Chain = {
getExplorerTransactionLink: getTransactionLink(arbiscanUrl),
}

const arbitrumNovaExplorerUrl = 'https://nova-explorer.arbitrum.io'

export const ArbitrumNova: Chain = {
chainId: 42170,
chainName: 'Arbitrum Nova',
isTestChain: false,
isLocalChain: false,
multicallAddress: '0x4E74EBd9CABff51cE9a43EFe059bA8c5A28E4A14',
rpcUrl: 'https://nova.arbitrum.io/rpc',
nativeCurrency: {
name: 'Ether',
symbol: 'ETH',
decimals: 18,
},
blockExplorerUrl: arbitrumNovaExplorerUrl,
getExplorerAddressLink: getAddressLink(arbitrumNovaExplorerUrl),
getExplorerTransactionLink: getTransactionLink(arbitrumNovaExplorerUrl),
}

export default {
ArbitrumNova,
ArbitrumRinkeby,
Arbitrum,
}
2 changes: 2 additions & 0 deletions packages/core/src/model/chain/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,5 @@ export * from './klaytn'
export * from './celo'
export * from './base'
export * from './scroll'
export * from './mantle'
export * from './linea'
23 changes: 23 additions & 0 deletions packages/core/src/model/chain/linea.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { Chain } from '../../constants'
import { getAddressLink, getTransactionLink } from '../../helpers/chainExplorerLink'

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

export const LineaTestnet: Chain = {
chainId: 59140,
chainName: 'Linea Testnet',
isTestChain: true,
isLocalChain: false,
multicallAddress: '0x9901f3053527a58B8C210B144f53CbeA7b6E23Fb',
rpcUrl: 'https://rpc.goerli.linea.build',
nativeCurrency: {
name: 'Linea Ether',
symbol: 'ETH',
decimals: 18,
},
blockExplorerUrl: lineaExplorerUrl,
getExplorerAddressLink: getAddressLink(lineaExplorerUrl),
getExplorerTransactionLink: getTransactionLink(lineaExplorerUrl),
}

export default { LineaTestnet }
24 changes: 24 additions & 0 deletions packages/core/src/model/chain/mantle.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { Chain } from '../../constants'
import { getAddressLink, getTransactionLink } from '../../helpers/chainExplorerLink'

const mantleExplorerUrl = 'https://explorer.testnet.mantle.xyz'

export const MantleTestnet: Chain = {
chainId: 5001,
chainName: 'Mantle Testnet',
isTestChain: true,
isLocalChain: false,
multicallAddress: '0x7eeFb76E4D201Eb7157c140F39E2992D53F71da7',
multicall2Address: '0xd875b6E583cba79183be68E0af7cBad053338C95',
rpcUrl: 'https://rpc.testnet.mantle.xyz',
nativeCurrency: {
name: 'Testnet BitDAO',
symbol: 'BIT',
decimals: 18,
},
blockExplorerUrl: mantleExplorerUrl,
getExplorerAddressLink: getAddressLink(mantleExplorerUrl),
getExplorerTransactionLink: getTransactionLink(mantleExplorerUrl),
}

export default { MantleTestnet }

2 comments on commit 8dad4e5

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.