@lit-protocol/vincent-ability-evm-transaction-signer 0.0.1-ea

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/CONTRIBUTING.md +88 -0
  3. package/README.md +166 -0
  4. package/dist/package.json +30 -0
  5. package/dist/src/generated/vincent-ability-metadata.json +3 -0
  6. package/dist/src/generated/vincent-bundled-ability.d.ts +971 -0
  7. package/dist/src/generated/vincent-bundled-ability.d.ts.map +1 -0
  8. package/dist/src/generated/vincent-bundled-ability.js +15 -0
  9. package/dist/src/generated/vincent-bundled-ability.js.map +1 -0
  10. package/dist/src/generated/vincent-bundled-tool.d.ts +971 -0
  11. package/dist/src/generated/vincent-bundled-tool.d.ts.map +1 -0
  12. package/dist/src/generated/vincent-bundled-tool.js +15 -0
  13. package/dist/src/generated/vincent-bundled-tool.js.map +1 -0
  14. package/dist/src/index.d.ts +2 -0
  15. package/dist/src/index.d.ts.map +1 -0
  16. package/dist/src/index.js +6 -0
  17. package/dist/src/index.js.map +1 -0
  18. package/dist/src/lib/lit-action-helpers/build-transaction-for-signing.d.ts +6 -0
  19. package/dist/src/lib/lit-action-helpers/build-transaction-for-signing.d.ts.map +1 -0
  20. package/dist/src/lib/lit-action-helpers/build-transaction-for-signing.js +32 -0
  21. package/dist/src/lib/lit-action-helpers/build-transaction-for-signing.js.map +1 -0
  22. package/dist/src/lib/lit-action-helpers/index.d.ts +4 -0
  23. package/dist/src/lib/lit-action-helpers/index.d.ts.map +1 -0
  24. package/dist/src/lib/lit-action-helpers/index.js +10 -0
  25. package/dist/src/lib/lit-action-helpers/index.js.map +1 -0
  26. package/dist/src/lib/lit-action-helpers/serialize-transaction-for-response.d.ts +47 -0
  27. package/dist/src/lib/lit-action-helpers/serialize-transaction-for-response.d.ts.map +1 -0
  28. package/dist/src/lib/lit-action-helpers/serialize-transaction-for-response.js +76 -0
  29. package/dist/src/lib/lit-action-helpers/serialize-transaction-for-response.js.map +1 -0
  30. package/dist/src/lib/lit-action-helpers/sign-tx.d.ts +3 -0
  31. package/dist/src/lib/lit-action-helpers/sign-tx.d.ts.map +1 -0
  32. package/dist/src/lib/lit-action-helpers/sign-tx.js +28 -0
  33. package/dist/src/lib/lit-action-helpers/sign-tx.js.map +1 -0
  34. package/dist/src/lib/lit-action.d.ts +2 -0
  35. package/dist/src/lib/lit-action.d.ts.map +1 -0
  36. package/dist/src/lib/lit-action.js +16 -0
  37. package/dist/src/lib/lit-action.js.map +1 -0
  38. package/dist/src/lib/schemas.d.ts +185 -0
  39. package/dist/src/lib/schemas.d.ts.map +1 -0
  40. package/dist/src/lib/schemas.js +62 -0
  41. package/dist/src/lib/schemas.js.map +1 -0
  42. package/dist/src/lib/vincent-ability.d.ts +968 -0
  43. package/dist/src/lib/vincent-ability.d.ts.map +1 -0
  44. package/dist/src/lib/vincent-ability.js +66 -0
  45. package/dist/src/lib/vincent-ability.js.map +1 -0
  46. package/package.json +29 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,7 @@
1
+ ## 0.0.2 (2025-08-01)
2
+
3
+ ### 🧱 Updated Dependencies
4
+
5
+ - Updated ability-sdk to 2.0.0
6
+ - Updated app-sdk to 2.0.0
7
+ - Updated policy-contract-whitelist to 0.0.2
@@ -0,0 +1,88 @@
1
+ # Contributing to Vincent Ability Transaction Signer
2
+
3
+ This document provides guidelines for contributing to the Vincent Ability Transaction Signer project.
4
+
5
+ ## Overview
6
+
7
+ The Vincent Ability Transaction Signer is a ability to sign transactions using a Vincent Agent Wallet. It's part of the Vincent Abilities ecosystem and is built using the Vincent Ability SDK.
8
+
9
+ ## Setup
10
+
11
+ 1. Follow the global setup instructions in the repository root [CONTRIBUTING.md](../../../CONTRIBUTING.md).
12
+ 2. Install dependencies:
13
+ ```bash
14
+ pnpm install
15
+ ```
16
+
17
+ ## Development Workflow
18
+
19
+ ### Testing
20
+
21
+ Run tests:
22
+
23
+ ```bash
24
+ nx test ability-evm-transaction-signer
25
+ ```
26
+
27
+ ### Building the Lit Action
28
+
29
+ Build the policy:
30
+
31
+ ```bash
32
+ nx action:build ability-evm-transaction-signer
33
+ ```
34
+
35
+ ### Deploying the Lit Action to IPFS
36
+
37
+ Building will be done automatically. Deploy the policy:
38
+
39
+ ```bash
40
+ nx action:deploy ability-evm-transaction-signer
41
+ ```
42
+
43
+ ## Project Structure
44
+
45
+ - `src/`: Source code
46
+ - `index.ts`: Main entry point
47
+
48
+ ## Ability Development Guidelines
49
+
50
+ 1. Use the Vincent Ability SDK to create abilities
51
+ 2. Define clear schemas for ability parameters
52
+ 3. Implement the ability lifecycle methods (precheck, execute)
53
+ 4. Handle errors gracefully
54
+ 5. Write comprehensive tests for all functionality
55
+ 6. Document the ability's purpose and usage
56
+
57
+ ## Integration with Policies
58
+
59
+ This ability can be integrated with various Vincent Policies to enforce constraints. When developing or modifying the ability, consider how it will be used with policies such as:
60
+
61
+ - Vincent Policy Contract Whitelist
62
+
63
+ ## Testing
64
+
65
+ Write unit tests for all functionality:
66
+
67
+ ```bash
68
+ pnpm test
69
+ ```
70
+
71
+ ## Documentation
72
+
73
+ - Document the ability's purpose and usage
74
+ - Update README.md when adding new features
75
+ - Document the ability's parameters and behavior
76
+
77
+ ## Pull Request Process
78
+
79
+ 1. Ensure your code follows the coding standards
80
+ 2. Update documentation if necessary
81
+ 3. Include tests for new functionality
82
+ 4. Link any related issues in your pull request description
83
+ 5. Request a review from a maintainer
84
+
85
+ ## Additional Resources
86
+
87
+ - [Vincent Documentation](https://docs.heyvincent.ai/)
88
+ - [Vincent Ability SDK Documentation](../../libs/ability-sdk/README.md)
package/README.md ADDED
@@ -0,0 +1,166 @@
1
+ # Vincent Ability: Transaction Signer
2
+
3
+ ## Overview
4
+
5
+ The Transaction Signer Ability enables Vincent Agent Wallets to sign EVM transactions utilizing the Vincent ecosystem to govern who can request signatures, as well as what's included in the transactions.
6
+
7
+ This Vincent Ability is intended to be used with Vincent Policies, such as the [@lit-protocol/vincent-policy-contract-whitelist](../policy-contract-whitelist/) policy, to provide protections such as only signing transactions that interact with specific contracts and/or call specific functions on contract.
8
+
9
+ ## How It Works
10
+
11
+ The Transaction Signer Ability is built using the Vincent Ability SDK and provides a secure way to sign Ethereum transactions. Here's how it operates:
12
+
13
+ - **Input**: Accepts a serialized unsigned EVM transaction
14
+ - **Parsing**: Uses `ethers.utils.parseTransaction` to deserialize and validate the transaction structure
15
+ - Important: All properties of the transaction are expected to be provided, including `nonce`, `gasPrice`, `gasLimit`, etc. The Ability will not fetch these values from the network on your behalf.
16
+ - **Signing**: The Vincent Agent Wallet (PKP (Programmable Key Pair)) signs the transaction within the Lit Action environment
17
+ - **Output**: Returns both the signed transaction hex and a deserialized version with signature components
18
+
19
+ ### Workflow
20
+
21
+ 1. **Precheck Phase**:
22
+
23
+ - Deserializes the input transaction
24
+ - Validates transaction structure
25
+ - Executes any registered Vincent Policy to validate the transaction meets the policy requirements
26
+ - Returns deserialized transaction details if successful
27
+
28
+ 2. **Execution Phase**:
29
+ - Performs the same validation as the precheck phase
30
+ - Signs the transaction using the Agent Wallet
31
+ - Returns both the signed transaction ready for broadcast, and the deserialized signed transaction
32
+
33
+ ## Using the Ability
34
+
35
+ See the comprehensive E2E test in [contract-whitelist.spec.ts](../abilities-e2e/test-e2e/contract-whitelist.spec.ts) for a complete example of:
36
+
37
+ - Setting up permissions and the Contract Whitelist Policy
38
+ - Executing the Transaction Signer Ability
39
+ - Validating the signed transaction
40
+ - Broadcasting the signed transaction to the network
41
+
42
+ ```typescript
43
+ import { getVincentAbilityClient } from '@lit-protocol/vincent-app-sdk/abilityClient';
44
+ import { bundledVincentAbility } from '@lit-protocol/vincent-ability-evm-transaction-signer';
45
+
46
+ // Create ability client
47
+ const abilityClient = getVincentAbilityClient({
48
+ bundledVincentAbility: bundledVincentAbility,
49
+ ethersSigner: yourEthersSigner,
50
+ });
51
+
52
+ // Create a transaction
53
+ const transaction = {
54
+ to: '0x4200000000000000000000000000000000000006', // Base WETH
55
+ value: '0x00',
56
+ data: '0xa9059cbb...', // transfer function call
57
+ chainId: 8453,
58
+ nonce: 0,
59
+ gasPrice: '0x...',
60
+ gasLimit: '0x...',
61
+ };
62
+
63
+ // Serialize the transaction
64
+ const serializedTx = ethers.utils.serializeTransaction(transaction);
65
+
66
+ const precheckResult = await abilityClient.precheck(
67
+ {
68
+ serializedTransaction: serializedTx,
69
+ },
70
+ {
71
+ delegatorPkpEthAddress: '0x...', // The Agent Wallet PKP that will sign
72
+ },
73
+ );
74
+
75
+ if (precheckResult.success) {
76
+ const { deserializedUnsignedTransaction } = precheckResult.result;
77
+ // Use the deserialized transaction
78
+ }
79
+
80
+ // Execute the ability
81
+ const executeResult = await abilityClient.execute(
82
+ {
83
+ serializedTransaction: serializedTx,
84
+ },
85
+ {
86
+ delegatorPkpEthAddress: '0x...', // The Agent Wallet PKP that will sign
87
+ },
88
+ );
89
+
90
+ if (executeResult.success) {
91
+ const { signedTransaction, deserializedSignedTransaction } = executeResult.result;
92
+ // Use the signed transaction
93
+ }
94
+ ```
95
+
96
+ ## Input/Output Schemas
97
+
98
+ ### Ability Parameters
99
+
100
+ ```typescript
101
+ {
102
+ serializedTransaction: string; // The serialized unsigned transaction
103
+ }
104
+ ```
105
+
106
+ ### Precheck Success Output
107
+
108
+ ```typescript
109
+ {
110
+ deserializedUnsignedTransaction: {
111
+ to?: string;
112
+ nonce?: number;
113
+ gasLimit: string;
114
+ gasPrice?: string;
115
+ data: string;
116
+ value: string;
117
+ chainId: number;
118
+ type?: number;
119
+ accessList?: any[];
120
+ maxPriorityFeePerGas?: string;
121
+ maxFeePerGas?: string;
122
+ }
123
+ }
124
+ ```
125
+
126
+ ### Execution Success Output
127
+
128
+ ```typescript
129
+ {
130
+ signedTransaction: string; // The signed transaction ready for broadcast
131
+ deserializedSignedTransaction: {
132
+ hash?: string;
133
+ to: string;
134
+ from: string;
135
+ nonce: number;
136
+ gasLimit: string;
137
+ gasPrice?: string;
138
+ data: string;
139
+ value: string;
140
+ chainId: number;
141
+ v: number;
142
+ r: string;
143
+ s: string;
144
+ type?: number;
145
+ accessList?: any[];
146
+ maxPriorityFeePerGas?: string;
147
+ maxFeePerGas?: string;
148
+ }
149
+ }
150
+ ```
151
+
152
+ ## Building
153
+
154
+ Run `pnpx nx build ability-evm-transaction-signer` to build the Ability.
155
+
156
+ ## Running E2E tests
157
+
158
+ Run `pnpx nx run abilities-e2e:test-e2e packages/apps/abilities-e2e/test-e2e/contract-whitelist.spec.ts` to execute the E2E tests via [Jest](https://jestjs.io).
159
+
160
+ ## Contributing
161
+
162
+ Please see [CONTRIBUTING.md](./CONTRIBUTING.md) for guidelines on how to contribute to this project.
163
+
164
+ ## License
165
+
166
+ This project is licensed under the MIT License - see the LICENSE file for details.
@@ -0,0 +1,30 @@
1
+ {
2
+ "name": "@lit-protocol/vincent-ability-evm-transaction-signer",
3
+ "version": "0.0.1-ea",
4
+ "publishConfig": {
5
+ "access": "public"
6
+ },
7
+ "dependencies": {
8
+ "@lit-protocol/vincent-policy-contract-whitelist": "workspace:*",
9
+ "@lit-protocol/vincent-ability-sdk": "workspace:*",
10
+ "ethers": "^5.8.0",
11
+ "tslib": "2.8.1",
12
+ "zod": "^3.25.64"
13
+ },
14
+ "peerDependencies": {
15
+ "@lit-protocol/vincent-app-sdk": "workspace:^"
16
+ },
17
+ "devDependencies": {
18
+ "esbuild": "^0.19.12",
19
+ "esbuild-plugin-polyfill-node": "^0.3.0",
20
+ "ipfs-only-hash": "^4.0.0"
21
+ },
22
+ "main": "./dist/src/index.js",
23
+ "module": "./dist/src/index.js",
24
+ "types": "./dist/src/index.d.ts",
25
+ "files": [
26
+ "dist/**",
27
+ "*.md"
28
+ ],
29
+ "type": "commonjs"
30
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "ipfsCid": "QmUQ3aCkuvhNL837yPtPXCq8UTZbx2pvwd5JP9NDditUaY"
3
+ }