Skip to main content

Withdraw Funds from Exchanges

Withdraw funds from exchange accounts back to your server wallet. The server handles transaction signing and withdrawal request processing.

Supported Exchanges

ExchangeEndpointDescription
AsterPOST /api/trading/aster/withdrawWithdraw from Aster to server wallet
HyperliquidPOST /api/trading/hyperliquid/withdrawWithdraw from Hyperliquid to destination

Aster Withdrawal

Withdraw funds from your Aster exchange account to your server wallet.

Endpoint

POST /api/trading/aster/withdraw

Request Body

{
  "walletAddress": "0x07943f0f79097572451601e768c329a2765f2ea2",
  "chainId": 56,
  "asset": "USDT",
  "amount": "50",
  "broker": 1000,
  "receiver": "0x07943f0f79097572451601e768c329a2765f2ea2",
  "accountType": "perp"
}

Request Parameters

FieldTypeRequiredDescription
walletAddressstringYesUser wallet performing withdrawal
chainIdnumberYesTarget blockchain (e.g., 56 = BSC)
assetstringYesToken symbol (e.g., “USDT”)
amountstringYesWithdrawal amount in raw units
brokernumberNoBroker ID (default: 1000)
receiverstringYesDestination wallet address
accountTypestringYesAccount type: “spot” or “perp”
Important: The receiver address should match the walletAddress for signature verification. The exchange verifies that the receiver address matches the signer address.

What Happens

  1. Create Withdrawal Message - Server creates withdrawal request with transaction details
  2. Sign Request - Server signs using the wallet’s MPC key shares
  3. Verify Signature - Exchange verifies the signature matches the wallet
  4. Process Withdrawal - Exchange validates and processes the withdrawal
  5. Broadcast Transaction - Funds are sent to the blockchain
  6. Receive Funds - Funds arrive in the server wallet after confirmation

Example Request

curl -X POST https://api.dexaggregatorbeta.xyz/api/trading/aster/withdraw \
  -H "Content-Type: application/json" \
  -d '{
    "walletAddress": "0x07943f0f79097572451601e768c329a2765f2ea2",
    "chainId": 56,
    "asset": "USDT",
    "amount": "50",
    "receiver": "0x07943f0f79097572451601e768c329a2765f2ea2",
    "accountType": "perp"
  }'
await axios.post('https://api.dexaggregatorbeta.xyz/api/trading/aster/withdraw', {
  walletAddress: '0x07943f0f79097572451601e768c329a2765f2ea2',
  chainId: 56,
  asset: 'USDT',
  amount: '50',
  receiver: '0x07943f0f79097572451601e768c329a2765f2ea2',
  accountType: 'perp'
});

Success Response

{
  "success": true,
  "withdrawalId": "4c93dfe1-8c62-40ae-93d7-f02a999ab2f7",
  "status": "submitted",
  "timestamp": 1698840000000
}

Response Fields

FieldTypeDescription
successbooleanOperation status
withdrawalIdstringUnique withdrawal identifier
statusstringWithdrawal status (“submitted”, “pending”, “completed”)
timestampnumberUnix timestamp in milliseconds

Hyperliquid Withdrawal

Withdraw funds from your Hyperliquid account to a destination address.

Endpoint

POST /api/trading/hyperliquid/withdraw

Headers

HeaderValueRequired
x-wallet-idWallet ID (UUID)Yes
Content-Typeapplication/jsonYes

Request Body

{
  "walletIdOrAddress": "0x90EA34C09B612AC68E696BdC7be0ED037a086E72",
  "destination": "0x90EA34C09B612AC68E696BdC7be0ED037a086E72",
  "amount": "0.2",
  "feeBuffer": "0",
  "chainId": 42161
}

Request Parameters

FieldTypeRequiredDescription
walletIdOrAddressstringYesUser’s wallet (userId, walletId, or address)
destinationstringYesRecipient wallet address
amountstringYesWithdrawal amount
feeBufferstringNoFee overhead multiplier (default: “0”)
chainIdnumberYesDestination network (e.g., 42161 = Arbitrum)

Example Request

curl -X POST https://api.dexaggregatorbeta.xyz/api/trading/hyperliquid/withdraw \
  -H "x-wallet-id: a1e82339-29f8-41a6-a468-ce8d268a3261" \
  -H "Content-Type: application/json" \
  -d '{
    "walletIdOrAddress": "0x90EA34C09B612AC68E696BdC7be0ED037a086E72",
    "destination": "0x90EA34C09B612AC68E696BdC7be0ED037a086E72",
    "amount": "0.2",
    "feeBuffer": "0",
    "chainId": 42161
  }'
await axios.post('https://api.dexaggregatorbeta.xyz/api/trading/hyperliquid/withdraw', {
  walletIdOrAddress: '0x90EA34C09B612AC68E696BdC7be0ED037a086E72',
  destination: '0x90EA34C09B612AC68E696BdC7be0ED037a086E72',
  amount: '0.2',
  feeBuffer: '0',
  chainId: 42161
}, {
  headers: { 'x-wallet-id': 'a1e82339-29f8-41a6-a468-ce8d268a3261' }
});

Success Response

{
  "success": true,
  "data": {
    "withdrawalId": "4828392",
    "status": "accepted",
    "timestamp": 1698840000000
  }
}

Response Fields

FieldTypeDescription
successbooleanOperation status
data.withdrawalIdstringUnique withdrawal identifier
data.statusstringWithdrawal status (“accepted”, “pending”, “completed”)
data.timestampnumberUnix timestamp in milliseconds

Error Responses

400 Bad Request - Missing Parameters

{
  "success": false,
  "error": "Missing required parameters",
  "timestamp": 1698840000000
}

400 Bad Request - Insufficient Balance

{
  "success": false,
  "error": "Insufficient balance for withdrawal",
  "timestamp": 1698840000000
}

404 Not Found - Wallet Not Found

{
  "success": false,
  "error": "Wallet not found",
  "timestamp": 1698840000000
}

500 Internal Server Error

{
  "success": false,
  "error": "Failed to process withdrawal",
  "timestamp": 1698840000000
}

Supported Networks

ExchangeNetworkChain IDToken
AsterBSC (BNB Chain)56USDT
HyperliquidArbitrum42161USDC

Important Notes

Signature Verification: For Aster, the receiver address must match the wallet address that signs the withdrawal request. This is a security measure to prevent unauthorized withdrawals.
Fee Buffer: For Hyperliquid, the feeBuffer parameter adds a percentage overhead to cover gas fees. A value of “1.1” means 10% extra for fees.
Withdrawal Status: Use the returned withdrawalId to track the withdrawal status. Withdrawals typically take a few minutes to complete depending on network congestion.
Account Types: For Aster, specify whether you’re withdrawing from “spot” or “perp” account. Make sure you have sufficient balance in the specified account type.

Use Cases

  • Withdraw profits from trading back to your server wallet
  • Move funds between exchanges by withdrawing to wallet then depositing elsewhere
  • Cash out positions after closing trades
  • Rebalance funds across different platforms