Skip to content

Commit

Permalink
Merge pull request #71 from gnosis/add-networks
Browse files Browse the repository at this point in the history
add optimism, arbitrum, and avalanche
  • Loading branch information
auryn-macmillan authored May 3, 2023
2 parents 5f79f71 + cc8be89 commit 4ea9c69
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .github/workflows/dev-cd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ env:
REACT_APP_ETHERSCAN_KEY: ${{ secrets.REACT_APP_ETHERSCAN_KEY }}
REACT_APP_INFURA_KEY: ${{ secrets.REACT_APP_INFURA_KEY }}
REACT_APP_ONBOARD_JS_DAPP_ID: ${{ secrets.REACT_APP_ONBOARD_JS_DAPP_ID }}
REACT_APP_OPTIMISTIC_ETHERSCAN_KEY: ${{ secrets.REACT_APP_OPTIMISTIC_ETHERSCAN_KEY }}
REACT_APP_ARBISCAN_KEY: ${{ secrets.REACT_APP_ARBISCAN_KEY }}
REACT_APP_SNOWTRACE_KEY: ${{ secrets.REACT_APP_SNOWTRACE_KEY }}
jobs:
deploy:
runs-on: ubuntu-latest
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/prod-release-deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ env:
REACT_APP_ETHERSCAN_KEY: ${{ secrets.REACT_APP_ETHERSCAN_KEY }}
REACT_APP_INFURA_KEY: ${{ secrets.REACT_APP_INFURA_KEY }}
REACT_APP_ONBOARD_JS_DAPP_ID: ${{ secrets.REACT_APP_ONBOARD_JS_DAPP_ID }}
REACT_APP_OPTIMISTIC_ETHERSCAN_KEY: ${{ secrets.REACT_APP_OPTIMISTIC_ETHERSCAN_KEY }}
REACT_APP_ARBISCAN_KEY: ${{ secrets.REACT_APP_ARBISCAN_KEY }}
REACT_APP_SNOWTRACE_KEY: ${{ secrets.REACT_APP_SNOWTRACE_KEY }}
jobs:
deploy:
runs-on: ubuntu-latest
Expand Down
3 changes: 3 additions & 0 deletions packages/exit-app/.env.sample
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
REACT_APP_INFURA_KEY=
REACT_APP_ONBOARD_JS_DAPP_ID=
REACT_APP_ETHERSCAN_KEY=
REACT_APP_OPTIMISTIC_ETHERSCAN_KEY=
REACT_APP_ARBISCAN_KEY=
REACT_APP_SNOWTRACE_KEY=
30 changes: 30 additions & 0 deletions packages/exit-app/src/utils/explorers.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import { NETWORK } from './networks'

const REACT_APP_ETHERSCAN_KEY = process.env.REACT_APP_ETHERSCAN_KEY
const REACT_APP_OPTIMISTIC_ETHERSCAN_KEY = process.env.REACT_APP_OPTIMISTIC_ETHERSCAN_KEY
const REACT_APP_ARBISCAN_KEY = process.env.REACT_APP_ARBISCAN_KEY
const REACT_APP_SNOWTRACE_KEY = process.env.REACT_APP_SNOWTRACE_KEY

interface ExplorerData {
networkExplorerName: string
Expand Down Expand Up @@ -57,6 +60,33 @@ export const EXPLORERS_CONFIG: Record<NETWORK, ExplorerData> = {
verifyContractUrl: 'https://bscscan.com/verifyContract',
explorerApiKey: REACT_APP_ETHERSCAN_KEY,
},
[NETWORK.OPTIMISM]: {
networkExplorerName: 'Etherscan',
networkExplorerUrl: 'https://optimistic.etherscan.io/',
networkExplorerApiUrl: 'https://api-optimistic.etherscan.io/api',
safeTransactionApi: 'https://safe-transaction-optimism.safe.global/',
safeUrl: 'https://app.safe.global/home?safe=oeth:',
verifyContractUrl: 'https://optimistic.etherscan.io/verifyContract',
explorerApiKey: REACT_APP_OPTIMISTIC_ETHERSCAN_KEY,
},
[NETWORK.ARBITRUMONE]: {
networkExplorerName: 'Arbiscan',
networkExplorerUrl: 'https://arbiscan.io/',
networkExplorerApiUrl: 'https://api.arbiscan.io/api',
safeTransactionApi: 'https://safe-transaction-arbitrum.safe.global/',
safeUrl: 'https://app.safe.global/home?safe=arb1:',
verifyContractUrl: 'https://arbiscan.io/verifyContract',
explorerApiKey: REACT_APP_ARBISCAN_KEY,
},
[NETWORK.AVALANCHE]: {
networkExplorerName: 'Snowtrace',
networkExplorerUrl: 'https://snowtrace.io/',
networkExplorerApiUrl: 'https://api.snowtrace.io/api',
safeTransactionApi: 'https://safe-transaction-arbitrum.safe.global/',
safeUrl: 'https://app.safe.global/home?safe=avax:',
verifyContractUrl: 'https://snowtrace.io/verifyContract',
explorerApiKey: REACT_APP_SNOWTRACE_KEY,
},
}

export const getNetworkExplorerInfo = (chainId: number) => {
Expand Down
15 changes: 14 additions & 1 deletion packages/exit-app/src/utils/networks.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
export enum NETWORK {
MAINNET = 1,
GOERLI = 5,
OPTIMISM = 10,
BSC = 56,
GOERLI = 5,
XDAI = 100,
POLYGON = 137,
ARBITRUMONE = 42161,
AVALANCHE = 43114,
}

export interface Coin {
Expand All @@ -16,6 +19,7 @@ export const NATIVE_ASSET: Record<string, Coin> = {
XDAI: { symbol: 'xDai', decimals: 18 },
MATIC: { symbol: 'MATIC', decimals: 18 },
BNB: { symbol: 'BNB', decimals: 18 },
AVAX: { symbol: 'AVAX', decimals: 18 },
}

export const NETWORK_NATIVE_ASSET: Record<NETWORK, Coin> = {
Expand All @@ -24,6 +28,9 @@ export const NETWORK_NATIVE_ASSET: Record<NETWORK, Coin> = {
[NETWORK.BSC]: NATIVE_ASSET.BNB,
[NETWORK.XDAI]: NATIVE_ASSET.XDAI,
[NETWORK.POLYGON]: NATIVE_ASSET.MATIC,
[NETWORK.OPTIMISM]: NATIVE_ASSET.ETH,
[NETWORK.ARBITRUMONE]: NATIVE_ASSET.ETH,
[NETWORK.AVALANCHE]: NATIVE_ASSET.AVAX,
}

export const NETWORK_NAME: Record<NETWORK, string> = {
Expand All @@ -32,6 +39,9 @@ export const NETWORK_NAME: Record<NETWORK, string> = {
[NETWORK.BSC]: 'Binance Smart Chain',
[NETWORK.XDAI]: 'Gnosis Chain',
[NETWORK.POLYGON]: 'Polygon',
[NETWORK.OPTIMISM]: 'Optimism',
[NETWORK.ARBITRUMONE]: 'Arbitrum One',
[NETWORK.AVALANCHE]: 'Avalanche',
}

export const NETWORK_DEFAULT_RPC: Record<NETWORK, string> = {
Expand All @@ -40,6 +50,9 @@ export const NETWORK_DEFAULT_RPC: Record<NETWORK, string> = {
[NETWORK.BSC]: 'https://bsc-dataseed.binance.org',
[NETWORK.XDAI]: 'https://rpc.gnosischain.com',
[NETWORK.POLYGON]: 'https://polygon-rpc.com',
[NETWORK.OPTIMISM]: 'https://mainnet.optimism.io',
[NETWORK.ARBITRUMONE]: 'https://arb1.arbitrum.io/rpc',
[NETWORK.AVALANCHE]: 'https://avalanche-c-chain.publicnode.com',
}

export function getNetworkNativeAsset(network: NETWORK) {
Expand Down

1 comment on commit 4ea9c69

@vercel
Copy link

@vercel vercel bot commented on 4ea9c69 May 3, 2023

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.