Withdraw Collateral
Withdraws specified amount of collateral from Vertex.
Note: use the max withdrawable query to determine the max amount you can withdraw for a given spot product.
Rate limits
With spot leverage: 60 withdrawals/min or 10 withdrawals every 10 seconds per wallet. (weight = 10)
Without spot leverage: 30 withdrawals/min or 5 withdrawals every 10 seconds per wallet. (weight=20)
See more details in API Rate limits.
Request
Request Parameters
Parameter | Type | Required | Description |
---|---|---|---|
tx | object | Yes | Withdraw collateral transaction object. See Signing section for details on the transaction fields. |
tx.sender | string | Yes | Hex string representing the subaccount's 32 bytes (address + subaccount name) of the tx sender. |
tx.productId | number | Yes | A spot product ID to withdraw from. |
tx.amount | string | Yes | The amount of the asset to withdraw, denominated in the base ERC20 token of the specified product e.g: USDC (product=0) has 6 decimals whereas wETH (product=3) has 18. See Signing section for more details. |
tx.nonce | string | Yes | This is an incrementing nonce, can be obtained using the Nonces query. |
signature | string | Yes | Hex string representing hash of the signed transaction. See Signing section for more details. |
spot_leverage | boolean | No | Indicates whether leverage should be used; when set to |
Signing
See more details and examples in our signing page.
The solidity typed data struct that needs to be signed is:
sender
: a bytes32
sent as a hex string; includes the address and the subaccount identifier.
productId
: a uint32
that specifies the product youโd like to withdraw collateral from; must be for a spot product.
amount
: the amount of asset to withdraw, sent as a string. Note that this is different from the amounts provided in transactions that arenโt depositCollateral
. This is the raw amount of the ERC20 token you want to receive, i.e. if USDC has 6 decimals and you want to withdraw 1 USDC, specify 1e6; if wETH has 18 decimals and you want to withdraw 1 wETH, specify 1e18. Use all products query to view the token address of the corresponding product which can be used to determine the correct decimals to use.
nonce
: the tx_nonce
. This is an incrementing nonce, can be obtained using the Nonces query.
Note: for signing you should always use the data type specified in the solidity struct which might be different from the type sent in the request e.g: nonce
should be an uint64
for Signing but should be sent as a string
in the final payload.
Response
Success
Failure
Last updated