Skip to content

Withdraw from Hyperliquid (phase 1): 22 destinations over Circle - #315

Open
ezedike-evan wants to merge 5 commits into
devfrom
hyperliquid-withdraw
Open

ezedike-evan wants to merge 5 commits into
devfrom
hyperliquid-withdraw

Conversation

@ezedike-evan

Copy link
Copy Markdown
Contributor

New source hyperliquid, behind NEXT_PUBLIC_HYPERLIQUID_SOURCE (off by default).

Why: Hyperliquid's own withdraw button sends USDC over Circle only to Arbitrum; Base, Ethereum and Polygon go through Across; nothing to Solana, Arc, Avalanche, OP, Monad and the rest (read from its production app; docs/hyperliquid-withdraw.md, which also says where Hyperliquid's button is cheaper).

What

  • Destinations: every EVM chain Circle forwards to (21, Arc included) + Solana. Stellar refused before any read ("stuck for good", with the two-step way round); Sui, Aptos, HyperEVM, Injective, Morph, Pharos refused with reasons.
  • Quote: Circle's fee live from CoreDepositWallet.calculateCrossChainWithdrawalFee(true, domain) + paused(); balances from Hyperliquid info; 1 USDC first-withdrawal fee from preTransferCheck; amounts the fees would swallow refused.
  • Build: two signatures, the withdrawal (sendToEvmWithData, nonce = Date.now()) and Xebra's fee (usdSend/spotSend, 0.01% + 1c, nonce + 1), both collected before anything is posted. No fee address (XEBRA_FEE_ADDRESS_HYPERCORE, server-only) = route listed nowhere, never free. Refuses while our fee account isn't activated.
  • Status: <sender>:<nonce> -> CrossChainWithdraw on HyperEVM -> Circle status for domain 19; burnTx exposed.
  • SDK/API: new tx kind, optional fields (fees.activation, quote sender, signatureChainId, status burnTx); openapi regenerated.
  • UI: "From: Hyperliquid" form from existing components, balance, breakdown, 3-step tracker that survives a closed tab.

Tests: 78 new (typed-data golden vectors from Python eth_account + Hyperliquid's own usdSend vector, fee math, service, mocked RPC/info). SDK 408/409 and web 1079 pass (the 2 failures are timing tests that pass alone). Typecheck clean, biome 0 errors.

Not verified yet: no signature or real withdrawal; that coreNonce equals the signed nonce (tracking depends on it); Solana hook when the ATA already exists; activation-fee behaviour on spot-only new accounts.

To switch on: activate a Xebra Hyperliquid fee address (send it 1 USDC), set XEBRA_FEE_ADDRESS_HYPERCORE, a paid HYPEREVM_RPC_URL (public RPC rate-limits log search), optional HYPERLIQUID_MAX_USDC, then NEXT_PUBLIC_HYPERLIQUID_SOURCE=true on a Preview and one real 2 USDC withdrawal to Arc.

🤖 Generated with Claude Code

Read from Hyperliquid's production app bundle, Across's Hyperliquid fee
page and Hyperliquid's FAQ (2026-11-28): USDC goes to Arbitrum (Circle,
destinationChainId hard-coded to 3), Base, Ethereum and Polygon (Across),
or the user's HyperEVM address. Not Solana, Arc or the other CCTP chains.
The Hyperliquid source's copy leads with that.
- core/hypercore: CoreDepositWallet and API constants, the destinations a
  HyperCore withdrawal reaches with Circle delivering (every forwardable
  EVM chain, Arc, Solana), plain-word refusals (Stellar: stuck for good;
  Sui/Aptos: not yet; HyperEVM; chains Circle does not deliver to), the
  fee split (Xebra fee, Circle forward fee, Hyperliquid's one-time 1 USDC)
  and <sender>:<nonce> transfer ids.
- build/hypercore: sendToEvmWithData and the usdSend/spotSend fee as
  EIP-712 typed data plus the action to post, Solana's cctp-forward +
  01 + owner hook, and the /exchange body. Golden vectors from Python
  eth_account and Hyperliquid's own usdSend test vector.
- ChainId gains hyperliquid; UnsignedTx gains kind hyperliquid; the
  public schemas gain fees.activation, quote sender, transfer
  signatureChainId and status burnTx (all optional). openapi.json
  regenerated.
…tus)

- routes: hyperliquid -> every forwardable EVM chain, Arc and Solana,
  listed only when NEXT_PUBLIC_HYPERLIQUID_SOURCE=true and
  XEBRA_FEE_ADDRESS_HYPERCORE is set (never served free).
- quote: Circle's forward fee read live from CoreDepositWallet
  (calculateCrossChainWithdrawalFee, paused), Xebra's fee from the fee
  table, Hyperliquid's 1 USDC when the sender has never sent anything
  (preTransferCheck). Refuses amounts the fees would swallow. Stellar is
  refused before anything is read, in plain words, with the two-step way.
- build: the withdrawal and Xebra's fee as two hyperliquid steps, nonce
  and nonce+1, signed for the wallet's chain (signatureChainId); the
  balance (perps or spot) that holds the whole amount; refuses while
  Xebra's fee account is not activated on HyperCore.
- status: <sender>:<nonce> -> CrossChainWithdraw log on HyperEVM (1000-
  block windows, matched on coreNonce) -> Circle's record of the burn on
  domain 19, with burnTx; or the HyperEVM hash directly.
- /api/hyperliquid/config for the page; env documented in
  .env.production.example. UnsignedTx's exchangeUrl is the literal
  Hyperliquid endpoint.
…IQUID_SOURCE

Off by default. When on, the screen asks /api/hyperliquid/config and
offers Hyperliquid as a source (shown as unavailable, with the reason,
while Xebra's HyperCore fee address is not set). The form leads with what
Hyperliquid's own Withdraw button cannot do (Solana, Arc and the other
CCTP chains), shows the account's perps and spot USDC, prices through
/v1/quote with the sender, builds through /v1/transfers with the wallet's
chain id, asks for both signatures before posting anything, posts the
withdrawal then the fee straight to Hyperliquid, remembers the withdrawal
across a closed tab and follows it through /v1/transfers/hyperliquid.
Errors say what happened, what to do and where the USDC is. Stellar is
not offered, with a line saying why and the way round. Built from the
app's own components (Notice, ChainPicker, Field, InsetTray, DataRow).
@vercel

vercel Bot commented Nov 28, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
xebra Error Error Nov 28, 2026 3:01pm UTC
xebra-docs Ready Ready Preview Nov 28, 2026 3:01pm UTC

This branch had an error being deployed

1 failed deployment
Preview – xebra — 11e7ab21 Deployed Nov 28, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant