๐Ÿ”€Disperse

This documentation provides details on the API endpoints available for Whirlprivacy.io, focusing on disperse-related operations.

โš ๏ธ 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 NameValueDescription

X-API-key

base64

API token obtained after authentication.

POST /disperse/init โ€“ Disperse Init

Description:

Allows a logged-in user to initiate a disperse operation. It is designed to distribute an asset across multiple addresses, optionally incorporating a delay in the disbursement process.

Parameters:

NameTypeDescriptionRequired

sender

String

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

No

chain

String

The blockchain chain ID where the asset exists.

Yes

ticker

String

The ticker symbol of the asset to disperse.

Yes

recipients

Array

A list of recipient objects with amount and address.

Yes

delayMin

Integer

The minimum delay (in minutes) before the disperse starts.

No

delayMax

Integer

The maximum delay (in minutes) after which the disperse must occur.

No

Request Example:

{
  "error": [],
  "result": {
      "chain": "1",
      "ticker": "ETH",
      "recipients": [
        {
          "amount": "0.5",
          "address": "0xABC123..."
        },
        {
          "amount": "1.2",
          "address": "0xDEF456..."
        }
      ],
      "delayMin": 10,
      "delayMax": 60
  }
}

Response:

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

Error Handling:

Error CodeDescription

E_INVALID_PARAMS

One or more parameters are missing or invalid.

E_INVALID_DELAY

The specified delay is invalid.

E_UNSUPPORTED_CHAIN_ASSET

The specified chain or asset is not supported.

E_TOO_MUCH_RECIPIENTS

The number of recipients exceeds the maximum allowed.

E_INVALID_TICKER

The specified ticker symbol is not recognized.

E_INVALID_CHAIN

The specified chain ID is invalid.

E_MAX_PENDING_OPS

The user has exceeded the maximum number of pending operations.

E_INVALID_AMOUNT

One or more of the specified amounts are invalid.

E_INVALID_ADDRESS

One or more of the recipient addresses are invalid.

E_BALANCE_TOO_LOW

The user's balance is too low to complete the disperse.

E_ESTIMATE_FEES_OR_AMOUNT_TO_LOW

Estimated fees are too high or the amount is too low.

E_DISPERSING

An error occurred during the disperse initiation.

Example Code:

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

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

const disperseInit = async () => {
  try {
    const response = await fetch(`${BASE_URL}disperse/init`, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
        'X-API-Key': API_KEY
      },
      body: JSON.stringify({
        sender: "uuid",
        chain: "1",
        ticker: "ETH",
        recipients: [
          { amount: "0.5", address: "0xABc123..." },
          { amount: "1.2", address: "0xDEf456..." }
        ],
        delayMin: 10,
        delayMax: 60
      })
    });
    const data = await response.json();
    console.log(data.result);
  } catch (error) {
    console.error('Error initiating disperse transaction:', error);
  }
};

disperseInit();

Last updated