Skip to content

Token Tools

These tools provide functionality for working with ERC20 tokens and ERC721 NFTs on the Somnia blockchain.

Gets comprehensive information about an ERC20 token.

Parameters:

  • network (optional): Network name or chain ID (defaults to Somnia testnet)
  • tokenAddress: The ERC20 token contract address

Example:

{
"network": "Somnia Testnet",
"tokenAddress": "0xabcdef1234567890abcdef1234567890abcdef12"
}

Response: Returns token name, symbol, decimals, total supply, and formatted total supply.

Example Prompt:

Get information about ERC20 token 0xabcdef1234567890abcdef1234567890abcdef12.

Retrieves information about a specific NFT (ERC721 token).

Parameters:

  • network (optional): Network name or chain ID (defaults to Somnia testnet)
  • tokenAddress: The NFT contract address
  • tokenId: The NFT token ID

Example:

{
"network": "Somnia Testnet",
"tokenAddress": "0xabcdef1234567890abcdef1234567890abcdef12",
"tokenId": "123"
}

Response: Returns NFT name, symbol, and token URI.

Example Prompt:

Get info about NFT with ID 123 from contract 0xabcdef1234567890abcdef1234567890abcdef12.

Checks if a specific address owns a particular NFT.

Parameters:

  • network (optional): Network name or chain ID (defaults to Somnia testnet)
  • tokenAddress: The NFT contract address
  • ownerAddress: The address to check
  • tokenId: The NFT token ID

Example:

{
"network": "Somnia Testnet",
"tokenAddress": "0xabcdef1234567890abcdef1234567890abcdef12",
"ownerAddress": "0x1234567890123456789012345678901234567890",
"tokenId": "456"
}

Response: Returns whether the address owns the NFT and a descriptive message.

Example Prompt:

Does address 0x1234567890123456789012345678901234567890 own NFT 456 from 0xabcdef1234567890abcdef1234567890abcdef12?

Resolves an ENS name to its corresponding address.

Parameters:

  • network (optional): Network name or chain ID (defaults to Somnia testnet)
  • ensName: The ENS name to resolve (e.g., ‘alice.eth’)

Example:

{
"network": "Somnia Testnet",
"ensName": "alice.somnia"
}

Response: Returns the resolved address for the ENS name.

Example Prompt:

Resolve the ENS name 'alice.somnia' to its address.

Gets the ENS name associated with an address.

Parameters:

  • network (optional): Network name or chain ID (defaults to Somnia testnet)
  • address: The address to reverse lookup

Example:

{
"network": "Somnia Testnet",
"address": "0x1234567890123456789012345678901234567890"
}

Response: Returns the ENS name associated with the address, if any.

Example Prompt:

Get the ENS name for address 0x1234567890123456789012345678901234567890.

Transfers native tokens to multiple addresses in batch.

Parameters:

  • network (optional): Network name or chain ID (defaults to Somnia testnet)
  • transfers: Array of transfer objects with to (recipient address) and amount (amount in SST/SOMI)

Example:

{
"network": "Somnia Testnet",
"transfers": [
{
"to": "0x1234567890123456789012345678901234567890",
"amount": "0.1"
},
{
"to": "0xabcdef1234567890abcdef1234567890abcdef12",
"amount": "0.5"
}
]
}

Response: Returns batch transfer results with success/failure status for each transfer.

Example Prompt:

Transfer 0.1 SST to 0x1234567890123456789012345678901234567890 and 0.5 SST to 0xabcdef1234567890abcdef1234567890abcdef12.

Transfers ERC20 tokens to multiple addresses in batch.

Parameters:

  • network (optional): Network name or chain ID (defaults to Somnia testnet)
  • tokenAddress: ERC20 token contract address
  • transfers: Array of transfer objects with to (recipient address) and amount (amount in token units)

Example:

{
"network": "Somnia Testnet",
"tokenAddress": "0xabcdef1234567890abcdef1234567890abcdef12",
"transfers": [
{
"to": "0x1234567890123456789012345678901234567890",
"amount": "100"
},
{
"to": "0xabcdef1234567890abcdef1234567890abcdef12",
"amount": "250"
}
]
}

Response: Returns batch ERC20 transfer results with success/failure status for each transfer.

Example Prompt:

Batch transfer ERC20 tokens from 0xabcdef1234567890abcdef1234567890abcdef12 to multiple addresses.

Token tools may return errors if:

  • Token contract address is invalid or doesn’t exist
  • Token ID is invalid for NFTs
  • ENS name doesn’t exist or can’t be resolved
  • Contract doesn’t implement expected ERC20/ERC721 interface