diff --git a/packages/arb-token-bridge-ui/package.json b/packages/arb-token-bridge-ui/package.json
index b585d4076e..93649f9481 100644
--- a/packages/arb-token-bridge-ui/package.json
+++ b/packages/arb-token-bridge-ui/package.json
@@ -5,7 +5,7 @@
"private": true,
"dependencies": {
"@apollo/client": "^3.7.11",
- "@arbitrum/sdk": "^3.7.0",
+ "@arbitrum/sdk": "^4.0.0-alpha.9",
"@ethersproject/providers": "^5.7.0",
"@headlessui/react": "^1.7.8",
"@headlessui/tailwindcss": "^0.1.2",
diff --git a/packages/arb-token-bridge-ui/scripts/generateDenylist.ts b/packages/arb-token-bridge-ui/scripts/generateDenylist.ts
index 4221017b9b..22ae50fcdb 100644
--- a/packages/arb-token-bridge-ui/scripts/generateDenylist.ts
+++ b/packages/arb-token-bridge-ui/scripts/generateDenylist.ts
@@ -1,7 +1,7 @@
import fs from 'fs'
import axios from 'axios'
import { TokenList } from '@uniswap/token-lists'
-import { l2Networks } from '@arbitrum/sdk/dist/lib/dataEntities/networks'
+import { getArbitrumNetworks } from '@arbitrum/sdk'
const tokenListsUrls = [
'https://tokenlist.arbitrum.io/ArbTokenLists/arbitrum_token_token_list.json',
@@ -123,10 +123,8 @@ async function main() {
...allTokenAddresses
]
- Object.keys(l2Networks).map(chainId => {
- const networkObject = l2Networks[chainId]
-
- const { ethBridge, tokenBridge } = networkObject
+ getArbitrumNetworks().map(arbitrumNetwork => {
+ const { ethBridge, tokenBridge } = arbitrumNetwork
const { classicOutboxes } = ethBridge
if (classicOutboxes) {
@@ -134,10 +132,11 @@ async function main() {
}
delete ethBridge.classicOutboxes
- denylistedAddresses.push(
- ...Object.values(ethBridge),
- ...Object.values(tokenBridge)
- )
+ denylistedAddresses.push(...Object.values(ethBridge))
+
+ if (tokenBridge) {
+ denylistedAddresses.push(...Object.values(tokenBridge))
+ }
})
const resultJson =
diff --git a/packages/arb-token-bridge-ui/src/components/TransactionHistory/helpers.ts b/packages/arb-token-bridge-ui/src/components/TransactionHistory/helpers.ts
index 193503655b..c19fd96669 100644
--- a/packages/arb-token-bridge-ui/src/components/TransactionHistory/helpers.ts
+++ b/packages/arb-token-bridge-ui/src/components/TransactionHistory/helpers.ts
@@ -3,19 +3,24 @@ import {
StaticJsonRpcProvider,
TransactionReceipt
} from '@ethersproject/providers'
-import { L1ToL2MessageStatus } from '@arbitrum/sdk'
import {
EthDepositMessage,
- EthDepositStatus,
- L1ToL2MessageReader
-} from '@arbitrum/sdk/dist/lib/message/L1ToL2Message'
+ EthDepositMessageStatus,
+ ParentToChildMessageStatus,
+ ParentToChildMessageReader
+} from '@arbitrum/sdk'
import {
DepositStatus,
MergedTransaction,
WithdrawalStatus
} from '../../state/app/state'
-import { ChainId, getBlockTime, isNetwork, rpcURLs } from '../../util/networks'
+import {
+ ChainId,
+ getL1BlockTime,
+ isNetwork,
+ rpcURLs
+} from '../../util/networks'
import { Deposit, Transfer } from '../../hooks/useTransactionHistory'
import { getWagmiChain } from '../../util/wagmi/getWagmiChain'
import {
@@ -286,7 +291,7 @@ export async function getUpdatedEthDeposit(
}
const status = await l1ToL2Msg?.status()
- const isDeposited = status === EthDepositStatus.DEPOSITED
+ const isDeposited = status === EthDepositMessageStatus.DEPOSITED
const newDeposit: MergedTransaction = {
...tx,
@@ -295,12 +300,12 @@ export async function getUpdatedEthDeposit(
l1ToL2MsgData: {
fetchingUpdate: false,
status: isDeposited
- ? L1ToL2MessageStatus.FUNDS_DEPOSITED_ON_L2
- : L1ToL2MessageStatus.NOT_YET_CREATED,
- retryableCreationTxID: (l1ToL2Msg as EthDepositMessage).l2DepositTxHash,
+ ? ParentToChildMessageStatus.FUNDS_DEPOSITED_ON_CHILD
+ : ParentToChildMessageStatus.NOT_YET_CREATED,
+ retryableCreationTxID: (l1ToL2Msg as EthDepositMessage).childTxHash,
// Only show `l2TxID` after the deposit is confirmed
l2TxID: isDeposited
- ? (l1ToL2Msg as EthDepositMessage).l2DepositTxHash
+ ? (l1ToL2Msg as EthDepositMessage).childTxHash
: undefined
}
}
@@ -329,7 +334,7 @@ export async function getUpdatedTokenDeposit(
l1Provider: getProvider(tx.parentChainId),
l2Provider: getProvider(tx.childChainId)
})
- const _l1ToL2Msg = l1ToL2Msg as L1ToL2MessageReader
+ const _l1ToL2Msg = l1ToL2Msg as ParentToChildMessageReader
if (!l1ToL2Msg) {
const receipt = await getTxReceipt(tx)
@@ -346,8 +351,8 @@ export async function getUpdatedTokenDeposit(
const res = await _l1ToL2Msg.getSuccessfulRedeem()
const l2TxID = (() => {
- if (res.status === L1ToL2MessageStatus.REDEEMED) {
- return res.l2TxReceipt.transactionHash
+ if (res.status === ParentToChildMessageStatus.REDEEMED) {
+ return res.childTxReceipt.transactionHash
} else {
return undefined
}
@@ -357,7 +362,9 @@ export async function getUpdatedTokenDeposit(
...tx,
status: _l1ToL2Msg.retryableCreationId ? 'success' : tx.status,
resolvedAt:
- res.status === L1ToL2MessageStatus.REDEEMED ? dayjs().valueOf() : null,
+ res.status === ParentToChildMessageStatus.REDEEMED
+ ? dayjs().valueOf()
+ : null,
l1ToL2MsgData: {
status: res.status,
l2TxID,
@@ -411,7 +418,7 @@ export async function getUpdatedCctpTransfer(
const requiredL1BlocksBeforeConfirmation = getBlockBeforeConfirmation(
tx.parentChainId
)
- const blockTime = getBlockTime(tx.parentChainId)
+ const blockTime = getL1BlockTime(tx.parentChainId)
const txWithTxId: MergedTransaction = { ...tx, txId: receipt.transactionHash }
diff --git a/packages/arb-token-bridge-ui/src/components/common/AddCustomChain.tsx b/packages/arb-token-bridge-ui/src/components/common/AddCustomChain.tsx
index d4cea3206e..a7aba71cd2 100644
--- a/packages/arb-token-bridge-ui/src/components/common/AddCustomChain.tsx
+++ b/packages/arb-token-bridge-ui/src/components/common/AddCustomChain.tsx
@@ -1,10 +1,7 @@
import { useState } from 'react'
import { isAddress } from 'ethers/lib/utils.js'
import { Popover } from '@headlessui/react'
-import {
- addCustomNetwork,
- constants as arbitrumSdkConstants
-} from '@arbitrum/sdk'
+import { registerCustomArbitrumNetwork } from '@arbitrum/sdk'
import { StaticJsonRpcProvider } from '@ethersproject/providers'
import { EllipsisHorizontalIcon, XMarkIcon } from '@heroicons/react/24/outline'
import { constants } from 'ethers'
@@ -181,7 +178,7 @@ async function mapOrbitConfigToOrbitChain(
const confirmPeriodBlocks =
(await rollup.confirmPeriodBlocks()).toNumber() ?? 150
return {
- chainID: data.chainInfo.chainId,
+ chainId: data.chainInfo.chainId,
confirmPeriodBlocks,
ethBridge: {
bridge: data.coreContracts.bridge,
@@ -194,30 +191,24 @@ async function mapOrbitConfigToOrbitChain(
explorerUrl: data.chainInfo.explorerUrl,
isCustom: true,
name: data.chainInfo.chainName,
- partnerChainID: data.chainInfo.parentChainId,
- partnerChainIDs: [],
+ parentChainId: data.chainInfo.parentChainId,
retryableLifetimeSeconds: 604800,
- nitroGenesisBlock: 0,
- nitroGenesisL1Block: 0,
- depositTimeout: 900000,
- blockTime: arbitrumSdkConstants.ARB_MINIMUM_BLOCK_TIME_IN_SECONDS,
nativeToken: data.chainInfo.nativeToken,
- isArbitrum: true,
tokenBridge: {
- l1CustomGateway: data.tokenBridgeContracts.l2Contracts.customGateway,
- l1ERC20Gateway: data.tokenBridgeContracts.l2Contracts.standardGateway,
- l1GatewayRouter: data.tokenBridgeContracts.l2Contracts.router,
- l1MultiCall: data.tokenBridgeContracts.l2Contracts.multicall,
- l1ProxyAdmin: data.tokenBridgeContracts.l2Contracts.proxyAdmin,
- l1Weth: data.tokenBridgeContracts.l2Contracts.weth,
- l1WethGateway: data.tokenBridgeContracts.l2Contracts.wethGateway,
- l2CustomGateway: data.tokenBridgeContracts.l3Contracts.customGateway,
- l2ERC20Gateway: data.tokenBridgeContracts.l3Contracts.standardGateway,
- l2GatewayRouter: data.tokenBridgeContracts.l3Contracts.router,
- l2Multicall: data.tokenBridgeContracts.l3Contracts.multicall,
- l2ProxyAdmin: data.tokenBridgeContracts.l3Contracts.proxyAdmin,
- l2Weth: data.tokenBridgeContracts.l3Contracts.weth,
- l2WethGateway: data.tokenBridgeContracts.l3Contracts.wethGateway
+ parentCustomGateway: data.tokenBridgeContracts.l2Contracts.customGateway,
+ parentErc20Gateway: data.tokenBridgeContracts.l2Contracts.standardGateway,
+ parentGatewayRouter: data.tokenBridgeContracts.l2Contracts.router,
+ parentMultiCall: data.tokenBridgeContracts.l2Contracts.multicall,
+ parentProxyAdmin: data.tokenBridgeContracts.l2Contracts.proxyAdmin,
+ parentWeth: data.tokenBridgeContracts.l2Contracts.weth,
+ parentWethGateway: data.tokenBridgeContracts.l2Contracts.wethGateway,
+ childCustomGateway: data.tokenBridgeContracts.l3Contracts.customGateway,
+ childErc20Gateway: data.tokenBridgeContracts.l3Contracts.standardGateway,
+ childGatewayRouter: data.tokenBridgeContracts.l3Contracts.router,
+ childMultiCall: data.tokenBridgeContracts.l3Contracts.multicall,
+ childProxyAdmin: data.tokenBridgeContracts.l3Contracts.proxyAdmin,
+ childWeth: data.tokenBridgeContracts.l3Contracts.weth,
+ childWethGateway: data.tokenBridgeContracts.l3Contracts.wethGateway
}
}
}
@@ -271,7 +262,7 @@ export const AddCustomChain = () => {
const nativeToken = await fetchNativeToken(data)
// Orbit config has been validated and will be added to the custom list after page refreshes
// let's still try to add it here to handle eventual errors
- addCustomNetwork({ customL2Network: customChain })
+ registerCustomArbitrumNetwork(customChain)
saveCustomChainToLocalStorage({ ...customChain, ...nativeToken })
saveOrbitConfigToLocalStorage(data)
// reload to apply changes
@@ -333,20 +324,20 @@ export const AddCustomChain = () => {
{customChains.map(customChain => (
{customChain.name}
|
- {customChain.chainID}
+ {customChain.chainId}
|
- {getNetworkName(customChain.partnerChainID)}
+ {getNetworkName(customChain.parentChainId)}
|
- {customChain.partnerChainID}
+ {customChain.parentChainId}
|
@@ -359,10 +350,10 @@ export const AddCustomChain = () => {
className="rounded-t p-4 text-left transition duration-300 hover:bg-[#333333]"
onClick={() => {
removeCustomChainFromLocalStorage(
- customChain.chainID
+ customChain.chainId
)
removeOrbitConfigFromLocalStorage(
- customChain.chainID
+ customChain.chainId
)
// reload to apply changes
location.reload()
@@ -375,7 +366,7 @@ export const AddCustomChain = () => {
href={`data:text/json;charset=utf-8,${encodeURIComponent(
JSON.stringify(
getOrbitConfigFromLocalStorageById(
- customChain.chainID
+ customChain.chainId
)
)
)}`}
diff --git a/packages/arb-token-bridge-ui/src/components/common/WithdrawalCountdown.tsx b/packages/arb-token-bridge-ui/src/components/common/WithdrawalCountdown.tsx
index ca0dbc9288..09012b177d 100644
--- a/packages/arb-token-bridge-ui/src/components/common/WithdrawalCountdown.tsx
+++ b/packages/arb-token-bridge-ui/src/components/common/WithdrawalCountdown.tsx
@@ -2,7 +2,7 @@ import dayjs, { Dayjs } from 'dayjs'
import {
getBaseChainIdByChainId,
- getBlockTime,
+ getL1BlockTime,
getConfirmPeriodBlocks
} from '../../util/networks'
import { MergedTransaction } from '../../state/app/state'
@@ -28,7 +28,8 @@ export function getTxConfirmationDate({
// the block time is always base chain's block time regardless of withdrawing from L3 to L2 or from L2 to L1
// and similarly, the confirm period blocks is always the number of blocks on the base chain
const confirmationSeconds =
- getBlockTime(baseChainId) * getConfirmPeriodBlocks(withdrawalFromChainId) +
+ getL1BlockTime(baseChainId) *
+ getConfirmPeriodBlocks(withdrawalFromChainId) +
CONFIRMATION_BUFFER_MINUTES * SECONDS_IN_MIN
return createdAt.add(confirmationSeconds, 'second')
}
diff --git a/packages/arb-token-bridge-ui/src/hooks/__tests__/helpers.ts b/packages/arb-token-bridge-ui/src/hooks/__tests__/helpers.ts
index 4749be24fa..252315cf83 100644
--- a/packages/arb-token-bridge-ui/src/hooks/__tests__/helpers.ts
+++ b/packages/arb-token-bridge-ui/src/hooks/__tests__/helpers.ts
@@ -1,5 +1,3 @@
-import { constants } from '@arbitrum/sdk'
-
import { ChainWithRpcUrl } from '../../util/networks'
export function createMockOrbitChain({
@@ -10,7 +8,7 @@ export function createMockOrbitChain({
parentChainId: number
}): ChainWithRpcUrl {
return {
- chainID: chainId,
+ chainId: chainId,
confirmPeriodBlocks: 45818,
ethBridge: {
bridge: '',
@@ -22,32 +20,10 @@ export function createMockOrbitChain({
nativeToken: '',
explorerUrl: '',
rpcUrl: '',
- isArbitrum: true,
isCustom: true,
name: `Mocked Orbit Chain ${chainId}`,
slug: `mocked-orbit-chain-${chainId}`,
- partnerChainID: parentChainId,
- partnerChainIDs: [],
- retryableLifetimeSeconds: 604800,
- tokenBridge: {
- l1CustomGateway: '',
- l1ERC20Gateway: '',
- l1GatewayRouter: '',
- l1MultiCall: '',
- l1ProxyAdmin: '',
- l1Weth: '',
- l1WethGateway: '',
- l2CustomGateway: '',
- l2ERC20Gateway: '',
- l2GatewayRouter: '',
- l2Multicall: '',
- l2ProxyAdmin: '',
- l2Weth: '',
- l2WethGateway: ''
- },
- nitroGenesisBlock: 0,
- nitroGenesisL1Block: 0,
- depositTimeout: 1800000,
- blockTime: constants.ARB_MINIMUM_BLOCK_TIME_IN_SECONDS
+ parentChainId,
+ retryableLifetimeSeconds: 604800
}
}
diff --git a/packages/arb-token-bridge-ui/src/hooks/__tests__/useArbQueryParams.test.ts b/packages/arb-token-bridge-ui/src/hooks/__tests__/useArbQueryParams.test.ts
index eb605433c7..e31ac3dd95 100644
--- a/packages/arb-token-bridge-ui/src/hooks/__tests__/useArbQueryParams.test.ts
+++ b/packages/arb-token-bridge-ui/src/hooks/__tests__/useArbQueryParams.test.ts
@@ -1,7 +1,7 @@
/**
* @jest-environment jsdom
*/
-import { addCustomNetwork } from '@arbitrum/sdk'
+import { registerCustomArbitrumNetwork } from '@arbitrum/sdk'
import { ChainId, customChainLocalStorageKey } from '../../util/networks'
import { AmountQueryParam, ChainParam } from '../useArbQueryParams'
import { createMockOrbitChain } from './helpers'
@@ -224,7 +224,7 @@ describe('ChainParam custom encoder and decoder', () => {
chainId: 222222,
parentChainId: 1
})
- addCustomNetwork({ customL2Network: customChain })
+ registerCustomArbitrumNetwork(customChain)
expect(ChainParam.decode('222222')).toEqual(222222)
})
})
diff --git a/packages/arb-token-bridge-ui/src/hooks/__tests__/useNetworks.test.ts b/packages/arb-token-bridge-ui/src/hooks/__tests__/useNetworks.test.ts
index bd3f1ba97c..80bf5705ee 100644
--- a/packages/arb-token-bridge-ui/src/hooks/__tests__/useNetworks.test.ts
+++ b/packages/arb-token-bridge-ui/src/hooks/__tests__/useNetworks.test.ts
@@ -1,7 +1,7 @@
/**
* @jest-environment jsdom
*/
-import { addCustomNetwork } from '@arbitrum/sdk'
+import { registerCustomArbitrumNetwork } from '@arbitrum/sdk'
import { ChainId, customChainLocalStorageKey } from '../../util/networks'
import { sanitizeQueryParams } from '../useNetworks'
import { createMockOrbitChain } from './helpers'
@@ -35,9 +35,9 @@ describe('sanitizeQueryParams', () => {
return null
}
)
- addCustomNetwork({ customL2Network: mockedOrbitChain_1 })
- addCustomNetwork({ customL2Network: mockedOrbitChain_2 })
- addCustomNetwork({ customL2Network: mockedOrbitChain_3 })
+ registerCustomArbitrumNetwork(mockedOrbitChain_1)
+ registerCustomArbitrumNetwork(mockedOrbitChain_2)
+ registerCustomArbitrumNetwork(mockedOrbitChain_3)
})
afterAll(() => {
diff --git a/packages/arb-token-bridge-ui/src/hooks/arbTokenBridge.types.ts b/packages/arb-token-bridge-ui/src/hooks/arbTokenBridge.types.ts
index 2d9884f5ba..516f57e9c9 100644
--- a/packages/arb-token-bridge-ui/src/hooks/arbTokenBridge.types.ts
+++ b/packages/arb-token-bridge-ui/src/hooks/arbTokenBridge.types.ts
@@ -2,22 +2,19 @@ import { Signer } from '@ethersproject/abstract-signer'
import { TransactionReceipt } from '@ethersproject/abstract-provider'
import { BigNumber, ContractReceipt, ethers } from 'ethers'
import { TokenList } from '@uniswap/token-lists'
-import { L2ToL1MessageStatus as OutgoingMessageState } from '@arbitrum/sdk'
+import {
+ EventArgs,
+ ParentEthDepositTransaction,
+ ParentEthDepositTransactionReceipt,
+ ParentContractCallTransaction,
+ ParentContractCallTransactionReceipt,
+ ChildContractTransaction,
+ ChildTransactionReceipt,
+ ChildToParentMessageStatus as OutgoingMessageState,
+ ChildToParentTransactionEvent
+} from '@arbitrum/sdk'
import { StandardArbERC20 } from '@arbitrum/sdk/dist/lib/abi/StandardArbERC20'
import { WithdrawalInitiatedEvent } from '@arbitrum/sdk/dist/lib/abi/L2ArbitrumGateway'
-import { L2ToL1TransactionEvent } from '@arbitrum/sdk/dist/lib/message/L2ToL1Message'
-import { EventArgs } from '@arbitrum/sdk/dist/lib/dataEntities/event'
-
-import {
- L1EthDepositTransaction,
- L1EthDepositTransactionReceipt,
- L1ContractCallTransaction,
- L1ContractCallTransactionReceipt
-} from '@arbitrum/sdk/dist/lib/message/L1Transaction'
-import {
- L2ContractTransaction,
- L2TransactionReceipt
-} from '@arbitrum/sdk/dist/lib/message/L2Transaction'
import {
NewTransaction,
@@ -43,18 +40,18 @@ export type TransactionLifecycle = Partial<{
}>
export type L1EthDepositTransactionLifecycle = TransactionLifecycle<
- L1EthDepositTransaction,
- L1EthDepositTransactionReceipt
+ ParentEthDepositTransaction,
+ ParentEthDepositTransactionReceipt
>
export type L1ContractCallTransactionLifecycle = TransactionLifecycle<
- L1ContractCallTransaction,
- L1ContractCallTransactionReceipt
+ ParentContractCallTransaction,
+ ParentContractCallTransactionReceipt
>
export type L2ContractCallTransactionLifecycle = TransactionLifecycle<
- L2ContractTransaction,
- L2TransactionReceipt
+ ChildContractTransaction,
+ ChildTransactionReceipt
>
export enum NodeBlockDeadlineStatusTypes {
@@ -67,7 +64,7 @@ export type NodeBlockDeadlineStatus =
| NodeBlockDeadlineStatusTypes.NODE_NOT_CREATED
| NodeBlockDeadlineStatusTypes.EXECUTE_CALL_EXCEPTION
-export type L2ToL1EventResult = L2ToL1TransactionEvent
+export type L2ToL1EventResult = ChildToParentTransactionEvent
export type L2ToL1EventResultPlus = L2ToL1EventResult & {
sender?: string
diff --git a/packages/arb-token-bridge-ui/src/hooks/useArbTokenBridge.ts b/packages/arb-token-bridge-ui/src/hooks/useArbTokenBridge.ts
index f20207f8a2..de7387aa49 100644
--- a/packages/arb-token-bridge-ui/src/hooks/useArbTokenBridge.ts
+++ b/packages/arb-token-bridge-ui/src/hooks/useArbTokenBridge.ts
@@ -5,9 +5,11 @@ import { Signer } from '@ethersproject/abstract-signer'
import { JsonRpcProvider } from '@ethersproject/providers'
import { useLocalStorage } from '@rehooks/local-storage'
import { TokenList } from '@uniswap/token-lists'
-import { L2ToL1Message } from '@arbitrum/sdk'
-import { EventArgs } from '@arbitrum/sdk/dist/lib/dataEntities/event'
-import { L2ToL1TransactionEvent } from '@arbitrum/sdk/dist/lib/message/L2ToL1Message'
+import {
+ EventArgs,
+ ChildToParentMessage,
+ ChildToParentTransactionEvent
+} from '@arbitrum/sdk'
import { L2ToL1TransactionEvent as ClassicL2ToL1TransactionEvent } from '@arbitrum/sdk/dist/lib/abi/ArbSys'
import useTransactions from './useTransactions'
@@ -40,7 +42,7 @@ export const wait = (ms = 0) => {
}
function isClassicL2ToL1TransactionEvent(
- event: L2ToL1TransactionEvent
+ event: ChildToParentTransactionEvent
): event is EventArgs {
return typeof (event as any).batchNumber !== 'undefined'
}
@@ -435,7 +437,7 @@ export const useArbTokenBridge = (
const parentChainProvider = getProvider(event.parentChainId)
const childChainProvider = getProvider(event.childChainId)
- const messageWriter = L2ToL1Message.fromEvent(
+ const messageWriter = ChildToParentMessage.fromEvent(
l1Signer,
event,
parentChainProvider
@@ -491,7 +493,7 @@ export const useArbTokenBridge = (
const parentChainProvider = getProvider(event.parentChainId)
const childChainProvider = getProvider(event.childChainId)
- const messageWriter = L2ToL1Message.fromEvent(
+ const messageWriter = ChildToParentMessage.fromEvent(
l1Signer,
event,
parentChainProvider
diff --git a/packages/arb-token-bridge-ui/src/hooks/useClaimWithdrawal.ts b/packages/arb-token-bridge-ui/src/hooks/useClaimWithdrawal.ts
index bfbaa4a158..234f253ae9 100644
--- a/packages/arb-token-bridge-ui/src/hooks/useClaimWithdrawal.ts
+++ b/packages/arb-token-bridge-ui/src/hooks/useClaimWithdrawal.ts
@@ -11,7 +11,7 @@ import {
getProvider,
setParentChainTxDetailsOfWithdrawalClaimTx
} from '../components/TransactionHistory/helpers'
-import { L2TransactionReceipt } from '@arbitrum/sdk'
+import { ChildTransactionReceipt } from '@arbitrum/sdk'
import { ContractReceipt, utils } from 'ethers'
import { useTransactionHistory } from './useTransactionHistory'
import dayjs from 'dayjs'
@@ -49,8 +49,8 @@ export function useClaimWithdrawal(
const childChainProvider = getProvider(tx.childChainId)
const txReceipt = await childChainProvider.getTransactionReceipt(tx.txId)
- const l2TxReceipt = new L2TransactionReceipt(txReceipt)
- const [event] = l2TxReceipt.getL2ToL1Events()
+ const l2TxReceipt = new ChildTransactionReceipt(txReceipt)
+ const [event] = l2TxReceipt.getChildToParentEvents()
if (!event) {
setIsClaiming(false)
diff --git a/packages/arb-token-bridge-ui/src/hooks/useNativeCurrency.ts b/packages/arb-token-bridge-ui/src/hooks/useNativeCurrency.ts
index 8cfedbc9ba..f315990e28 100644
--- a/packages/arb-token-bridge-ui/src/hooks/useNativeCurrency.ts
+++ b/packages/arb-token-bridge-ui/src/hooks/useNativeCurrency.ts
@@ -1,5 +1,5 @@
import { Provider, StaticJsonRpcProvider } from '@ethersproject/providers'
-import { EthBridger, L2Network, getL2Network } from '@arbitrum/sdk'
+import { EthBridger, ArbitrumNetwork, getArbitrumNetwork } from '@arbitrum/sdk'
import useSWRImmutable from 'swr/immutable'
import { ETHER_TOKEN_LOGO, ether } from '../constants'
@@ -57,10 +57,10 @@ export async function fetchNativeCurrency({
}: {
provider: Provider
}): Promise {
- let chain: L2Network
+ let chain: ArbitrumNetwork
try {
- chain = await getL2Network(provider)
+ chain = await getArbitrumNetwork(provider)
} catch (error) {
// This will only throw for L1s, so we can safely assume that the native currency is ETH
return nativeCurrencyEther
@@ -74,7 +74,7 @@ export async function fetchNativeCurrency({
}
const address = ethBridger.nativeToken.toLowerCase()
- const parentChainId = chain.partnerChainID
+ const parentChainId = chain.parentChainId
const parentChainProvider = new StaticJsonRpcProvider(rpcURLs[parentChainId])
const { name, symbol, decimals } = await fetchErc20Data({
@@ -84,7 +84,7 @@ export async function fetchNativeCurrency({
return {
name,
- logoUrl: getBridgeUiConfigForChain(chain.chainID).nativeTokenData?.logoUrl,
+ logoUrl: getBridgeUiConfigForChain(chain.chainId).nativeTokenData?.logoUrl,
symbol,
decimals,
address,
diff --git a/packages/arb-token-bridge-ui/src/hooks/useNetworks.ts b/packages/arb-token-bridge-ui/src/hooks/useNetworks.ts
index 565bbb70df..7db69d9269 100644
--- a/packages/arb-token-bridge-ui/src/hooks/useNetworks.ts
+++ b/packages/arb-token-bridge-ui/src/hooks/useNetworks.ts
@@ -27,7 +27,7 @@ export function isSupportedChainId(
}
const customChainIds = getCustomChainsFromLocalStorage().map(
- chain => chain.chainID
+ chain => chain.chainId
)
return [
@@ -39,7 +39,7 @@ export function isSupportedChainId(
arbitrumSepolia.id,
arbitrumLocal.id,
local.id,
- ...getOrbitChains().map(chain => chain.chainID),
+ ...getOrbitChains().map(chain => chain.chainId),
...customChainIds
].includes(chainId)
}
diff --git a/packages/arb-token-bridge-ui/src/hooks/useRedeemRetryable.ts b/packages/arb-token-bridge-ui/src/hooks/useRedeemRetryable.ts
index b73fec6c29..5c6bd83bdf 100644
--- a/packages/arb-token-bridge-ui/src/hooks/useRedeemRetryable.ts
+++ b/packages/arb-token-bridge-ui/src/hooks/useRedeemRetryable.ts
@@ -1,8 +1,7 @@
import { useCallback, useState } from 'react'
-import { L1ToL2MessageStatus } from '@arbitrum/sdk'
+import { ParentToChildMessageStatus } from '@arbitrum/sdk'
import { useSigner } from 'wagmi'
import dayjs from 'dayjs'
-import { TransactionReceipt } from '@ethersproject/providers'
import { DepositStatus, MergedTransaction } from '../state/app/state'
import { getRetryableTicket } from '../util/RetryableUtils'
@@ -52,17 +51,19 @@ export function useRedeemRetryable(
await redeemTx.wait()
const status = await retryableTicket.status()
- const isSuccess = status === L1ToL2MessageStatus.REDEEMED
+ const isSuccess = status === ParentToChildMessageStatus.REDEEMED
+ const successfulRedeem = await retryableTicket.getSuccessfulRedeem()
- const redeemReceipt = (await retryableTicket.getSuccessfulRedeem()) as {
- status: L1ToL2MessageStatus.REDEEMED
- l2TxReceipt: TransactionReceipt
+ if (successfulRedeem.status !== ParentToChildMessageStatus.REDEEMED) {
+ throw new Error(
+ `Unexpected status for retryable ticket (parent tx hash ${tx.txId}), expected ${ParentToChildMessageStatus.REDEEMED} but got ${successfulRedeem.status}`
+ )
}
await updatePendingTransaction({
...tx,
l1ToL2MsgData: {
- l2TxID: redeemReceipt.l2TxReceipt.transactionHash,
+ l2TxID: successfulRedeem.childTxReceipt.transactionHash,
status,
retryableCreationTxID: retryableTicket.retryableCreationId,
fetchingUpdate: false
diff --git a/packages/arb-token-bridge-ui/src/hooks/useRedeemTeleporter.ts b/packages/arb-token-bridge-ui/src/hooks/useRedeemTeleporter.ts
index b86104161d..710fc73067 100644
--- a/packages/arb-token-bridge-ui/src/hooks/useRedeemTeleporter.ts
+++ b/packages/arb-token-bridge-ui/src/hooks/useRedeemTeleporter.ts
@@ -1,6 +1,9 @@
import { useCallback, useState } from 'react'
import { Signer } from 'ethers'
-import { L1ToL2MessageStatus, L1ToL2MessageWriter } from '@arbitrum/sdk'
+import {
+ ParentToChildMessageStatus,
+ ParentToChildMessageWriter
+} from '@arbitrum/sdk'
import { useSigner } from 'wagmi'
import dayjs from 'dayjs'
import { TransactionReceipt } from '@ethersproject/providers'
@@ -26,12 +29,12 @@ import { UseRedeemRetryableResult } from './useRedeemRetryable'
import { getUpdatedTeleportTransfer } from '../components/TransactionHistory/helpers'
// common handling for redeeming all 3 retryables for teleporter
-const redeemRetryable = async (retryable: L1ToL2MessageWriter) => {
+const redeemRetryable = async (retryable: ParentToChildMessageWriter) => {
const redeemTx = await retryable.redeem({ gasLimit: 40_000_000 }) // after a few trials, this gas limit seems to be working fine
await redeemTx.wait()
const status = await retryable.status()
- const isSuccess = status === L1ToL2MessageStatus.REDEEMED
+ const isSuccess = status === ParentToChildMessageStatus.REDEEMED
if (!isSuccess) {
console.error('Redemption failed; status is not REDEEMED', redeemTx)
@@ -40,12 +43,15 @@ const redeemRetryable = async (retryable: L1ToL2MessageWriter) => {
)
}
- const redeemReceipt = (await retryable.getSuccessfulRedeem()) as {
- status: L1ToL2MessageStatus.REDEEMED
- l2TxReceipt: TransactionReceipt
+ const successfulRedeem = await retryable.getSuccessfulRedeem()
+
+ if (successfulRedeem.status !== ParentToChildMessageStatus.REDEEMED) {
+ throw new Error(
+ `Unexpected status for retryable ticket (creation id ${retryable.retryableCreationId}), expected ${ParentToChildMessageStatus.REDEEMED} but got ${successfulRedeem.status}`
+ )
}
- return redeemReceipt
+ return successfulRedeem
}
// this will try to redeem - 1. L1L2Retryable 2. L2ForwarderRetryable
@@ -129,8 +135,8 @@ const redeemTeleporterSecondLeg = async ({
// update the teleport tx in the UI
const l2ToL3MsgData: L2ToL3MessageData = {
...tx.l2ToL3MsgData,
- l3TxID: redemptionReceipt.l2TxReceipt.transactionHash,
- status: L1ToL2MessageStatus.REDEEMED,
+ l3TxID: redemptionReceipt.childTxReceipt.transactionHash,
+ status: ParentToChildMessageStatus.REDEEMED,
retryableCreationTxID: l2L3Retryable.retryableCreationId
}
const updatedTeleporterTx = await getUpdatedTeleportTransfer({
diff --git a/packages/arb-token-bridge-ui/src/hooks/useTransactionHistory.ts b/packages/arb-token-bridge-ui/src/hooks/useTransactionHistory.ts
index 6bb3bc8af9..4830324365 100644
--- a/packages/arb-token-bridge-ui/src/hooks/useTransactionHistory.ts
+++ b/packages/arb-token-bridge-ui/src/hooks/useTransactionHistory.ts
@@ -131,7 +131,7 @@ function getMultiChainFetchList(): ChainPair[] {
// For each destination chain, map to an array of ChainPair objects
return childChainIds.map(childChainId => ({
- parentChainId: chain.chainID,
+ parentChainId: chain.chainId,
childChainId: childChainId
}))
})
diff --git a/packages/arb-token-bridge-ui/src/hooks/useTransactions.ts b/packages/arb-token-bridge-ui/src/hooks/useTransactions.ts
index 0ed9caa361..b51ed6069c 100644
--- a/packages/arb-token-bridge-ui/src/hooks/useTransactions.ts
+++ b/packages/arb-token-bridge-ui/src/hooks/useTransactions.ts
@@ -2,7 +2,7 @@ import { useReducer, useEffect, useMemo } from 'react'
import { TransactionReceipt } from '@ethersproject/abstract-provider'
import { AssetType, TransactionActions } from './arbTokenBridge.types'
import { BigNumber, ethers } from 'ethers'
-import { L1ToL2MessageStatus } from '@arbitrum/sdk'
+import { ParentToChildMessageStatus } from '@arbitrum/sdk'
type Action =
| { type: 'ADD_TRANSACTION'; transaction: Transaction }
@@ -63,14 +63,14 @@ export const txnTypeToLayer = (txnType: TxnType): 1 | 2 => {
}
export interface L1ToL2MessageData {
- status: L1ToL2MessageStatus
+ status: ParentToChildMessageStatus
retryableCreationTxID: string
l2TxID?: string
fetchingUpdate: boolean
}
export interface L2ToL3MessageData {
- status: L1ToL2MessageStatus
+ status: ParentToChildMessageStatus
retryableCreationTxID?: string
l2ForwarderRetryableTxID?: string
l3TxID?: string
diff --git a/packages/arb-token-bridge-ui/src/pages/index.tsx b/packages/arb-token-bridge-ui/src/pages/index.tsx
index cec887c923..0b7d279b2c 100644
--- a/packages/arb-token-bridge-ui/src/pages/index.tsx
+++ b/packages/arb-token-bridge-ui/src/pages/index.tsx
@@ -1,6 +1,6 @@
import React, { useEffect } from 'react'
import dynamic from 'next/dynamic'
-import { addCustomNetwork } from '@arbitrum/sdk'
+import { registerCustomArbitrumNetwork } from '@arbitrum/sdk'
import { Loader } from '../components/common/atoms/Loader'
import {
@@ -26,7 +26,7 @@ export default function Index() {
;[...getOrbitChains(), ...getCustomChainsFromLocalStorage()].forEach(
chain => {
try {
- addCustomNetwork({ customL2Network: chain })
+ registerCustomArbitrumNetwork(chain)
mapCustomChainToNetworkData(chain)
} catch (_) {
// already added
diff --git a/packages/arb-token-bridge-ui/src/state/app/utils.ts b/packages/arb-token-bridge-ui/src/state/app/utils.ts
index 8e47c518e0..33abb12763 100644
--- a/packages/arb-token-bridge-ui/src/state/app/utils.ts
+++ b/packages/arb-token-bridge-ui/src/state/app/utils.ts
@@ -1,5 +1,5 @@
import dayjs from 'dayjs'
-import { L1ToL2MessageStatus } from '@arbitrum/sdk'
+import { ParentToChildMessageStatus } from '@arbitrum/sdk'
import { ethers, BigNumber } from 'ethers'
import { DepositStatus, MergedTransaction } from './state'
@@ -82,7 +82,7 @@ export const getDepositStatus = (tx: Transaction | MergedTransaction) => {
return secondLegDepositStatus
}
switch (l1ToL2MsgData.status) {
- case L1ToL2MessageStatus.REDEEMED:
+ case ParentToChildMessageStatus.REDEEMED:
return DepositStatus.L2_PENDING // tx is still pending if `l1ToL2MsgData` is redeemed (but l2ToL3MsgData is not)
default:
return getDepositStatusFromL1ToL2MessageStatus(l1ToL2MsgData.status)
@@ -94,37 +94,37 @@ export const getDepositStatus = (tx: Transaction | MergedTransaction) => {
return DepositStatus.L2_PENDING
}
switch (l1ToL2MsgData.status) {
- case L1ToL2MessageStatus.NOT_YET_CREATED:
+ case ParentToChildMessageStatus.NOT_YET_CREATED:
return DepositStatus.L2_PENDING
- case L1ToL2MessageStatus.CREATION_FAILED:
+ case ParentToChildMessageStatus.CREATION_FAILED:
return DepositStatus.CREATION_FAILED
- case L1ToL2MessageStatus.EXPIRED:
+ case ParentToChildMessageStatus.EXPIRED:
return tx.assetType === AssetType.ETH
? DepositStatus.L2_SUCCESS
: DepositStatus.EXPIRED
- case L1ToL2MessageStatus.FUNDS_DEPOSITED_ON_L2: {
+ case ParentToChildMessageStatus.FUNDS_DEPOSITED_ON_CHILD: {
return tx.assetType === AssetType.ETH
? DepositStatus.L2_SUCCESS
: DepositStatus.L2_FAILURE
}
- case L1ToL2MessageStatus.REDEEMED:
+ case ParentToChildMessageStatus.REDEEMED:
return DepositStatus.L2_SUCCESS
}
}
function getDepositStatusFromL1ToL2MessageStatus(
- status: L1ToL2MessageStatus
+ status: ParentToChildMessageStatus
): DepositStatus | undefined {
switch (status) {
- case L1ToL2MessageStatus.NOT_YET_CREATED:
+ case ParentToChildMessageStatus.NOT_YET_CREATED:
return DepositStatus.L2_PENDING
- case L1ToL2MessageStatus.CREATION_FAILED:
+ case ParentToChildMessageStatus.CREATION_FAILED:
return DepositStatus.CREATION_FAILED
- case L1ToL2MessageStatus.EXPIRED:
+ case ParentToChildMessageStatus.EXPIRED:
return DepositStatus.EXPIRED
- case L1ToL2MessageStatus.FUNDS_DEPOSITED_ON_L2:
+ case ParentToChildMessageStatus.FUNDS_DEPOSITED_ON_CHILD:
return DepositStatus.L2_FAILURE
- case L1ToL2MessageStatus.REDEEMED:
+ case ParentToChildMessageStatus.REDEEMED:
return DepositStatus.L2_SUCCESS
}
}
diff --git a/packages/arb-token-bridge-ui/src/state/cctpState.ts b/packages/arb-token-bridge-ui/src/state/cctpState.ts
index bd42cc81e5..7732eacfbe 100644
--- a/packages/arb-token-bridge-ui/src/state/cctpState.ts
+++ b/packages/arb-token-bridge-ui/src/state/cctpState.ts
@@ -8,7 +8,7 @@ import { useInterval } from 'react-use'
import { getCctpUtils } from '@/token-bridge-sdk/cctp'
import {
ChainId,
- getBlockTime,
+ getL1BlockTime,
getNetworkName,
isNetwork
} from '../util/networks'
@@ -607,7 +607,7 @@ function getConfirmedDate(tx: MergedTransaction) {
const requiredL1BlocksBeforeConfirmation = getBlockBeforeConfirmation(
tx.parentChainId
)
- const blockTime = getBlockTime(tx.parentChainId)
+ const blockTime = getL1BlockTime(tx.parentChainId)
return dayjs(tx.createdAt).add(
requiredL1BlocksBeforeConfirmation * blockTime,
diff --git a/packages/arb-token-bridge-ui/src/token-bridge-sdk/Erc20DepositStarter.ts b/packages/arb-token-bridge-ui/src/token-bridge-sdk/Erc20DepositStarter.ts
index ba8484bb10..7d90d2b4e9 100644
--- a/packages/arb-token-bridge-ui/src/token-bridge-sdk/Erc20DepositStarter.ts
+++ b/packages/arb-token-bridge-ui/src/token-bridge-sdk/Erc20DepositStarter.ts
@@ -84,7 +84,7 @@ export class Erc20DepositStarter extends BridgeTransferStarter {
const address = await getAddressFromSigner(signer)
const erc20Bridger = await this.getBridger()
- const l2Network = erc20Bridger.l2Network
+ const l2Network = erc20Bridger.childNetwork
if (typeof l2Network.nativeToken === 'undefined') {
return false // native currency doesn't require approval
@@ -143,8 +143,8 @@ export class Erc20DepositStarter extends BridgeTransferStarter {
const erc20Bridger = await this.getBridger()
const txRequest = await erc20Bridger.getApproveGasTokenRequest({
- erc20L1Address: this.sourceChainErc20Address,
- l1Provider: this.sourceChainProvider,
+ erc20ParentAddress: this.sourceChainErc20Address,
+ parentProvider: this.sourceChainProvider,
amount
})
@@ -161,7 +161,7 @@ export class Erc20DepositStarter extends BridgeTransferStarter {
const erc20Bridger = await this.getBridger()
- const l2Network = erc20Bridger.l2Network
+ const l2Network = erc20Bridger.childNetwork
if (typeof l2Network.nativeToken === 'undefined') {
throw Error('Network does not have a custom native token')
@@ -196,8 +196,8 @@ export class Erc20DepositStarter extends BridgeTransferStarter {
)
return erc20Bridger.approveGasToken({
- erc20L1Address: this.sourceChainErc20Address,
- l1Signer: signer,
+ erc20ParentAddress: this.sourceChainErc20Address,
+ parentSigner: signer,
amount: estimatedDestinationChainGasFee
})
}
@@ -251,8 +251,8 @@ export class Erc20DepositStarter extends BridgeTransferStarter {
const erc20Bridger = await this.getBridger()
return erc20Bridger.approveToken({
- erc20L1Address: this.sourceChainErc20Address,
- l1Signer: signer,
+ erc20ParentAddress: this.sourceChainErc20Address,
+ parentSigner: signer,
amount: amount ?? constants.MaxUint256
})
}
@@ -282,10 +282,10 @@ export class Erc20DepositStarter extends BridgeTransferStarter {
const erc20Bridger = await this.getBridger()
const depositRequest = await erc20Bridger.getDepositRequest({
- l1Provider: this.sourceChainProvider,
- l2Provider: this.destinationChainProvider,
+ parentProvider: this.sourceChainProvider,
+ childProvider: this.destinationChainProvider,
from: address,
- erc20L1Address: this.sourceChainErc20Address,
+ erc20ParentAddress: this.sourceChainErc20Address,
destinationAddress,
amount,
retryableGasOverrides: {
@@ -301,7 +301,8 @@ export class Erc20DepositStarter extends BridgeTransferStarter {
const sourceChainTransaction = await erc20Bridger.deposit({
...depositRequest,
- l1Signer: signer,
+ parentSigner: signer,
+ childProvider: this.destinationChainProvider,
overrides: { gasLimit: percentIncrease(gasLimit, BigNumber.from(5)) }
})
diff --git a/packages/arb-token-bridge-ui/src/token-bridge-sdk/Erc20TeleportStarter.ts b/packages/arb-token-bridge-ui/src/token-bridge-sdk/Erc20TeleportStarter.ts
index af0ed725d5..f4fee31dbb 100644
--- a/packages/arb-token-bridge-ui/src/token-bridge-sdk/Erc20TeleportStarter.ts
+++ b/packages/arb-token-bridge-ui/src/token-bridge-sdk/Erc20TeleportStarter.ts
@@ -1,4 +1,4 @@
-import { Erc20L1L3Bridger, getL2Network } from '@arbitrum/sdk'
+import { Erc20L1L3Bridger, getArbitrumNetwork } from '@arbitrum/sdk'
import { ERC20__factory } from '@arbitrum/sdk/dist/lib/abi/factories/ERC20__factory'
import { BigNumber, constants } from 'ethers'
import { StaticJsonRpcProvider } from '@ethersproject/providers'
@@ -34,7 +34,7 @@ export class Erc20TeleportStarter extends BridgeTransferStarter {
return this.l1l3Bridger
}
- const l3Network = await getL2Network(this.destinationChainProvider)
+ const l3Network = await getArbitrumNetwork(this.destinationChainProvider)
this.l1l3Bridger = new Erc20L1L3Bridger(l3Network)
return this.l1l3Bridger
diff --git a/packages/arb-token-bridge-ui/src/token-bridge-sdk/Erc20WithdrawalStarter.ts b/packages/arb-token-bridge-ui/src/token-bridge-sdk/Erc20WithdrawalStarter.ts
index 48125ec5ad..021f73abee 100644
--- a/packages/arb-token-bridge-ui/src/token-bridge-sdk/Erc20WithdrawalStarter.ts
+++ b/packages/arb-token-bridge-ui/src/token-bridge-sdk/Erc20WithdrawalStarter.ts
@@ -206,14 +206,14 @@ export class Erc20WithdrawalStarter extends BridgeTransferStarter {
const request = await erc20Bridger.getWithdrawalRequest({
from: address,
- erc20l1Address: destinationChainErc20Address,
+ erc20ParentAddress: destinationChainErc20Address,
destinationAddress: destinationAddress ?? address,
amount
})
const tx = await erc20Bridger.withdraw({
...request,
- l2Signer: signer,
+ childSigner: signer,
overrides: {
gasLimit: percentIncrease(
await this.sourceChainProvider.estimateGas(request.txRequest),
diff --git a/packages/arb-token-bridge-ui/src/token-bridge-sdk/EthDepositStarter.ts b/packages/arb-token-bridge-ui/src/token-bridge-sdk/EthDepositStarter.ts
index 96e4cf2d7c..13a6480462 100644
--- a/packages/arb-token-bridge-ui/src/token-bridge-sdk/EthDepositStarter.ts
+++ b/packages/arb-token-bridge-ui/src/token-bridge-sdk/EthDepositStarter.ts
@@ -37,17 +37,17 @@ export class EthDepositStarter extends BridgeTransferStarter {
const address = await getAddressFromSigner(signer)
const ethBridger = await this.getBridger()
- const { l2Network } = ethBridger
+ const { childNetwork } = ethBridger
- if (typeof l2Network.nativeToken === 'undefined') {
+ if (typeof childNetwork.nativeToken === 'undefined') {
return false // native currency doesn't require approval
}
const customFeeTokenAllowanceForInbox = await fetchErc20Allowance({
- address: l2Network.nativeToken,
+ address: childNetwork.nativeToken,
provider: this.sourceChainProvider,
owner: address,
- spender: l2Network.ethBridge.inbox
+ spender: childNetwork.ethBridge.inbox
})
// We want to bridge a certain amount of the custom fee token, so we have to check if the allowance is enough.
@@ -70,7 +70,7 @@ export class EthDepositStarter extends BridgeTransferStarter {
}: ApproveNativeCurrencyProps) {
const ethBridger = await this.getBridger()
return ethBridger.approveGasToken({
- l1Signer: signer,
+ parentSigner: signer,
amount
})
}
@@ -111,7 +111,7 @@ export class EthDepositStarter extends BridgeTransferStarter {
const sourceChainTransaction = await ethBridger.deposit({
amount,
- l1Signer: signer,
+ parentSigner: signer,
overrides: { gasLimit: percentIncrease(gasLimit, BigNumber.from(5)) }
})
diff --git a/packages/arb-token-bridge-ui/src/token-bridge-sdk/EthTeleportStarter.ts b/packages/arb-token-bridge-ui/src/token-bridge-sdk/EthTeleportStarter.ts
index df7b09e2f2..57cf90756e 100644
--- a/packages/arb-token-bridge-ui/src/token-bridge-sdk/EthTeleportStarter.ts
+++ b/packages/arb-token-bridge-ui/src/token-bridge-sdk/EthTeleportStarter.ts
@@ -1,4 +1,4 @@
-import { EthL1L3Bridger, getL2Network } from '@arbitrum/sdk'
+import { EthL1L3Bridger, getArbitrumNetwork } from '@arbitrum/sdk'
import { BigNumber, constants } from 'ethers'
import { StaticJsonRpcProvider } from '@ethersproject/providers'
import {
@@ -25,7 +25,7 @@ export class EthTeleportStarter extends BridgeTransferStarter {
return this.l1l3Bridger
}
- const l3Network = await getL2Network(this.destinationChainProvider)
+ const l3Network = await getArbitrumNetwork(this.destinationChainProvider)
this.l1l3Bridger = new EthL1L3Bridger(l3Network)
return this.l1l3Bridger
diff --git a/packages/arb-token-bridge-ui/src/token-bridge-sdk/EthWithdrawalStarter.ts b/packages/arb-token-bridge-ui/src/token-bridge-sdk/EthWithdrawalStarter.ts
index 1ba9fccff9..a6ac06c6a8 100644
--- a/packages/arb-token-bridge-ui/src/token-bridge-sdk/EthWithdrawalStarter.ts
+++ b/packages/arb-token-bridge-ui/src/token-bridge-sdk/EthWithdrawalStarter.ts
@@ -57,7 +57,7 @@ export class EthWithdrawalStarter extends BridgeTransferStarter {
const tx = await ethBridger.withdraw({
...request,
- l2Signer: signer,
+ childSigner: signer,
overrides: {
gasLimit: percentIncrease(
await this.sourceChainProvider.estimateGas(request.txRequest),
diff --git a/packages/arb-token-bridge-ui/src/token-bridge-sdk/teleport.ts b/packages/arb-token-bridge-ui/src/token-bridge-sdk/teleport.ts
index f7e775e761..83599b6e6c 100644
--- a/packages/arb-token-bridge-ui/src/token-bridge-sdk/teleport.ts
+++ b/packages/arb-token-bridge-ui/src/token-bridge-sdk/teleport.ts
@@ -1,7 +1,11 @@
// utils for teleport type transactions
import { Provider } from '@ethersproject/providers'
-import { Erc20L1L3Bridger, EthL1L3Bridger, getL2Network } from '@arbitrum/sdk'
+import {
+ Erc20L1L3Bridger,
+ EthL1L3Bridger,
+ getArbitrumNetwork
+} from '@arbitrum/sdk'
import { L1GatewayRouter__factory } from '@arbitrum/sdk/dist/lib/abi/factories/L1GatewayRouter__factory'
import { IInbox__factory } from '@arbitrum/sdk/dist/lib/abi/factories/IInbox__factory'
import { IBridge__factory } from '@arbitrum/sdk/dist/lib/abi/factories/IBridge__factory'
@@ -25,8 +29,8 @@ export const getL2ConfigForTeleport = async ({
}: {
destinationChainProvider: Provider
}) => {
- const l3Network = await getL2Network(destinationChainProvider)
- const l2ChainId = l3Network.partnerChainID
+ const l3Network = await getArbitrumNetwork(destinationChainProvider)
+ const l2ChainId = l3Network.parentChainId
const l2Provider = getProviderForChainId(l2ChainId)
return { l2ChainId, l2Provider }
}
@@ -46,7 +50,7 @@ export const fetchTeleportStatusFromTxId = async ({
const { l2Provider } = await getL2ConfigForTeleport({
destinationChainProvider
})
- const l3Network = await getL2Network(destinationChainProvider)
+ const l3Network = await getArbitrumNetwork(destinationChainProvider)
// just the type of bridger changes in case of Eth vs Erc20 teleport
const l1l3Bridger = isNativeCurrencyTransfer
@@ -154,7 +158,7 @@ export const fetchTeleportInputParametersFromTxId = async ({
destinationChainProvider: Provider
isNativeCurrencyTransfer: boolean
}) => {
- const l3Network = await getL2Network(destinationChainProvider)
+ const l3Network = await getArbitrumNetwork(destinationChainProvider)
// get Eth deposit request
if (isNativeCurrencyTransfer) {
diff --git a/packages/arb-token-bridge-ui/src/token-bridge-sdk/utils.ts b/packages/arb-token-bridge-ui/src/token-bridge-sdk/utils.ts
index 1c55eef6bc..480d2cf627 100644
--- a/packages/arb-token-bridge-ui/src/token-bridge-sdk/utils.ts
+++ b/packages/arb-token-bridge-ui/src/token-bridge-sdk/utils.ts
@@ -9,7 +9,7 @@ import {
Erc20L1L3Bridger,
EthBridger,
EthL1L3Bridger,
- getL2Network
+ getArbitrumNetwork
} from '@arbitrum/sdk'
export const getAddressFromSigner = async (signer: Signer) => {
@@ -84,7 +84,7 @@ export const getBridger = async ({
const destinationChainProvider = getProviderForChainId(destinationChainId)
if (isTeleportTransfer({ sourceChainId, destinationChainId })) {
- const l3Network = await getL2Network(destinationChainId)
+ const l3Network = await getArbitrumNetwork(destinationChainId)
return isNativeCurrencyTransfer
? new EthL1L3Bridger(l3Network)
diff --git a/packages/arb-token-bridge-ui/src/types/ChainQueryParam.ts b/packages/arb-token-bridge-ui/src/types/ChainQueryParam.ts
index a96150ff61..bd64417782 100644
--- a/packages/arb-token-bridge-ui/src/types/ChainQueryParam.ts
+++ b/packages/arb-token-bridge-ui/src/types/ChainQueryParam.ts
@@ -67,11 +67,11 @@ export function getChainQueryParamForChain(chainId: ChainId): ChainQueryParam {
const orbitChain = orbitChains[chainId]
if (customChain) {
- return customChain.chainID
+ return customChain.chainId
}
if (orbitChain) {
- return orbitChain.slug ?? orbitChain.chainID
+ return orbitChain.slug ?? orbitChain.chainId
}
throw new Error(
@@ -109,7 +109,7 @@ export function getChainForChainKeyQueryParam(
const orbitChain = getOrbitChains().find(
chain =>
chain.slug === chainKeyQueryParam ??
- chain.chainID === Number(chainKeyQueryParam)
+ chain.chainId === Number(chainKeyQueryParam)
)
if (orbitChain) {
diff --git a/packages/arb-token-bridge-ui/src/util/EthDepositUtils.ts b/packages/arb-token-bridge-ui/src/util/EthDepositUtils.ts
index 403ea5816d..87e194b364 100644
--- a/packages/arb-token-bridge-ui/src/util/EthDepositUtils.ts
+++ b/packages/arb-token-bridge-ui/src/util/EthDepositUtils.ts
@@ -1,4 +1,4 @@
-import { EthBridger, getL2Network } from '@arbitrum/sdk'
+import { EthBridger, getArbitrumNetwork } from '@arbitrum/sdk'
import { BigNumber, constants } from 'ethers'
import { DepositGasEstimates } from '../hooks/arbTokenBridge.types'
@@ -20,7 +20,7 @@ async function customFeeTokenAllowanceIsInsufficient(
params: DepositEthEstimateGasParams
) {
const { amount, address, parentChainProvider, childChainProvider } = params
- const l2Network = await getL2Network(childChainProvider)
+ const l2Network = await getArbitrumNetwork(childChainProvider)
if (typeof l2Network.nativeToken === 'undefined') {
throw new Error(
diff --git a/packages/arb-token-bridge-ui/src/util/RetryableUtils.ts b/packages/arb-token-bridge-ui/src/util/RetryableUtils.ts
index 47324eae09..99c1f9df24 100644
--- a/packages/arb-token-bridge-ui/src/util/RetryableUtils.ts
+++ b/packages/arb-token-bridge-ui/src/util/RetryableUtils.ts
@@ -1,7 +1,7 @@
import {
- L1TransactionReceipt,
- L1ToL2MessageWriter as IL1ToL2MessageWriter,
- L1ToL2MessageStatus
+ ParentTransactionReceipt,
+ ParentToChildMessageWriter as IParentToChildMessageWriter,
+ ParentToChildMessageStatus
} from '@arbitrum/sdk'
import { Signer } from '@ethersproject/abstract-signer'
import { Provider } from '@ethersproject/abstract-provider'
@@ -36,17 +36,17 @@ export async function getRetryableTicket({
retryableCreationId,
parentChainProvider,
childChainSigner
-}: GetRetryableTicketParams): Promise {
+}: GetRetryableTicketParams): Promise {
if (!retryableCreationId) {
throw new Error("Error: Couldn't find retryable ticket creation id")
}
- const parentChainTxReceipt = new L1TransactionReceipt(
+ const parentChainTxReceipt = new ParentTransactionReceipt(
await parentChainProvider.getTransactionReceipt(parentChainTxHash)
)
const retryableTicket = (
- await parentChainTxReceipt.getL1ToL2Messages(childChainSigner)
+ await parentChainTxReceipt.getParentToChildMessages(childChainSigner)
)
// Find message with the matching id
.find(m => m.retryableCreationId === retryableCreationId)
@@ -74,10 +74,9 @@ export const getRetryableTicketExpiration = async ({
const depositTxReceipt = await parentChainProvider.getTransactionReceipt(
parentChainTxHash
)
- const parentChainTxReceipt = new L1TransactionReceipt(depositTxReceipt)
- const [parentToChildMsg] = await parentChainTxReceipt.getL1ToL2Messages(
- childChainProvider
- )
+ const parentChainTxReceipt = new ParentTransactionReceipt(depositTxReceipt)
+ const [parentToChildMsg] =
+ await parentChainTxReceipt.getParentToChildMessages(childChainProvider)
const now = dayjs()
@@ -107,7 +106,10 @@ export const getRetryableTicketExpiration = async ({
// utilities for teleporter transactions
export const l1L2RetryableRequiresRedeem = (tx: MergedTransaction) => {
- return tx.l1ToL2MsgData?.status === L1ToL2MessageStatus.FUNDS_DEPOSITED_ON_L2
+ return (
+ tx.l1ToL2MsgData?.status ===
+ ParentToChildMessageStatus.FUNDS_DEPOSITED_ON_CHILD
+ )
}
export const l2ForwarderRetryableRequiresRedeem = (tx: MergedTransaction) => {
@@ -125,7 +127,8 @@ export const secondRetryableLegForTeleportRequiresRedeem = (
) => {
return (
!l2ForwarderRetryableRequiresRedeem(tx) &&
- tx.l2ToL3MsgData?.status === L1ToL2MessageStatus.FUNDS_DEPOSITED_ON_L2
+ tx.l2ToL3MsgData?.status ===
+ ParentToChildMessageStatus.FUNDS_DEPOSITED_ON_CHILD
)
}
diff --git a/packages/arb-token-bridge-ui/src/util/TokenDepositUtils.ts b/packages/arb-token-bridge-ui/src/util/TokenDepositUtils.ts
index ffb2264d0f..fe587f409d 100644
--- a/packages/arb-token-bridge-ui/src/util/TokenDepositUtils.ts
+++ b/packages/arb-token-bridge-ui/src/util/TokenDepositUtils.ts
@@ -1,4 +1,4 @@
-import { Erc20Bridger, getL2Network } from '@arbitrum/sdk'
+import { Erc20Bridger, getArbitrumNetwork } from '@arbitrum/sdk'
import { Inbox__factory } from '@arbitrum/sdk/dist/lib/abi/factories/Inbox__factory'
import { Provider } from '@ethersproject/providers'
import { BigNumber } from 'ethers'
@@ -156,7 +156,7 @@ export async function depositTokenEstimateGas(
)
return fetchTokenFallbackGasEstimates({
- inboxAddress: erc20Bridger.l2Network.ethBridge.inbox,
+ inboxAddress: erc20Bridger.childNetwork.ethBridge.inbox,
parentChainErc20Address,
parentChainProvider,
childChainProvider
@@ -165,9 +165,9 @@ export async function depositTokenEstimateGas(
const { txRequest, retryableData } = await erc20Bridger.getDepositRequest({
amount,
- erc20L1Address: parentChainErc20Address,
- l1Provider: parentChainProvider,
- l2Provider: childChainProvider,
+ erc20ParentAddress: parentChainErc20Address,
+ parentProvider: parentChainProvider,
+ childProvider: childChainProvider,
from: address,
retryableGasOverrides: {
// the gas limit may vary by about 20k due to SSTORE (zero vs nonzero)
@@ -185,7 +185,7 @@ export async function depositTokenEstimateGas(
Sentry.captureException(error)
return fetchTokenFallbackGasEstimates({
- inboxAddress: erc20Bridger.l2Network.ethBridge.inbox,
+ inboxAddress: erc20Bridger.childNetwork.ethBridge.inbox,
parentChainErc20Address,
parentChainProvider,
childChainProvider
@@ -207,9 +207,9 @@ async function addressIsCustomGatewayToken({
parentChainProvider,
childChainProvider
})
- const childChainNetwork = await getL2Network(childChainProvider)
+ const childChainNetwork = await getArbitrumNetwork(childChainProvider)
return (
parentChainGatewayAddress.toLowerCase() ===
- childChainNetwork.tokenBridge.l1CustomGateway.toLowerCase()
+ childChainNetwork.tokenBridge?.parentCustomGateway.toLowerCase()
)
}
diff --git a/packages/arb-token-bridge-ui/src/util/TokenUtils.ts b/packages/arb-token-bridge-ui/src/util/TokenUtils.ts
index 2e1bca0f8c..937f34dfbf 100644
--- a/packages/arb-token-bridge-ui/src/util/TokenUtils.ts
+++ b/packages/arb-token-bridge-ui/src/util/TokenUtils.ts
@@ -6,7 +6,7 @@ import {
EthBridger,
EthL1L3Bridger,
MultiCaller,
- getL2Network
+ getArbitrumNetwork
} from '@arbitrum/sdk'
import { ERC20__factory } from '@arbitrum/sdk/dist/lib/abi/factories/ERC20__factory'
import * as Sentry from '@sentry/react'
@@ -232,7 +232,7 @@ export async function getL1ERC20Address({
}): Promise {
try {
const erc20Bridger = await Erc20Bridger.fromProvider(l2Provider)
- return await erc20Bridger.getL1ERC20Address(erc20L2Address, l2Provider)
+ return await erc20Bridger.getParentErc20Address(erc20L2Address, l2Provider)
} catch (error) {
return null
}
@@ -251,7 +251,7 @@ export async function fetchErc20ParentChainGatewayAddress({
childChainProvider: Provider
}): Promise {
const erc20Bridger = await Erc20Bridger.fromProvider(childChainProvider)
- return erc20Bridger.getL1GatewayAddress(
+ return erc20Bridger.getParentGatewayAddress(
erc20ParentChainAddress,
parentChainProvider
)
@@ -268,7 +268,7 @@ export async function fetchErc20L2GatewayAddress({
l2Provider: Provider
}): Promise {
const erc20Bridger = await Erc20Bridger.fromProvider(l2Provider)
- return erc20Bridger.getL2GatewayAddress(erc20L1Address, l2Provider)
+ return erc20Bridger.getChildGatewayAddress(erc20L1Address, l2Provider)
}
/*
@@ -284,7 +284,7 @@ export async function getL2ERC20Address({
l2Provider: Provider
}): Promise {
const erc20Bridger = await Erc20Bridger.fromProvider(l2Provider)
- return await erc20Bridger.getL2ERC20Address(erc20L1Address, l1Provider)
+ return await erc20Bridger.getChildErc20Address(erc20L1Address, l1Provider)
}
// Given an L1 token address, derive it's L3 counterpart address
@@ -298,19 +298,25 @@ export async function getL3ERC20Address({
l1Provider: Provider
l3Provider: Provider
}): Promise {
- const l3Network = await getL2Network(l3Provider)
+ const l3Network = await getArbitrumNetwork(l3Provider)
const l1l3Bridger = new Erc20L1L3Bridger(l3Network)
const { l2Provider } = await getL2ConfigForTeleport({
destinationChainProvider: l3Provider
})
- return await l1l3Bridger.getL3ERC20Address(
+ return await l1l3Bridger.getL3Erc20Address(
erc20L1Address,
l1Provider,
l2Provider // this is the actual l2 provider
)
}
+function isErc20Bridger(
+ bridger: Erc20Bridger | Erc20L1L3Bridger
+): bridger is Erc20Bridger {
+ return typeof (bridger as Erc20Bridger).isDepositDisabled !== 'undefined'
+}
+
/*
Retrieves data about whether an ERC-20 token is disabled on the router.
*/
@@ -336,7 +342,9 @@ export async function l1TokenIsDisabled({
return false
}
- return erc20Bridger.l1TokenIsDisabled(erc20L1Address, l1Provider)
+ return isErc20Bridger(erc20Bridger)
+ ? erc20Bridger.isDepositDisabled(erc20L1Address, l1Provider)
+ : erc20Bridger.l1TokenIsDisabled(erc20L1Address, l1Provider)
}
type SanitizeTokenOptions = {
@@ -475,8 +483,8 @@ export async function isGatewayRegistered({
const erc20Bridger = await Erc20Bridger.fromProvider(childChainProvider)
return erc20Bridger.isRegistered({
- erc20L1Address: erc20ParentChainAddress,
- l1Provider: parentChainProvider,
- l2Provider: childChainProvider
+ erc20ParentAddress: erc20ParentChainAddress,
+ parentProvider: parentChainProvider,
+ childProvider: childChainProvider
})
}
diff --git a/packages/arb-token-bridge-ui/src/util/WithdrawalUtils.ts b/packages/arb-token-bridge-ui/src/util/WithdrawalUtils.ts
index 5db7cf52df..f4aa78e0a5 100644
--- a/packages/arb-token-bridge-ui/src/util/WithdrawalUtils.ts
+++ b/packages/arb-token-bridge-ui/src/util/WithdrawalUtils.ts
@@ -1,8 +1,11 @@
-import { Erc20Bridger, EthBridger } from '@arbitrum/sdk'
+import {
+ Erc20Bridger,
+ EthBridger,
+ ChildToParentTransactionRequest
+} from '@arbitrum/sdk'
import { Provider } from '@ethersproject/providers'
import { BigNumber } from 'ethers'
import * as Sentry from '@sentry/react'
-import { L2ToL1TransactionRequest } from '@arbitrum/sdk/dist/lib/dataEntities/transactionRequest'
import { GasEstimates } from '../hooks/arbTokenBridge.types'
import { Address } from './AddressUtils'
@@ -27,7 +30,7 @@ export async function withdrawInitTxEstimateGas({
const estimatedParentChainGas = BigNumber.from(0)
try {
- let withdrawalRequest: L2ToL1TransactionRequest
+ let withdrawalRequest: ChildToParentTransactionRequest
if (isToken) {
const bridger = await Erc20Bridger.fromProvider(childChainProvider)
@@ -35,7 +38,7 @@ export async function withdrawInitTxEstimateGas({
amount,
destinationAddress: address,
from: address,
- erc20l1Address: erc20L1Address
+ erc20ParentAddress: erc20L1Address
})
} else {
const bridger = await EthBridger.fromProvider(childChainProvider)
diff --git a/packages/arb-token-bridge-ui/src/util/__tests__/networks.test.ts b/packages/arb-token-bridge-ui/src/util/__tests__/networks.test.ts
index 706d401fd3..f322d84b63 100644
--- a/packages/arb-token-bridge-ui/src/util/__tests__/networks.test.ts
+++ b/packages/arb-token-bridge-ui/src/util/__tests__/networks.test.ts
@@ -1,4 +1,4 @@
-import { constants, addCustomNetwork } from '@arbitrum/sdk'
+import { registerCustomArbitrumNetwork } from '@arbitrum/sdk'
import {
ChainId,
@@ -17,61 +17,39 @@ beforeAll(() => {
}
// add local
- addCustomNetwork({
- customL1Network: {
- blockTime: 10,
- chainID: 1337,
- explorerUrl: '',
- isCustom: true,
- name: 'Ethereum Local',
- partnerChainIDs: [412346],
- isArbitrum: false
+ registerCustomArbitrumNetwork({
+ chainId: 412346,
+ confirmPeriodBlocks: 20,
+ ethBridge: {
+ bridge: '0x2b360a9881f21c3d7aa0ea6ca0de2a3341d4ef3c',
+ inbox: '0xff4a24b22f94979e9ba5f3eb35838aa814bad6f1',
+ outbox: '0x49940929c7cA9b50Ff57a01d3a92817A414E6B9B',
+ rollup: '0x65a59d67da8e710ef9a01eca37f83f84aedec416',
+ sequencerInbox: '0xe7362d0787b51d8c72d504803e5b1d6dcda89540'
},
- customL2Network: {
- chainID: 412346,
- partnerChainIDs: [
- // Orbit chains will go here
- ],
- confirmPeriodBlocks: 20,
- ethBridge: {
- bridge: '0x2b360a9881f21c3d7aa0ea6ca0de2a3341d4ef3c',
- inbox: '0xff4a24b22f94979e9ba5f3eb35838aa814bad6f1',
- outbox: '0x49940929c7cA9b50Ff57a01d3a92817A414E6B9B',
- rollup: '0x65a59d67da8e710ef9a01eca37f83f84aedec416',
- sequencerInbox: '0xe7362d0787b51d8c72d504803e5b1d6dcda89540'
- },
- explorerUrl: '',
- isArbitrum: true,
- isCustom: true,
- name: 'Arbitrum Local',
- partnerChainID: 1337,
- retryableLifetimeSeconds: 604800,
- nitroGenesisBlock: 0,
- nitroGenesisL1Block: 0,
- depositTimeout: 900000,
- blockTime: constants.ARB_MINIMUM_BLOCK_TIME_IN_SECONDS,
- tokenBridge: {
- l1CustomGateway: '0x75E0E92A79880Bd81A69F72983D03c75e2B33dC8',
- l1ERC20Gateway: '0x4Af567288e68caD4aA93A272fe6139Ca53859C70',
- l1GatewayRouter: '0x85D9a8a4bd77b9b5559c1B7FCb8eC9635922Ed49',
- l1MultiCall: '0xA39FFA43ebA037D67a0f4fe91956038ABA0CA386',
- l1ProxyAdmin: '0x7E32b54800705876d3b5cFbc7d9c226a211F7C1a',
- l1Weth: '0xDB2D15a3EB70C347E0D2C2c7861cAFb946baAb48',
- l1WethGateway: '0x408Da76E87511429485C32E4Ad647DD14823Fdc4',
- l2CustomGateway: '0x525c2aBA45F66987217323E8a05EA400C65D06DC',
- l2ERC20Gateway: '0xe1080224B632A93951A7CFA33EeEa9Fd81558b5e',
- l2GatewayRouter: '0x1294b86822ff4976BfE136cB06CF43eC7FCF2574',
- l2Multicall: '0xDB2D15a3EB70C347E0D2C2c7861cAFb946baAb48',
- l2ProxyAdmin: '0xda52b25ddB0e3B9CC393b0690Ac62245Ac772527',
- l2Weth: '0x408Da76E87511429485C32E4Ad647DD14823Fdc4',
- l2WethGateway: '0x4A2bA922052bA54e29c5417bC979Daaf7D5Fe4f4'
- }
+ isCustom: true,
+ name: 'Arbitrum Local',
+ parentChainId: 1337,
+ retryableLifetimeSeconds: 604800,
+ tokenBridge: {
+ parentCustomGateway: '0x75E0E92A79880Bd81A69F72983D03c75e2B33dC8',
+ parentErc20Gateway: '0x4Af567288e68caD4aA93A272fe6139Ca53859C70',
+ parentGatewayRouter: '0x85D9a8a4bd77b9b5559c1B7FCb8eC9635922Ed49',
+ parentMultiCall: '0xA39FFA43ebA037D67a0f4fe91956038ABA0CA386',
+ parentProxyAdmin: '0x7E32b54800705876d3b5cFbc7d9c226a211F7C1a',
+ parentWeth: '0xDB2D15a3EB70C347E0D2C2c7861cAFb946baAb48',
+ parentWethGateway: '0x408Da76E87511429485C32E4Ad647DD14823Fdc4',
+ childCustomGateway: '0x525c2aBA45F66987217323E8a05EA400C65D06DC',
+ childErc20Gateway: '0xe1080224B632A93951A7CFA33EeEa9Fd81558b5e',
+ childGatewayRouter: '0x1294b86822ff4976BfE136cB06CF43eC7FCF2574',
+ childMultiCall: '0xDB2D15a3EB70C347E0D2C2c7861cAFb946baAb48',
+ childProxyAdmin: '0xda52b25ddB0e3B9CC393b0690Ac62245Ac772527',
+ childWeth: '0x408Da76E87511429485C32E4Ad647DD14823Fdc4',
+ childWethGateway: '0x4A2bA922052bA54e29c5417bC979Daaf7D5Fe4f4'
}
})
- addCustomNetwork({
- customL2Network: xaiTestnet
- })
+ registerCustomArbitrumNetwork(xaiTestnet)
})
describe('getBaseChainIdByChainId', () => {
diff --git a/packages/arb-token-bridge-ui/src/util/deposits/helpers.ts b/packages/arb-token-bridge-ui/src/util/deposits/helpers.ts
index 00d77f17dd..6d40703d6b 100644
--- a/packages/arb-token-bridge-ui/src/util/deposits/helpers.ts
+++ b/packages/arb-token-bridge-ui/src/util/deposits/helpers.ts
@@ -1,18 +1,15 @@
import {
- L1TransactionReceipt,
- L1ToL2MessageStatus,
- EthDepositStatus
-} from '@arbitrum/sdk'
-import {
+ ParentTransactionReceipt,
+ ParentToChildMessageStatus,
EthDepositMessage,
- L1ToL2MessageReader,
- L1ToL2MessageReaderClassic
-} from '@arbitrum/sdk/dist/lib/message/L1ToL2Message'
+ EthDepositMessageStatus,
+ ParentToChildMessageReader,
+ ParentToChildMessageReaderClassic,
+ EthL1L3DepositStatus,
+ Erc20L1L3DepositStatus
+} from '@arbitrum/sdk'
+
import { Provider } from '@ethersproject/providers'
-import {
- Erc20DepositStatus as Erc20TeleportStatus,
- EthDepositStatus as EthTeleportStatus
-} from '@arbitrum/sdk/dist/lib/assetBridger/l1l3Bridger'
import { AssetType } from '../../hooks/arbTokenBridge.types'
import {
L1ToL2MessageData,
@@ -94,7 +91,7 @@ export const updateAdditionalDepositData = async ({
if (isClassic) {
return updateClassicDepositStatusData({
depositTx,
- l1ToL2Msg: l1ToL2Msg as L1ToL2MessageReaderClassic,
+ l1ToL2Msg: l1ToL2Msg as ParentToChildMessageReaderClassic,
isEthDeposit,
timestampCreated,
l2Provider
@@ -114,7 +111,7 @@ export const updateAdditionalDepositData = async ({
// finally, else if the transaction is not ETH ie. it's a ERC20 token deposit
return updateTokenDepositStatusData({
depositTx,
- l1ToL2Msg: l1ToL2Msg as L1ToL2MessageReader,
+ l1ToL2Msg: l1ToL2Msg as ParentToChildMessageReader,
timestampCreated,
l1Provider,
l2Provider
@@ -137,9 +134,9 @@ const updateETHDepositStatusData = async ({
if (!ethDepositMessage) return depositTx
const status = await ethDepositMessage.status()
- const isDeposited = status === EthDepositStatus.DEPOSITED
+ const isDeposited = status === EthDepositMessageStatus.DEPOSITED
- const retryableCreationTxID = ethDepositMessage.l2DepositTxHash
+ const retryableCreationTxID = ethDepositMessage.childTxHash
const l2BlockNum = isDeposited
? (await l2Provider.getTransaction(retryableCreationTxID)).blockNumber
@@ -159,11 +156,11 @@ const updateETHDepositStatusData = async ({
: undefined,
l1ToL2MsgData: {
status: isDeposited
- ? L1ToL2MessageStatus.FUNDS_DEPOSITED_ON_L2
- : L1ToL2MessageStatus.NOT_YET_CREATED,
+ ? ParentToChildMessageStatus.FUNDS_DEPOSITED_ON_CHILD
+ : ParentToChildMessageStatus.NOT_YET_CREATED,
retryableCreationTxID,
// Only show `l2TxID` after the deposit is confirmed
- l2TxID: isDeposited ? ethDepositMessage.l2DepositTxHash : undefined,
+ l2TxID: isDeposited ? ethDepositMessage.childTxHash : undefined,
fetchingUpdate: false
}
}
@@ -182,7 +179,7 @@ const updateTokenDepositStatusData = async ({
timestampCreated: string
l1Provider: Provider
l2Provider: Provider
- l1ToL2Msg: L1ToL2MessageReader
+ l1ToL2Msg: ParentToChildMessageReader
}): Promise => {
const updatedDepositTx = {
...depositTx,
@@ -205,8 +202,8 @@ const updateTokenDepositStatusData = async ({
const res = await l1ToL2Msg.getSuccessfulRedeem()
const l2TxID =
- res.status === L1ToL2MessageStatus.REDEEMED
- ? res.l2TxReceipt.transactionHash
+ res.status === ParentToChildMessageStatus.REDEEMED
+ ? res.childTxReceipt.transactionHash
: undefined
const l1ToL2MsgData = {
@@ -216,7 +213,8 @@ const updateTokenDepositStatusData = async ({
retryableCreationTxID: l1ToL2Msg.retryableCreationId
}
- const isDeposited = l1ToL2MsgData.status === L1ToL2MessageStatus.REDEEMED
+ const isDeposited =
+ l1ToL2MsgData.status === ParentToChildMessageStatus.REDEEMED
const l2BlockNum = isDeposited
? (await l2Provider.getTransaction(l1ToL2Msg.retryableCreationId))
@@ -251,7 +249,7 @@ const updateClassicDepositStatusData = async ({
timestampCreated: string
l2Provider: Provider
isEthDeposit: boolean
- l1ToL2Msg: L1ToL2MessageReaderClassic
+ l1ToL2Msg: ParentToChildMessageReaderClassic
}): Promise => {
const updatedDepositTx = {
...depositTx,
@@ -261,15 +259,16 @@ const updateClassicDepositStatusData = async ({
const status = await l1ToL2Msg.status()
const isCompletedEthDeposit =
- isEthDeposit && status >= L1ToL2MessageStatus.FUNDS_DEPOSITED_ON_L2
+ isEthDeposit &&
+ status >= ParentToChildMessageStatus.FUNDS_DEPOSITED_ON_CHILD
const l2TxID = (() => {
if (isCompletedEthDeposit) {
return l1ToL2Msg.retryableCreationId
}
- if (status === L1ToL2MessageStatus.REDEEMED) {
- return l1ToL2Msg.l2TxHash
+ if (status === ParentToChildMessageStatus.REDEEMED) {
+ return l1ToL2Msg.childTxHash
}
return undefined
@@ -341,8 +340,8 @@ export async function fetchTeleporterDepositStatusData({
})
function isEthTeleport(
- status: EthTeleportStatus | Erc20TeleportStatus
- ): status is EthTeleportStatus {
+ status: EthL1L3DepositStatus | Erc20L1L3DepositStatus
+ ): status is EthL1L3DepositStatus {
return isNativeCurrencyTransfer
}
@@ -354,7 +353,7 @@ export async function fetchTeleporterDepositStatusData({
isNativeCurrencyTransfer
})
const l2ToL3MsgData: L2ToL3MessageData = {
- status: L1ToL2MessageStatus.NOT_YET_CREATED,
+ status: ParentToChildMessageStatus.NOT_YET_CREATED,
l2ChainId
}
const l2Retryable = isEthTeleport(depositStatus)
@@ -372,8 +371,8 @@ export async function fetchTeleporterDepositStatusData({
const l1ToL2MsgData: L1ToL2MessageData = {
status: await l2Retryable.status(),
l2TxID:
- l1l2Redeem && l1l2Redeem.status === L1ToL2MessageStatus.REDEEMED
- ? l1l2Redeem.l2TxReceipt.transactionHash
+ l1l2Redeem && l1l2Redeem.status === ParentToChildMessageStatus.REDEEMED
+ ? l1l2Redeem.childTxReceipt.transactionHash
: undefined,
fetchingUpdate: false,
retryableCreationTxID: l2Retryable.retryableCreationId
@@ -385,7 +384,7 @@ export async function fetchTeleporterDepositStatusData({
!depositStatus.completed &&
l2ForwarderFactoryRetryable &&
(await l2ForwarderFactoryRetryable.status()) ===
- L1ToL2MessageStatus.FUNDS_DEPOSITED_ON_L2
+ ParentToChildMessageStatus.FUNDS_DEPOSITED_ON_CHILD
) {
return {
status: l2Retryable ? 'success' : 'failure',
@@ -393,7 +392,7 @@ export async function fetchTeleporterDepositStatusData({
l1ToL2MsgData,
l2ToL3MsgData: {
...l2ToL3MsgData,
- status: L1ToL2MessageStatus.FUNDS_DEPOSITED_ON_L2,
+ status: ParentToChildMessageStatus.FUNDS_DEPOSITED_ON_CHILD,
l2ForwarderRetryableTxID:
l2ForwarderFactoryRetryable.retryableCreationId
}
@@ -402,8 +401,8 @@ export async function fetchTeleporterDepositStatusData({
// extract the l3 transaction details, if any
const l2L3Redeem = await l3Retryable.getSuccessfulRedeem()
const l3TxID =
- l2L3Redeem && l2L3Redeem.status === L1ToL2MessageStatus.REDEEMED
- ? l2L3Redeem.l2TxReceipt.transactionHash
+ l2L3Redeem && l2L3Redeem.status === ParentToChildMessageStatus.REDEEMED
+ ? l2L3Redeem.childTxReceipt.transactionHash
: undefined
const timestampResolved = await getTimestampResolved(
destinationChainProvider,
@@ -415,13 +414,13 @@ export async function fetchTeleporterDepositStatusData({
if (l2ForwarderFactoryRetryable) {
const l2ForwarderRedeem =
await l2ForwarderFactoryRetryable.getSuccessfulRedeem()
- if (l2ForwarderRedeem.status === L1ToL2MessageStatus.REDEEMED) {
+ if (l2ForwarderRedeem.status === ParentToChildMessageStatus.REDEEMED) {
return {
status: l2Retryable ? 'success' : 'failure',
timestampResolved,
l1ToL2MsgData: {
...l1ToL2MsgData,
- l2TxID: l2ForwarderRedeem.l2TxReceipt.transactionHash
+ l2TxID: l2ForwarderRedeem.childTxReceipt.transactionHash
},
l2ToL3MsgData: {
...l2ToL3MsgData,
@@ -458,7 +457,7 @@ export async function fetchTeleporterDepositStatusData({
return {
status: 'pending',
l2ToL3MsgData: {
- status: L1ToL2MessageStatus.NOT_YET_CREATED,
+ status: ParentToChildMessageStatus.NOT_YET_CREATED,
l2ChainId
}
}
@@ -480,9 +479,9 @@ export const getL1ToL2MessageDataFromL1TxHash = async ({
}): Promise<{
isClassic?: boolean
l1ToL2Msg?:
- | L1ToL2MessageReaderClassic
+ | ParentToChildMessageReaderClassic
| EthDepositMessage
- | L1ToL2MessageReader
+ | ParentToChildMessageReader
}> => {
// fetch L1 transaction receipt
const depositTxReceipt = await l1Provider.getTransactionReceipt(depositTxId)
@@ -492,10 +491,12 @@ export const getL1ToL2MessageDataFromL1TxHash = async ({
return {}
}
- const l1TxReceipt = new L1TransactionReceipt(depositTxReceipt)
+ const l1TxReceipt = new ParentTransactionReceipt(depositTxReceipt)
const getClassicDepositMessage = async () => {
- const [l1ToL2Msg] = await l1TxReceipt.getL1ToL2MessagesClassic(l2Provider)
+ const [l1ToL2Msg] = await l1TxReceipt.getParentToChildMessagesClassic(
+ l2Provider
+ )
return {
isClassic: true,
l1ToL2Msg: l1ToL2Msg
@@ -514,7 +515,7 @@ export const getL1ToL2MessageDataFromL1TxHash = async ({
}
// Else, nitro token deposit
- const [l1ToL2Msg] = await l1TxReceipt.getL1ToL2Messages(l2Provider)
+ const [l1ToL2Msg] = await l1TxReceipt.getParentToChildMessages(l2Provider)
return {
isClassic: false,
l1ToL2Msg
diff --git a/packages/arb-token-bridge-ui/src/util/fetchL2Gateways.ts b/packages/arb-token-bridge-ui/src/util/fetchL2Gateways.ts
index 5318855efd..64c9407b21 100644
--- a/packages/arb-token-bridge-ui/src/util/fetchL2Gateways.ts
+++ b/packages/arb-token-bridge-ui/src/util/fetchL2Gateways.ts
@@ -1,5 +1,5 @@
import { Provider } from '@ethersproject/providers'
-import { getL2Network } from '@arbitrum/sdk'
+import { getArbitrumNetwork } from '@arbitrum/sdk'
import {
l2ArbReverseGatewayAddresses,
@@ -15,17 +15,25 @@ import {
* @param l2Provider Provider for the L2 network
*/
export async function fetchL2Gateways(l2Provider: Provider) {
- const l2Network = await getL2Network(l2Provider)
+ const l2Network = await getArbitrumNetwork(l2Provider)
+
+ if (!l2Network.tokenBridge) {
+ return []
+ }
/* configure gateway addresses for fetching withdrawals */
- const { l2ERC20Gateway, l2CustomGateway, l2WethGateway } =
+ const { childErc20Gateway, childCustomGateway, childWethGateway } =
l2Network.tokenBridge
- const gatewaysToUse = [l2ERC20Gateway, l2CustomGateway, l2WethGateway]
- const l2ArbReverseGateway = l2ArbReverseGatewayAddresses[l2Network.chainID]
- const l2DaiGateway = l2DaiGatewayAddresses[l2Network.chainID]
- const l2wstETHGateway = l2wstETHGatewayAddresses[l2Network.chainID]
- const l2LptGateway = l2LptGatewayAddresses[l2Network.chainID]
- const l2MoonGateway = l2MoonGatewayAddresses[l2Network.chainID]
+ const gatewaysToUse = [
+ childErc20Gateway,
+ childCustomGateway,
+ childWethGateway
+ ]
+ const l2ArbReverseGateway = l2ArbReverseGatewayAddresses[l2Network.chainId]
+ const l2DaiGateway = l2DaiGatewayAddresses[l2Network.chainId]
+ const l2wstETHGateway = l2wstETHGatewayAddresses[l2Network.chainId]
+ const l2LptGateway = l2LptGatewayAddresses[l2Network.chainId]
+ const l2MoonGateway = l2MoonGatewayAddresses[l2Network.chainId]
if (l2ArbReverseGateway) {
gatewaysToUse.push(l2ArbReverseGateway)
diff --git a/packages/arb-token-bridge-ui/src/util/networks.ts b/packages/arb-token-bridge-ui/src/util/networks.ts
index e77e91816a..e00ffb29db 100644
--- a/packages/arb-token-bridge-ui/src/util/networks.ts
+++ b/packages/arb-token-bridge-ui/src/util/networks.ts
@@ -1,69 +1,114 @@
import {
- L1Network,
- L2Network,
- addCustomNetwork,
- constants
+ ArbitrumNetwork,
+ getChildrenForNetwork,
+ getArbitrumNetwork,
+ getArbitrumNetworks,
+ registerCustomArbitrumNetwork
} from '@arbitrum/sdk'
-import { networks as arbitrumSdkChains } from '@arbitrum/sdk/dist/lib/dataEntities/networks'
import { loadEnvironmentVariableWithFallback } from './index'
import { getBridgeUiConfigForChain } from './bridgeUiConfig'
import { orbitMainnets, orbitTestnets } from './orbitChainsList'
import { chainIdToInfuraUrl } from './infura'
+export enum ChainId {
+ // L1
+ Ethereum = 1,
+ // L1 Testnets
+ Local = 1337,
+ Sepolia = 11155111,
+ Holesky = 17000,
+ // L2
+ ArbitrumOne = 42161,
+ ArbitrumNova = 42170,
+ // L2 Testnets
+ ArbitrumSepolia = 421614,
+ ArbitrumLocal = 412346
+}
+
+type L1Network = {
+ chainId: ChainId
+ blockTime: number
+}
+
+const l1Networks: { [chainId: number]: L1Network } = {
+ [ChainId.Ethereum]: {
+ chainId: ChainId.Ethereum,
+ blockTime: 12
+ },
+ [ChainId.Sepolia]: {
+ chainId: ChainId.Sepolia,
+ blockTime: 12
+ },
+ [ChainId.Holesky]: {
+ chainId: ChainId.Holesky,
+ blockTime: 12
+ },
+ [ChainId.Local]: {
+ chainId: ChainId.Local,
+ blockTime: 12
+ }
+}
+
export const getChains = () => {
- const chains = Object.values(arbitrumSdkChains)
+ const chains = [...Object.values(l1Networks), ...getArbitrumNetworks()]
+
return chains.filter(chain => {
- // exclude devnet
- if (chain.chainID === 1338) {
- return false
- }
// exclude L1 chains with no child chains
- if (isL1Chain(chain) && chain.partnerChainIDs.length === 0) {
+ if (isL1Chain(chain) && getChildrenForNetwork(chain.chainId).length === 0) {
return false
}
+
return true
})
}
+function getChainByChainId(chainId: number) {
+ return getChains().find(c => c.chainId === chainId)
+}
+
export const customChainLocalStorageKey = 'arbitrum:custom:chains'
-export type ChainWithRpcUrl = L2Network & {
+export type ChainWithRpcUrl = ArbitrumNetwork & {
rpcUrl: string
+ explorerUrl: string
slug?: string
}
-function getParentChain(chain: L2Network): L1Network | L2Network {
- const parentChain = arbitrumSdkChains[chain.partnerChainID]
-
- if (typeof parentChain === 'undefined') {
- throw new Error(
- `[getParentChain] parent chain ${chain.partnerChainID} not found for ${chain.chainID}`
- )
- }
-
- return parentChain
-}
-
export function getBaseChainIdByChainId({
chainId
}: {
chainId: number
}): number {
- const chain = arbitrumSdkChains[chainId]
-
// the chain provided is an L1 chain, so we can return early
- if (!chain || isL1Chain(chain)) {
+ if (isL1Chain({ chainId })) {
return chainId
}
- let currentParentChain = getParentChain(chain)
- // keep following the parent chains until we find the L1 chain
- while (!isL1Chain(currentParentChain)) {
- currentParentChain = getParentChain(currentParentChain)
+ let currentParentChain: L1Network | ArbitrumNetwork
+
+ try {
+ currentParentChain = getArbitrumNetwork(chainId)
+ } catch (error) {
+ return chainId
}
- return currentParentChain.chainID
+ // keep following the parent chains until we find the L1 chain
+ while (true) {
+ if (isL1Chain(currentParentChain)) {
+ return currentParentChain.chainId
+ }
+
+ const newParentChain = getChains().find(
+ c => c.chainId === (currentParentChain as ArbitrumNetwork).parentChainId
+ )
+
+ if (!newParentChain) {
+ return currentParentChain.chainId
+ }
+
+ currentParentChain = newParentChain
+ }
}
export function getCustomChainsFromLocalStorage(): ChainWithRpcUrl[] {
@@ -80,13 +125,17 @@ export function getCustomChainsFromLocalStorage(): ChainWithRpcUrl[] {
return (JSON.parse(customChainsFromLocalStorage) as ChainWithRpcUrl[])
.filter(
// filter again in case local storage is compromised
- chain => !supportedCustomOrbitParentChains.includes(Number(chain.chainID))
+ chain => !supportedCustomOrbitParentChains.includes(Number(chain.chainId))
)
.map(chain => {
+ // chainID is used in previously stored custom orbit chains
+ // if we don't make it backwards compatible then the app will hang on load if at least one old chain is present
+ const _chain = chain as ChainWithRpcUrl & { chainID?: string }
+
return {
- ...chain,
- // make sure chainID is numeric
- chainID: Number(chain.chainID)
+ ..._chain,
+ // make sure chainId is numeric
+ chainId: Number(_chain.chainId ?? _chain.chainID)
}
})
}
@@ -98,14 +147,14 @@ export function getCustomChainFromLocalStorageById(chainId: ChainId) {
return undefined
}
- return customChains.find(chain => chain.chainID === chainId)
+ return customChains.find(chain => chain.chainId === chainId)
}
export function saveCustomChainToLocalStorage(newCustomChain: ChainWithRpcUrl) {
const customChains = getCustomChainsFromLocalStorage()
if (
- customChains.findIndex(chain => chain.chainID === newCustomChain.chainID) >
+ customChains.findIndex(chain => chain.chainId === newCustomChain.chainId) >
-1
) {
// chain already exists
@@ -121,7 +170,7 @@ export function saveCustomChainToLocalStorage(newCustomChain: ChainWithRpcUrl) {
export function removeCustomChainFromLocalStorage(chainId: number) {
const newCustomChains = getCustomChainsFromLocalStorage().filter(
- chain => chain.chainID !== chainId
+ chain => chain.chainId !== chainId
)
localStorage.setItem(
customChainLocalStorageKey,
@@ -129,21 +178,6 @@ export function removeCustomChainFromLocalStorage(chainId: number) {
)
}
-export enum ChainId {
- // L1
- Ethereum = 1,
- // L1 Testnets
- Local = 1337,
- Sepolia = 11155111,
- Holesky = 17000,
- // L2
- ArbitrumOne = 42161,
- ArbitrumNova = 42170,
- // L2 Testnets
- ArbitrumSepolia = 421614,
- ArbitrumLocal = 412346
-}
-
export const supportedCustomOrbitParentChains = [
ChainId.Sepolia,
ChainId.Holesky,
@@ -193,22 +227,18 @@ export const getExplorerUrl = (chainId: ChainId) => {
return explorerUrls[chainId] ?? explorerUrls[ChainId.Ethereum]! //defaults to etherscan, can never be null
}
-export const getBlockTime = (chainId: ChainId) => {
- const network = arbitrumSdkChains[chainId]
- if (!network) {
+export const getL1BlockTime = (chainId: number) => {
+ const chain = getChainByChainId(getBaseChainIdByChainId({ chainId }))
+
+ if (!chain || !isL1Chain(chain)) {
throw new Error(`Couldn't get block time. Unexpected chain ID: ${chainId}`)
}
- return network.blockTime
+
+ return chain.blockTime
}
export const getConfirmPeriodBlocks = (chainId: ChainId) => {
- const network = arbitrumSdkChains[chainId]
- if (!network || !isArbitrumChain(network)) {
- throw new Error(
- `Couldn't get confirm period blocks. Unexpected chain ID: ${chainId}`
- )
- }
- return network.confirmPeriodBlocks
+ return getArbitrumNetwork(chainId).confirmPeriodBlocks
}
export const l2ArbReverseGatewayAddresses: { [chainId: number]: string } = {
@@ -235,19 +265,12 @@ export const l2MoonGatewayAddresses: { [chainId: number]: string } = {
const defaultL1Network: L1Network = {
blockTime: 10,
- chainID: 1337,
- explorerUrl: '',
- isCustom: true,
- name: 'Ethereum Local',
- partnerChainIDs: [412346],
- isArbitrum: false
+ chainId: 1337
}
-const defaultL2Network: L2Network = {
- chainID: 412346,
- partnerChainIDs: [
- // Orbit chains will go here
- ],
+const defaultL2Network: ArbitrumNetwork = {
+ chainId: 412346,
+ parentChainId: ChainId.Local,
confirmPeriodBlocks: 20,
ethBridge: {
bridge: '0x2b360a9881f21c3d7aa0ea6ca0de2a3341d4ef3c',
@@ -256,44 +279,27 @@ const defaultL2Network: L2Network = {
rollup: '0x65a59d67da8e710ef9a01eca37f83f84aedec416',
sequencerInbox: '0xe7362d0787b51d8c72d504803e5b1d6dcda89540'
},
- explorerUrl: '',
- isArbitrum: true,
isCustom: true,
name: 'Arbitrum Local',
- partnerChainID: 1337,
retryableLifetimeSeconds: 604800,
- nitroGenesisBlock: 0,
- nitroGenesisL1Block: 0,
- depositTimeout: 900000,
- blockTime: constants.ARB_MINIMUM_BLOCK_TIME_IN_SECONDS,
tokenBridge: {
- l1CustomGateway: '0x75E0E92A79880Bd81A69F72983D03c75e2B33dC8',
- l1ERC20Gateway: '0x4Af567288e68caD4aA93A272fe6139Ca53859C70',
- l1GatewayRouter: '0x85D9a8a4bd77b9b5559c1B7FCb8eC9635922Ed49',
- l1MultiCall: '0xA39FFA43ebA037D67a0f4fe91956038ABA0CA386',
- l1ProxyAdmin: '0x7E32b54800705876d3b5cFbc7d9c226a211F7C1a',
- l1Weth: '0xDB2D15a3EB70C347E0D2C2c7861cAFb946baAb48',
- l1WethGateway: '0x408Da76E87511429485C32E4Ad647DD14823Fdc4',
- l2CustomGateway: '0x525c2aBA45F66987217323E8a05EA400C65D06DC',
- l2ERC20Gateway: '0xe1080224B632A93951A7CFA33EeEa9Fd81558b5e',
- l2GatewayRouter: '0x1294b86822ff4976BfE136cB06CF43eC7FCF2574',
- l2Multicall: '0xDB2D15a3EB70C347E0D2C2c7861cAFb946baAb48',
- l2ProxyAdmin: '0xda52b25ddB0e3B9CC393b0690Ac62245Ac772527',
- l2Weth: '0x408Da76E87511429485C32E4Ad647DD14823Fdc4',
- l2WethGateway: '0x4A2bA922052bA54e29c5417bC979Daaf7D5Fe4f4'
+ parentCustomGateway: '0x75E0E92A79880Bd81A69F72983D03c75e2B33dC8',
+ parentErc20Gateway: '0x4Af567288e68caD4aA93A272fe6139Ca53859C70',
+ parentGatewayRouter: '0x85D9a8a4bd77b9b5559c1B7FCb8eC9635922Ed49',
+ parentMultiCall: '0xA39FFA43ebA037D67a0f4fe91956038ABA0CA386',
+ parentProxyAdmin: '0x7E32b54800705876d3b5cFbc7d9c226a211F7C1a',
+ parentWeth: '0xDB2D15a3EB70C347E0D2C2c7861cAFb946baAb48',
+ parentWethGateway: '0x408Da76E87511429485C32E4Ad647DD14823Fdc4',
+ childCustomGateway: '0x525c2aBA45F66987217323E8a05EA400C65D06DC',
+ childErc20Gateway: '0xe1080224B632A93951A7CFA33EeEa9Fd81558b5e',
+ childGatewayRouter: '0x1294b86822ff4976BfE136cB06CF43eC7FCF2574',
+ childMultiCall: '0xDB2D15a3EB70C347E0D2C2c7861cAFb946baAb48',
+ childProxyAdmin: '0xda52b25ddB0e3B9CC393b0690Ac62245Ac772527',
+ childWeth: '0x408Da76E87511429485C32E4Ad647DD14823Fdc4',
+ childWethGateway: '0x4A2bA922052bA54e29c5417bC979Daaf7D5Fe4f4'
}
}
-export type RegisterLocalNetworkParams = {
- l1Network: L1Network
- l2Network: L2Network
-}
-
-const registerLocalNetworkDefaultParams: RegisterLocalNetworkParams = {
- l1Network: defaultL1Network,
- l2Network: defaultL2Network
-}
-
export const localL1NetworkRpcUrl = loadEnvironmentVariableWithFallback({
env: process.env.NEXT_PUBLIC_LOCAL_ETHEREUM_RPC_URL,
fallback: 'http://localhost:8545'
@@ -303,16 +309,12 @@ export const localL2NetworkRpcUrl = loadEnvironmentVariableWithFallback({
fallback: 'http://localhost:8547'
})
-export function registerLocalNetwork(
- params: RegisterLocalNetworkParams = registerLocalNetworkDefaultParams
-) {
- const { l1Network, l2Network } = params
-
+export function registerLocalNetwork() {
try {
- rpcURLs[l1Network.chainID] = localL1NetworkRpcUrl
- rpcURLs[l2Network.chainID] = localL2NetworkRpcUrl
+ rpcURLs[defaultL1Network.chainId] = localL1NetworkRpcUrl
+ rpcURLs[defaultL2Network.chainId] = localL2NetworkRpcUrl
- addCustomNetwork({ customL1Network: l1Network, customL2Network: l2Network })
+ registerCustomArbitrumNetwork(defaultL2Network)
} catch (error: any) {
console.error(`Failed to register local network: ${error.message}`)
}
@@ -340,7 +342,7 @@ export function isNetwork(chainId: ChainId) {
const isArbitrum =
isArbitrumOne || isArbitrumNova || isArbitrumLocal || isArbitrumSepolia
- const customChainIds = customChains.map(chain => chain.chainID)
+ const customChainIds = customChains.map(chain => chain.chainId)
const isCustomOrbitChain = customChainIds.includes(chainId)
const isCoreChain = isEthereumMainnetOrTestnet || isArbitrum
@@ -400,7 +402,7 @@ export function getSupportedChainIds({
includeTestnets?: boolean
}): ChainId[] {
return getChains()
- .map(chain => chain.chainID)
+ .map(chain => chain.chainId)
.filter(chainId => {
const { isTestnet } = isNetwork(chainId)
if (includeMainnets && !includeTestnets) {
@@ -420,17 +422,19 @@ export function mapCustomChainToNetworkData(chain: ChainWithRpcUrl) {
// custom chain details need to be added to various objects to make it work with the UI
//
// add RPC
- rpcURLs[chain.chainID] = chain.rpcUrl
+ rpcURLs[chain.chainId] = chain.rpcUrl
// explorer URL
- explorerUrls[chain.chainID] = chain.explorerUrl
+ explorerUrls[chain.chainId] = chain.explorerUrl
}
-function isL1Chain(chain: L1Network | L2Network): chain is L1Network {
- return !chain.isArbitrum
+function isL1Chain(chain: { chainId: number }): chain is L1Network {
+ return typeof l1Networks[chain.chainId] !== 'undefined'
}
-function isArbitrumChain(chain: L1Network | L2Network): chain is L2Network {
- return chain.isArbitrum
+function isArbitrumChain(
+ chain: L1Network | ArbitrumNetwork
+): chain is ArbitrumNetwork {
+ return typeof (chain as ArbitrumNetwork).parentChainId !== 'undefined'
}
export const TELEPORT_ALLOWLIST: { [id: number]: number[] } = {
@@ -438,27 +442,24 @@ export const TELEPORT_ALLOWLIST: { [id: number]: number[] } = {
[ChainId.Sepolia]: [1918988905] // RARI Testnet
}
-export function getChildChainIds(chain: L2Network | L1Network) {
+export function getChildChainIds(chain: ArbitrumNetwork | L1Network) {
const childChainIds = [
- ...(chain.partnerChainIDs ?? []),
- ...(TELEPORT_ALLOWLIST[chain.chainID] ?? []) // for considering teleport (L1-L3 transfers) we will get the L3 children of the chain, if present
+ ...getChildrenForNetwork(chain.chainId).map(chain => chain.chainId),
+ ...(TELEPORT_ALLOWLIST[chain.chainId] ?? []) // for considering teleport (L1-L3 transfers) we will get the L3 children of the chain, if present
]
return Array.from(new Set(childChainIds))
}
export function getDestinationChainIds(chainId: ChainId): ChainId[] {
- const chains = getChains()
- const arbitrumSdkChain = chains.find(chain => chain.chainID === chainId)
+ const chain = getChainByChainId(chainId)
- if (!arbitrumSdkChain) {
+ if (!chain) {
return []
}
- const parentChainId = isArbitrumChain(arbitrumSdkChain)
- ? arbitrumSdkChain.partnerChainID
- : undefined
+ const parentChainId = isArbitrumChain(chain) ? chain.parentChainId : undefined
- const validDestinationChainIds = getChildChainIds(arbitrumSdkChain)
+ const validDestinationChainIds = getChildChainIds(chain)
if (parentChainId) {
// always make parent chain the first element
diff --git a/packages/arb-token-bridge-ui/src/util/orbitChainsList.ts b/packages/arb-token-bridge-ui/src/util/orbitChainsList.ts
index e9b72e52b6..124134107e 100644
--- a/packages/arb-token-bridge-ui/src/util/orbitChainsList.ts
+++ b/packages/arb-token-bridge-ui/src/util/orbitChainsList.ts
@@ -1,4 +1,3 @@
-import { constants } from '@arbitrum/sdk'
import { NativeCurrencyBase } from '../hooks/useNativeCurrency'
import { ChainWithRpcUrl } from './networks'
@@ -27,7 +26,7 @@ export const orbitMainnets: {
[key: number]: OrbitChainConfig
} = {
660279: {
- chainID: 660279,
+ chainId: 660279,
confirmPeriodBlocks: 45818,
ethBridge: {
bridge: '0x7dd8A76bdAeBE3BBBaCD7Aa87f1D4FDa1E60f94f',
@@ -39,33 +38,27 @@ export const orbitMainnets: {
nativeToken: '0x4Cb9a7AE498CEDcBb5EAe9f25736aE7d428C9D66',
explorerUrl: 'https://explorer.xai-chain.net',
rpcUrl: 'https://xai-chain.net/rpc',
- isArbitrum: true,
isCustom: true,
name: 'Xai',
slug: 'xai',
- partnerChainID: 42161,
- partnerChainIDs: [],
+ parentChainId: 42161,
retryableLifetimeSeconds: 604800,
tokenBridge: {
- l1CustomGateway: '0xb15A0826d65bE4c2fDd961b72636168ee70Af030',
- l1ERC20Gateway: '0xb591cE747CF19cF30e11d656EB94134F523A9e77',
- l1GatewayRouter: '0x22CCA5Dc96a4Ac1EC32c9c7C5ad4D66254a24C35',
- l1MultiCall: '0x90B02D9F861017844F30dFbdF725b6aa84E63822',
- l1ProxyAdmin: '0x041f85dd87c46b941dc9b15c6628b19ee5358485',
- l1Weth: '0x0000000000000000000000000000000000000000',
- l1WethGateway: '0x0000000000000000000000000000000000000000',
- l2CustomGateway: '0x96551194230725c72ACF8E9573B1382CCBC70635',
- l2ERC20Gateway: '0x0c71417917D24F4A6A6A55559B98c5cCEcb33F7a',
- l2GatewayRouter: '0xd096e8dE90D34de758B0E0bA4a796eA2e1e272cF',
- l2Multicall: '0xEEC168551A85911Ec3A905e0561b656979f3ea67',
- l2ProxyAdmin: '0x56800fDCFbE19Ea3EE9d115dAC30d95d6459c44E',
- l2Weth: '0x0000000000000000000000000000000000000000',
- l2WethGateway: '0x0000000000000000000000000000000000000000'
+ parentCustomGateway: '0xb15A0826d65bE4c2fDd961b72636168ee70Af030',
+ parentErc20Gateway: '0xb591cE747CF19cF30e11d656EB94134F523A9e77',
+ parentGatewayRouter: '0x22CCA5Dc96a4Ac1EC32c9c7C5ad4D66254a24C35',
+ parentMultiCall: '0x90B02D9F861017844F30dFbdF725b6aa84E63822',
+ parentProxyAdmin: '0x041f85dd87c46b941dc9b15c6628b19ee5358485',
+ parentWeth: '0x0000000000000000000000000000000000000000',
+ parentWethGateway: '0x0000000000000000000000000000000000000000',
+ childCustomGateway: '0x96551194230725c72ACF8E9573B1382CCBC70635',
+ childErc20Gateway: '0x0c71417917D24F4A6A6A55559B98c5cCEcb33F7a',
+ childGatewayRouter: '0xd096e8dE90D34de758B0E0bA4a796eA2e1e272cF',
+ childMultiCall: '0xEEC168551A85911Ec3A905e0561b656979f3ea67',
+ childProxyAdmin: '0x56800fDCFbE19Ea3EE9d115dAC30d95d6459c44E',
+ childWeth: '0x0000000000000000000000000000000000000000',
+ childWethGateway: '0x0000000000000000000000000000000000000000'
},
- nitroGenesisBlock: 0,
- nitroGenesisL1Block: 0,
- depositTimeout: 1800000,
- blockTime: constants.ARB_MINIMUM_BLOCK_TIME_IN_SECONDS,
bridgeUiConfig: {
color: '#F30019',
network: {
@@ -83,7 +76,7 @@ export const orbitMainnets: {
}
},
1380012617: {
- chainID: 1380012617,
+ chainId: 1380012617,
confirmPeriodBlocks: 45818,
ethBridge: {
bridge: '0x255f80Ef2F09FCE0944faBb292b8510F01316Cf0',
@@ -94,33 +87,27 @@ export const orbitMainnets: {
},
explorerUrl: 'https://mainnet.explorer.rarichain.org',
rpcUrl: 'https://mainnet.rpc.rarichain.org/http',
- isArbitrum: true,
isCustom: true,
name: 'RARI Mainnet',
slug: 'rari-mainnet',
- partnerChainID: 42161,
- partnerChainIDs: [],
+ parentChainId: 42161,
retryableLifetimeSeconds: 604800,
tokenBridge: {
- l1CustomGateway: '0x8bE956aB42274056ef4471BEb211b33e258b7324',
- l1ERC20Gateway: '0x46406c88285AD9BE2fB23D9aD96Cb578d824cAb6',
- l1GatewayRouter: '0x2623C144B4d167f70893f6A8968B98c89a6C5F97',
- l1MultiCall: '0x90B02D9F861017844F30dFbdF725b6aa84E63822',
- l1ProxyAdmin: '0x003e70b041abb993006c03e56c8515622a02928c',
- l1Weth: '0x82aF49447D8a07e3bd95BD0d56f35241523fBab1',
- l1WethGateway: '0x8DF47DAe3313663C80f5E94A893190710A719224',
- l2CustomGateway: '0x90E43f5d772e50B01B3F9596f65AD5653467d010',
- l2ERC20Gateway: '0x0CA4c24079a191e08F659699292e5C75274EF253',
- l2GatewayRouter: '0x9a2859B2a83148b8DE25d26643B5407555D219E1',
- l2Multicall: '0x4c753F58Ee9E83B38170abAbBEa8B47976C7ee1b',
- l2ProxyAdmin: '0x18AB1fE7CBeB5F40d2eAf8A3906A966d59E79767',
- l2Weth: '0xf037540e51D71b2D2B1120e8432bA49F29EDFBD0',
- l2WethGateway: '0xd0C21F7960ea9835E7B2E636548f4deDD9E2309C'
+ parentCustomGateway: '0x8bE956aB42274056ef4471BEb211b33e258b7324',
+ parentErc20Gateway: '0x46406c88285AD9BE2fB23D9aD96Cb578d824cAb6',
+ parentGatewayRouter: '0x2623C144B4d167f70893f6A8968B98c89a6C5F97',
+ parentMultiCall: '0x90B02D9F861017844F30dFbdF725b6aa84E63822',
+ parentProxyAdmin: '0x003e70b041abb993006c03e56c8515622a02928c',
+ parentWeth: '0x82aF49447D8a07e3bd95BD0d56f35241523fBab1',
+ parentWethGateway: '0x8DF47DAe3313663C80f5E94A893190710A719224',
+ childCustomGateway: '0x90E43f5d772e50B01B3F9596f65AD5653467d010',
+ childErc20Gateway: '0x0CA4c24079a191e08F659699292e5C75274EF253',
+ childGatewayRouter: '0x9a2859B2a83148b8DE25d26643B5407555D219E1',
+ childMultiCall: '0x4c753F58Ee9E83B38170abAbBEa8B47976C7ee1b',
+ childProxyAdmin: '0x18AB1fE7CBeB5F40d2eAf8A3906A966d59E79767',
+ childWeth: '0xf037540e51D71b2D2B1120e8432bA49F29EDFBD0',
+ childWethGateway: '0xd0C21F7960ea9835E7B2E636548f4deDD9E2309C'
},
- nitroGenesisBlock: 0,
- nitroGenesisL1Block: 0,
- depositTimeout: 1800000,
- blockTime: constants.ARB_MINIMUM_BLOCK_TIME_IN_SECONDS,
bridgeUiConfig: {
color: '#B16EFF',
network: {
@@ -132,7 +119,8 @@ export const orbitMainnets: {
}
},
4078: {
- chainID: 4078,
+ chainId: 4078,
+ parentChainId: 42161,
confirmPeriodBlocks: 7200,
ethBridge: {
bridge: '0xB0EC3C1368AF7d9C2CAE6B7f8E022Cc14d59D2b1',
@@ -143,33 +131,26 @@ export const orbitMainnets: {
},
explorerUrl: 'https://muster-explorer.alt.technology',
rpcUrl: 'https://muster.alt.technology',
- isArbitrum: true,
- isCustom: true,
name: 'Muster',
slug: 'muster',
- partnerChainID: 42161,
- partnerChainIDs: [],
retryableLifetimeSeconds: 604800,
+ isCustom: true,
tokenBridge: {
- l1CustomGateway: '0x6085B32d97be137cC2D6447DcB3BF684C0835D2F',
- l1ERC20Gateway: '0x6551eF99126253B7a838Cf46340030C8eD5342c2',
- l1GatewayRouter: '0x5040981c42fD61219cc567e255129166A840938e',
- l1MultiCall: '0x90B02D9F861017844F30dFbdF725b6aa84E63822',
- l1ProxyAdmin: '0x37119EAcFBc1c83DDAf80F6705b6B19630C101C4',
- l1Weth: '0x82aF49447D8a07e3bd95BD0d56f35241523fBab1',
- l1WethGateway: '0x5e833dd255e2aafFcfB32E874F5e2dFA17A109Ee',
- l2CustomGateway: '0x9FcC7aC2c40eFD0443D8B641e482F04310F113f6',
- l2ERC20Gateway: '0xFdEb5b89bb8FCA61BF77f205B9F89aC3C5fA5dB8',
- l2GatewayRouter: '0xDcF4964Dbb526e91CD6354ac3d1247Ce93C21fc4',
- l2Multicall: '0xaA6669a609862871ce72c91a93E70F1ef7590271',
- l2ProxyAdmin: '0xf10D50B24eDd74ECF3B6Bc22aE74b7F9843e0fDD',
- l2Weth: '0x869Bf8814d77106323745758135b999D34C79a87',
- l2WethGateway: '0xB6145BFd3fA9D270871037238003c66B984787f4'
+ parentCustomGateway: '0x6085B32d97be137cC2D6447DcB3BF684C0835D2F',
+ parentErc20Gateway: '0x6551eF99126253B7a838Cf46340030C8eD5342c2',
+ parentGatewayRouter: '0x5040981c42fD61219cc567e255129166A840938e',
+ parentMultiCall: '0x90B02D9F861017844F30dFbdF725b6aa84E63822',
+ parentProxyAdmin: '0x37119EAcFBc1c83DDAf80F6705b6B19630C101C4',
+ parentWeth: '0x82aF49447D8a07e3bd95BD0d56f35241523fBab1',
+ parentWethGateway: '0x5e833dd255e2aafFcfB32E874F5e2dFA17A109Ee',
+ childCustomGateway: '0x9FcC7aC2c40eFD0443D8B641e482F04310F113f6',
+ childErc20Gateway: '0xFdEb5b89bb8FCA61BF77f205B9F89aC3C5fA5dB8',
+ childGatewayRouter: '0xDcF4964Dbb526e91CD6354ac3d1247Ce93C21fc4',
+ childMultiCall: '0xaA6669a609862871ce72c91a93E70F1ef7590271',
+ childProxyAdmin: '0xf10D50B24eDd74ECF3B6Bc22aE74b7F9843e0fDD',
+ childWeth: '0x869Bf8814d77106323745758135b999D34C79a87',
+ childWethGateway: '0xB6145BFd3fA9D270871037238003c66B984787f4'
},
- nitroGenesisBlock: 0,
- nitroGenesisL1Block: 0,
- depositTimeout: 1800000,
- blockTime: constants.ARB_MINIMUM_BLOCK_TIME_IN_SECONDS,
bridgeUiConfig: {
color: '#DF62DD',
network: {
@@ -180,7 +161,7 @@ export const orbitMainnets: {
}
},
70700: {
- chainID: 70700,
+ chainId: 70700,
confirmPeriodBlocks: 40320,
ethBridge: {
bridge: '0x074fFD20C6D8865752C997f4980Cf70F2a3Fbac6',
@@ -191,33 +172,26 @@ export const orbitMainnets: {
},
explorerUrl: 'https://explorer.apex.proofofplay.com',
rpcUrl: 'https://rpc.apex.proofofplay.com',
- isArbitrum: true,
- isCustom: true,
name: 'Proof of Play Apex',
slug: 'pop-apex',
- partnerChainID: 42161,
- partnerChainIDs: [],
- retryableLifetimeSeconds: 604800,
+ parentChainId: 42161,
+ isCustom: true,
tokenBridge: {
- l1CustomGateway: '0x653f8D34a86207569069164d45a031eE552A4729',
- l1ERC20Gateway: '0x298eb8d9f2F046AC60c01535fad40320CCdeB7c0',
- l1GatewayRouter: '0x2f883c5997Cf60B4d52a2fD4039918E1f9D1147c',
- l1MultiCall: '0x90B02D9F861017844F30dFbdF725b6aa84E63822',
- l1ProxyAdmin: '0xCC6f49cff395c4d160C61112522700dcB007c41d',
- l1Weth: '0x82aF49447D8a07e3bd95BD0d56f35241523fBab1',
- l1WethGateway: '0xEB2Ae03709f63CEa9E5eC6ab25C1838c4A5634BA',
- l2CustomGateway: '0x1a4ba648Ddc0E726085A847178eBff204411EB1A',
- l2ERC20Gateway: '0x7aEdD5a2F3bBd4841711D017Edf90d611aD96a9e',
- l2GatewayRouter: '0x33e59640CD7E5C5E8D43fd46d995efDdDd0Fc930',
- l2Multicall: '0xEB4150a4F26Cf3563B3a86965E269C8873D48527',
- l2ProxyAdmin: '0x518e5FA773118b779a6231303f5593A10D3B3c84',
- l2Weth: '0x77684A04145a5924eFCE0D92A7c4a2A2E8C359de',
- l2WethGateway: '0x6e965dd667cb08f09DE8285317f012Ac889507b4'
+ parentCustomGateway: '0x653f8D34a86207569069164d45a031eE552A4729',
+ parentErc20Gateway: '0x298eb8d9f2F046AC60c01535fad40320CCdeB7c0',
+ parentGatewayRouter: '0x2f883c5997Cf60B4d52a2fD4039918E1f9D1147c',
+ parentMultiCall: '0x90B02D9F861017844F30dFbdF725b6aa84E63822',
+ parentProxyAdmin: '0xCC6f49cff395c4d160C61112522700dcB007c41d',
+ parentWeth: '0x82aF49447D8a07e3bd95BD0d56f35241523fBab1',
+ parentWethGateway: '0xEB2Ae03709f63CEa9E5eC6ab25C1838c4A5634BA',
+ childCustomGateway: '0x1a4ba648Ddc0E726085A847178eBff204411EB1A',
+ childErc20Gateway: '0x7aEdD5a2F3bBd4841711D017Edf90d611aD96a9e',
+ childGatewayRouter: '0x33e59640CD7E5C5E8D43fd46d995efDdDd0Fc930',
+ childMultiCall: '0xEB4150a4F26Cf3563B3a86965E269C8873D48527',
+ childProxyAdmin: '0x518e5FA773118b779a6231303f5593A10D3B3c84',
+ childWeth: '0x77684A04145a5924eFCE0D92A7c4a2A2E8C359de',
+ childWethGateway: '0x6e965dd667cb08f09DE8285317f012Ac889507b4'
},
- nitroGenesisBlock: 0,
- nitroGenesisL1Block: 0,
- depositTimeout: 1800000,
- blockTime: constants.ARB_MINIMUM_BLOCK_TIME_IN_SECONDS,
bridgeUiConfig: {
color: '#3E63DD',
network: {
@@ -229,7 +203,7 @@ export const orbitMainnets: {
}
},
42001: {
- chainID: 42001,
+ chainId: 42001,
confirmPeriodBlocks: 7200,
ethBridge: {
bridge: '0x10B25719f4c0fA1BFF22431438E6b6315059548A',
@@ -241,33 +215,26 @@ export const orbitMainnets: {
nativeToken: '0xBC9B77acA82f6BE43927076D71cd453b625165B8',
explorerUrl: 'https://explorer.pmon.xyz',
rpcUrl: 'https://rpc.pmon.xyz',
- isArbitrum: true,
- isCustom: true,
name: 'PMON Chain',
slug: 'pmon-chain',
- partnerChainID: 42161,
- partnerChainIDs: [],
- retryableLifetimeSeconds: 604800,
+ parentChainId: 42161,
+ isCustom: true,
tokenBridge: {
- l1CustomGateway: '0x38727FfD8aFAdaeF60687D1E623Fd28B58A2B8a8',
- l1ERC20Gateway: '0x341F7f035f1CBA1E879Df40117f797F88aC703ea',
- l1GatewayRouter: '0xAE4BAD578fff3377FC5Ebfd4d52d3fdd7FAB3017',
- l1MultiCall: '0x90B02D9F861017844F30dFbdF725b6aa84E63822',
- l1ProxyAdmin: '0x50AD12758e5e6320d658B358C731AF6C7FE2b853',
- l1Weth: '0x0000000000000000000000000000000000000000',
- l1WethGateway: '0x0000000000000000000000000000000000000000',
- l2CustomGateway: '0xed609532adB4B24cd580d042A05ef15d914Bb7b0',
- l2ERC20Gateway: '0x8624C8046AA1E619528adA4Fa894E431b7CCE139',
- l2GatewayRouter: '0x1d55e424757817CBd27caD7169FE462d6703c57d',
- l2Multicall: '0xB019E8B9448138251a9C58af34FcCd276cE733f6',
- l2ProxyAdmin: '0x8699E41Ed6246708035f7B2E1bf194D9C6Fb7d32',
- l2Weth: '0x0000000000000000000000000000000000000000',
- l2WethGateway: '0x0000000000000000000000000000000000000000'
+ parentCustomGateway: '0x38727FfD8aFAdaeF60687D1E623Fd28B58A2B8a8',
+ parentErc20Gateway: '0x341F7f035f1CBA1E879Df40117f797F88aC703ea',
+ parentGatewayRouter: '0xAE4BAD578fff3377FC5Ebfd4d52d3fdd7FAB3017',
+ parentMultiCall: '0x90B02D9F861017844F30dFbdF725b6aa84E63822',
+ parentProxyAdmin: '0x50AD12758e5e6320d658B358C731AF6C7FE2b853',
+ parentWeth: '0x0000000000000000000000000000000000000000',
+ parentWethGateway: '0x0000000000000000000000000000000000000000',
+ childCustomGateway: '0xed609532adB4B24cd580d042A05ef15d914Bb7b0',
+ childErc20Gateway: '0x8624C8046AA1E619528adA4Fa894E431b7CCE139',
+ childGatewayRouter: '0x1d55e424757817CBd27caD7169FE462d6703c57d',
+ childMultiCall: '0xB019E8B9448138251a9C58af34FcCd276cE733f6',
+ childProxyAdmin: '0x8699E41Ed6246708035f7B2E1bf194D9C6Fb7d32',
+ childWeth: '0x0000000000000000000000000000000000000000',
+ childWethGateway: '0x0000000000000000000000000000000000000000'
},
- nitroGenesisBlock: 0,
- nitroGenesisL1Block: 0,
- depositTimeout: 1800000,
- blockTime: constants.ARB_MINIMUM_BLOCK_TIME_IN_SECONDS,
bridgeUiConfig: {
color: '#FF3369',
network: {
@@ -285,7 +252,7 @@ export const orbitMainnets: {
}
},
12324: {
- chainID: 12324,
+ chainId: 12324,
confirmPeriodBlocks: 7200,
ethBridge: {
bridge: '0x59E088d827CB7983Cd0CC64312E472D7cc8a4F44',
@@ -296,33 +263,27 @@ export const orbitMainnets: {
},
explorerUrl: 'https://explorer.l3x.com',
rpcUrl: 'https://rpc-mainnet.l3x.com',
- isArbitrum: true,
- isCustom: true,
name: 'L3X Network',
slug: 'l3x-network',
- partnerChainID: 42161,
- partnerChainIDs: [],
+ parentChainId: 42161,
retryableLifetimeSeconds: 604800,
+ isCustom: true,
tokenBridge: {
- l1CustomGateway: '0xec80A45ebadD945379f69e9A8929973BCb3E297D',
- l1ERC20Gateway: '0x4fF3E70f30f0394Ad62428751Fe3858740595908',
- l1GatewayRouter: '0x817C8Da480bC6b42a5FA88A26e9eD8c0c03968Cf',
- l1MultiCall: '0x90B02D9F861017844F30dFbdF725b6aa84E63822',
- l1ProxyAdmin: '0x0000000000000000000000000000000000000000',
- l1Weth: '0x82aF49447D8a07e3bd95BD0d56f35241523fBab1',
- l1WethGateway: '0x9bd7C6d040665E95a4FE70b61718abca2E3A62CD',
- l2CustomGateway: '0x1AE90d0FBf03d1bb0685D4bAc5BCe4F4071cB0dc',
- l2ERC20Gateway: '0x76df9F5004F38aC74D0cE664027a1E718AA45E97',
- l2GatewayRouter: '0x460E0a28a1DcE5a15811C3F5775D1e8fd0a08278',
- l2Multicall: '0xA9cfB51510b18300cf056d7e0b96925a1D11f424',
- l2ProxyAdmin: '0xFB027dBD2FBb343FD16D66a63a690B29D51D23AA',
- l2Weth: '0xD3f8b9D33b159E8f5141d28880b216d31B00ee63',
- l2WethGateway: '0x0fEf8843450b7c6a416C30D1E00cbc535Bb905b6'
+ parentCustomGateway: '0xec80A45ebadD945379f69e9A8929973BCb3E297D',
+ parentErc20Gateway: '0x4fF3E70f30f0394Ad62428751Fe3858740595908',
+ parentGatewayRouter: '0x817C8Da480bC6b42a5FA88A26e9eD8c0c03968Cf',
+ parentMultiCall: '0x90B02D9F861017844F30dFbdF725b6aa84E63822',
+ parentProxyAdmin: '0x0000000000000000000000000000000000000000',
+ parentWeth: '0x82aF49447D8a07e3bd95BD0d56f35241523fBab1',
+ parentWethGateway: '0x9bd7C6d040665E95a4FE70b61718abca2E3A62CD',
+ childCustomGateway: '0x1AE90d0FBf03d1bb0685D4bAc5BCe4F4071cB0dc',
+ childErc20Gateway: '0x76df9F5004F38aC74D0cE664027a1E718AA45E97',
+ childGatewayRouter: '0x460E0a28a1DcE5a15811C3F5775D1e8fd0a08278',
+ childMultiCall: '0xA9cfB51510b18300cf056d7e0b96925a1D11f424',
+ childProxyAdmin: '0xFB027dBD2FBb343FD16D66a63a690B29D51D23AA',
+ childWeth: '0xD3f8b9D33b159E8f5141d28880b216d31B00ee63',
+ childWethGateway: '0x0fEf8843450b7c6a416C30D1E00cbc535Bb905b6'
},
- nitroGenesisBlock: 0,
- nitroGenesisL1Block: 0,
- depositTimeout: 1800000,
- blockTime: constants.ARB_MINIMUM_BLOCK_TIME_IN_SECONDS,
bridgeUiConfig: {
color: '#3ABE7B',
network: {
@@ -334,7 +295,7 @@ export const orbitMainnets: {
}
},
94524: {
- chainID: 94524,
+ chainId: 94524,
confirmPeriodBlocks: 40320,
ethBridge: {
bridge: '0x2Be65c5b58F78B02AB5c0e798A9ffC181703D3C1',
@@ -345,33 +306,27 @@ export const orbitMainnets: {
},
explorerUrl: 'https://xchain-explorer.idex.io',
rpcUrl: 'https://xchain-rpc.idex.io',
- isArbitrum: true,
isCustom: true,
name: 'XCHAIN',
slug: 'xchain',
- partnerChainID: 1,
- partnerChainIDs: [],
+ parentChainId: 1,
retryableLifetimeSeconds: 604800,
tokenBridge: {
- l1CustomGateway: '0xEFb1F8ae759c595907782e9bD45F119c9814b308',
- l1ERC20Gateway: '0xFFb821ca61e823a884D79226B0fcD7a99A4d48aa',
- l1GatewayRouter: '0xe0a99350288971456EE4BAc4568495352929B769',
- l1MultiCall: '0x7cdCB0Cc61f47B8Dd8f47C5A29edaDd84a1BDf5e',
- l1ProxyAdmin: '0x22010F5C4c106dfBaffec780196d2F691860Ff62',
- l1Weth: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2',
- l1WethGateway: '0xCAde60b1331f1cF714ECb01f08117780887A0AF4',
- l2CustomGateway: '0x642e40E3F9948F11E18973f79E910f0953dd0C80',
- l2ERC20Gateway: '0xBF14b5F058AE33469eC2D20c9Ee712Cb7eC68A8b',
- l2GatewayRouter: '0xe95788E89383447177312846DB45E6bffc32DD3b',
- l2Multicall: '0x9eE16369804735D75944AA3B025B063C31862786',
- l2ProxyAdmin: '0xc5A8e16EADC3276B3DdB9F122e2c824Dc8a87BfD',
- l2Weth: '0x594Ee2FA451dC7aCFC6785c0d746695f79A4daeE',
- l2WethGateway: '0x377880CbbA57EB9ACb7120028f21Ce043266A431'
+ parentCustomGateway: '0xEFb1F8ae759c595907782e9bD45F119c9814b308',
+ parentErc20Gateway: '0xFFb821ca61e823a884D79226B0fcD7a99A4d48aa',
+ parentGatewayRouter: '0xe0a99350288971456EE4BAc4568495352929B769',
+ parentMultiCall: '0x7cdCB0Cc61f47B8Dd8f47C5A29edaDd84a1BDf5e',
+ parentProxyAdmin: '0x22010F5C4c106dfBaffec780196d2F691860Ff62',
+ parentWeth: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2',
+ parentWethGateway: '0xCAde60b1331f1cF714ECb01f08117780887A0AF4',
+ childCustomGateway: '0x642e40E3F9948F11E18973f79E910f0953dd0C80',
+ childErc20Gateway: '0xBF14b5F058AE33469eC2D20c9Ee712Cb7eC68A8b',
+ childGatewayRouter: '0xe95788E89383447177312846DB45E6bffc32DD3b',
+ childMultiCall: '0x9eE16369804735D75944AA3B025B063C31862786',
+ childProxyAdmin: '0xc5A8e16EADC3276B3DdB9F122e2c824Dc8a87BfD',
+ childWeth: '0x594Ee2FA451dC7aCFC6785c0d746695f79A4daeE',
+ childWethGateway: '0x377880CbbA57EB9ACb7120028f21Ce043266A431'
},
- nitroGenesisBlock: 0,
- nitroGenesisL1Block: 0,
- depositTimeout: 1800000,
- blockTime: constants.ARB_MINIMUM_BLOCK_TIME_IN_SECONDS,
bridgeUiConfig: {
color: '#FD0598',
network: {
@@ -383,7 +338,7 @@ export const orbitMainnets: {
}
},
1996: {
- chainID: 1996,
+ chainId: 1996,
confirmPeriodBlocks: 20,
ethBridge: {
bridge: '0x2f285781B8d58678a3483de52D618198E4d27532',
@@ -395,33 +350,27 @@ export const orbitMainnets: {
nativeToken: '0x8B0E6f19Ee57089F7649A455D89D7bC6314D04e8',
explorerUrl: 'https://explorer.sanko.xyz',
rpcUrl: 'https://mainnet.sanko.xyz',
- isArbitrum: true,
isCustom: true,
name: 'Sanko',
slug: 'sanko',
- partnerChainID: 42161,
- partnerChainIDs: [],
+ parentChainId: 42161,
retryableLifetimeSeconds: 604800,
tokenBridge: {
- l1CustomGateway: '0x5414Dc7c8DB4BeDbf3c772768aE1F5e984bdf47a',
- l1ERC20Gateway: '0xb4951c0C41CFceB0D195A95FE66280457A80a990',
- l1GatewayRouter: '0x847186fbeEBf41eEe9c230360D0bF8585c0Db57B',
- l1MultiCall: '0x909b042B88F587d745dBF52e2569545376f6eAA4',
- l1ProxyAdmin: '0xd18b1C6376633000c85541F7c15c591Ffe5f9556',
- l1Weth: '0x0000000000000000000000000000000000000000',
- l1WethGateway: '0x0000000000000000000000000000000000000000',
- l2CustomGateway: '0x5dd84FB52A27B9D5b760b0373fDeda52D10d3c4a',
- l2ERC20Gateway: '0xAf574BbE2139e39F560C4db1A118E1245aC0983d',
- l2GatewayRouter: '0x505421b85ae7F906e8807bf59ee3Da62e894CDC3',
- l2Multicall: '0x446696a44B13D7B03dBEe837610692d2A71D6232',
- l2ProxyAdmin: '0xa2A055fa56b7B4d36F0320c5c65562854873e5B2',
- l2Weth: '0x0000000000000000000000000000000000000000',
- l2WethGateway: '0x0000000000000000000000000000000000000000'
+ parentCustomGateway: '0x5414Dc7c8DB4BeDbf3c772768aE1F5e984bdf47a',
+ parentErc20Gateway: '0xb4951c0C41CFceB0D195A95FE66280457A80a990',
+ parentGatewayRouter: '0x847186fbeEBf41eEe9c230360D0bF8585c0Db57B',
+ parentMultiCall: '0x909b042B88F587d745dBF52e2569545376f6eAA4',
+ parentProxyAdmin: '0xd18b1C6376633000c85541F7c15c591Ffe5f9556',
+ parentWeth: '0x0000000000000000000000000000000000000000',
+ parentWethGateway: '0x0000000000000000000000000000000000000000',
+ childCustomGateway: '0x5dd84FB52A27B9D5b760b0373fDeda52D10d3c4a',
+ childErc20Gateway: '0xAf574BbE2139e39F560C4db1A118E1245aC0983d',
+ childGatewayRouter: '0x505421b85ae7F906e8807bf59ee3Da62e894CDC3',
+ childMultiCall: '0x446696a44B13D7B03dBEe837610692d2A71D6232',
+ childProxyAdmin: '0xa2A055fa56b7B4d36F0320c5c65562854873e5B2',
+ childWeth: '0x0000000000000000000000000000000000000000',
+ childWethGateway: '0x0000000000000000000000000000000000000000'
},
- nitroGenesisBlock: 0,
- nitroGenesisL1Block: 0,
- depositTimeout: 1800000,
- blockTime: constants.ARB_MINIMUM_BLOCK_TIME_IN_SECONDS,
bridgeUiConfig: {
color: '#0367FF',
network: {
@@ -442,7 +391,7 @@ export const orbitMainnets: {
export const orbitTestnets: { [key in number]: OrbitChainConfig } = {
37714555429: {
- chainID: 37714555429,
+ chainId: 37714555429,
confirmPeriodBlocks: 150,
ethBridge: {
bridge: '0x6c7FAC4edC72E86B3388B48979eF37Ecca5027e6',
@@ -454,33 +403,27 @@ export const orbitTestnets: { [key in number]: OrbitChainConfig } = {
nativeToken: '0x4e6f41acbfa8eb4a3b25e151834d9a14b49b69d2',
explorerUrl: 'https://testnet-explorer-v2.xai-chain.net',
rpcUrl: 'https://testnet-v2.xai-chain.net/rpc',
- isArbitrum: true,
- isCustom: true,
name: 'Xai Testnet',
slug: 'xai-testnet',
- partnerChainID: 421614,
- partnerChainIDs: [],
+ parentChainId: 421614,
retryableLifetimeSeconds: 604800,
+ isCustom: true,
tokenBridge: {
- l1CustomGateway: '0x04e14E04949D49ae9c551ca8Cc3192310Ce65D88',
- l1ERC20Gateway: '0xCcB451C4Df22addCFe1447c58bC6b2f264Bb1256',
- l1GatewayRouter: '0x185b868DBBF41554465fcb99C6FAb9383E15f47A',
- l1MultiCall: '0xA115146782b7143fAdB3065D86eACB54c169d092',
- l1ProxyAdmin: '0x022c515aEAb29aaFf82e86A10950cE14eA89C9c5',
- l1Weth: '0x0000000000000000000000000000000000000000',
- l1WethGateway: '0x0000000000000000000000000000000000000000',
- l2CustomGateway: '0xea1ce1CC75C948488515A3058E10aa82da40cE8F',
- l2ERC20Gateway: '0xD840761a09609394FaFA3404bEEAb312059AC558',
- l2GatewayRouter: '0x3B8ba769a43f34cdD67a20aF60d08D54C9C8f1AD',
- l2Multicall: '0x5CBd60Ae5Af80A42FA8b0F20ADF95A8879844984',
- l2ProxyAdmin: '0x7C1BA251d812fb34aF5C2566040C3C30585aFed9',
- l2Weth: '0x0000000000000000000000000000000000000000',
- l2WethGateway: '0x0000000000000000000000000000000000000000'
+ parentCustomGateway: '0x04e14E04949D49ae9c551ca8Cc3192310Ce65D88',
+ parentErc20Gateway: '0xCcB451C4Df22addCFe1447c58bC6b2f264Bb1256',
+ parentGatewayRouter: '0x185b868DBBF41554465fcb99C6FAb9383E15f47A',
+ parentMultiCall: '0xA115146782b7143fAdB3065D86eACB54c169d092',
+ parentProxyAdmin: '0x022c515aEAb29aaFf82e86A10950cE14eA89C9c5',
+ parentWeth: '0x0000000000000000000000000000000000000000',
+ parentWethGateway: '0x0000000000000000000000000000000000000000',
+ childCustomGateway: '0xea1ce1CC75C948488515A3058E10aa82da40cE8F',
+ childErc20Gateway: '0xD840761a09609394FaFA3404bEEAb312059AC558',
+ childGatewayRouter: '0x3B8ba769a43f34cdD67a20aF60d08D54C9C8f1AD',
+ childMultiCall: '0x5CBd60Ae5Af80A42FA8b0F20ADF95A8879844984',
+ childProxyAdmin: '0x7C1BA251d812fb34aF5C2566040C3C30585aFed9',
+ childWeth: '0x0000000000000000000000000000000000000000',
+ childWethGateway: '0x0000000000000000000000000000000000000000'
},
- nitroGenesisBlock: 0,
- nitroGenesisL1Block: 0,
- depositTimeout: 1800000,
- blockTime: constants.ARB_MINIMUM_BLOCK_TIME_IN_SECONDS,
bridgeUiConfig: {
color: '#F30019',
network: {
@@ -497,7 +440,7 @@ export const orbitTestnets: { [key in number]: OrbitChainConfig } = {
}
},
53457: {
- chainID: 53457,
+ chainId: 53457,
confirmPeriodBlocks: 150,
ethBridge: {
bridge: '0xC0856971702b02A5576219540BD92DAE79a79288',
@@ -509,33 +452,27 @@ export const orbitTestnets: { [key in number]: OrbitChainConfig } = {
nativeToken: '0xAC716E87b0853C0712674e8E3a8435a489F276b4',
explorerUrl: 'https://testnet-scan.dodochain.com',
rpcUrl: 'https://dodochain-testnet.alt.technology',
- isArbitrum: true,
isCustom: true,
name: 'DODOchain Testnet',
slug: 'dodochain-testnet',
- partnerChainID: 421614,
- partnerChainIDs: [],
+ parentChainId: 421614,
retryableLifetimeSeconds: 604800,
tokenBridge: {
- l1CustomGateway: '0xeCa856BE0041184eeda8F2c98896AC4693b168EA',
- l1ERC20Gateway: '0xf57F874845CD652e69f69f020A4d46F4e427bb43',
- l1GatewayRouter: '0xE3661c8313B35BA310Ad89e113561F3C983dC761',
- l1MultiCall: '0xce1CAd780c529e66e3aa6D952a1ED9A6447791c1',
- l1ProxyAdmin: '0x0000000000000000000000000000000000000000',
- l1Weth: '0x0000000000000000000000000000000000000000',
- l1WethGateway: '0x0000000000000000000000000000000000000000',
- l2CustomGateway: '0x6B8C4aD57806fB4563031B79348bcC4CC3bBa7D5',
- l2ERC20Gateway: '0xBb94635f882f03f7641B742F5e3070e6B5108b71',
- l2GatewayRouter: '0x14De2d9c4C7F5ad2d134Eb746207653797693C0D',
- l2Multicall: '0xF6Fd6C87C4cac9A4BF4b6fF4efa4B06bdbbe5D51',
- l2ProxyAdmin: '0x80C5A0C4004B4130b823AfE8D97aAeA3fBFf3fCc',
- l2Weth: '0x0000000000000000000000000000000000000000',
- l2WethGateway: '0x0000000000000000000000000000000000000000'
+ parentCustomGateway: '0xeCa856BE0041184eeda8F2c98896AC4693b168EA',
+ parentErc20Gateway: '0xf57F874845CD652e69f69f020A4d46F4e427bb43',
+ parentGatewayRouter: '0xE3661c8313B35BA310Ad89e113561F3C983dC761',
+ parentMultiCall: '0xce1CAd780c529e66e3aa6D952a1ED9A6447791c1',
+ parentProxyAdmin: '0x0000000000000000000000000000000000000000',
+ parentWeth: '0x0000000000000000000000000000000000000000',
+ parentWethGateway: '0x0000000000000000000000000000000000000000',
+ childCustomGateway: '0x6B8C4aD57806fB4563031B79348bcC4CC3bBa7D5',
+ childErc20Gateway: '0xBb94635f882f03f7641B742F5e3070e6B5108b71',
+ childGatewayRouter: '0x14De2d9c4C7F5ad2d134Eb746207653797693C0D',
+ childMultiCall: '0xF6Fd6C87C4cac9A4BF4b6fF4efa4B06bdbbe5D51',
+ childProxyAdmin: '0x80C5A0C4004B4130b823AfE8D97aAeA3fBFf3fCc',
+ childWeth: '0x0000000000000000000000000000000000000000',
+ childWethGateway: '0x0000000000000000000000000000000000000000'
},
- nitroGenesisBlock: 0,
- nitroGenesisL1Block: 0,
- depositTimeout: 1800000,
- blockTime: constants.ARB_MINIMUM_BLOCK_TIME_IN_SECONDS,
bridgeUiConfig: {
color: '#B88B1E',
network: {
@@ -552,7 +489,7 @@ export const orbitTestnets: { [key in number]: OrbitChainConfig } = {
}
},
12325: {
- chainID: 12325,
+ chainId: 12325,
confirmPeriodBlocks: 150,
ethBridge: {
bridge: '0x98DBc5f9d4BB16A7c8C21e36789E673b6E0FDf37',
@@ -563,33 +500,27 @@ export const orbitTestnets: { [key in number]: OrbitChainConfig } = {
},
explorerUrl: 'https://explorer-testnet.l3x.com',
rpcUrl: 'https://rpc-testnet.l3x.com',
- isArbitrum: true,
isCustom: true,
name: 'L3X Network Testnet',
slug: 'l3x-network-testnet',
- partnerChainID: 421614,
- partnerChainIDs: [],
+ parentChainId: 421614,
retryableLifetimeSeconds: 604800,
tokenBridge: {
- l1CustomGateway: '0x00eE97A18A85a58fbfddA2CCa2Bdb3B88d1068b3',
- l1ERC20Gateway: '0xD2e9EA14CE4C61630a87bC652f5cD51deA7C66bA',
- l1GatewayRouter: '0x8D684F7fA0aE2a13e0a1FAa60699ee2db46505a8',
- l1MultiCall: '0xce1CAd780c529e66e3aa6D952a1ED9A6447791c1',
- l1ProxyAdmin: '0x0000000000000000000000000000000000000000',
- l1Weth: '0x980B62Da83eFf3D4576C647993b0c1D7faf17c73',
- l1WethGateway: '0xB001D0E3a43EbB820E82720a2Bd74f4C03a5b424',
- l2CustomGateway: '0xcc3fa38D4a18474DF92107d328bF4A6F7C9fA29A',
- l2ERC20Gateway: '0x7aeD67245Db9b4E6bB26791b48E20aBbA9411EdD',
- l2GatewayRouter: '0xF40E36d3043373Ce6F89abe3914d631135342C28',
- l2Multicall: '0xa8D4b59f0FB23CB785d360E73C7364dDB3e34A62',
- l2ProxyAdmin: '0xC381Ff423f37d42b0b9B84195D9C9C31eDc26e73',
- l2Weth: '0x6793D074d3A410C803B8C2086E569883D6e928F1',
- l2WethGateway: '0x4F24D0244B29d76ED1FBD3c8a9967b72b78B9DBd'
+ parentCustomGateway: '0x00eE97A18A85a58fbfddA2CCa2Bdb3B88d1068b3',
+ parentErc20Gateway: '0xD2e9EA14CE4C61630a87bC652f5cD51deA7C66bA',
+ parentGatewayRouter: '0x8D684F7fA0aE2a13e0a1FAa60699ee2db46505a8',
+ parentMultiCall: '0xce1CAd780c529e66e3aa6D952a1ED9A6447791c1',
+ parentProxyAdmin: '0x0000000000000000000000000000000000000000',
+ parentWeth: '0x980B62Da83eFf3D4576C647993b0c1D7faf17c73',
+ parentWethGateway: '0xB001D0E3a43EbB820E82720a2Bd74f4C03a5b424',
+ childCustomGateway: '0xcc3fa38D4a18474DF92107d328bF4A6F7C9fA29A',
+ childErc20Gateway: '0x7aeD67245Db9b4E6bB26791b48E20aBbA9411EdD',
+ childGatewayRouter: '0xF40E36d3043373Ce6F89abe3914d631135342C28',
+ childMultiCall: '0xa8D4b59f0FB23CB785d360E73C7364dDB3e34A62',
+ childProxyAdmin: '0xC381Ff423f37d42b0b9B84195D9C9C31eDc26e73',
+ childWeth: '0x6793D074d3A410C803B8C2086E569883D6e928F1',
+ childWethGateway: '0x4F24D0244B29d76ED1FBD3c8a9967b72b78B9DBd'
},
- nitroGenesisBlock: 0,
- nitroGenesisL1Block: 0,
- depositTimeout: 1800000,
- blockTime: constants.ARB_MINIMUM_BLOCK_TIME_IN_SECONDS,
bridgeUiConfig: {
color: '#3ABE7B',
network: {
@@ -601,7 +532,7 @@ export const orbitTestnets: { [key in number]: OrbitChainConfig } = {
}
},
1918988905: {
- chainID: 1918988905,
+ chainId: 1918988905,
confirmPeriodBlocks: 64,
ethBridge: {
bridge: '0x55f0a866E9A5B59Eab0269D62d121BC0978a4346',
@@ -612,33 +543,27 @@ export const orbitTestnets: { [key in number]: OrbitChainConfig } = {
},
explorerUrl: 'https://testnet.explorer.rarichain.org',
rpcUrl: 'https://testnet.rpc.rarichain.org/http',
- isArbitrum: true,
isCustom: true,
name: 'RARI Testnet',
slug: 'rari-testnet',
- partnerChainID: 421614,
- partnerChainIDs: [],
+ parentChainId: 421614,
retryableLifetimeSeconds: 604800,
tokenBridge: {
- l1CustomGateway: '0x7EDA0d4c14Af6B0920F4e3C0F0cA18d18212fB0A',
- l1ERC20Gateway: '0x2c9Dd2b2cd55266e3b5c3C95840F3c037fbCb856',
- l1GatewayRouter: '0xece5902AD6Bbf4689EA8aD4B95237fAf5B65FB26',
- l1MultiCall: '0x6550ef0Ff640fDD871C9321D2483801c891D7d54',
- l1ProxyAdmin: '0x311C5Fe27874FBc8ea9D06BeDA2ff316E37c3E2f',
- l1Weth: '0x980B62Da83eFf3D4576C647993b0c1D7faf17c73',
- l1WethGateway: '0x1A0d79b35953fDA4F2b7A3B0BC893C767AAe44aE',
- l2CustomGateway: '0x311C5Fe27874FBc8ea9D06BeDA2ff316E37c3E2f',
- l2ERC20Gateway: '0x68b350501592a1501ffc2C8f1B28Ca896253fFe8',
- l2GatewayRouter: '0x52d17dcd26F9B19A2672dC79686f1279391Aa449',
- l2Multicall: '0x1A0d79b35953fDA4F2b7A3B0BC893C767AAe44aE',
- l2ProxyAdmin: '0x25Da52b43f252Bc52Ce038a7541eCC62b9347229',
- l2Weth: '0x2c9Dd2b2cd55266e3b5c3C95840F3c037fbCb856',
- l2WethGateway: '0xece5902AD6Bbf4689EA8aD4B95237fAf5B65FB26'
+ parentCustomGateway: '0x7EDA0d4c14Af6B0920F4e3C0F0cA18d18212fB0A',
+ parentErc20Gateway: '0x2c9Dd2b2cd55266e3b5c3C95840F3c037fbCb856',
+ parentGatewayRouter: '0xece5902AD6Bbf4689EA8aD4B95237fAf5B65FB26',
+ parentMultiCall: '0x6550ef0Ff640fDD871C9321D2483801c891D7d54',
+ parentProxyAdmin: '0x311C5Fe27874FBc8ea9D06BeDA2ff316E37c3E2f',
+ parentWeth: '0x980B62Da83eFf3D4576C647993b0c1D7faf17c73',
+ parentWethGateway: '0x1A0d79b35953fDA4F2b7A3B0BC893C767AAe44aE',
+ childCustomGateway: '0x311C5Fe27874FBc8ea9D06BeDA2ff316E37c3E2f',
+ childErc20Gateway: '0x68b350501592a1501ffc2C8f1B28Ca896253fFe8',
+ childGatewayRouter: '0x52d17dcd26F9B19A2672dC79686f1279391Aa449',
+ childMultiCall: '0x1A0d79b35953fDA4F2b7A3B0BC893C767AAe44aE',
+ childProxyAdmin: '0x25Da52b43f252Bc52Ce038a7541eCC62b9347229',
+ childWeth: '0x2c9Dd2b2cd55266e3b5c3C95840F3c037fbCb856',
+ childWethGateway: '0xece5902AD6Bbf4689EA8aD4B95237fAf5B65FB26'
},
- nitroGenesisBlock: 0,
- nitroGenesisL1Block: 0,
- depositTimeout: 1800000,
- blockTime: constants.ARB_MINIMUM_BLOCK_TIME_IN_SECONDS,
bridgeUiConfig: {
color: '#B16EFF',
network: {
@@ -650,7 +575,7 @@ export const orbitTestnets: { [key in number]: OrbitChainConfig } = {
}
},
1183: {
- chainID: 1183,
+ chainId: 1183,
confirmPeriodBlocks: 150,
ethBridge: {
bridge: '0xCAeCF7c5c2769e250Ef69592dD470D40BC61D1f7',
@@ -662,33 +587,27 @@ export const orbitTestnets: { [key in number]: OrbitChainConfig } = {
nativeToken: '0x566f8345F7bF45358FaB2802C19c60D691dE04e4',
explorerUrl: 'https://testnet.theatlas.tech',
rpcUrl: 'https://theatlas.tech',
- isArbitrum: true,
isCustom: true,
name: 'Atlas Testnet',
slug: 'atlas-testnet',
- partnerChainID: 421614,
- partnerChainIDs: [],
+ parentChainId: 421614,
retryableLifetimeSeconds: 604800,
tokenBridge: {
- l1CustomGateway: '0xE5A8943e36f93491f97A521447772fCF529533B5',
- l1ERC20Gateway: '0xBc89C0A2CCA8A0e1583AA6d4e22B36E26661C78E',
- l1GatewayRouter: '0xc93fDF8327e04776fd184188bB4EC8521E5E96D7',
- l1MultiCall: '0xce1CAd780c529e66e3aa6D952a1ED9A6447791c1',
- l1ProxyAdmin: '0x0000000000000000000000000000000000000000',
- l1Weth: '0x0000000000000000000000000000000000000000',
- l1WethGateway: '0x0000000000000000000000000000000000000000',
- l2CustomGateway: '0x2c2Be954C9B79d9cA2CF145d9d6363F3c3784615',
- l2ERC20Gateway: '0xDfCD9f6154BEA2E98e8aE493f3Fec2E22De52D6a',
- l2GatewayRouter: '0xBc63Ec54dA9Ee3B2b3D4cA5DE3622a3F85e0F219',
- l2Multicall: '0x54AFaf5Fd025A99708e73e52c317454bD52B1e77',
- l2ProxyAdmin: '0xE1C9a27C47bb9691bA5b4E35eb7617B39F6098B9',
- l2Weth: '0x0000000000000000000000000000000000000000',
- l2WethGateway: '0x0000000000000000000000000000000000000000'
+ parentCustomGateway: '0xE5A8943e36f93491f97A521447772fCF529533B5',
+ parentErc20Gateway: '0xBc89C0A2CCA8A0e1583AA6d4e22B36E26661C78E',
+ parentGatewayRouter: '0xc93fDF8327e04776fd184188bB4EC8521E5E96D7',
+ parentMultiCall: '0xce1CAd780c529e66e3aa6D952a1ED9A6447791c1',
+ parentProxyAdmin: '0x0000000000000000000000000000000000000000',
+ parentWeth: '0x0000000000000000000000000000000000000000',
+ parentWethGateway: '0x0000000000000000000000000000000000000000',
+ childCustomGateway: '0x2c2Be954C9B79d9cA2CF145d9d6363F3c3784615',
+ childErc20Gateway: '0xDfCD9f6154BEA2E98e8aE493f3Fec2E22De52D6a',
+ childGatewayRouter: '0xBc63Ec54dA9Ee3B2b3D4cA5DE3622a3F85e0F219',
+ childMultiCall: '0x54AFaf5Fd025A99708e73e52c317454bD52B1e77',
+ childProxyAdmin: '0xE1C9a27C47bb9691bA5b4E35eb7617B39F6098B9',
+ childWeth: '0x0000000000000000000000000000000000000000',
+ childWethGateway: '0x0000000000000000000000000000000000000000'
},
- nitroGenesisBlock: 0,
- nitroGenesisL1Block: 0,
- depositTimeout: 1800000,
- blockTime: constants.ARB_MINIMUM_BLOCK_TIME_IN_SECONDS,
bridgeUiConfig: {
color: '#889B6F',
network: {
@@ -728,12 +647,12 @@ export function getInboxAddressFromOrbitChainId(chainId: number) {
return (
getOrbitChains()
//
- .find(chain => chain.chainID === chainId)?.ethBridge.inbox
+ .find(chain => chain.chainId === chainId)?.ethBridge.inbox
)
}
export function getChainIdFromInboxAddress(inboxAddress: string) {
return getOrbitChains().find(
chain => chain.ethBridge.inbox.toLowerCase() === inboxAddress.toLowerCase()
- )?.chainID
+ )?.chainId
}
diff --git a/packages/arb-token-bridge-ui/src/util/teleports/helpers.ts b/packages/arb-token-bridge-ui/src/util/teleports/helpers.ts
index 7e5feb849d..e3cbe2338d 100644
--- a/packages/arb-token-bridge-ui/src/util/teleports/helpers.ts
+++ b/packages/arb-token-bridge-ui/src/util/teleports/helpers.ts
@@ -1,6 +1,6 @@
import { utils } from 'ethers'
import { getProviderForChainId } from '@/token-bridge-sdk/utils'
-import { RetryableMessageParams } from '@arbitrum/sdk/dist/lib/dataEntities/message'
+import { RetryableMessageParams } from '@arbitrum/sdk'
import {
fetchTeleportInputParametersFromTxId,
getL3ChainIdFromTeleportEvents
diff --git a/packages/arb-token-bridge-ui/src/util/wagmi/setup.ts b/packages/arb-token-bridge-ui/src/util/wagmi/setup.ts
index 449a115a96..c8c062bed7 100644
--- a/packages/arb-token-bridge-ui/src/util/wagmi/setup.ts
+++ b/packages/arb-token-bridge-ui/src/util/wagmi/setup.ts
@@ -19,10 +19,10 @@ import { getWagmiChain } from './getWagmiChain'
import { customInfuraProvider } from '../infura'
const customChains = getCustomChainsFromLocalStorage().map(chain =>
- getWagmiChain(chain.chainID)
+ getWagmiChain(chain.chainId)
)
const wagmiOrbitChains = getOrbitChains().map(chain =>
- getWagmiChain(chain.chainID)
+ getWagmiChain(chain.chainId)
)
const chainList = isTestingEnvironment
diff --git a/packages/arb-token-bridge-ui/src/util/wagmi/wagmiAdditionalNetworks.ts b/packages/arb-token-bridge-ui/src/util/wagmi/wagmiAdditionalNetworks.ts
index d8c6ca9d6f..c6f9bc8811 100644
--- a/packages/arb-token-bridge-ui/src/util/wagmi/wagmiAdditionalNetworks.ts
+++ b/packages/arb-token-bridge-ui/src/util/wagmi/wagmiAdditionalNetworks.ts
@@ -5,10 +5,10 @@ import { ChainId, ChainWithRpcUrl, explorerUrls, rpcURLs } from '../networks'
import { getBridgeUiConfigForChain } from '../bridgeUiConfig'
export function chainToWagmiChain(chain: ChainWithRpcUrl): Chain {
- const { nativeTokenData } = getBridgeUiConfigForChain(chain.chainID)
+ const { nativeTokenData } = getBridgeUiConfigForChain(chain.chainId)
return {
- id: chain.chainID,
+ id: chain.chainId,
name: chain.name,
network: chain.name.toLowerCase().split(' ').join('-'),
nativeCurrency: nativeTokenData ?? ether,
diff --git a/packages/arb-token-bridge-ui/src/util/withdrawals/fetchETHWithdrawalsFromEventLogs.ts b/packages/arb-token-bridge-ui/src/util/withdrawals/fetchETHWithdrawalsFromEventLogs.ts
index ad8dff4bd0..a9955e6dc8 100644
--- a/packages/arb-token-bridge-ui/src/util/withdrawals/fetchETHWithdrawalsFromEventLogs.ts
+++ b/packages/arb-token-bridge-ui/src/util/withdrawals/fetchETHWithdrawalsFromEventLogs.ts
@@ -1,5 +1,5 @@
import { Provider, BlockTag } from '@ethersproject/providers'
-import { L2ToL1MessageReader } from '@arbitrum/sdk'
+import { ChildToParentMessageReader } from '@arbitrum/sdk'
/**
* Fetches initiated ETH withdrawals from event logs in range of [fromBlock, toBlock].
@@ -25,7 +25,7 @@ export function fetchETHWithdrawalsFromEventLogs({
return []
}
// funds sent by this address
- return L2ToL1MessageReader.getL2ToL1Events(
+ return ChildToParentMessageReader.getChildToParentEvents(
l2Provider,
{ fromBlock, toBlock },
undefined,
diff --git a/packages/arb-token-bridge-ui/src/util/withdrawals/fetchTokenWithdrawalsFromEventLogs.ts b/packages/arb-token-bridge-ui/src/util/withdrawals/fetchTokenWithdrawalsFromEventLogs.ts
index 0831ed38e2..0b3d9531e3 100644
--- a/packages/arb-token-bridge-ui/src/util/withdrawals/fetchTokenWithdrawalsFromEventLogs.ts
+++ b/packages/arb-token-bridge-ui/src/util/withdrawals/fetchTokenWithdrawalsFromEventLogs.ts
@@ -1,6 +1,5 @@
import { Provider, BlockTag } from '@ethersproject/providers'
-import { Erc20Bridger } from '@arbitrum/sdk'
-import { EventArgs } from '@arbitrum/sdk/dist/lib/dataEntities/event'
+import { Erc20Bridger, EventArgs } from '@arbitrum/sdk'
import { WithdrawalInitiatedEvent } from '@arbitrum/sdk/dist/lib/abi/L2ArbitrumGateway'
function dedupeEvents(
@@ -38,13 +37,13 @@ export async function fetchTokenWithdrawalsFromEventLogs({
l2GatewayAddresses?: string[]
}) {
const erc20Bridger = await Erc20Bridger.fromProvider(l2Provider)
- const promises: ReturnType[] = []
+ const promises: ReturnType[] = []
l2GatewayAddresses.forEach(gatewayAddress => {
// funds sent by this address
if (sender) {
promises.push(
- erc20Bridger.getL2WithdrawalEvents(
+ erc20Bridger.getWithdrawalEvents(
l2Provider,
gatewayAddress,
{ fromBlock, toBlock },
@@ -58,7 +57,7 @@ export async function fetchTokenWithdrawalsFromEventLogs({
// funds received by this address
if (receiver) {
promises.push(
- erc20Bridger.getL2WithdrawalEvents(
+ erc20Bridger.getWithdrawalEvents(
l2Provider,
gatewayAddress,
{ fromBlock, toBlock },
diff --git a/packages/arb-token-bridge-ui/src/util/withdrawals/helpers.ts b/packages/arb-token-bridge-ui/src/util/withdrawals/helpers.ts
index cf96d5827e..82e7706695 100644
--- a/packages/arb-token-bridge-ui/src/util/withdrawals/helpers.ts
+++ b/packages/arb-token-bridge-ui/src/util/withdrawals/helpers.ts
@@ -1,7 +1,10 @@
import { utils } from 'ethers'
import { Provider } from '@ethersproject/providers'
import { BigNumber } from '@ethersproject/bignumber'
-import { L2ToL1MessageReader, L2TransactionReceipt } from '@arbitrum/sdk'
+import {
+ ChildToParentMessageReader,
+ ChildTransactionReceipt
+} from '@arbitrum/sdk'
import { FetchWithdrawalsFromSubgraphResult } from './fetchWithdrawalsFromSubgraph'
import { fetchErc20Data } from '../TokenUtils'
import {
@@ -51,8 +54,8 @@ export async function attachTimestampToTokenWithdrawal({
l2Provider: Provider
}) {
const txReceipt = await l2Provider.getTransactionReceipt(withdrawal.txHash)
- const l2TxReceipt = new L2TransactionReceipt(txReceipt)
- const [event] = l2TxReceipt.getL2ToL1Events()
+ const l2TxReceipt = new ChildTransactionReceipt(txReceipt)
+ const [event] = l2TxReceipt.getChildToParentEvents()
return {
...withdrawal,
@@ -112,7 +115,7 @@ export async function getOutgoingMessageState(
return OutgoingMessageState.EXECUTED
}
- const messageReader = new L2ToL1MessageReader(l1Provider, event)
+ const messageReader = new ChildToParentMessageReader(l1Provider, event)
try {
return await messageReader.status(l2Provider)
@@ -133,7 +136,7 @@ export async function attachNodeBlockDeadlineToEvent(
return event
}
- const messageReader = L2ToL1MessageReader.fromEvent(l1Provider, event)
+ const messageReader = ChildToParentMessageReader.fromEvent(l1Provider, event)
try {
const firstExecutableBlock = await messageReader.getFirstExecutableBlock(
@@ -191,10 +194,10 @@ export async function mapTokenWithdrawalFromEventLogsToL2ToL1EventResult({
})
const txReceipt = await l2Provider.getTransactionReceipt(result.txHash)
- const l2TxReceipt = new L2TransactionReceipt(txReceipt)
+ const l2TxReceipt = new ChildTransactionReceipt(txReceipt)
// TODO: length != 1
- const [event] = l2TxReceipt.getL2ToL1Events()
+ const [event] = l2TxReceipt.getChildToParentEvents()
if (!event) {
return undefined
@@ -264,10 +267,10 @@ export async function mapWithdrawalToL2ToL1EventResult({
}): Promise {
// get transaction receipt
const txReceipt = await l2Provider.getTransactionReceipt(withdrawal.l2TxHash)
- const l2TxReceipt = new L2TransactionReceipt(txReceipt)
+ const l2TxReceipt = new ChildTransactionReceipt(txReceipt)
// TODO: length != 1
- const [event] = l2TxReceipt.getL2ToL1Events()
+ const [event] = l2TxReceipt.getChildToParentEvents()
if (!event) {
return undefined
diff --git a/packages/arb-token-bridge-ui/synpress.config.ts b/packages/arb-token-bridge-ui/synpress.config.ts
index 7f630df5f6..1e2123d8f3 100644
--- a/packages/arb-token-bridge-ui/synpress.config.ts
+++ b/packages/arb-token-bridge-ui/synpress.config.ts
@@ -184,9 +184,9 @@ async function deployERC20ToL2(erc20L1Address: string) {
const bridger = await Erc20Bridger.fromProvider(arbProvider)
const deploy = await bridger.deposit({
amount: BigNumber.from(0),
- erc20L1Address,
- l1Signer: localWallet.connect(ethProvider),
- l2Provider: arbProvider
+ erc20ParentAddress: erc20L1Address,
+ parentSigner: localWallet.connect(ethProvider),
+ childProvider: arbProvider
})
await deploy.wait()
}
@@ -253,10 +253,10 @@ async function generateTestTxForRedeemRetryable() {
const amount = utils.parseUnits('0.001', erc20Token.decimals)
const erc20Bridger = await Erc20Bridger.fromProvider(l2Provider)
const depositRequest = await erc20Bridger.getDepositRequest({
- l1Provider,
- l2Provider,
+ parentProvider: l1Provider,
+ childProvider: l2Provider,
from: walletAddress,
- erc20L1Address: erc20Token.address,
+ erc20ParentAddress: erc20Token.address,
amount,
retryableGasOverrides: {
gasLimit: { base: BigNumber.from(0) }
@@ -264,7 +264,8 @@ async function generateTestTxForRedeemRetryable() {
})
const tx = await erc20Bridger.deposit({
...depositRequest,
- l1Signer: userWallet.connect(ethProvider),
+ parentSigner: userWallet.connect(ethProvider),
+ childProvider: arbProvider,
retryableGasOverrides: {
gasLimit: {
base: BigNumber.from(0)
diff --git a/packages/arb-token-bridge-ui/tests/e2e/specs/readClassicDeposits.cy.ts b/packages/arb-token-bridge-ui/tests/e2e/specs/readClassicDeposits.cy.ts
index c7680fa938..b39e7a06b7 100644
--- a/packages/arb-token-bridge-ui/tests/e2e/specs/readClassicDeposits.cy.ts
+++ b/packages/arb-token-bridge-ui/tests/e2e/specs/readClassicDeposits.cy.ts
@@ -1,6 +1,5 @@
-import { L1ToL2MessageStatus } from '@arbitrum/sdk'
+import { ParentToChildMessageStatus } from '@arbitrum/sdk'
-import { shortenTxHash } from '../../../src/util/CommonUtils'
import { Transaction } from '../../../src/hooks/useTransactions'
import { AssetType } from '../../../src/hooks/arbTokenBridge.types'
@@ -32,7 +31,7 @@ function mockClassicDepositTransaction(
timestampResolved: dateYearAgo.toISOString(),
l1ToL2MsgData: {
fetchingUpdate: false,
- status: L1ToL2MessageStatus.NOT_YET_CREATED,
+ status: ParentToChildMessageStatus.NOT_YET_CREATED,
retryableCreationTxID: undefined,
l2TxID: undefined
},
diff --git a/yarn.lock b/yarn.lock
index 5a9c5d81bb..e03197ad40 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -39,10 +39,10 @@
tslib "^2.3.0"
zen-observable-ts "^1.2.5"
-"@arbitrum/sdk@^3.7.0":
- version "3.7.0"
- resolved "https://registry.yarnpkg.com/@arbitrum/sdk/-/sdk-3.7.0.tgz#2a6035a596469e43bdb3721298cdae9c0bccb9d7"
- integrity sha512-7Omaqd8xfhCatxyyFZC3k7S9HE8pTVuk9tg+snqk8ojDVqO8kiD3YrYS9STJqbKxLBQ1TRktbRaUOAiH3+Y0zg==
+"@arbitrum/sdk@^4.0.0-alpha.9":
+ version "4.0.0-alpha.9"
+ resolved "https://registry.yarnpkg.com/@arbitrum/sdk/-/sdk-4.0.0-alpha.9.tgz#3751b4dc289e7d77ab2037332ae8010a976a0b13"
+ integrity sha512-YsI2QQnJdd1L9B7mbWoF532a/mY/bmBHINR8CgFDFVkMjNRoQSC8avvnylmoco97xX4X6UZALNrd8CJN7eGXZQ==
dependencies:
"@ethersproject/address" "^5.0.8"
"@ethersproject/bignumber" "^5.1.1"
|