networks
Interfaces
ArbitrumNetwork
Represents an Arbitrum chain, e.g. Arbitrum One, Arbitrum Sepolia, or an L3 chain.
Properties
Property | Type | Description |
---|---|---|
chainId | number | Id of the chain. |
confirmPeriodBlocks | number | The time allowed for validators to dispute or challenge state assertions. Measured in L1 blocks. |
ethBridge | EthBridge | The core contracts |
isCustom | boolean | Whether or not the chain was registered by the user. |
name | string | Name of the chain. |
nativeToken? | string | In case of a chain that uses ETH as its native/gas token, this is either undefined or the zero addressIn case of a chain that uses an ERC-20 token from the parent chain as its native/gas token, this is the address of said token on the parent chain |
parentChainId | number | Chain id of the parent chain, i.e. the chain on which this chain settles to. |
retryableLifetimeSeconds? | number | Represents how long a retryable ticket lasts for before it expires (in seconds). Defaults to 7 days. |
tokenBridge | TokenBridge | The token bridge contracts. |
Type Aliases
L2Network
type L2Network: Prettify<Omit<ArbitrumNetwork, "chainId" | "parentChainId"> & object>;
This type is only here for when you want to achieve backwards compatibility between SDK v3 and v4.
Please see ArbitrumNetwork for the latest type.
Deprecated
since v4
Source
Variables
l2Networks
l2Networks: Networks;
Index of all Arbitrum chains that have been added.
Source
networks
const networks: Networks;
Storage for all networks, either L1, L2 or L3.
Source
Functions
addDefaultLocalNetwork()
function addDefaultLocalNetwork(): ArbitrumNetwork
Registers a custom network that matches the one created by a Nitro local node. Useful in development.
Returns
See
https://github.com/OffchainLabs/nitro
Source
getArbitrumNetwork()
function getArbitrumNetwork(signerOrProviderOrChainId: number | SignerOrProvider): Promise<ArbitrumNetwork>
Returns the Arbitrum chain associated with the given signer, provider or chain id.
Parameters
Parameter | Type |
---|---|
signerOrProviderOrChainId | number | SignerOrProvider |
Returns
Promise
<ArbitrumNetwork
>
Note
Throws if the chain is not an Arbitrum chain.
Source
getArbitrumNetworkInformationFromRollup()
function getArbitrumNetworkInformationFromRollup(rollupAddress: string, parentProvider: Provider): Promise<ArbitrumNetworkInformationFromRollup>
Returns all the information about an Arbitrum network that can be fetched from its Rollup contract.
Parameters
Parameter | Type | Description |
---|---|---|
rollupAddress | string | Address of the Rollup contract on the parent chain |
parentProvider | Provider | Provider for the parent chain |
Returns
Promise
<ArbitrumNetworkInformationFromRollup
>
An ArbitrumNetworkInformationFromRollup object
Source
getChildrenForNetwork()
function getChildrenForNetwork(parentChainOrChainId: number | ArbitrumNetwork): ArbitrumNetwork[]
Returns a list of children chains for the given chain or chain id.
Parameters
Parameter | Type |
---|---|
parentChainOrChainId | number | ArbitrumNetwork |
Returns
Source
isParentNetwork()
function isParentNetwork(parentChainOrChainId: number | ArbitrumNetwork): boolean
Determines if a chain is a parent of any other chain. Could be an L1 or an L2 chain.
Parameters
Parameter | Type |
---|---|
parentChainOrChainId | number | ArbitrumNetwork |
Returns
boolean
Source
mapL2NetworkToArbitrumNetwork()
function mapL2NetworkToArbitrumNetwork(l2Network: object): ArbitrumNetwork
Maps the old L2Network (from SDK v3) to ArbitrumNetwork (from SDK v4).
Parameters
Parameter | Type | Description |
---|---|---|
l2Network | object | - |
l2Network.chainID | number | - |
l2Network.confirmPeriodBlocks | number | The time allowed for validators to dispute or challenge state assertions. Measured in L1 blocks. |
l2Network.ethBridge | EthBridge | The core contracts |
l2Network.isCustom | boolean | Whether or not the chain was registered by the user. |
l2Network.name | string | Name of the chain. |
l2Network.nativeToken ? | string | In case of a chain that uses ETH as its native/gas token, this is either undefined or the zero addressIn case of a chain that uses an ERC-20 token from the parent chain as its native/gas token, this is the address of said token on the parent chain |
l2Network.partnerChainID | number | - |
l2Network.retryableLifetimeSeconds ? | number | Represents how long a retryable ticket lasts for before it expires (in seconds). Defaults to 7 days. |
l2Network.tokenBridge | TokenBridge | The token bridge contracts. |
Returns
Source
registerCustomArbitrumNetwork()
function registerCustomArbitrumNetwork(network: ArbitrumNetwork, options?: object): ArbitrumNetwork
Registers a custom Arbitrum network.
Parameters
Parameter | Type | Description |
---|---|---|
network | ArbitrumNetwork | ArbitrumNetwork to be registered |
options ? | object | Additional options |
options.throwIfAlreadyRegistered ? | boolean | Whether or not the function should throw if the network is already registered, defaults to false |