Skip to content

Commit ef9819f

Browse files
committed
Merge branch 'develop' into ELIZAAI-16-unit-tests
2 parents 6e71dfb + 101c445 commit ef9819f

File tree

3 files changed

+163
-70
lines changed

3 files changed

+163
-70
lines changed

agent/package.json

+60-60
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,62 @@
11
{
2-
"name": "@ai16z/agent",
3-
"version": "0.1.6-alpha.4",
4-
"main": "src/index.ts",
5-
"type": "module",
6-
"scripts": {
7-
"start": "node --loader ts-node/esm src/index.ts",
8-
"dev": "node --loader ts-node/esm src/index.ts",
9-
"check-types": "tsc --noEmit"
10-
},
11-
"nodemonConfig": {
12-
"watch": [
13-
"src",
14-
"../core/dist"
15-
],
16-
"ext": "ts,json",
17-
"exec": "node --enable-source-maps --loader ts-node/esm src/index.ts"
18-
},
19-
"dependencies": {
20-
"@ai16z/adapter-postgres": "workspace:*",
21-
"@ai16z/adapter-sqlite": "workspace:*",
22-
"@ai16z/client-auto": "workspace:*",
23-
"@ai16z/client-direct": "workspace:*",
24-
"@ai16z/client-discord": "workspace:*",
25-
"@ai16z/client-farcaster": "workspace:*",
26-
"@ai16z/client-lens": "workspace:*",
27-
"@ai16z/client-telegram": "workspace:*",
28-
"@ai16z/client-twitter": "workspace:*",
29-
"@ai16z/client-slack": "workspace:*",
30-
"@ai16z/eliza": "workspace:*",
31-
"@ai16z/plugin-0g": "workspace:*",
32-
"@ai16z/plugin-aptos": "workspace:*",
33-
"@ai16z/plugin-bootstrap": "workspace:*",
34-
"@ai16z/plugin-intiface": "workspace:*",
35-
"@ai16z/plugin-coinbase": "workspace:*",
36-
"@ai16z/plugin-conflux": "workspace:*",
37-
"@ai16z/plugin-evm": "workspace:*",
38-
"@ai16z/plugin-cosmos": "workspace:*",
39-
"@ai16z/plugin-flow": "workspace:*",
40-
"@ai16z/plugin-story": "workspace:*",
41-
"@ai16z/plugin-goat": "workspace:*",
42-
"@ai16z/plugin-icp": "workspace:*",
43-
"@ai16z/plugin-image-generation": "workspace:*",
44-
"@ai16z/plugin-nft-generation": "workspace:*",
45-
"@ai16z/plugin-node": "workspace:*",
46-
"@ai16z/plugin-solana": "workspace:*",
47-
"@ai16z/plugin-starknet": "workspace:*",
48-
"@ai16z/plugin-ton": "workspace:*",
49-
"@ai16z/plugin-sui": "workspace:*",
50-
"@ai16z/plugin-tee": "workspace:*",
51-
"@ai16z/plugin-multiversx": "workspace:*",
52-
"@ai16z/plugin-near": "workspace:*",
53-
"@ai16z/plugin-zksync-era": "workspace:*",
54-
"readline": "1.3.0",
55-
"ws": "8.18.0",
56-
"yargs": "17.7.2"
57-
},
58-
"devDependencies": {
59-
"ts-node": "10.9.2",
60-
"tsup": "8.3.5"
61-
}
2+
"name": "@ai16z/agent",
3+
"version": "0.1.6-alpha.4",
4+
"main": "src/index.ts",
5+
"type": "module",
6+
"scripts": {
7+
"start": "node --loader ts-node/esm src/index.ts",
8+
"dev": "node --loader ts-node/esm src/index.ts",
9+
"check-types": "tsc --noEmit"
10+
},
11+
"nodemonConfig": {
12+
"watch": [
13+
"src",
14+
"../core/dist"
15+
],
16+
"ext": "ts,json",
17+
"exec": "node --enable-source-maps --loader ts-node/esm src/index.ts"
18+
},
19+
"dependencies": {
20+
"@ai16z/adapter-postgres": "workspace:*",
21+
"@ai16z/adapter-sqlite": "workspace:*",
22+
"@ai16z/client-auto": "workspace:*",
23+
"@ai16z/client-direct": "workspace:*",
24+
"@ai16z/client-discord": "workspace:*",
25+
"@ai16z/client-farcaster": "workspace:*",
26+
"@ai16z/client-lens": "workspace:*",
27+
"@ai16z/client-telegram": "workspace:*",
28+
"@ai16z/client-twitter": "workspace:*",
29+
"@ai16z/client-slack": "workspace:*",
30+
"@ai16z/eliza": "workspace:*",
31+
"@ai16z/plugin-0g": "workspace:*",
32+
"@ai16z/plugin-aptos": "workspace:*",
33+
"@ai16z/plugin-bootstrap": "workspace:*",
34+
"@ai16z/plugin-intiface": "workspace:*",
35+
"@ai16z/plugin-coinbase": "workspace:*",
36+
"@ai16z/plugin-conflux": "workspace:*",
37+
"@ai16z/plugin-cosmos": "workspace:*",
38+
"@ai16z/plugin-evm": "workspace:*",
39+
"@ai16z/plugin-flow": "workspace:*",
40+
"@ai16z/plugin-story": "workspace:*",
41+
"@ai16z/plugin-goat": "workspace:*",
42+
"@ai16z/plugin-icp": "workspace:*",
43+
"@ai16z/plugin-image-generation": "workspace:*",
44+
"@ai16z/plugin-nft-generation": "workspace:*",
45+
"@ai16z/plugin-node": "workspace:*",
46+
"@ai16z/plugin-solana": "workspace:*",
47+
"@ai16z/plugin-starknet": "workspace:*",
48+
"@ai16z/plugin-ton": "workspace:*",
49+
"@ai16z/plugin-sui": "workspace:*",
50+
"@ai16z/plugin-tee": "workspace:*",
51+
"@ai16z/plugin-multiversx": "workspace:*",
52+
"@ai16z/plugin-near": "workspace:*",
53+
"@ai16z/plugin-zksync-era": "workspace:*",
54+
"readline": "1.3.0",
55+
"ws": "8.18.0",
56+
"yargs": "17.7.2"
57+
},
58+
"devDependencies": {
59+
"ts-node": "10.9.2",
60+
"tsup": "8.3.5"
61+
}
6262
}

agent/src/index.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ export function getTokenForProvider(
215215
switch (provider) {
216216
// no key needed for llama_local
217217
case ModelProviderName.LLAMALOCAL:
218-
return ''
218+
return "";
219219
case ModelProviderName.OPENAI:
220220
return (
221221
character.settings?.secrets?.OPENAI_API_KEY ||
@@ -311,9 +311,9 @@ export function getTokenForProvider(
311311
settings.AKASH_CHAT_API_KEY
312312
);
313313
default:
314-
const errorMessage = `Failed to get token - unsupported model provider: ${provider}`
315-
elizaLogger.error(errorMessage)
316-
throw new Error(errorMessage)
314+
const errorMessage = `Failed to get token - unsupported model provider: ${provider}`;
315+
elizaLogger.error(errorMessage);
316+
throw new Error(errorMessage);
317317
}
318318
}
319319

packages/plugin-cosmos/README.md

+99-6
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,118 @@
11
# `@ai16z/plugin-cosmos`
22

3-
This plugin provides actions and providers for interacting with Cosmos compatible chains.
3+
This plugin provides actions and utilities for interacting with Cosmos-compatible blockchains.
44

55
---
66

7+
## Development
8+
9+
Prepare Eliza according to [README](../../README.md)
10+
Add variables required for `@ai16z/plugin-cosmos` :
11+
```
12+
COSMOS_RECOVERY_PHRASE=your recovery phrase words
13+
COSMOS_AVAILABLE_CHAINS=chain1,chain2,chain3
14+
```
15+
16+
Ensure the appropriate environment variables are added for the plugin. If they are correctly configured, the project will run with `@ai16z/plugin-cosmos`
17+
18+
Run Eliza
19+
```
20+
pnpm run dev
21+
```
22+
723
## Configuration
824

925
### Default Setup
1026

11-
### Adding Support for Other Chains
27+
To start using the plugin, you need to provide your **Cosmos account recovery phrases** and the list of **available chains**. Add the following to your `.env` file:
28+
29+
30+
```env
31+
COSMOS_RECOVERY_PHRASE=your recovery phrase words
32+
COSMOS_AVAILABLE_CHAINS=chain1,chain2,chain3
33+
```
34+
Ensure that the chain names in `COSMOS_AVAILABLE_CHAINS` match the identifiers from the [chain-registry](https://github.com/cosmos/chain-registry) library for compatibility.
35+
36+
37+
### Using the Cosmos Helper Character
38+
39+
The plugin includes a pre-configured character, `cosmosHelper.character.json`, optimized for Cosmos-related operations. This character enhances interaction by:
40+
41+
- Handling repeated prompts effectively.
1242

13-
## Provider
43+
- Requesting confirmation before executing detected actions.
44+
45+
To use the character, pass it with the `--characters` flag:
46+
47+
```bash
48+
--characters='../characters/cosmosHelper.character.json'
49+
```
50+
51+
---
52+
53+
### Custom chain configuration
54+
Plugin allows you to pass you custom chain config to `createCosmosPlugin` function invoked in `../agent/src/index`.
55+
56+
Your custom configuration fulfills the interfaces from `chain-registry`
57+
```
58+
import type { assets, chains } from "chain-registry";
59+
60+
export interface ICosmosPluginCustomChainData {
61+
chainData: (typeof chains)[number];
62+
assets: (typeof assets)[number];
63+
}
64+
65+
export interface ICosmosPluginOptions {
66+
customChainData?: ICosmosPluginCustomChainData[];
67+
}
68+
```
1469

1570
## Actions
1671

17-
### Transfer
72+
### Token Transfer
73+
74+
This plugin supports a token transfer action, which allows users to transfer tokens between addresses on Cosmos-compatible blockchains. The action prompts for confirmation to ensure secure execution.
75+
76+
#### Example Prompts
77+
78+
Below are examples of how the transfer action can be initiated and confirmed:
79+
80+
**Example**
81+
82+
1. User input:
83+
84+
```
85+
Make transfer 0.0001 ATOM to cosmos1nk3uuw6zt5t5aqw5fvujkd54sa4uws9xv465ad on cosmoshubtestnet.
86+
```
87+
88+
2. Plugin response:
89+
90+
```
91+
Do you confirm the transfer action?
92+
```
93+
94+
3. User confirmation:
95+
96+
```
97+
Yes
98+
```
99+
100+
4. Action executed.
101+
102+
---
103+
104+
## Contribution
105+
106+
The plugin includes comprehensive tests. Before submitting any pull requests, ensure all tests pass.
18107

19108
### Running Tests
20109

21-
Navigate to the `plugin-cosmos` directory and run:
110+
Navigate to the `plugin-cosmos` directory and execute:
22111

23112
```bash
24-
pnpm test
113+
pnpm test
25114
```
115+
116+
---
117+
118+
This plugin simplifies Cosmos blockchain interactions and enhances productivity with its tailored features. Happy building!

0 commit comments

Comments
 (0)