The AI Agent SDK offers powerful token interaction capabilities on the Cronos blockchain. It supports retrieving token balances for both native tokens and ERC20 tokens, performing token transfers, as well as wrapping and swapping tokens.
This comprehensive feature set makes it easy for developers to build AI agents that smoothly interact with tokens.
2.1 Get native balance
Query the native token balance for the specified blockchain address using the Crypto.com developer platform.
Example Query
Query: "Get native balance of <example-address>"
Example Response
The native balance for address <example-address> is <example-amount> CRO (CRO being the native token).
Query Arguments
address (str): The blockchain address to query.
Query Returns
str: A formatted string containing the native token balance for the address.
Transfer native tokens (cro, CRO, tcro, tCRO, zkcro, zkCRO, zktcro, zkTCRO) to a specified address using the Crypto.com developer platform.
Example Query
Query: "Transfer <example-amount> CRO to <example-to>"
Example Response
The transfer of <example-amount> CRO to **<example-to>** was successful.
You can view the transaction details [here](<example-transaction-explorer-link>).
Query Arguments
state (dict): The current state of the workflow.
to (str): The recipient's blockchain address.
amount (float): The amount of native tokens to transfer.
Query Returns
str: A formatted string confirming the success of the token transfer.
Query: "Transfer <exmaple-amount> to <example-to> of contract <example-token>"
Example Response
The transfer of <exmaple-amount> to <example-to> of contract <example-token> was successful.
You can view the transaction details [here](<example-transaction-explorer-link>).
Query Arguments
state (dict): The current state of the workflow.
to (str): The recipient's blockchain address.
amount (float): The amount of tokens to transfer.
token_symbol_or_address (str): The ERC20 token symbol or contract address.
Query Returns
str: A formatted string confirming the success of the token transfer.
Query: "Swap <example-amount> <example-from-token> for <example-to-token>"
Example Response
The token swap of <example-amount> <example-from-token> for <example-to-token> was successful.
- Transaction Hash: [<example-transaction-hash>](<example-explorer-link>)
You can view the transaction details by clicking on the link.
Query Arguments
state: The current state of the workflow.
from_token_symbol_or_address (str): The symbol or contract address of the token to swap from.
to_token_symbol_or_address (str): The symbol or contract address of the token to swap to.
amount (float): The amount of tokens to swap.
Query Returns
str: A formatted string confirming the success of the token swap.