@okxweb3/app-x402-core 0.1.2 → 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 (57) hide show
  1. package/dist/cjs/OKXFacilitatorClient-Bqyw9fzj.d.ts +69 -0
  2. package/dist/cjs/client/index.d.ts +1 -1
  3. package/dist/cjs/client/index.js +34 -0
  4. package/dist/cjs/client/index.js.map +1 -1
  5. package/dist/cjs/facilitator/index.d.ts +2 -2
  6. package/dist/cjs/facilitator/index.js +166 -4
  7. package/dist/cjs/facilitator/index.js.map +1 -1
  8. package/dist/cjs/http/index.d.ts +5 -3
  9. package/dist/cjs/http/index.js +1241 -7
  10. package/dist/cjs/http/index.js.map +1 -1
  11. package/dist/cjs/index-2gWfiUbK.d.ts +713 -0
  12. package/dist/cjs/index.d.ts +2 -2
  13. package/dist/cjs/index.js +166 -4
  14. package/dist/cjs/index.js.map +1 -1
  15. package/dist/cjs/{mechanisms-sojpSwWW.d.ts → mechanisms-LhI9qkRo.d.ts} +509 -1
  16. package/dist/cjs/server/index.d.ts +4 -2
  17. package/dist/cjs/server/index.js +1256 -7
  18. package/dist/cjs/server/index.js.map +1 -1
  19. package/dist/cjs/subscription/index.d.ts +3 -0
  20. package/dist/cjs/subscription/index.js +600 -0
  21. package/dist/cjs/subscription/index.js.map +1 -0
  22. package/dist/cjs/types/index.d.ts +1 -1
  23. package/dist/cjs/utils/index.d.ts +1 -1
  24. package/dist/cjs/{x402HTTPResourceServer-CcsAkcgI.d.ts → x402HTTPResourceServer-B0mXzV8r.d.ts} +114 -1
  25. package/dist/esm/OKXFacilitatorClient-z-cCE5Db.d.mts +69 -0
  26. package/dist/esm/chunk-4KASWSSY.mjs +257 -0
  27. package/dist/esm/chunk-4KASWSSY.mjs.map +1 -0
  28. package/dist/esm/chunk-CKXR4QVD.mjs +274 -0
  29. package/dist/esm/chunk-CKXR4QVD.mjs.map +1 -0
  30. package/dist/esm/{chunk-XBQG2CDV.mjs → chunk-EYS4TWVA.mjs} +617 -9
  31. package/dist/esm/chunk-EYS4TWVA.mjs.map +1 -0
  32. package/dist/esm/client/index.d.mts +1 -1
  33. package/dist/esm/client/index.mjs +3 -2
  34. package/dist/esm/client/index.mjs.map +1 -1
  35. package/dist/esm/facilitator/index.d.mts +2 -2
  36. package/dist/esm/facilitator/index.mjs +2 -1
  37. package/dist/esm/facilitator/index.mjs.map +1 -1
  38. package/dist/esm/http/index.d.mts +5 -3
  39. package/dist/esm/http/index.mjs +3 -2
  40. package/dist/esm/index-DKbqlTu_.d.mts +713 -0
  41. package/dist/esm/index.d.mts +2 -2
  42. package/dist/esm/index.mjs +2 -1
  43. package/dist/esm/{mechanisms-sojpSwWW.d.mts → mechanisms-LhI9qkRo.d.mts} +509 -1
  44. package/dist/esm/server/index.d.mts +4 -2
  45. package/dist/esm/server/index.mjs +3 -2
  46. package/dist/esm/subscription/index.d.mts +3 -0
  47. package/dist/esm/subscription/index.mjs +309 -0
  48. package/dist/esm/subscription/index.mjs.map +1 -0
  49. package/dist/esm/types/index.d.mts +1 -1
  50. package/dist/esm/utils/index.d.mts +1 -1
  51. package/dist/esm/{x402HTTPResourceServer-DBeutKxq.d.mts → x402HTTPResourceServer-56Tq3Jup.d.mts} +114 -1
  52. package/package.json +12 -1
  53. package/dist/cjs/OKXFacilitatorClient-BvyQB1QM.d.ts +0 -59
  54. package/dist/esm/OKXFacilitatorClient-D5E3LX50.d.mts +0 -59
  55. package/dist/esm/chunk-O3IYMTNT.mjs +0 -118
  56. package/dist/esm/chunk-O3IYMTNT.mjs.map +0 -1
  57. package/dist/esm/chunk-XBQG2CDV.mjs.map +0 -1
@@ -0,0 +1,713 @@
1
+ import { u as Subscription, v as SubscriptionCapability, w as ChargeResult, C as CancelAuth, a as PaymentRequirements, P as PaymentPayload, A as AccessProof, x as CancelInitiator, y as PlanInitialCharge, z as AccessRouteRequirements, m as FacilitatorCancelData, o as FacilitatorCancelPendingData, l as FacilitatorChangeData, p as FacilitatorChargeData, B as FacilitatorChargeRow, j as FacilitatorEnvelope, q as FacilitatorFinalizeExpiredData, r as FacilitatorGetChargesData, t as FacilitatorGetSubscriptionData, s as FacilitatorPendingChangeRow, k as FacilitatorSubscribeData, O as OnBeforeAccessContext, D as OnBeforeAccessHook, E as OnBeforeAccessResult, n as PendingChangeCancelAuth, G as PendingPlanChange, I as PlanCatalog, J as PlanCatalogEntry, K as SettleCancelOk, L as SettleCancelPendingChangeOk, M as SettleCancelPendingChangeResult, Q as SettleCancelResult, R as SettleChangeOk, T as SettleChangeResult, U as SettleResultFail, W as SettleSubscribeOk, X as SettleSubscribeResult, Y as SubscriptionFacilitatorClient, Z as SubscriptionState, _ as VerifyAccessOk, $ as VerifyAccessResult, a0 as VerifyChangeOk, a1 as VerifyChangeResult, a2 as VerifyOwnershipOk, a3 as VerifyOwnershipResult, a4 as VerifyResult, a5 as VerifyResultFail, a6 as VerifyResultOk, a7 as hasSubscriptionCapability, a8 as supportsSubscription } from './mechanisms-LhI9qkRo.mjs';
2
+ import { Hex, TypedDataDomain } from 'viem';
3
+
4
+ /**
5
+ * Canonical facilitator error reasons. The SDK uses these literal strings
6
+ * verbatim in verify / settle / charge return values so seller code can
7
+ * switch on a single set of codes regardless of whether the rejection
8
+ * originated in the SDK pre-check or in the facilitator response.
9
+ */
10
+ declare const ErrorCode: {
11
+ readonly TermsBindingInvalid: "terms_binding_invalid";
12
+ readonly AllowanceInsufficient: "allowance_insufficient";
13
+ readonly AllowanceExpired: "allowance_expired";
14
+ readonly PeriodNotDue: "period_not_due";
15
+ readonly InsufficientBalance: "insufficient_balance";
16
+ readonly SubscriptionNotActive: "subscription_not_active";
17
+ /**
18
+ * SDK-local code. Surfaced by `verifyAccess` when local period math
19
+ * yields `currentCalculatePeriod === 0` — subscription exists but
20
+ * `nowSec < startAt`, i.e. has not yet entered its first chargeable
21
+ * period.
22
+ */
23
+ readonly SubscriptionNotYetActive: "subscription_not_yet_active";
24
+ readonly UnauthorizedCaller: "unauthorized_caller";
25
+ readonly CancelSignatureInvalid: "cancel_signature_invalid";
26
+ readonly CancelNonceUsed: "cancel_nonce_used";
27
+ readonly TierSame: "tier_same";
28
+ readonly ChangeEffectiveAtMismatch: "change_effective_at_mismatch";
29
+ readonly MerchantMismatch: "merchant_mismatch";
30
+ readonly PayerMismatch: "payer_mismatch";
31
+ readonly PendingChangeExists: "pending_change_exists";
32
+ readonly SubNotActiveForChange: "sub_not_active_for_change";
33
+ readonly NoPendingChange: "no_pending_change";
34
+ readonly ConfirmationTimeout: "confirmation_timeout";
35
+ };
36
+ type ErrorCode = (typeof ErrorCode)[keyof typeof ErrorCode];
37
+ /**
38
+ * Charge-flow subset of ErrorCode. Seller scheduler switches on these 6
39
+ * codes.
40
+ */
41
+ declare const ChargeErrorCode: {
42
+ readonly PeriodNotDue: "period_not_due";
43
+ readonly SubscriptionNotActive: "subscription_not_active";
44
+ readonly InsufficientBalance: "insufficient_balance";
45
+ readonly AllowanceExpired: "allowance_expired";
46
+ readonly UnauthorizedCaller: "unauthorized_caller";
47
+ readonly ConfirmationTimeout: "confirmation_timeout";
48
+ };
49
+ type ChargeErrorCode = (typeof ChargeErrorCode)[keyof typeof ChargeErrorCode];
50
+ declare class ChargeError extends Error {
51
+ readonly code: ChargeErrorCode;
52
+ readonly subId: string;
53
+ readonly txHash?: string;
54
+ constructor(code: ChargeErrorCode, subId: string, txHash?: string);
55
+ }
56
+
57
+ /**
58
+ * Persistence abstraction for subscription state.
59
+ *
60
+ * Intentionally minimal — every state transition is performed by `put`-ing
61
+ * the full Subscription object, and every lookup is by `subId`. Address /
62
+ * payer-indexed queries are deliberately NOT part of this contract: the
63
+ * seller's own data model should own that (e.g. by mapping wallet →
64
+ * subId(s) in its user table), keeping the SDK store free of any secondary
65
+ * index requirement.
66
+ */
67
+ interface SubscriptionStore {
68
+ get(subId: string): Promise<Subscription | null>;
69
+ put(sub: Subscription): Promise<void>;
70
+ delete(subId: string): Promise<void>;
71
+ }
72
+ /**
73
+ * In-memory reference implementation. Suitable for development / unit tests /
74
+ * single-process demos only — multi-process deployments must replace this
75
+ * with a shared persistent backend.
76
+ */
77
+ declare class InMemoryStore implements SubscriptionStore {
78
+ private readonly data;
79
+ get(subId: string): Promise<Subscription | null>;
80
+ put(sub: Subscription): Promise<void>;
81
+ delete(subId: string): Promise<void>;
82
+ /**
83
+ * Return all subscriptions, ordered by `startAt` ascending. Not part of
84
+ * the SubscriptionStore interface — admin/debug helper, not used by the
85
+ * scheme. Production backends should expose paginated equivalents.
86
+ */
87
+ list(): Promise<Subscription[]>;
88
+ }
89
+
90
+ interface SubscriptionClientConfig {
91
+ /**
92
+ * The scheme instance to delegate facilitator-touching operations to.
93
+ * Typically the same `PermitSubscriptionScheme` instance that is registered
94
+ * to `x402ResourceServer`, so HTTP main-line state and out-of-band charge
95
+ * state share one source of truth.
96
+ */
97
+ scheme: SubscriptionCapability;
98
+ /**
99
+ * The store the scheme writes to. Required here because `getSubscription`
100
+ * reads from the store (fast path) while `syncFromChain` writes to it after
101
+ * re-fetching from chain.
102
+ */
103
+ store: SubscriptionStore;
104
+ }
105
+ /**
106
+ * Out-of-band primitives for Seller scheduler / business code. SDK ships the
107
+ * per-call atoms (charge / cancelBySeller / syncFromChain / etc.) but NOT a
108
+ * scheduler — cron, due index, retry policy, distributed locks are all
109
+ * Seller infrastructure.
110
+ *
111
+ * All methods are thin wrappers:
112
+ * - `charge` delegates to scheme.charge (throws ChargeError on fail)
113
+ * - `cancelBySeller` delegates to scheme.settleCancel with a Seller-built
114
+ * CancelAuth
115
+ * - `syncFromChain` re-pulls Subscription via scheme.getSubscription and
116
+ * repairs the store; connects with the `state==="changed"`
117
+ * chain to also sync the downstream new sub
118
+ * - `getSubscription` direct store read (does NOT touch the chain)
119
+ */
120
+ declare class SubscriptionClient {
121
+ protected readonly scheme: SubscriptionCapability;
122
+ protected readonly store: SubscriptionStore;
123
+ constructor(config: SubscriptionClientConfig);
124
+ /**
125
+ * Run one charge period for a subscription. Throws `ChargeError` (one of 6
126
+ * codes) on facilitator-side failure. Internally `scheme.charge` already
127
+ * updates the store on success (and on `planChangeTriggered`); the client is
128
+ * a pass-through.
129
+ */
130
+ charge(subId: string): Promise<ChargeResult>;
131
+ /**
132
+ * Seller-initiated cancel (e.g. ToS violation, fraud, business reason).
133
+ *
134
+ * The SDK does NOT hold the Seller's merchant private key; the Seller must
135
+ * construct + sign a `CancelAuth` with `by=1 (MERCHANT)` outside and pass
136
+ * it in. SDK runs verifyCancel (sanity check on the auth) then settleCancel
137
+ * (facilitator + store mark canceled).
138
+ *
139
+ * Throws on either verify or settle failure.
140
+ */
141
+ cancelBySeller(subId: string, auth: CancelAuth, _reason?: string): Promise<void>;
142
+ /**
143
+ * Re-sync a subscription from chain and repair the store. Use when:
144
+ * - `charge` threw `SubscriptionNotActive` (buyer may have cancelled
145
+ * directly via the facilitator or contract)
146
+ * - `charge` threw `ConfirmationTimeout` (network-level failure; chain
147
+ * may or may not have written)
148
+ * - periodic reconciliation
149
+ *
150
+ * If the synced sub is in `"changed"` state, the downstream `changedToSubId`
151
+ * is also fetched and persisted, so the Seller's `dueIndex` can switch over
152
+ * to the new sub without manual intervention.
153
+ */
154
+ syncFromChain(subId: string): Promise<Subscription | null>;
155
+ /**
156
+ * Direct store read. Cheap; does NOT touch the chain. Use this for hot-path
157
+ * lookups (e.g. resolving subId to plan/tier for business logic). For chain
158
+ * state of record, use `syncFromChain`.
159
+ */
160
+ getSubscription(subId: string): Promise<Subscription | null>;
161
+ }
162
+
163
+ /**
164
+ * Permit2 PermitSingle (AllowanceTransfer) — what the buyer signs to authorize
165
+ * the subscription contract to pull tokens on every charge.
166
+ *
167
+ * PermitSingle(PermitDetails details, address spender, uint256 sigDeadline)
168
+ * PermitDetails(address token, uint160 amount, uint48 expiration, uint48 nonce)
169
+ */
170
+ interface PermitSingleData {
171
+ details: {
172
+ token: string;
173
+ /** uint160 as decimal string — covers entire remaining commitment. */
174
+ amount: string;
175
+ /** uint48 unix seconds — Permit2 allowance expiration. */
176
+ expiration: number;
177
+ /** uint48 — Permit2 nonce (current value from allowance-status, NOT +1). */
178
+ nonce: number;
179
+ };
180
+ /** Subscription contract address. */
181
+ spender: string;
182
+ /** uint256 as decimal string — outer signature expiry. */
183
+ sigDeadline: string;
184
+ }
185
+ /**
186
+ * SubscriptionTerms — what the buyer's EIP-712 signature commits to. 17
187
+ * fields. Field ORDER MATTERS because it determines the EIP-712 TypeHash:
188
+ * 0xa5223de56e7694cf776c7d4f74c0323f42bf9e65655fe49affefbdfd40ec97ae
189
+ */
190
+ interface SubscriptionTerms {
191
+ payer: string;
192
+ merchant: string;
193
+ facilitator: string;
194
+ token: string;
195
+ /** uint160 (atomic units). */
196
+ amountPerPeriod: string;
197
+ /** uint64 seconds; MUST be 0 when periodMode=1 (calendar_month). */
198
+ periodSec: number;
199
+ /** uint32. */
200
+ maxPeriods: number;
201
+ /** uint64 unix seconds; 0 means "use block.timestamp on-chain". */
202
+ startAt: number;
203
+ /** uint32; 0 = no separate initial charge. */
204
+ initialChargePeriods: number;
205
+ /** uint160; atomic units. */
206
+ initialChargeAmount: string;
207
+ /** uint64 unix seconds — terms signature validity window. */
208
+ termsDeadline: number;
209
+ /** bytes32 — keccak256 of the PermitSingle EIP-712 struct hash, binds terms to permit. */
210
+ permitHash: Hex;
211
+ /** bytes32 — buyer-generated random anti-replay value. */
212
+ salt: Hex;
213
+ /** uint8 (>0) — plan tier for upgrade/downgrade comparison. */
214
+ planTier: number;
215
+ /** bytes32 — old subId on change, zero on create. */
216
+ changeFromSubId: Hex;
217
+ /** uint8 — 0 none(create) / 1 immediate(upgrade) / 2 period_end(downgrade). */
218
+ changeEffectiveAt: number;
219
+ /** uint8 — 0 fixed_seconds / 1 calendar_month. */
220
+ periodMode: number;
221
+ /**
222
+ * bytes32 — keccak256(utf8(plan.id)). Buyer SDKs sign it as a terms field
223
+ * and the facilitator persists it as the on-chain `planId`. Seller verify
224
+ * MUST cross-check this hash equals `keccak256(utf8(accepted.extra.plan.id))`
225
+ * to defeat plan-spoof attacks.
226
+ */
227
+ planId?: Hex;
228
+ }
229
+ /**
230
+ * Concrete payload nested inside `PaymentPayload.payload` for the `period`
231
+ * scheme.
232
+ */
233
+ interface SubscriptionPaymentInner {
234
+ permitSingle: PermitSingleData;
235
+ permitSingleSignature: Hex;
236
+ terms: SubscriptionTerms;
237
+ termsSignature: Hex;
238
+ }
239
+ interface EncodePaymentPayloadInput {
240
+ selected: PaymentRequirements;
241
+ permitSingle: PermitSingleData;
242
+ permitSingleSignature: Hex;
243
+ terms: SubscriptionTerms;
244
+ termsSignature: Hex;
245
+ }
246
+ /**
247
+ * Decode the `APP-PAYMENT-REQUIRED` header into the underlying
248
+ * `PaymentRequired.accepts` array. Throws on invalid base64 / JSON.
249
+ */
250
+ declare function parsePaymentRequired(headerValue: string): PaymentRequirements[];
251
+ /**
252
+ * Build the `PAYMENT-SIGNATURE` header value (base64-encoded JSON). Buyer side.
253
+ */
254
+ declare function encodePaymentPayload(input: EncodePaymentPayloadInput): string;
255
+ /**
256
+ * Decode the `PAYMENT-SIGNATURE` header value back into a typed PaymentPayload.
257
+ * Throws on invalid base64 / JSON; does not validate field shapes (that is the
258
+ * responsibility of the scheme verify step).
259
+ */
260
+ declare function decodePaymentPayload(headerValue: string): PaymentPayload;
261
+ /**
262
+ * Narrow a generic PaymentPayload's `.payload` to the subscription inner.
263
+ * Throws if required fields are missing — single chokepoint between base64
264
+ * decode and verify.
265
+ */
266
+ declare function asSubscriptionPaymentInner(payload: PaymentPayload): SubscriptionPaymentInner;
267
+
268
+ /**
269
+ * Verify that buyer-signed `terms` bind to the server-advertised
270
+ * PaymentRequirements. Without this field-by-field check a buyer could sign
271
+ * a basic-tier accepted but submit terms claiming enterprise-tier access at
272
+ * basic price. The contract verifies the signature but cannot see what the
273
+ * seller offered in 402 — only the SDK can enforce this binding.
274
+ *
275
+ * All mismatches collapse to `terms_binding_invalid` so the caller's switch
276
+ * statement stays compact.
277
+ *
278
+ * Returns `null` on match, an `ErrorCode` on first mismatch.
279
+ */
280
+ declare function verifyTermsBindRequirements(terms: SubscriptionTerms, requirements: PaymentRequirements): ErrorCode | null;
281
+
282
+ /**
283
+ * Local mirror of the facilitator's elapsed-period math. Used by
284
+ * `verifyAccess` to decide whether `lastChargedPeriod` is current without
285
+ * hitting the facilitator on every request — only when the local
286
+ * computation says we're behind does the SDK fall through to a GET /detail
287
+ * refresh.
288
+ *
289
+ * MUST stay bit-for-bit equivalent to the backend implementation. Returns
290
+ * `0` when the subscription has not yet started — caller treats this as a
291
+ * special "pre-start" state.
292
+ */
293
+ /**
294
+ * Compute the real elapsed period count at `nowSec`, NOT clamped to
295
+ * `maxPeriods`. Period 1 is the first chargeable period; `0` means
296
+ * pre-start (subscription not yet effective).
297
+ */
298
+ declare function computeElapsedPeriods(periodMode: number, startAt: number, billingAnchorAt: number, periodSec: number, nowSec: number): number;
299
+ /**
300
+ * Number of calendar-month boundaries crossed between `anchorSec` (exclusive)
301
+ * and `tsSec` (inclusive). Each boundary is `addCalendarMonths(anchor, n)`
302
+ * for n=1,2,…, with month-end truncation (1/31 + 1m → 2/28/29).
303
+ */
304
+ declare function elapsedCalendarMonths(anchorSec: number, tsSec: number): number;
305
+ /**
306
+ * Add `n` calendar months to `anchorSec`, keeping the anchor's day-of-month
307
+ * but truncating to month-end when overflowing (1/31 + 1m → 2/28 or 2/29).
308
+ * Returned timestamp preserves the anchor's hour / minute / second / ms in UTC.
309
+ */
310
+ declare function addCalendarMonths(anchorSec: number, n: number): number;
311
+
312
+ /**
313
+ * Isomorphic UTF-8 ↔ base64 helpers.
314
+ *
315
+ * Buyers may run this code in a browser; Buffer is preferred on Node so the
316
+ * built CJS bundle stays free of `globalThis.atob` polyfills, but we fall back
317
+ * to atob/btoa when Buffer is unavailable.
318
+ */
319
+ declare function base64EncodeUtf8(value: string): string;
320
+ declare function base64DecodeUtf8(value: string): string;
321
+
322
+ interface AccessProofMessageInput {
323
+ subId: Hex;
324
+ payer: Hex;
325
+ timestamp: number;
326
+ }
327
+ /**
328
+ * Returns the inner 32-byte hash that wallets sign via EIP-191 personal_sign.
329
+ *
330
+ * Layout:
331
+ * inner = keccak256(abi.encodePacked(bytes32 subId, address payer, uint256 timestamp))
332
+ *
333
+ * `timestamp` is encoded as `uint256` (32 bytes). Switching to anything
334
+ * narrower yields a different digest and silently produces
335
+ * `signature_invalid` on every access call.
336
+ *
337
+ * IMPORTANT: callers must NOT prepend the EIP-191 envelope themselves —
338
+ * `wallet.signMessage(buildAccessProofMessage(...))` will add the
339
+ * `\x19Ethereum Signed Message:\n32` prefix automatically. The recover step on
340
+ * the server must mirror this (verify EIP-191 signature, not raw keccak).
341
+ */
342
+ declare function buildAccessProofMessage(input: AccessProofMessageInput): Hex;
343
+ declare function encodeAccessProof(proof: AccessProof): string;
344
+ declare function decodeAccessProof(headerValue: string): AccessProof;
345
+
346
+ /** 32-byte zero hash, used as the sentinel for empty bytes32 fields. */
347
+ declare const ZERO_BYTES32: Hex;
348
+ /**
349
+ * Permit2 PermitSingle (AllowanceTransfer) EIP-712 schema. Used for the
350
+ * continuous-pull authorization signed by the buyer. The Permit2 domain has
351
+ * NO `version` field — only `name="Permit2"`, `chainId`, `verifyingContract`.
352
+ */
353
+ declare const PERMIT2_TYPES: {
354
+ readonly PermitSingle: readonly [{
355
+ readonly name: "details";
356
+ readonly type: "PermitDetails";
357
+ }, {
358
+ readonly name: "spender";
359
+ readonly type: "address";
360
+ }, {
361
+ readonly name: "sigDeadline";
362
+ readonly type: "uint256";
363
+ }];
364
+ readonly PermitDetails: readonly [{
365
+ readonly name: "token";
366
+ readonly type: "address";
367
+ }, {
368
+ readonly name: "amount";
369
+ readonly type: "uint160";
370
+ }, {
371
+ readonly name: "expiration";
372
+ readonly type: "uint48";
373
+ }, {
374
+ readonly name: "nonce";
375
+ readonly type: "uint48";
376
+ }];
377
+ };
378
+ /**
379
+ * SubscriptionTerms EIP-712 schema. 17 fields; field ORDER + integer widths
380
+ * must mirror the contract. TypeHash:
381
+ * 0xa5223de56e7694cf776c7d4f74c0323f42bf9e65655fe49affefbdfd40ec97ae
382
+ * (verify against contract `SUBSCRIPTION_TERMS_TYPEHASH()`)
383
+ */
384
+ declare const SUBSCRIPTION_TERMS_TYPES: {
385
+ readonly SubscriptionTerms: readonly [{
386
+ readonly name: "payer";
387
+ readonly type: "address";
388
+ }, {
389
+ readonly name: "merchant";
390
+ readonly type: "address";
391
+ }, {
392
+ readonly name: "facilitator";
393
+ readonly type: "address";
394
+ }, {
395
+ readonly name: "token";
396
+ readonly type: "address";
397
+ }, {
398
+ readonly name: "amountPerPeriod";
399
+ readonly type: "uint160";
400
+ }, {
401
+ readonly name: "periodSec";
402
+ readonly type: "uint64";
403
+ }, {
404
+ readonly name: "maxPeriods";
405
+ readonly type: "uint32";
406
+ }, {
407
+ readonly name: "startAt";
408
+ readonly type: "uint64";
409
+ }, {
410
+ readonly name: "initialChargePeriods";
411
+ readonly type: "uint32";
412
+ }, {
413
+ readonly name: "initialChargeAmount";
414
+ readonly type: "uint160";
415
+ }, {
416
+ readonly name: "termsDeadline";
417
+ readonly type: "uint64";
418
+ }, {
419
+ readonly name: "permitHash";
420
+ readonly type: "bytes32";
421
+ }, {
422
+ readonly name: "salt";
423
+ readonly type: "bytes32";
424
+ }, {
425
+ readonly name: "planTier";
426
+ readonly type: "uint8";
427
+ }, {
428
+ readonly name: "changeFromSubId";
429
+ readonly type: "bytes32";
430
+ }, {
431
+ readonly name: "changeEffectiveAt";
432
+ readonly type: "uint8";
433
+ }, {
434
+ readonly name: "periodMode";
435
+ readonly type: "uint8";
436
+ }];
437
+ };
438
+ /**
439
+ * CancelAuth EIP-712 schema (subscription contract domain):
440
+ * `CancelAuth(uint8 action, bytes32 subId, uint8 initiator, bytes32 nonce, uint64 deadline)`
441
+ */
442
+ declare const CANCEL_AUTH_TYPES: {
443
+ readonly CancelAuth: readonly [{
444
+ readonly name: "action";
445
+ readonly type: "uint8";
446
+ }, {
447
+ readonly name: "subId";
448
+ readonly type: "bytes32";
449
+ }, {
450
+ readonly name: "initiator";
451
+ readonly type: "uint8";
452
+ }, {
453
+ readonly name: "nonce";
454
+ readonly type: "bytes32";
455
+ }, {
456
+ readonly name: "deadline";
457
+ readonly type: "uint64";
458
+ }];
459
+ };
460
+ /**
461
+ * PendingChangeCancelAuth EIP-712 schema (subscription contract domain):
462
+ * `PendingChangeCancelAuth(bytes32 subId, bytes32 newSubId, bytes32 nonce, uint64 deadline)`
463
+ */
464
+ declare const PENDING_CHANGE_CANCEL_AUTH_TYPES: {
465
+ readonly PendingChangeCancelAuth: readonly [{
466
+ readonly name: "subId";
467
+ readonly type: "bytes32";
468
+ }, {
469
+ readonly name: "newSubId";
470
+ readonly type: "bytes32";
471
+ }, {
472
+ readonly name: "nonce";
473
+ readonly type: "bytes32";
474
+ }, {
475
+ readonly name: "deadline";
476
+ readonly type: "uint64";
477
+ }];
478
+ };
479
+ interface SubscriptionPlanExtra {
480
+ id: string;
481
+ tier: number;
482
+ name?: string;
483
+ }
484
+ /**
485
+ * Buyer's intent to switch from `fromSubId` to a new plan. Present on
486
+ * PaymentRequirements.extra ONLY when the requirements are a change offer
487
+ * for an upgrade/downgrade.
488
+ */
489
+ interface ChangeFromExtra {
490
+ fromSubId: Hex;
491
+ fromPlanId: Hex;
492
+ fromPlanTier: number;
493
+ direction: "upgrade" | "downgrade";
494
+ effectiveAt: "immediate" | "period_end";
495
+ }
496
+ interface SubscriptionContractAddresses {
497
+ subscription: string;
498
+ permit2: string;
499
+ }
500
+ /**
501
+ * Typed view of the `extra` field on subscription PaymentRequirements. The
502
+ * evm scheme is responsible for producing PaymentRequirements whose `extra`
503
+ * matches this shape; codec helpers consume it via this type rather than
504
+ * Record<string, unknown> to keep field access type-safe.
505
+ *
506
+ * Index signature lets this be assigned directly to
507
+ * `PaymentRequirements.extra: Record<string, unknown>` without a cast.
508
+ */
509
+ interface SubscriptionRequirementsExtra {
510
+ contracts: SubscriptionContractAddresses;
511
+ facilitator: string;
512
+ amountPerPeriod: string;
513
+ periodSec: number;
514
+ /** uint8 — 0 fixed_seconds (default) / 1 calendar_month. */
515
+ periodMode?: number;
516
+ maxPeriods: number;
517
+ startAt?: number;
518
+ initialCharge?: PlanInitialCharge | null;
519
+ plan: SubscriptionPlanExtra;
520
+ changeFrom?: ChangeFromExtra;
521
+ domain: TypedDataDomain;
522
+ [key: string]: unknown;
523
+ }
524
+ interface TypedDataEnvelope<TPrimary extends string, TMessage> {
525
+ domain: TypedDataDomain;
526
+ types: Record<string, ReadonlyArray<{
527
+ name: string;
528
+ type: string;
529
+ }>>;
530
+ primaryType: TPrimary;
531
+ message: TMessage;
532
+ }
533
+ interface BuildPermit2TypedDataInput {
534
+ /** PaymentRequirements with subscription `extra`. */
535
+ selected: PaymentRequirements;
536
+ /** uint48 — current nonce from allowance-status (NOT +1). */
537
+ nonce: number;
538
+ /** uint48 unix seconds — Permit2 allowance expiration. */
539
+ expiration: number;
540
+ /** uint256 decimal — outer signature expiry. */
541
+ sigDeadline: string;
542
+ /** Override amount; default = initialChargeAmount + (maxPeriods - initialChargePeriods) * amountPerPeriod. */
543
+ amount?: string;
544
+ }
545
+ interface BuildSubscriptionTermsTypedDataInput {
546
+ selected: PaymentRequirements;
547
+ payer: string;
548
+ startAt: number;
549
+ /** uint64 unix seconds — terms signature validity. */
550
+ termsDeadline: number;
551
+ /** bytes32 — random anti-replay; reuse the same hex string ≤ once. */
552
+ salt: Hex;
553
+ /** bytes32 — keccak256 of the PermitSingle struct hash; bind permit. */
554
+ permitHash: Hex;
555
+ changeFrom?: ChangeFromExtra;
556
+ /** Override domain for special cases; defaults to `selected.extra.domain`. */
557
+ domain?: TypedDataDomain;
558
+ }
559
+ interface BuildCancelAuthTypedDataInput {
560
+ subId: Hex;
561
+ initiator: CancelInitiator;
562
+ /** uint64 unix seconds. */
563
+ deadline: number;
564
+ /** bytes32. */
565
+ nonce: Hex;
566
+ domain: TypedDataDomain;
567
+ }
568
+ interface BuildPendingChangeCancelAuthTypedDataInput {
569
+ subId: Hex;
570
+ /** The pending change's target newSubId — must match `pendingPlanChange.newSubId`. */
571
+ newSubId: Hex;
572
+ deadline: number;
573
+ nonce: Hex;
574
+ domain: TypedDataDomain;
575
+ }
576
+ /**
577
+ * Build the Permit2 PermitSingle (AllowanceTransfer) typed data the wallet
578
+ * signs. `spender = subscription contract`; `amount` covers the entire
579
+ * remaining commitment (default), so the subscription contract can pull from
580
+ * the same Permit2 allowance on every charge without re-signing.
581
+ *
582
+ * Permit2's EIP-712 domain has NO `version` field.
583
+ */
584
+ declare function buildPermit2TypedData(input: BuildPermit2TypedDataInput): TypedDataEnvelope<"PermitSingle", Record<string, unknown>>;
585
+ /**
586
+ * Compute the EIP-712 struct hash of a PermitSingle message — what
587
+ * `terms.permitHash` must equal byte-for-byte. The facilitator verifies this
588
+ * via `permit_hash_mismatch`.
589
+ *
590
+ * permitDetailsHash = keccak256(
591
+ * PERMIT_DETAILS_TYPEHASH ‖ token ‖ amount ‖ expiration ‖ nonce
592
+ * )
593
+ * permitSingleHash = keccak256(
594
+ * PERMIT_SINGLE_TYPEHASH ‖ permitDetailsHash ‖ spender ‖ sigDeadline
595
+ * )
596
+ */
597
+ declare function computePermitSingleStructHash(permit: PermitSingleData): Hex;
598
+ /**
599
+ * Build the EIP-712 typed-data object the wallet signs to commit to the
600
+ * subscription terms (17 fields). `permitHash` MUST be the struct hash of
601
+ * the PermitSingle the buyer signed for permit2 (compute it via
602
+ * `computePermitSingleStructHash`) — the contract verifies this binding to
603
+ * defeat detached-signature swap attacks.
604
+ */
605
+ declare function buildSubscriptionTermsTypedData(input: BuildSubscriptionTermsTypedDataInput): TypedDataEnvelope<"SubscriptionTerms", SubscriptionTerms>;
606
+ declare function buildCancelAuthTypedData(input: BuildCancelAuthTypedDataInput): TypedDataEnvelope<"CancelAuth", Record<string, unknown>>;
607
+ declare function buildPendingChangeCancelAuthTypedData(input: BuildPendingChangeCancelAuthTypedDataInput): TypedDataEnvelope<"PendingChangeCancelAuth", Record<string, unknown>>;
608
+ /**
609
+ * Parse the chainId from a CAIP-2 network identifier (`eip155:<chainId>`).
610
+ * Throws if not an EVM CAIP — the subscription scheme is EVM-only.
611
+ */
612
+ declare function parseChainIdFromNetwork(network: string): number;
613
+
614
+ declare const ___subscription_AccessProof: typeof AccessProof;
615
+ type ___subscription_AccessProofMessageInput = AccessProofMessageInput;
616
+ declare const ___subscription_AccessRouteRequirements: typeof AccessRouteRequirements;
617
+ type ___subscription_BuildCancelAuthTypedDataInput = BuildCancelAuthTypedDataInput;
618
+ type ___subscription_BuildPermit2TypedDataInput = BuildPermit2TypedDataInput;
619
+ type ___subscription_BuildSubscriptionTermsTypedDataInput = BuildSubscriptionTermsTypedDataInput;
620
+ declare const ___subscription_CANCEL_AUTH_TYPES: typeof CANCEL_AUTH_TYPES;
621
+ declare const ___subscription_CancelAuth: typeof CancelAuth;
622
+ declare const ___subscription_CancelInitiator: typeof CancelInitiator;
623
+ type ___subscription_ChangeFromExtra = ChangeFromExtra;
624
+ type ___subscription_ChargeError = ChargeError;
625
+ declare const ___subscription_ChargeError: typeof ChargeError;
626
+ type ___subscription_ChargeErrorCode = ChargeErrorCode;
627
+ declare const ___subscription_ChargeResult: typeof ChargeResult;
628
+ type ___subscription_EncodePaymentPayloadInput = EncodePaymentPayloadInput;
629
+ type ___subscription_ErrorCode = ErrorCode;
630
+ declare const ___subscription_FacilitatorCancelData: typeof FacilitatorCancelData;
631
+ declare const ___subscription_FacilitatorCancelPendingData: typeof FacilitatorCancelPendingData;
632
+ declare const ___subscription_FacilitatorChangeData: typeof FacilitatorChangeData;
633
+ declare const ___subscription_FacilitatorChargeData: typeof FacilitatorChargeData;
634
+ declare const ___subscription_FacilitatorChargeRow: typeof FacilitatorChargeRow;
635
+ declare const ___subscription_FacilitatorEnvelope: typeof FacilitatorEnvelope;
636
+ declare const ___subscription_FacilitatorFinalizeExpiredData: typeof FacilitatorFinalizeExpiredData;
637
+ declare const ___subscription_FacilitatorGetChargesData: typeof FacilitatorGetChargesData;
638
+ declare const ___subscription_FacilitatorGetSubscriptionData: typeof FacilitatorGetSubscriptionData;
639
+ declare const ___subscription_FacilitatorPendingChangeRow: typeof FacilitatorPendingChangeRow;
640
+ declare const ___subscription_FacilitatorSubscribeData: typeof FacilitatorSubscribeData;
641
+ type ___subscription_InMemoryStore = InMemoryStore;
642
+ declare const ___subscription_InMemoryStore: typeof InMemoryStore;
643
+ declare const ___subscription_OnBeforeAccessContext: typeof OnBeforeAccessContext;
644
+ declare const ___subscription_OnBeforeAccessHook: typeof OnBeforeAccessHook;
645
+ declare const ___subscription_OnBeforeAccessResult: typeof OnBeforeAccessResult;
646
+ declare const ___subscription_PENDING_CHANGE_CANCEL_AUTH_TYPES: typeof PENDING_CHANGE_CANCEL_AUTH_TYPES;
647
+ declare const ___subscription_PERMIT2_TYPES: typeof PERMIT2_TYPES;
648
+ declare const ___subscription_PendingChangeCancelAuth: typeof PendingChangeCancelAuth;
649
+ declare const ___subscription_PendingPlanChange: typeof PendingPlanChange;
650
+ type ___subscription_PermitSingleData = PermitSingleData;
651
+ declare const ___subscription_PlanCatalog: typeof PlanCatalog;
652
+ declare const ___subscription_PlanCatalogEntry: typeof PlanCatalogEntry;
653
+ declare const ___subscription_PlanInitialCharge: typeof PlanInitialCharge;
654
+ declare const ___subscription_SUBSCRIPTION_TERMS_TYPES: typeof SUBSCRIPTION_TERMS_TYPES;
655
+ declare const ___subscription_SettleCancelOk: typeof SettleCancelOk;
656
+ declare const ___subscription_SettleCancelPendingChangeOk: typeof SettleCancelPendingChangeOk;
657
+ declare const ___subscription_SettleCancelPendingChangeResult: typeof SettleCancelPendingChangeResult;
658
+ declare const ___subscription_SettleCancelResult: typeof SettleCancelResult;
659
+ declare const ___subscription_SettleChangeOk: typeof SettleChangeOk;
660
+ declare const ___subscription_SettleChangeResult: typeof SettleChangeResult;
661
+ declare const ___subscription_SettleResultFail: typeof SettleResultFail;
662
+ declare const ___subscription_SettleSubscribeOk: typeof SettleSubscribeOk;
663
+ declare const ___subscription_SettleSubscribeResult: typeof SettleSubscribeResult;
664
+ declare const ___subscription_Subscription: typeof Subscription;
665
+ declare const ___subscription_SubscriptionCapability: typeof SubscriptionCapability;
666
+ type ___subscription_SubscriptionClient = SubscriptionClient;
667
+ declare const ___subscription_SubscriptionClient: typeof SubscriptionClient;
668
+ type ___subscription_SubscriptionClientConfig = SubscriptionClientConfig;
669
+ type ___subscription_SubscriptionContractAddresses = SubscriptionContractAddresses;
670
+ declare const ___subscription_SubscriptionFacilitatorClient: typeof SubscriptionFacilitatorClient;
671
+ type ___subscription_SubscriptionPaymentInner = SubscriptionPaymentInner;
672
+ type ___subscription_SubscriptionPlanExtra = SubscriptionPlanExtra;
673
+ type ___subscription_SubscriptionRequirementsExtra = SubscriptionRequirementsExtra;
674
+ declare const ___subscription_SubscriptionState: typeof SubscriptionState;
675
+ type ___subscription_SubscriptionStore = SubscriptionStore;
676
+ type ___subscription_SubscriptionTerms = SubscriptionTerms;
677
+ type ___subscription_TypedDataEnvelope<TPrimary extends string, TMessage> = TypedDataEnvelope<TPrimary, TMessage>;
678
+ declare const ___subscription_VerifyAccessOk: typeof VerifyAccessOk;
679
+ declare const ___subscription_VerifyAccessResult: typeof VerifyAccessResult;
680
+ declare const ___subscription_VerifyChangeOk: typeof VerifyChangeOk;
681
+ declare const ___subscription_VerifyChangeResult: typeof VerifyChangeResult;
682
+ declare const ___subscription_VerifyOwnershipOk: typeof VerifyOwnershipOk;
683
+ declare const ___subscription_VerifyOwnershipResult: typeof VerifyOwnershipResult;
684
+ declare const ___subscription_VerifyResult: typeof VerifyResult;
685
+ declare const ___subscription_VerifyResultFail: typeof VerifyResultFail;
686
+ declare const ___subscription_VerifyResultOk: typeof VerifyResultOk;
687
+ declare const ___subscription_ZERO_BYTES32: typeof ZERO_BYTES32;
688
+ declare const ___subscription_addCalendarMonths: typeof addCalendarMonths;
689
+ declare const ___subscription_asSubscriptionPaymentInner: typeof asSubscriptionPaymentInner;
690
+ declare const ___subscription_base64DecodeUtf8: typeof base64DecodeUtf8;
691
+ declare const ___subscription_base64EncodeUtf8: typeof base64EncodeUtf8;
692
+ declare const ___subscription_buildAccessProofMessage: typeof buildAccessProofMessage;
693
+ declare const ___subscription_buildCancelAuthTypedData: typeof buildCancelAuthTypedData;
694
+ declare const ___subscription_buildPendingChangeCancelAuthTypedData: typeof buildPendingChangeCancelAuthTypedData;
695
+ declare const ___subscription_buildPermit2TypedData: typeof buildPermit2TypedData;
696
+ declare const ___subscription_buildSubscriptionTermsTypedData: typeof buildSubscriptionTermsTypedData;
697
+ declare const ___subscription_computeElapsedPeriods: typeof computeElapsedPeriods;
698
+ declare const ___subscription_computePermitSingleStructHash: typeof computePermitSingleStructHash;
699
+ declare const ___subscription_decodeAccessProof: typeof decodeAccessProof;
700
+ declare const ___subscription_decodePaymentPayload: typeof decodePaymentPayload;
701
+ declare const ___subscription_elapsedCalendarMonths: typeof elapsedCalendarMonths;
702
+ declare const ___subscription_encodeAccessProof: typeof encodeAccessProof;
703
+ declare const ___subscription_encodePaymentPayload: typeof encodePaymentPayload;
704
+ declare const ___subscription_hasSubscriptionCapability: typeof hasSubscriptionCapability;
705
+ declare const ___subscription_parseChainIdFromNetwork: typeof parseChainIdFromNetwork;
706
+ declare const ___subscription_parsePaymentRequired: typeof parsePaymentRequired;
707
+ declare const ___subscription_supportsSubscription: typeof supportsSubscription;
708
+ declare const ___subscription_verifyTermsBindRequirements: typeof verifyTermsBindRequirements;
709
+ declare namespace ___subscription {
710
+ export { ___subscription_AccessProof as AccessProof, type ___subscription_AccessProofMessageInput as AccessProofMessageInput, ___subscription_AccessRouteRequirements as AccessRouteRequirements, type ___subscription_BuildCancelAuthTypedDataInput as BuildCancelAuthTypedDataInput, type ___subscription_BuildPermit2TypedDataInput as BuildPermit2TypedDataInput, type ___subscription_BuildSubscriptionTermsTypedDataInput as BuildSubscriptionTermsTypedDataInput, ___subscription_CANCEL_AUTH_TYPES as CANCEL_AUTH_TYPES, ___subscription_CancelAuth as CancelAuth, ___subscription_CancelInitiator as CancelInitiator, type ___subscription_ChangeFromExtra as ChangeFromExtra, ___subscription_ChargeError as ChargeError, type ___subscription_ChargeErrorCode as ChargeErrorCode, ___subscription_ChargeResult as ChargeResult, type ___subscription_EncodePaymentPayloadInput as EncodePaymentPayloadInput, type ___subscription_ErrorCode as ErrorCode, ___subscription_FacilitatorCancelData as FacilitatorCancelData, ___subscription_FacilitatorCancelPendingData as FacilitatorCancelPendingData, ___subscription_FacilitatorChangeData as FacilitatorChangeData, ___subscription_FacilitatorChargeData as FacilitatorChargeData, ___subscription_FacilitatorChargeRow as FacilitatorChargeRow, ___subscription_FacilitatorEnvelope as FacilitatorEnvelope, ___subscription_FacilitatorFinalizeExpiredData as FacilitatorFinalizeExpiredData, ___subscription_FacilitatorGetChargesData as FacilitatorGetChargesData, ___subscription_FacilitatorGetSubscriptionData as FacilitatorGetSubscriptionData, ___subscription_FacilitatorPendingChangeRow as FacilitatorPendingChangeRow, ___subscription_FacilitatorSubscribeData as FacilitatorSubscribeData, ___subscription_InMemoryStore as InMemoryStore, ___subscription_OnBeforeAccessContext as OnBeforeAccessContext, ___subscription_OnBeforeAccessHook as OnBeforeAccessHook, ___subscription_OnBeforeAccessResult as OnBeforeAccessResult, ___subscription_PENDING_CHANGE_CANCEL_AUTH_TYPES as PENDING_CHANGE_CANCEL_AUTH_TYPES, ___subscription_PERMIT2_TYPES as PERMIT2_TYPES, ___subscription_PendingChangeCancelAuth as PendingChangeCancelAuth, ___subscription_PendingPlanChange as PendingPlanChange, type ___subscription_PermitSingleData as PermitSingleData, ___subscription_PlanCatalog as PlanCatalog, ___subscription_PlanCatalogEntry as PlanCatalogEntry, ___subscription_PlanInitialCharge as PlanInitialCharge, ___subscription_SUBSCRIPTION_TERMS_TYPES as SUBSCRIPTION_TERMS_TYPES, ___subscription_SettleCancelOk as SettleCancelOk, ___subscription_SettleCancelPendingChangeOk as SettleCancelPendingChangeOk, ___subscription_SettleCancelPendingChangeResult as SettleCancelPendingChangeResult, ___subscription_SettleCancelResult as SettleCancelResult, ___subscription_SettleChangeOk as SettleChangeOk, ___subscription_SettleChangeResult as SettleChangeResult, ___subscription_SettleResultFail as SettleResultFail, ___subscription_SettleSubscribeOk as SettleSubscribeOk, ___subscription_SettleSubscribeResult as SettleSubscribeResult, ___subscription_Subscription as Subscription, ___subscription_SubscriptionCapability as SubscriptionCapability, ___subscription_SubscriptionClient as SubscriptionClient, type ___subscription_SubscriptionClientConfig as SubscriptionClientConfig, type ___subscription_SubscriptionContractAddresses as SubscriptionContractAddresses, ___subscription_SubscriptionFacilitatorClient as SubscriptionFacilitatorClient, type ___subscription_SubscriptionPaymentInner as SubscriptionPaymentInner, type ___subscription_SubscriptionPlanExtra as SubscriptionPlanExtra, type ___subscription_SubscriptionRequirementsExtra as SubscriptionRequirementsExtra, ___subscription_SubscriptionState as SubscriptionState, type ___subscription_SubscriptionStore as SubscriptionStore, type ___subscription_SubscriptionTerms as SubscriptionTerms, type ___subscription_TypedDataEnvelope as TypedDataEnvelope, ___subscription_VerifyAccessOk as VerifyAccessOk, ___subscription_VerifyAccessResult as VerifyAccessResult, ___subscription_VerifyChangeOk as VerifyChangeOk, ___subscription_VerifyChangeResult as VerifyChangeResult, ___subscription_VerifyOwnershipOk as VerifyOwnershipOk, ___subscription_VerifyOwnershipResult as VerifyOwnershipResult, ___subscription_VerifyResult as VerifyResult, ___subscription_VerifyResultFail as VerifyResultFail, ___subscription_VerifyResultOk as VerifyResultOk, ___subscription_ZERO_BYTES32 as ZERO_BYTES32, ___subscription_addCalendarMonths as addCalendarMonths, ___subscription_asSubscriptionPaymentInner as asSubscriptionPaymentInner, ___subscription_base64DecodeUtf8 as base64DecodeUtf8, ___subscription_base64EncodeUtf8 as base64EncodeUtf8, ___subscription_buildAccessProofMessage as buildAccessProofMessage, ___subscription_buildCancelAuthTypedData as buildCancelAuthTypedData, ___subscription_buildPendingChangeCancelAuthTypedData as buildPendingChangeCancelAuthTypedData, ___subscription_buildPermit2TypedData as buildPermit2TypedData, ___subscription_buildSubscriptionTermsTypedData as buildSubscriptionTermsTypedData, ___subscription_computeElapsedPeriods as computeElapsedPeriods, ___subscription_computePermitSingleStructHash as computePermitSingleStructHash, ___subscription_decodeAccessProof as decodeAccessProof, ___subscription_decodePaymentPayload as decodePaymentPayload, ___subscription_elapsedCalendarMonths as elapsedCalendarMonths, ___subscription_encodeAccessProof as encodeAccessProof, ___subscription_encodePaymentPayload as encodePaymentPayload, ___subscription_hasSubscriptionCapability as hasSubscriptionCapability, ___subscription_parseChainIdFromNetwork as parseChainIdFromNetwork, ___subscription_parsePaymentRequired as parsePaymentRequired, ___subscription_supportsSubscription as supportsSubscription, ___subscription_verifyTermsBindRequirements as verifyTermsBindRequirements };
711
+ }
712
+
713
+ export { type AccessProofMessageInput as A, type BuildCancelAuthTypedDataInput as B, CANCEL_AUTH_TYPES as C, computePermitSingleStructHash as D, type EncodePaymentPayloadInput as E, decodeAccessProof as F, decodePaymentPayload as G, elapsedCalendarMonths as H, InMemoryStore as I, encodeAccessProof as J, encodePaymentPayload as K, parseChainIdFromNetwork as L, parsePaymentRequired as M, verifyTermsBindRequirements as N, PENDING_CHANGE_CANCEL_AUTH_TYPES as P, SUBSCRIPTION_TERMS_TYPES as S, type TypedDataEnvelope as T, ZERO_BYTES32 as Z, ___subscription as _, type BuildPermit2TypedDataInput as a, type BuildSubscriptionTermsTypedDataInput as b, type ChangeFromExtra as c, ChargeError as d, ChargeErrorCode as e, ErrorCode as f, PERMIT2_TYPES as g, type PermitSingleData as h, SubscriptionClient as i, type SubscriptionClientConfig as j, type SubscriptionContractAddresses as k, type SubscriptionPaymentInner as l, type SubscriptionPlanExtra as m, type SubscriptionRequirementsExtra as n, type SubscriptionStore as o, type SubscriptionTerms as p, addCalendarMonths as q, asSubscriptionPaymentInner as r, base64DecodeUtf8 as s, base64EncodeUtf8 as t, buildAccessProofMessage as u, buildCancelAuthTypedData as v, buildPendingChangeCancelAuthTypedData as w, buildPermit2TypedData as x, buildSubscriptionTermsTypedData as y, computeElapsedPeriods as z };