|
2 | 2 |
|
3 | 3 | A plugin for handling Polkadot blockchain operations, providing wallet management and price fetching capabilities. |
4 | 4 |
|
5 | | -### Usage |
6 | | ---- |
7 | | -Add the plugin to your character configuration: |
8 | | - |
9 | | -``` |
10 | | -"plugins": ["@elizaos-plugins/plugin-polkadot"] |
11 | | -``` |
12 | | -## Configuration |
13 | | -The plugin requires these environment variables (can be set in .env file or character settings): |
| 5 | +## Step by Step Usage |
| 6 | + |
| 7 | +**Option 1** - Dynamically Loading from Github repo: |
| 8 | +1. Follow the ElizaOS quickstart instructions here: https://eliza.how/docs/quickstart |
| 9 | +2. Add the following dependancy in your newly created agent's package.json: `"@esscrypt/plugin-polkadot": "github:Esscrypt/plugin-polkadot"` |
| 10 | +3. Add the following line to the end of the plugins array in src/character.ts: `'@esscrypt/plugin-polkadot'` |
| 11 | +4. Run: `bun install` |
| 12 | +5. Start Agent: `bun run dev` |
| 13 | +6. (Optional) Set root .env with **POLKADOT_PRIVATE_KEY** and **POLKADOT_RPC_URL** |
| 14 | +> Note: When starting the Agent, if **POLKADOT_PRIVATE_KEY** is not set, an error will pop up, but the agent will still run and expect a wallet to get created by the user |
| 15 | +
|
| 16 | +**Option 2** - Submodule |
| 17 | +1. Clone the ElizaOS monorepo: https://github.com/elizaOS/eliza |
| 18 | +2. Inside packages, clone the polkadot-plugin repo: https://github.com/Esscrypt/plugin-polkadot |
| 19 | +3. Configuration. Ether: |
| 20 | +- Inside `packages/plugin-polkadot/characters/polkadot.character.json`, Fill up the secrets: |
14 | 21 | ```env |
15 | 22 | "settings": { |
16 | | - "POLKADOT_RPC_URL": "rpc-url", |
17 | | - "COINMARKETCAP_API_KEY": "<api-key>", |
18 | | - "POLKADOT_PRIVATE_KEY": "<private_key>" |
| 23 | + "secrets": { |
| 24 | + "POLKADOT_RPC_URL": "<your-rpc-url>", |
| 25 | + "POLKADOT_PRIVATE_KEY": "<your-private-key>", |
| 26 | + "COINMARKETCAP_API_KEY": "<api-key>", |
| 27 | + "OPENAI_API_KEY": "<your-openai-api-key>" |
| 28 | + |
| 29 | + } |
19 | 30 | } |
20 | 31 | ``` |
21 | | -Or in .env file: |
| 32 | +- Or in .env file: |
22 | 33 |
|
23 | 34 | ```env |
24 | 35 | POLKADOT_RPC_URL=your_polkadot_rpc_endpoint # Optional - defaults to wss://rpc.polkadot.io |
25 | 36 | COINMARKETCAP_API_KEY=your_cmc_api_key # Optional - for fetching token prices |
26 | 37 | POLKADOT_PRIVATE_KEY=your_mnemonic_phrase # Optional - for default wallet initialization via initWalletProvider |
| 38 | +OPENAI_API_KEY=your-openai-api-key> # Optional - for inference through the OpenAI LLM. You can use a different one |
27 | 39 | ``` |
| 40 | +4. In the root folder (monorepo), run: |
| 41 | +`bun i && bun run build` |
| 42 | +5. Eliza now supports a CLI that can be run through: |
| 43 | +``` |
| 44 | +bun install -g @elizaos/cli |
| 45 | +elizaos start --character "packages/plugin-polkadot/characters/polkadot.character.json" |
| 46 | +# Alternatively using bun: |
| 47 | +bun run start:debug --character "packages/plugin-polkadot/characters/polkadot.character.json" |
| 48 | +``` |
| 49 | + |
| 50 | +#### Go to [http://localhost:3000/](http://localhost:3000/) and interact with the agent. If started, click the "Polkadot" character and then "Start agent" then interact. |
28 | 51 |
|
29 | 52 | ## Overview |
30 | 53 |
|
|
0 commit comments