The canonical token-bridge of Arbitrum
Are you a developer looking to explore the Arbitrum token bridge and its underlying technology? Then you've come to the right place! We'll walk you through the steps to run the Arbitrum token bridge website locally on your machine.
Offchain Labs โค๏ธ Open-source
Interested in contributing to this repo? We welcome your contribution. Check out the contribution guidelines and instructions here.
-
Install Node.js for your platform
-
Install Node Version Manager (nvm) to setup the correct Node version for the project.
-
Install VS Code for your platform
-
Install Yarn (version 1) - Package manager
-
Within VS Code, we use a some tools to automate things (e.g. code formatting), maintain consistency and reduce noise for code reviews. For the optimal development experience, install the following tools:
-
Clone the Arbitrum token bridge repository from Github onto your local machine
$ git clone https://github.com/OffchainLabs/arb-token-bridge
-
Use the Node version as per project settings to avoid any errors before project installation.
$ nvm use
-
Install dependencies in all packages using yarn.
$ yarn
-
Set env vars:
-
Copy the existing env.local.sample file present.
$ cp ./packages/arb-token-bridge-ui/.env.local.sample ./packages/arb-token-bridge-ui/.env
-
In
.env
created, addNEXT_PUBLIC_INFURA_KEY=my-infura-key
-
Set
NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID
to your WalletConnect project ID. You can create a new project on the WalletConnect dashboard. -
For custom urls, set optional vars:
NEXT_PUBLIC_ETHEREUM_RPC_URL=my-eth-node
NEXT_PUBLIC_SEPOLIA_RPC_URL=my-sepolia-node
(see .env.sample) If no custom URL is provided, Infura will be used by default.
-
-
Build the project and internal packages
$ yarn build
-
Finally, running the project
-
(back in root dir:)
$ yarn dev
-
Visit
http://localhost:3000/
-
It is important for any code change to pass both unit and end-to-end tests. This is generally done before raising the PR to ensure it doesn't break any existing feature.
- Run the token bridge UI locally on
http://localhost:3000/
- Run the tests
$ yarn test:ci
-
Set up the Nitro test node
-
First, make sure you have a Nitro test node running. Follow the instructions here.
Use the following command to run your test nodes locally for our tests. You may omit
--l3node --l3-token-bridge
if you don't intend on testing Orbit chains../test-node.bash --init --no-simple --tokenbridge --l3node --l3-token-bridge
To run with a custom fee token also include the following flags:
--l3-fee-token --l3-fee-token-decimals 18
-
When the Nitro test-node is up and running you should see logs like
sequencer_1
andstaker-unsafe_1
in the terminal. This can take up to 10 minutes.
-
-
At the root of the token bridge UI:
- Run:
$ cp ./packages/arb-token-bridge-ui/.e2e.env.sample ./packages/arb-token-bridge-ui/.e2e.env
- In the newly created file,
.e2e.env
, update yourNEXT_PUBLIC_INFURA_KEY
andPRIVATE_KEY_USER
-
Run the token bridge UI locally on
http://localhost:3000/
with:$ yarn dev
-
Run e2e tests
$ yarn test:e2e
-
If you would like to run CCTP tests, run
$ yarn test:e2e:cctp
-
For Orbit tests, run
$ yarn test:e2e:orbit
Read more about the test setup here.