diff --git a/.changeset/add-arbitrum-reddis-testnet.md b/.changeset/add-arbitrum-reddis-testnet.md new file mode 100644 index 000000000..7f17750a1 --- /dev/null +++ b/.changeset/add-arbitrum-reddis-testnet.md @@ -0,0 +1,5 @@ +--- +"@usedapp/core": patch +--- + +⛓ Add arbitrum reddit test chain diff --git a/packages/core/src/constants/chainId.ts b/packages/core/src/constants/chainId.ts index 0ef0e22bd..95215c1db 100644 --- a/packages/core/src/constants/chainId.ts +++ b/packages/core/src/constants/chainId.ts @@ -42,6 +42,7 @@ import { Velas, VelasTestnet, ZkSyncTestnet, + ArbitrumRedditTestnet, } from '../model' // rough alphabet order (put network from the same chain together) @@ -88,6 +89,7 @@ export const DEFAULT_SUPPORTED_CHAINS = [ Velas, VelasTestnet, ZkSyncTestnet, + ArbitrumRedditTestnet, ] export enum ChainId { @@ -134,4 +136,5 @@ export enum ChainId { Velas = 106, VelasTestnet = 111, ZkSyncTestnet = 280, + ArbitrumRedditTestnet = 5391184, } diff --git a/packages/core/src/hooks/useConfig.test.tsx b/packages/core/src/hooks/useConfig.test.tsx index 743829065..e368f5e4f 100644 --- a/packages/core/src/hooks/useConfig.test.tsx +++ b/packages/core/src/hooks/useConfig.test.tsx @@ -31,7 +31,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(42) + expect(result.current.networks?.length).to.eq(43) expect(result.current.notifications?.checkInterval).to.eq(500) expect(result.current.notifications?.expirationPeriod).to.eq(5000) }) diff --git a/packages/core/src/model/chain/arbitrumReddit.test.ts b/packages/core/src/model/chain/arbitrumReddit.test.ts new file mode 100644 index 000000000..41fbc8e99 --- /dev/null +++ b/packages/core/src/model/chain/arbitrumReddit.test.ts @@ -0,0 +1,37 @@ +import { expect } from 'chai' +import { TEST_ADDRESS, TEST_TX } from './test-defaults' +import { ArbitrumRedditTestnet } from '../..' + +describe('ArbitrumRedditTestnet Chain', () => { + it('getChainId', () => { + expect(ArbitrumRedditTestnet.chainId).to.equal(5391184) + }) + + it('getChainName', () => { + expect(ArbitrumRedditTestnet.chainName).to.eq('ArbitrumRedditTestnet') + }) + + it('isTestChain', () => { + expect(ArbitrumRedditTestnet.isTestChain).to.be.true + }) + + it('isLocalChain', () => { + expect(ArbitrumRedditTestnet.isLocalChain).to.be.false + }) + + it('rpcUrl', () => { + expect(ArbitrumRedditTestnet.rpcUrl).to.eq('https://testnet.redditspace.com/rpc') + }) + + it('getExplorerAddressLink', () => { + expect(ArbitrumRedditTestnet.getExplorerAddressLink(TEST_ADDRESS)).to.eq( + `https://testnet.redditspace.com/address/${TEST_ADDRESS}` + ) + }) + + it('getExplorerTransactionLink', () => { + expect(ArbitrumRedditTestnet.getExplorerTransactionLink(TEST_TX)).to.eq( + `https://testnet.redditspace.com/tx/${TEST_TX}` + ) + }) +}) diff --git a/packages/core/src/model/chain/arbitrumReddit.ts b/packages/core/src/model/chain/arbitrumReddit.ts new file mode 100644 index 000000000..c839f63c4 --- /dev/null +++ b/packages/core/src/model/chain/arbitrumReddit.ts @@ -0,0 +1,21 @@ +import { Chain } from '../../constants' +import { getAddressLink, getTransactionLink } from '../../helpers/chainExplorerLink' + +const arbitrumRedditscanUrl = 'https://testnet.redditspace.com' + +export const ArbitrumRedditTestnet: Chain = { + chainId: 5391184, + chainName: 'ArbitrumRedditTestnet', + isTestChain: true, + isLocalChain: false, + multicallAddress: '0x722db82dea58c880d03b87885053f206f1b37136', + multicall2Address: '0xd4d664d419a6a845c98cc366ae1c4b24592bd5ce', + rpcUrl: 'https://testnet.redditspace.com/rpc', + blockExplorerUrl: arbitrumRedditscanUrl, + getExplorerAddressLink: getAddressLink(arbitrumRedditscanUrl), + getExplorerTransactionLink: getTransactionLink(arbitrumRedditscanUrl), +} + +export default { + ArbitrumRedditTestnet, +} diff --git a/packages/core/src/model/chain/index.ts b/packages/core/src/model/chain/index.ts index 2b1b192c0..9f6864afc 100644 --- a/packages/core/src/model/chain/index.ts +++ b/packages/core/src/model/chain/index.ts @@ -23,3 +23,4 @@ export * from './optimism' export * from './aurora' export * from './velas' export * from './zksync' +export * from './arbitrumReddit'