For the complete documentation index, see llms.txt. This page is also available as Markdown.

Withdraw funds

1

Build withdrawal transaction

Please note only free balances are able to withdraw from the current hydra cycle. Deposit funds

For in-depth API details Build withdrawal transaction

In the following example we're withdrawing 10 Ada, equivalent to 10_000_000 lovelace.

curl --location 'https://api-staging.deltadefi.io/accounts/withdrawal/build' \
--header 'x-api-key: <your_api_key>' \
--header 'Content-Type: application/json' \
--data '{
	"withdrawal_amount": [
		{
			"unit": "lovelace",
			"quantity": "1000000"
		},
	]
}'

const axios = require('axios');
let data = JSON.stringify({
  "withdrawal_amount": [
    {
      "unit": "lovelace",
      "quantity": "1000000"
    },
  ]
});

let config = {
  method: 'post',
  maxBodyLength: Infinity,
  url: 'https://api-staging.deltadefi.io/accounts/withdrawal/build',
  headers: { 
    'x-api-key': '<your_api_key>', 
    'Content-Type': 'application/json'
  },
  data : data
};

axios.request(config)
.then((response) => {
  console.log(JSON.stringify(response.data));
})
.catch((error) => {
  console.log(error);
});

2

Submit withdrawal transaction

With the returned tx_hex from step 1, you will need to sign it before submitting it.

For in-depth API details Submit withdrawal transaction

curl --location 'https://api-staging.deltadefi.io/accounts/withdrawal/submit' \
--header 'X-API-KEY: <your_api_key>' \
--header 'Content-Type: application/json' \
--data '{
    "signed_tx": ""
}'
const axios = require('axios');
let data = JSON.stringify({
  "signed_tx": ""
});

let config = {
  method: 'post',
  maxBodyLength: Infinity,
  url: 'https://api-staging.deltadefi.io/accounts/withdrawal/submit',
  headers: { 
    'X-API-KEY': '<your_api_key>', 
    'Content-Type': 'application/json'
  },
  data : data
};

axios.request(config)
.then((response) => {
  console.log(JSON.stringify(response.data));
})
.catch((error) => {
  console.log(error);
});


Verifying withdrawal

After you have made a successful withdrawal request, you can check your latest account balance via the Account Balances API.

curl --location 'https://api-staging.deltadefi.io/accounts/balance' \
--header 'X-API-KEY: <your_api_key>'
const axios = require('axios');

let config = {
  method: 'get',
  maxBodyLength: Infinity,
  url: 'https://api-staging.deltadefi.io/accounts/balance',
  headers: { 
    'X-API-KEY': '<your_api_key>'
  }
};

axios.request(config)
.then((response) => {
  console.log(JSON.stringify(response.data));
})
.catch((error) => {
  console.log(error);
});

Your requested withdrawal amount will be converted from Free will to Locked , and will be distributed during the next hydra closed.

Your Response should look something like below:

[
    {
        "asset": "ada",
        "asset_unit": "",
        "free": 0,
        "locked": 100
    }
]

Last updated