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/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-S2ZSX2VS.js';
9
+ import '../chunk-NY6VLXQB.js';
10
10
  import '../chunk-VJUXTVSW.js';
11
11
  import '../chunk-WMVJNPX2.js';
12
- import { createJpycDailyLimitPolicies } from '../chunk-E47SIVFY.js';
13
- import '../chunk-6CNAYQOL.js';
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.5.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: any address allowed (no allowlist in M2).
387
- null,
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.map((a) => viem.getAddress(a));
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 },