Repository navigation
Withdraw from Hyperliquid (phase 1): 22 destinations over Circle - #315
Open
ezedike-evan wants to merge 5 commits into
Open
ezedike-evan wants to merge 5 commits into
ezedike-evan wants to merge 5 commits into
Conversation
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).
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch had an error being deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
New source
hyperliquid, behindNEXT_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
CoreDepositWallet.calculateCrossChainWithdrawalFee(true, domain)+paused(); balances from Hyperliquid info; 1 USDC first-withdrawal fee frompreTransferCheck; amounts the fees would swallow refused.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.<sender>:<nonce>->CrossChainWithdrawon HyperEVM -> Circle status for domain 19;burnTxexposed.fees.activation, quotesender,signatureChainId, statusburnTx); openapi regenerated.Tests: 78 new (typed-data golden vectors from Python
eth_account+ Hyperliquid's ownusdSendvector, 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
coreNonceequals 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 paidHYPEREVM_RPC_URL(public RPC rate-limits log search), optionalHYPERLIQUID_MAX_USDC, thenNEXT_PUBLIC_HYPERLIQUID_SOURCE=trueon a Preview and one real 2 USDC withdrawal to Arc.🤖 Generated with Claude Code