suix_getCoinMetadata{deprecated} - Sui
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.
This method is deprecated
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| coin_type | string | Yes | The fully qualified type name for the coin (e.g., 0x2::sui::SUI) |
Returns
| Field | Type | Description |
|---|---|---|
| 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
bashcurl -X POST https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/ \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": "getblock.io",
"method": "suix_getCoinMetadata",
"params": [
"0x2::sui::SUI"
]
}'javascriptconst axios = require('axios');
const url = 'https://shared.eu-central-1.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));pythonimport requests
import json
url = "https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/"
payload = {
"jsonrpc": "2.0",
"id": "getblock.io",
"method": "suix_getCoinMetadata",
"params": ["0x2::sui::SUI"]
}
response = requests.post(url, headers={"Content-Type": "application/json"}, json=payload)
print(response.json())rustuse reqwest::Client;
use serde_json::json;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = Client::new();
let payload = json!({
"jsonrpc": "2.0",
"id": "getblock.io",
"method": "suix_getCoinMetadata",
"params": ["0x2::sui::SUI"]
});
let response = client
.post("https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/")
.header("Content-Type", "application/json")
.json(&payload)
.send()
.await?;
let result: serde_json::Value = response.json().await?;
println!("{:#?}", result);
Ok(())
}Response Example
json{
"jsonrpc": "2.0",
"result": {
"decimals": 9,
"name": "Sui",
"symbol": "SUI",
"description": "The native token of the Sui network.",
"iconUrl": null,
"id": "0x587c29de216efd4219573e08a1f6964d4fa7cb714518c2c8a0f29abfa264327d"
},
"id": "getblock.io"
}Response Parameters
| Parameter | Type | Description |
|---|---|---|
| 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
| Error Code | Description |
|---|---|
| -32602 | Invalid params - malformed coin type |
| -32603 | Internal error - node processing issues |
| null result | Coin type does not have registered metadata |
SDK Integration
typescriptimport { SuiClient } from '@mysten/sui/client';
const client = new SuiClient({ url: 'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/' });
const metadata = await client.getCoinMetadata({
coinType: '0x2::sui::SUI',
});
console.log(metadata);rustuse sui_sdk::SuiClientBuilder;
#[tokio::main]
async fn main() -> Result<(), anyhow::Error> {
let sui = SuiClientBuilder::default()
.build("https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/")
.await?;
let metadata = sui.coin_read_api()
.get_coin_metadata("0x2::sui::SUI".to_string())
.await?;
println!("{:?}", metadata);
Ok(())
}