- USDC Arrival Detection - Monitor for bridged USDC on HyperEVM
- Deposit Execution - Execute deposits to Hyperliquid L1
- L1 Confirmation Monitoring - Confirm deposits on Hyperliquid L1
USDC Arrival Detection
Monitor for USDC arrival on HyperEVM after a bridge transaction.Exports
detectUsdcArrival(walletAddress, options?)
Poll for USDC balance increase on HyperEVM.| Parameter | Type | Required | Description |
|---|---|---|---|
walletAddress | string | Yes | Wallet address to monitor |
options | DetectionOptions | No | Detection options |
| Option | Type | Default | Description |
|---|---|---|---|
timeout | number | 300000 | Timeout in ms (5 minutes) |
pollInterval | number | 5000 | Poll interval in ms (5 seconds) |
onPoll | (attempt, balance) => void | - | Callback for each poll |
expectedAmount | string | - | Expected amount for validation |
UsdcArrivalResult
| Property | Type | Description |
|---|---|---|
detected | boolean | Whether arrival was detected |
amount | string | Amount received (smallest unit) |
amountFormatted | string | Formatted amount with decimals |
receivingTxHash | string | undefined | HyperEVM transaction hash |
timestamp | number | Detection timestamp |
previousBalance | string | Pre-bridge balance |
currentBalance | string | Current balance |
UsdcArrivalTimeoutError if timeout is reached.
Example:
snapshotUsdcBalance(walletAddress)
Take a balance snapshot before bridging.detectUsdcArrivalFromSnapshot(walletAddress, previousBalance, options?)
Detect arrival from a known balance snapshot.checkUsdcBalance(walletAddress)
One-time check of USDC balance on HyperEVM.Deposit Execution
Execute deposits from HyperEVM to Hyperliquid L1.Exports
executeDeposit(signer, options)
Execute a deposit to Hyperliquid L1 trading account.| Option | Type | Required | Default | Description |
|---|---|---|---|---|
amount | string | Yes | - | Amount in smallest units |
walletAddress | string | Yes | - | Wallet address |
destinationDex | DestinationDexType | No | 0 (PERPS) | Destination DEX |
onDepositSubmitted | (txHash) => void | No | - | Deposit tx callback |
onApprovalSubmitted | (txHash) => void | No | - | Approval tx callback |
onStatusChange | (status) => void | No | - | Status callback |
infiniteApproval | boolean | No | false | Infinite approval |
DepositResult
| Property | Type | Description |
|---|---|---|
success | boolean | Whether deposit succeeded |
depositTxHash | string | Deposit transaction hash |
approvalTxHash | string | undefined | Approval tx hash (if needed) |
amount | string | Deposited amount |
amountFormatted | string | Formatted amount |
destinationDex | DestinationDexType | Destination DEX |
blockNumber | number | undefined | Confirmation block |
gasUsed | string | undefined | Gas used |
MinimumDepositErrorif amount < 5 USDCInsufficientBalanceErrorif USDC balance insufficientInsufficientGasErrorif HYPE balance insufficientDepositTransactionErrorif transaction failsUserRejectedErrorif user rejects
executeDepositFor(signer, recipientAddress, options)
Deposit on behalf of another address.validateDepositRequirements(walletAddress, amount)
Pre-flight validation before deposit.DepositValidation
| Property | Type | Description |
|---|---|---|
valid | boolean | Can deposit proceed |
usdcBalance | string | USDC balance |
usdcBalanceFormatted | string | Formatted USDC balance |
gasBalance | string | HYPE (gas) balance |
currentAllowance | string | Current deposit allowance |
needsApproval | boolean | Whether approval needed |
error | string | undefined | Error message |
approveUsdcForDeposit(signer, amount, onSubmitted?)
Execute USDC approval for CoreDepositWallet.checkDepositAllowance(walletAddress)
Check current USDC allowance for CoreDepositWallet.L1 Confirmation Monitoring
Monitor deposit confirmation on Hyperliquid L1.Exports
monitorL1Confirmation(walletAddress, expectedAmount, hyperEvmTxHash, options?)
Monitor L1 with cancellation support.| Option | Type | Default | Description |
|---|---|---|---|
timeout | number | 120000 | Timeout in ms (2 minutes) |
pollInterval | number | 5000 | Poll interval in ms |
onProgress | (progress) => void | - | Progress callback |
onTimeoutWarning | (warning) => void | - | Timeout warning callback |
result: Promise that resolves toL1ConfirmationResultcontroller:L1MonitorControllerfor managing monitoring
waitForL1Confirmation(walletAddress, expectedAmount, hyperEvmTxHash, options?)
Simple L1 confirmation (without controller).getHyperliquidBalance(walletAddress)
Get Hyperliquid L1 trading account balance.InvalidL1AddressErrorif address is invalidNetworkErrorif API fails
getL1TradingBalance(walletAddress)
Get formatted L1 trading balance.checkHyperliquidAccountExists(walletAddress)
Check if account has any trading history.createBridgeCompleteSummary(params)
Create a complete summary of the bridge-to-trading flow.BridgeCompleteSummary
| Property | Type | Description |
|---|---|---|
sourceChain | { id, name } | Source chain info |
sourceTxHash | string | First transaction hash |
bridgeSteps | CompletedStep[] | All bridge steps |
bridgeTime | number | Bridge time in ms |
hyperEvmDepositTxHash | string | Deposit tx hash |
hyperEvmDepositTime | number | Deposit time in ms |
l1ConfirmationTime | number | L1 confirmation time |
inputAmount | string | Original input |
inputAmountFormatted | string | Formatted input |
outputAmount | string | Deposited amount |
outputAmountFormatted | string | Formatted output |
finalTradingBalance | string | Final L1 balance |
finalTradingBalanceFormatted | string | Formatted L1 balance |
totalTime | number | Total time in ms |
totalFeesUsd | string | Total fees |
completedAt | number | Completion timestamp |
Constants
Contract Addresses
| Constant | Value | Description |
|---|---|---|
CORE_DEPOSIT_WALLET_ADDRESS | 0x6B9E773128f453f5c2C60935Ee2DE2CBc5390A24 | CoreDepositWallet on HyperEVM |
HYPEREVM_USDC_ADDRESS | 0xb88339cb7199b77e23db6e890353e22632ba630f | USDC on HyperEVM |
Amounts
| Constant | Value | Description |
|---|---|---|
MINIMUM_DEPOSIT_AMOUNT | 5000000 | Minimum deposit (5 USDC) |
DestinationDex
Timing
| Constant | Value | Description |
|---|---|---|
ARRIVAL_DETECTION_TIMEOUT_MS | 300000 | 5 min - arrival timeout |
ARRIVAL_POLL_INTERVAL_MS | 5000 | 5 sec - arrival poll |
L1_CONFIRMATION_TIMEOUT_MS | 120000 | 2 min - L1 timeout |
L1_HARD_MAX_TIMEOUT_MS | 1800000 | 30 min - hard max |
L1_POLL_INTERVAL_MS | 5000 | 5 sec - L1 poll |
APIs
| Constant | Value | Description |
|---|---|---|
HYPERLIQUID_INFO_API | https://api.hyperliquid.xyz/info | Hyperliquid Info API |
