Skip to content

Commit

Permalink
try
Browse files Browse the repository at this point in the history
  • Loading branch information
fionnachan committed Sep 20, 2024
1 parent df50b3f commit 997b81c
Show file tree
Hide file tree
Showing 4 changed files with 156 additions and 28 deletions.
2 changes: 2 additions & 0 deletions packages/arb-token-bridge-ui/src/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,8 @@ export default function App({ Component, pageProps, router }: AppProps) {
const destinationChainName =
getChainForChainKeyQueryParam(destinationChainSlug).name

console.log('router.query? ', router.query)

console.log('source chain name: ', sourceChainName)
console.log('destination chain name: ', destinationChainName)

Expand Down
3 changes: 3 additions & 0 deletions packages/arb-token-bridge-ui/src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ function getDestinationWithSanitizedQueryParams(
params.set('experiments', encodedExperiments)
}

console.log('params? ', params)
console.log('params.toString()? ', params.toString())

return `/?${params.toString()}`
}

Expand Down
37 changes: 9 additions & 28 deletions packages/arb-token-bridge-ui/src/util/chainQueryParamUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,33 +7,14 @@ import {
localL2Network,
localL3Network,
sepolia
} from './wagmi/wagmiAdditionalNetworks'
} from './wagmiNetworks'
import { ChainKeyQueryParam } from '../types/ChainQueryParam'
import { ChainId, rpcURLs } from './networks'
import { ether } from '../constants'
import { getOrbitChains } from './orbitChainsList'
import { arbitrum } from '@wagmi/chains'
import { chainToWagmiChain } from './wagmi/chainToWagmiChain'

// const arbitrumNova: Chain = {
// id: ChainId.ArbitrumNova,
// name: 'Arbitrum Nova',
// network: 'arbitrum-nova',
// nativeCurrency: ether,
// rpcUrls: {
// default: {
// http: [rpcURLs[ChainId.ArbitrumNova]!]
// },
// public: {
// http: [rpcURLs[ChainId.ArbitrumNova]!]
// }
// },
// blockExplorers: {
// etherscan: { name: 'Arbiscan', url: 'https://nova.arbiscan.io' },
// default: { name: 'Arbiscan', url: 'https://nova.arbiscan.io' }
// }
// }

export function getChainForChainKeyQueryParam(
chainKeyQueryParam: ChainKeyQueryParam
): Chain {
Expand All @@ -48,20 +29,20 @@ export function getChainForChainKeyQueryParam(
case 'arbitrum-one':
return arbitrum

// case 'arbitrum-nova':
// return arbitrumNova
case 'arbitrum-nova':
return arbitrumNova

case 'arbitrum-sepolia':
return arbitrumSepolia

// case 'custom-localhost':
// return localL1Network
case 'custom-localhost':
return localL1Network

// case 'arbitrum-localhost':
// return localL2Network
case 'arbitrum-localhost':
return localL2Network

// case 'l3-localhost':
// return localL3Network
case 'l3-localhost':
return localL3Network

default:
const orbitChain = getOrbitChains().find(
Expand Down
142 changes: 142 additions & 0 deletions packages/arb-token-bridge-ui/src/util/wagmiNetworks.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
import { Chain, sepolia as sepoliaDefault } from 'wagmi'

import { ether } from '../constants'
import { ChainId, explorerUrls, rpcURLs } from './networks'

export const sepolia: Chain = {
...sepoliaDefault,
rpcUrls: {
...sepoliaDefault.rpcUrls,
// override the default public RPC with the Infura RPC
// public RPCs are getting rate limited
default: {
http: [rpcURLs[ChainId.Sepolia]!]
}
}
}

export const holesky: Chain = {
id: ChainId.Holesky,
name: 'Holesky',
network: 'holesky',
nativeCurrency: ether,
rpcUrls: {
default: {
http: [rpcURLs[ChainId.Holesky]!]
},
public: {
http: [rpcURLs[ChainId.Holesky]!]
}
},
blockExplorers: {
etherscan: {
name: 'Etherscan',
url: explorerUrls[ChainId.Holesky]!
},
default: { name: 'Etherscan', url: explorerUrls[ChainId.Holesky]! }
}
}

export const arbitrumSepolia: Chain = {
id: ChainId.ArbitrumSepolia,
name: 'Arbitrum Sepolia',
network: 'arbitrum-sepolia',
nativeCurrency: ether,
rpcUrls: {
default: {
http: [rpcURLs[ChainId.ArbitrumSepolia]!]
},
public: {
http: [rpcURLs[ChainId.ArbitrumSepolia]!]
}
},
blockExplorers: {
etherscan: {
name: 'Arbiscan',
url: explorerUrls[ChainId.ArbitrumSepolia]!
},
default: { name: 'Arbiscan', url: explorerUrls[ChainId.ArbitrumSepolia]! }
}
}

export const arbitrumNova: Chain = {
id: ChainId.ArbitrumNova,
name: 'Arbitrum Nova',
network: 'arbitrum-nova',
nativeCurrency: ether,
rpcUrls: {
default: {
http: [rpcURLs[ChainId.ArbitrumNova]!]
},
public: {
http: [rpcURLs[ChainId.ArbitrumNova]!]
}
},
blockExplorers: {
etherscan: { name: 'Arbiscan', url: 'https://nova.arbiscan.io' },
default: { name: 'Arbiscan', url: 'https://nova.arbiscan.io' }
}
}

/**
* For e2e testing
*/
export const localL1Network: Chain = {
id: ChainId.Local,
name: 'Ethereum Local',
network: 'custom-localhost',
nativeCurrency: ether,
rpcUrls: {
default: {
http: [rpcURLs[ChainId.Local]!]
},
public: {
http: [rpcURLs[ChainId.Local]!]
}
},
blockExplorers: {
default: { name: 'Blockscout', url: '' }
}
}

/**
* For e2e testing
*/
export const localL2Network: Chain = {
id: ChainId.ArbitrumLocal,
name: 'Arbitrum Local',
network: 'arbitrum-localhost',
nativeCurrency: ether,
rpcUrls: {
default: {
http: [rpcURLs[ChainId.ArbitrumLocal]!]
},
public: {
http: [rpcURLs[ChainId.ArbitrumLocal]!]
}
},
blockExplorers: {
default: { name: 'Blockscout', url: 'https://etherscan.io' }
}
}

/**
* For e2e testing
*/
export const localL3Network: Chain = {
id: ChainId.L3Local,
name: 'L3 Local',
network: 'l3-localhost',
nativeCurrency: ether,
rpcUrls: {
default: {
http: [rpcURLs[ChainId.L3Local]!]
},
public: {
http: [rpcURLs[ChainId.L3Local]!]
}
},
blockExplorers: {
default: { name: 'Blockscout', url: 'https://etherscan.io' }
}
}

0 comments on commit 997b81c

Please sign in to comment.