Token Tools
These tools provide functionality for working with ERC20 tokens and ERC721 NFTs on the Somnia blockchain.
get_token_info
Section titled “get_token_info”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.
get_nft_info
Section titled “get_nft_info”Retrieves information about a specific NFT (ERC721 token).
Parameters:
network
(optional): Network name or chain ID (defaults to Somnia testnet)tokenAddress
: The NFT contract addresstokenId
: 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.
check_nft_ownership
Section titled “check_nft_ownership”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 addressownerAddress
: The address to checktokenId
: 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?
get_ens_name
Section titled “get_ens_name”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.
reverse_ens_name
Section titled “reverse_ens_name”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.
batch_transfer_native
Section titled “batch_transfer_native”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 withto
(recipient address) andamount
(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.
batch_transfer_erc20
Section titled “batch_transfer_erc20”Transfers ERC20 tokens to multiple addresses in batch.
Parameters:
network
(optional): Network name or chain ID (defaults to Somnia testnet)tokenAddress
: ERC20 token contract addresstransfers
: Array of transfer objects withto
(recipient address) andamount
(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.
Error Handling
Section titled “Error Handling”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