Prices
The Prices
class provides methods to fetch price information for coins on the Sui network. It allows you to get the current price of a coin, as well as price information for multiple coins simultaneously.
Creating a Prices Instance
To use the Prices
class, you need to create an instance of it. You can specify the Sui network ("MAINNET"
or "TESTNET"
) when creating the instance.
Fetching Coin Price Information
Get Price Info for a Single Coin
Retrieve detailed price information for a single coin using the getCoinPriceInfo
method.
Get Price Info for Multiple Coins
Fetch price information for multiple coins with the getCoinsToPriceInfo
method.
Get Current Price for a Single Coin
If you only need the current price of a coin, use the getCoinPrice
method.
Get Current Prices for Multiple Coins
To get the current prices for multiple coins, use the getCoinsToPrice
method.
Types
`CoinType`: A string representing the unique identifier of a coin (e.g., its SUI address).
`CoinPriceInfo`: An object containing price information for a coin. -
price
: The current price of the coin in USD.
priceChange24HoursPercentage
: The percentage change in price over the last 24 hours.
Example Usage
Last updated