To install the library, run:
go get github.com/fateevd/dedust-api-goThis 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 ofBoostobjects.error: An error if the request fails.
Fetches the list of assets.
- Returns:
[]Asset: A slice ofAssetobjects.error: An error if the request fails.
Fetches a single asset by its address.
- Parameters:
assetAddress: The address of the asset.
- Returns:
Asset: TheAssetobject.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: ThePriceobject.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 ofPriceobjects.error: An error if the request fails.
Fetches the list of pools.
- Returns:
[]Pool: A slice ofPoolobjects.error: An error if the request fails.
Fetches a single pool by its address.
- Parameters:
poolAddress: The address of the pool.
- Returns:
Pool: ThePoolobject.error: An error if the request fails.
Fetches the list of promotions.
- Returns:
[]Promotions: A slice ofPromotionsobjects.error: An error if the request fails.