Arb-TS
Typescript library for doing Arbitrum stuff, particular stuff like interacting between L1 and L2. Uses ethers.
Quickstart
const ethProvider = new providers.JsonRpcProvider(ethRPC)
const arbProvider = new providers.JsonRpcProvider(arbRPC)
const connectedL1Wallet = new Wallet(myPrivateKey, ethProvider)
const connectedL2Wallet = new Wallet(myPrivateKey, arbProvider)
const bridge = await Bridge.init(
connectedL1Wallet,
connectedL2Wallet
l1GatewayRouter,
l2GatewayRouter
)
bridge.depositEth(parseEther('32'))
See integration tests for sample usage.
Run Integration tests
yarn test:integration
Defaults to rinkArby
, for custom network use --network
flag.
rinkArby
expects env var DEVNET_PRIVKEY
to be prefunded with at least 0.02 ETH, and env var INFURA_KEY
to be set.
(see integration_test/config.ts
)
Bridge A Standard Token
Bridging new a 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:
-
clone arbitrum
monorepo
-
git submodule update --init --recursive
-
yarn install
(from root)
-
cd packages/arb-ts
-
Set PRIVKEY
environmental 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).
-
Set MAINNET_RPC environmental variable to L1 RPC endpoint (i.e., https://mainnet.infura.io/v3/my-infura-key)
-
yarn bridgeStandardToken
Required CL params:
networkID
:number — Chain ID of L1 network
l1TokenAddress
:string — address of L1 token to be bridged
Ex:
yarn bridgeStandardToken --networkID 4 --l1TokenAddress 0xdf032bc4b9dc2782bb09352007d4c57b75160b15 --amount 3