@lit-protocol/vincent-policy-send-counter 0.0.12-mma → 0.1.1
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 +7 -0
- package/dist/CHANGELOG.md +21 -0
- package/dist/CONTRIBUTING.md +89 -0
- package/dist/README.md +71 -0
- package/dist/package.json +1 -1
- package/dist/src/generated/lit-action.js +9 -0
- package/dist/src/generated/vincent-bundled-policy.d.ts +18 -18
- package/dist/src/generated/vincent-bundled-policy.ts +13 -0
- package/dist/src/generated/vincent-policy-metadata.json +1 -1
- package/dist/src/lib/schemas.d.ts +6 -6
- package/dist/src/lib/schemas.d.ts.map +1 -1
- package/dist/src/lib/schemas.js +4 -8
- package/dist/src/lib/schemas.js.map +1 -1
- package/dist/src/lib/vincent-policy.d.ts +18 -18
- package/dist/src/lib/vincent-policy.d.ts.map +1 -1
- package/dist/src/lib/vincent-policy.js +21 -31
- package/dist/src/lib/vincent-policy.js.map +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
## 0.1.1 (2025-09-03)
|
|
2
|
+
|
|
3
|
+
### 🧱 Updated Dependencies
|
|
4
|
+
|
|
5
|
+
- Updated ability-sdk to 2.0.1
|
|
6
|
+
- Updated app-sdk to 2.0.1
|
|
7
|
+
|
|
8
|
+
## 0.1.0 (2025-08-05)
|
|
9
|
+
|
|
10
|
+
### 🚀 Features
|
|
11
|
+
|
|
12
|
+
- Migrated abilities and policy to vincent monorepo ([f62d9461](https://github.com/LIT-Protocol/Vincent/commit/f62d9461))
|
|
13
|
+
|
|
14
|
+
### 🧱 Updated Dependencies
|
|
15
|
+
|
|
16
|
+
- Updated ability-sdk to 2.0.0
|
|
17
|
+
- Updated app-sdk to 2.0.0
|
|
18
|
+
|
|
19
|
+
### ❤️ Thank You
|
|
20
|
+
|
|
21
|
+
- FedericoAmura @FedericoAmura
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# Contributing to Vincent Policy Send Counter
|
|
2
|
+
|
|
3
|
+
This document provides guidelines for contributing to the Vincent Policy Send Counter project.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
The Vincent Policy Send Counter is a policy that can be attached to abilities to avoid them spending more than a user-defined limit in a specific period of time. It's part of the Vincent Abilities ecosystem and is built using the Vincent Tool 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 policy-spending-limit
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### Building the Lit Action
|
|
28
|
+
|
|
29
|
+
Build the policy:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
nx action:build policy-spending-limit
|
|
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 policy-spending-limit
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Project Structure
|
|
44
|
+
|
|
45
|
+
- `src/`: Source code
|
|
46
|
+
- `index.ts`: Main entry point
|
|
47
|
+
|
|
48
|
+
## Policy Development Guidelines
|
|
49
|
+
|
|
50
|
+
1. Use the Vincent Ability SDK to create policies
|
|
51
|
+
2. Define clear schemas for ability parameters and user parameters
|
|
52
|
+
3. Implement the policy lifecycle methods (evaluate, commit)
|
|
53
|
+
4. Handle errors gracefully
|
|
54
|
+
5. Write comprehensive tests for all functionality
|
|
55
|
+
6. Document the policy's purpose and usage
|
|
56
|
+
|
|
57
|
+
## Integration with Abilities
|
|
58
|
+
|
|
59
|
+
This policy can be integrated with various Vincent Abilities to enforce sending limits. When developing or modifying the policy, consider how it will be used by abilities such as:
|
|
60
|
+
|
|
61
|
+
- Vincent Ability ERC20 Approval
|
|
62
|
+
- Vincent Ability Uniswap Swap
|
|
63
|
+
|
|
64
|
+
## Testing
|
|
65
|
+
|
|
66
|
+
Write unit tests for all functionality:
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
pnpm test
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Documentation
|
|
73
|
+
|
|
74
|
+
- Document the policy's purpose and usage
|
|
75
|
+
- Update README.md when adding new features
|
|
76
|
+
- Document the policy's parameters and behavior
|
|
77
|
+
|
|
78
|
+
## Pull Request Process
|
|
79
|
+
|
|
80
|
+
1. Ensure your code follows the coding standards
|
|
81
|
+
2. Update documentation if necessary
|
|
82
|
+
3. Include tests for new functionality
|
|
83
|
+
4. Link any related issues in your pull request description
|
|
84
|
+
5. Request a review from a maintainer
|
|
85
|
+
|
|
86
|
+
## Additional Resources
|
|
87
|
+
|
|
88
|
+
- [Vincent Documentation](https://docs.heyvincent.ai/)
|
|
89
|
+
- [Vincent Ability SDK Documentation](../../libs/ability-sdk/README.md)
|
package/dist/README.md
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# Vincent Policy Send Counter
|
|
2
|
+
|
|
3
|
+
A policy that can be attached to Vincent abilitys to limit the number of transactions that can be sent within a specific time period.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
The Vincent Policy Send Counter is part of the Vincent Abilities ecosystem and is built using the Vincent Ability SDK. It allows users to set transaction count limits for abilitys, providing an additional layer of security and control.
|
|
8
|
+
|
|
9
|
+
## Features
|
|
10
|
+
|
|
11
|
+
- Set maximum transaction limits per time period
|
|
12
|
+
- Track transaction counts across multiple abilities
|
|
13
|
+
- Configurable by users through the Vincent Dashboard
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm install @lit-protocol/vincent-policy-send-counter
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Usage
|
|
22
|
+
|
|
23
|
+
This policy can be integrated with Vincent Abilities to enforce transaction count limits:
|
|
24
|
+
|
|
25
|
+
```typescript
|
|
26
|
+
import {
|
|
27
|
+
createVincentAbilityPolicy,
|
|
28
|
+
createVincentAbility,
|
|
29
|
+
supportedPoliciesForAbility,
|
|
30
|
+
} from '@lit-protocol/vincent-ability-sdk';
|
|
31
|
+
import { bundledVincentPolicy } from '@lit-protocol/vincent-policy-send-counter';
|
|
32
|
+
|
|
33
|
+
const abilityParamsSchema = z.object({
|
|
34
|
+
// Your ability's parameter schema
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
const sendCounterPolicy = createVincentAbilityPolicy({
|
|
38
|
+
abilityParamsSchema,
|
|
39
|
+
bundledVincentPolicy,
|
|
40
|
+
// Map your ability's parameters to the policy's expected parameters if needed
|
|
41
|
+
abilityParameterMappings: {
|
|
42
|
+
/* your parameter mappings */
|
|
43
|
+
},
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
export const myAbility = createVincentAbility({
|
|
47
|
+
abilityParamsSchema,
|
|
48
|
+
supportedPolicies: supportedPoliciesForAbility([sendCounterPolicy]),
|
|
49
|
+
// ... rest of ability implementation
|
|
50
|
+
});
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Building
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
nx build policy-send-counter
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Running Tests
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
nx test policy-send-counter
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Contributing
|
|
66
|
+
|
|
67
|
+
Please see [CONTRIBUTING.md](../../CONTRIBUTING.md) for guidelines on how to contribute to this project.
|
|
68
|
+
|
|
69
|
+
## License
|
|
70
|
+
|
|
71
|
+
This project is licensed under the MIT License - see the [LICENSE](../../LICENSE) file for details.
|