Skip to content

Commit 14b4c41

Browse files
docs: update PKP package READMEs with improved documentation
Co-Authored-By: [email protected] <[email protected]>
1 parent dd4a818 commit 14b4c41

File tree

4 files changed

+208
-41
lines changed

4 files changed

+208
-41
lines changed

packages/pkp-base/README.md

Lines changed: 50 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,55 @@
1-
# Quick Start
1+
# PKP Base
22

3-
This submodule defines a PKPBase class, providing shared wallet functionality for PKP signers, responsible for managing public key compression, initializing and connecting to the LIT node, running LIT actions, and offering debug functions for logging and error handling.
3+
A foundational package providing shared wallet functionality for PKP (Programmable Key Pair) signers in the Lit Protocol ecosystem. This package manages public key operations, LIT node connections, and action execution.
44

5-
| Method/Property | Description |
6-
| -------------------------------------------------------------------- | ----------------------------------------------------------------------------- |
7-
| `compressPubKey(pubKey: string)` | Compresses a provided public key |
8-
| `setUncompressPubKeyAndBuffer(prop: PKPBaseProp)` | Sets the uncompressed public key and its buffer representation |
9-
| `setCompressedPubKeyAndBuffer(prop: PKPBaseProp)` | Sets the compressed public key and its buffer representation |
10-
| `setLitAction(prop: PKPBaseProp)` | Sets the Lit action to be executed by the LitNode client |
11-
| `setLitActionJsParams<CustomType extends T = T>(params: CustomType)` | Sets the value of the `litActionJsParams` property to the given params object |
12-
| `createAndSetSessionSigs(sessionParams: GetSessionSigsProps)` | Creates and sets the session sigs and their expiration |
13-
| `init()` | Initializes the PKPBase instance by connecting to the LIT node |
14-
| `runLitAction(toSign: Uint8Array, sigName: string)` | Runs the specified Lit action with the given parameters |
15-
| `ensureLitNodeClientReady()` | Ensures that the LitNode client is ready for use |
16-
| `log(...args: any[])` | Logs the provided arguments to the console, but only if debugging is enabled |
5+
## Installation
176

18-
### node.js / browser
19-
20-
```
7+
```bash
218
yarn add @lit-protocol/pkp-base
229
```
10+
11+
## Quick Start
12+
13+
```typescript
14+
import { PKPBase } from '@lit-protocol/pkp-base';
15+
16+
// Initialize PKP Base
17+
const pkpBase = new PKPBase({
18+
controllerAuthSig: authSig,
19+
pkpPubKey: publicKey,
20+
});
21+
22+
// Connect to LIT node
23+
await pkpBase.init();
24+
25+
// Run LIT action
26+
const signature = await pkpBase.runLitAction(dataToSign, 'sign');
27+
```
28+
29+
## Key Features
30+
31+
- Public key compression and management
32+
- LIT node connection handling
33+
- Session signature management
34+
- LIT action execution
35+
- Debug logging capabilities
36+
37+
## Core Methods
38+
39+
| Method | Description |
40+
| ------ | ----------- |
41+
| `init()` | Initialize and connect to LIT node |
42+
| `compressPubKey()` | Compress public keys |
43+
| `runLitAction()` | Execute LIT actions |
44+
| `createAndSetSessionSigs()` | Manage session signatures |
45+
| `ensureLitNodeClientReady()` | Verify node connection |
46+
47+
## Development
48+
49+
### Building
50+
51+
Run `nx build pkp-base` to build the library.
52+
53+
### Testing
54+
55+
Run `nx test pkp-base` to execute the unit tests.

packages/pkp-cosmos/README.md

Lines changed: 54 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,59 @@
1-
# PKPCosmos
1+
# PKP Cosmos
22

3-
The `PKPCosmosWallet` class is a specialized wallet for the Cosmos blockchain, based on the `DirectSecp256k1HdWallet` class from the `@cosmjs/proto-signing` library. This class implements the `OfflineDirectSigner` and `PKPClientHelpers` interfaces. The wallet can generate its own Bech32 address (address), manage account data (`getAccounts`), and sign transactions (`signDirect`) with the private key using a LIT node client. It can also create a SigningStargateClient instance (`getClient`), prepare transaction data (formSendTx), and sign a transaction following the SigningStargateClient.sign method (`sign`). The class supports the customization of the Cosmos RPC URL (`rpc`) and the Bech32 address prefix (`addressPrefix`).
3+
A specialized wallet implementation for the Cosmos blockchain ecosystem using Lit Protocol's PKP (Programmable Key Pair) technology. Built on top of `@cosmjs/proto-signing`, this package enables secure transaction signing and account management through Lit nodes.
44

5-
# Getting Started
5+
## Installation
66

7-
```
7+
```bash
88
yarn add @lit-protocol/pkp-cosmos
99
```
10+
11+
## Quick Start
12+
13+
```typescript
14+
import { PKPCosmosWallet } from '@lit-protocol/pkp-cosmos';
15+
16+
// Initialize wallet
17+
const wallet = new PKPCosmosWallet({
18+
controllerAuthSig: authSig,
19+
pkpPubKey: publicKey,
20+
addressPrefix: 'cosmos',
21+
});
22+
23+
// Get wallet address
24+
const address = await wallet.getAddress();
25+
26+
// Sign transaction
27+
const signedTx = await wallet.signDirect(address, {
28+
bodyBytes: tx.bodyBytes,
29+
authInfoBytes: tx.authInfoBytes,
30+
chainId: chainId,
31+
});
32+
```
33+
34+
## Key Features
35+
36+
- Bech32 address generation
37+
- Account data management
38+
- Transaction signing via LIT nodes
39+
- SigningStargateClient integration
40+
- Customizable RPC endpoints
41+
- Flexible address prefix support
42+
43+
## Core Functionality
44+
45+
- Address Generation: Create Cosmos blockchain addresses
46+
- Transaction Management: Sign and prepare transactions
47+
- Client Integration: Create SigningStargateClient instances
48+
- Account Operations: Manage account data and balances
49+
- Network Configuration: Customize RPC URLs and prefixes
50+
51+
## Development
52+
53+
### Building
54+
55+
Run `nx build pkp-cosmos` to build the library.
56+
57+
### Testing
58+
59+
Run `nx test pkp-cosmos` to execute the unit tests.

packages/pkp-ethers/README.md

Lines changed: 54 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,60 @@
1-
# Getting started
1+
# PKP Ethers
22

3-
This module presents a modified version of `new ethers.Wallet()`, known as `PKPEthersWallet`. Unlike its counterpart, `PKPEthersWallet` does not store private keys nor does it support the creation of random wallets.
3+
A specialized Ethereum wallet implementation using Lit Protocol's PKP (Programmable Key Pair) technology, built as an extension of ethers.js Wallet. This package provides secure transaction signing and account management through Lit nodes without storing private keys locally.
44

5-
Despite these differences, it retains the ability to sign and send transactions, process JSON requests, retrieve balance and transaction count, among other functionalities, just like a standard ethers.js Wallet instance.
5+
## Installation
66

7-
API: https://docs.ethers.org/v4/api-wallet.html
8-
9-
```
7+
```bash
108
yarn add @lit-protocol/pkp-ethers ethers
119
```
1210

13-
More info here:
14-
https://github.com/LIT-Protocol/pkp-ethers/tree/master/packages/wallet
11+
## Quick Start
12+
13+
```typescript
14+
import { PKPEthersWallet } from '@lit-protocol/pkp-ethers';
15+
16+
// Initialize wallet
17+
const wallet = new PKPEthersWallet({
18+
controllerAuthSig: authSig,
19+
pkpPubKey: publicKey,
20+
});
21+
22+
// Get wallet address
23+
const address = await wallet.getAddress();
24+
25+
// Sign transaction
26+
const signedTx = await wallet.signTransaction({
27+
to: recipient,
28+
value: ethers.utils.parseEther("0.1"),
29+
});
30+
```
31+
32+
## Key Features
33+
34+
- Secure transaction signing via LIT nodes
35+
- Full ethers.js Wallet compatibility
36+
- JSON-RPC request handling
37+
- Balance and nonce management
38+
- Gas estimation support
39+
- Message signing capabilities
40+
41+
## Core Functionality
42+
43+
- Transaction Management: Sign and send transactions
44+
- Account Operations: Get balances and transaction counts
45+
- Message Signing: Sign messages and typed data
46+
- Network Integration: Connect to any EVM network
47+
- Gas Handling: Estimate and manage gas costs
48+
49+
For detailed API documentation, visit:
50+
https://docs.ethers.org/v4/api-wallet.html
51+
52+
## Development
53+
54+
### Building
55+
56+
Run `nx build pkp-ethers` to build the library.
57+
58+
### Testing
59+
60+
Run `nx test pkp-ethers` to execute the unit tests.
Lines changed: 50 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,65 @@
1-
# pkp-walletconnect
1+
# PKP WalletConnect
22

3-
`pkp-walletconnect` wraps [`@walletconnect/web3wallet`](https://docs.walletconnect.com/2.0/web/web3wallet/wallet-usage) to provide base functionality needed to pair PKPs to dApps, approve and reject session proposals, and respond to session requests. This library is intended to be used with `pkp-client`.
3+
A WalletConnect integration for Lit Protocol's PKP (Programmable Key Pair) system, enabling secure dApp connections and session management. This package wraps WalletConnect's Web3Wallet to provide seamless PKP integration with decentralized applications.
44

5-
## 📜 API Reference
5+
## Installation
66

7-
Check out the [API reference](https://docs.lit-js-sdk-v2.litprotocol.com/modules/pkp_walletconnect_src.html).
7+
```bash
8+
yarn add @lit-protocol/pkp-walletconnect
9+
```
810

9-
## 📦 Installation
11+
## Quick Start
1012

11-
Get started by installing the package:
13+
```typescript
14+
import { PKPWalletConnect } from '@lit-protocol/pkp-walletconnect';
1215

13-
```bash
14-
yarn add @lit-protocol/pkp-walletconnect
16+
// Initialize WalletConnect client
17+
const client = new PKPWalletConnect({
18+
projectId: 'your-project-id',
19+
metadata: {
20+
name: 'Your App',
21+
description: 'Your app description',
22+
url: 'https://your-app.com',
23+
icons: ['https://your-app.com/icon.png']
24+
}
25+
});
26+
27+
// Handle session proposals
28+
client.on('session_proposal', async (proposal) => {
29+
const approved = await client.approveSession(proposal);
30+
});
31+
32+
// Handle session requests
33+
client.on('session_request', async (request) => {
34+
const response = await client.respondToRequest(request);
35+
});
1536
```
1637

17-
## 🙌 Contributing
38+
## Key Features
39+
40+
- WalletConnect v2.0 integration
41+
- dApp pairing management
42+
- Session proposal handling
43+
- Request/response management
44+
- Multi-chain support
45+
- Event handling system
46+
47+
## Core Functionality
48+
49+
- Session Management: Handle dApp connections
50+
- Request Processing: Respond to session requests
51+
- Pairing: Manage PKP-dApp pairings
52+
- Event Handling: Subscribe to WalletConnect events
53+
- Chain Configuration: Support multiple blockchains
54+
55+
For detailed API documentation, visit the [API reference](https://docs.lit-js-sdk-v2.litprotocol.com/modules/pkp_walletconnect_src.html).
1856

19-
This library was generated with [Nx](https://nx.dev).
57+
## Development
2058

2159
### Building
2260

2361
Run `nx build pkp-walletconnect` to build the library.
2462

25-
### Running unit tests
63+
### Testing
2664

27-
Run `nx test pkp-walletconnect` to execute the unit tests via [Jest](https://jestjs.io).
65+
Run `nx test pkp-walletconnect` to execute the unit tests.

0 commit comments

Comments
 (0)