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. Crypto.com On-Chain Developer Platform

Developer Platform API Methods

API Methods of Developer Platform

Client Methods

  • Client.init(config): Initializes the client with an API key, blockchain network (Cronos EVM or ZK EVM), and an optional provider.

  • Client.getApiKey(): Returns the configured API key.

  • Client.getProvider(): Returns the configured provider URL (if available).

  • Client.getChainId(): Returns the chain ID based on the configured network.

Wallet Methods

  • Wallet.create(): Creates a new wallet and returns the address, private key, and mnemonic.

  • Wallet.balance(address): Fetches the native token balance for a specified address.

Token Methods

  • Token.getNativeTokenBalance(address): Fetches the native token balance of a wallet address.

  • Token.getERC20TokenBalance(address, contractAddress): Fetches the ERC20 token balance of a wallet for a specific contract.

  • Token.transfer(payload): Sends a token transfer transaction.

  • Token.wrap(payload): Sends a token wrapping transaction.

  • Token.swap(payload): Sends a token swapping transaction.

Transaction Methods

  • Transaction.getTransactionsByAddress(address): Fetches transactions associated with a wallet address.

  • Transaction.getTransactionByHash(txHash): Fetches transaction details by its hash.

  • Transaction.getTransactionStatus(txHash): Fetches the status of a transaction by its hash.

Contract Methods

  • Contract.getContractABI(contractAddress): Fetches the ABI of a smart contract using its contract address.

Block Methods

  • Block.getBlockByTag(blockTag): Fetches block data using a block tag (e.g., 'latest', 'earliest') or block number.

CronosId Methods

  • CronosId.forwardResolve(croAddress): Converts .cro addresses to EVM address

  • CronosId.reverseResolve(evmAddress): Converts EVM addresses to .cro addresses

Defi Methods

  • Defi.getWhitelistedTokens(defiProtocol): Obtains all whitelisted tokens from a supported defi protocol

  • Defi.getAllFarms(defiProtocol): Obtains all farms from a supported defi protocol

  • Defi.getFarmBySymbol(defiProtocol, symbol): Obtains a farm by farm symbol from a supported defi protocol

Exchange Methods

  • Exchange.getAllTickers(): Get all tickers from the Crypto.com exchange API

  • Exchange.getTickerByInstrument(ticker): Get instrument information by ticket, e.g `BTC_USD`

Block

  • get_by_tag(tag, tx_detail)

    • tx_detail: If true it returns the full transaction objects, if false only the hashes of the transactions.

Contract

  • get_contract_abi(contract_address)

    • contract_address: The address of the smart contract.

Token

  • get_native_balance(address)

    • address: The address to get the balance for.

  • get_erc20_balance(address, contract_address, block_height)

    • address: The address to get the balance for.

    • contract_address: The contract address to get the balance for.

    • block_height: The block height to get the balance for. Optional, default to "latest".

  • transfer_token(to, amount)

    • to: The address to transfer the token to.

    • amount: The amount of token to transfer.

  • wrap_token(from_contract_address, to_contract_address, to, amount)

    • from_contract_address: The address to wrap the token from.

    • to_contract_address: The address to wrap the token to.

    • to: The address to send the wrapped token to

    • amount: The amount of token to wrap.

  • swap_token(from_contract_address, to_contract_address, to, amount)

    • from_contract_address: The token to swap from.

    • to_contract_address: The token to swap to.

    • to: The address to send the swapped token to

    • amount: The amount of token to swap.

Transaction

  • get_transactions_by_address(address, session, limit)

    • address: The address to get the transactions for.

    • session: The session to get the transactions for. Optional, default to "".

    • limit: The limit of the transactions to get. Optional, default to "20".

  • get_transaction_by_hash(hash)

    • hash: The hash of the transaction.

  • get_transaction_status(hash)

    • hash: The hash of the transaction to get the status for.

Wallet

  • create_wallet()

  • get_balance(address)

    • address: The address to get the balance for.

CronosId Methods

  • CronosId.resolve_name(croAddress): Converts .cro addresses to EVM address

  • CronosId.lookup_address(evmAddress): Converts EVM addresses to .cro addresses

Defi Methods

  • Defi.get_whitelisted_tokens(defiProtocol): Obtains all whitelisted tokens from a supported defi protocol

  • Defi.get_all_farms(defiProtocol): Obtains all farms from a supported defi protocol

  • Defi.get_farm_by_symbol(defiProtocol, symbol): Obtains a farm by farm symbol from a supported defi protocol

Exchange Methods

  • Exchange.get_all_tickers(): Get all tickers from the Crypto.com exchange API

  • Exchange.get_ticker_by_instrument(ticker): Get instrument information by ticket, e.g `BTC_USD`

PreviousCrypto.com On-Chain Developer PlatformNextOn-Chain Functions and Examples

Last updated 2 months ago

Was this helpful?

tag: Integer of a block number in hex, or the string "earliest", "latest" or "pending", as in

https://ethereum.org/en/developers/docs/apis/json-rpc/#default-block