Skip to main content

Overview

All operations use a unified Yield Aggregator Service API, accessible via REST API. Key features of Yield Aggregator:
  1. Upon request, the swap.coffee backend provides information about liquidity pools and DeFi protocols on the TON network.
  2. If the user provides their wallet, the swap.coffee backend retrieves data about the user’s pools.
  3. Users can interact with pools via the API: retrieve pool details, gather information about their position, and perform actions (e.g., adding liquidity).
  4. Users can track the status of their transactions by querying the swap.coffee backend.

List of Pools

To retrieve the list of all pools in Yield Aggregator, use the GET /v1/yield/pools method. This method allows filtering and sorting pools by various parameters, including blockchains, liquidity providers, and more.

Request Parameters

The in_groups Flag

You can retrieve a preview for the specified parameters for each liquidity provider (or all providers if the providers parameter is null). To do this, set in_groups=true in the request. In this case, the response will contain a set of pool lists for each required liquidity provider (up to 10 entries per provider). If in_groups=true, the size and page parameters must be null.

Response Structure

The response structure contains an array of entries with the following fields: Each element in pools consists of: Possible values for pool["@type"]:
  • dex_pool, the object is a DEX pool and contains the following fields:
The pool_statistics object includes the following fields:

Example Request

Retrieving Pool Information

To retrieve detailed information about a pool, use the GET /v1/yield/pool/{pool_address} method.

Response Structure

The method returns an object with fields: Possible values for pool["@type"]:
  • dex_pool, the object is a DEX pool and has the following fields:
Each element in the boosts list has the following fields:

Example Request

Retrieving User Position Information

To retrieve detailed information about a user’s position in a pool, use the GET /v1/yield/pool/{pool_address}/{user_address} method.

Response Structure

The method returns an object with fields: Possible values for pool["@type"]:
  • dex_pool, the object is a DEX pool and has the following fields:
Each element in the boosts list has the following fields:

Example Request

User Interaction with a Pool

To add liquidity or withdraw funds, use the POST /v1/yield/pool/{pool_address}/{user_address} method.

Interaction Types

The method supports the following operations, parameterized by the "@type" field in the request body:
  • dex_provide_liquidity: Add liquidity to the pool.
  • dex_withdraw_liquidity: Withdraw liquidity from the pool.
  • dex_stonfi_lock_staking: Stake in Ston.fi farming service.
  • dex_stonfi_withdraw_staking: Withdraw from staking in Ston.fi.
Each request returns a list of transactions that need to be signed and sent to the blockchain:

Example Request

Checking Operation Status

After submitting a transaction, you can check its statuses using the GET /v1/yield/result method.

Response Structure

The method returns an array of transaction statuses:
  • pending;
  • success;
  • failed.

Example Request