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

Was this helpful?

  1. Core Concepts Overview
  2. Blockchain Functions

Contract Operations

The AI Agent SDK simplifies smart contract interactions by allowing developers to fetch Contract ABI (Application Binary Interface) by providing a contract address. This feature enables seamless integration with smart contracts on Cronos Chains, making it easier to interact with deployed contracts and build powerful blockchain applications.

5.1 Get contract ABI

Retrieve the ABI for a specified smart contract using the Crypto.com developer platform.

  • Arguments

    contract_address (str): The address of the smart contract.
  • Example Query

    "Get contract ABI of <example-contract-address>"
  • Returns

    str: A formatted string containing the ABI of the smart contract.
  • Example Response

    The ABI for the contract at address <example-contract-address> is as follows:
    ```json
    <example-abi>
    ```
    This ABI includes the contract's constructor, events, and functions, providing the necessary information to interact with the contract on the blockchain.

Example Code

from crypto_com_agent_client import Agent

agent = Agent.init(
    llm_config={
        "provider": "OpenAI",
        "model": "gpt-4",
        "provider-api-key": "sk-proj-example-key",
        "temperature": "float-controlling-output-randomness",
    },
    blockchain_config={
         "chainId": "chain-id",
         "explorer-api-key": "your-api-key",
         "private-key": "your-private-key",
         "sso-wallet-url": "your-sso-wallet-url",
    },
)
response = agent.interact("Get contract ABI of <example-contract-address>")
print(response)
PreviousBlock InformationNextCronosID Operations

Last updated 1 day ago

Was this helpful?