Skip to main content

Prerequisites

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

Script

Save as src/bridge-tokens.ts and run with npx tsx src/bridge-tokens.ts.
src/bridge-tokens.ts

Notes

  • Wallets that support EIP-5792 batching can sign the fee and main steps as one bundle; build.feeBatch names the steps. Sequential signing, as above, is always correct.
  • expectedOutAtomic on the build equals the amountOutAtomic you were quoted.
  • A quote_drifted or quote_expired error on build means the price moved. Quote again.

Endpoints used