For the complete documentation index, see llms.txt. This page is also available as Markdown.

Transaction Module

Transaction module handles blockchain transaction operations and queries.

To learn more about how to use the AI Agent SDK to interact with the transaction module, please visit AI Agent SDK Transaction Queries.

3.1 Get Transaction By Hash

Fetches a transaction by hash.

Function Name

get_transaction_by_hash
  • Arguments

    hash (str): The hash of the transaction.
  • Example Code

    from crypto_com_developer_platform_client import Transaction
    
    tx = Transaction.get_transaction_by_hash('example-hash')
    print(tx)
  • Returns

    The transaction details.
  • Errors

    ValueError: If the Transaction class is not initialized with a Client instance.
  • Example Return

    {'status': 'Success', 'data': {'transaction': {'_type': 'TransactionResponse', 'accessList': example-list, 'blockNumber': example-block-number, 'blockHash': 'example-hash', 'blobVersionedHashes': example-hashes, 'chainId': 'example-chain0id', 'data': 'example-data', 'from': 'example-from', 'gasLimit': 'example-gas-limit', 'gasPrice': 'example-gas-price', 'hash': 'example-hash', 'maxFeePerGas': 'example-fee', 'maxPriorityFeePerGas': 'example-fee', 'maxFeePerBlobGas': example-fee, 'nonce': example-nonce, 'signature': {'_type': 'signature', 'networkV': 'example-V', 'r': 'example-r', 's': 'example-s', 'v': example-v}, 'to': 'example-to', 'index': example-index, 'type': example-type, 'value': 'example-value'}}}

Function Name

getTransactionByHash
  • Arguments

    {string} txHash: Transaction hash.
  • Example Code

    import { Transaction } from '@crypto.com/developer-platform-client';
    
    const tx = await Transaction.getTransactionByHash('example-hash');
    console.log(tx);
  • Returns

    {Promise<ApiResponse<TransactionByHash>>}: A promise that resolves to the transaction result
  • Example Return

    {
      status: 'Success',
      data: {
        transaction: {
          _type: 'TransactionResponse',
          accessList: example-list,
          blockNumber: example-block-number,
          blockHash: 'example-hash',
          blobVersionedHashes: example-hashes,
          chainId: 'example-chain-id',
          data: 'example-data',
          from: 'example-from',
          gasLimit: 'example-gas-limit',
          gasPrice: 'example-gas-price',
          hash: 'example-hash',
          maxFeePerGas: 'example-fee',
          maxPriorityFeePerGas: 'example-fee',
          maxFeePerBlobGas: example-fee,
          nonce: example-nonce,
          signature: [example-singature],
          to: 'example-to',
          index: example-index,
          type: example-type,
          value: 'example-value'
        }
      }
    }

3.2 Get Transaction Status

Fetches transaction status by hash.

Function Name

get_transaction_status
  • Arguments

    hash (str): The hash of the transaction.
  • Example Code

    from crypto_com_developer_platform_client import Transaction
    
    status = Transaction.get_transaction_status('example-hash')
    print(status)
  • Returns

    The transaction status.
  • Errors

    ValueError: If the Transaction class is not initialized with a Client instance.
  • Example Return

    {'status': 'Success', 'data': {'status': 1}}

Function Name

getTransactionStatus
  • Arguments

    {string} txHash: Transaction hash.
  • Example Code

    import { Transaction } from '@crypto.com/developer-platform-client';
    
    const status = await Transaction.getTransactionStatus('example-hash');
    console.log(status);
  • Returns

    Promise<ApiResponse<TransactionStatus>>}: A promise that resolves to the transaction status.
  • Example Return

    { status: 'Success', data: { status: 1 } }

3.3 Get Transaction Count

Fetches transaction count for a wallet.

Function Name

  • Arguments

  • Example Code

  • Returns

  • Errors

  • Example Return

Function Name

  • Arguments

  • Example Code

  • Returns

  • Example Return

3.4 Get Gas Price

Fetches current gas price.

Function Name

  • Example Code

  • Returns

  • Errors

  • Example Return

Function Name

  • Example Code

  • Returns

  • Example Return

3.5 Get Fee Data

Fetches current fee data.

Function Name

  • Example Code

  • Returns

  • Errors

  • Example Return

Function Name

  • Example Code

  • Returns

  • Example Return

3.6 Estimate Gas

Estimates gas for a transaction.

Function Name

  • Arguments

  • Example Code

  • Returns

  • Errors

  • Example Return

Function Name

  • Arguments

  • Example Code

  • Returns

  • Example Return

Last updated

Was this helpful?