Prices
The Prices class provides methods for fetching and managing price information for coins on the Sui network, including current prices and 24-hour price changes.
Initialization
const afSdk = new Aftermath("MAINNET");
await afSdk.init(); // initialize provider
const prices = afSdk.Prices();Methods
getCoinPriceInfo()
Retrieves detailed price information for a single coin. Please note that 24h price change percentage is currently not supported for any coins, and will return 0.
const priceInfo = await prices.getCoinPriceInfo({
coin: "0x2::sui::SUI", // CoinType
});
console.log(priceInfo);
/*
{
price: 1.23, // Current price in USD
priceChange24HoursPercentage: 5.67 // 24h price change percentage
}
*/getCoinsToPriceInfo()
Fetches price information for multiple coins simultaneously. Please note that 24h price change percentage is currently not supported for any coins, and will return 0.
getCoinPrice()
Gets the current price of a single coin in USD.
getCoinsToPrice()
Retrieves current prices for multiple coins in USD.
Types
Basic Types
Record Types
Example Usage
Last updated