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

ParameterTypeRequiredDescription
coin_typestringYesThe fully qualified type name for the coin (e.g., 0x2::sui::SUI)

Returns

FieldTypeDescription
decimalsuint8Number of decimal places for display formatting
namestringHuman-readable name of the coin
symbolstringTrading symbol (e.g., SUI, USDC)
descriptionstringDescription of the coin and its purpose
iconUrlstringURL to the coin's icon image (may be null)
idObjectIDThe 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

ParameterTypeDescription
decimalsintegerNumber of decimal places (SUI uses 9, meaning 1 SUI = 10^9 MIST)
namestringFull name of the token
symbolstringShort trading symbol
descriptionstringToken description
iconUrlstringURL to token icon (null if not set)
idstringOn-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 CodeDescription
-32602Invalid params - malformed coin type
-32603Internal error - node processing issues
null resultCoin 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(())
}