Skip to content

Commit

Permalink
Merge pull request #2101 from pranjallyad/plugin
Browse files Browse the repository at this point in the history
feat: Lens Network Plugin
  • Loading branch information
wtfsayo authored Jan 10, 2025
2 parents 5d89ec3 + d4c9e81 commit c9d4411
Show file tree
Hide file tree
Showing 10 changed files with 514 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,10 @@ STARKNET_ADDRESS=
STARKNET_PRIVATE_KEY=
STARKNET_RPC_URL=

# Lens Network Configuration
LENS_ADDRESS=
LENS_PRIVATE_KEY=

# Coinbase
COINBASE_COMMERCE_KEY= # From Coinbase developer portal
COINBASE_API_KEY= # From Coinbase developer portal
Expand Down
1 change: 1 addition & 0 deletions agent/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
"@elizaos/plugin-gitbook": "workspace:*",
"@elizaos/plugin-story": "workspace:*",
"@elizaos/plugin-goat": "workspace:*",
"@elizaos/plugin-lensNetwork": "workspace:*",
"@elizaos/plugin-icp": "workspace:*",
"@elizaos/plugin-image-generation": "workspace:*",
"@elizaos/plugin-movement": "workspace:*",
Expand Down
5 changes: 5 additions & 0 deletions agent/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ import { flowPlugin } from "@elizaos/plugin-flow";
import { fuelPlugin } from "@elizaos/plugin-fuel";
import { genLayerPlugin } from "@elizaos/plugin-genlayer";
import { imageGenerationPlugin } from "@elizaos/plugin-image-generation";
import { lensPlugin } from "@elizaos/plugin-lensNetwork";
import { multiversxPlugin } from "@elizaos/plugin-multiversx";
import { nearPlugin } from "@elizaos/plugin-near";
import { nftGenerationPlugin } from "@elizaos/plugin-nft-generation";
Expand Down Expand Up @@ -717,6 +718,10 @@ export async function createAgent(
getSecret(character, "FLOW_PRIVATE_KEY")
? flowPlugin
: null,
getSecret(character, "LENS_ADDRESS") &&
getSecret(character, "LENS_PRIVATE_KEY")
? lensPlugin
: null,
getSecret(character, "APTOS_PRIVATE_KEY") ? aptosPlugin : null,
getSecret(character, "MVX_PRIVATE_KEY") ? multiversxPlugin : null,
getSecret(character, "ZKSYNC_PRIVATE_KEY") ? zksyncEraPlugin : null,
Expand Down
99 changes: 99 additions & 0 deletions packages/plugin-lensNetwork/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
# @elizaos/plugin-abstract

A plugin for interacting with the Abstract blockchain network within the ElizaOS ecosystem.

## Description
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.

## Installation

```bash
pnpm install @elizaos/plugin-lensNetwork
```

## Configuration

The plugin requires the following environment variables to be set:
```typescript
LENS_ADDRESS=<Your Lens wallet address>
LENS_PRIVATE_KEY=<Your Lens private key>
```

## Usage

### Basic Integration

```typescript
import { lensPlugin } from '@elizaos/plugin-lensNetwork';
```

### Transfer Examples

```typescript
// The plugin responds to natural language commands like:

"Send 1 Grass to 0xCCa8009f5e09F8C5dB63cb0031052F9CB635Af62"

```

## API Reference

### Actions

#### SEND_TOKEN

Transfers tokens from the agent's wallet to another address.

**Aliases:**
- TRANSFER_TOKEN_ON_LENS
- TRANSFER_TOKENS_ON_LENS
- SEND_TOKENS_ON_LENS
- SEND_ETH_ON_LENS
- PAY_ON_LENS
- MOVE_TOKENS_ON_LENS
- MOVE_ETH_ON_LENS

## Common Issues & Troubleshooting

1. **Transaction Failures**
- Verify wallet has sufficient balance
- Check recipient address format
- Ensure private key is correctly set
- Verify network connectivity

2. **Configuration Issues**
- Verify all required environment variables are set
- Ensure private key format is correct
- Check wallet address format

## Security Best Practices

1. **Private Key Management**
- Store private key securely using environment variables
- Never commit private keys to version control
- Use separate wallets for development and production
- Monitor wallet activity regularly

## Development Guide

### Setting Up Development Environment

1. Clone the repository
2. Install dependencies:

```bash
pnpm install
```

3. Build the plugin:

```bash
pnpm run build
```

4. Run the plugin:

```bash
pnpm run dev
```

37 changes: 37 additions & 0 deletions packages/plugin-lensNetwork/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"name": "@elizaos/plugin-lensNetwork",
"version": "0.1.7",
"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"
],
"dependencies": {
"@elizaos/core": "workspace:*",
"tsup": "^8.3.5",
"web3": "^4.15.0",
"@lens-network/sdk": "^0.0.0-canary-20241203140504",

"dotenv": "^16.0.3",
"ethers": "^6.0.0",
"zksync-ethers": "^6.0.0"
},
"scripts": {
"build": "tsup --format esm --dts"
},
"peerDependencies": {
"whatwg-url": "7.1.0"
}
}
Loading

0 comments on commit c9d4411

Please sign in to comment.