Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(more-actions): Lit Protocol plugin #2912

Merged
merged 16 commits into from
Jan 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions agent/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,20 +58,22 @@
"@elizaos/plugin-echochambers": "workspace:*",
"@elizaos/plugin-evm": "workspace:*",
"@elizaos/plugin-flow": "workspace:*",
"@elizaos/plugin-gelato": "workspace:*",
"@elizaos/plugin-giphy": "workspace:*",
"@elizaos/plugin-gitbook": "workspace:*",
"@elizaos/plugin-gitcoin-passport": "workspace:*",
"@elizaos/plugin-goat": "workspace:*",
"@elizaos/plugin-lens-network": "workspace:*",
"@elizaos/plugin-icp": "workspace:*",
"@elizaos/plugin-initia": "workspace:*",
"@elizaos/plugin-image-generation": "workspace:*",
"@elizaos/plugin-intiface": "workspace:*",
"@elizaos/plugin-lens-network": "workspace:*",
"@elizaos/plugin-letzai": "workspace:*",
"@elizaos/plugin-lit": "workspace:*",
"@elizaos/plugin-gelato": "workspace:*",
"@elizaos/plugin-moralis": "workspace:*",
"@elizaos/plugin-massa": "workspace:*",
"@elizaos/plugin-mind-network": "workspace:*",
"@elizaos/plugin-moralis": "workspace:*",
"@elizaos/plugin-movement": "workspace:*",
"@elizaos/plugin-massa": "workspace:*",
"@elizaos/plugin-news": "workspace:*",
"@elizaos/plugin-nft-generation": "workspace:*",
"@elizaos/plugin-node": "workspace:*",
Expand Down
1 change: 1 addition & 0 deletions agent/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ import { gitcoinPassportPlugin } from "@elizaos/plugin-gitcoin-passport";
import { initiaPlugin } from "@elizaos/plugin-initia";
import { imageGenerationPlugin } from "@elizaos/plugin-image-generation";
import { lensPlugin } from "@elizaos/plugin-lens-network";
import { litPlugin } from "@elizaos/plugin-lit";
import { mindNetworkPlugin } from "@elizaos/plugin-mind-network";
import { multiversxPlugin } from "@elizaos/plugin-multiversx";
import { nearPlugin } from "@elizaos/plugin-near";
Expand Down
3 changes: 0 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,6 @@
"cookie": "0.7.0",
"bs58": "5.0.0",
"@coral-xyz/anchor": "0.28.0"
},
"patchedDependencies": {
"@solana-developers/helpers": "patches/@solana-developers__helpers.patch"
}
},
"engines": {
Expand Down
143 changes: 143 additions & 0 deletions packages/plugin-lit/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# @elizaos/plugin-lit

A plugin that integrates Lit Protocol functionality into the elizaOS runtime environment, enabling secure and decentralized access control and cryptographic operations.

## Features

- Deploy and manage Lit Actions for programmable cryptography
- Interact with Lit Agent Wallet for secure transaction signing
- Built-in tools for common blockchain operations:
- ECDSA signing
- ERC20 token transfers
- Uniswap interactions

## Installation

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.

## Overview
Expand Down Expand Up @@ -37,6 +50,136 @@ The Lit Protocol plugin provides:
npm install @elizaos/plugin-lit
```

## Setup

There are two ways to register the plugin:

1. Add to your agent's plugins in `agent/src/index.ts`:

```typescript
import { LitPlugin } from '@elizaos/plugin-lit';

export default {
plugins: [
// ... other plugins
litPlugin,
],
// ... rest of your agent configuration
};
```

2. Or add it in your character configuration:

```typescript
{
name: "YourCharacter",
plugins: [
// ... other plugins
"@elizaos/plugin-lit"
]
}
```

## Quick Start

1. After registration, initialize Lit Protocol:

```javascript
await elizaOS.lit.initialize({
// Your configuration options
});
```

## Core Components

### Lit Actions

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.

Example usage:

```javascript
const litAction = await elizaOS.lit.deployAction({
code: `
(async () => {
// Your Lit Action code here
})();
`
});
```

### Tools

The `src/actions/helloLit/tools` directory contains pre-built tools for common blockchain operations:

#### ECDSA Signing
```javascript
const signature = await elizaOS.lit.tools.ecdsaSign({
message: "Message to sign",
// Additional parameters
});
```

#### ERC20 Token Transfer
```javascript
const transfer = await elizaOS.lit.tools.erc20Transfer({
tokenAddress: "0x...",
recipient: "0x...",
amount: "1000000000000000000" // 1 token with 18 decimals
});
```

#### Uniswap Integration
```javascript
const swap = await elizaOS.lit.tools.uniswapSwap({
tokenIn: "0x...",
tokenOut: "0x...",
amountIn: "1000000000000000000"
});
```

## Agent Wallet Integration

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:

- Secure key generation and storage
- Transaction signing capabilities
- Integration with Lit Actions for programmable authorization

## Documentation

For more detailed information about Lit Protocol and its capabilities, visit:
- [Lit Protocol Documentation](https://developer.litprotocol.com/)
- [Agent Wallet Documentation](https://github.com/LIT-Protocol/agent-wallet)

## Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

## License

MIT License

Copyright (c) 2024 elizaOS

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
=======
## Configuration

Required environment variables:
Expand Down
19 changes: 19 additions & 0 deletions packages/plugin-lit/dist/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { Action, Plugin } from '@elizaos/core';

declare const HELLO_LIT_ACTION: Action;

declare const WALLET_TRANSFER_LIT_ACTION: Action;

/**
* Action for executing an ECDSA signing using the Lit Protocol.
*/
declare const ECDSA_SIGN_LIT_ACTION: Action;

/**
* Action for executing a Uniswap swap using the Lit Protocol.
*/
declare const UNISWAP_SWAP_LIT_ACTION: Action;

declare const litPlugin: Plugin;

export { ECDSA_SIGN_LIT_ACTION, HELLO_LIT_ACTION, UNISWAP_SWAP_LIT_ACTION, WALLET_TRANSFER_LIT_ACTION, litPlugin as default, litPlugin };
Loading
Loading