๐Ÿ“จSend

This documentation provides details on the API endpoints available for Whirlprivacy.io, focusing on sending-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 /send/init - Initiate Send

Description:

Initiates a send transaction between users. It handles the transfer of assets from one blockchain to another with optional delay parameters for added security.

Parameters:

ParameterTypeDescriptionRequired

sender

String

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

No

fromChain

String

The blockchain from which the assets are being sent.

Yes

ticker

String

The ticker symbol of the asset to be transferred.

Yes

amount

String

The amount of the asset to be transferred.

Yes

recipient

String

The recipient's address.

Yes

tx

String

The transaction hash of the send transaction.

Yes

toChain

String

The blockchain to which the assets are being sent.

Yes

delayMin

Number

The minimum delay time (in minutes) before the transaction.

No

delayMax

Number

The maximum delay time (in minutes) before the transaction.

No

Response:

The response for a successful initiation of a send transaction will look like:

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

Error Handling:

Error CodeDescription

E_INVALID_PARAMS

Invalid parameters were provided.

E_UNSUPPORTED_CHAIN_SEND

The requested chain send is not supported.

E_INVALID_DELAY

The specified delay is invalid.

E_UNSUPPORTED_CHAIN_ASSET

The asset is not supported on the specified chain.

E_INVALID_TICKER

The provided ticker symbol is invalid.

E_INVALID_AMOUNT

The specified amount is invalid.

E_INVALID_CHAIN

The specified chain is invalid.

E_MAX_PENDING_OPS

The user has exceeded the maximum pending operations.

E_PROCESSED_TX

The transaction has already been processed.

E_ESTIMATE_FEES_OR_AMOUNT_TO_LOW

The estimated fees or amount is too low.

E_SENDING

An error occurred initiating the transfer.

Example Code:

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

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

const initiateSendTransaction = async (sender, fromChain, ticker, amount, recipient, tx, toChain, delayMin, delayMax) => {
  try {
    const response = await fetch(`${BASE_URL}send/init`, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
        'X-API-Key': API_KEY
      },
      body: JSON.stringify({
        sender: sender,
        fromChain: fromChain,
        ticker: ticker,
        amount: amount,
        recipient: recipient,
        tx: tx,
        toChain: toChain,
        delayMin: delayMin,
        delayMax: delayMax
      })
    });
    const data = await response.json();
    console.log(data.result);
  } catch (error) {
    console.error('Error initiating send transaction:', error);
  }
};

// Replace the following parameters with actual data
initiateSendTransaction('uuid', 'Ethereum', 'ETH', '0.5', '0xRecipientAddress', '0xTransactionHash', 'Arbitrum', null, null);

Last updated