diff --git a/.gitignore b/.gitignore index 037426b618..5182036e87 100644 --- a/.gitignore +++ b/.gitignore @@ -244,9 +244,6 @@ instance/ # Scrapy stuff: .scrapy -# Sphinx documentation -docs/_build/ - # PyBuilder target/ @@ -312,6 +309,5 @@ packages/arb-bridge-eth/password.txt packages/issues packages/**/issues -docs json_data abi diff --git a/README.md b/README.md index a787f212a5..0a342a8f1c 100644 --- a/README.md +++ b/README.md @@ -1,137 +1,110 @@ # Arbitrum SDK -TypeScript library for client-side interactions with Arbitrum. Arbitrum SDK provides common helper functionality as well as access to the underlying smart contract interfaces. +[![npm version](https://badge.fury.io/js/%40arbitrum%2Fsdk.svg)](https://badge.fury.io/js/@arbitrum%2Fsdk.svg) +[![License: Apache 2.0](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) -Below is an overview of the Arbitrum SDK functionality. See the [tutorials](https://github.com/OffchainLabs/arbitrum-tutorials) for further examples of how to use these classes. +A TypeScript library for client-side interactions with Arbitrum. The Arbitrum SDK provides essential helper functionality and direct access to underlying smart contract interfaces, enabling developers to build powerful applications on the Arbitrum network. -### Quickstart Recipes +> [!IMPORTANT] +> +> This is the code and documentation for `@arbitrum/sdk` v4. +> +> If you're looking for v3, check out [this branch](https://github.com/OffchainLabs/arbitrum-sdk/tree/v3). +> +> If you're looking to migrate from v3 to v4, check out [this guide](./docs/2-migrate.mdx). -- ##### Deposit Ether Into Arbitrum +## Table of Contents -```ts -import { getArbitrumNetwork, EthBridger } from '@arbitrum/sdk' - -const l2Network = await getArbitrumNetwork( - l2ChainID /** <-- chain id of target Arbitrum chain */ -) -const ethBridger = new EthBridger(l2Network) - -const ethDepositTxResponse = await ethBridger.deposit({ - amount: utils.parseEther('23'), - l1Signer: l1Signer /** <-- connected ethers-js Wallet */, - l2Provider: l2Provider /** <--- ethers-js Provider */, -}) +- [Arbitrum SDK](#arbitrum-sdk) + - [Table of Contents](#table-of-contents) + - [Overview](#overview) + - [Installation](#installation) + - [Key Features](#key-features) + - [Bridging Assets](#bridging-assets) + - [Cross-Chain Messages](#cross-chain-messages) + - [Network Configuration](#network-configuration) + - [Usage](#usage) + - [Running Integration Tests](#running-integration-tests) + - [Documentation](#documentation) + - [License](#license) -const ethDepositTxReceipt = await ethDepositTxResponse.wait() - -/** check ethDepositTxReceipt.status */ -``` - -- ##### Redeem an L1 to L2 Message - -```ts -import { L1TransactionReceipt, L1ToL2MessageStatus } from '@arbitrum/sdk' - -const l1TxnReceipt = new L1TransactionReceipt( - txnReceipt /** <-- ethers-js TransactionReceipt of an ethereum tx that triggered an L1 to L2 message (say depositting a token via a bridge) */ -) - -const l1ToL2Message = ( - await l1TxnReceipt.getL1ToL2Messages( - l2Signer /** <-- connected ethers-js Wallet */ - ) -)[0] - -const res = await l1ToL2Message.waitForStatus() - -if (res.status === L1ToL2MessageStatus.FUNDS_DEPOSITED_ON_L2) { - /** Message wasn't auto-redeemed; redeem it now: */ - const response = await l1ToL2Message.redeem() - const receipt = await response.wait() -} else if (res.status === L1ToL2MessageStatus.REDEEMED) { - /** Message succesfully redeeemed */ -} -``` +## Overview -- ##### Check if sequencer has included a transaction in L1 data +Arbitrum SDK simplifies the process of interacting with Arbitrum chains, offering a robust set of tools for asset bridging and cross-chain messaging. -```ts -import { L2TransactionReceipt } from '@arbitrum/sdk' +## Installation -const l2TxnReceipt = new L2TransactionReceipt( - txnReceipt /** <-- ethers-js TransactionReceipt of an arbitrum tx */ -) +```bash +npm install @arbitrum/sdk -/** Wait 3 minutes: */ -await new Promise(resolve => setTimeout(resolve, 1000 * 60 * 3000)) +# or -// if dataIsOnL1, sequencer has posted it and it inherits full rollup/L1 security -const dataIsOnL1 = await l2TxnReceipt.isDataAvailable(l2Provider, l1Provider) +yarn add @arbitrum/sdk ``` -### Bridging assets - -Arbitrum SDK can be used to bridge assets to/from the rollup chain. The following asset bridgers are currently available: - -- EthBridger -- Erc20Bridger - -All asset bridgers have the following methods: +## Key Features -- **deposit** - moves assets from the L1 to the L2 -- **depositEstimateGas** - estimates the gas required to do the deposit -- **withdraw** - moves assets from the L2 to the L1 -- **withdrawEstimateGas** - estimates the gas required to do the withdrawal - Which accept different parameters depending on the asset bridger type +### Bridging Assets -### Cross chain messages +Arbitrum SDK facilitates the bridging of assets between an Arbitrum chain and its parent chain. Currently supported asset bridgers: -When assets are moved by the L1 and L2 cross chain messages are sent. The lifecycles of these messages are encapsulated in the classes `L1ToL2Message` and `L2ToL1Message`. These objects are commonly created from the receipts of transactions that send cross chain messages. A cross chain message will eventually result in a transaction being executed on the destination chain, and these message classes provide the ability to wait for that finalizing transaction to occur. +- `EthBridger`: For bridging ETH to and from an Arbitrum chain (L2 or L3) +- `Erc20Bridger`: For bridging ERC-20 tokens to and from an Arbitrum chain (L2 or L3) +- `EthL1L3Bridger`: For bridging ETH to an L3 directly from L1 +- `Erc20L1L3Bridger`: For bridging ERC-20 tokens to an L3 directly from L1 -### Networks +### Cross-Chain Messages -Arbitrum SDK comes pre-configured for Mainnet and Sepolia, and their Arbitrum counterparts. However, the networks functionality can be used to register networks for custom Arbitrum instances. Most of the classes in Arbitrum SDK depend on network objects so this must be configured before using other Arbitrum SDK functionality. +Cross-chain communication is handled through `ParentToChildMessage` and `ChildToParentMessage` classes. These encapsulate the lifecycle of messages sent between chains, typically created from transaction receipts that initiate cross-chain messages. -### Inbox tools +### Network Configuration -As part of normal operation the Arbitrum sequencer will send messages into the rollup chain. However, if the sequencer is unavailable and not posting batches, the inbox tools can be used to force the inclusion of transactions into the rollup chain. +The SDK comes preconfigured for Arbitrum One, Arbitrum Nova and Arbitrum Sepolia. Custom Arbitrum networks can be registered using `registerCustomArbitrumNetwork`, which is required before utilizing other SDK features. -### Utils +## Usage -- **EventFetcher** - A utility to provide typing for the fetching of events -- **MultiCaller** - A utility for executing multiple calls as part of a single RPC request. This can be useful for reducing round trips. -- **constants** - A list of useful Arbitrum related constants +Here's a basic example of using the SDK to bridge ETH: -### Run Integration tests - -1. First, make sure you have a Nitro test node running. Follow the instructions [here](https://docs.arbitrum.io/node-running/how-tos/local-dev-node). +```ts +import { ethers } from 'ethers' +import { EthBridger, getArbitrumNetwork } from '@arbitrum/sdk' -2. After the node has started up (that could take up to 20-30 mins), run `yarn gen:network`. +async function bridgeEth(parentSigner: ethers.Signer, childChainId: number) { + const childNetwork = await getArbitrumNetwork(childChainId) + const ethBridger = new EthBridger(childNetwork) -3. Once done, finally run `yarn test:integration` to run the integration tests. + const deposit = await ethBridger.deposit({ + amount: ethers.utils.parseEther('0.1'), + parentSigner, + }) -Defaults to `Arbitrum Sepolia`, for custom network use `--network` flag. + const txReceipt = await deposit.wait() + console.log(`Deposit initiated: ${txReceipt.transactionHash}`) +} +``` -`Arbitrum Sepolia` expects env var `ARB_KEY` to be prefunded with at least 0.02 ETH, and env var `INFURA_KEY` to be set. -(see `integration_test/config.ts`) +For more detailed usage examples and API references, please refer to the [Arbitrum SDK documentation](https://docs.arbitrum.io/sdk). -### Bridge A Standard Token +## Running Integration Tests -Bridging a new token to L2 (i.e., deploying a new token contract) through the standard gateway is done by simply depositing a token that hasn't yet been bridged. This repo includes a script to trigger this initial deposit/deployment: +1. Set up a Nitro test node by following the instructions [here](https://docs.arbitrum.io/node-running/how-tos/local-dev-node). +2. Copy `.env.example` to `.env` and update relevant environment variables. +3. Generate the network configuration against your active Nitro test node: -1. Clone `arbitrum-sdk` + ```sh + yarn gen:network + ``` -2. `yarn install` (from root) +4. Execute the integration tests: -3. Set `PRIVKEY` environment variable (you can use .env) to the key of the account from which you'll be deploying (account should have some balance of the token you're bridging). + ```sh + yarn test:integration + ``` -4. Set MAINNET_RPC environment variable to L1 RPC endpoint (i.e., https://mainnet.infura.io/v3/my-infura-key) +## Documentation -5. `yarn bridgeStandardToken` +For comprehensive guides and API documentation, visit the [Arbitrum SDK Documentation](https://docs.arbitrum.io/sdk). -Required CL params: -`networkID`:number — Chain ID of L2 network -`l1TokenAddress`:string — address of L1 token to be bridged +## License -Ex: -`yarn bridgeStandardToken --networkID 421614 --l1TokenAddress 0xdf032bc4b9dc2782bb09352007d4c57b75160b15 --amount 3` +Arbitrum SDK is released under the [Apache 2.0 License](LICENSE). diff --git a/docs/1-introduction.mdx b/docs/1-introduction.mdx new file mode 100644 index 0000000000..7b53656af6 --- /dev/null +++ b/docs/1-introduction.mdx @@ -0,0 +1,198 @@ +# Introduction + +The Arbitrum SDK is a powerful TypeScript library that streamlines interactions with Arbitrum networks. It offers robust tools for bridging tokens and passing messages between networks through an intuitive interface to the underlying smart contracts. + +**Key Features** + +- Token Bridging: Effortlessly bridge tokens between Ethereum and Arbitrum. +- Message Passing: Seamlessly pass messages across networks. +- Contracts Interface: Leverage a strongly-typed interface for interacting with smart contracts. + +Below is an overview of the Arbitrum SDK functionality. See the [tutorials](https://github.com/OffchainLabs/arbitrum-tutorials) for more examples. + +## Getting Started + +Install dependencies + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + + + + +```sh +npm install @arbitrum/sdk +``` + + + + +```sh +yarn add @arbitrum/sdk +``` + + + + +```sh +pnpm install @arbitrum/sdk +``` + + + + +## Using the Arbitrum SDK + +### Bridging assets + +Arbitrum SDK can be used to bridge assets to or from an Arbitrum Network. The following asset bridgers are currently available: + +- [`EthBridger`](./reference/assetBridger/ethBridger.md) +- [`Erc20Bridger`](./reference/assetBridger/erc20Bridger.md) + +All asset bridgers have the following methods which accept different parameters depending on the asset bridger type: + +- [`deposit`](./reference/assetBridger/assetBridger.md#deposit) - moves assets from the Parent to the Child chain +- [`withdraw`](./reference/assetBridger/assetBridger.md#withdraw) - moves assets from the Child to the Parent chain + +#### Example ETH Deposit to Arbitrum One + +```ts +import { getArbitrumNetwork, EthBridger } from '@arbitrum/sdk' + +// get the `@arbitrum/sdk` ArbitrumNetwork object using the chain id of the Arbitrum One chain +const childNetwork = await getArbitrumNetwork(42161) +const ethBridger = new EthBridger(childNetwork) + +const ethDepositTxResponse = await ethBridger.deposit({ + amount: utils.parseEther('23'), + parentSigner, // an ethers v5 signer connected to mainnet ethereum + childProvider, // an ethers v5 provider connected to Arbitrum One +}) + +const ethDepositTxReceipt = await ethDepositTxResponse.wait() +``` + +[Learn more in the Eth Deposit tutorial](https://github.com/OffchainLabs/arbitrum-tutorials/tree/master/packages/eth-deposit) + +#### Example ETH Withdrawal from Arbitrum One + +```ts +import { getArbitrumNetwork, EthBridger } from '@arbitrum/sdk' + +// get the `@arbitrum/sdk` ArbitrumNetwork object using the chain id of the Arbitrum One chain +const childNetwork = await getArbitrumNetwork(42161) +const ethBridger = new EthBridger(childNetwork) + +const withdrawTx = await ethBridger.withdraw({ + amount: utils.parseEther('23'), + childSigner, // an ethers v5 signer connected to Arbitrum One + destinationAddress: childWallet.address, +}) +const withdrawRec = await withdrawTx.wait() +``` + +[Learn more in the Eth Withdraw tutorial](https://github.com/OffchainLabs/arbitrum-tutorials/tree/master/packages/eth-withdraw) + +### Networks + +Arbitrum SDK comes pre-configured for Mainnet and Sepolia, and their Arbitrum counterparts. Any other networks that are not pre-configured **must** be registered before being used. + +#### Configuring Network + +To interact with a custom [`ArbitrumNetwork`](./reference/dataEntities/networks), you can register it using the [`registerCustomArbitrumNetwork`](./reference/dataEntities/networks.md#registerCustomArbitrumNetwork) function. + +```ts +import { registerCustomArbitrumNetwork } from '@arbitrum/sdk' + +registerCustomArbitrumNetwork({ + chainID: 123456, + name: 'Custom Arbitrum Network', +}) +``` + +### Cross chain messages + +When assets are moved by the Parent and Child cross chain messages are sent. The lifecycles of these messages are encapsulated in the classes [`ParentToChildMessage`](./reference/message/ParentToChildMessage) and [`ChildToParentMessage`](./reference/message/ParentToChildMessage). These objects are commonly created from the receipts of transactions that send cross chain messages. A cross chain message will eventually result in a transaction being executed on the destination chain, and these message classes provide the ability to wait for that finalizing transaction to occur. + +#### Redeem a Parent-to-Child Message + +```ts +import { + ParentTransactionReceipt, + ParentToChildMessageStatus, +} from '@arbitrum/sdk' + +const parentTxnReceipt = new ParentTransactionReceipt( + txnReceipt // ethers-js TransactionReceipt of an ethereum tx that triggered a Parent-to-Child message (say depositing a token via a bridge) +) + +const parentToChildMessage = ( + await parentTxnReceipt.getParentToChildMessages( + childSigner // connected ethers-js Wallet + ) +)[0] + +const res = await parentToChildMessage.waitForStatus() + +if (res.status === ParentToChildMessageStatus.Child) { + // Message wasn't auto-redeemed; redeem it now: + const response = await parentToChildMessage.redeem() + const receipt = await response.wait() +} else if (res.status === ParentToChildMessageStatus.REDEEMED) { + // Message successfully redeemed +} +``` + +[Learn more in the Redeem Failed Retryable Tickets tutorial](https://github.com/OffchainLabs/arbitrum-tutorials/tree/master/packages/redeem-failed-retryable) + +### Inbox Tools + +As part of normal operation, the Arbitrum sequencer will send messages into the rollup chain. However, if the sequencer is unavailable and not posting batches, the inbox tools can be used to force the inclusion of transactions into the Arbitrum network. + +Here's how you can use the inbox tools to withdraw ether from Arbitrum One without waiting for the sequencer: + +```ts +const childNetwork = await getArbitrumNetwork(await childWallet.getChainId()) + +const inboxSdk = new InboxTools(parentWallet, childNetwork) +const arbSys = ArbSys__factory.connect(ARB_SYS_ADDRESS, childProvider) +const arbSysIface = arbSys.interface +const childCalldata = arbSysIface.encodeFunctionData('withdrawEth', [ + parentWallet.address, +]) + +const txChildRequest = { + data: childCalldata, + to: ARB_SYS_ADDRESS, + value: 1, +} + +const childSignedTx = await inboxSdk.signChildTx(txChildRequest, childWallet) +const childTxhash = ethers.utils.parseTransaction(childSignedTx).hash +const resultsParent = await inboxSdk.sendChildSignedTx(childSignedTx) + +const inboxRec = await resultsParent.wait() +``` + +[Learn more in the Delayed Inbox tutorial](https://github.com/OffchainLabs/arbitrum-tutorials/tree/master/packages/delayedInbox-l2msg). + +### Utils + +- [`EventFetcher`](./reference/utils/eventFetcher) - A utility to provide typing for the fetching of events +- [`MultiCaller`](./reference/utils/multicall#multicaller) - A utility for executing multiple calls as part of a single RPC request. This can be useful for reducing round trips. +- [`constants`](./reference/dataEntities/constants) - A list of useful Arbitrum related constants + +## Development + +### Run Integration tests + +1. Copy the `.env-sample` file to `.env` and update the values with your own. +1. First, make sure you have a [Nitro test node](https://github.com/Offchainlabs/nitro-testnode) running. Follow the instructions [here](https://docs.arbitrum.io/node-running/how-tos/local-dev-node). +1. After the node has started up (that could take up to 20-30 mins), run `yarn gen:network`. +1. Once done, finally run `yarn test:integration` to run the integration tests. + +Defaults to `Arbitrum Sepolia`, for custom network use `--network` flag. + +`Arbitrum Sepolia` expects env var `ARB_KEY` to be prefunded with at least 0.02 ETH, and env var `INFURA_KEY` to be set. +(see `integration_test/config.ts`) diff --git a/docs/2-migrate.mdx b/docs/2-migrate.mdx new file mode 100644 index 0000000000..f45d5f3550 --- /dev/null +++ b/docs/2-migrate.mdx @@ -0,0 +1,198 @@ +# 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`](./reference/dataEntities/networks#getArbitrumNetworks) function. +- To list all of the children of a network, use the new [`getChildrenForNetwork`](./reference/dataEntities/networks#getChildrenForNetwork) function. + +| v3 Name | v4 Name | +| --------------------- | -------------------------------------------------------------------------------------------------- | +| `L2Network` | [`ArbitrumNetwork`](./reference/dataEntities/networks#arbitrumnetwork) | +| `getL2Network` | [`getArbitrumNetwork`](./reference/dataEntities/networks#getArbitrumNetwork) | +| `l2Networks` | [`getArbitrumNetworks`](./reference/dataEntities/networks#getArbitrumNetworks) | +| `addCustomNetwork` | [`registerCustomArbitrumNetwork`](./reference/dataEntities/networks#registerCustomArbitrumNetwork) | +| `Network` | *removed* | +| `L1Network` | *removed* | +| `getL1Network` | *removed* | +| `getParentForNetwork` | *removed* | + +#### `ArbitrumNetwork` type + +`Network` type has been replaced with the [`ArbitrumNetwork`](./reference/dataEntities/networks#arbitrumnetwork) type and some properties have been removed or renamed. + +| v3 Name | v4 Name | +| --------------------- | --------------- | +| `chainID` | `chainId` | +| `partnerChainID` | `parentChainId` | +| `explorerUrl` | *removed* | +| `isArbitrum` | *removed* | +| `partnerChainIDs` | *removed* | +| `nitroGenesisBlock` | *removed* | +| `nitroGenesisL1Block` | *removed* | +| `depositTimeout` | *removed* | +| `blockTime` | *removed* | + +#### `TokenBridge` type + +The `TokenBridge` type within the[`ArbitrumNetwork`](./reference/dataEntities/networks#arbitrumnetwork) object has been updated. + +| v3 Name | v4 Name | +| ----------------- | --------------------- | +| `l1CustomGateway` | `parentCustomGateway` | +| `l1ERC20Gateway` | `parentErc20Gateway` | +| `l1GatewayRouter` | `parentGatewayRouter` | +| `l1MultiCall` | `parentMultiCall` | +| `l1ProxyAdmin` | `parentProxyAdmin` | +| `l1Weth` | `parentWeth` | +| `l1WethGateway` | `parentWethGateway` | +| `l2CustomGateway` | `childCustomGateway` | +| `l2ERC20Gateway` | `childErc20Gateway` | +| `l2GatewayRouter` | `childGatewayRouter` | +| `l2Multicall` | `childMultiCall` | +| `l2ProxyAdmin` | `childProxyAdmin` | +| `l2Weth` | `childWeth` | +| `l2WethGateway` | `childWethGateway` | + +### 3. Updates to `AssetBridger` and `Erc20Bridger` classes + +#### [`AssetBridger`](./reference/assetBridger/assetBridger.md) Class Methods + +The [`AssetBridger`](./reference/assetBridger/assetBridger.md) class methods and properties have been renamed to reflect the new parent-child terminology. + +| v3 Name | v4 Name | +| ---------------- | -------------------- | +| `l2Network` | `childNetwork` | +| `checkL1Network` | `checkParentNetwork` | +| `checkL2Network` | `checkChildNetwork` | + +#### [`AssetBridger`](./reference/assetBridger/assetBridger.md) Class Method Parameters + +The objects passed to the class methods of classes that inherit from [`AssetBridger`](./reference/assetBridger/assetBridger.md) ([`EthBridger`](./reference/assetBridger/ethBridger.md) and [`Erc20Bridger`](./reference/assetBridger/erc20Bridger.md)) have been renamed. + +| v3 Name | v4 Name | +| ---------------- | -------------------- | +| `erc20L1Address` | `erc20ParentAddress` | +| `l1Provider` | `parentProvider` | +| `l2Provider` | `childProvider` | +| `l1Signer` | `parentSigner` | +| `l2Signer` | `childSigner` | + +#### [`Erc20Bridger`](./reference/assetBridger/erc20Bridger.md) Class Methods + +| v3 Name | v4 Name | +| ----------------------- | --------------------------- | +| `getL1GatewayAddress` | `getParentGatewayAddress` | +| `getL2GatewayAddress` | `getChildGatewayAddress` | +| `getL2WithdrawalEvents` | `getWithdrawalEvents` | +| `getL1TokenContract` | `getParentTokenContract` | +| `getL1ERC20Address` | `getParentErc20Address` | +| `getL2TokenContract` | `getChildTokenContract` | +| `getL2ERC20Address` | `getChildErc20Address` | +| `l1TokenIsDisabled` | `isDepositDisabled` | +| `l1Provider` | `parentProvider` | +| `getL1GatewaySetEvents` | `getParentGatewaySetEvents` | +| `getL2GatewaySetEvents` | `getChildGatewaySetEvents` | + +#### [`Erc20L1L3Bridger`](./reference/assetBridger/L1L3Bridger.md) Class Methods + +| v3 Name | v4 Name | +| ------------------- | ------------------- | +| `getL2ERC20Address` | `getL2Erc20Address` | +| `getL3ERC20Address` | `getL3Erc20Address` | + +### 4. Changes to Message classes + +Message classes have been renamed and their methods updated: + +| v3 Name | v4 Name | +| ----------------------------- | ----------------------------------------- | +| `L1TransactionReceipt` | `ParentTransactionReceipt` | +| `L1ContractTransaction` | `ParentContractTransaction` | +| `L1ToL2Message` | `ParentToChildMessage` | +| `L1ToL2MessageWriter` | `ParentToChildMessageWriter` | +| `L1ToL2MessageReader` | `ParentToChildMessageReader` | +| `L1ToL2MessageReaderClassic` | `ParentToChildMessageReaderClassic` | +| `L1ToL2MessageStatus` | `ParentToChildMessageStatus` | +| `L1ToL2MessageGasEstimator` | `ParentToChildMessageGasEstimator` | +| `L2TransactionReceipt` | `ChildTransactionReceipt` | +| `L2ContractTransaction` | `ChildContractTransaction` | +| `L2ToL1Message` | `ChildToParentMessage` | +| `L2ToL1MessageWriter` | `ChildToParentMessageWriter` | +| `L2ToL1MessageReader` | `ChildToParentMessageReader` | +| `L2ToL1MessageStatus` | `ChildToParentMessageStatus` | +| `EthDepositStatus` | `EthDepositMessageStatus` | +| `EthDepositMessageWaitResult` | `EthDepositMessageWaitForStatusResult` | +| `L1ToL2MessageWaitResult` | `ParentToChildMessageWaitForStatusResult` | + +#### `ChildToParentMessageClassic` + +| v3 Name | v4 Name | +| ----------------- | ------------------------ | +| `getL2ToL1Events` | `getChildToParentEvents` | + +#### `ChildToParentChainMessageNitro` + +| v3 Name | v4 Name | +| ----------------- | ------------------------ | +| `getL2ToL1Events` | `getChildToParentEvents` | + +#### `ChildTransactionReceipt` + +| v3 Name | v4 Name | +| ------------------- | -------------------------- | +| `getL2ToL1Events` | `getChildToParentEvents` | +| `getL2ToL1Messages` | `getChildToParentMessages` | + +#### `ParentToChildMessage` + +| v3 Name | v4 Name | +| ------------------ | ------------------------- | +| `EthDepositStatus` | `EthDepositMessageStatus` | + +#### `ParentToChildMessageStatus` + +| v3 Name | v4 Name | +| ----------------------- | -------------------------- | +| `FUNDS_DEPOSITED_ON_L2` | `FUNDS_DEPOSITED_ON_CHILD` | + +#### `ParentTransactionReceipt` + +| v3 Name | v4 Name | +| -------------------------- | --------------------------------- | +| `getL1ToL2MessagesClassic` | `getParentToChildMessagesClassic` | +| `getL1ToL2Messages` | `getParentToChildMessages` | + +#### `ParentEthDepositTransactionReceipt` + +| v3 Name | v4 Name | +| ----------- | -------------------------------- | +| `waitForL2` | `waitForChildTransactionReceipt` | + +#### `ParentContractCallTransactionReceipt` + +| v3 Name | v4 Name | +| ----------- | -------------------------------- | +| `waitForL2` | `waitForChildTransactionReceipt` | diff --git a/package.json b/package.json index b783fd5d60..b7e8f409e3 100644 --- a/package.json +++ b/package.json @@ -38,8 +38,6 @@ "lint": "eslint .", "format": "prettier './**/*.{js,json,md,ts,yml}' '!./src/lib/abi' --write && yarn run lint --fix", "clean:compile": "ts-node scripts/cleanCompileContracts.ts", - "generate_docs": "typedoc --options typedoc_md.js && node scripts/postProcessDocs.js", - "generate_docs_site": "typedoc", "checkRetryable": "ts-node scripts/checkRetryableStatus.ts", "redeemRetryable": "ts-node scripts/redeemRetryable.ts", "setStandard": "ts-node scripts/setStandardGateways.ts", @@ -86,8 +84,6 @@ "ts-node": "^10.2.1", "tslint": "^6.1.3", "typechain": "7.0.0", - "typedoc": "^0.25.7", - "typedoc-plugin-markdown": "^3.17.1", "typescript": "^4.9.5", "yargs": "^17.3.1" }, diff --git a/src/lib/utils/byte_serialize_params.ts b/src/lib/utils/byte_serialize_params.ts index 577a3515c9..f3afa1e1c1 100644 --- a/src/lib/utils/byte_serialize_params.ts +++ b/src/lib/utils/byte_serialize_params.ts @@ -92,7 +92,8 @@ export const getAddressIndex = (() => { })() /** - // to use: + to use: + ```js const mySerializeParamsFunction = argSerializerConstructor("rpcurl") mySerializeParamsFunction(["4","5", "6"]) diff --git a/theme/style.css b/theme/style.css deleted file mode 100644 index a53d604b27..0000000000 --- a/theme/style.css +++ /dev/null @@ -1,4 +0,0 @@ -:root { - /* we can override CSS variables */ - /* --light-color-background: #ffffff; */ -} diff --git a/yarn.lock b/yarn.lock index b297791c83..6193b395ef 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1866,11 +1866,6 @@ ansi-regex@^5.0.1: resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.1.tgz#082cb2c89c9fe8659a311a53bd6a4dc5301db304" integrity sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ== -ansi-sequence-parser@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/ansi-sequence-parser/-/ansi-sequence-parser-1.1.0.tgz#4d790f31236ac20366b23b3916b789e1bde39aed" - integrity sha512-lEm8mt52to2fT8GhciPCGeCXACSz2UwIN4X2e2LJSnZ5uAbn2/dsYdOmUXq0AtWS5cpAupysIneExOgH0Vd2TQ== - ansi-styles@^3.2.1: version "3.2.1" resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d" @@ -3627,18 +3622,6 @@ growl@1.10.5: resolved "https://registry.yarnpkg.com/growl/-/growl-1.10.5.tgz#f2735dc2283674fa67478b10181059355c369e5e" integrity sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA== -handlebars@^4.7.7: - version "4.7.7" - resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.7.7.tgz#9ce33416aad02dbd6c8fafa8240d5d98004945a1" - integrity sha512-aAcXm5OAfE/8IXkcZvCepKU3VzW1/39Fb5ZuqMtgI/hT8X2YgoMvBY5dLhq/cpOvw7Lk1nK/UF71aLG/ZnVYRA== - dependencies: - minimist "^1.2.5" - neo-async "^2.6.0" - source-map "^0.6.1" - wordwrap "^1.0.0" - optionalDependencies: - uglify-js "^3.1.4" - hardhat@^2.18.3: version "2.18.3" resolved "https://registry.yarnpkg.com/hardhat/-/hardhat-2.18.3.tgz#8fd01348795c77086fff417a4d13c521dce28fcf" @@ -4206,11 +4189,6 @@ json5@^2.2.3: resolved "https://registry.yarnpkg.com/json5/-/json5-2.2.3.tgz#78cd6f1a19bdc12b73db5ad0c61efd66c1e29283" integrity sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg== -jsonc-parser@^3.2.0: - version "3.2.0" - resolved "https://registry.yarnpkg.com/jsonc-parser/-/jsonc-parser-3.2.0.tgz#31ff3f4c2b9793f89c67212627c51c6394f88e76" - integrity sha512-gfFQZrcTc8CnKXp6Y4/CBT3fTc0OVuDofpre4aEeEpSBPV5X5v4+Vmx+8snU7RLPrNHPKSgLxGo9YuQzz20o+w== - jsonfile@^2.1.0: version "2.4.0" resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-2.4.0.tgz#3736a2b428b87bbda0cc83b53fa3d633a35c2ae8" @@ -4391,11 +4369,6 @@ lru_map@^0.3.3: resolved "https://registry.yarnpkg.com/lru_map/-/lru_map-0.3.3.tgz#b5c8351b9464cbd750335a79650a0ec0e56118dd" integrity sha512-Pn9cox5CsMYngeDbmChANltQl+5pi6XmTrraMSzhPmMBbmgcxmqWry0U3PGapCU1yB4/LqCcom7qhHZiF/jGfQ== -lunr@^2.3.9: - version "2.3.9" - resolved "https://registry.yarnpkg.com/lunr/-/lunr-2.3.9.tgz#18b123142832337dd6e964df1a5a7707b25d35e1" - integrity sha512-zTU3DaZaF3Rt9rhN3uBMGQD3dD2/vFQqnvZCDv4dl5iOzq2IZQqTxu90r4E5J+nP70J3ilqVCrbho2eWaeW8Ow== - make-dir@^3.0.0, make-dir@^3.0.2: version "3.1.0" resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-3.1.0.tgz#415e967046b3a7f1d185277d84aa58203726a13f" @@ -4420,11 +4393,6 @@ map-stream@0.0.7: resolved "https://registry.yarnpkg.com/map-stream/-/map-stream-0.0.7.tgz#8a1f07896d82b10926bd3744a2420009f88974a8" integrity sha512-C0X0KQmGm3N2ftbTGBhSyuydQ+vV1LC3f3zPvT3RXHXNZrvfPZcoXp/N5DOa8vedX/rTMm2CjTtivFg2STJMRQ== -marked@^4.3.0: - version "4.3.0" - resolved "https://registry.yarnpkg.com/marked/-/marked-4.3.0.tgz#796362821b019f734054582038b116481b456cf3" - integrity sha512-PRsaiG84bK+AMvxziE/lCFss8juXjNaWzVbN5tXAm4XjeaS9NAHhop+PjQxz2A9h8Q4M/xGmzP8vqNwy6JeK0A== - mcl-wasm@^0.7.1: version "0.7.9" resolved "https://registry.yarnpkg.com/mcl-wasm/-/mcl-wasm-0.7.9.tgz#c1588ce90042a8700c3b60e40efb339fc07ab87f" @@ -4509,21 +4477,7 @@ minimatch@^3.0.4, minimatch@^3.1.1: dependencies: brace-expansion "^1.1.7" -minimatch@^5.0.1: - version "5.1.6" - resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-5.1.6.tgz#1cfcb8cf5522ea69952cd2af95ae09477f122a96" - integrity sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g== - dependencies: - brace-expansion "^2.0.1" - -minimatch@^9.0.3: - version "9.0.3" - resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-9.0.3.tgz#a6e00c3de44c3a542bfaae70abfc22420a6da825" - integrity sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg== - dependencies: - brace-expansion "^2.0.1" - -minimist@^1.2.5, minimist@^1.2.6: +minimist@^1.2.6: version "1.2.6" resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.6.tgz#8637a5b759ea0d6e98702cfb3a9283323c93af44" integrity sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q== @@ -4649,11 +4603,6 @@ natural-compare@^1.4.0: resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" integrity sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc= -neo-async@^2.6.0: - version "2.6.2" - resolved "https://registry.yarnpkg.com/neo-async/-/neo-async-2.6.2.tgz#b4aafb93e3aeb2d8174ca53cf163ab7d7308305f" - integrity sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw== - nice-try@^1.0.4: version "1.0.5" resolved "https://registry.yarnpkg.com/nice-try/-/nice-try-1.0.5.tgz#a3378a7696ce7d223e88fc9b764bd7ef1089e366" @@ -5405,16 +5354,6 @@ shebang-regex@^3.0.0: resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-3.0.0.tgz#ae16f1644d873ecad843b0307b143362d4c42172" integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A== -shiki@^0.14.7: - version "0.14.7" - resolved "https://registry.yarnpkg.com/shiki/-/shiki-0.14.7.tgz#c3c9e1853e9737845f1d2ef81b31bcfb07056d4e" - integrity sha512-dNPAPrxSc87ua2sKJ3H5dQ/6ZaY8RNnaAqK+t0eG7p0Soi2ydiqbGOTaZCqaYvA/uZYfS1LJnemt3Q+mSfcPCg== - dependencies: - ansi-sequence-parser "^1.1.0" - jsonc-parser "^3.2.0" - vscode-oniguruma "^1.7.0" - vscode-textmate "^8.0.0" - side-channel@^1.0.4: version "1.0.5" resolved "https://registry.yarnpkg.com/side-channel/-/side-channel-1.0.5.tgz#9a84546599b48909fb6af1211708d23b1946221b" @@ -5941,23 +5880,6 @@ typedarray-to-buffer@^3.1.5: dependencies: is-typedarray "^1.0.0" -typedoc-plugin-markdown@^3.17.1: - version "3.17.1" - resolved "https://registry.yarnpkg.com/typedoc-plugin-markdown/-/typedoc-plugin-markdown-3.17.1.tgz#c33f42363c185adf842f4699166015f7fe0ed02b" - integrity sha512-QzdU3fj0Kzw2XSdoL15ExLASt2WPqD7FbLeaqwT70+XjKyTshBnUlQA5nNREO1C2P8Uen0CDjsBLMsCQ+zd0lw== - dependencies: - handlebars "^4.7.7" - -typedoc@^0.25.7: - version "0.25.7" - resolved "https://registry.yarnpkg.com/typedoc/-/typedoc-0.25.7.tgz#11e3f527ca80ca3c029cb8e15f362e6d9f715e25" - integrity sha512-m6A6JjQRg39p2ZVRIN3NKXgrN8vzlHhOS+r9ymUYtcUP/TIQPvWSq7YgE5ZjASfv5Vd5BW5xrir6Gm2XNNcOow== - dependencies: - lunr "^2.3.9" - marked "^4.3.0" - minimatch "^9.0.3" - shiki "^0.14.7" - typescript@^4.9.5: version "4.9.5" resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.9.5.tgz#095979f9bcc0d09da324d58d03ce8f8374cbe65a" @@ -5973,11 +5895,6 @@ typical@^5.2.0: resolved "https://registry.yarnpkg.com/typical/-/typical-5.2.0.tgz#4daaac4f2b5315460804f0acf6cb69c52bb93066" integrity sha512-dvdQgNDNJo+8B2uBQoqdb11eUCE1JQXhvjC/CZtgvZseVd5TYMXnq0+vuUemXbd/Se29cTaUuPX3YIc2xgbvIg== -uglify-js@^3.1.4: - version "3.15.4" - resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.15.4.tgz#fa95c257e88f85614915b906204b9623d4fa340d" - integrity sha512-vMOPGDuvXecPs34V74qDKk4iJ/SN4vL3Ow/23ixafENYvtrNvtbcgUeugTcUGRGsOF/5fU8/NYSL5Hyb3l1OJA== - unbox-primitive@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/unbox-primitive/-/unbox-primitive-1.0.2.tgz#29032021057d5e6cdbd08c5129c226dff8ed6f9e" @@ -6058,29 +5975,6 @@ v8-compile-cache@^2.0.3: resolved "https://registry.yarnpkg.com/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz#2de19618c66dc247dcfb6f99338035d8245a2cee" integrity sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA== -vscode-oniguruma@^1.7.0: - version "1.7.0" - resolved "https://registry.yarnpkg.com/vscode-oniguruma/-/vscode-oniguruma-1.7.0.tgz#439bfad8fe71abd7798338d1cd3dc53a8beea94b" - integrity sha512-L9WMGRfrjOhgHSdOYgCt/yRMsXzLDJSL7BPrOZt73gU0iWO4mpqzqQzOz5srxqTvMBaR0XZTSrVWo4j55Rc6cA== - -vscode-textmate@^8.0.0: - version "8.0.0" - resolved "https://registry.yarnpkg.com/vscode-textmate/-/vscode-textmate-8.0.0.tgz#2c7a3b1163ef0441097e0b5d6389cd5504b59e5d" - integrity sha512-AFbieoL7a5LMqcnOF04ji+rpXadgOXnZsxQr//r83kLPr7biP7am3g9zbaZIaBGwBRWeSvoMD4mgPdX3e4NWBg== - -webidl-conversions@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871" - integrity sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ== - -whatwg-url@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-5.0.0.tgz#966454e8765462e37644d3626f6742ce8b70965d" - integrity sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw== - dependencies: - tr46 "~0.0.3" - webidl-conversions "^3.0.0" - which-boxed-primitive@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/which-boxed-primitive/-/which-boxed-primitive-1.0.2.tgz#13757bc89b209b049fe5d86430e21cf40a89a8e6" @@ -6127,11 +6021,6 @@ word-wrap@^1.2.3: resolved "https://registry.yarnpkg.com/word-wrap/-/word-wrap-1.2.5.tgz#d2c45c6dd4fbce621a66f136cbe328afd0410b34" integrity sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA== -wordwrap@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-1.0.0.tgz#27584810891456a4171c8d0226441ade90cbcaeb" - integrity sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus= - wordwrapjs@^4.0.0: version "4.0.1" resolved "https://registry.yarnpkg.com/wordwrapjs/-/wordwrapjs-4.0.1.tgz#d9790bccfb110a0fc7836b5ebce0937b37a8b98f"