This plugin enables Eliza to interact with the 0x Protocol, providing decentralized exchange capabilities across multiple evm blockchain networks with optimized token swaps and liquidity aggregation.
Supported networks include: - Ethereum Mainnet - Polygon - Binance Smart Chain - Arbitrum - Optimism - Base - Linea - Scroll - Avalanche - Blast
Set the following environment variables:
WALLET_PRIVATE_KEY=your_private_key
ZERO_EX_API_KEY=your_0x_api_key
{chain}_RPC_URL=your_rpc_endpointpnpm install @elizaos/plugin-0ximport { zeroExPlugin } from "@elizaos/plugin-0x";The plugin supports natural language commands for ETH transfers:
"I want to convert 1 ETH to USDC on ethereum chain";
"Give me the quote";
"Execute it";The plugin provides the following actions:
-
GET_INDICATIVE_PRICE_0X: Get indicative prices for token swaps
- Example: "Get quote for swapping 1 ETH to USDC on Ethereum chain"
- Example: "Price check for trading 100 USDT to MATIC on Polygon chain"
-
GET_QUOTE_0X: Get the quote for the swap. Quote expires in 5mins. (This action is triggered only after user has requested for an indicative price. No need to repeat the buy/sell tokens because the last indicative price will be stored in the memory)
- Example: "Get quote"
-
EXECUTE_SWAP_0X: Execute token swaps. (Action is triggered only after user has gotten a quote)
- Example: "Execute the swap"
- Environment Variables
- Never commit private keys to version control
- Use secure environment variable management
- Rotate private keys periodically
Contributions are welcome! Please see the CONTRIBUTING.md file for more information.
This plugin integrates with:
For more information about 0x capabilities:
This plugin is part of the Eliza project. See the main project repository for license information.