๐Ÿ“ฅWithdrawals

This documentation provides an overview of the main functionalities provided by the Whirlprivacy.io platform, focusing on the withdrawal process.

โš ๏ธ You must be logged in to use these requests.

Common Headers

For all requests that require user authentication, you must include the following headers:

Header Name
Value
Description

X-API-key

base64

API token obtained after authentication.

POST /withdrawal/init - Initiate Withdrawal

Description:

This endpoint initiates a withdrawal process for a user, allowing them to transfer assets out of the platform.

Parameters:

Name
Type
Description
Required

sender

String

The UUID or the label of the sender. Main by default.

No

chain

String

Blockchain chain identifier.

Yes

ticker

String

Asset ticker symbol.

Yes

amount

String

Amount of the asset to withdraw.

Yes

recipient

String

Recipient's blockchain address.

Yes

Response:

{
  "error": [],
  "result": "Withdrawal initiated"
}

Error Handling:

Error Code
Description

E_INVALID_PARAMS

One or more request parameters are invalid.

E_UNSUPPORTED_CHAIN_ASSET

The requested chain or asset is not supported.

E_INVALID_TICKER

The provided ticker symbol is invalid.

E_INVALID_AMOUNT

The specified amount is invalid.

E_INVALID_CHAIN

The specified blockchain chain is invalid.

E_MAX_PENDING_OPS

Maximum number of pending operations exceeded.

E_BALANCE_TOO_LOW

User's balance is too low for the withdrawal.

E_ESTIMATE_FEES_OR_AMOUNT_TO_LOW

Estimated fees or amount too low for processing.

E_WITHDRAWING

Error occurred during the withdrawal initiation.

Example Code:

const fetch = require('node-fetch');

const BASE_URL = 'https://api.whirlprivacy.io/';
const API_KEY = 'your_api_token';

const initiateWithdrawal = async () => {
  const bodyData = {
    sender: 'string',
    chain: 'string',
    ticker: 'string',
    amount: 'number',
    recipient: 'address'
  };

  try {
    const response = await fetch(`${BASE_URL}withdrawal/init`, {
      method: 'POST',
      headers: { 
        'Content-Type': 'application/json',
        'X-API-Key': API_KEY
      },
      body: JSON.stringify(bodyData)
    });
    const data = await response.json();

    console.log(data.result);
  } catch (error) {
    console.error('Error initiating withdrawal:', error);
  }
};

initiateWithdrawal();

GET /withdrawal/history - Get Withdrawal History

Description:

This endpoint allows users to retrieve their withdrawal history.

Parameters:

Name
Type
Description
Required

uuid or label

String

The UUID or the label of the sender.

Yes

page

Int

Specifies the page of history to fetch.

Yes

Response:

{
  "data": [
    {
      "status": "withdrawal_status",
      "ticker": "string",
      "createdAt": "string",
      "chain": "int",
      "recipient": "string",
      "formatted": "string"
    }
  ],
  "meta": {
    "pagination": {
      "total": "int",
      "perPage": "int",
      "currentPage": "int",
      "lastPage": "int"
    }
  }
}

Status:

Status
Description

0

Withdrawal initiated

1

Withdrawal dropped

2

Withdrawal processing

3

Withdrawal failed

4

Withdrawal executed

Error Handling:

Error Code
Description

None

No specific errors defined for this route

Example Code:

const fetch = require('node-fetch');

const BASE_URL = 'https://api.whirlprivacy.io/';
const API_KEY = 'your_api_token';

const getWithdrawalHistory = async (uuid = "uuid", page = 1) => {
  try {
    const response = await fetch(`${BASE_URL}withdrawal/history?uuid=${uuid}&page=${page}`, {
      headers: {
        'X-API-Key': API_KEY
      }
    });
    const data = await response.json();

    console.log(data.data);
    console.log(data.meta.pagination);
  } catch (error) {
    console.error('Error fetching withdrawal history:', error);
  }
};

getWithdrawalHistory();

Last updated