一键导入
gdex-perp-funding
Deposit and withdraw USDC to/from HyperLiquid for perpetual futures trading — constraints, amounts, and managed-custody flow
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Deposit and withdraw USDC to/from HyperLiquid for perpetual futures trading — constraints, amounts, and managed-custody flow
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
HyperLiquid perpetual futures — open/close positions, set leverage, place market and limit orders with TP/SL, and manage open orders
CSS theming system for GDEX trading UIs — dark/light modes, trading colors, responsive breakpoints, and Tailwind CSS configuration
Troubleshoot GDEX SDK errors — error codes, encryption debugging, chain-specific quirks, HL gotchas, and copy trade pitfalls
Start here — GDEX overview, architecture, supported chains, available skills, and quickstart for cross-chain DeFi trading via managed-custody wallets
HyperLiquid HIP-3 outcome / event markets — list markets, place outcome orders, and manage outcome positions
Import user-defined custom tokens so they appear in token details, balances, and portfolio across the platform
| name | gdex-perp-funding |
| description | Deposit and withdraw USDC to/from HyperLiquid for perpetual futures trading — constraints, amounts, and managed-custody flow |
Manage USDC deposits and withdrawals between your managed wallet and HyperLiquid perp account.
@gdexsdk/gdex-skill installedimport { GdexSkill, GDEX_API_KEY_PRIMARY } from '@gdexsdk/gdex-skill';
const skill = new GdexSkill();
skill.loginWithApiKey(GDEX_API_KEY_PRIMARY);
// Amount is human-readable USDC — SDK converts to smallest unit (6 decimals) internally
await skill.perpDeposit({ amount: '10' }); // deposit 10 USDC (minimum)
await skill.perpDeposit({ amount: '100' }); // deposit 100 USDC
await skill.perpDeposit({
amount: '50',
tokenAddress: '0xaf88d065e77c8cC2239327C5EDb3A432268e5831', // USDC on Arbitrum
chainId: 42161, // Arbitrum
apiKey,
walletAddress, // MUST be the CONTROL wallet address (from sign-in), NOT the managed address
sessionPrivateKey,
});
CRITICAL:
walletAddressmust be the control wallet address used during sign-in — NOT the managed-custody address returned by/v1/user. Passing the managed address causes400 Unauthorized (code 103). See gdex-authentication for details.
await skill.perpWithdraw({ amount: '5' }); // withdraw 5 USDC
await skill.perpWithdraw({
amount: '25',
apiKey,
walletAddress,
sessionPrivateKey,
});
| Constraint | Value |
|---|---|
| Chain | Arbitrum only (chainId 42161) |
| Token | USDC only (0xaf88d065e77c8cC2239327C5EDb3A432268e5831) |
| Min deposit | 10 USDC |
| Amount format | Human-readable (e.g., '10' for 10 USDC); SDK converts to 6 decimal smallest unit internally |
| Fee buffer | Managed wallet must hold amount × 1.01 (1% fee) |
| Delivery time | ~10 minutes after Arbitrum tx confirms |
| On-chain amount | 10 USDC = 10000000 (6 decimals) in the ABI encoding |
const balance = await skill.getHlUsdcBalance({ walletAddress: '0xYourAddress' });
console.log('Available USDC:', balance);
The deposit uses a specific ABI schema with uint64 for chainId:
| Field | ABI Type | Example |
|---|---|---|
chainId | uint64 | 42161 |
tokenAddress | address | 0xaf88d065e77c8cC2239327C5EDb3A432268e5831 |
amount | uint256 | 10000000 (10 USDC) |
nonce | string | Client-generated timestamp + random |
CRITICAL: chainId is uint64, NOT uint256. Using uint256 causes 400 Unauthorized (code 103).
Withdraw ABI schema:
| Field | ABI Type | Example |
|---|---|---|
amount | string | '5000000' (5 USDC in smallest unit) |
nonce | string | Client-generated |
amount × 1.01 USDC on Arbitrum (1% fee buffer)getHlUsdcBalance() or getHlAccountState() to checkThe backend can return an error (HTTP 400, "Transaction has been reverted…")
even though the on-chain USDC transfer to the HL bridge succeeded and the
funds are en route. Do not blindly retry — a retry spends gas and can move
funds twice. On any deposit error, first check the managed wallet's USDC
balance on Arbitrum and getHlAccountState() / getHlUsdcBalance(); only
retry if the balance is unchanged after a few minutes.
HyperLiquid credits the depositing wallet (the managed address), so check
getHlAccountState(managedAddress). Enabling outcome (HIP-3) trading or placing
an outcome order can move USDC from the perp account to the spot balance —
check getHlSpotState(managedAddress) if the perp balance reads $0.
walletAddress instead of the control wallet address — see gdex-authenticationuint256 vs uint64 encoding mismatch for chainId — see gdex-perp-trading for full ABI detailsgetHlAccountState() — getGbotUsdcBalance returns 404.perpDeposit({ amount: '10' })), but the ABI encoding internally converts to 6-decimal smallest unit (10 USDC = 10000000).chainId: 1 (EVM) for HL deposit/withdraw operations.walletAddress MUST be control wallet — passing managed address → 400 Unauthorized (code 103).