kawasekit 0.5.0 → 0.7.0
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/dist/{chunk-6CNAYQOL.js → chunk-7YKRKV6D.js} +18 -4
- package/dist/chunk-7YKRKV6D.js.map +1 -0
- package/dist/{chunk-S2ZSX2VS.js → chunk-NY6VLXQB.js} +3 -3
- package/dist/{chunk-S2ZSX2VS.js.map → chunk-NY6VLXQB.js.map} +1 -1
- package/dist/chunk-UIDDRHLW.js +65 -0
- package/dist/chunk-UIDDRHLW.js.map +1 -0
- package/dist/chunk-Y2LOACWO.js +88 -0
- package/dist/chunk-Y2LOACWO.js.map +1 -0
- package/dist/cli/index.cjs +41 -9
- package/dist/cli/index.cjs.map +1 -1
- package/dist/cli/index.js +5 -5
- package/dist/index.cjs +87 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +78 -3
- package/dist/index.d.ts +78 -3
- package/dist/index.js +4 -4
- package/dist/policy/index.cjs +42 -10
- package/dist/policy/index.cjs.map +1 -1
- package/dist/policy/index.d.cts +41 -3
- package/dist/policy/index.d.ts +41 -3
- package/dist/policy/index.js +2 -2
- package/dist/signer/index.cjs.map +1 -1
- package/dist/signer/index.d.cts +1 -1
- package/dist/signer/index.d.ts +1 -1
- package/dist/signer/index.js +2 -2
- package/dist/{spending-policy-BD2Mpm-L.d.ts → spending-policy-BBgXDrVD.d.ts} +10 -3
- package/dist/{spending-policy-CGIaBpg-.d.cts → spending-policy-CwXcTFD_.d.cts} +10 -3
- package/package.json +1 -1
- package/dist/chunk-6CNAYQOL.js.map +0 -1
- package/dist/chunk-E47SIVFY.js +0 -44
- package/dist/chunk-E47SIVFY.js.map +0 -1
- package/dist/chunk-RJLDKDWL.js +0 -43
- package/dist/chunk-RJLDKDWL.js.map +0 -1
package/dist/policy/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Policy } from '@zerodev/permissions';
|
|
2
2
|
import { CallPolicyVersion } from '@zerodev/permissions/policies';
|
|
3
3
|
import { Address } from 'viem';
|
|
4
|
-
export { C as CreateSpendingPolicyParams, P as PolicyDecision, S as SpendState, a as SpendingPolicy, b as SpendingPolicyConfigError, T as TokenLimit, c as createSpendingPolicy, e as evaluateSpendingPolicy, m as mergeSpendState } from '../spending-policy-
|
|
4
|
+
export { C as CreateSpendingPolicyParams, P as PolicyDecision, S as SpendState, a as SpendingPolicy, b as SpendingPolicyConfigError, T as TokenLimit, c as createSpendingPolicy, e as evaluateSpendingPolicy, m as mergeSpendState } from '../spending-policy-CwXcTFD_.cjs';
|
|
5
5
|
import '../types-BLJU67HZ.cjs';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -9,8 +9,12 @@ import '../types-BLJU67HZ.cjs';
|
|
|
9
9
|
*
|
|
10
10
|
* Composes two ZeroDev policies:
|
|
11
11
|
* 1. **callPolicy** — locks the session key to `JPYC.transfer(to, value)`
|
|
12
|
-
* with `value ≤ maxPerTransfer
|
|
13
|
-
*
|
|
12
|
+
* with `value ≤ maxPerTransfer`, and — when {@link
|
|
13
|
+
* CreateJpycDailyLimitPoliciesParams.recipientAllowlist} is provided —
|
|
14
|
+
* restricts `to` to the allowlisted recipients (otherwise any recipient is
|
|
15
|
+
* allowed). This is the on-chain enforcement behind the "pay only registered
|
|
16
|
+
* merchants" model: a buy-list resolves to its merchants' addresses, which
|
|
17
|
+
* are baked into a disposable session key here.
|
|
14
18
|
* 2. **rateLimitPolicy** — caps userOp count to `maxTransfersPerDay` in any
|
|
15
19
|
* 24-hour rolling window.
|
|
16
20
|
*
|
|
@@ -36,6 +40,29 @@ interface CreateJpycDailyLimitPoliciesParams {
|
|
|
36
40
|
* time of writing). Bump only after auditing the new version's semantics.
|
|
37
41
|
*/
|
|
38
42
|
readonly callPolicyVersion?: CallPolicyVersion;
|
|
43
|
+
/**
|
|
44
|
+
* Recipient restriction. An address list restricts the session key to
|
|
45
|
+
* `transfer` JPYC only to those recipients (enforced on-chain via the
|
|
46
|
+
* callPolicy `to` argument, condition `ONE_OF`); every other recipient is
|
|
47
|
+
* rejected before any funds move. `"any"` (or omitting the field) leaves the
|
|
48
|
+
* recipient unrestricted.
|
|
49
|
+
*
|
|
50
|
+
* The type mirrors the off-chain {@link SpendingPolicy.recipientAllowlist}
|
|
51
|
+
* (`Address[] | "any"`) so a buy-list's resolved allowlist can feed both the
|
|
52
|
+
* off-chain and on-chain policy paths unchanged. Two **deliberate** differences
|
|
53
|
+
* from that sibling, forced by on-chain semantics:
|
|
54
|
+
* - it is **optional** here (omitted = `"any"`) for backward compatibility —
|
|
55
|
+
* the pre-allowlist policy left the recipient unrestricted;
|
|
56
|
+
* - an **empty** array `[]` **throws** (rather than meaning deny-all as it does
|
|
57
|
+
* off-chain) — an on-chain allowlist cannot encode "match nothing"; omit it
|
|
58
|
+
* or pass `"any"` for unrestricted, or list ≥1 recipient.
|
|
59
|
+
*
|
|
60
|
+
* Entries are checksum-normalized and de-duplicated (shared with the off-chain
|
|
61
|
+
* path via {@link normalizeRecipientAllowlist}). An address list requires
|
|
62
|
+
* `callPolicyVersion` ≥ `V0_0_2` (the `ONE_OF` condition is unsupported on
|
|
63
|
+
* `V0_0_1`); the default `V0_0_4` is fine.
|
|
64
|
+
*/
|
|
65
|
+
readonly recipientAllowlist?: readonly Address[] | "any";
|
|
39
66
|
}
|
|
40
67
|
/**
|
|
41
68
|
* Builds the ZeroDev policy bundle that enforces a JPYC daily spend limit.
|
|
@@ -60,6 +87,17 @@ interface CreateJpycDailyLimitPoliciesParams {
|
|
|
60
87
|
* // effective daily cap = 1000 JPYC
|
|
61
88
|
* });
|
|
62
89
|
* ```
|
|
90
|
+
*
|
|
91
|
+
* @example Restrict the session key to a buy-list's merchants only
|
|
92
|
+
* ```ts
|
|
93
|
+
* const policies = createJpycDailyLimitPolicies({
|
|
94
|
+
* jpycAddress: getJpycAddress(polygonAmoy.id),
|
|
95
|
+
* maxPerTransfer: parseUnits("100", JPYC_DECIMALS),
|
|
96
|
+
* maxTransfersPerDay: 5,
|
|
97
|
+
* // on-chain: any transfer to a non-allowlisted address reverts before funds move
|
|
98
|
+
* recipientAllowlist: [merchantA, merchantB],
|
|
99
|
+
* });
|
|
100
|
+
* ```
|
|
63
101
|
*/
|
|
64
102
|
declare function createJpycDailyLimitPolicies(params: CreateJpycDailyLimitPoliciesParams): readonly [Policy, Policy];
|
|
65
103
|
|
package/dist/policy/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Policy } from '@zerodev/permissions';
|
|
2
2
|
import { CallPolicyVersion } from '@zerodev/permissions/policies';
|
|
3
3
|
import { Address } from 'viem';
|
|
4
|
-
export { C as CreateSpendingPolicyParams, P as PolicyDecision, S as SpendState, a as SpendingPolicy, b as SpendingPolicyConfigError, T as TokenLimit, c as createSpendingPolicy, e as evaluateSpendingPolicy, m as mergeSpendState } from '../spending-policy-
|
|
4
|
+
export { C as CreateSpendingPolicyParams, P as PolicyDecision, S as SpendState, a as SpendingPolicy, b as SpendingPolicyConfigError, T as TokenLimit, c as createSpendingPolicy, e as evaluateSpendingPolicy, m as mergeSpendState } from '../spending-policy-BBgXDrVD.js';
|
|
5
5
|
import '../types-BLJU67HZ.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -9,8 +9,12 @@ import '../types-BLJU67HZ.js';
|
|
|
9
9
|
*
|
|
10
10
|
* Composes two ZeroDev policies:
|
|
11
11
|
* 1. **callPolicy** — locks the session key to `JPYC.transfer(to, value)`
|
|
12
|
-
* with `value ≤ maxPerTransfer
|
|
13
|
-
*
|
|
12
|
+
* with `value ≤ maxPerTransfer`, and — when {@link
|
|
13
|
+
* CreateJpycDailyLimitPoliciesParams.recipientAllowlist} is provided —
|
|
14
|
+
* restricts `to` to the allowlisted recipients (otherwise any recipient is
|
|
15
|
+
* allowed). This is the on-chain enforcement behind the "pay only registered
|
|
16
|
+
* merchants" model: a buy-list resolves to its merchants' addresses, which
|
|
17
|
+
* are baked into a disposable session key here.
|
|
14
18
|
* 2. **rateLimitPolicy** — caps userOp count to `maxTransfersPerDay` in any
|
|
15
19
|
* 24-hour rolling window.
|
|
16
20
|
*
|
|
@@ -36,6 +40,29 @@ interface CreateJpycDailyLimitPoliciesParams {
|
|
|
36
40
|
* time of writing). Bump only after auditing the new version's semantics.
|
|
37
41
|
*/
|
|
38
42
|
readonly callPolicyVersion?: CallPolicyVersion;
|
|
43
|
+
/**
|
|
44
|
+
* Recipient restriction. An address list restricts the session key to
|
|
45
|
+
* `transfer` JPYC only to those recipients (enforced on-chain via the
|
|
46
|
+
* callPolicy `to` argument, condition `ONE_OF`); every other recipient is
|
|
47
|
+
* rejected before any funds move. `"any"` (or omitting the field) leaves the
|
|
48
|
+
* recipient unrestricted.
|
|
49
|
+
*
|
|
50
|
+
* The type mirrors the off-chain {@link SpendingPolicy.recipientAllowlist}
|
|
51
|
+
* (`Address[] | "any"`) so a buy-list's resolved allowlist can feed both the
|
|
52
|
+
* off-chain and on-chain policy paths unchanged. Two **deliberate** differences
|
|
53
|
+
* from that sibling, forced by on-chain semantics:
|
|
54
|
+
* - it is **optional** here (omitted = `"any"`) for backward compatibility —
|
|
55
|
+
* the pre-allowlist policy left the recipient unrestricted;
|
|
56
|
+
* - an **empty** array `[]` **throws** (rather than meaning deny-all as it does
|
|
57
|
+
* off-chain) — an on-chain allowlist cannot encode "match nothing"; omit it
|
|
58
|
+
* or pass `"any"` for unrestricted, or list ≥1 recipient.
|
|
59
|
+
*
|
|
60
|
+
* Entries are checksum-normalized and de-duplicated (shared with the off-chain
|
|
61
|
+
* path via {@link normalizeRecipientAllowlist}). An address list requires
|
|
62
|
+
* `callPolicyVersion` ≥ `V0_0_2` (the `ONE_OF` condition is unsupported on
|
|
63
|
+
* `V0_0_1`); the default `V0_0_4` is fine.
|
|
64
|
+
*/
|
|
65
|
+
readonly recipientAllowlist?: readonly Address[] | "any";
|
|
39
66
|
}
|
|
40
67
|
/**
|
|
41
68
|
* Builds the ZeroDev policy bundle that enforces a JPYC daily spend limit.
|
|
@@ -60,6 +87,17 @@ interface CreateJpycDailyLimitPoliciesParams {
|
|
|
60
87
|
* // effective daily cap = 1000 JPYC
|
|
61
88
|
* });
|
|
62
89
|
* ```
|
|
90
|
+
*
|
|
91
|
+
* @example Restrict the session key to a buy-list's merchants only
|
|
92
|
+
* ```ts
|
|
93
|
+
* const policies = createJpycDailyLimitPolicies({
|
|
94
|
+
* jpycAddress: getJpycAddress(polygonAmoy.id),
|
|
95
|
+
* maxPerTransfer: parseUnits("100", JPYC_DECIMALS),
|
|
96
|
+
* maxTransfersPerDay: 5,
|
|
97
|
+
* // on-chain: any transfer to a non-allowlisted address reverts before funds move
|
|
98
|
+
* recipientAllowlist: [merchantA, merchantB],
|
|
99
|
+
* });
|
|
100
|
+
* ```
|
|
63
101
|
*/
|
|
64
102
|
declare function createJpycDailyLimitPolicies(params: CreateJpycDailyLimitPoliciesParams): readonly [Policy, Policy];
|
|
65
103
|
|
package/dist/policy/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { ONE_DAY_SECONDS, createJpycDailyLimitPolicies } from '../chunk-
|
|
2
|
-
export { SpendingPolicyConfigError, createSpendingPolicy, evaluateSpendingPolicy, mergeSpendState } from '../chunk-
|
|
1
|
+
export { ONE_DAY_SECONDS, createJpycDailyLimitPolicies } from '../chunk-UIDDRHLW.js';
|
|
2
|
+
export { SpendingPolicyConfigError, createSpendingPolicy, evaluateSpendingPolicy, mergeSpendState } from '../chunk-7YKRKV6D.js';
|
|
3
3
|
import '../chunk-KT7XDT2T.js';
|
|
4
4
|
import '../chunk-SOTYGX67.js';
|
|
5
5
|
import '../chunk-7D4SUZUM.js';
|