Skip to content

Commit b9a1af6

Browse files
authored
Merge pull request #2912 from madschristensen99/main
feat(more-actions): Lit Protocol plugin
2 parents bfd954d + d215c78 commit b9a1af6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+30597
-31
lines changed

agent/package.json

+6-4
Original file line numberDiff line numberDiff line change
@@ -58,20 +58,22 @@
5858
"@elizaos/plugin-echochambers": "workspace:*",
5959
"@elizaos/plugin-evm": "workspace:*",
6060
"@elizaos/plugin-flow": "workspace:*",
61+
"@elizaos/plugin-gelato": "workspace:*",
6162
"@elizaos/plugin-giphy": "workspace:*",
6263
"@elizaos/plugin-gitbook": "workspace:*",
6364
"@elizaos/plugin-gitcoin-passport": "workspace:*",
6465
"@elizaos/plugin-goat": "workspace:*",
65-
"@elizaos/plugin-lens-network": "workspace:*",
6666
"@elizaos/plugin-icp": "workspace:*",
6767
"@elizaos/plugin-initia": "workspace:*",
6868
"@elizaos/plugin-image-generation": "workspace:*",
69+
"@elizaos/plugin-intiface": "workspace:*",
70+
"@elizaos/plugin-lens-network": "workspace:*",
71+
"@elizaos/plugin-letzai": "workspace:*",
6972
"@elizaos/plugin-lit": "workspace:*",
70-
"@elizaos/plugin-gelato": "workspace:*",
71-
"@elizaos/plugin-moralis": "workspace:*",
73+
"@elizaos/plugin-massa": "workspace:*",
7274
"@elizaos/plugin-mind-network": "workspace:*",
75+
"@elizaos/plugin-moralis": "workspace:*",
7376
"@elizaos/plugin-movement": "workspace:*",
74-
"@elizaos/plugin-massa": "workspace:*",
7577
"@elizaos/plugin-news": "workspace:*",
7678
"@elizaos/plugin-nft-generation": "workspace:*",
7779
"@elizaos/plugin-node": "workspace:*",

agent/src/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ import { gitcoinPassportPlugin } from "@elizaos/plugin-gitcoin-passport";
9292
import { initiaPlugin } from "@elizaos/plugin-initia";
9393
import { imageGenerationPlugin } from "@elizaos/plugin-image-generation";
9494
import { lensPlugin } from "@elizaos/plugin-lens-network";
95+
import { litPlugin } from "@elizaos/plugin-lit";
9596
import { mindNetworkPlugin } from "@elizaos/plugin-mind-network";
9697
import { multiversxPlugin } from "@elizaos/plugin-multiversx";
9798
import { nearPlugin } from "@elizaos/plugin-near";

package.json

-3
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,6 @@
5959
"cookie": "0.7.0",
6060
"bs58": "5.0.0",
6161
"@coral-xyz/anchor": "0.28.0"
62-
},
63-
"patchedDependencies": {
64-
"@solana-developers/helpers": "patches/@solana-developers__helpers.patch"
6562
}
6663
},
6764
"engines": {

packages/plugin-lit/README.md

+143
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
11
# @elizaos/plugin-lit
22

3+
A plugin that integrates Lit Protocol functionality into the elizaOS runtime environment, enabling secure and decentralized access control and cryptographic operations.
4+
5+
## Features
6+
7+
- Deploy and manage Lit Actions for programmable cryptography
8+
- Interact with Lit Agent Wallet for secure transaction signing
9+
- Built-in tools for common blockchain operations:
10+
- ECDSA signing
11+
- ERC20 token transfers
12+
- Uniswap interactions
13+
14+
## Installation
15+
316
A comprehensive blockchain interaction plugin for the Eliza Agent Stack, powered by Lit Protocol's Programmable Key Pairs (PKPs). This plugin enables autonomous agents to perform secure cross-chain transactions through decentralized key management and threshold cryptography.
417

518
## Overview
@@ -37,6 +50,136 @@ The Lit Protocol plugin provides:
3750
npm install @elizaos/plugin-lit
3851
```
3952

53+
## Setup
54+
55+
There are two ways to register the plugin:
56+
57+
1. Add to your agent's plugins in `agent/src/index.ts`:
58+
59+
```typescript
60+
import { LitPlugin } from '@elizaos/plugin-lit';
61+
62+
export default {
63+
plugins: [
64+
// ... other plugins
65+
litPlugin,
66+
],
67+
// ... rest of your agent configuration
68+
};
69+
```
70+
71+
2. Or add it in your character configuration:
72+
73+
```typescript
74+
{
75+
name: "YourCharacter",
76+
plugins: [
77+
// ... other plugins
78+
"@elizaos/plugin-lit"
79+
]
80+
}
81+
```
82+
83+
## Quick Start
84+
85+
1. After registration, initialize Lit Protocol:
86+
87+
```javascript
88+
await elizaOS.lit.initialize({
89+
// Your configuration options
90+
});
91+
```
92+
93+
## Core Components
94+
95+
### Lit Actions
96+
97+
Located in `src/actions/helloLit`, this module provides the foundation for deploying and managing Lit Actions. Lit Actions are JavaScript functions that run in a decentralized manner across the Lit Network.
98+
99+
Example usage:
100+
101+
```javascript
102+
const litAction = await elizaOS.lit.deployAction({
103+
code: `
104+
(async () => {
105+
// Your Lit Action code here
106+
})();
107+
`
108+
});
109+
```
110+
111+
### Tools
112+
113+
The `src/actions/helloLit/tools` directory contains pre-built tools for common blockchain operations:
114+
115+
#### ECDSA Signing
116+
```javascript
117+
const signature = await elizaOS.lit.tools.ecdsaSign({
118+
message: "Message to sign",
119+
// Additional parameters
120+
});
121+
```
122+
123+
#### ERC20 Token Transfer
124+
```javascript
125+
const transfer = await elizaOS.lit.tools.erc20Transfer({
126+
tokenAddress: "0x...",
127+
recipient: "0x...",
128+
amount: "1000000000000000000" // 1 token with 18 decimals
129+
});
130+
```
131+
132+
#### Uniswap Integration
133+
```javascript
134+
const swap = await elizaOS.lit.tools.uniswapSwap({
135+
tokenIn: "0x...",
136+
tokenOut: "0x...",
137+
amountIn: "1000000000000000000"
138+
});
139+
```
140+
141+
## Agent Wallet Integration
142+
143+
This plugin integrates with the [Lit Protocol Agent Wallet](https://github.com/LIT-Protocol/agent-wallet) for secure key management and transaction signing. The Agent Wallet provides:
144+
145+
- Secure key generation and storage
146+
- Transaction signing capabilities
147+
- Integration with Lit Actions for programmable authorization
148+
149+
## Documentation
150+
151+
For more detailed information about Lit Protocol and its capabilities, visit:
152+
- [Lit Protocol Documentation](https://developer.litprotocol.com/)
153+
- [Agent Wallet Documentation](https://github.com/LIT-Protocol/agent-wallet)
154+
155+
## Contributing
156+
157+
Contributions are welcome! Please feel free to submit a Pull Request.
158+
159+
## License
160+
161+
MIT License
162+
163+
Copyright (c) 2024 elizaOS
164+
165+
Permission is hereby granted, free of charge, to any person obtaining a copy
166+
of this software and associated documentation files (the "Software"), to deal
167+
in the Software without restriction, including without limitation the rights
168+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
169+
copies of the Software, and to permit persons to whom the Software is
170+
furnished to do so, subject to the following conditions:
171+
172+
The above copyright notice and this permission notice shall be included in all
173+
copies or substantial portions of the Software.
174+
175+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
176+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
177+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
178+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
179+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
180+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
181+
SOFTWARE.
182+
=======
40183
## Configuration
41184

42185
Required environment variables:

packages/plugin-lit/dist/index.d.ts

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { Action, Plugin } from '@elizaos/core';
2+
3+
declare const HELLO_LIT_ACTION: Action;
4+
5+
declare const WALLET_TRANSFER_LIT_ACTION: Action;
6+
7+
/**
8+
* Action for executing an ECDSA signing using the Lit Protocol.
9+
*/
10+
declare const ECDSA_SIGN_LIT_ACTION: Action;
11+
12+
/**
13+
* Action for executing a Uniswap swap using the Lit Protocol.
14+
*/
15+
declare const UNISWAP_SWAP_LIT_ACTION: Action;
16+
17+
declare const litPlugin: Plugin;
18+
19+
export { ECDSA_SIGN_LIT_ACTION, HELLO_LIT_ACTION, UNISWAP_SWAP_LIT_ACTION, WALLET_TRANSFER_LIT_ACTION, litPlugin as default, litPlugin };

0 commit comments

Comments
 (0)