Token Module

Token module handles operations related to native tokens, ERC20 tokens, and NFTs.

To learn more about how to use the AI Agent SDK to interact with the token module, please visit AI Agent SDK Token Interaction.

2.1 Get Native Token Balance

Fetches the native token balance of a specific wallet address.

Function Name

get_native_balance
  • Arguments

    address (str): The address to get the balance for (CronosIds with the `.cro` suffix are supported, e.g. `xyz.cro`)
  • Example Code

    from crypto_com_developer_platform_client import Token
    
    balance = Token.get_native_balance('example-wallet')
    print(balance)

2.2 Get ERC20 Token Balance

Fetches the ERC20 token balance of a wallet for a given ERC20 contract.

Function Name

get_erc20_balance
  • Arguments

    wallet_address (str): The address to get the balance for (CronosIds with the `.cro` suffix are supported, e.g. `xyz.cro`)
    contract_address (str): The contract address to get the balance for.
    block_height (str): The block height to get the balance for.
  • Example Code

    from crypto_com_developer_platform_client import Token
    
    balance = Token.get_erc20_balance('example-wallet', 'example-contract', 'latest')
    print(balance)

2.3 Transfer Token

Transfers native or ERC20 tokens.

Function Name

  • Arguments

  • Example Code

2.4 Wrap Token

Wrap tokens.

Function Name

  • Arguments

  • Example Code

2.5 Swap Token

Swap tokens.

Function Name

  • Arguments

  • Example Code

2.6 Get ERC721 Token Balance

Fetches the ERC721 token balance for a wallet and contract.

Function Name

  • Arguments

  • Example Code

2.7 Get ERC721 Token Owner

Fetches the owner of a specific ERC721 token.

Function Name

  • Arguments

  • Example Code

2.8 Get Token URI

Fetches the token URI of a specific ERC721 token.

Function Name

  • Arguments

  • Example Code

2.9 Get ERC721 Metadata

Fetches metadata for a specific ERC721 contract.

Function Name

  • Arguments

  • Example Code

2.10 Get ERC20 Metadata

Fetches metadata for a specific ERC20 contract.

Function Name

  • Arguments

  • Example Code

Last updated

Was this helpful?