kawasekit 0.1.0-beta.6 → 0.2.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.
Files changed (46) hide show
  1. package/dist/asset-domain-4Ioxqn28.d.cts +348 -0
  2. package/dist/asset-domain-4Ioxqn28.d.ts +348 -0
  3. package/dist/{chunk-YMABXRCK.js → chunk-6CNAYQOL.js} +2 -2
  4. package/dist/chunk-6CNAYQOL.js.map +1 -0
  5. package/dist/{chunk-E2EG72U2.js → chunk-SMAZUZFO.js} +4 -9
  6. package/dist/chunk-SMAZUZFO.js.map +1 -0
  7. package/dist/{chunk-RUWCCP37.js → chunk-THTVJZ2Q.js} +5 -10
  8. package/dist/chunk-THTVJZ2Q.js.map +1 -0
  9. package/dist/{chunk-VPRR3TNA.js → chunk-VXZHS74W.js} +59 -51
  10. package/dist/chunk-VXZHS74W.js.map +1 -0
  11. package/dist/{chunk-UQ7WJY6O.js → chunk-XRSZTZVZ.js} +2 -2
  12. package/dist/{chunk-UQ7WJY6O.js.map → chunk-XRSZTZVZ.js.map} +1 -1
  13. package/dist/cli/index.cjs +1 -1
  14. package/dist/cli/index.cjs.map +1 -1
  15. package/dist/cli/index.js +6 -6
  16. package/dist/cli/index.js.map +1 -1
  17. package/dist/{index-Z6AL1MR_.d.cts → index-Cn6kg7KH.d.cts} +1 -1
  18. package/dist/{index-BaAOB0xd.d.ts → index-f-Xg86P9.d.ts} +1 -1
  19. package/dist/index.cjs +14 -12
  20. package/dist/index.cjs.map +1 -1
  21. package/dist/index.d.cts +5 -170
  22. package/dist/index.d.ts +5 -170
  23. package/dist/index.js +5 -5
  24. package/dist/policy/index.cjs.map +1 -1
  25. package/dist/policy/index.d.cts +1 -1
  26. package/dist/policy/index.d.ts +1 -1
  27. package/dist/policy/index.js +1 -1
  28. package/dist/signer/index.cjs +9 -6
  29. package/dist/signer/index.cjs.map +1 -1
  30. package/dist/signer/index.d.cts +2 -2
  31. package/dist/signer/index.d.ts +2 -2
  32. package/dist/signer/index.js +3 -3
  33. package/dist/{spending-policy-DZSNHqnD.d.ts → spending-policy-DKZN3Sg8.d.ts} +3 -2
  34. package/dist/{spending-policy-DqBRDUxx.d.cts → spending-policy-DaajDg9B.d.cts} +3 -2
  35. package/dist/x402/index.cjs +9 -6
  36. package/dist/x402/index.cjs.map +1 -1
  37. package/dist/x402/index.d.cts +2 -2
  38. package/dist/x402/index.d.ts +2 -2
  39. package/dist/x402/index.js +2 -2
  40. package/package.json +1 -1
  41. package/dist/asset-domain-CpJuDkI2.d.cts +0 -102
  42. package/dist/asset-domain-CpJuDkI2.d.ts +0 -102
  43. package/dist/chunk-E2EG72U2.js.map +0 -1
  44. package/dist/chunk-RUWCCP37.js.map +0 -1
  45. package/dist/chunk-VPRR3TNA.js.map +0 -1
  46. package/dist/chunk-YMABXRCK.js.map +0 -1
package/dist/index.d.cts CHANGED
@@ -2,16 +2,16 @@ import { Policy } from '@zerodev/permissions';
2
2
  import { CreateKernelAccountReturnType } from '@zerodev/sdk';
3
3
  import { EntryPointType, GetKernelVersion } from '@zerodev/sdk/types';
4
4
  import * as viem from 'viem';
5
- import { PublicClient, Transport, Chain, LocalAccount, Address, Hex, Account } from 'viem';
5
+ import { PublicClient, Transport, Chain, LocalAccount, Address } from 'viem';
6
6
  import { S as SupportedChainId } from './index-2fEOL83n.cjs';
7
7
  export { C as ChainNotSupportedError, g as getChain, i as isSupportedChainId, s as supportedChains } from './index-2fEOL83n.cjs';
8
8
  export { C as ConfiguredKernelClient, I as IssueSessionKeyParams, K as KAWASEKIT_SESSION_ENVELOPE_VERSION, a as KawasekitSessionEnvelope, b as KawasekitSessionEnvelopeVersion, c as KawasekitSessionPolicySummary, R as RestoreSessionAccountParams, d as RevokeSessionKeyParams, e as RevokeSessionKeyResult, f as RotateSessionKeyParams, g as RotateSessionKeyResult, S as SessionEnvelopeChainMismatchError, h as SessionEnvelopeParseError, i as SessionEnvelopeSignerMismatchError, j as SessionEnvelopeVersionError, T as TransferJpycInputError, k as TransferJpycParams, l as TransferJpycResult, m as issueSessionKey, p as parseSessionEnvelope, r as restoreSessionAccount, n as revokeSessionKey, o as rotateSessionKey, s as serializeSessionEnvelope, t as transferJpyc } from './index-DFChv_fT.cjs';
9
9
  export { CreateJpycDailyLimitPoliciesParams, ONE_DAY_SECONDS, createJpycDailyLimitPolicies } from './policy/index.cjs';
10
- 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-DqBRDUxx.cjs';
10
+ 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-DaajDg9B.cjs';
11
11
  export { CreateLocalPolicyGatedSignerParams, PolicyGatedSignerConfigError, assertNonBypassable, createLocalPolicyGatedSigner, requireNonBypassable } from './signer/index.cjs';
12
12
  export { E as EnforcementLevel, N as NonBypassableEnforcement, P as PaymentIntent, a as PolicyGatedSigner, b as PolicyRejection, S as SignResult, c as SignerDescription } from './types-IEl-iOIx.cjs';
13
- export { K as KnownAssetDomain, a as KnownAssetId, X as X402AssetParam, b as X402TokenDomain, g as getKnownAssetDomain, l as listKnownAssetIds } from './asset-domain-CpJuDkI2.cjs';
14
- export { B as BuildPaymentRequiredResponseParams, a as BuildPaymentRequirementsParams, C as CreateCoinbaseFacilitatorParams, b as CreateHttpFacilitatorParams, c as CreateSelfFacilitatorParams, d as CreateX402PaymentSignerParams, K as KawaseChain, S as SignX402PaymentParams, W as WrapFetchParams, X as X402Fetch, e as X402InvalidConfigError, f as X402InvalidPayloadError, g as X402PaymentSigner, h as X402PolicyRejectedError, i as X402_DEFAULT_AUTHORIZATION_LIFETIME_SECONDS, j as X402_DEFAULT_MAX_TIMEOUT_SECONDS, k as X402_FACILITATOR_ERROR_CODES, l as X402_HEADER_IDEMPOTENCY_KEY, m as X402_HEADER_PAYMENT_REQUIRED, n as X402_HEADER_PAYMENT_RESPONSE, o as X402_HEADER_PAYMENT_SIGNATURE, p as buildPaymentRequiredResponse, q as buildPaymentRequirements, r as createCoinbaseFacilitator, s as createHttpFacilitator, t as createSelfFacilitator, u as createX402PaymentSigner, v as decodePaymentRequiredHeader, w as decodePaymentResponseHeader, x as decodePaymentSignatureHeader, y as deriveReceiptTimeoutMs, z as encodePaymentRequiredHeader, A as encodePaymentResponseHeader, D as encodePaymentSignatureHeader, E as wrapFetch, F as zerodevRpcUrl } from './index-Z6AL1MR_.cjs';
13
+ export { C as CancelAuthorizationMessage, E as Eip3009Domain, K as KnownAssetDomain, a as KnownAssetId, R as ReceiveWithAuthorizationMessage, b as ResolvedAsset, S as SignedAuthorization, T as TransferWithAuthorizationMessage, X as X402AssetParam, c as X402TokenDomain, d as authorizationDeadlineFromNow, e as cancelAuthorizationTypes, f as deriveAuthorizationNonce, g as generateAuthorizationNonce, h as getKnownAssetDomain, l as listKnownAssetIds, r as receiveWithAuthorizationTypes, i as resolvedAssetToEip3009Domain, s as signCancelAuthorization, j as signReceiveWithAuthorization, k as signTransferWithAuthorization, t as transferWithAuthorizationTypes } from './asset-domain-4Ioxqn28.cjs';
14
+ export { B as BuildPaymentRequiredResponseParams, a as BuildPaymentRequirementsParams, C as CreateCoinbaseFacilitatorParams, b as CreateHttpFacilitatorParams, c as CreateSelfFacilitatorParams, d as CreateX402PaymentSignerParams, K as KawaseChain, S as SignX402PaymentParams, W as WrapFetchParams, X as X402Fetch, e as X402InvalidConfigError, f as X402InvalidPayloadError, g as X402PaymentSigner, h as X402PolicyRejectedError, i as X402_DEFAULT_AUTHORIZATION_LIFETIME_SECONDS, j as X402_DEFAULT_MAX_TIMEOUT_SECONDS, k as X402_FACILITATOR_ERROR_CODES, l as X402_HEADER_IDEMPOTENCY_KEY, m as X402_HEADER_PAYMENT_REQUIRED, n as X402_HEADER_PAYMENT_RESPONSE, o as X402_HEADER_PAYMENT_SIGNATURE, p as buildPaymentRequiredResponse, q as buildPaymentRequirements, r as createCoinbaseFacilitator, s as createHttpFacilitator, t as createSelfFacilitator, u as createX402PaymentSigner, v as decodePaymentRequiredHeader, w as decodePaymentResponseHeader, x as decodePaymentSignatureHeader, y as deriveReceiptTimeoutMs, z as encodePaymentRequiredHeader, A as encodePaymentResponseHeader, D as encodePaymentSignatureHeader, E as wrapFetch, F as zerodevRpcUrl } from './index-Cn6kg7KH.cjs';
15
15
  export { C as CreateX402HandlerParams, I as IdempotencyServerConfig, X as X402HandlerContext, a as X402InnerHandler, b as X402RequestHandler, c as createX402Handler } from './server-ov8YstNS.cjs';
16
16
  export { F as Facilitator, X as X402AssetTransferMethod, a as X402ExactEvmAuthorization, b as X402ExactEvmExtra, c as X402ExactEvmPayload, d as X402Network, e as X402PaymentPayload, f as X402PaymentRequiredResponse, g as X402PaymentRequirements, h as X402ResourceInfo, i as X402Scheme, j as X402SettleRequest, k as X402SettleResponse, l as X402SettlementResponse, m as X402SupportedKind, n as X402SupportedResponse, o as X402VerifyRequest, p as X402VerifyResponse, q as X402Version, r as X402_VERSION, s as chainIdToX402Network, t as isX402Network, x as x402NetworkToChainId } from './types-TpS_8ztt.cjs';
17
17
  export { ClientPaymentEvent, HookCallback, ObservabilityEvent, ObservabilityEventBase, ObservabilityHooks, PaymentAcceptedEvent, PaymentRequiredEvent, SettleEvent, VerifyEvent, extractAcceptedNetworks, invokeHookSafely } from './observability/index.cjs';
@@ -553,171 +553,6 @@ declare const polygonAmoy: {
553
553
  verifyHash?: ((client: viem.Client, parameters: viem.VerifyHashActionParameters) => Promise<viem.VerifyHashActionReturnType>) | undefined;
554
554
  };
555
555
 
556
- /**
557
- * EIP-3009 typed-data builders and signing helpers.
558
- *
559
- * Token-agnostic: works for any EIP-3009-compliant token (JPYC, USDC, USDP,
560
- * Centre FiatToken family). Pure off-chain construction — no chain RPC, no
561
- * submission. Submission is the caller's job (M3 x402 flow, or arbitrary
562
- * gas-paying relayer).
563
- *
564
- * @packageDocumentation
565
- */
566
-
567
- /**
568
- * EIP-712 domain for an EIP-3009-compliant token.
569
- *
570
- * `name` and `version` MUST match the values the token used when computing
571
- * its `DOMAIN_SEPARATOR`. For JPYC see {@link JPYC_EIP712_DOMAIN_HINT}.
572
- */
573
- interface Eip3009Domain {
574
- readonly name: string;
575
- readonly version: string;
576
- readonly chainId: number;
577
- readonly verifyingContract: Address;
578
- }
579
- /** Message body for {@link signTransferWithAuthorization}. */
580
- interface TransferWithAuthorizationMessage {
581
- readonly from: Address;
582
- readonly to: Address;
583
- readonly value: bigint;
584
- readonly validAfter: bigint;
585
- readonly validBefore: bigint;
586
- /** 32-byte random nonce. Generate with {@link generateAuthorizationNonce}. */
587
- readonly nonce: Hex;
588
- }
589
- /** Message body for {@link signReceiveWithAuthorization}. */
590
- type ReceiveWithAuthorizationMessage = TransferWithAuthorizationMessage;
591
- /** Message body for {@link signCancelAuthorization}. */
592
- interface CancelAuthorizationMessage {
593
- readonly authorizer: Address;
594
- readonly nonce: Hex;
595
- }
596
- /**
597
- * A signed EIP-3009 authorization, ready to be passed to the token's
598
- * `*WithAuthorization` entrypoint as `(v, r, s)`.
599
- */
600
- interface SignedAuthorization<TMessage> {
601
- readonly signature: Hex;
602
- readonly v: number;
603
- readonly r: Hex;
604
- readonly s: Hex;
605
- readonly domain: Eip3009Domain;
606
- readonly message: TMessage;
607
- }
608
- /**
609
- * Generates a cryptographically random 32-byte EIP-3009 nonce.
610
- *
611
- * The nonce only needs to be unique per `(authorizer, contract)` — duplicates
612
- * across different tokens are harmless because the contract scopes them.
613
- *
614
- * @example
615
- * ```ts
616
- * import { generateAuthorizationNonce } from "kawasekit";
617
- *
618
- * const nonce = generateAuthorizationNonce();
619
- * ```
620
- */
621
- declare function generateAuthorizationNonce(): Hex;
622
- /**
623
- * Derives a **deterministic** 32-byte EIP-3009 nonce from a reasoning-step
624
- * idempotency key, scoped to `(from, verifyingContract, chainId)` so the same
625
- * key never collides across tokens or chains (M5-1, Half B).
626
- *
627
- * `nonce = keccak256(DOMAIN_TAG ‖ idempotencyKey ‖ from ‖ verifyingContract ‖
628
- * chainId)`. **No shared secret**: determinism across replicas / sub-agents
629
- * needs only a shared `conversationId` (the source of the key), not secret
630
- * distribution. A replayed key ⇒ identical nonce ⇒ the token contract's
631
- * `authorizationState` rejects the second settlement — the on-chain last line of
632
- * defence against re-signed same-intent duplicate payments. Use in place of
633
- * {@link generateAuthorizationNonce} only when a key is available.
634
- *
635
- * `chainId` is in the preimage, so the same JPYC address on Polygon / Avalanche
636
- * / Kaia / Ethereum yields distinct nonces (cross-chain replay safety).
637
- *
638
- * @example
639
- * ```ts
640
- * import { deriveAuthorizationNonce } from "kawasekit";
641
- *
642
- * const nonce = deriveAuthorizationNonce(
643
- * { idempotencyKey },
644
- * { from: account.address, verifyingContract, chainId },
645
- * );
646
- * ```
647
- */
648
- declare function deriveAuthorizationNonce(input: {
649
- readonly idempotencyKey: string;
650
- }, scope: {
651
- readonly from: Address;
652
- readonly verifyingContract: Address;
653
- readonly chainId: number;
654
- }): Hex;
655
- /**
656
- * Returns a `validBefore` UNIX timestamp `seconds` in the future.
657
- *
658
- * @param seconds - Lifetime of the authorization, in seconds.
659
- * @param nowSec - Optional override of "now" (defaults to {@link Date.now}).
660
- *
661
- * @example
662
- * ```ts
663
- * import { authorizationDeadlineFromNow } from "kawasekit";
664
- *
665
- * const validBefore = authorizationDeadlineFromNow(60 * 5); // 5 minutes
666
- * ```
667
- */
668
- declare function authorizationDeadlineFromNow(seconds: number, nowSec?: bigint): bigint;
669
- /**
670
- * Signs an EIP-3009 `TransferWithAuthorization` message.
671
- *
672
- * The signing account MUST equal `message.from` — EIP-3009 rejects signatures
673
- * from anyone else (the on-chain check is pure `ecrecover` against `from`).
674
- *
675
- * @example
676
- * ```ts
677
- * import { privateKeyToAccount } from "viem/accounts";
678
- * import {
679
- * authorizationDeadlineFromNow,
680
- * generateAuthorizationNonce,
681
- * JPYC_EIP712_DOMAIN_HINT,
682
- * polygon,
683
- * signTransferWithAuthorization,
684
- * } from "kawasekit";
685
- *
686
- * const account = privateKeyToAccount("0x...");
687
- * const signed = await signTransferWithAuthorization(account, {
688
- * ...JPYC_EIP712_DOMAIN_HINT,
689
- * chainId: polygon.id,
690
- * verifyingContract: "0xE7C3D8C9a439feDe00D2600032D5dB0Be71C3c29",
691
- * }, {
692
- * from: account.address,
693
- * to: "0xBeef...",
694
- * value: 100n * 10n ** 18n,
695
- * validAfter: 0n,
696
- * validBefore: authorizationDeadlineFromNow(300),
697
- * nonce: generateAuthorizationNonce(),
698
- * });
699
- * // → submit (v, r, s) to token.transferWithAuthorization(...)
700
- * ```
701
- */
702
- declare function signTransferWithAuthorization(account: Account, domain: Eip3009Domain, message: TransferWithAuthorizationMessage): Promise<SignedAuthorization<TransferWithAuthorizationMessage>>;
703
- /**
704
- * Signs an EIP-3009 `ReceiveWithAuthorization` message.
705
- *
706
- * Differs from {@link signTransferWithAuthorization} in two ways:
707
- * 1. Uses the `ReceiveWithAuthorization` EIP-712 type.
708
- * 2. The contract additionally enforces `msg.sender == to` at submission
709
- * time, so only `to` (or a relayer impersonating `to` — impossible in
710
- * practice) can land the tx.
711
- */
712
- declare function signReceiveWithAuthorization(account: Account, domain: Eip3009Domain, message: ReceiveWithAuthorizationMessage): Promise<SignedAuthorization<ReceiveWithAuthorizationMessage>>;
713
- /**
714
- * Signs an EIP-3009 `CancelAuthorization` message.
715
- *
716
- * Cancelling consumes the nonce so a later `transferWithAuthorization` or
717
- * `receiveWithAuthorization` with the same nonce will revert.
718
- */
719
- declare function signCancelAuthorization(account: Account, domain: Eip3009Domain, message: CancelAuthorizationMessage): Promise<SignedAuthorization<CancelAuthorizationMessage>>;
720
-
721
556
  /**
722
557
  * JPYC stablecoin metadata, deployments, and ABI.
723
558
  *
@@ -1084,4 +919,4 @@ declare const jpycAbi: readonly [{
1084
919
  }];
1085
920
  }];
1086
921
 
1087
- export { type CancelAuthorizationMessage, type CreateAgentSmartAccountParams, type Eip3009Domain, JPYC_DECIMALS, JPYC_EIP712_DOMAIN_HINT, JPYC_V2_ADDRESS, type JpycDeployment, JpycNotAvailableError, type ReceiveWithAuthorizationMessage, type SignedAuthorization, SupportedChainId, type TransferWithAuthorizationMessage, authorizationDeadlineFromNow, avalanche, avalancheFuji, createAgentSmartAccount, deriveAuthorizationNonce, ethereum, generateAuthorizationNonce, getJpycAddress, jpycAbi, jpycDeployments, kaia, kairos, polygon, polygonAmoy, sepolia, signCancelAuthorization, signReceiveWithAuthorization, signTransferWithAuthorization };
922
+ export { type CreateAgentSmartAccountParams, JPYC_DECIMALS, JPYC_EIP712_DOMAIN_HINT, JPYC_V2_ADDRESS, type JpycDeployment, JpycNotAvailableError, SupportedChainId, avalanche, avalancheFuji, createAgentSmartAccount, ethereum, getJpycAddress, jpycAbi, jpycDeployments, kaia, kairos, polygon, polygonAmoy, sepolia };
package/dist/index.d.ts CHANGED
@@ -2,16 +2,16 @@ import { Policy } from '@zerodev/permissions';
2
2
  import { CreateKernelAccountReturnType } from '@zerodev/sdk';
3
3
  import { EntryPointType, GetKernelVersion } from '@zerodev/sdk/types';
4
4
  import * as viem from 'viem';
5
- import { PublicClient, Transport, Chain, LocalAccount, Address, Hex, Account } from 'viem';
5
+ import { PublicClient, Transport, Chain, LocalAccount, Address } from 'viem';
6
6
  import { S as SupportedChainId } from './index-2fEOL83n.js';
7
7
  export { C as ChainNotSupportedError, g as getChain, i as isSupportedChainId, s as supportedChains } from './index-2fEOL83n.js';
8
8
  export { C as ConfiguredKernelClient, I as IssueSessionKeyParams, K as KAWASEKIT_SESSION_ENVELOPE_VERSION, a as KawasekitSessionEnvelope, b as KawasekitSessionEnvelopeVersion, c as KawasekitSessionPolicySummary, R as RestoreSessionAccountParams, d as RevokeSessionKeyParams, e as RevokeSessionKeyResult, f as RotateSessionKeyParams, g as RotateSessionKeyResult, S as SessionEnvelopeChainMismatchError, h as SessionEnvelopeParseError, i as SessionEnvelopeSignerMismatchError, j as SessionEnvelopeVersionError, T as TransferJpycInputError, k as TransferJpycParams, l as TransferJpycResult, m as issueSessionKey, p as parseSessionEnvelope, r as restoreSessionAccount, n as revokeSessionKey, o as rotateSessionKey, s as serializeSessionEnvelope, t as transferJpyc } from './index-CSpNGigO.js';
9
9
  export { CreateJpycDailyLimitPoliciesParams, ONE_DAY_SECONDS, createJpycDailyLimitPolicies } from './policy/index.js';
10
- 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-DZSNHqnD.js';
10
+ 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-DKZN3Sg8.js';
11
11
  export { CreateLocalPolicyGatedSignerParams, PolicyGatedSignerConfigError, assertNonBypassable, createLocalPolicyGatedSigner, requireNonBypassable } from './signer/index.js';
12
12
  export { E as EnforcementLevel, N as NonBypassableEnforcement, P as PaymentIntent, a as PolicyGatedSigner, b as PolicyRejection, S as SignResult, c as SignerDescription } from './types-IEl-iOIx.js';
13
- export { K as KnownAssetDomain, a as KnownAssetId, X as X402AssetParam, b as X402TokenDomain, g as getKnownAssetDomain, l as listKnownAssetIds } from './asset-domain-CpJuDkI2.js';
14
- export { B as BuildPaymentRequiredResponseParams, a as BuildPaymentRequirementsParams, C as CreateCoinbaseFacilitatorParams, b as CreateHttpFacilitatorParams, c as CreateSelfFacilitatorParams, d as CreateX402PaymentSignerParams, K as KawaseChain, S as SignX402PaymentParams, W as WrapFetchParams, X as X402Fetch, e as X402InvalidConfigError, f as X402InvalidPayloadError, g as X402PaymentSigner, h as X402PolicyRejectedError, i as X402_DEFAULT_AUTHORIZATION_LIFETIME_SECONDS, j as X402_DEFAULT_MAX_TIMEOUT_SECONDS, k as X402_FACILITATOR_ERROR_CODES, l as X402_HEADER_IDEMPOTENCY_KEY, m as X402_HEADER_PAYMENT_REQUIRED, n as X402_HEADER_PAYMENT_RESPONSE, o as X402_HEADER_PAYMENT_SIGNATURE, p as buildPaymentRequiredResponse, q as buildPaymentRequirements, r as createCoinbaseFacilitator, s as createHttpFacilitator, t as createSelfFacilitator, u as createX402PaymentSigner, v as decodePaymentRequiredHeader, w as decodePaymentResponseHeader, x as decodePaymentSignatureHeader, y as deriveReceiptTimeoutMs, z as encodePaymentRequiredHeader, A as encodePaymentResponseHeader, D as encodePaymentSignatureHeader, E as wrapFetch, F as zerodevRpcUrl } from './index-BaAOB0xd.js';
13
+ export { C as CancelAuthorizationMessage, E as Eip3009Domain, K as KnownAssetDomain, a as KnownAssetId, R as ReceiveWithAuthorizationMessage, b as ResolvedAsset, S as SignedAuthorization, T as TransferWithAuthorizationMessage, X as X402AssetParam, c as X402TokenDomain, d as authorizationDeadlineFromNow, e as cancelAuthorizationTypes, f as deriveAuthorizationNonce, g as generateAuthorizationNonce, h as getKnownAssetDomain, l as listKnownAssetIds, r as receiveWithAuthorizationTypes, i as resolvedAssetToEip3009Domain, s as signCancelAuthorization, j as signReceiveWithAuthorization, k as signTransferWithAuthorization, t as transferWithAuthorizationTypes } from './asset-domain-4Ioxqn28.js';
14
+ export { B as BuildPaymentRequiredResponseParams, a as BuildPaymentRequirementsParams, C as CreateCoinbaseFacilitatorParams, b as CreateHttpFacilitatorParams, c as CreateSelfFacilitatorParams, d as CreateX402PaymentSignerParams, K as KawaseChain, S as SignX402PaymentParams, W as WrapFetchParams, X as X402Fetch, e as X402InvalidConfigError, f as X402InvalidPayloadError, g as X402PaymentSigner, h as X402PolicyRejectedError, i as X402_DEFAULT_AUTHORIZATION_LIFETIME_SECONDS, j as X402_DEFAULT_MAX_TIMEOUT_SECONDS, k as X402_FACILITATOR_ERROR_CODES, l as X402_HEADER_IDEMPOTENCY_KEY, m as X402_HEADER_PAYMENT_REQUIRED, n as X402_HEADER_PAYMENT_RESPONSE, o as X402_HEADER_PAYMENT_SIGNATURE, p as buildPaymentRequiredResponse, q as buildPaymentRequirements, r as createCoinbaseFacilitator, s as createHttpFacilitator, t as createSelfFacilitator, u as createX402PaymentSigner, v as decodePaymentRequiredHeader, w as decodePaymentResponseHeader, x as decodePaymentSignatureHeader, y as deriveReceiptTimeoutMs, z as encodePaymentRequiredHeader, A as encodePaymentResponseHeader, D as encodePaymentSignatureHeader, E as wrapFetch, F as zerodevRpcUrl } from './index-f-Xg86P9.js';
15
15
  export { C as CreateX402HandlerParams, I as IdempotencyServerConfig, X as X402HandlerContext, a as X402InnerHandler, b as X402RequestHandler, c as createX402Handler } from './server-D_rZc-cW.js';
16
16
  export { F as Facilitator, X as X402AssetTransferMethod, a as X402ExactEvmAuthorization, b as X402ExactEvmExtra, c as X402ExactEvmPayload, d as X402Network, e as X402PaymentPayload, f as X402PaymentRequiredResponse, g as X402PaymentRequirements, h as X402ResourceInfo, i as X402Scheme, j as X402SettleRequest, k as X402SettleResponse, l as X402SettlementResponse, m as X402SupportedKind, n as X402SupportedResponse, o as X402VerifyRequest, p as X402VerifyResponse, q as X402Version, r as X402_VERSION, s as chainIdToX402Network, t as isX402Network, x as x402NetworkToChainId } from './types-BR9UcvJO.js';
17
17
  export { ClientPaymentEvent, HookCallback, ObservabilityEvent, ObservabilityEventBase, ObservabilityHooks, PaymentAcceptedEvent, PaymentRequiredEvent, SettleEvent, VerifyEvent, extractAcceptedNetworks, invokeHookSafely } from './observability/index.js';
@@ -553,171 +553,6 @@ declare const polygonAmoy: {
553
553
  verifyHash?: ((client: viem.Client, parameters: viem.VerifyHashActionParameters) => Promise<viem.VerifyHashActionReturnType>) | undefined;
554
554
  };
555
555
 
556
- /**
557
- * EIP-3009 typed-data builders and signing helpers.
558
- *
559
- * Token-agnostic: works for any EIP-3009-compliant token (JPYC, USDC, USDP,
560
- * Centre FiatToken family). Pure off-chain construction — no chain RPC, no
561
- * submission. Submission is the caller's job (M3 x402 flow, or arbitrary
562
- * gas-paying relayer).
563
- *
564
- * @packageDocumentation
565
- */
566
-
567
- /**
568
- * EIP-712 domain for an EIP-3009-compliant token.
569
- *
570
- * `name` and `version` MUST match the values the token used when computing
571
- * its `DOMAIN_SEPARATOR`. For JPYC see {@link JPYC_EIP712_DOMAIN_HINT}.
572
- */
573
- interface Eip3009Domain {
574
- readonly name: string;
575
- readonly version: string;
576
- readonly chainId: number;
577
- readonly verifyingContract: Address;
578
- }
579
- /** Message body for {@link signTransferWithAuthorization}. */
580
- interface TransferWithAuthorizationMessage {
581
- readonly from: Address;
582
- readonly to: Address;
583
- readonly value: bigint;
584
- readonly validAfter: bigint;
585
- readonly validBefore: bigint;
586
- /** 32-byte random nonce. Generate with {@link generateAuthorizationNonce}. */
587
- readonly nonce: Hex;
588
- }
589
- /** Message body for {@link signReceiveWithAuthorization}. */
590
- type ReceiveWithAuthorizationMessage = TransferWithAuthorizationMessage;
591
- /** Message body for {@link signCancelAuthorization}. */
592
- interface CancelAuthorizationMessage {
593
- readonly authorizer: Address;
594
- readonly nonce: Hex;
595
- }
596
- /**
597
- * A signed EIP-3009 authorization, ready to be passed to the token's
598
- * `*WithAuthorization` entrypoint as `(v, r, s)`.
599
- */
600
- interface SignedAuthorization<TMessage> {
601
- readonly signature: Hex;
602
- readonly v: number;
603
- readonly r: Hex;
604
- readonly s: Hex;
605
- readonly domain: Eip3009Domain;
606
- readonly message: TMessage;
607
- }
608
- /**
609
- * Generates a cryptographically random 32-byte EIP-3009 nonce.
610
- *
611
- * The nonce only needs to be unique per `(authorizer, contract)` — duplicates
612
- * across different tokens are harmless because the contract scopes them.
613
- *
614
- * @example
615
- * ```ts
616
- * import { generateAuthorizationNonce } from "kawasekit";
617
- *
618
- * const nonce = generateAuthorizationNonce();
619
- * ```
620
- */
621
- declare function generateAuthorizationNonce(): Hex;
622
- /**
623
- * Derives a **deterministic** 32-byte EIP-3009 nonce from a reasoning-step
624
- * idempotency key, scoped to `(from, verifyingContract, chainId)` so the same
625
- * key never collides across tokens or chains (M5-1, Half B).
626
- *
627
- * `nonce = keccak256(DOMAIN_TAG ‖ idempotencyKey ‖ from ‖ verifyingContract ‖
628
- * chainId)`. **No shared secret**: determinism across replicas / sub-agents
629
- * needs only a shared `conversationId` (the source of the key), not secret
630
- * distribution. A replayed key ⇒ identical nonce ⇒ the token contract's
631
- * `authorizationState` rejects the second settlement — the on-chain last line of
632
- * defence against re-signed same-intent duplicate payments. Use in place of
633
- * {@link generateAuthorizationNonce} only when a key is available.
634
- *
635
- * `chainId` is in the preimage, so the same JPYC address on Polygon / Avalanche
636
- * / Kaia / Ethereum yields distinct nonces (cross-chain replay safety).
637
- *
638
- * @example
639
- * ```ts
640
- * import { deriveAuthorizationNonce } from "kawasekit";
641
- *
642
- * const nonce = deriveAuthorizationNonce(
643
- * { idempotencyKey },
644
- * { from: account.address, verifyingContract, chainId },
645
- * );
646
- * ```
647
- */
648
- declare function deriveAuthorizationNonce(input: {
649
- readonly idempotencyKey: string;
650
- }, scope: {
651
- readonly from: Address;
652
- readonly verifyingContract: Address;
653
- readonly chainId: number;
654
- }): Hex;
655
- /**
656
- * Returns a `validBefore` UNIX timestamp `seconds` in the future.
657
- *
658
- * @param seconds - Lifetime of the authorization, in seconds.
659
- * @param nowSec - Optional override of "now" (defaults to {@link Date.now}).
660
- *
661
- * @example
662
- * ```ts
663
- * import { authorizationDeadlineFromNow } from "kawasekit";
664
- *
665
- * const validBefore = authorizationDeadlineFromNow(60 * 5); // 5 minutes
666
- * ```
667
- */
668
- declare function authorizationDeadlineFromNow(seconds: number, nowSec?: bigint): bigint;
669
- /**
670
- * Signs an EIP-3009 `TransferWithAuthorization` message.
671
- *
672
- * The signing account MUST equal `message.from` — EIP-3009 rejects signatures
673
- * from anyone else (the on-chain check is pure `ecrecover` against `from`).
674
- *
675
- * @example
676
- * ```ts
677
- * import { privateKeyToAccount } from "viem/accounts";
678
- * import {
679
- * authorizationDeadlineFromNow,
680
- * generateAuthorizationNonce,
681
- * JPYC_EIP712_DOMAIN_HINT,
682
- * polygon,
683
- * signTransferWithAuthorization,
684
- * } from "kawasekit";
685
- *
686
- * const account = privateKeyToAccount("0x...");
687
- * const signed = await signTransferWithAuthorization(account, {
688
- * ...JPYC_EIP712_DOMAIN_HINT,
689
- * chainId: polygon.id,
690
- * verifyingContract: "0xE7C3D8C9a439feDe00D2600032D5dB0Be71C3c29",
691
- * }, {
692
- * from: account.address,
693
- * to: "0xBeef...",
694
- * value: 100n * 10n ** 18n,
695
- * validAfter: 0n,
696
- * validBefore: authorizationDeadlineFromNow(300),
697
- * nonce: generateAuthorizationNonce(),
698
- * });
699
- * // → submit (v, r, s) to token.transferWithAuthorization(...)
700
- * ```
701
- */
702
- declare function signTransferWithAuthorization(account: Account, domain: Eip3009Domain, message: TransferWithAuthorizationMessage): Promise<SignedAuthorization<TransferWithAuthorizationMessage>>;
703
- /**
704
- * Signs an EIP-3009 `ReceiveWithAuthorization` message.
705
- *
706
- * Differs from {@link signTransferWithAuthorization} in two ways:
707
- * 1. Uses the `ReceiveWithAuthorization` EIP-712 type.
708
- * 2. The contract additionally enforces `msg.sender == to` at submission
709
- * time, so only `to` (or a relayer impersonating `to` — impossible in
710
- * practice) can land the tx.
711
- */
712
- declare function signReceiveWithAuthorization(account: Account, domain: Eip3009Domain, message: ReceiveWithAuthorizationMessage): Promise<SignedAuthorization<ReceiveWithAuthorizationMessage>>;
713
- /**
714
- * Signs an EIP-3009 `CancelAuthorization` message.
715
- *
716
- * Cancelling consumes the nonce so a later `transferWithAuthorization` or
717
- * `receiveWithAuthorization` with the same nonce will revert.
718
- */
719
- declare function signCancelAuthorization(account: Account, domain: Eip3009Domain, message: CancelAuthorizationMessage): Promise<SignedAuthorization<CancelAuthorizationMessage>>;
720
-
721
556
  /**
722
557
  * JPYC stablecoin metadata, deployments, and ABI.
723
558
  *
@@ -1084,4 +919,4 @@ declare const jpycAbi: readonly [{
1084
919
  }];
1085
920
  }];
1086
921
 
1087
- export { type CancelAuthorizationMessage, type CreateAgentSmartAccountParams, type Eip3009Domain, JPYC_DECIMALS, JPYC_EIP712_DOMAIN_HINT, JPYC_V2_ADDRESS, type JpycDeployment, JpycNotAvailableError, type ReceiveWithAuthorizationMessage, type SignedAuthorization, SupportedChainId, type TransferWithAuthorizationMessage, authorizationDeadlineFromNow, avalanche, avalancheFuji, createAgentSmartAccount, deriveAuthorizationNonce, ethereum, generateAuthorizationNonce, getJpycAddress, jpycAbi, jpycDeployments, kaia, kairos, polygon, polygonAmoy, sepolia, signCancelAuthorization, signReceiveWithAuthorization, signTransferWithAuthorization };
922
+ export { type CreateAgentSmartAccountParams, JPYC_DECIMALS, JPYC_EIP712_DOMAIN_HINT, JPYC_V2_ADDRESS, type JpycDeployment, JpycNotAvailableError, SupportedChainId, avalanche, avalancheFuji, createAgentSmartAccount, ethereum, getJpycAddress, jpycAbi, jpycDeployments, kaia, kairos, polygon, polygonAmoy, sepolia };
package/dist/index.js CHANGED
@@ -1,15 +1,15 @@
1
- export { TransferJpycInputError, transferJpyc } from './chunk-UQ7WJY6O.js';
2
- export { X402_DEFAULT_AUTHORIZATION_LIFETIME_SECONDS, X402_FACILITATOR_ERROR_CODES, createCoinbaseFacilitator, createHttpFacilitator, createSelfFacilitator, createX402PaymentSigner, deriveReceiptTimeoutMs, wrapFetch } from './chunk-E2EG72U2.js';
1
+ export { TransferJpycInputError, transferJpyc } from './chunk-XRSZTZVZ.js';
2
+ export { X402_DEFAULT_AUTHORIZATION_LIFETIME_SECONDS, X402_FACILITATOR_ERROR_CODES, createCoinbaseFacilitator, createHttpFacilitator, createSelfFacilitator, createX402PaymentSigner, deriveReceiptTimeoutMs, wrapFetch } from './chunk-SMAZUZFO.js';
3
3
  export { X402_DEFAULT_MAX_TIMEOUT_SECONDS, X402_HEADER_IDEMPOTENCY_KEY, X402_HEADER_PAYMENT_REQUIRED, X402_HEADER_PAYMENT_RESPONSE, X402_HEADER_PAYMENT_SIGNATURE, buildPaymentRequiredResponse, buildPaymentRequirements, createX402Handler, decodePaymentRequiredHeader, decodePaymentResponseHeader, decodePaymentSignatureHeader, encodePaymentRequiredHeader, encodePaymentResponseHeader, encodePaymentSignatureHeader } from './chunk-PVUKX6IF.js';
4
4
  export { extractAcceptedNetworks, invokeHookSafely } from './chunk-LEHWRDVS.js';
5
5
  export { createIdempotencyKeyBuilder, createInMemoryIdempotencyStore, deriveIdempotencyKey, normalizeIntentText } from './chunk-TTX3RBIZ.js';
6
6
  export { IdempotencyConfigError, IdempotencyRecordParseError, IdempotencyRecordVersionError, KAWASEKIT_IDEMPOTENCY_RECORD_VERSION, X402_VERSION, chainIdToX402Network, isX402Network, parseIdempotencyRecord, serializeIdempotencyRecord, x402NetworkToChainId } from './chunk-QHUCU5YX.js';
7
7
  export { KAWASEKIT_SESSION_ENVELOPE_VERSION, SessionEnvelopeChainMismatchError, SessionEnvelopeParseError, SessionEnvelopeSignerMismatchError, SessionEnvelopeVersionError, createAgentSmartAccount, issueSessionKey, parseSessionEnvelope, restoreSessionAccount, revokeSessionKey, rotateSessionKey, serializeSessionEnvelope } from './chunk-N3CVLISJ.js';
8
- export { createLocalPolicyGatedSigner } from './chunk-RUWCCP37.js';
9
- export { PolicyGatedSignerConfigError, assertNonBypassable, authorizationDeadlineFromNow, deriveAuthorizationNonce, generateAuthorizationNonce, getKnownAssetDomain, listKnownAssetIds, requireNonBypassable, signCancelAuthorization, signReceiveWithAuthorization, signTransferWithAuthorization } from './chunk-VPRR3TNA.js';
8
+ export { createLocalPolicyGatedSigner } from './chunk-THTVJZ2Q.js';
9
+ export { PolicyGatedSignerConfigError, assertNonBypassable, authorizationDeadlineFromNow, cancelAuthorizationTypes, deriveAuthorizationNonce, generateAuthorizationNonce, getKnownAssetDomain, listKnownAssetIds, receiveWithAuthorizationTypes, requireNonBypassable, resolvedAssetToEip3009Domain, signCancelAuthorization, signReceiveWithAuthorization, signTransferWithAuthorization, transferWithAuthorizationTypes } from './chunk-VXZHS74W.js';
10
10
  export { X402InvalidConfigError, X402InvalidPayloadError, X402PolicyRejectedError } from './chunk-WMVJNPX2.js';
11
11
  export { ONE_DAY_SECONDS, createJpycDailyLimitPolicies } from './chunk-E47SIVFY.js';
12
- export { SpendingPolicyConfigError, createSpendingPolicy, evaluateSpendingPolicy, mergeSpendState } from './chunk-YMABXRCK.js';
12
+ export { SpendingPolicyConfigError, createSpendingPolicy, evaluateSpendingPolicy, mergeSpendState } from './chunk-6CNAYQOL.js';
13
13
  export { JPYC_DECIMALS, JPYC_EIP712_DOMAIN_HINT, JPYC_V2_ADDRESS, JpycNotAvailableError, getJpycAddress, jpycAbi, jpycDeployments } from './chunk-KT7XDT2T.js';
14
14
  export { ChainNotSupportedError, avalanche, avalancheFuji, ethereum, getChain, isSupportedChainId, kaia, kairos, polygon, polygonAmoy, sepolia, supportedChains, zerodevRpcUrl } from './chunk-SOTYGX67.js';
15
15
  import './chunk-7D4SUZUM.js';