Crypto.com AI Agent SDK
  • Getting Started
    • Introduction
    • Quick Start Guide: Simulation Entry Point
  • Core Concepts Overview
    • Plugins
    • Tools
    • Blockchain Functions
      • Wallet Management
      • Token Interaction
      • Transaction Queries
      • Block Information
      • Contract Operations
      • CronosID Operations
      • Defi Operations
      • Crypto.com Exchange
    • Built-in Telegram Feature
    • Advanced Usage: Custom Instructions
    • Dynamic AI Model Manager
  • Crypto.com On-Chain Developer Platform
    • Developer Platform API Methods
  • On-Chain Functions and Examples
    • AI Agent Chatbot
    • "Magic Link" Signer
  • Resources for Developers
Powered by GitBook
On this page
  • Introduction
  • 1. Transfer native token
  • 2. Obtain on-chain balance
  • 3. Get Latest Block
  • 4. Get Transactions by Address
  • 5. Get Contract ABI
  • 6. Get Transaction by Hash
  • 7. Get Block by Number
  • 8. Get Transaction Status
  • 9. Wrapping zkCRO
  • 10. Swap Token

Was this helpful?

  1. Outdated Contents

Functions and Example Queries of AI agent services

Last updated 6 months ago

Was this helpful?

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"
    }
{
  "status": "Success",
  "action": "SendTransaction",
  "message": "Signature url created successfully. Please sign the transaction on this link",
  "data": {
    "magicLink": "https://{provider}/sign-transaction/{transactionId}?token={token}"
  }
}

This function returns a 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"]
    }
{
  "status": "Success",
  "action": "GetBalance",
  "message": "Balances: 0xAddress: 0.5 ETH",
  "data": {
    "balances": [
      {
        "address": "0xAddress",
        "balanceWei": "500000000000000000",
        "balanceEth": "0.5",
        "balanceVUsd": "1000"
      }
    ]
  }
}

3. Get Latest Block

Fetches the latest block information.

  • Example Query

query: "Get latest block height"

Function Name: GetLatestBlock

  • Function Argument:

    {}
{
  "status": "Success",
  "action": "GetLatestBlock",
  "message": "Latest block height: 123456",
  "data": {
    "blockHeight": 123456,
    "timestamp": "2023-09-24T14:22:00.000Z"
  }
}

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
    }
{
  "status": "Success",
  "action": "GetTransactionsByAddress",
  "message": "Retrieved 20 transactions for 0xAddress",
  "data": {
    "transactions": [...],
    "pagination": {...}
  }
}

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"
    }
{
  "status": "Success",
  "action": "GetContractABI",
  "message": "Fetched ABI for contract at 0xContractAddress",
  "data": { "abi": result }
}

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"
    }
{
  "status": "Success",
  "action": "GetTransactionByHash",
  "message": "Retrieved details for transaction 0xTransactionHash",
  "data": { ... }
}

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
    }
{
  "status": "Success",
  "action": "GetBlocksByNumber",
  "message": "Retrieved information for blocks",
  "data": { ... }
}

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"
    }
{
  "status": "Success",
  "action": "GetTransactionStatus",
  "message": "Transaction status: Success",
  "data": { ... }
}

9. Wrapping zkCRO

Wraps zkCRO tokens into wrapped tokens.

  • Example Query

query: "Wrap 100 zkCRO tokens"

Function Name: WrapToken

  • Function Argument:

    {
      "amount": 100
    }
{
  "status": "Success",
  "action": "WrapToken",
  "message": "Signature URL created successfully. Please sign the transaction on this link.",
  "data": {
    "magicLink": "http://{provider}/wrap-token/{transactionId}?token={token}"
  }
}

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
    }
{
  "status": "Success",
  "action": "SwapToken",
  "message": "Signature URL created successfully. Please sign the transaction on this link.",
  "data": {
    "magicLink": "http://{provider}/swap-token/{transactionId}?token={token}"
  }
}

Note: This function returns a magic link. .

Note: This function returns a magic link. .

Read more about Magic Link
Read more about Magic Link
Read more about Magic Link