Transaction Tools
These tools enable querying transaction information and performing token transfers on the Somnia blockchain.
get_transaction
Section titled “get_transaction”Retrieves details of a transaction by its hash.
Parameters:
network
(optional): Network name or chain ID (defaults to Somnia mainnet)transactionHash
: The transaction hash to query
Example:
{ "network": "Somnia Mainnet", "transactionHash": "0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890ab"}
Response: Returns complete transaction data including sender, receiver, value, gas used, etc.
Example Prompt:
Get details of transaction 0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890ab.
get_transaction_receipt
Section titled “get_transaction_receipt”Gets the receipt of a transaction by its hash.
Parameters:
network
(optional): Network name or chain ID (defaults to Somnia mainnet)transactionHash
: The transaction hash to query
Example:
{ "network": "Somnia Testnet", "transactionHash": "0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890ab"}
Response: Returns transaction receipt with status, gas used, logs, etc.
Example Prompt:
Get the receipt for transaction 0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890ab.
get_transaction_count
Section titled “get_transaction_count”Gets the number of transactions sent from an address (nonce).
Parameters:
network
(optional): Network name or chain ID (defaults to Somnia mainnet)address
: The address to query
Example:
{ "network": "Somnia Mainnet", "address": "0x1234567890123456789012345678901234567890"}
Response: Returns the transaction count (nonce) for the address.
Example Prompt:
What is the transaction count for address 0x1234567890123456789012345678901234567890?
estimate_gas
Section titled “estimate_gas”Estimates the gas required for a transaction.
Parameters:
network
(optional): Network name or chain ID (defaults to Somnia mainnet)to
: Recipient addressvalue
: Amount to send (in SST/SOMI)data
(optional): Transaction data as hex string
Example:
{ "network": "Somnia Mainnet", "to": "0x1234567890123456789012345678901234567890", "value": "0.1", "data": "0x..."}
Response: Returns the estimated gas amount.
Example Prompt:
Estimate gas for sending 0.1 SST to 0x1234567890123456789012345678901234567890.
transfer_native_token
Section titled “transfer_native_token”Transfers SST (native token) to another address.
Parameters:
network
(optional): Network name or chain ID (defaults to Somnia mainnet)to
: Recipient addressamount
: Amount of SST to send
Example:
{ "network": "Somnia Testnet", "to": "0x1234567890123456789012345678901234567890", "amount": "0.5"}
Response: Returns success status and transaction hash.
Example Prompt:
Transfer 0.5 SST to address 0x1234567890123456789012345678901234567890.
transfer_erc20_token
Section titled “transfer_erc20_token”Transfers ERC20 tokens to another address.
Parameters:
network
(optional): Network name or chain ID (defaults to Somnia mainnet)tokenAddress
: ERC20 token contract addressto
: Recipient addressamount
: Amount of tokens to send
Example:
{ "network": "Somnia Mainnet", "tokenAddress": "0xabcdef1234567890abcdef1234567890abcdef12", "to": "0x1234567890123456789012345678901234567890", "amount": "100"}
Response: Returns success status and transaction hash.
Example Prompt:
Transfer 100 tokens of 0xabcdef1234567890abcdef1234567890abcdef12 to 0x1234567890123456789012345678901234567890.
estimate_contract_gas
Section titled “estimate_contract_gas”Estimates the gas required for a contract function call.
Parameters:
network
(optional): Network name or chain ID (defaults to Somnia testnet)contractAddress
: The contract addressabi
: The contract ABI as a JSON arrayfunctionName
: The function to estimate gas forargs
(optional): Arguments for the function call as an arrayfrom
(optional): The sender addressvalue
(optional): The value to send with the call in wei
Example:
{ "network": "Somnia Testnet", "contractAddress": "0xabcdef1234567890abcdef1234567890abcdef12", "abi": [ { "inputs": [ {"name": "to", "type": "address"}, {"name": "amount", "type": "uint256"} ], "name": "transfer", "stateMutability": "nonpayable", "type": "function" } ], "functionName": "transfer", "args": ["0x1234567890123456789012345678901234567890", "1000000000000000000"]}
Response: Returns the estimated gas amount.
Example Prompt:
Estimate gas for calling transfer function on contract 0xabcdef1234567890abcdef1234567890abcdef12.
monitor_transaction
Section titled “monitor_transaction”Monitors a transaction until it’s confirmed.
Parameters:
network
(optional): Network name or chain ID (defaults to Somnia mainnet)transactionHash
: Transaction hash to monitorconfirmations
(optional): Number of confirmations to wait for (default: 1)timeout
(optional): Timeout in milliseconds (default: 300000 = 5 minutes)
Example:
{ "network": "Somnia Testnet", "transactionHash": "0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890ab", "confirmations": 3, "timeout": 600000}
Response: Returns transaction confirmation status, block number, gas used, and effective gas price.
Example Prompt:
Monitor transaction 0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890ab for 3 confirmations.
send_raw_transaction
Section titled “send_raw_transaction”Sends a raw signed transaction to the network.
Parameters:
network
(optional): Network name or chain ID (defaults to Somnia mainnet)signedTransaction
: Raw signed transaction as hex string
Example:
{ "network": "Somnia Testnet", "signedTransaction": "0x02f8..."}
Response: Returns transaction hash and success status.
Example Prompt:
Send raw transaction 0x02f8...
decode_transaction_input
Section titled “decode_transaction_input”Decodes transaction input data using contract ABI.
Parameters:
network
(optional): Network name or chain ID (defaults to Somnia mainnet)transactionHash
: Transaction hash to decodeabi
(optional): Contract ABI as JSON array (optional for decoding)
Example:
{ "network": "Somnia Testnet", "transactionHash": "0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890ab", "abi": [ { "inputs": [ {"name": "to", "type": "address"}, {"name": "amount", "type": "uint256"} ], "name": "transfer", "stateMutability": "nonpayable", "type": "function" } ]}
Response: Returns decoded function name, arguments, and raw input data.
Example Prompt:
Decode the input data of transaction 0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890ab.
get_transaction_fee
Section titled “get_transaction_fee”Calculates the actual fee paid for a transaction.
Parameters:
network
(optional): Network name or chain ID (defaults to Somnia mainnet)transactionHash
: Transaction hash to calculate fee for
Example:
{ "network": "Somnia Testnet", "transactionHash": "0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890ab"}
Response: Returns gas used, gas price, effective gas price, total fee in wei and SST format.
Example Prompt:
Calculate the fee paid for transaction 0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890ab.
get_address_transactions
Section titled “get_address_transactions”Gets transaction history for a specific address.
Parameters:
network
(optional): Network name or chain ID (defaults to Somnia mainnet)address
: Address to get transactions forpage
(optional): Page number for pagination (default: 1)limit
(optional): Number of transactions per page (max 100, default: 10)sort
(optional): Sort order (‘asc’ or ‘desc’, default: ‘desc’)
Example:
{ "network": "Somnia Testnet", "address": "0x1234567890123456789012345678901234567890", "page": 1, "limit": 25, "sort": "desc"}
Response: Returns array of transactions with pagination info.
Example Prompt:
Get the transaction history for address 0x1234567890123456789012345678901234567890.
get_pending_transactions
Section titled “get_pending_transactions”Gets pending transactions from the mempool.
Parameters:
network
(optional): Network name or chain ID (defaults to Somnia mainnet)limit
(optional): Maximum number of pending transactions to return (default: 10)
Example:
{ "network": "Somnia Testnet", "limit": 20}
Response: Returns array of pending transactions with hash, from, to, value, gas info, and nonce.
Example Prompt:
Get the list of pending transactions.
Error Handling
Section titled “Error Handling”Transaction tools may return errors if:
- Transaction hash is invalid or not found
- Address format is incorrect
- Insufficient funds for transfer
- Network congestion or gas estimation fails
- Private key not configured for transfer operations