@lit-protocol/vincent-policy-spending-limit 0.0.4-mma → 0.0.8-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/CHANGELOG.md +1 -1
- package/CONTRIBUTING.md +8 -8
- package/README.md +16 -16
- package/dist/CHANGELOG.md +1 -1
- package/dist/CONTRIBUTING.md +8 -8
- package/dist/README.md +16 -16
- package/dist/package.json +1 -1
- package/dist/src/generated/lit-action.js +2 -2
- package/dist/src/generated/vincent-bundled-policy.d.ts +4 -4
- package/dist/src/generated/vincent-bundled-policy.js +2 -2
- package/dist/src/generated/vincent-bundled-policy.js.map +1 -1
- package/dist/src/generated/vincent-bundled-policy.ts +1 -1
- package/dist/src/generated/vincent-policy-metadata.json +1 -1
- package/dist/src/lib/lit-action.js +3 -3
- package/dist/src/lib/lit-action.js.map +1 -1
- package/dist/src/lib/schemas.d.ts +1 -1
- package/dist/src/lib/schemas.d.ts.map +1 -1
- package/dist/src/lib/schemas.js +2 -2
- package/dist/src/lib/schemas.js.map +1 -1
- package/dist/src/lib/vincent-policy.d.ts +4 -4
- package/dist/src/lib/vincent-policy.js +9 -9
- package/dist/src/lib/vincent-policy.js.map +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
package/CONTRIBUTING.md
CHANGED
|
@@ -4,7 +4,7 @@ This document provides guidelines for contributing to the Vincent Policy Spendin
|
|
|
4
4
|
|
|
5
5
|
## Overview
|
|
6
6
|
|
|
7
|
-
The Vincent Policy Spending Limit is a policy that can be attached to
|
|
7
|
+
The Vincent Policy Spending Limit 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 Ability SDK.
|
|
8
8
|
|
|
9
9
|
## Setup
|
|
10
10
|
|
|
@@ -47,19 +47,19 @@ nx action:deploy policy-spending-limit
|
|
|
47
47
|
|
|
48
48
|
## Policy Development Guidelines
|
|
49
49
|
|
|
50
|
-
1. Use the Vincent
|
|
51
|
-
2. Define clear schemas for
|
|
50
|
+
1. Use the Vincent Ability SDK to create policies
|
|
51
|
+
2. Define clear schemas for ability parameters and user parameters
|
|
52
52
|
3. Implement the policy lifecycle methods (evaluate, commit)
|
|
53
53
|
4. Handle errors gracefully
|
|
54
54
|
5. Write comprehensive tests for all functionality
|
|
55
55
|
6. Document the policy's purpose and usage
|
|
56
56
|
|
|
57
|
-
## Integration with
|
|
57
|
+
## Integration with Abilities
|
|
58
58
|
|
|
59
|
-
This policy can be integrated with various Vincent
|
|
59
|
+
This policy can be integrated with various Vincent Abilities to enforce spending limits. When developing or modifying the policy, consider how it will be used by abilities such as:
|
|
60
60
|
|
|
61
|
-
- Vincent
|
|
62
|
-
- Vincent
|
|
61
|
+
- Vincent Ability ERC20 Approval
|
|
62
|
+
- Vincent Ability Uniswap Swap
|
|
63
63
|
|
|
64
64
|
## Testing
|
|
65
65
|
|
|
@@ -86,4 +86,4 @@ pnpm test
|
|
|
86
86
|
## Additional Resources
|
|
87
87
|
|
|
88
88
|
- [Vincent Documentation](https://docs.heyvincent.ai/)
|
|
89
|
-
- [Vincent
|
|
89
|
+
- [Vincent Ability SDK Documentation](../../libs/ability-sdk/README.md)
|
package/README.md
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
# Vincent Policy Spending Limit
|
|
2
2
|
|
|
3
|
-
A policy that can be attached to Vincent
|
|
3
|
+
A policy that can be attached to Vincent abilities to avoid them spending more than a user-defined limit in a specific period of time.
|
|
4
4
|
|
|
5
5
|
## Overview
|
|
6
6
|
|
|
7
|
-
The Vincent Policy Spending Limit is part of the Vincent
|
|
7
|
+
The Vincent Policy Spending Limit is part of the Vincent Abilities ecosystem and is built using the Vincent Ability SDK. It allows users to set spending limits for abilities that interact with their funds, providing an additional layer of security and control.
|
|
8
8
|
|
|
9
9
|
## Features
|
|
10
10
|
|
|
11
11
|
- Set maximum spending limits per period
|
|
12
|
-
- Track spending across multiple
|
|
12
|
+
- Track spending across multiple abilities
|
|
13
13
|
- Configurable by users through the Vincent Dashboard
|
|
14
14
|
|
|
15
15
|
## Installation
|
|
@@ -20,30 +20,30 @@ npm install @lit-protocol/vincent-policy-spending-limit
|
|
|
20
20
|
|
|
21
21
|
## Usage
|
|
22
22
|
|
|
23
|
-
This policy can be integrated with Vincent
|
|
23
|
+
This policy can be integrated with Vincent Abilities to enforce spending limits:
|
|
24
24
|
|
|
25
25
|
```typescript
|
|
26
26
|
import {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
} from '@lit-protocol/vincent-
|
|
27
|
+
createVincentAbilityPolicy,
|
|
28
|
+
createVincentAbility,
|
|
29
|
+
supportedPoliciesForAbility,
|
|
30
|
+
} from '@lit-protocol/vincent-ability-sdk';
|
|
31
31
|
import { bundledVincentPolicy } from '@lit-protocol/vincent-policy-spending-limit';
|
|
32
32
|
|
|
33
|
-
const
|
|
33
|
+
const abilityParamsSchema = z.object({
|
|
34
34
|
buy: z.boolean(),
|
|
35
35
|
});
|
|
36
36
|
|
|
37
|
-
const spendingLimitPolicy =
|
|
38
|
-
|
|
37
|
+
const spendingLimitPolicy = createVincentAbilityPolicy({
|
|
38
|
+
abilityParamsSchema,
|
|
39
39
|
bundledVincentPolicy,
|
|
40
|
-
|
|
40
|
+
abilityParameterMappings: { buy: 'buyAmount' },
|
|
41
41
|
});
|
|
42
42
|
|
|
43
|
-
export const
|
|
44
|
-
|
|
45
|
-
supportedPolicies:
|
|
46
|
-
// ... rest of
|
|
43
|
+
export const myTokenSwapAbility = createVincentAbility({
|
|
44
|
+
abilityParamsSchema,
|
|
45
|
+
supportedPolicies: supportedPoliciesForAbility([spendingLimitPolicy]),
|
|
46
|
+
// ... rest of ability implementation
|
|
47
47
|
});
|
|
48
48
|
```
|
|
49
49
|
|
package/dist/CHANGELOG.md
CHANGED
package/dist/CONTRIBUTING.md
CHANGED
|
@@ -4,7 +4,7 @@ This document provides guidelines for contributing to the Vincent Policy Spendin
|
|
|
4
4
|
|
|
5
5
|
## Overview
|
|
6
6
|
|
|
7
|
-
The Vincent Policy Spending Limit is a policy that can be attached to
|
|
7
|
+
The Vincent Policy Spending Limit 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 Ability SDK.
|
|
8
8
|
|
|
9
9
|
## Setup
|
|
10
10
|
|
|
@@ -47,19 +47,19 @@ nx action:deploy policy-spending-limit
|
|
|
47
47
|
|
|
48
48
|
## Policy Development Guidelines
|
|
49
49
|
|
|
50
|
-
1. Use the Vincent
|
|
51
|
-
2. Define clear schemas for
|
|
50
|
+
1. Use the Vincent Ability SDK to create policies
|
|
51
|
+
2. Define clear schemas for ability parameters and user parameters
|
|
52
52
|
3. Implement the policy lifecycle methods (evaluate, commit)
|
|
53
53
|
4. Handle errors gracefully
|
|
54
54
|
5. Write comprehensive tests for all functionality
|
|
55
55
|
6. Document the policy's purpose and usage
|
|
56
56
|
|
|
57
|
-
## Integration with
|
|
57
|
+
## Integration with Abilities
|
|
58
58
|
|
|
59
|
-
This policy can be integrated with various Vincent
|
|
59
|
+
This policy can be integrated with various Vincent Abilities to enforce spending limits. When developing or modifying the policy, consider how it will be used by abilities such as:
|
|
60
60
|
|
|
61
|
-
- Vincent
|
|
62
|
-
- Vincent
|
|
61
|
+
- Vincent Ability ERC20 Approval
|
|
62
|
+
- Vincent Ability Uniswap Swap
|
|
63
63
|
|
|
64
64
|
## Testing
|
|
65
65
|
|
|
@@ -86,4 +86,4 @@ pnpm test
|
|
|
86
86
|
## Additional Resources
|
|
87
87
|
|
|
88
88
|
- [Vincent Documentation](https://docs.heyvincent.ai/)
|
|
89
|
-
- [Vincent
|
|
89
|
+
- [Vincent Ability SDK Documentation](../../libs/ability-sdk/README.md)
|
package/dist/README.md
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
# Vincent Policy Spending Limit
|
|
2
2
|
|
|
3
|
-
A policy that can be attached to Vincent
|
|
3
|
+
A policy that can be attached to Vincent abilities to avoid them spending more than a user-defined limit in a specific period of time.
|
|
4
4
|
|
|
5
5
|
## Overview
|
|
6
6
|
|
|
7
|
-
The Vincent Policy Spending Limit is part of the Vincent
|
|
7
|
+
The Vincent Policy Spending Limit is part of the Vincent Abilities ecosystem and is built using the Vincent Ability SDK. It allows users to set spending limits for abilities that interact with their funds, providing an additional layer of security and control.
|
|
8
8
|
|
|
9
9
|
## Features
|
|
10
10
|
|
|
11
11
|
- Set maximum spending limits per period
|
|
12
|
-
- Track spending across multiple
|
|
12
|
+
- Track spending across multiple abilities
|
|
13
13
|
- Configurable by users through the Vincent Dashboard
|
|
14
14
|
|
|
15
15
|
## Installation
|
|
@@ -20,30 +20,30 @@ npm install @lit-protocol/vincent-policy-spending-limit
|
|
|
20
20
|
|
|
21
21
|
## Usage
|
|
22
22
|
|
|
23
|
-
This policy can be integrated with Vincent
|
|
23
|
+
This policy can be integrated with Vincent Abilities to enforce spending limits:
|
|
24
24
|
|
|
25
25
|
```typescript
|
|
26
26
|
import {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
} from '@lit-protocol/vincent-
|
|
27
|
+
createVincentAbilityPolicy,
|
|
28
|
+
createVincentAbility,
|
|
29
|
+
supportedPoliciesForAbility,
|
|
30
|
+
} from '@lit-protocol/vincent-ability-sdk';
|
|
31
31
|
import { bundledVincentPolicy } from '@lit-protocol/vincent-policy-spending-limit';
|
|
32
32
|
|
|
33
|
-
const
|
|
33
|
+
const abilityParamsSchema = z.object({
|
|
34
34
|
buy: z.boolean(),
|
|
35
35
|
});
|
|
36
36
|
|
|
37
|
-
const spendingLimitPolicy =
|
|
38
|
-
|
|
37
|
+
const spendingLimitPolicy = createVincentAbilityPolicy({
|
|
38
|
+
abilityParamsSchema,
|
|
39
39
|
bundledVincentPolicy,
|
|
40
|
-
|
|
40
|
+
abilityParameterMappings: { buy: 'buyAmount' },
|
|
41
41
|
});
|
|
42
42
|
|
|
43
|
-
export const
|
|
44
|
-
|
|
45
|
-
supportedPolicies:
|
|
46
|
-
// ... rest of
|
|
43
|
+
export const myTokenSwapAbility = createVincentAbility({
|
|
44
|
+
abilityParamsSchema,
|
|
45
|
+
supportedPolicies: supportedPoliciesForAbility([spendingLimitPolicy]),
|
|
46
|
+
// ... rest of ability implementation
|
|
47
47
|
});
|
|
48
48
|
```
|
|
49
49
|
|