kawasekit 0.5.0 → 0.6.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-E47SIVFY.js → chunk-X54U6GU4.js} +18 -5
- package/dist/chunk-X54U6GU4.js.map +1 -0
- package/dist/cli/index.cjs +29 -3
- package/dist/cli/index.cjs.map +1 -1
- package/dist/cli/index.js +4 -4
- package/dist/index.cjs +29 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +3 -3
- package/dist/policy/index.cjs +27 -3
- 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.map +0 -1
package/dist/cli/index.js
CHANGED
|
@@ -6,11 +6,11 @@ import '../chunk-LEHWRDVS.js';
|
|
|
6
6
|
import '../chunk-TTX3RBIZ.js';
|
|
7
7
|
import '../chunk-QHUCU5YX.js';
|
|
8
8
|
import { issueSessionKey, serializeSessionEnvelope, restoreSessionAccount, revokeSessionKey, rotateSessionKey, parseSessionEnvelope } from '../chunk-N3CVLISJ.js';
|
|
9
|
-
import '../chunk-
|
|
9
|
+
import '../chunk-NY6VLXQB.js';
|
|
10
10
|
import '../chunk-VJUXTVSW.js';
|
|
11
11
|
import '../chunk-WMVJNPX2.js';
|
|
12
|
-
import { createJpycDailyLimitPolicies } from '../chunk-
|
|
13
|
-
import '../chunk-
|
|
12
|
+
import { createJpycDailyLimitPolicies } from '../chunk-X54U6GU4.js';
|
|
13
|
+
import '../chunk-7YKRKV6D.js';
|
|
14
14
|
import { JPYC_DECIMALS, getJpycAddress, jpycAbi } from '../chunk-KT7XDT2T.js';
|
|
15
15
|
import { zerodevRpcUrl, polygon, polygonAmoy } from '../chunk-SOTYGX67.js';
|
|
16
16
|
import { __commonJS, __require, __toESM } from '../chunk-7D4SUZUM.js';
|
|
@@ -980,7 +980,7 @@ function registerTransferCommand(program2) {
|
|
|
980
980
|
}
|
|
981
981
|
|
|
982
982
|
// cli/index.ts
|
|
983
|
-
var CLI_VERSION = "0.
|
|
983
|
+
var CLI_VERSION = "0.6.0" ;
|
|
984
984
|
var program = new Command();
|
|
985
985
|
program.name("kawasekit").description(
|
|
986
986
|
"kawasekit \u2014 CLI for the kawasekit SDK (AI-agent stablecoin payments, Japan-first, JPYC-native)."
|
package/dist/index.cjs
CHANGED
|
@@ -363,6 +363,20 @@ async function transferJpyc(kernelClient, params) {
|
|
|
363
363
|
success: receipt.success
|
|
364
364
|
};
|
|
365
365
|
}
|
|
366
|
+
function normalizeRecipientAllowlist(allowlist) {
|
|
367
|
+
const seen = /* @__PURE__ */ new Set();
|
|
368
|
+
const normalized = [];
|
|
369
|
+
for (const entry of allowlist) {
|
|
370
|
+
const checksummed = viem.getAddress(entry);
|
|
371
|
+
if (!seen.has(checksummed)) {
|
|
372
|
+
seen.add(checksummed);
|
|
373
|
+
normalized.push(checksummed);
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
return normalized;
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
// src/policy/daily-limit.ts
|
|
366
380
|
var ONE_DAY_SECONDS = 86400;
|
|
367
381
|
function createJpycDailyLimitPolicies(params) {
|
|
368
382
|
if (params.maxPerTransfer <= 0n) {
|
|
@@ -375,6 +389,17 @@ function createJpycDailyLimitPolicies(params) {
|
|
|
375
389
|
`createJpycDailyLimitPolicies: maxTransfersPerDay must be a positive integer, got ${params.maxTransfersPerDay}.`
|
|
376
390
|
);
|
|
377
391
|
}
|
|
392
|
+
const recipients = params.recipientAllowlist === void 0 || params.recipientAllowlist === "any" ? null : normalizeRecipientAllowlist(params.recipientAllowlist);
|
|
393
|
+
if (recipients !== null && recipients.length === 0) {
|
|
394
|
+
throw new Error(
|
|
395
|
+
'createJpycDailyLimitPolicies: recipientAllowlist must not be empty \u2014 omit it or pass "any" to allow any recipient.'
|
|
396
|
+
);
|
|
397
|
+
}
|
|
398
|
+
if (recipients !== null && params.callPolicyVersion === policies.CallPolicyVersion.V0_0_1) {
|
|
399
|
+
throw new Error(
|
|
400
|
+
"createJpycDailyLimitPolicies: recipientAllowlist requires callPolicyVersion V0_0_2 or later (the ONE_OF condition is unsupported on V0_0_1)."
|
|
401
|
+
);
|
|
402
|
+
}
|
|
378
403
|
const callPolicy = policies.toCallPolicy({
|
|
379
404
|
policyVersion: params.callPolicyVersion ?? policies.CallPolicyVersion.V0_0_4,
|
|
380
405
|
permissions: [
|
|
@@ -383,8 +408,9 @@ function createJpycDailyLimitPolicies(params) {
|
|
|
383
408
|
abi: jpycAbi,
|
|
384
409
|
functionName: "transfer",
|
|
385
410
|
args: [
|
|
386
|
-
// Recipient:
|
|
387
|
-
|
|
411
|
+
// Recipient (`to`): unrestricted (`null`) unless an allowlist resolved
|
|
412
|
+
// above, in which case it is constrained via the ONE_OF condition.
|
|
413
|
+
recipients === null ? null : { condition: policies.ParamCondition.ONE_OF, value: recipients },
|
|
388
414
|
// value: must be ≤ maxPerTransfer.
|
|
389
415
|
{
|
|
390
416
|
condition: policies.ParamCondition.LESS_THAN_OR_EQUAL,
|
|
@@ -501,7 +527,7 @@ function createSpendingPolicy(params) {
|
|
|
501
527
|
}
|
|
502
528
|
return { token, maxPerSign: l.maxPerSign };
|
|
503
529
|
});
|
|
504
|
-
const recipientAllowlist = params.recipientAllowlist === "any" ? "any" : params.recipientAllowlist
|
|
530
|
+
const recipientAllowlist = params.recipientAllowlist === "any" ? "any" : normalizeRecipientAllowlist(params.recipientAllowlist);
|
|
505
531
|
return {
|
|
506
532
|
version: "1",
|
|
507
533
|
session: { id: params.session.id, notAfter: params.session.notAfter },
|