parseTransaction

Cosmos RPC

Overview

The parseTransaction method allows you to parse either an unsigned or signed transaction and retrieve detailed information about its contents. This function is crucial for validating transaction details before submitting them to the Cosmos network.

Request Parameters

NameTypeRequiredDescription
networkIdentifierobjectYesIdentifies the Cosmos blockchain and network details.
blockchainstring (from networkIdentifier)YesThe blockchain identifier, typically "Cosmos".
networkstring (from networkIdentifier)YesThe network name on which the transaction is taking place.
subNetworkIdentifierobject (from networkIdentifier)NoOptional sub-network identifier object.
networkstring (from subNetworkIdentifier)YesThe name of the sub-network within Cosmos.
metadataobject (from subNetworkIdentifier)NoMetadata associated with the sub-network.
signedbooleanYesIndicates whether the transaction is signed.
transactionstringYesThe transaction blob (either unsigned or signed).

Returns

FieldDescription
parsedTransactionThe details of the parsed transaction.

Example Result

{
  "parsedTransaction": {
    "operations": [
      {
        "operation_identifier": {
          "index": 0
        },
        "type": "TRANSFER",
        "status": "SUCCESS",
        "account": {
          "address": "cosmos1..."
        },
        "amount": {
          "value": "-1000",
          "currency": {
            "symbol": "ATOM",
            "decimals": 6
          }
        }
      }
    ]
  }
}

Request Example

curl --location 'https://api.tatum.io/v3/blockchain/node/cosmos-mainnet/construction/parse' \
--header 'Content-Type: application/json' \
--header 'x-api-key: {API_KEY}' \
--data '{
  "network_identifier": {
    "blockchain": "cosmos",
    "network": "cosmos-mainnet"
  },
  "signed": true,
  "transaction": "TRANSACTION_BLOB"
}'
import { TatumSDK, Cosmos, Network } from "@tatumio/tatum";

const cosmos = await TatumSDK.init<Cosmos>({ network: Network.COSMOS_MAINNET });

const transactionDetails = await cosmos.rpc.parseTransaction({
  networkIdentifier: {
    blockchain: "cosmos",
    network: "mainnet"
  },
  signed: true,
  transaction: "TRANSACTION_BLOB"
});

console.log("Parsed Transaction Details:", transactionDetails);

await cosmos.destroy();