๐Ÿ“š
Whirl API
  • ๐Ÿ“šWhirl API Documentation
  • ๐Ÿ“–Public requests
  • ๐Ÿ“ˆStats
  • ๐Ÿ—๏ธAPI
  • ๐Ÿ“‡Auth
  • ๐Ÿง‘User
  • ๐Ÿ“ฌDeposit
  • ๐Ÿ“ฅWithdrawals
  • ๐Ÿ”„Swap
  • ๐Ÿ“จSend
  • ๐Ÿ”€Disperse
  • ๐ŸงพFees
  • ๐Ÿ’ฒRevenue Share (RevShare)
  • ๐Ÿ”ฎVirtual Accounts
  • โžก๏ธTransfer
Powered by GitBook
On this page
  • POST /transfer/init - Initiate Transfer
  • GET /transfer/history/sent - Sent Transfer History
  • GET /transfer/history/received - Received Transfer History
  • GET /virtual/virtual-transfer-fee/total - Retrieve Total Virtual Transfer Fees
  • GET /virtual/virtual-transfer-fee/history - Retrieve Virtual Transfer Fee History

Transfer

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

POST /transfer/init - Initiate Transfer

Description: Initiates a virtual transfer between two accounts, either from UUID to UUID or from UUID to a recipient address.

Parameters:

Parameter
Type
Description

ticker

string

The asset ticker symbol.

amount

string

The amount of the asset to transfer.

senderUuid

string

The UUID of the sender's virtual account.

recipient

string

The recipient's address or UUID.

senderLabel

string

An optional label for the sender's virtual account.

fees

string

Optional fees to be applied to the transaction.

feesCollector

string

The collector of the transaction fees.

Response:

{
  "error": [],
  "result": {
    "transactionId": "unique_transaction_identifier",
    "status": "initiated",
    "timestamp": "timestamp_of_creation"
  }
}

Error Handling:

Error Code
Description

E_INVALID_PARAMS

Returned if required parameters are missing or invalid.

E_INVALID_TICKER

Invalid or unsupported ticker symbol.

E_INVALID_AMOUNT

Invalid transaction amount, possibly below minimum threshold.

E_FEES_ABOVE_AMOUNT

Specified fees are greater than the transaction amount.

E_INVALID_FEES_COLLECTOR

Fees collector address is invalid or not found.

E_CREATING_VIRTUAL_TRANSFER

General error during the transfer initiation process.

Example Code:

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

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

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

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

// Replace payload with actual data
initiateTransfer({
  ticker: 'ETH',
  amount: '0.01',
  senderUuid: 'sender-uuid',
  recipient: 'recipient-uuid',
  senderLabel: 'My Wallet',
  fees: '0.0001',
  feesCollector: 'fees-collector-address'
});

GET /transfer/history/sent - Sent Transfer History

Description: Retrieves the history of all transfers sent from the user's virtual accounts.

Parameters:

Parameter
Type
Description

label

string

Optional label of the user's virtual account.

uuid

string

Optional UUID of the user's virtual account.

Response:

{
  "data": [
    {
      "senderUuid": "uuid_of_sender",
      "senderLabel": "label_of_sender",
      "ticker": "asset_ticker",
      "createdAt": "transaction_timestamp",
      "formatted": "formatted_amount_with_decimals"
    }
  ],
  "meta": {
    "pagination": {
      "currentPage": 1,
      "totalPages": 10,
      "totalResults": 100
    }
  }
}

Error Handling:

Error Code
Description

E_UNAUTHORIZED

Unauthorized access, possibly due to bad token.

Example Code:

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

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

const fetchSentHistory = async (uuid) => {
  try {
    const response = await fetch(`${BASE_URL}transfer/history/sent?uuid=${uuid}`, {
      headers: {
        'X-API-Key': API_KEY
      }
    });
    const data = await response.json();

    console.log(data.result);
  } catch (error) {
    console.error('Error fetching sent transfer history:', error

);
  }
};

const uuid = "uuid";
fetchSentHistory(uuid);

GET /transfer/history/received - Received Transfer History

Description: Retrieves the history of all transfers received into the user's virtual accounts.

Parameters:

Parameter
Type
Description

label

string

Optional label of the user's virtual account.

uuid

string

Optional UUID of the user's virtual account.

Response:

{
  "data": [
    {
      "recipientUuid": "uuid_of_recipient",
      "recipientLabel": "label_of_recipient",
      "ticker": "asset_ticker",
      "createdAt": "transaction_timestamp",
      "formatted": "formatted_amount_with_decimals"
    }
  ],
  "meta": {
    "pagination": {
      "currentPage": 1,
      "totalPages": 10,
      "totalResults": 100
    }
  }
}

Error Handling:

Error Code
Description

E_UNAUTHORIZED

Unauthorized access, possibly due to bad token.

Example Code:

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

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

const fetchReceivedHistory = async (uuid) => {
  try {
    const response = await fetch(`${BASE_URL}transfer/history/received?uuid=${uuid}`, {
      headers: {
        'X-API-Key': API_KEY
      }
    });
    const data = await response.json();

    console.log(data.result);
  } catch (error) {
    console.error('Error fetching received transfer history:', error);
  }
};

const uuid = "uuid";
fetchReceivedHistory(uuid);

GET /virtual/virtual-transfer-fee/total - Retrieve Total Virtual Transfer Fees

Description: This endpoint retrieves the total of virtual transfer fees for a specific user from the specified address.

Parameters:

Parameter
Type
Description
Required

from

string

Blockchain address to filter the transactions.

Yes

Response:

{
  "error": [],
  "result": [
    {
      "ticker": "ETH",
      "amount": "2000000000000000000",
      "formatted": "2.0"
    }
  ]
}

Error Handling:

Error Code
Description

E_INVALID_ADDRESS

Provided 'from' parameter is invalid.

Example Code:

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

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

const getTotalVirtualTransferFees = async (userAddress) => {
  try {
    const response = await fetch(`${BASE_URL}virtual/virtual-transfer-fee/total?from=${encodeURIComponent(userAddress)}`, {
      headers: {
        'X-API-Key': API_KEY
      }
    });
    const data = await response.json();

    console.log(data.result);
  } catch (error) {
    console.error('Error retrieving total virtual transfer fees:', error);
  }
};

// Replace '0x...' with the actual user address
getTotalVirtualTransferFees('0x...');

GET /virtual/virtual-transfer-fee/history - Retrieve Virtual Transfer Fee History

Description: This endpoint retrieves the history of virtual transfer fees for a specific user from the specified address with pagination.

Parameters:

Parameter
Type
Description
Required

from

string

Blockchain address to filter the transactions.

No

page

integer

Page number for pagination.

No

Response:

{
  "data": [
    {
      "ticker": "ETH",
      "createdAt": "2022-07-01T00:00:00Z",
      "formatted": "0.5"
    }
  ],
  "meta": {
    "totalPages": 1,
    "currentPage": 1,
    "pageSize": 10
  }
}

Error Handling:

Error Code
Description

E_INVALID_ADDRESS

Provided 'from' parameter is invalid.

Example Code:

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

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

const getVirtualTransferFeeHistory = async (userAddress, page) => {
  try {
    const url = `${BASE_URL}virtual/virtual-transfer-fee/history?from=${encodeURIComponent(userAddress)}&page=${page}`;
    const response = await fetch(url, {
      headers: {
        'X-API-Key': API_KEY
      }
    });
    const data = await response.json();

    console.log(data.result);
  } catch (error) {
    console.error('Error retrieving virtual transfer fee history:', error);
  }
};

// Replace '0x...' with the actual user address and `1` with the desired page number
getVirtualTransferFeeHistory('0x...', 1);
PreviousVirtual Accounts

Last updated 1 year ago

โžก๏ธ