Transfers & Withdrawals
Preview EIP-712 encoding for a withdrawal
Dry-run helper that returns the EIP-712 typed data and hashes that would be computed for the given withdrawal parameters, so clients can verify their own signing and hashing before submitting. Takes the same inputs as private/withdraw (subaccount, signer, nonce, amount, max fee, expiry, asset) but performs no state change and needs no signature.
POST
/
public
/
withdraw_debug
Preview EIP-712 encoding for a withdrawal
curl --request POST \
--url https://api.derive.xyz/v3/public/withdraw_debug \
--header 'Content-Type: application/json' \
--data '
{
"amount_in_underlying": "<string>",
"asset_name": "<string>",
"force_batch": true,
"max_fee_usd": "<string>",
"nonce": 123,
"signature_expiry_sec": 1,
"signer": "<string>",
"subaccount_id": 1
}
'import requests
url = "https://api.derive.xyz/v3/public/withdraw_debug"
payload = {
"amount_in_underlying": "<string>",
"asset_name": "<string>",
"force_batch": True,
"max_fee_usd": "<string>",
"nonce": 123,
"signature_expiry_sec": 1,
"signer": "<string>",
"subaccount_id": 1
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
amount_in_underlying: '<string>',
asset_name: '<string>',
force_batch: true,
max_fee_usd: '<string>',
nonce: 123,
signature_expiry_sec: 1,
signer: '<string>',
subaccount_id: 1
})
};
fetch('https://api.derive.xyz/v3/public/withdraw_debug', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.derive.xyz/v3/public/withdraw_debug",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'amount_in_underlying' => '<string>',
'asset_name' => '<string>',
'force_batch' => true,
'max_fee_usd' => '<string>',
'nonce' => 123,
'signature_expiry_sec' => 1,
'signer' => '<string>',
'subaccount_id' => 1
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.derive.xyz/v3/public/withdraw_debug"
payload := strings.NewReader("{\n \"amount_in_underlying\": \"<string>\",\n \"asset_name\": \"<string>\",\n \"force_batch\": true,\n \"max_fee_usd\": \"<string>\",\n \"nonce\": 123,\n \"signature_expiry_sec\": 1,\n \"signer\": \"<string>\",\n \"subaccount_id\": 1\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.derive.xyz/v3/public/withdraw_debug")
.header("Content-Type", "application/json")
.body("{\n \"amount_in_underlying\": \"<string>\",\n \"asset_name\": \"<string>\",\n \"force_batch\": true,\n \"max_fee_usd\": \"<string>\",\n \"nonce\": 123,\n \"signature_expiry_sec\": 1,\n \"signer\": \"<string>\",\n \"subaccount_id\": 1\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.derive.xyz/v3/public/withdraw_debug")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"amount_in_underlying\": \"<string>\",\n \"asset_name\": \"<string>\",\n \"force_batch\": true,\n \"max_fee_usd\": \"<string>\",\n \"nonce\": 123,\n \"signature_expiry_sec\": 1,\n \"signer\": \"<string>\",\n \"subaccount_id\": 1\n}"
response = http.request(request)
puts response.read_bodyBody
application/json
Maximum sequencer fee the signer authorises, in USD, as a decimal string (e.g. "1.5") or a JSON number.
Required range:
x >= 0Required range:
x >= 0Response
Success
Related topics
Preview EIP-712 signing data for a quotePreview EIP-712 signing data for a quote executionPreview an order's EIP-712 signing dataRegister a deterministic deposit address for a wallet
Previous
Get remaining rate limits for the connection
Next
⌘I
Preview EIP-712 encoding for a withdrawal
curl --request POST \
--url https://api.derive.xyz/v3/public/withdraw_debug \
--header 'Content-Type: application/json' \
--data '
{
"amount_in_underlying": "<string>",
"asset_name": "<string>",
"force_batch": true,
"max_fee_usd": "<string>",
"nonce": 123,
"signature_expiry_sec": 1,
"signer": "<string>",
"subaccount_id": 1
}
'import requests
url = "https://api.derive.xyz/v3/public/withdraw_debug"
payload = {
"amount_in_underlying": "<string>",
"asset_name": "<string>",
"force_batch": True,
"max_fee_usd": "<string>",
"nonce": 123,
"signature_expiry_sec": 1,
"signer": "<string>",
"subaccount_id": 1
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
amount_in_underlying: '<string>',
asset_name: '<string>',
force_batch: true,
max_fee_usd: '<string>',
nonce: 123,
signature_expiry_sec: 1,
signer: '<string>',
subaccount_id: 1
})
};
fetch('https://api.derive.xyz/v3/public/withdraw_debug', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.derive.xyz/v3/public/withdraw_debug",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'amount_in_underlying' => '<string>',
'asset_name' => '<string>',
'force_batch' => true,
'max_fee_usd' => '<string>',
'nonce' => 123,
'signature_expiry_sec' => 1,
'signer' => '<string>',
'subaccount_id' => 1
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.derive.xyz/v3/public/withdraw_debug"
payload := strings.NewReader("{\n \"amount_in_underlying\": \"<string>\",\n \"asset_name\": \"<string>\",\n \"force_batch\": true,\n \"max_fee_usd\": \"<string>\",\n \"nonce\": 123,\n \"signature_expiry_sec\": 1,\n \"signer\": \"<string>\",\n \"subaccount_id\": 1\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.derive.xyz/v3/public/withdraw_debug")
.header("Content-Type", "application/json")
.body("{\n \"amount_in_underlying\": \"<string>\",\n \"asset_name\": \"<string>\",\n \"force_batch\": true,\n \"max_fee_usd\": \"<string>\",\n \"nonce\": 123,\n \"signature_expiry_sec\": 1,\n \"signer\": \"<string>\",\n \"subaccount_id\": 1\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.derive.xyz/v3/public/withdraw_debug")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"amount_in_underlying\": \"<string>\",\n \"asset_name\": \"<string>\",\n \"force_batch\": true,\n \"max_fee_usd\": \"<string>\",\n \"nonce\": 123,\n \"signature_expiry_sec\": 1,\n \"signer\": \"<string>\",\n \"subaccount_id\": 1\n}"
response = http.request(request)
puts response.read_body