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)

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)

3.3 Get Transaction Count

Fetches transaction count for a wallet.

Function Name

get_transaction_count
  • Arguments

    wallet_address (str): The address to get the transaction count for.
  • Example Code

    from crypto_com_developer_platform_client import Transaction
    
    count = Transaction.get_transaction_count('example-wallet')
    print(count)

3.4 Get Gas Price

Fetches current gas price.

Function Name

get_gas_price
  • Example Code

    from crypto_com_developer_platform_client import Transaction
    
    price = Transaction.get_gas_price()
    print(price)

3.5 Get Fee Data

Fetches current fee data.

Function Name

get_fee_data
  • Example Code

    from crypto_com_developer_platform_client import Transaction
    
    data = Transaction.get_fee_data()
    print(data)

3.6 Estimate Gas

Estimates gas for a transaction.

Function Name

estimate_gas
  • Arguments

    payload (dict): The payload for gas estimation, including fields like `from`, `to`, `value`, `gasLimit`, `gasPrice`, `data`.
  • Example Code

    from crypto_com_developer_platform_client import Transaction
    
    gas = Transaction.estimate_gas({'from': 'example-from', 'to': 'example-to', 'value': 'example-value', 'gasLimit': 'example-gas-limit', 'gasPrice': 'example-gas-price', 'data': 'example-data'})
    print(gas)

Last updated

Was this helpful?