Skip to main content

Before you start

  • The TypeScript project, which provides src/evm.ts.
  • A Base wallet with some USDC, and ETH to pay for gas.

Script

This script sends 25 USDC from Base to the same wallet on Arbitrum. Save it as src/bridge-tokens.ts and run npx tsx src/bridge-tokens.ts.
src/bridge-tokens.ts

Notes

  • Signing the steps one at a time, as above, always works. A wallet that supports EIP-5792 batching can instead sign the steps listed in build.feeBatch as one bundle.
  • build.expectedOutAtomic matches the amountOutAtomic you were quoted.
  • If the build fails with quote_drifted or quote_expired, the price has moved or the quote is too old. Get a new quote.

Endpoints used