Functions and Example Queries of AI agent services

Introduction

This page provides detailed information on various on-chain functions and example queries available through the Crypto.com AI Agent SDK. Each function is accompanied by a sample query and explanation of the response format, offering developers guidance on how to interact with Cronos Chains using the AI agent services.

1. Transfer native token

Sends a transaction from one address to another.

  • Example Query

query: "Send 1 ZKCRO to 0xRecipientAddress"

Function Name: SendTransaction

  • Function Argument:

    {
      "to": "0xRecipientAddress",
      "amount": 1,
      "symbol": "ZKCRO"
    }

This function returns a magic link. Read more about Magic Link.

2. Obtain on-chain balance

Fetches the balance of multiple wallet addresses.

  • Example Query

query: "Get balance for 0xWalletAddress1 and 0xWalletAddress2"

Function Name: GetBalance

  • Function Argument:

    {
      "walletAddresses": ["0xWalletAddress1", "0xWalletAddress2"]
    }

3. Get Latest Block

Fetches the latest block information.

  • Example Query

query: "Get latest block height"

Function Name: GetLatestBlock

  • Function Argument:

    {}

4. Get Transactions by Address

Fetches transactions for a specific address.

  • Example Query

query: "Show transactions for 0xYourAddress"

Function Name: GetTransactionsByAddress

  • Function Argument:

    {
      "address": "0xYourAddress",
      "session": "ExplorerPageSession", // TODO: automatically adjust page based on user instruction
      "limit": 20
    }

5. Get Contract ABI

Fetches the ABI (Application Binary Interface) of a contract.

  • Example Query

query: "Fetch the ABI for contract at 0xContractAddress"

Function Name: GetContractABI

  • Function Argument:

    {
      "address": "0xContractAddress"
    }

6. Get Transaction by Hash

Fetches the details of a transaction using its hash.

  • Example Query

query: "Get transaction details for 0xTransactionHash"

Function Name: GetTransactionByHash

  • Function Argument:

    {
      "txHash": "0xTransactionHash"
    }

7. Get Block by Number

Fetches the details of a block using its block number.

  • Example Query

query: "Fetch details of the latest block"

Function Name: GetBlocksByNumber

  • Function Argument:

    {
      "blockNumbers": ["latest"],
      "txDetail": false
    }

8. Get Transaction Status

Fetches the status of a transaction using its hash.

  • Example Query

query: "What is the status of transaction 0xTransactionHash?"

Function Name: GetTransactionStatus

  • Function Argument:

    {
      "txHash": "0xTransactionHash"
    }

9. Wrapping zkCRO

Wraps zkCRO tokens into wrapped tokens.

  • Example Query

query: "Wrap 100 zkCRO tokens"

Function Name: WrapToken

  • Function Argument:

    {
      "amount": 100
    }

Note: This function returns a magic link. Read more about Magic Link.

10. Swap Token

Swaps one token into another (e.g., zkCRO to VUSD).

  • Example Query

query: "Swap 100 zkCRO tokens to VUSD"

Function Name: SwapToken

  • Function Argument:

    {
      "amount": 100
    }

Note: This function returns a magic link. Read more about Magic Link.

Last updated