๐Ÿ’ฒRevenue Share (RevShare)

This documentation provides details on the API endpoints available for Whirlprivacy.io, focusing on revenue-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.

GET /rev/eligible - Check Rev Share Eligibility

Description: Determines if a user is eligible for revenue sharing.

Parameters:

ParameterLocationTypeRequiredDescription

user

query

address

Yes

The address of the user to verify

Response:

{
  "error": [],
  "result": {
    "eligible": "boolean"
  }
}

Error Handling:

Error NameDescription

Unauthorized

The user is not logged in or token is invalid.

Example Code:

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

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

const checkRevShareEligibility = async (userAddress) => {
  try {
    const response = await fetch(`${BASE_URL}rev/eligible?user=${encodeURIComponent(userAddress)}`, {
      headers: {
        'X-API-Key': API_KEY
      }
    });
    const data = await response.json();

    console.log(data.result);
  } catch (error) {
    console.error('Error checking revenue share eligibility:', error);
  }
};

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

GET /rev/history - Get User's Revenue Share History

Description: Fetches the revenue share history of the logged-in user for a specified ticker.

Parameters:

ParameterLocationTypeRequiredDescription

ticker

query

string

Yes

The ticker symbol of the asset to filter the history.

page

query

integer

No

The page number for pagination. Defaults to 1 if not provided.

Response:

{
  "error": [],
  "result": {
    "data": [
      {
        "status": "string",
        "createdAt": "date",
        "chain": "int",
        "formatted": "float"
      }
    ],
    "meta": {
      "pagination": {
        "total": "int",
        "perPage": "int",
        "currentPage": "int",
        "lastPage": "int"
      }
    }
  }
}

Error Handling:

Error NameDescription

Unauthorized

The user is not logged in or token is invalid.

InvalidTicker

The provided ticker symbol is not supported.

Example Code:

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

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

const getRevenueShareHistory = async (ticker, page) => {
  try {
    const response = await fetch(`${BASE_URL}rev/history?ticker=${encodeURIComponent(ticker)}${page ? `&page=${page}` : ''}`, {
      headers: {
        'X-API-Key': API_KEY
      }
    });
    const data = await response.json();

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

// Replace 'ETH' with the actual ticker symbol and '2' with the desired page number
getRevenueShareHistory('ETH', 2);

GET /rev/total - Get User's Total Revenue Shares by Ticker

Description: Calculates the total revenue shares for a user by a specific ticker.

Parameters:

ParameterLocationTypeRequiredDescription

ticker

query

string

No

The ticker symbol of the asset. Defaults to "ETH" if not provided.

Response:

{
  "error": [],
  "result": "string"
}

Error Handling:

Error NameDescription

Unauthorized

The user is not logged in or token is invalid.

InvalidTicker

The provided ticker symbol is not supported.

Example Code:

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

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

const getUserTotalRevenueShares = async (ticker = 'ETH') => { // Default to 'ETH' if ticker is not provided
  try {
    const response = await fetch(`${BASE_URL}rev/total?ticker=${encodeURIComponent(ticker)}`, {
      headers: {
        'X-API-Key': API_KEY
      }
    });
    const data = await response.json();

    console.log(data.result);
  } catch (error) {
    console.error('Error fetching user\'s total revenue shares:', error);
  }
};

getUserTotalRevenueShares();

Last updated