-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* draft commit * remove useless file * update readme * Update packages/plugin-0x/src/EVMtokenRegistry.ts Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Update packages/plugin-0x/src/EVMtokenRegistry.ts Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Update packages/plugin-0x/src/actions/swap.ts Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Update packages/plugin-0x/src/actions/getIndicativePrice.ts Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Update packages/plugin-0x/src/actions/getQuote.ts Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Update packages/plugin-0x/src/hooks.ts/useGetWalletClient.ts Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * refactor according to codeRabbit * fix syntax error, remove mode=json from Anthropic * remove unnecessary logging * remove changes to mode=json for generation * remove ai from packagejson, its in core/package.json already * resolve pnpm-lock * Update pnpm-lock.yaml --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: Sayo <[email protected]>
- Loading branch information
1 parent
cac3912
commit d51ab66
Showing
18 changed files
with
2,024 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
# @elizaos/plugin-0x | ||
|
||
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 | ||
|
||
## Configuration | ||
|
||
Set the following environment variables: | ||
|
||
```env | ||
WALLET_PRIVATE_KEY=your_private_key | ||
ZERO_EX_API_KEY=your_0x_api_key | ||
{chain}_RPC_URL=your_rpc_endpoint | ||
``` | ||
|
||
## Installation | ||
|
||
```bash | ||
pnpm install @elizaos/plugin-0x | ||
``` | ||
|
||
## Usage | ||
|
||
### Basic Integration | ||
|
||
```typescript | ||
import { zeroExPlugin } from "@elizaos/plugin-0x"; | ||
``` | ||
|
||
### Example Usage | ||
|
||
The plugin supports natural language commands for ETH transfers: | ||
|
||
```typescript | ||
"I want to convert 1 ETH to USDC on ethereum chain"; | ||
"Give me the quote"; | ||
"Execute it"; | ||
``` | ||
|
||
## Available Actions | ||
|
||
The plugin provides the following actions: | ||
|
||
1. **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" | ||
|
||
2. **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" | ||
|
||
3. **EXECUTE_SWAP_0X**: Execute token swaps. (Action is triggered only after user has gotten a quote) | ||
- Example: "Execute the swap" | ||
|
||
## Security Best Practices | ||
|
||
1. **Environment Variables** | ||
- Never commit private keys to version control | ||
- Use secure environment variable management | ||
- Rotate private keys periodically | ||
|
||
## Contributing | ||
|
||
Contributions are welcome! Please see the [CONTRIBUTING.md](CONTRIBUTING.md) file for more information. | ||
|
||
## Credits | ||
|
||
This plugin integrates with: | ||
- [0x Protocol](https://0x.org/) | ||
|
||
For more information about 0x capabilities: | ||
- [0x API Documentation](https://0x.org/docs/api) | ||
|
||
## License | ||
|
||
This plugin is part of the Eliza project. See the main project repository for license information. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
{ | ||
"name": "@elizaos/plugin-0x", | ||
"version": "0.1.8", | ||
"type": "module", | ||
"main": "dist/index.js", | ||
"module": "dist/index.js", | ||
"types": "dist/index.d.ts", | ||
"exports": { | ||
"./package.json": "./package.json", | ||
".": { | ||
"import": { | ||
"@elizaos/source": "./src/index.ts", | ||
"types": "./dist/index.d.ts", | ||
"default": "./dist/index.js" | ||
} | ||
} | ||
}, | ||
"files": [ | ||
"dist" | ||
], | ||
"scripts": { | ||
"build": "tsup --format esm --dts", | ||
"dev": "tsup --format esm --dts --watch", | ||
"test": "vitest" | ||
}, | ||
"dependencies": { | ||
"@0x/swap-ts-sdk": "2.1.1" | ||
}, | ||
"devDependencies": { | ||
"tsup": "^8.0.1" | ||
}, | ||
"peerDependencies": { | ||
"@elizaos/core": "workspace:*", | ||
"zod": "^3.22.4" | ||
} | ||
} |
Oops, something went wrong.