OmnesMSA API Docs
Api reference

Get Receipt

Get transaction receipts by transaction hash.

Get transaction receipts by transaction hash.

Endpoint

POST /receipt

Description

Retrieves transaction receipts from the blockchain by transaction hash. Includes decoded logs and event data.

Request Body

{
  "txHashes": [
    "0x066a0269a55aa42498da9993f01b9bfc82517330669c240807ed1b94b2acd938"
  ],
  "rpc": "https://polygon-amoy.infura.io/v3/{key}"
}

Response

{
  "requestStatus": 200,
  "receipts": [
    {
      "status": 1,
      "txHash": "0x066a0269a55aa42498da9993f01b9bfc82517330669c240807ed1b94b2acd938",
      "gasUsed": 34111,
      "cumulativeGasUsed": 17033026,
      "effectiveGasPrice": "1136849215",
      "logs": []
    }
  ]
}

Response Fields

  • requestStatus (integer): HTTP status code of the request
  • receipts (array): Array of transaction receipts
    • status (integer): Transaction status (0 - failed, 1 - success)
    • txHash (string): Transaction hash
    • gasUsed (integer): Gas used by the transaction
    • cumulativeGasUsed (integer): Cumulative gas used in the block
    • effectiveGasPrice (string): Effective gas price
    • logs (array): Decoded event logs from the transaction

Example Request

curl -X POST https://api.msa.omnes.tech/receipt \
  -H "Content-Type: application/json" \
  -d '{
    "txHashes": [
      "0x066a0269a55aa42498da9993f01b9bfc82517330669c240807ed1b94b2acd938"
    ],
    "rpc": "https://polygon-amoy.infura.io/v3/{key}"
  }'
const response = await fetch('https://api.msa.omnes.tech/receipt', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    txHashes: [
      '0x066a0269a55aa42498da9993f01b9bfc82517330669c240807ed1b94b2acd938',
    ],
    rpc: 'https://polygon-amoy.infura.io/v3/{key}',
  }),
});

const result = await response.json();
console.log('Transaction status:', result.receipts[0].status === 1 ? 'Success' : 'Failed');
console.log('Gas used:', result.receipts[0].gasUsed);
import requests

url = "https://api.msa.omnes.tech/receipt"
payload = {
    "txHashes": [
        "0x066a0269a55aa42498da9993f01b9bfc82517330669c240807ed1b94b2acd938"
    ],
    "rpc": "https://polygon-amoy.infura.io/v3/{key}"
}

response = requests.post(url, json=payload)
result = response.json()
print(f"Transaction status: {'Success' if result['receipts'][0]['status'] == 1 else 'Failed'}")
print(f"Gas used: {result['receipts'][0]['gasUsed']}")

Use Cases

  • Transaction tracking: Monitor transaction status and completion
  • Event logging: Retrieve decoded event logs from transactions
  • Gas analysis: Analyze gas usage for optimization
  • Batch verification: Verify multiple transactions at once

Best Practices

  1. Wait for confirmation: Wait for transaction confirmation before fetching receipt
  2. Handle multiple receipts: Process array of receipts for batch operations
  3. Check status codes: Verify transaction status before processing logs
  4. Decode logs: Use decoded logs for event tracking

💡 Tip: Receipts include decoded event logs, making it easy to track contract events without manual decoding.