networks
Interfaces
ArbitrumNetwork
Defined in: dataEntities/networks.ts:32
Represents an Arbitrum chain, e.g. Arbitrum One, Arbitrum Sepolia, or an L3 chain.
Properties
| Property | Type | Description | Defined in |
|---|---|---|---|
chainId | number | Id of the chain. | dataEntities/networks.ts:40 |
confirmPeriodBlocks | number | The time allowed for validators to dispute or challenge state assertions. Measured in L1 blocks. | dataEntities/networks.ts:60 |
ethBridge | EthBridge | The core contracts | dataEntities/networks.ts:48 |
isBold? | boolean | Has the network been upgraded to bold. True if yes, otherwise undefined This is a temporary property and will be removed in future if Bold is widely adopted and the legacy challenge protocol is deprecated | dataEntities/networks.ts:84 |
isCustom | boolean | Whether or not the chain was registered by the user. | dataEntities/networks.ts:78 |
isTestnet | boolean | Whether or not it is a testnet chain. | dataEntities/networks.ts:74 |
name | string | Name of the chain. | dataEntities/networks.ts:36 |
nativeToken? | string | In case of a chain that uses ETH as its native/gas token, this is either undefined or the zero address In 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 | dataEntities/networks.ts:70 |
parentChainId | number | Chain id of the parent chain, i.e. the chain on which this chain settles to. | dataEntities/networks.ts:44 |
retryableLifetimeSeconds? | number | Represents how long a retryable ticket lasts for before it expires (in seconds). Defaults to 7 days. | dataEntities/networks.ts:64 |
teleporter? | Teleporter | The teleporter contracts. | dataEntities/networks.ts:56 |
tokenBridge? | TokenBridge | The token bridge contracts. | dataEntities/networks.ts:52 |
L2NetworkTokenBridge
Defined in: dataEntities/networks.ts:131
This type is only here for when you want to achieve backwards compatibility between SDK v3 and v4.
Please see TokenBridge for the latest type.
Deprecated
since v4
Type Aliases
L2Network
type L2Network = Prettify<Omit<ArbitrumNetwork, "chainId" | "parentChainId" | "tokenBridge"> & object>;
Defined in: dataEntities/networks.ts:94
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
Functions
assertArbitrumNetworkHasTokenBridge()
function assertArbitrumNetworkHasTokenBridge<T>(network: T): asserts network is T & { tokenBridge: TokenBridge };
Defined in: dataEntities/networks.ts:554
Asserts that the given object has a token bridge. This is useful because not all Arbitrum network operations require a token bridge.
Type Parameters
| Type Parameter |
|---|
T extends ArbitrumNetwork |
Parameters
| Parameter | Type | Description |
|---|---|---|
network | T | ArbitrumNetwork object |
Returns
asserts network is T & { tokenBridge: TokenBridge }
Throws
ArbSdkError if the object does not have a token bridge
getArbitrumNetwork()
Call Signature
function getArbitrumNetwork(chainId: number): ArbitrumNetwork;
Defined in: dataEntities/networks.ts:316
Returns the Arbitrum chain associated with the given signer, provider or chain id.
Parameters
| Parameter | Type |
|---|---|
chainId | number |
Returns
Note
Throws if the chain is not an Arbitrum chain.
Call Signature
function getArbitrumNetwork(signerOrProvider: SignerOrProvider): Promise<ArbitrumNetwork>;
Defined in: dataEntities/networks.ts:317
Returns the Arbitrum chain associated with the given signer, provider or chain id.
Parameters
| Parameter | Type |
|---|---|
signerOrProvider | SignerOrProvider |
Returns
Promise<ArbitrumNetwork>
Note
Throws if the chain is not an Arbitrum chain.
getArbitrumNetworkInformationFromRollup()
function getArbitrumNetworkInformationFromRollup(rollupAddress: string, parentProvider: Provider): Promise<ArbitrumNetworkInformationFromRollup>;
Defined in: dataEntities/networks.ts:376
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
getArbitrumNetworks()
function getArbitrumNetworks(): ArbitrumNetwork[];
Defined in: dataEntities/networks.ts:359
Returns all Arbitrum networks registered in the SDK, both default and custom.
Returns
getChildrenForNetwork()
function getChildrenForNetwork(parentChainOrChainId: number | ArbitrumNetwork): ArbitrumNetwork[];
Defined in: dataEntities/networks.ts:298
Returns a list of children chains for the given chain or chain id.
Parameters
| Parameter | Type |
|---|---|
parentChainOrChainId | number | ArbitrumNetwork |
Returns
isParentNetwork()
function isParentNetwork(parentChainOrChainId: number | ArbitrumNetwork): boolean;
Defined in: dataEntities/networks.ts:283
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
mapL2NetworkToArbitrumNetwork()
function mapL2NetworkToArbitrumNetwork(l2Network: object): ArbitrumNetwork;
Defined in: dataEntities/networks.ts:534
Maps the old L2Network (from SDK v3) to ArbitrumNetwork (from SDK v4).
Parameters
| Parameter | Type | Description |
|---|---|---|
l2Network | { chainID: number; confirmPeriodBlocks: number; ethBridge: EthBridge; isBold?: boolean; isCustom: boolean; isTestnet: boolean; name: string; nativeToken?: string; partnerChainID: number; retryableLifetimeSeconds?: number; teleporter?: Teleporter; tokenBridge: L2NetworkTokenBridge; } | - |
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.isBold? | boolean | Has the network been upgraded to bold. True if yes, otherwise undefined This is a temporary property and will be removed in future if Bold is widely adopted and the legacy challenge protocol is deprecated |
l2Network.isCustom | boolean | Whether or not the chain was registered by the user. |
l2Network.isTestnet | boolean | Whether or not it is a testnet chain. |
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 address In 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.teleporter? | Teleporter | The teleporter contracts. |
l2Network.tokenBridge | L2NetworkTokenBridge | - |
Returns
mapL2NetworkTokenBridgeToTokenBridge()
function mapL2NetworkTokenBridgeToTokenBridge(input: L2NetworkTokenBridge): TokenBridge;
Defined in: dataEntities/networks.ts:510
Maps the old L2Network.tokenBridge (from SDK v3) to ArbitrumNetwork.tokenBridge (from SDK v4).
Parameters
| Parameter | Type |
|---|---|
input | L2NetworkTokenBridge |
Returns
TokenBridge
registerCustomArbitrumNetwork()
function registerCustomArbitrumNetwork(network: ArbitrumNetwork, options?: object): ArbitrumNetwork;
Defined in: dataEntities/networks.ts:415
Registers a custom Arbitrum network.
Parameters
| Parameter | Type | Description |
|---|---|---|
network | ArbitrumNetwork | ArbitrumNetwork to be registered |
options? | { throwIfAlreadyRegistered?: boolean; } | Additional options |
options.throwIfAlreadyRegistered? | boolean | Whether or not the function should throw if the network is already registered, defaults to false |