Retrieve coin
Example Code
const coins = await coinProvider.getCoins({
coinTypes: ['0x2::sui::SUI'],
});Example Response
It will return Coin[] instances, with Coinintance you can do a lot of thing not just JSON
Key Properties:
coinType: Identifies the coin type.
decimals: The number of decimal places (e.g., 18 decimals for Ether).
symbol, name, description, iconUrl: Optional information about the coin, like its name, symbol, description, and an icon URL.
derivedPriceInUSD, derivedSUI: Optional values for the coin’s price in USD or SUI.
isVerified: Marks if the coin is verified.
Main Methods:
sortsBefore: Compares this coin with another to see which comes first in a sorted list.wrapped: Returns the coin itself (currently does nothing extra).equals: Checks if this coin is the same as another by comparing theircoinType.fetchAllOwnedCoins: Retrieves all the coins owned by an address.take: Transfers a specified amount of coins to a transaction, making sure the balance is enough and handling the SUI-specific coins appropriately.
Last updated
Was this helpful?

