Block Information
The AI Agent SDK provides robust block operation capabilities, allowing developers to fetch blocks by tag (e.g., latest, pending) or by specific block number on Cronos Chains.
This feature makes it easy to retrieve detailed block information, enabling seamless integration of real-time blockchain data into your AI-powered applications.
4.1 Get block by tag
Retrieve block data for a specified tag using the Crypto.com developer platform.
Arguments
tag (str): Integer of a block number in hex, or the string "earliest", "latest" or "pending". tx_detail (str, optional): If "true", returns full transaction objects; if "false", only transaction hashes.
Example Query
"Get <example-tag> block with detail"
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 lastest block with detail")
print(response)
Last updated
Was this helpful?