Skip to content

Transaction Tools

These tools enable querying transaction information and performing token transfers on the Somnia blockchain.

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.

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.

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?

Estimates the gas required for a transaction.

Parameters:

  • network (optional): Network name or chain ID (defaults to Somnia mainnet)
  • to: Recipient address
  • value: 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.

Transfers SST (native token) to another address.

Parameters:

  • network (optional): Network name or chain ID (defaults to Somnia mainnet)
  • to: Recipient address
  • amount: 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.

Transfers ERC20 tokens to another address.

Parameters:

  • network (optional): Network name or chain ID (defaults to Somnia mainnet)
  • tokenAddress: ERC20 token contract address
  • to: Recipient address
  • amount: 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.

Estimates the gas required for a contract function call.

Parameters:

  • network (optional): Network name or chain ID (defaults to Somnia testnet)
  • contractAddress: The contract address
  • abi: The contract ABI as a JSON array
  • functionName: The function to estimate gas for
  • args (optional): Arguments for the function call as an array
  • from (optional): The sender address
  • value (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.

Monitors a transaction until it’s confirmed.

Parameters:

  • network (optional): Network name or chain ID (defaults to Somnia mainnet)
  • transactionHash: Transaction hash to monitor
  • confirmations (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.

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...

Decodes transaction input data using contract ABI.

Parameters:

  • network (optional): Network name or chain ID (defaults to Somnia mainnet)
  • transactionHash: Transaction hash to decode
  • abi (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.

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.

Gets transaction history for a specific address.

Parameters:

  • network (optional): Network name or chain ID (defaults to Somnia mainnet)
  • address: Address to get transactions for
  • page (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.

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.

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