@bosonprotocol/x402-server 0.2.0 → 0.3.0-alpha-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.
@@ -1,12 +1,13 @@
1
1
  import { UnsignedFullOffer } from '@bosonprotocol/x402-core/eip712';
2
2
  import { Address, BosonOfferRef, TokenAuthStrategy, FulfillmentRequirements, EvmNetwork, EscrowPaymentRequirements } from '@bosonprotocol/x402-core/schemes/escrow';
3
- import { S as SellerSigner } from '../config-CBr9qMps.js';
3
+ import { S as SellerSigner } from '../config-hnCiZiXF.js';
4
4
  import { ChannelRegistry } from '@bosonprotocol/x402-actions';
5
5
  import '@bosonprotocol/x402-facilitator';
6
6
  import 'viem';
7
7
  import 'zod';
8
8
  import '@bosonprotocol/core-sdk';
9
9
  import '../onchain/index.js';
10
+ import '../client-B2yejopi.js';
10
11
 
11
12
  interface SignFullOfferArgs {
12
13
  fullOffer: UnsignedFullOffer;
@@ -0,0 +1,88 @@
1
+ import { FacilitatorVerifyInput, FacilitatorVerifyResult, FacilitatorSettleInput, FacilitatorSettleResult, FacilitatorPerformActionInput, FacilitatorPerformActionResult } from '@bosonprotocol/x402-facilitator';
2
+
3
+ interface Logger {
4
+ debug(msg: string, meta?: Record<string, unknown>): void;
5
+ info(msg: string, meta?: Record<string, unknown>): void;
6
+ warn(msg: string, meta?: Record<string, unknown>): void;
7
+ error(msg: string, meta?: Record<string, unknown>): void;
8
+ }
9
+ /** No-op logger — the default when the host doesn't supply one. */
10
+ declare const noopLogger: Logger;
11
+
12
+ type FetchLike = (input: string, init?: {
13
+ method?: string;
14
+ headers?: Record<string, string>;
15
+ body?: string;
16
+ signal?: AbortSignal;
17
+ }) => Promise<{
18
+ ok: boolean;
19
+ status: number;
20
+ text: () => Promise<string>;
21
+ json?: () => Promise<unknown>;
22
+ }>;
23
+ interface FacilitatorRetryOptions {
24
+ /** Total attempt budget (initial try + retries). Default 3. */
25
+ attempts: number;
26
+ /** Linear-backoff multiplier in ms: sleep `backoffMs * attemptIndex` between attempts. Default 200. */
27
+ backoffMs: number;
28
+ }
29
+ interface CreateFacilitatorClientOptions {
30
+ /** Base URL of the facilitator service (no trailing slash needed). */
31
+ url: string;
32
+ /** Optional `fetch` override — defaults to the global `fetch`. Useful for tests + non-`fetch` runtimes. */
33
+ fetch?: FetchLike;
34
+ /** Optional headers attached to every request — e.g. an `Authorization` for hosted facilitators. */
35
+ headers?: Record<string, string>;
36
+ /**
37
+ * Per-attempt timeout in ms. Default 30_000. The `AbortController`
38
+ * aborts in-flight fetches when this elapses; the error surfaces as
39
+ * `FacilitatorHttpError` with code `TIMEOUT` and is retried under
40
+ * the same policy as `NETWORK_ERROR`.
41
+ */
42
+ timeoutMs?: number;
43
+ /**
44
+ * Retry policy applied to `NETWORK_ERROR`, `TIMEOUT`, and HTTP 5xx
45
+ * responses. Defaults to `{ attempts: 3, backoffMs: 200 }` — three
46
+ * attempts total at 0/200/400 ms. Set `{ attempts: 1, backoffMs: 0 }`
47
+ * to disable.
48
+ */
49
+ retry?: FacilitatorRetryOptions;
50
+ /**
51
+ * Factory for the `x-x402b-idempotency-key` header attached to
52
+ * `/settle` calls. Called once per logical request — *not* once per
53
+ * retry attempt — so the facilitator's dedup table can recognise
54
+ * retries of the same intent. Defaults to `crypto.randomUUID`.
55
+ */
56
+ idempotencyKey?: () => string;
57
+ /** Override for `setTimeout` — tests use this to skip real backoff sleeps. */
58
+ setTimeout?: typeof setTimeout;
59
+ /** Override for `clearTimeout` — paired with `setTimeout`. */
60
+ clearTimeout?: typeof clearTimeout;
61
+ /** Optional structured logger. Defaults to no-op. Receives `warn` on errored requests; `debug` on each call. */
62
+ logger?: Logger;
63
+ }
64
+ interface FacilitatorClient {
65
+ verify(input: FacilitatorVerifyInput): Promise<FacilitatorVerifyResult>;
66
+ settle(input: FacilitatorSettleInput): Promise<FacilitatorSettleResult>;
67
+ performAction(input: FacilitatorPerformActionInput): Promise<FacilitatorPerformActionResult>;
68
+ /**
69
+ * GET `/healthz` liveness probe. Resolves on any 2xx; throws on
70
+ * network error or non-2xx. Designed for the server SDK's
71
+ * `healthCheck()` helper — hosts mount that one behind whatever
72
+ * `/healthz` route their framework uses.
73
+ */
74
+ healthCheck(): Promise<void>;
75
+ }
76
+ /** Idempotency-key header name. Stable so a facilitator-side dedup table can recognise it. */
77
+ declare const IDEMPOTENCY_KEY_HEADER = "x-x402b-idempotency-key";
78
+ /**
79
+ * Construct a typed HTTP client for the facilitator. The returned
80
+ * methods stringify the input as JSON and POST to the matching path
81
+ * on the configured URL. Bodies matching the well-formed result shape
82
+ * (whether HTTP 2xx success or HTTP 400 domain rejection) are returned
83
+ * verbatim; transport failures (network, non-JSON body,
84
+ * schema-mismatched body) raise `FacilitatorHttpError`.
85
+ */
86
+ declare function createFacilitatorClient(opts: CreateFacilitatorClientOptions): FacilitatorClient;
87
+
88
+ export { type CreateFacilitatorClientOptions as C, type FacilitatorRetryOptions as F, IDEMPOTENCY_KEY_HEADER as I, type Logger as L, type FacilitatorClient as a, type FetchLike as b, createFacilitatorClient as c, noopLogger as n };
@@ -6,6 +6,7 @@ import { Hex } from 'viem';
6
6
  import { z } from 'zod';
7
7
  import { CoreSDK } from '@bosonprotocol/core-sdk';
8
8
  import { ExchangeReader } from './onchain/index.js';
9
+ import { F as FacilitatorRetryOptions, L as Logger } from './client-B2yejopi.js';
9
10
 
10
11
  /** Funds entity returned by `coreSdk.getFunds` — narrowed to the fields the handler reshapes. */
11
12
  interface CoreSdkFundsEntity {
@@ -50,6 +51,34 @@ interface CoreSdkReadAdapter {
50
51
  */
51
52
  declare function asCoreSdkReadAdapter(coreSdk: CoreSDK): CoreSdkReadAdapter;
52
53
 
54
+ /**
55
+ * Minimal async key/value store. `get` / `set` / `delete` are the
56
+ * hot-path handler operations; `entries` is consumed by the
57
+ * recovery-inspection surface (`recovery.list`) and stays optional in
58
+ * spirit by being a method on the same interface — wrapping a `Map`
59
+ * via `mapAsStore` makes all four trivial.
60
+ */
61
+ interface Store<V> {
62
+ get(key: string): Promise<V | undefined>;
63
+ set(key: string, value: V): Promise<void>;
64
+ delete(key: string): Promise<void>;
65
+ entries(): AsyncIterable<readonly [string, V]>;
66
+ }
67
+ /**
68
+ * Wrap an in-memory `Map` as a `Store<V>`. The adapter is intentionally
69
+ * cheap — no copies, no locking — so single-process tests and dev
70
+ * deployments pay zero overhead versus the previous direct-`Map`
71
+ * shape.
72
+ */
73
+ declare function mapAsStore<V>(m: Map<string, V>): Store<V>;
74
+ /**
75
+ * Structural type-guard for the `Store<V>` shape. Used by
76
+ * `x402bServerConfigSchema` to validate host-supplied stores without
77
+ * locking the contract to `Map` (the previous `z.instanceof(Map)`
78
+ * accepted only the concrete `Map` class).
79
+ */
80
+ declare function isStore(value: unknown): value is Store<unknown>;
81
+
53
82
  /**
54
83
  * Minimal signing surface needed by `signFullOffer`. Structurally
55
84
  * compatible with viem's `Account` (in particular `LocalAccount` from
@@ -85,9 +114,20 @@ interface X402bServerConfig {
85
114
  escrow: Address;
86
115
  /** Seller signer (signs the FullOffer EIP-712 typed-data). */
87
116
  signer: SellerSigner;
88
- /** Facilitator service the server forwards meta-tx envelopes to. The URL is also advertised in `nextActions[].endpoints.facilitator`. */
117
+ /**
118
+ * Facilitator service the server forwards meta-tx envelopes to. The
119
+ * URL is also advertised in `nextActions[].endpoints.facilitator`.
120
+ *
121
+ * `timeoutMs`, `retry`, and `idempotencyKey` tune the HTTP client at
122
+ * `./facilitator/client.ts`. Defaults: 30 s timeout; 3 attempts at
123
+ * 0 / 200 / 400 ms; idempotency key sourced from `crypto.randomUUID()`
124
+ * on every `/settle` call.
125
+ */
89
126
  facilitator: {
90
127
  url: string;
128
+ timeoutMs?: number;
129
+ retry?: FacilitatorRetryOptions;
130
+ idempotencyKey?: () => string;
91
131
  };
92
132
  /** Per-seller channel + endpoint registry consumed by `deriveNextActions`. */
93
133
  channelRegistry: ChannelRegistry;
@@ -123,19 +163,31 @@ interface X402bServerConfig {
123
163
  * cannot switch to a channel the offer never advertised.
124
164
  *
125
165
  * Optional in the config: when omitted, `createX402bServer` wires up
126
- * an in-memory `Map`. Hosts running multiple instances should plug
127
- * in their own cross-process `Map`-shaped backing store.
166
+ * an in-memory `Map` via `mapAsStore`. Single-process / dev
167
+ * deployments need no extra plumbing; hosts running multiple
168
+ * instances or who need to survive a restart MUST supply their own
169
+ * `Store` implementation (Redis, Postgres, etc.) — otherwise the
170
+ * Flow A redeem-time option-policy check is silently bypassed after
171
+ * a restart because the in-memory `Map` is empty.
128
172
  */
129
- exchangeFulfillmentOptionStore?: Map<string, readonly string[]>;
173
+ exchangeFulfillmentOptionStore?: Store<readonly string[]>;
130
174
  /**
131
- * Pending fulfillment updates that reached REDEEMED on-chain but
132
- * failed the server-side `channel.onCommit(...)` upsert. The commit
133
- * handler records Flow B updates here before attempting the channel
134
- * write; the redeem handler does the same for Flow A. Both delete the
135
- * record on success and leave it behind with the error message on
136
- * failure so the host can replay/reconcile out of band.
175
+ * Pending fulfillment work that reached REDEEMED on-chain but did
176
+ * not complete server-side. Tracks both the `channel.onCommit(...)`
177
+ * upsert and the `channel.onFulfill(...)` delivery dispatch see
178
+ * `FulfillmentRecoveryEntry.phase` for which step each entry left
179
+ * behind. The commit handler records Flow B entries; the redeem
180
+ * handler records Flow A. Each step deletes the entry on success
181
+ * and re-records it with the error message on failure so the host
182
+ * can replay/reconcile out of band.
183
+ *
184
+ * Same persistence story as `exchangeFulfillmentOptionStore`:
185
+ * defaults to in-memory `Map`; production hosts MUST supply a
186
+ * persistent `Store` or lose the recovery queue on every restart —
187
+ * the on-chain voucher is irreversibly REDEEMED in that window and
188
+ * the buyer's delivery payload becomes unrecoverable.
137
189
  */
138
- fulfillmentRecoveryStore?: Map<string, FulfillmentRecoveryEntry>;
190
+ fulfillmentRecoveryStore?: Store<FulfillmentRecoveryEntry>;
139
191
  /**
140
192
  * Fulfillment channels the server accepts at redeem time when the
141
193
  * client re-submits delivery data. Structurally a subset of
@@ -147,7 +199,52 @@ interface X402bServerConfig {
147
199
  * `FULFILLMENT_CHANNELS_NOT_CONFIGURED`.
148
200
  */
149
201
  fulfillmentChannels?: readonly RedeemFulfillmentChannel[];
202
+ /**
203
+ * Optional structured logger. Threaded through the handlers + the
204
+ * facilitator HTTP client; events emitted include recovery-store
205
+ * writes, channel-`onCommit` failures, facilitator retry attempts,
206
+ * and boot diagnostics. Defaults to a no-op so the SDK is silent
207
+ * unless the host opts in.
208
+ */
209
+ logger?: Logger;
210
+ /**
211
+ * Operational mode. Default `"development"` accepts everything the
212
+ * type system allows. `"production"` adds a boot-time `superRefine`
213
+ * that requires:
214
+ *
215
+ * - `exchangeReader` (post-settle state verification is non-optional)
216
+ * - one of `coreSdkRead` / `subgraphUrl` (withdraw / available-funds
217
+ * require a read client)
218
+ * - `exchangeFulfillmentOptionStore` (otherwise the Flow A redeem-time
219
+ * option gate silently relaxes after a restart)
220
+ * - `fulfillmentRecoveryStore` (otherwise post-settle channel-onCommit
221
+ * failures lose their replay handle)
222
+ *
223
+ * Without `mode: "production"`, those fields default at runtime; a
224
+ * misconfigured deploy boots clean and only explodes on the first
225
+ * request. `mode: "production"` makes the misconfiguration a synchronous
226
+ * `ZodError` at `createX402bServer` time instead.
227
+ */
228
+ mode?: "development" | "production";
150
229
  }
230
+ /**
231
+ * Result of a channel's `onFulfill` dispatch. Mirrors
232
+ * `@bosonprotocol/x402-fulfillment`'s `FulfillmentResult` (kept inline so
233
+ * this SDK doesn't depend on that package — see `RedeemFulfillmentChannel`).
234
+ *
235
+ * - `inline` — the resource itself (the server base64-encodes `body` for
236
+ * the JSON wire response; see `serializeFulfillmentResult`).
237
+ * - `async` — delivered out-of-band; an optional `pointer` (e.g.
238
+ * `ipfs://…`, the buyer's webhook `https://…`) is surfaced to the caller.
239
+ */
240
+ type FulfillmentResult = {
241
+ kind: "inline";
242
+ body: Uint8Array;
243
+ contentType: string;
244
+ } | {
245
+ kind: "async";
246
+ pointer?: string;
247
+ };
151
248
  /**
152
249
  * Minimal structural slice of `FulfillmentChannel` the redeem
153
250
  * handler needs. Kept inline so `@bosonprotocol/x402-server` does
@@ -164,6 +261,15 @@ interface RedeemFulfillmentChannel {
164
261
  reason: string;
165
262
  };
166
263
  onCommit(exchangeId: string, data: Record<string, unknown> | null): Promise<void>;
264
+ /**
265
+ * Dispatch delivery once the on-chain release is confirmed (REDEEMED).
266
+ * Optional: when present, the redeem / atomic-commit-and-redeem handlers
267
+ * invoke it after `onCommit` persists the buyer's target, and surface
268
+ * the result on the 200 response. A host that delivers out-of-band via
269
+ * its own worker can omit it — persistence (`onCommit`) still runs.
270
+ * Real `@bosonprotocol/x402-fulfillment` channels always implement it.
271
+ */
272
+ onFulfill?(exchangeId: string): Promise<FulfillmentResult>;
167
273
  }
168
274
  interface FulfillmentRecoveryEntry {
169
275
  exchangeId: string;
@@ -171,6 +277,17 @@ interface FulfillmentRecoveryEntry {
171
277
  data: Record<string, unknown> | null;
172
278
  redeemer: Address;
173
279
  recordedAt: number;
280
+ /**
281
+ * Which lifecycle step left this entry behind:
282
+ * - `"commit"` — `channel.onCommit(...)` was pending / failed
283
+ * (the server's delivery-target store was not updated).
284
+ * - `"delivery"` — `onCommit` persisted, but `channel.onFulfill(...)`
285
+ * was pending / failed (the buyer's webhook POST / IPFS upload
286
+ * still needs dispatch).
287
+ * A single recovery worker can dispatch the right retry step by
288
+ * branching on this field.
289
+ */
290
+ phase: "commit" | "delivery";
174
291
  error?: string;
175
292
  }
176
293
  /**
@@ -196,10 +313,34 @@ declare const x402bServerConfigSchema: z.ZodEffects<z.ZodObject<{
196
313
  }, z.ZodTypeAny, "passthrough">>;
197
314
  facilitator: z.ZodObject<{
198
315
  url: z.ZodEffects<z.ZodString, string, string>;
316
+ timeoutMs: z.ZodOptional<z.ZodNumber>;
317
+ retry: z.ZodOptional<z.ZodObject<{
318
+ attempts: z.ZodNumber;
319
+ backoffMs: z.ZodNumber;
320
+ }, "strict", z.ZodTypeAny, {
321
+ attempts: number;
322
+ backoffMs: number;
323
+ }, {
324
+ attempts: number;
325
+ backoffMs: number;
326
+ }>>;
327
+ idempotencyKey: z.ZodOptional<z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodString>>;
199
328
  }, "strict", z.ZodTypeAny, {
200
329
  url: string;
330
+ timeoutMs?: number | undefined;
331
+ retry?: {
332
+ attempts: number;
333
+ backoffMs: number;
334
+ } | undefined;
335
+ idempotencyKey?: ((...args: unknown[]) => string) | undefined;
201
336
  }, {
202
337
  url: string;
338
+ timeoutMs?: number | undefined;
339
+ retry?: {
340
+ attempts: number;
341
+ backoffMs: number;
342
+ } | undefined;
343
+ idempotencyKey?: ((...args: unknown[]) => string) | undefined;
203
344
  }>;
204
345
  channelRegistry: z.ZodObject<{
205
346
  channels: z.ZodEffects<z.ZodArray<z.ZodEnum<[_bosonprotocol_x402_actions.ActionChannel, ..._bosonprotocol_x402_actions.ActionChannel[]]>, "many">, _bosonprotocol_x402_actions.ActionChannel[], _bosonprotocol_x402_actions.ActionChannel[]>;
@@ -241,29 +382,51 @@ declare const x402bServerConfigSchema: z.ZodEffects<z.ZodObject<{
241
382
  getSellersByAddress: z.ZodFunction<z.ZodTuple<[z.ZodUnknown], z.ZodUnknown>, z.ZodUnknown>;
242
383
  getBuyers: z.ZodFunction<z.ZodTuple<[z.ZodUnknown], z.ZodUnknown>, z.ZodUnknown>;
243
384
  }, z.ZodTypeAny, "passthrough">>>;
244
- exchangeFulfillmentOptionStore: z.ZodOptional<z.ZodType<Map<unknown, unknown>, z.ZodTypeDef, Map<unknown, unknown>>>;
245
- fulfillmentRecoveryStore: z.ZodOptional<z.ZodType<Map<unknown, unknown>, z.ZodTypeDef, Map<unknown, unknown>>>;
385
+ exchangeFulfillmentOptionStore: z.ZodOptional<z.ZodType<Store<readonly string[]>, z.ZodTypeDef, Store<readonly string[]>>>;
386
+ fulfillmentRecoveryStore: z.ZodOptional<z.ZodType<Store<FulfillmentRecoveryEntry>, z.ZodTypeDef, Store<FulfillmentRecoveryEntry>>>;
387
+ logger: z.ZodOptional<z.ZodObject<{
388
+ debug: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodUnknown>;
389
+ info: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodUnknown>;
390
+ warn: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodUnknown>;
391
+ error: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodUnknown>;
392
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
393
+ debug: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodUnknown>;
394
+ info: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodUnknown>;
395
+ warn: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodUnknown>;
396
+ error: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodUnknown>;
397
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
398
+ debug: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodUnknown>;
399
+ info: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodUnknown>;
400
+ warn: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodUnknown>;
401
+ error: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodUnknown>;
402
+ }, z.ZodTypeAny, "passthrough">>>;
246
403
  fulfillmentChannels: z.ZodOptional<z.ZodEffects<z.ZodArray<z.ZodObject<{
247
404
  id: z.ZodString;
248
405
  validate: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodUnknown>;
249
406
  onCommit: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodUnknown>;
407
+ onFulfill: z.ZodOptional<z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodUnknown>>;
250
408
  }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
251
409
  id: z.ZodString;
252
410
  validate: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodUnknown>;
253
411
  onCommit: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodUnknown>;
412
+ onFulfill: z.ZodOptional<z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodUnknown>>;
254
413
  }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
255
414
  id: z.ZodString;
256
415
  validate: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodUnknown>;
257
416
  onCommit: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodUnknown>;
417
+ onFulfill: z.ZodOptional<z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodUnknown>>;
258
418
  }, z.ZodTypeAny, "passthrough">>, "many">, z.objectOutputType<{
259
419
  id: z.ZodString;
260
420
  validate: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodUnknown>;
261
421
  onCommit: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodUnknown>;
422
+ onFulfill: z.ZodOptional<z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodUnknown>>;
262
423
  }, z.ZodTypeAny, "passthrough">[], z.objectInputType<{
263
424
  id: z.ZodString;
264
425
  validate: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodUnknown>;
265
426
  onCommit: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodUnknown>;
427
+ onFulfill: z.ZodOptional<z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodUnknown>>;
266
428
  }, z.ZodTypeAny, "passthrough">[]>>;
429
+ mode: z.ZodOptional<z.ZodEnum<["development", "production"]>>;
267
430
  }, "strict", z.ZodTypeAny, {
268
431
  chainId: number;
269
432
  network: string;
@@ -277,6 +440,12 @@ declare const x402bServerConfigSchema: z.ZodEffects<z.ZodObject<{
277
440
  };
278
441
  facilitator: {
279
442
  url: string;
443
+ timeoutMs?: number | undefined;
444
+ retry?: {
445
+ attempts: number;
446
+ backoffMs: number;
447
+ } | undefined;
448
+ idempotencyKey?: ((...args: unknown[]) => string) | undefined;
280
449
  };
281
450
  signer: {
282
451
  address: string;
@@ -293,13 +462,21 @@ declare const x402bServerConfigSchema: z.ZodEffects<z.ZodObject<{
293
462
  getSellersByAddress: z.ZodFunction<z.ZodTuple<[z.ZodUnknown], z.ZodUnknown>, z.ZodUnknown>;
294
463
  getBuyers: z.ZodFunction<z.ZodTuple<[z.ZodUnknown], z.ZodUnknown>, z.ZodUnknown>;
295
464
  }, z.ZodTypeAny, "passthrough"> | undefined;
296
- exchangeFulfillmentOptionStore?: Map<unknown, unknown> | undefined;
297
- fulfillmentRecoveryStore?: Map<unknown, unknown> | undefined;
465
+ exchangeFulfillmentOptionStore?: Store<readonly string[]> | undefined;
466
+ fulfillmentRecoveryStore?: Store<FulfillmentRecoveryEntry> | undefined;
467
+ logger?: z.objectOutputType<{
468
+ debug: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodUnknown>;
469
+ info: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodUnknown>;
470
+ warn: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodUnknown>;
471
+ error: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodUnknown>;
472
+ }, z.ZodTypeAny, "passthrough"> | undefined;
298
473
  fulfillmentChannels?: z.objectOutputType<{
299
474
  id: z.ZodString;
300
475
  validate: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodUnknown>;
301
476
  onCommit: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodUnknown>;
477
+ onFulfill: z.ZodOptional<z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodUnknown>>;
302
478
  }, z.ZodTypeAny, "passthrough">[] | undefined;
479
+ mode?: "production" | "development" | undefined;
303
480
  }, {
304
481
  chainId: number;
305
482
  network: string;
@@ -313,6 +490,12 @@ declare const x402bServerConfigSchema: z.ZodEffects<z.ZodObject<{
313
490
  };
314
491
  facilitator: {
315
492
  url: string;
493
+ timeoutMs?: number | undefined;
494
+ retry?: {
495
+ attempts: number;
496
+ backoffMs: number;
497
+ } | undefined;
498
+ idempotencyKey?: ((...args: unknown[]) => string) | undefined;
316
499
  };
317
500
  signer: {
318
501
  address: string;
@@ -329,13 +512,21 @@ declare const x402bServerConfigSchema: z.ZodEffects<z.ZodObject<{
329
512
  getSellersByAddress: z.ZodFunction<z.ZodTuple<[z.ZodUnknown], z.ZodUnknown>, z.ZodUnknown>;
330
513
  getBuyers: z.ZodFunction<z.ZodTuple<[z.ZodUnknown], z.ZodUnknown>, z.ZodUnknown>;
331
514
  }, z.ZodTypeAny, "passthrough"> | undefined;
332
- exchangeFulfillmentOptionStore?: Map<unknown, unknown> | undefined;
333
- fulfillmentRecoveryStore?: Map<unknown, unknown> | undefined;
515
+ exchangeFulfillmentOptionStore?: Store<readonly string[]> | undefined;
516
+ fulfillmentRecoveryStore?: Store<FulfillmentRecoveryEntry> | undefined;
517
+ logger?: z.objectInputType<{
518
+ debug: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodUnknown>;
519
+ info: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodUnknown>;
520
+ warn: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodUnknown>;
521
+ error: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodUnknown>;
522
+ }, z.ZodTypeAny, "passthrough"> | undefined;
334
523
  fulfillmentChannels?: z.objectInputType<{
335
524
  id: z.ZodString;
336
525
  validate: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodUnknown>;
337
526
  onCommit: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodUnknown>;
527
+ onFulfill: z.ZodOptional<z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodUnknown>>;
338
528
  }, z.ZodTypeAny, "passthrough">[] | undefined;
529
+ mode?: "production" | "development" | undefined;
339
530
  }>, {
340
531
  chainId: number;
341
532
  network: string;
@@ -349,6 +540,12 @@ declare const x402bServerConfigSchema: z.ZodEffects<z.ZodObject<{
349
540
  };
350
541
  facilitator: {
351
542
  url: string;
543
+ timeoutMs?: number | undefined;
544
+ retry?: {
545
+ attempts: number;
546
+ backoffMs: number;
547
+ } | undefined;
548
+ idempotencyKey?: ((...args: unknown[]) => string) | undefined;
352
549
  };
353
550
  signer: {
354
551
  address: string;
@@ -365,13 +562,21 @@ declare const x402bServerConfigSchema: z.ZodEffects<z.ZodObject<{
365
562
  getSellersByAddress: z.ZodFunction<z.ZodTuple<[z.ZodUnknown], z.ZodUnknown>, z.ZodUnknown>;
366
563
  getBuyers: z.ZodFunction<z.ZodTuple<[z.ZodUnknown], z.ZodUnknown>, z.ZodUnknown>;
367
564
  }, z.ZodTypeAny, "passthrough"> | undefined;
368
- exchangeFulfillmentOptionStore?: Map<unknown, unknown> | undefined;
369
- fulfillmentRecoveryStore?: Map<unknown, unknown> | undefined;
565
+ exchangeFulfillmentOptionStore?: Store<readonly string[]> | undefined;
566
+ fulfillmentRecoveryStore?: Store<FulfillmentRecoveryEntry> | undefined;
567
+ logger?: z.objectOutputType<{
568
+ debug: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodUnknown>;
569
+ info: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodUnknown>;
570
+ warn: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodUnknown>;
571
+ error: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodUnknown>;
572
+ }, z.ZodTypeAny, "passthrough"> | undefined;
370
573
  fulfillmentChannels?: z.objectOutputType<{
371
574
  id: z.ZodString;
372
575
  validate: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodUnknown>;
373
576
  onCommit: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodUnknown>;
577
+ onFulfill: z.ZodOptional<z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodUnknown>>;
374
578
  }, z.ZodTypeAny, "passthrough">[] | undefined;
579
+ mode?: "production" | "development" | undefined;
375
580
  }, {
376
581
  chainId: number;
377
582
  network: string;
@@ -385,6 +590,12 @@ declare const x402bServerConfigSchema: z.ZodEffects<z.ZodObject<{
385
590
  };
386
591
  facilitator: {
387
592
  url: string;
593
+ timeoutMs?: number | undefined;
594
+ retry?: {
595
+ attempts: number;
596
+ backoffMs: number;
597
+ } | undefined;
598
+ idempotencyKey?: ((...args: unknown[]) => string) | undefined;
388
599
  };
389
600
  signer: {
390
601
  address: string;
@@ -401,13 +612,21 @@ declare const x402bServerConfigSchema: z.ZodEffects<z.ZodObject<{
401
612
  getSellersByAddress: z.ZodFunction<z.ZodTuple<[z.ZodUnknown], z.ZodUnknown>, z.ZodUnknown>;
402
613
  getBuyers: z.ZodFunction<z.ZodTuple<[z.ZodUnknown], z.ZodUnknown>, z.ZodUnknown>;
403
614
  }, z.ZodTypeAny, "passthrough"> | undefined;
404
- exchangeFulfillmentOptionStore?: Map<unknown, unknown> | undefined;
405
- fulfillmentRecoveryStore?: Map<unknown, unknown> | undefined;
615
+ exchangeFulfillmentOptionStore?: Store<readonly string[]> | undefined;
616
+ fulfillmentRecoveryStore?: Store<FulfillmentRecoveryEntry> | undefined;
617
+ logger?: z.objectInputType<{
618
+ debug: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodUnknown>;
619
+ info: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodUnknown>;
620
+ warn: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodUnknown>;
621
+ error: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodUnknown>;
622
+ }, z.ZodTypeAny, "passthrough"> | undefined;
406
623
  fulfillmentChannels?: z.objectInputType<{
407
624
  id: z.ZodString;
408
625
  validate: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodUnknown>;
409
626
  onCommit: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodUnknown>;
627
+ onFulfill: z.ZodOptional<z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodUnknown>>;
410
628
  }, z.ZodTypeAny, "passthrough">[] | undefined;
629
+ mode?: "production" | "development" | undefined;
411
630
  }>;
412
631
  /**
413
632
  * Cross-field invariant: `config.escrow` and
@@ -416,4 +635,4 @@ declare const x402bServerConfigSchema: z.ZodEffects<z.ZodObject<{
416
635
  */
417
636
  declare function assertChannelRegistryEscrowMatch(config: X402bServerConfig): void;
418
637
 
419
- export { type CoreSdkBuyerEntity as C, type FulfillmentRecoveryEntry as F, type RedeemFulfillmentChannel as R, type SellerSigner as S, type X402bServerConfig as X, type CoreSdkFundsEntity as a, type CoreSdkReadAdapter as b, type CoreSdkSellerEntity as c, asCoreSdkReadAdapter as d, assertChannelRegistryEscrowMatch as e, x402bServerConfigSchema as x };
638
+ export { type CoreSdkReadAdapter as C, type FulfillmentRecoveryEntry as F, type RedeemFulfillmentChannel as R, type SellerSigner as S, type X402bServerConfig as X, type CoreSdkBuyerEntity as a, type CoreSdkFundsEntity as b, type CoreSdkSellerEntity as c, type FulfillmentResult as d, type Store as e, asCoreSdkReadAdapter as f, assertChannelRegistryEscrowMatch as g, isStore as i, mapAsStore as m, x402bServerConfigSchema as x };
@@ -1,4 +1,4 @@
1
- export { C as CreateFacilitatorClientOptions, F as FacilitatorClient, a as FetchLike, c as createFacilitatorClient } from '../client-tnrpqVMW.js';
1
+ export { C as CreateFacilitatorClientOptions, a as FacilitatorClient, F as FacilitatorRetryOptions, b as FetchLike, I as IDEMPOTENCY_KEY_HEADER, c as createFacilitatorClient } from '../client-B2yejopi.js';
2
2
  import { FacilitatorErrorCode } from '@bosonprotocol/x402-facilitator';
3
3
  export { FacilitatorErrorCode, FacilitatorPerformActionInput, FacilitatorPerformActionResult, FacilitatorSettleInput, FacilitatorSettleResult, FacilitatorVerifyInput, FacilitatorVerifyResult } from '@bosonprotocol/x402-facilitator';
4
4