Skip to content

Commit

Permalink
⛓ Add arbitrum reddit test chain (#815)
Browse files Browse the repository at this point in the history
* Add reddit arbitrum testing chain

* Create add-arbitrum-reddis-testnet.md

Co-authored-by: Mateusz Janduła <[email protected]>
  • Loading branch information
Isk and mj426382 committed Jun 21, 2022
1 parent 2909416 commit d835054
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/add-arbitrum-reddis-testnet.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@usedapp/core": patch
---

⛓ Add arbitrum reddit test chain
3 changes: 3 additions & 0 deletions packages/core/src/constants/chainId.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import {
Velas,
VelasTestnet,
ZkSyncTestnet,
ArbitrumRedditTestnet,
} from '../model'

// rough alphabet order (put network from the same chain together)
Expand Down Expand Up @@ -88,6 +89,7 @@ export const DEFAULT_SUPPORTED_CHAINS = [
Velas,
VelasTestnet,
ZkSyncTestnet,
ArbitrumRedditTestnet,
]

export enum ChainId {
Expand Down Expand Up @@ -134,4 +136,5 @@ export enum ChainId {
Velas = 106,
VelasTestnet = 111,
ZkSyncTestnet = 280,
ArbitrumRedditTestnet = 5391184,
}
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 @@ -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)
})
Expand Down
37 changes: 37 additions & 0 deletions packages/core/src/model/chain/arbitrumReddit.test.ts
Original file line number Diff line number Diff line change
@@ -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}`
)
})
})
21 changes: 21 additions & 0 deletions packages/core/src/model/chain/arbitrumReddit.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 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,
}
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 @@ -23,3 +23,4 @@ export * from './optimism'
export * from './aurora'
export * from './velas'
export * from './zksync'
export * from './arbitrumReddit'

3 comments on commit d835054

@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.

@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.