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/cli/index.cjs
CHANGED
|
@@ -698,19 +698,36 @@ async function transferJpyc(kernelClient, params) {
|
|
|
698
698
|
success: receipt.success
|
|
699
699
|
};
|
|
700
700
|
}
|
|
701
|
-
|
|
702
|
-
|
|
701
|
+
function normalizeRecipientAllowlist(allowlist) {
|
|
702
|
+
const seen = /* @__PURE__ */ new Set();
|
|
703
|
+
const normalized = [];
|
|
704
|
+
for (const entry of allowlist) {
|
|
705
|
+
const checksummed = viem.getAddress(entry);
|
|
706
|
+
if (!seen.has(checksummed)) {
|
|
707
|
+
seen.add(checksummed);
|
|
708
|
+
normalized.push(checksummed);
|
|
709
|
+
}
|
|
710
|
+
}
|
|
711
|
+
return normalized;
|
|
712
|
+
}
|
|
713
|
+
|
|
714
|
+
// src/policy/jpyc-call-policy.ts
|
|
715
|
+
function buildJpycTransferCallPolicy(params) {
|
|
703
716
|
if (params.maxPerTransfer <= 0n) {
|
|
717
|
+
throw new Error(`maxPerTransfer must be positive, got ${params.maxPerTransfer}.`);
|
|
718
|
+
}
|
|
719
|
+
const recipients = params.recipientAllowlist === void 0 || params.recipientAllowlist === "any" ? null : normalizeRecipientAllowlist(params.recipientAllowlist);
|
|
720
|
+
if (recipients !== null && recipients.length === 0) {
|
|
704
721
|
throw new Error(
|
|
705
|
-
|
|
722
|
+
'recipientAllowlist must not be empty \u2014 omit it or pass "any" to allow any recipient.'
|
|
706
723
|
);
|
|
707
724
|
}
|
|
708
|
-
if (
|
|
725
|
+
if (recipients !== null && params.callPolicyVersion === policies.CallPolicyVersion.V0_0_1) {
|
|
709
726
|
throw new Error(
|
|
710
|
-
|
|
727
|
+
"recipientAllowlist requires callPolicyVersion V0_0_2 or later (the ONE_OF condition is unsupported on V0_0_1)."
|
|
711
728
|
);
|
|
712
729
|
}
|
|
713
|
-
|
|
730
|
+
return policies.toCallPolicy({
|
|
714
731
|
policyVersion: params.callPolicyVersion ?? policies.CallPolicyVersion.V0_0_4,
|
|
715
732
|
permissions: [
|
|
716
733
|
{
|
|
@@ -718,8 +735,9 @@ function createJpycDailyLimitPolicies(params) {
|
|
|
718
735
|
abi: jpycAbi,
|
|
719
736
|
functionName: "transfer",
|
|
720
737
|
args: [
|
|
721
|
-
// Recipient:
|
|
722
|
-
|
|
738
|
+
// Recipient (`to`): unrestricted (`null`) unless an allowlist resolved
|
|
739
|
+
// above, in which case it is constrained via the ONE_OF condition.
|
|
740
|
+
recipients === null ? null : { condition: policies.ParamCondition.ONE_OF, value: recipients },
|
|
723
741
|
// value: must be ≤ maxPerTransfer.
|
|
724
742
|
{
|
|
725
743
|
condition: policies.ParamCondition.LESS_THAN_OR_EQUAL,
|
|
@@ -729,6 +747,20 @@ function createJpycDailyLimitPolicies(params) {
|
|
|
729
747
|
}
|
|
730
748
|
]
|
|
731
749
|
});
|
|
750
|
+
}
|
|
751
|
+
var ONE_DAY_SECONDS = 86400;
|
|
752
|
+
function createJpycDailyLimitPolicies(params) {
|
|
753
|
+
if (!Number.isInteger(params.maxTransfersPerDay) || params.maxTransfersPerDay < 1) {
|
|
754
|
+
throw new Error(
|
|
755
|
+
`createJpycDailyLimitPolicies: maxTransfersPerDay must be a positive integer, got ${params.maxTransfersPerDay}.`
|
|
756
|
+
);
|
|
757
|
+
}
|
|
758
|
+
const callPolicy = buildJpycTransferCallPolicy({
|
|
759
|
+
jpycAddress: params.jpycAddress,
|
|
760
|
+
maxPerTransfer: params.maxPerTransfer,
|
|
761
|
+
recipientAllowlist: params.recipientAllowlist,
|
|
762
|
+
callPolicyVersion: params.callPolicyVersion
|
|
763
|
+
});
|
|
732
764
|
const rateLimitPolicy = policies.toRateLimitPolicy({
|
|
733
765
|
interval: ONE_DAY_SECONDS,
|
|
734
766
|
count: params.maxTransfersPerDay
|
|
@@ -1643,7 +1675,7 @@ function registerTransferCommand(program2) {
|
|
|
1643
1675
|
}
|
|
1644
1676
|
|
|
1645
1677
|
// cli/index.ts
|
|
1646
|
-
var CLI_VERSION = "0.
|
|
1678
|
+
var CLI_VERSION = "0.7.0" ;
|
|
1647
1679
|
var program = new commander.Command();
|
|
1648
1680
|
program.name("kawasekit").description(
|
|
1649
1681
|
"kawasekit \u2014 CLI for the kawasekit SDK (AI-agent stablecoin payments, Japan-first, JPYC-native)."
|