@lit-protocol/vincent-ability-evm-transaction-signer 0.0.2-ea → 0.0.2
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.
- package/CHANGELOG.md +2 -2
- package/README.md +24 -16
- package/dist/CHANGELOG.md +7 -0
- package/dist/CONTRIBUTING.md +88 -0
- package/dist/README.md +174 -0
- package/dist/package.json +3 -3
- package/dist/src/generated/lit-action.js +9 -0
- package/dist/src/generated/vincent-ability-metadata.json +1 -1
- package/dist/src/generated/vincent-bundled-ability.ts +13 -0
- package/package.json +4 -4
- package/dist/src/generated/vincent-bundled-tool.d.ts +0 -971
- package/dist/src/generated/vincent-bundled-tool.d.ts.map +0 -1
- package/dist/src/generated/vincent-bundled-tool.js +0 -15
- package/dist/src/generated/vincent-bundled-tool.js.map +0 -1
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -1,34 +1,42 @@
|
|
|
1
|
-
# Vincent Ability: Transaction Signer
|
|
1
|
+
# Vincent Ability: EVM Transaction Signer
|
|
2
2
|
|
|
3
3
|
## Overview
|
|
4
4
|
|
|
5
|
-
The Transaction Signer Ability enables Vincent
|
|
5
|
+
The EVM Transaction Signer Ability enables Vincent Apps to sign Ethereum Virtual Machine (EVM) transactions on behalf of Vincent Users using their Vincent Agent Wallets. This enables Vincent Apps to interact with contracts even if there isn't an explicit Vincent Ability made for interacting with that contract.
|
|
6
6
|
|
|
7
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
8
|
|
|
9
|
+
## Key Features
|
|
10
|
+
|
|
11
|
+
- **Secure Transaction Signing**: Signs transactions using Vincent Agent Wallets within Lit Protocol's secure Trusted Execution Environment
|
|
12
|
+
- **Full Transaction Support**: Handles all EVM transaction types including legacy, EIP-2930, and EIP-1559
|
|
13
|
+
- **Policy Integration**: Supports the Contract Whitelist Policy for restricting what transactions can be signed
|
|
14
|
+
|
|
9
15
|
## How It Works
|
|
10
16
|
|
|
11
17
|
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
18
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
-
|
|
17
|
-
-
|
|
19
|
+
1. **Precheck Phase**: Validates the transaction structure and runs policy checks
|
|
20
|
+
|
|
21
|
+
- Deserializes the provided serialized transaction using ethers.js
|
|
22
|
+
- Validates all required fields are present (nonce, gasPrice, gasLimit, etc.)
|
|
23
|
+
- Returns deserialized transaction details for review
|
|
24
|
+
|
|
25
|
+
2. **Execution Phase**: If permitted by the evaluated Policies, signs the serialized transaction
|
|
26
|
+
- Signs the transaction using the Vincent Agent Wallet
|
|
27
|
+
- Returns both the signed transaction hex and decoded signature components
|
|
18
28
|
|
|
19
29
|
### Workflow
|
|
20
30
|
|
|
21
|
-
1. **Precheck Phase**:
|
|
31
|
+
1. **Precheck Phase**: Validates the transaction structure and runs policy checks
|
|
22
32
|
|
|
23
|
-
- Deserializes the
|
|
24
|
-
- Validates
|
|
25
|
-
-
|
|
26
|
-
- Returns deserialized transaction details if successful
|
|
33
|
+
- Deserializes the provided serialized transaction using ethers.js
|
|
34
|
+
- Validates all required fields are present (nonce, gasPrice, gasLimit, etc.)
|
|
35
|
+
- Returns deserialized transaction details for review
|
|
27
36
|
|
|
28
|
-
2. **Execution Phase**:
|
|
29
|
-
-
|
|
30
|
-
-
|
|
31
|
-
- Returns both the signed transaction ready for broadcast, and the deserialized signed transaction
|
|
37
|
+
2. **Execution Phase**: If permitted by the evaluated Policies, signs the serialized transaction
|
|
38
|
+
- Signs the transaction using the Vincent Agent Wallet
|
|
39
|
+
- Returns both the signed transaction hex and decoded signature components
|
|
32
40
|
|
|
33
41
|
## Using the Ability
|
|
34
42
|
|
|
@@ -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/dist/README.md
ADDED
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
# Vincent Ability: EVM Transaction Signer
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
The EVM Transaction Signer Ability enables Vincent Apps to sign Ethereum Virtual Machine (EVM) transactions on behalf of Vincent Users using their Vincent Agent Wallets. This enables Vincent Apps to interact with contracts even if there isn't an explicit Vincent Ability made for interacting with that contract.
|
|
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
|
+
## Key Features
|
|
10
|
+
|
|
11
|
+
- **Secure Transaction Signing**: Signs transactions using Vincent Agent Wallets within Lit Protocol's secure Trusted Execution Environment
|
|
12
|
+
- **Full Transaction Support**: Handles all EVM transaction types including legacy, EIP-2930, and EIP-1559
|
|
13
|
+
- **Policy Integration**: Supports the Contract Whitelist Policy for restricting what transactions can be signed
|
|
14
|
+
|
|
15
|
+
## How It Works
|
|
16
|
+
|
|
17
|
+
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:
|
|
18
|
+
|
|
19
|
+
1. **Precheck Phase**: Validates the transaction structure and runs policy checks
|
|
20
|
+
|
|
21
|
+
- Deserializes the provided serialized transaction using ethers.js
|
|
22
|
+
- Validates all required fields are present (nonce, gasPrice, gasLimit, etc.)
|
|
23
|
+
- Returns deserialized transaction details for review
|
|
24
|
+
|
|
25
|
+
2. **Execution Phase**: If permitted by the evaluated Policies, signs the serialized transaction
|
|
26
|
+
- Signs the transaction using the Vincent Agent Wallet
|
|
27
|
+
- Returns both the signed transaction hex and decoded signature components
|
|
28
|
+
|
|
29
|
+
### Workflow
|
|
30
|
+
|
|
31
|
+
1. **Precheck Phase**: Validates the transaction structure and runs policy checks
|
|
32
|
+
|
|
33
|
+
- Deserializes the provided serialized transaction using ethers.js
|
|
34
|
+
- Validates all required fields are present (nonce, gasPrice, gasLimit, etc.)
|
|
35
|
+
- Returns deserialized transaction details for review
|
|
36
|
+
|
|
37
|
+
2. **Execution Phase**: If permitted by the evaluated Policies, signs the serialized transaction
|
|
38
|
+
- Signs the transaction using the Vincent Agent Wallet
|
|
39
|
+
- Returns both the signed transaction hex and decoded signature components
|
|
40
|
+
|
|
41
|
+
## Using the Ability
|
|
42
|
+
|
|
43
|
+
See the comprehensive E2E test in [contract-whitelist.spec.ts](../abilities-e2e/test-e2e/contract-whitelist.spec.ts) for a complete example of:
|
|
44
|
+
|
|
45
|
+
- Setting up permissions and the Contract Whitelist Policy
|
|
46
|
+
- Executing the Transaction Signer Ability
|
|
47
|
+
- Validating the signed transaction
|
|
48
|
+
- Broadcasting the signed transaction to the network
|
|
49
|
+
|
|
50
|
+
```typescript
|
|
51
|
+
import { getVincentAbilityClient } from '@lit-protocol/vincent-app-sdk/abilityClient';
|
|
52
|
+
import { bundledVincentAbility } from '@lit-protocol/vincent-ability-evm-transaction-signer';
|
|
53
|
+
|
|
54
|
+
// Create ability client
|
|
55
|
+
const abilityClient = getVincentAbilityClient({
|
|
56
|
+
bundledVincentAbility: bundledVincentAbility,
|
|
57
|
+
ethersSigner: yourEthersSigner,
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
// Create a transaction
|
|
61
|
+
const transaction = {
|
|
62
|
+
to: '0x4200000000000000000000000000000000000006', // Base WETH
|
|
63
|
+
value: '0x00',
|
|
64
|
+
data: '0xa9059cbb...', // transfer function call
|
|
65
|
+
chainId: 8453,
|
|
66
|
+
nonce: 0,
|
|
67
|
+
gasPrice: '0x...',
|
|
68
|
+
gasLimit: '0x...',
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
// Serialize the transaction
|
|
72
|
+
const serializedTx = ethers.utils.serializeTransaction(transaction);
|
|
73
|
+
|
|
74
|
+
const precheckResult = await abilityClient.precheck(
|
|
75
|
+
{
|
|
76
|
+
serializedTransaction: serializedTx,
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
delegatorPkpEthAddress: '0x...', // The Agent Wallet PKP that will sign
|
|
80
|
+
},
|
|
81
|
+
);
|
|
82
|
+
|
|
83
|
+
if (precheckResult.success) {
|
|
84
|
+
const { deserializedUnsignedTransaction } = precheckResult.result;
|
|
85
|
+
// Use the deserialized transaction
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// Execute the ability
|
|
89
|
+
const executeResult = await abilityClient.execute(
|
|
90
|
+
{
|
|
91
|
+
serializedTransaction: serializedTx,
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
delegatorPkpEthAddress: '0x...', // The Agent Wallet PKP that will sign
|
|
95
|
+
},
|
|
96
|
+
);
|
|
97
|
+
|
|
98
|
+
if (executeResult.success) {
|
|
99
|
+
const { signedTransaction, deserializedSignedTransaction } = executeResult.result;
|
|
100
|
+
// Use the signed transaction
|
|
101
|
+
}
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## Input/Output Schemas
|
|
105
|
+
|
|
106
|
+
### Ability Parameters
|
|
107
|
+
|
|
108
|
+
```typescript
|
|
109
|
+
{
|
|
110
|
+
serializedTransaction: string; // The serialized unsigned transaction
|
|
111
|
+
}
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### Precheck Success Output
|
|
115
|
+
|
|
116
|
+
```typescript
|
|
117
|
+
{
|
|
118
|
+
deserializedUnsignedTransaction: {
|
|
119
|
+
to?: string;
|
|
120
|
+
nonce?: number;
|
|
121
|
+
gasLimit: string;
|
|
122
|
+
gasPrice?: string;
|
|
123
|
+
data: string;
|
|
124
|
+
value: string;
|
|
125
|
+
chainId: number;
|
|
126
|
+
type?: number;
|
|
127
|
+
accessList?: any[];
|
|
128
|
+
maxPriorityFeePerGas?: string;
|
|
129
|
+
maxFeePerGas?: string;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### Execution Success Output
|
|
135
|
+
|
|
136
|
+
```typescript
|
|
137
|
+
{
|
|
138
|
+
signedTransaction: string; // The signed transaction ready for broadcast
|
|
139
|
+
deserializedSignedTransaction: {
|
|
140
|
+
hash?: string;
|
|
141
|
+
to: string;
|
|
142
|
+
from: string;
|
|
143
|
+
nonce: number;
|
|
144
|
+
gasLimit: string;
|
|
145
|
+
gasPrice?: string;
|
|
146
|
+
data: string;
|
|
147
|
+
value: string;
|
|
148
|
+
chainId: number;
|
|
149
|
+
v: number;
|
|
150
|
+
r: string;
|
|
151
|
+
s: string;
|
|
152
|
+
type?: number;
|
|
153
|
+
accessList?: any[];
|
|
154
|
+
maxPriorityFeePerGas?: string;
|
|
155
|
+
maxFeePerGas?: string;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
## Building
|
|
161
|
+
|
|
162
|
+
Run `pnpx nx build ability-evm-transaction-signer` to build the Ability.
|
|
163
|
+
|
|
164
|
+
## Running E2E tests
|
|
165
|
+
|
|
166
|
+
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).
|
|
167
|
+
|
|
168
|
+
## Contributing
|
|
169
|
+
|
|
170
|
+
Please see [CONTRIBUTING.md](./CONTRIBUTING.md) for guidelines on how to contribute to this project.
|
|
171
|
+
|
|
172
|
+
## License
|
|
173
|
+
|
|
174
|
+
This project is licensed under the MIT License - see the LICENSE file for details.
|
package/dist/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lit-protocol/vincent-ability-evm-transaction-signer",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.2",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@lit-protocol/vincent-policy-contract-whitelist": "
|
|
9
|
-
"@lit-protocol/vincent-ability-sdk": "
|
|
8
|
+
"@lit-protocol/vincent-policy-contract-whitelist": "workspace:*",
|
|
9
|
+
"@lit-protocol/vincent-ability-sdk": "workspace:*",
|
|
10
10
|
"ethers": "^5.8.0",
|
|
11
11
|
"tslib": "2.8.1",
|
|
12
12
|
"zod": "^3.25.64"
|