Skip to main content

Migrating from v3 to v4

Introduction

@arbitrum/sdk v4 introduces significant changes to improve support Orbit chains from Offchain Labs. This guide outlines the breaking changes to know before migrating your existing v3 code to v4.

Major Changes Overview

  1. Terminology change from L1/L2 to parent/child
  2. Network types and functions updated
  3. Updates to AssetBridger and Erc20Bridger classes
  4. Changes to Message classes

Detailed Changes

1. Terminology change from L1/L2 to parent/child

Most instances of "L1" and "L2" have been replaced with "parent" and "child" respectively. This change reflects the more general parent-child relationship between chains in the Arbitrum ecosystem.

  • In most circumstances, when referring to a parent-child relationship between chains, the terms "parent" and "child" are used.
  • Though, when referring explicitly to "L1", "L2", or "L3", those specific terms are still used.

2. Network types and functions updated

  • The L1Network is no longer required to be registered before bridging.
  • Only Arbitrum networks need to be registered.
  • Arbitrum networks are defined as Arbitrum One, Arbitrum testnets, and any Orbit chain.
  • If you need a full list of Arbitrum networks, you can use the new getArbitrumNetworks function.
  • To list all of the children of a network, use the new getChildrenForNetwork function.
v3 Namev4 Name
L2NetworkArbitrumNetwork
getL2NetworkgetArbitrumNetwork
l2NetworksgetArbitrumNetworks
addCustomNetworkregisterCustomArbitrumNetwork
Networkremoved
L1Networkremoved
getL1Networkremoved
getParentForNetworkremoved

ArbitrumNetwork type

Network type has been replaced with the ArbitrumNetwork type and some properties have been removed or renamed.

v3 Namev4 Name
chainIDchainId
partnerChainIDparentChainId
explorerUrlremoved
isArbitrumremoved
partnerChainIDsremoved
nitroGenesisBlockremoved
nitroGenesisL1Blockremoved
depositTimeoutremoved
blockTimeremoved

TokenBridge type

The TokenBridge type within theArbitrumNetwork object has been updated.

v3 Namev4 Name
l1CustomGatewayparentCustomGateway
l1ERC20GatewayparentErc20Gateway
l1GatewayRouterparentGatewayRouter
l1MultiCallparentMultiCall
l1ProxyAdminparentProxyAdmin
l1WethparentWeth
l1WethGatewayparentWethGateway
l2CustomGatewaychildCustomGateway
l2ERC20GatewaychildErc20Gateway
l2GatewayRouterchildGatewayRouter
l2MulticallchildMultiCall
l2ProxyAdminchildProxyAdmin
l2WethchildWeth
l2WethGatewaychildWethGateway

3. Updates to AssetBridger and Erc20Bridger classes

AssetBridger Class Methods

The AssetBridger class methods and properties have been renamed to reflect the new parent-child terminology.

v3 Namev4 Name
l2NetworkchildNetwork
checkL1NetworkcheckParentNetwork
checkL2NetworkcheckChildNetwork

AssetBridger Class Method Parameters

The objects passed to the class methods of classes that inherit from AssetBridger (EthBridger and Erc20Bridger) have been renamed.

v3 Namev4 Name
erc20L1Addresserc20ParentAddress
l1ProviderparentProvider
l2ProviderchildProvider
l1SignerparentSigner
l2SignerchildSigner

Erc20Bridger Class Methods

v3 Namev4 Name
getL1GatewayAddressgetParentGatewayAddress
getL2GatewayAddressgetChildGatewayAddress
getL2WithdrawalEventsgetWithdrawalEvents
getL1TokenContractgetParentTokenContract
getL1ERC20AddressgetParentErc20Address
getL2TokenContractgetChildTokenContract
getL2ERC20AddressgetChildErc20Address
l1TokenIsDisabledisDepositDisabled
l1ProviderparentProvider
getL1GatewaySetEventsgetParentGatewaySetEvents
getL2GatewaySetEventsgetChildGatewaySetEvents

Erc20L1L3Bridger Class Methods

v3 Namev4 Name
getL2ERC20AddressgetL2Erc20Address
getL3ERC20AddressgetL3Erc20Address

4. Changes to Message classes

Message classes have been renamed and their methods updated:

v3 Namev4 Name
L1TransactionReceiptParentTransactionReceipt
L1ContractTransactionParentContractTransaction
L1ToL2MessageParentToChildMessage
L1ToL2MessageWriterParentToChildMessageWriter
L1ToL2MessageReaderParentToChildMessageReader
L1ToL2MessageReaderClassicParentToChildMessageReaderClassic
L1ToL2MessageStatusParentToChildMessageStatus
L1ToL2MessageGasEstimatorParentToChildMessageGasEstimator
L2TransactionReceiptChildTransactionReceipt
L2ContractTransactionChildContractTransaction
L2ToL1MessageChildToParentMessage
L2ToL1MessageWriterChildToParentMessageWriter
L2ToL1MessageReaderChildToParentMessageReader
L2ToL1MessageStatusChildToParentMessageStatus
EthDepositStatusEthDepositMessageStatus
EthDepositMessageWaitResultEthDepositMessageWaitForStatusResult
L1ToL2MessageWaitResultParentToChildMessageWaitForStatusResult

ChildToParentMessageClassic

v3 Namev4 Name
getL2ToL1EventsgetChildToParentEvents

ChildToParentChainMessageNitro

v3 Namev4 Name
getL2ToL1EventsgetChildToParentEvents

ChildTransactionReceipt

v3 Namev4 Name
getL2ToL1EventsgetChildToParentEvents
getL2ToL1MessagesgetChildToParentMessages

ParentToChildMessage

v3 Namev4 Name
EthDepositStatusEthDepositMessageStatus

ParentToChildMessageStatus

v3 Namev4 Name
FUNDS_DEPOSITED_ON_L2FUNDS_DEPOSITED_ON_CHILD

ParentTransactionReceipt

v3 Namev4 Name
getL1ToL2MessagesClassicgetParentToChildMessagesClassic
getL1ToL2MessagesgetParentToChildMessages

ParentEthDepositTransactionReceipt

v3 Namev4 Name
waitForL2waitForChildTransactionReceipt

ParentContractCallTransactionReceipt

v3 Namev4 Name
waitForL2waitForChildTransactionReceipt