Skip to content

Commit

Permalink
try
Browse files Browse the repository at this point in the history
  • Loading branch information
brtkx committed Oct 22, 2024
1 parent 76987d6 commit 816c3e0
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 16 deletions.
29 changes: 16 additions & 13 deletions packages/arb-token-bridge-ui/src/util/networks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -436,27 +436,30 @@ export const localL3NetworkRpcUrl = loadEnvironmentVariableWithFallback({
fallback: 'http://127.0.0.1:3347'
})

export async function registerLocalNetwork(isLocalCustomNativeToken?: boolean) {
export async function registerLocalNetwork() {
try {
rpcURLs[defaultL1Network.chainId] = localL1NetworkRpcUrl
rpcURLs[defaultL2Network.chainId] = localL2NetworkRpcUrl
rpcURLs[defaultL3Network.chainId] = localL3NetworkRpcUrl

registerCustomArbitrumNetwork(defaultL2Network)

if (typeof isLocalCustomNativeToken === 'undefined') {
try {
const data = await fetchErc20Data({
address: defaultL3CustomGasTokenNetwork.nativeToken!,
provider: new StaticJsonRpcProvider(localL2NetworkRpcUrl)
})
if (data.symbol === 'TN') {
isLocalCustomNativeToken = true
}
} catch (e) {
// not the native token
isLocalCustomNativeToken = false
let isLocalCustomNativeToken = false

try {
const data = await fetchErc20Data({
address: defaultL3CustomGasTokenNetwork.nativeToken!,
provider: new StaticJsonRpcProvider(
process.env.NEXT_PUBLIC_LOCAL_ARBITRUM_RPC_URL ||
'http://127.0.0.1:8547'
)
})
if (data.symbol === 'TN') {
isLocalCustomNativeToken = true
}
} catch (e) {
// not the native token
isLocalCustomNativeToken = false
}

registerCustomArbitrumNetwork(
Expand Down
4 changes: 1 addition & 3 deletions packages/arb-token-bridge-ui/synpress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,7 @@ export default defineConfig({
e2e: {
async setupNodeEvents(on, config) {
logsPrinter(on)
await registerLocalNetwork(
process.env.E2E_ORBIT_CUSTOM_GAS_TOKEN === 'true'
)
await registerLocalNetwork()

const erc20Bridger = await Erc20Bridger.fromProvider(childProvider)
const ethBridger = await EthBridger.fromProvider(childProvider)
Expand Down

0 comments on commit 816c3e0

Please sign in to comment.