Skip to content

Commit c9d4411

Browse files
authored
Merge pull request #2101 from pranjallyad/plugin
feat: Lens Network Plugin
2 parents 5d89ec3 + d4c9e81 commit c9d4411

File tree

10 files changed

+514
-0
lines changed

10 files changed

+514
-0
lines changed

.env.example

+4
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,10 @@ STARKNET_ADDRESS=
306306
STARKNET_PRIVATE_KEY=
307307
STARKNET_RPC_URL=
308308

309+
# Lens Network Configuration
310+
LENS_ADDRESS=
311+
LENS_PRIVATE_KEY=
312+
309313
# Coinbase
310314
COINBASE_COMMERCE_KEY= # From Coinbase developer portal
311315
COINBASE_API_KEY= # From Coinbase developer portal

agent/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
"@elizaos/plugin-gitbook": "workspace:*",
5151
"@elizaos/plugin-story": "workspace:*",
5252
"@elizaos/plugin-goat": "workspace:*",
53+
"@elizaos/plugin-lensNetwork": "workspace:*",
5354
"@elizaos/plugin-icp": "workspace:*",
5455
"@elizaos/plugin-image-generation": "workspace:*",
5556
"@elizaos/plugin-movement": "workspace:*",

agent/src/index.ts

+5
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ import { flowPlugin } from "@elizaos/plugin-flow";
6363
import { fuelPlugin } from "@elizaos/plugin-fuel";
6464
import { genLayerPlugin } from "@elizaos/plugin-genlayer";
6565
import { imageGenerationPlugin } from "@elizaos/plugin-image-generation";
66+
import { lensPlugin } from "@elizaos/plugin-lensNetwork";
6667
import { multiversxPlugin } from "@elizaos/plugin-multiversx";
6768
import { nearPlugin } from "@elizaos/plugin-near";
6869
import { nftGenerationPlugin } from "@elizaos/plugin-nft-generation";
@@ -717,6 +718,10 @@ export async function createAgent(
717718
getSecret(character, "FLOW_PRIVATE_KEY")
718719
? flowPlugin
719720
: null,
721+
getSecret(character, "LENS_ADDRESS") &&
722+
getSecret(character, "LENS_PRIVATE_KEY")
723+
? lensPlugin
724+
: null,
720725
getSecret(character, "APTOS_PRIVATE_KEY") ? aptosPlugin : null,
721726
getSecret(character, "MVX_PRIVATE_KEY") ? multiversxPlugin : null,
722727
getSecret(character, "ZKSYNC_PRIVATE_KEY") ? zksyncEraPlugin : null,

packages/plugin-lensNetwork/README.md

+99
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
# @elizaos/plugin-abstract
2+
3+
A plugin for interacting with the Abstract blockchain network within the ElizaOS ecosystem.
4+
5+
## Description
6+
The Abstract plugin enables seamless token transfers on the Abstract testnet. It provides functionality to transfer both native ETH and ERC20 tokens using secure wallet operations.
7+
8+
## Installation
9+
10+
```bash
11+
pnpm install @elizaos/plugin-lensNetwork
12+
```
13+
14+
## Configuration
15+
16+
The plugin requires the following environment variables to be set:
17+
```typescript
18+
LENS_ADDRESS=<Your Lens wallet address>
19+
LENS_PRIVATE_KEY=<Your Lens private key>
20+
```
21+
22+
## Usage
23+
24+
### Basic Integration
25+
26+
```typescript
27+
import { lensPlugin } from '@elizaos/plugin-lensNetwork';
28+
```
29+
30+
### Transfer Examples
31+
32+
```typescript
33+
// The plugin responds to natural language commands like:
34+
35+
"Send 1 Grass to 0xCCa8009f5e09F8C5dB63cb0031052F9CB635Af62"
36+
37+
```
38+
39+
## API Reference
40+
41+
### Actions
42+
43+
#### SEND_TOKEN
44+
45+
Transfers tokens from the agent's wallet to another address.
46+
47+
**Aliases:**
48+
- TRANSFER_TOKEN_ON_LENS
49+
- TRANSFER_TOKENS_ON_LENS
50+
- SEND_TOKENS_ON_LENS
51+
- SEND_ETH_ON_LENS
52+
- PAY_ON_LENS
53+
- MOVE_TOKENS_ON_LENS
54+
- MOVE_ETH_ON_LENS
55+
56+
## Common Issues & Troubleshooting
57+
58+
1. **Transaction Failures**
59+
- Verify wallet has sufficient balance
60+
- Check recipient address format
61+
- Ensure private key is correctly set
62+
- Verify network connectivity
63+
64+
2. **Configuration Issues**
65+
- Verify all required environment variables are set
66+
- Ensure private key format is correct
67+
- Check wallet address format
68+
69+
## Security Best Practices
70+
71+
1. **Private Key Management**
72+
- Store private key securely using environment variables
73+
- Never commit private keys to version control
74+
- Use separate wallets for development and production
75+
- Monitor wallet activity regularly
76+
77+
## Development Guide
78+
79+
### Setting Up Development Environment
80+
81+
1. Clone the repository
82+
2. Install dependencies:
83+
84+
```bash
85+
pnpm install
86+
```
87+
88+
3. Build the plugin:
89+
90+
```bash
91+
pnpm run build
92+
```
93+
94+
4. Run the plugin:
95+
96+
```bash
97+
pnpm run dev
98+
```
99+
+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{
2+
"name": "@elizaos/plugin-lensNetwork",
3+
"version": "0.1.7",
4+
"type": "module",
5+
"main": "dist/index.js",
6+
"module": "dist/index.js",
7+
"types": "dist/index.d.ts",
8+
"exports": {
9+
"./package.json": "./package.json",
10+
".": {
11+
"import": {
12+
"@elizaos/source": "./src/index.ts",
13+
"types": "./dist/index.d.ts",
14+
"default": "./dist/index.js"
15+
}
16+
}
17+
},
18+
"files": [
19+
"dist"
20+
],
21+
"dependencies": {
22+
"@elizaos/core": "workspace:*",
23+
"tsup": "^8.3.5",
24+
"web3": "^4.15.0",
25+
"@lens-network/sdk": "^0.0.0-canary-20241203140504",
26+
27+
"dotenv": "^16.0.3",
28+
"ethers": "^6.0.0",
29+
"zksync-ethers": "^6.0.0"
30+
},
31+
"scripts": {
32+
"build": "tsup --format esm --dts"
33+
},
34+
"peerDependencies": {
35+
"whatwg-url": "7.1.0"
36+
}
37+
}

0 commit comments

Comments
 (0)