To install the library, run:
go get github.com/fateevd/dedust-api-go
This package provides functions to interact with the DeDust API using GraphQL. It includes functions to fetch various data such as boosts, assets, prices, pools, and promotions.
baseUrl
: The base URL for the DeDust GraphQL API.
defaultVariables
: A map containing default variables for GraphQL requests.
Fetches the list of boosts.
- Returns:
[]Boost
: A slice ofBoost
objects.error
: An error if the request fails.
Fetches the list of assets.
- Returns:
[]Asset
: A slice ofAsset
objects.error
: An error if the request fails.
Fetches a single asset by its address.
- Parameters:
assetAddress
: The address of the asset.
- Returns:
Asset
: TheAsset
object.error
: An error if the request fails.
Fetches the price of an asset.
- Parameters:
assetAddress
: The address of the asset.decimals
: The number of decimals for the price.
- Returns:
Price
: ThePrice
object.error
: An error if the request fails.
Fetches the prices of an asset.
- Parameters:
assetAddress
: The address of the asset.decimals
: The number of decimals for the prices.
- Returns:
[]Price
: A slice ofPrice
objects.error
: An error if the request fails.
Fetches the list of pools.
- Returns:
[]Pool
: A slice ofPool
objects.error
: An error if the request fails.
Fetches a single pool by its address.
- Parameters:
poolAddress
: The address of the pool.
- Returns:
Pool
: ThePool
object.error
: An error if the request fails.
Fetches the list of promotions.
- Returns:
[]Promotions
: A slice ofPromotions
objects.error
: An error if the request fails.