Before you start
- The TypeScript project, which provides
src/evm.ts. - A Base wallet with at least 50 USDC, and ETH to pay for gas.
- The Hyperliquid address to credit. It does not have to be yours, and it never signs anything.
Script
This script deposits 50 USDC from Base into a Hyperliquid perps balance. Replace0xHyperliquidAccount with the address to credit, save the file as src/deposit-to-hyperliquid.ts, and run npx tsx src/deposit-to-hyperliquid.ts.
src/deposit-to-hyperliquid.ts
Notes
- The quote ranks two kinds of route together: venues that credit the account directly, and routes through Arbitrum where BRDG’s relayer credits the account. Both need a single signature on the source chain. See Hyperliquid.
- On a route through Arbitrum, the transfer has a
postStep. ItstxHashandcreditedAmountAtomicare set once the Hyperliquid account is credited. - The minimum deposit is 5.10 USDC for an account that is new to Hyperliquid, and 1 USDC otherwise. A route that would credit less appears in
rejectedasbelow_min, with the amount it would have delivered.