suix_getCoinMetadata - Sui
Example code for the suix_getCoinMetadata JSON-RPC method. Complete guide on how to use suix_getCoinMetadata JSON-RPC in GetBlock Web3 documentation.
This method returns metadata for a specified coin type on the SUI network, including its symbol, decimals, name, description, and icon URL. This information is essential for displaying tokens correctly in wallet interfaces, DEXs, and portfolio trackers. The metadata is stored on-chain and reflects the token's official configuration.
Parameters
coin_type
string
Yes
The fully qualified type name for the coin (e.g., 0x2::sui::SUI)
Returns
decimals
uint8
Number of decimal places for display formatting
name
string
Human-readable name of the coin
symbol
string
Trading symbol (e.g., SUI, USDC)
description
string
Description of the coin and its purpose
iconUrl
string
URL to the coin's icon image (may be null)
id
ObjectID
The CoinMetadata object ID on-chain
Request Example
curl -X POST https://go.getblock.io/<ACCESS-TOKEN>/ \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": "getblock.io",
"method": "suix_getCoinMetadata",
"params": [
"0x2::sui::SUI"
]
}'const axios = require('axios');
const url = 'https://go.getblock.io/<ACCESS-TOKEN>/';
const payload = {
jsonrpc: '2.0',
id: 'getblock.io',
method: 'suix_getCoinMetadata',
params: ['0x2::sui::SUI']
};
axios.post(url, payload, {
headers: { 'Content-Type': 'application/json' }
})
.then(response => console.log(response.data))
.catch(error => console.error(error));Response Example
Response Parameters
decimals
integer
Number of decimal places (SUI uses 9, meaning 1 SUI = 10^9 MIST)
name
string
Full name of the token
symbol
string
Short trading symbol
description
string
Token description
iconUrl
string
URL to token icon (null if not set)
id
string
On-chain CoinMetadata object ID
Use Cases
Display correct token symbols and names in wallets
Format balances with proper decimal places
Show token icons in user interfaces
Validate token information for listings
Build token registries and databases
Error Handling
-32602
Invalid params - malformed coin type
-32603
Internal error - node processing issues
null result
Coin type does not have registered metadata
SDK Integration
Last updated
Was this helpful?