@lit-protocol/vincent-ability-aave 0.2.8 → 1.0.0-mma
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/README.md +51 -86
- package/dist/CHANGELOG.md +7 -0
- package/dist/README.md +51 -86
- package/dist/generated/vincent-bundled-ability.d.ts +1440 -0
- package/dist/generated/vincent-bundled-ability.d.ts.map +1 -0
- package/dist/generated/vincent-bundled-ability.js +15 -0
- package/dist/generated/vincent-bundled-ability.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +22 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/decodeTransaction.d.ts +3 -0
- package/dist/lib/decodeTransaction.d.ts.map +1 -0
- package/dist/lib/decodeTransaction.js +49 -0
- package/dist/lib/decodeTransaction.js.map +1 -0
- package/dist/lib/helpers/aave.d.ts +85 -0
- package/dist/lib/helpers/aave.d.ts.map +1 -0
- package/dist/lib/helpers/aave.js +331 -0
- package/dist/lib/helpers/aave.js.map +1 -0
- package/dist/lib/helpers/erc20.d.ts +6 -0
- package/dist/lib/helpers/erc20.d.ts.map +1 -0
- package/dist/lib/helpers/erc20.js +53 -0
- package/dist/lib/helpers/erc20.js.map +1 -0
- package/dist/lib/helpers/transactionKind.d.ts +6 -0
- package/dist/lib/helpers/transactionKind.d.ts.map +1 -0
- package/dist/lib/helpers/transactionKind.js +10 -0
- package/dist/lib/helpers/transactionKind.js.map +1 -0
- package/dist/lib/validateSimulation.d.ts +3 -0
- package/dist/lib/validateSimulation.d.ts.map +1 -0
- package/dist/lib/validateSimulation.js +56 -0
- package/dist/lib/validateSimulation.js.map +1 -0
- package/dist/lib/validateTransaction.d.ts +3 -0
- package/dist/lib/validateTransaction.d.ts.map +1 -0
- package/dist/lib/validateTransaction.js +79 -0
- package/dist/lib/validateTransaction.js.map +1 -0
- package/dist/lib/vincent-ability.d.ts +1437 -0
- package/dist/lib/vincent-ability.d.ts.map +1 -0
- package/dist/lib/vincent-ability.js +15 -0
- package/dist/lib/vincent-ability.js.map +1 -0
- package/dist/package.json +5 -5
- package/dist/src/generated/lit-action.js +2 -2
- package/dist/src/generated/vincent-ability-metadata.json +1 -1
- package/dist/src/generated/vincent-bundled-ability.d.ts +1417 -66
- package/dist/src/generated/vincent-bundled-ability.d.ts.map +1 -1
- package/dist/src/generated/vincent-bundled-ability.js +3 -5
- package/dist/src/index.d.ts +2 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +17 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/lib/decodeTransaction.d.ts +3 -0
- package/dist/src/lib/decodeTransaction.d.ts.map +1 -0
- package/dist/src/lib/decodeTransaction.js +49 -0
- package/dist/src/lib/decodeTransaction.js.map +1 -0
- package/dist/src/lib/helpers/aave.d.ts +85 -0
- package/dist/src/lib/helpers/aave.d.ts.map +1 -0
- package/dist/src/lib/helpers/aave.js +331 -0
- package/dist/src/lib/helpers/aave.js.map +1 -0
- package/dist/src/lib/helpers/erc20.d.ts +6 -0
- package/dist/src/lib/helpers/erc20.d.ts.map +1 -0
- package/dist/src/lib/helpers/erc20.js +53 -0
- package/dist/src/lib/helpers/erc20.js.map +1 -0
- package/dist/src/lib/helpers/transactionKind.d.ts +6 -0
- package/dist/src/lib/helpers/transactionKind.d.ts.map +1 -0
- package/dist/src/lib/helpers/transactionKind.js +10 -0
- package/dist/src/lib/helpers/transactionKind.js.map +1 -0
- package/dist/src/lib/lit-action.js.map +1 -1
- package/dist/src/lib/validateSimulation.d.ts +3 -0
- package/dist/src/lib/validateSimulation.d.ts.map +1 -0
- package/dist/src/lib/validateSimulation.js +56 -0
- package/dist/src/lib/validateSimulation.js.map +1 -0
- package/dist/src/lib/validateTransaction.d.ts +3 -0
- package/dist/src/lib/validateTransaction.d.ts.map +1 -0
- package/dist/src/lib/validateTransaction.js +79 -0
- package/dist/src/lib/validateTransaction.js.map +1 -0
- package/dist/src/lib/vincent-ability.d.ts +1417 -67
- package/dist/src/lib/vincent-ability.d.ts.map +1 -1
- package/dist/src/lib/vincent-ability.js +9 -345
- package/dist/src/lib/vincent-ability.js.map +1 -1
- package/package.json +6 -6
- package/dist/src/lib/helpers/index.d.ts +0 -71
- package/dist/src/lib/helpers/index.d.ts.map +0 -1
- package/dist/src/lib/helpers/index.js +0 -345
- package/dist/src/lib/helpers/index.js.map +0 -1
- package/dist/src/lib/schemas.d.ts +0 -115
- package/dist/src/lib/schemas.d.ts.map +0 -1
- package/dist/src/lib/schemas.js +0 -110
- package/dist/src/lib/schemas.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,112 +1,77 @@
|
|
|
1
|
-
# Vincent Aave Ability
|
|
1
|
+
# Vincent Aave Gated Signer Ability
|
|
2
2
|
|
|
3
|
-
A
|
|
4
|
-
Scaffold SDK and Lit Actions execution environment.
|
|
3
|
+
A Vincent Ability that acts as a secure, gated signer for Aave v3 operations. It is designed to work with ERC-4337 Smart Accounts (UserOperations) and EOAs (Transactions).
|
|
5
4
|
|
|
6
5
|
## Overview
|
|
7
6
|
|
|
8
|
-
|
|
9
|
-
through Lit Actions. It supports all core Aave operations: supplying assets as collateral, borrowing
|
|
10
|
-
against collateral, repaying debt, and withdrawing assets.
|
|
7
|
+
This ability validates transactions or UserOperations destined for the Aave v3 protocol. It ensures that the operations are safe and aligned with the user's intent before signing them with the delegated Vincent PKP.
|
|
11
8
|
|
|
12
|
-
|
|
9
|
+
It uses the `createVincentGatedSignerAbility` from `@lit-protocol/vincent-ability-sdk/gatedSigner` to enforce a strict validation lifecycle:
|
|
13
10
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
-
|
|
18
|
-
-
|
|
19
|
-
-
|
|
11
|
+
1. **Decode**: Decodes the transaction or userOperation calldata.
|
|
12
|
+
2. **Simulation**: Simulates the transaction/userOperation on-chain.
|
|
13
|
+
3. **Validation**:
|
|
14
|
+
- Verifies interaction with authorized Aave contracts.
|
|
15
|
+
- Checks for value extraction (no unexpected transfers or approvals).
|
|
16
|
+
- Validates operation types (Approve, Supply, Withdraw, etc.).
|
|
17
|
+
4. **Signing**: Signs the UserOperation (ECDSA or EIP-712) or Transaction (ECDSA) if all checks pass.
|
|
20
18
|
|
|
21
|
-
##
|
|
19
|
+
## Features
|
|
22
20
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
- **Smart Account Support**: Compatible with Kernel, Crossmint, Safe, and other ERC-4337 accounts.
|
|
22
|
+
- **EOA Support**: Can sign raw transactions for EOAs.
|
|
23
|
+
- **Protocol Safety**: Restricts interactions to the Aave v3 protocol.
|
|
24
|
+
- **Simulation-based Security**: Validates the actual on-chain effects of the transaction.
|
|
26
25
|
|
|
27
26
|
## Usage
|
|
28
27
|
|
|
28
|
+
This ability is typically used within a Vincent App. The backend service prepares an unsigned UserOperation or Transaction and sends it to the ability for validation and signing.
|
|
29
|
+
|
|
30
|
+
### Parameters
|
|
31
|
+
|
|
32
|
+
The ability accepts either a `UserOperation` or a `Transaction` object.
|
|
33
|
+
|
|
34
|
+
#### For UserOperations (Smart Accounts)
|
|
35
|
+
|
|
29
36
|
```typescript
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
//
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
// Example: Supply WETH as collateral
|
|
40
|
-
const supplyParams = {
|
|
41
|
-
operation: 'supply',
|
|
42
|
-
asset: '0xC558DBdd856501FCd9aaF1E62eae57A9F0629a3c', // WETH on Sepolia
|
|
43
|
-
amount: '0.01',
|
|
44
|
-
chain: 'sepolia',
|
|
37
|
+
const abilityParams = {
|
|
38
|
+
alchemyRpcUrl: 'https://...', // Required for simulation
|
|
39
|
+
entryPointAddress: '0x...',
|
|
40
|
+
userOp: { ... }, // The UserOperation object
|
|
41
|
+
// Optional parameters for Safe/EIP-712
|
|
42
|
+
safe4337ModuleAddress: '0x...',
|
|
43
|
+
eip712Params: { ... },
|
|
45
44
|
};
|
|
46
|
-
|
|
47
|
-
// First run precheck
|
|
48
|
-
const precheckRes = await aaveAbilityClient.precheck(supplyParams, {
|
|
49
|
-
delegatorPkpEthAddress: pkpAddress,
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
if (precheckRes.success) {
|
|
53
|
-
// Then execute
|
|
54
|
-
const executeRes = await aaveAbilityClient.execute(supplyParams, {
|
|
55
|
-
delegatorPkpEthAddress: pkpAddress,
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
if (executeRes.success) {
|
|
59
|
-
console.log('Transaction hash:', executeRes.result.data.txHash);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
45
|
```
|
|
63
46
|
|
|
64
|
-
|
|
47
|
+
#### For Transactions (EOA)
|
|
48
|
+
|
|
49
|
+
```typescript
|
|
50
|
+
const abilityParams = {
|
|
51
|
+
alchemyRpcUrl: 'https://...', // Required for simulation
|
|
52
|
+
transaction: {
|
|
53
|
+
to: '0x...',
|
|
54
|
+
data: '0x...',
|
|
55
|
+
value: '0x...',
|
|
56
|
+
// ... other tx fields
|
|
57
|
+
},
|
|
58
|
+
};
|
|
59
|
+
```
|
|
65
60
|
|
|
66
|
-
|
|
67
|
-
| ------------------ | ----------------------------------------------- | -------- | ------------------------------------------------ |
|
|
68
|
-
| `operation` | `"supply" \| "withdraw" \| "borrow" \| "repay"` | ✅ | The Aave operation to perform |
|
|
69
|
-
| `asset` | `string` | ✅ | Token contract address (0x format) |
|
|
70
|
-
| `amount` | `string` | ✅ | Amount as a string (e.g., "1.5") |
|
|
71
|
-
| `chain` | `string` | ✅ | Chain identifier (e.g., "ethereum", "polygon") |
|
|
72
|
-
| `interestRateMode` | `1 \| 2` | ❌ | 1=Stable, 2=Variable (required for borrow/repay) |
|
|
73
|
-
| `rpcUrl` | `string` | ❌ | Custom RPC URL for precheck validation |
|
|
61
|
+
## Integration
|
|
74
62
|
|
|
75
|
-
|
|
63
|
+
For a full integration example, please refer to the `vincent-smart-account-integration` project, which demonstrates how to use this ability with various smart account providers.
|
|
76
64
|
|
|
77
|
-
|
|
78
|
-
- Sufficient token balance for the operation
|
|
79
|
-
- Token approval for supply/repay operations
|
|
80
|
-
- Properly configured PKP wallet with required permissions
|
|
65
|
+
## Development
|
|
81
66
|
|
|
82
|
-
|
|
67
|
+
### Building
|
|
83
68
|
|
|
84
69
|
```bash
|
|
85
|
-
|
|
86
|
-
npm run build
|
|
87
|
-
|
|
88
|
-
# Build all abilitys and policies
|
|
89
|
-
npm run vincent:build
|
|
70
|
+
nx build ability-aave
|
|
90
71
|
```
|
|
91
72
|
|
|
92
|
-
|
|
73
|
+
### Testing
|
|
93
74
|
|
|
94
75
|
```bash
|
|
95
|
-
|
|
96
|
-
npm test
|
|
97
|
-
|
|
98
|
-
# Run E2E tests
|
|
99
|
-
npm run test:e2e
|
|
100
|
-
|
|
101
|
-
# Reset test state
|
|
102
|
-
npm run test:reset
|
|
76
|
+
nx test ability-aave
|
|
103
77
|
```
|
|
104
|
-
|
|
105
|
-
## Contributing
|
|
106
|
-
|
|
107
|
-
Contributions are welcome! Please see [CONTRIBUTING.md](../../CONTRIBUTING.md) for guidelines on how
|
|
108
|
-
to contribute to this project.
|
|
109
|
-
|
|
110
|
-
## License
|
|
111
|
-
|
|
112
|
-
This project is licensed under the MIT License - see the [LICENSE](../../LICENSE) file for details.
|
package/dist/CHANGELOG.md
CHANGED
package/dist/README.md
CHANGED
|
@@ -1,112 +1,77 @@
|
|
|
1
|
-
# Vincent Aave Ability
|
|
1
|
+
# Vincent Aave Gated Signer Ability
|
|
2
2
|
|
|
3
|
-
A
|
|
4
|
-
Scaffold SDK and Lit Actions execution environment.
|
|
3
|
+
A Vincent Ability that acts as a secure, gated signer for Aave v3 operations. It is designed to work with ERC-4337 Smart Accounts (UserOperations) and EOAs (Transactions).
|
|
5
4
|
|
|
6
5
|
## Overview
|
|
7
6
|
|
|
8
|
-
|
|
9
|
-
through Lit Actions. It supports all core Aave operations: supplying assets as collateral, borrowing
|
|
10
|
-
against collateral, repaying debt, and withdrawing assets.
|
|
7
|
+
This ability validates transactions or UserOperations destined for the Aave v3 protocol. It ensures that the operations are safe and aligned with the user's intent before signing them with the delegated Vincent PKP.
|
|
11
8
|
|
|
12
|
-
|
|
9
|
+
It uses the `createVincentGatedSignerAbility` from `@lit-protocol/vincent-ability-sdk/gatedSigner` to enforce a strict validation lifecycle:
|
|
13
10
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
-
|
|
18
|
-
-
|
|
19
|
-
-
|
|
11
|
+
1. **Decode**: Decodes the transaction or userOperation calldata.
|
|
12
|
+
2. **Simulation**: Simulates the transaction/userOperation on-chain.
|
|
13
|
+
3. **Validation**:
|
|
14
|
+
- Verifies interaction with authorized Aave contracts.
|
|
15
|
+
- Checks for value extraction (no unexpected transfers or approvals).
|
|
16
|
+
- Validates operation types (Approve, Supply, Withdraw, etc.).
|
|
17
|
+
4. **Signing**: Signs the UserOperation (ECDSA or EIP-712) or Transaction (ECDSA) if all checks pass.
|
|
20
18
|
|
|
21
|
-
##
|
|
19
|
+
## Features
|
|
22
20
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
- **Smart Account Support**: Compatible with Kernel, Crossmint, Safe, and other ERC-4337 accounts.
|
|
22
|
+
- **EOA Support**: Can sign raw transactions for EOAs.
|
|
23
|
+
- **Protocol Safety**: Restricts interactions to the Aave v3 protocol.
|
|
24
|
+
- **Simulation-based Security**: Validates the actual on-chain effects of the transaction.
|
|
26
25
|
|
|
27
26
|
## Usage
|
|
28
27
|
|
|
28
|
+
This ability is typically used within a Vincent App. The backend service prepares an unsigned UserOperation or Transaction and sends it to the ability for validation and signing.
|
|
29
|
+
|
|
30
|
+
### Parameters
|
|
31
|
+
|
|
32
|
+
The ability accepts either a `UserOperation` or a `Transaction` object.
|
|
33
|
+
|
|
34
|
+
#### For UserOperations (Smart Accounts)
|
|
35
|
+
|
|
29
36
|
```typescript
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
//
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
// Example: Supply WETH as collateral
|
|
40
|
-
const supplyParams = {
|
|
41
|
-
operation: 'supply',
|
|
42
|
-
asset: '0xC558DBdd856501FCd9aaF1E62eae57A9F0629a3c', // WETH on Sepolia
|
|
43
|
-
amount: '0.01',
|
|
44
|
-
chain: 'sepolia',
|
|
37
|
+
const abilityParams = {
|
|
38
|
+
alchemyRpcUrl: 'https://...', // Required for simulation
|
|
39
|
+
entryPointAddress: '0x...',
|
|
40
|
+
userOp: { ... }, // The UserOperation object
|
|
41
|
+
// Optional parameters for Safe/EIP-712
|
|
42
|
+
safe4337ModuleAddress: '0x...',
|
|
43
|
+
eip712Params: { ... },
|
|
45
44
|
};
|
|
46
|
-
|
|
47
|
-
// First run precheck
|
|
48
|
-
const precheckRes = await aaveAbilityClient.precheck(supplyParams, {
|
|
49
|
-
delegatorPkpEthAddress: pkpAddress,
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
if (precheckRes.success) {
|
|
53
|
-
// Then execute
|
|
54
|
-
const executeRes = await aaveAbilityClient.execute(supplyParams, {
|
|
55
|
-
delegatorPkpEthAddress: pkpAddress,
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
if (executeRes.success) {
|
|
59
|
-
console.log('Transaction hash:', executeRes.result.data.txHash);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
45
|
```
|
|
63
46
|
|
|
64
|
-
|
|
47
|
+
#### For Transactions (EOA)
|
|
48
|
+
|
|
49
|
+
```typescript
|
|
50
|
+
const abilityParams = {
|
|
51
|
+
alchemyRpcUrl: 'https://...', // Required for simulation
|
|
52
|
+
transaction: {
|
|
53
|
+
to: '0x...',
|
|
54
|
+
data: '0x...',
|
|
55
|
+
value: '0x...',
|
|
56
|
+
// ... other tx fields
|
|
57
|
+
},
|
|
58
|
+
};
|
|
59
|
+
```
|
|
65
60
|
|
|
66
|
-
|
|
67
|
-
| ------------------ | ----------------------------------------------- | -------- | ------------------------------------------------ |
|
|
68
|
-
| `operation` | `"supply" \| "withdraw" \| "borrow" \| "repay"` | ✅ | The Aave operation to perform |
|
|
69
|
-
| `asset` | `string` | ✅ | Token contract address (0x format) |
|
|
70
|
-
| `amount` | `string` | ✅ | Amount as a string (e.g., "1.5") |
|
|
71
|
-
| `chain` | `string` | ✅ | Chain identifier (e.g., "ethereum", "polygon") |
|
|
72
|
-
| `interestRateMode` | `1 \| 2` | ❌ | 1=Stable, 2=Variable (required for borrow/repay) |
|
|
73
|
-
| `rpcUrl` | `string` | ❌ | Custom RPC URL for precheck validation |
|
|
61
|
+
## Integration
|
|
74
62
|
|
|
75
|
-
|
|
63
|
+
For a full integration example, please refer to the `vincent-smart-account-integration` project, which demonstrates how to use this ability with various smart account providers.
|
|
76
64
|
|
|
77
|
-
|
|
78
|
-
- Sufficient token balance for the operation
|
|
79
|
-
- Token approval for supply/repay operations
|
|
80
|
-
- Properly configured PKP wallet with required permissions
|
|
65
|
+
## Development
|
|
81
66
|
|
|
82
|
-
|
|
67
|
+
### Building
|
|
83
68
|
|
|
84
69
|
```bash
|
|
85
|
-
|
|
86
|
-
npm run build
|
|
87
|
-
|
|
88
|
-
# Build all abilitys and policies
|
|
89
|
-
npm run vincent:build
|
|
70
|
+
nx build ability-aave
|
|
90
71
|
```
|
|
91
72
|
|
|
92
|
-
|
|
73
|
+
### Testing
|
|
93
74
|
|
|
94
75
|
```bash
|
|
95
|
-
|
|
96
|
-
npm test
|
|
97
|
-
|
|
98
|
-
# Run E2E tests
|
|
99
|
-
npm run test:e2e
|
|
100
|
-
|
|
101
|
-
# Reset test state
|
|
102
|
-
npm run test:reset
|
|
76
|
+
nx test ability-aave
|
|
103
77
|
```
|
|
104
|
-
|
|
105
|
-
## Contributing
|
|
106
|
-
|
|
107
|
-
Contributions are welcome! Please see [CONTRIBUTING.md](../../CONTRIBUTING.md) for guidelines on how
|
|
108
|
-
to contribute to this project.
|
|
109
|
-
|
|
110
|
-
## License
|
|
111
|
-
|
|
112
|
-
This project is licensed under the MIT License - see the [LICENSE](../../LICENSE) file for details.
|