Skip to main content

BuyBack Queries

The BuyBack API provides a single GraphQL query to retrieve information about token buyback operations, burns, and liquidity additions.

Query: buyBacks​

Retrieves a paginated list of BuyBack records.

Query Structure​

query BuyBacksQuery(
$limit: Int
$offset: Int
$order: Order
$orderBy: DefaultOrderBy
) {
buyBacks(limit: $limit, offset: $offset, order: $order, orderBy: $orderBy) {
count
limit
offset
data {
id
type
tokenAmount
usdAmount
date
txLink
createdAt
updatedAt
}
}
}

Parameters​

All parameters are optional and provide pagination and sorting controls:

  • limit (Int): Maximum number of records to return. Default is set by the server.
  • offset (Int): Number of records to skip. Default is 0.
  • order (Order): Sort order, either ASC (ascending) or DESC (descending). Default is DESC.
  • orderBy (DefaultOrderBy): Field to order by. Default is CREATED_AT. Available options include:
    • CREATED_AT: Order by creation date
    • Other supported fields from DefaultOrderBy enum

Response Structure​

The query returns a BuyBacksPaginationResponse object with the following structure:

  • count (Int): Total number of records matching the query
  • limit (Int): The limit parameter value used
  • offset (Int): The offset parameter value used
  • data (Array of BuyBackModel): The retrieved records with the following fields:
    • id (ID): Unique identifier of the record
    • type (BuyBackType): Type of the operation (BUY_BACK, BURN, or LIQUIDITY_ADD)
    • tokenAmount (Float): Amount of tokens involved in the operation
    • usdAmount (Float): USD value of the tokens at the time of the operation
    • date (DateTime): Date and time when the operation occurred
    • txLink (String): Link to the blockchain transaction
    • createdAt (DateTime): Record creation timestamp
    • updatedAt (DateTime): Record last update timestamp

Example Request​

query GetBuyBacks {
buyBacks(limit: 10, offset: 0, order: DESC, orderBy: CREATED_AT) {
count
limit
offset
data {
id
type
tokenAmount
usdAmount
date
txLink
createdAt
}
}
}

Example Response​

{
"data": {
"buyBacks": {
"count": 25,
"limit": 10,
"offset": 0,
"data": [
{
"id": "65d5f8e1c2d9a82b16b34a77",
"type": "BUY_BACK",
"tokenAmount": 5000,
"usdAmount": 750,
"date": "2023-12-15T08:30:00Z",
"txLink": "https://explorer.com/tx/0x1234567890abcdef",
"createdAt": "2023-12-15T08:35:22Z"
},
{
"id": "65d5f8e1c2d9a82b16b34a78",
"type": "BURN",
"tokenAmount": 2500,
"usdAmount": 375,
"date": "2023-12-14T10:15:00Z",
"txLink": "https://explorer.com/tx/0xabcdef1234567890",
"createdAt": "2023-12-14T10:20:45Z"
}
// Additional records...
]
}
}
}

Error Handling​

If an error occurs during the execution of the query, the GraphQL response will include an errors field with details about the error.

Filtering​

The current implementation does not support filtering. The query returns all BuyBack records according to the pagination and sorting parameters.

Notes​

  • All date fields are returned in ISO 8601 format with UTC timezone
  • The query is read-only and does not modify any data