Defi Operations
The AI Agent SDK provides powerful DeFi-related features, enabling seamless access to essential data from the Crypto.com ecosystem. It allows developers to retrieve a list of whitelisted tokens for a specified DeFi protocol, fetch information about all available farms, and obtain detailed information about a specific farm identified by its symbol.
To learn more about the underlying Developer Platform functionalities, please visit Developer Platform Client SDK Defi Module.
6.1 Get whitelisted tokens
Retrieve a list of whitelisted tokens for the specified DeFi protocol from the Crypto.com developer platform.
Arguments
protocol (str): The DeFi protocol name (e.g., "H2", "VVS").Example Query
"Get whitelisted tokens of protocol <example-protocol>"
Returns
str: A formatted string containing the list of whitelisted tokens.Example Response
Here are the whitelisted tokens for the <example-protocol> protocol: <example-token-name> - Address: [<example-address>](<example-explore-link>) - Decimal: <example-decimal> - Swappable: <example-boolean> -  <example-token-name> ... Feel free to ask if you need more information about any specific token!
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={
"api-key": "your-crypto.com-developer-platform-api-key",
"private-key": "your-private-key",
"sso-wallet-url": "your-sso-wallet-url",
"timeout": "timeout-in-seconds-for-API-calls-default-20s")
},
)
response = agent.interact("Get whitelisted tokens of protocol <example-protocol>")
print(response)6.2 Get all farms
Retrieve information about all available farms for the specified DeFi protocol from the Crypto.com developer platform.
Arguments
Example Query
Returns
Example Response
Example Code
6.3 Get farm by symbol
Retrieve detailed information about a specific farm identified by its symbol for the specified DeFi protocol.
Arguments
Example Query
Returns
Example Response
Example Code
Last updated
Was this helpful?