@agentcash/router 1.4.1 → 1.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +150 -9
- package/dist/index.cjs +658 -112
- package/dist/index.d.cts +148 -41
- package/dist/index.d.ts +148 -41
- package/dist/index.js +646 -111
- package/package.json +3 -3
package/dist/index.d.cts
CHANGED
|
@@ -128,7 +128,7 @@ interface ErrorEvent {
|
|
|
128
128
|
interface AuthEvent {
|
|
129
129
|
/** Authentication mode that was verified */
|
|
130
130
|
authMode: 'siwx' | 'apiKey';
|
|
131
|
-
/** Verified wallet address (lowercase) */
|
|
131
|
+
/** Verified canonical wallet address (EVM lowercase, non-EVM preserved) */
|
|
132
132
|
wallet: string | null;
|
|
133
133
|
/** Route key */
|
|
134
134
|
route: string;
|
|
@@ -260,6 +260,60 @@ interface PaidOptions {
|
|
|
260
260
|
/** Override MPP protocol metadata in x-payment-info discovery. */
|
|
261
261
|
mpp?: MppProtocolInfo;
|
|
262
262
|
}
|
|
263
|
+
type PaymentStatus = 'verified' | 'settled';
|
|
264
|
+
interface HandlerPaymentContext {
|
|
265
|
+
protocol: ProtocolType;
|
|
266
|
+
status: PaymentStatus;
|
|
267
|
+
payer: string;
|
|
268
|
+
amount: string;
|
|
269
|
+
network: string;
|
|
270
|
+
recipient?: string;
|
|
271
|
+
transaction?: string;
|
|
272
|
+
receipt?: string;
|
|
273
|
+
}
|
|
274
|
+
interface SettlementLifecycleContext<TBody = unknown> {
|
|
275
|
+
route: string;
|
|
276
|
+
request: NextRequest;
|
|
277
|
+
body: TBody;
|
|
278
|
+
wallet: string;
|
|
279
|
+
account: unknown;
|
|
280
|
+
payment: HandlerPaymentContext;
|
|
281
|
+
response: NextResponse;
|
|
282
|
+
result: unknown;
|
|
283
|
+
}
|
|
284
|
+
interface SettlementSettledContext<TBody = unknown> extends Omit<SettlementLifecycleContext<TBody>, 'payment'> {
|
|
285
|
+
payment: HandlerPaymentContext & {
|
|
286
|
+
status: 'settled';
|
|
287
|
+
};
|
|
288
|
+
}
|
|
289
|
+
interface SettlementErrorContext<TBody = unknown> extends SettlementLifecycleContext<TBody> {
|
|
290
|
+
error: unknown;
|
|
291
|
+
phase: 'settle' | 'afterSettle';
|
|
292
|
+
}
|
|
293
|
+
interface SettledHandlerErrorContext<TBody = unknown> extends SettlementSettledContext<TBody> {
|
|
294
|
+
error: unknown;
|
|
295
|
+
}
|
|
296
|
+
interface SettlementLifecycle<TBody = unknown> {
|
|
297
|
+
/**
|
|
298
|
+
* Runs after the handler returns a successful response, before router-controlled
|
|
299
|
+
* settlement/broadcast. Throw with `.status` to return a specific error and
|
|
300
|
+
* skip settlement when the protocol flow has not already settled.
|
|
301
|
+
*/
|
|
302
|
+
beforeSettle?: (ctx: SettlementLifecycleContext<TBody>) => void | Promise<void>;
|
|
303
|
+
/**
|
|
304
|
+
* Runs after successful settlement. Use for durable ledgers and audit rows.
|
|
305
|
+
* Errors are alerted and do not change the already-settled response.
|
|
306
|
+
*/
|
|
307
|
+
afterSettle?: (ctx: SettlementSettledContext<TBody>) => void | Promise<void>;
|
|
308
|
+
/**
|
|
309
|
+
* Runs when the router has already observed a settled payment, then the
|
|
310
|
+
* handler returns an error response. Use for app-owned refund or
|
|
311
|
+
* compensation queues.
|
|
312
|
+
*/
|
|
313
|
+
onSettledHandlerError?: (ctx: SettledHandlerErrorContext<TBody>) => void | Promise<void>;
|
|
314
|
+
/** Runs when router-controlled settlement fails after the handler succeeded. */
|
|
315
|
+
onSettlementError?: (ctx: SettlementErrorContext<TBody>) => void | Promise<void>;
|
|
316
|
+
}
|
|
263
317
|
interface HandlerContext<TBody = undefined, TQuery = undefined> {
|
|
264
318
|
body: TBody;
|
|
265
319
|
query: TQuery;
|
|
@@ -267,6 +321,7 @@ interface HandlerContext<TBody = undefined, TQuery = undefined> {
|
|
|
267
321
|
requestId: string;
|
|
268
322
|
route: string;
|
|
269
323
|
wallet: string | null;
|
|
324
|
+
payment: HandlerPaymentContext | null;
|
|
270
325
|
account: unknown;
|
|
271
326
|
alert: AlertFn;
|
|
272
327
|
setVerifiedWallet: (addr: string) => void;
|
|
@@ -309,22 +364,22 @@ interface RouteEntry {
|
|
|
309
364
|
querySchema?: ZodType;
|
|
310
365
|
outputSchema?: ZodType;
|
|
311
366
|
/**
|
|
312
|
-
*
|
|
313
|
-
*
|
|
314
|
-
* validated at route-registration time via the Zod schema.
|
|
367
|
+
* Optional conforming example for the request input (body for body routes, query params for query routes).
|
|
368
|
+
* When present, it must satisfy the corresponding schema and is validated at route registration.
|
|
315
369
|
*
|
|
316
370
|
* Emitted in the bazaar discovery extension so indexers can advertise a working sample call.
|
|
317
371
|
*/
|
|
318
372
|
inputExample?: JsonObject;
|
|
319
373
|
/**
|
|
320
|
-
*
|
|
321
|
-
*
|
|
374
|
+
* Optional conforming example for the response output. When present, it must
|
|
375
|
+
* satisfy `outputSchema` and is validated at route registration.
|
|
322
376
|
*
|
|
323
377
|
* Accepts any JSON value (object, array, or primitive) to support top-level array or
|
|
324
378
|
* primitive response schemas.
|
|
325
379
|
*
|
|
326
|
-
* Emitted in the bazaar discovery extension. Without it the `output` block is
|
|
327
|
-
* the declaration entirely (the output schema alone cannot be
|
|
380
|
+
* Emitted in the bazaar discovery extension. Without it the `output` block is
|
|
381
|
+
* dropped from the declaration entirely (the output schema alone cannot be
|
|
382
|
+
* exposed in bazaar without an example).
|
|
328
383
|
*/
|
|
329
384
|
outputExample?: JsonValue;
|
|
330
385
|
description?: string;
|
|
@@ -337,6 +392,7 @@ interface RouteEntry {
|
|
|
337
392
|
providerName?: string;
|
|
338
393
|
providerConfig?: ProviderConfig;
|
|
339
394
|
validateFn?: (body: unknown) => void | Promise<void>;
|
|
395
|
+
settlement?: SettlementLifecycle;
|
|
340
396
|
mppInfo?: MppProtocolInfo;
|
|
341
397
|
}
|
|
342
398
|
interface DiscoveryConfig {
|
|
@@ -411,7 +467,7 @@ interface RouterConfig {
|
|
|
411
467
|
* createRouter({
|
|
412
468
|
* mpp: {
|
|
413
469
|
* secretKey: process.env.MPP_SECRET_KEY!,
|
|
414
|
-
* currency:
|
|
470
|
+
* currency: TEMPO_USDC_CURRENCY,
|
|
415
471
|
* useDefaultStore: true,
|
|
416
472
|
* }
|
|
417
473
|
* })
|
|
@@ -419,7 +475,7 @@ interface RouterConfig {
|
|
|
419
475
|
useDefaultStore?: boolean;
|
|
420
476
|
};
|
|
421
477
|
/**
|
|
422
|
-
* Payment protocols to accept on
|
|
478
|
+
* Payment protocols to accept on paid routes unless a route overrides them.
|
|
423
479
|
*
|
|
424
480
|
* @default ['x402']
|
|
425
481
|
*
|
|
@@ -427,7 +483,7 @@ interface RouterConfig {
|
|
|
427
483
|
* // Accept both x402 and MPP payments
|
|
428
484
|
* createRouter({
|
|
429
485
|
* protocols: ['x402', 'mpp'],
|
|
430
|
-
* mpp: { secretKey, currency, recipient },
|
|
486
|
+
* mpp: { secretKey, currency: TEMPO_USDC_CURRENCY, recipient },
|
|
431
487
|
* prices: { 'exa/search': '0.01' }
|
|
432
488
|
* })
|
|
433
489
|
*/
|
|
@@ -473,6 +529,7 @@ interface OrchestrateDeps {
|
|
|
473
529
|
nonceStore: NonceStore;
|
|
474
530
|
entitlementStore: EntitlementStore;
|
|
475
531
|
payeeAddress: string;
|
|
532
|
+
mppRecipient?: string;
|
|
476
533
|
network: string;
|
|
477
534
|
x402FacilitatorsByNetwork?: Record<string, ResolvedX402Facilitator>;
|
|
478
535
|
x402Accepts: X402AcceptConfig[];
|
|
@@ -509,16 +566,12 @@ type InputTypeFor<TBody, TQuery> = [TBody] extends [undefined] ? [TQuery] extend
|
|
|
509
566
|
* because TypeScript doesn't reliably gate overload selection on `this` for
|
|
510
567
|
* generic classes (structurally identical instance types collapse).
|
|
511
568
|
*/
|
|
512
|
-
type HandlerArg<TBody, TQuery, HasAuth extends boolean, NeedsBody extends boolean, HasBody extends boolean
|
|
569
|
+
type HandlerArg<TBody, TQuery, HasAuth extends boolean, NeedsBody extends boolean, HasBody extends boolean> = HasAuth extends true ? [NeedsBody, HasBody] extends [true, false] ? {
|
|
513
570
|
__missing: 'Call .body(schema) — dynamic/tiered pricing requires a body schema to resolve the price against';
|
|
514
|
-
} : NeedsInputExample extends true ? {
|
|
515
|
-
__missing: 'Call .inputExample(sample) — .body()/.query() routes must advertise a conforming request example for bazaar discovery';
|
|
516
|
-
} : NeedsOutputExample extends true ? {
|
|
517
|
-
__missing: 'Call .outputExample(sample) — .output() routes must advertise a conforming response example for bazaar discovery';
|
|
518
571
|
} : (ctx: HandlerContext<TBody, TQuery>) => Promise<unknown> : {
|
|
519
572
|
__missing: 'Select an auth mode: .paid(pricing), .siwx(), .apiKey(resolver), or .unprotected()';
|
|
520
573
|
};
|
|
521
|
-
declare class RouteBuilder<TBody = undefined, TQuery = undefined, TOutput = undefined, HasAuth extends boolean = false, NeedsBody extends boolean = false, HasBody extends boolean = false
|
|
574
|
+
declare class RouteBuilder<TBody = undefined, TQuery = undefined, TOutput = undefined, HasAuth extends boolean = false, NeedsBody extends boolean = false, HasBody extends boolean = false> {
|
|
522
575
|
/** @internal */ readonly _key: string;
|
|
523
576
|
/** @internal */ readonly _registry: RouteRegistry;
|
|
524
577
|
/** @internal */ readonly _deps: OrchestrateDeps;
|
|
@@ -528,7 +581,7 @@ declare class RouteBuilder<TBody = undefined, TQuery = undefined, TOutput = unde
|
|
|
528
581
|
/** @internal */ _protocols: ProtocolType[];
|
|
529
582
|
/** @internal */ _maxPrice: string | undefined;
|
|
530
583
|
/** @internal */ _minPrice: string | undefined;
|
|
531
|
-
/** @internal */ _payTo:
|
|
584
|
+
/** @internal */ _payTo: PayToConfig | undefined;
|
|
532
585
|
/** @internal */ _bodySchema: ZodType | undefined;
|
|
533
586
|
/** @internal */ _querySchema: ZodType | undefined;
|
|
534
587
|
/** @internal */ _outputSchema: ZodType | undefined;
|
|
@@ -543,13 +596,14 @@ declare class RouteBuilder<TBody = undefined, TQuery = undefined, TOutput = unde
|
|
|
543
596
|
/** @internal */ _providerName: string | undefined;
|
|
544
597
|
/** @internal */ _providerConfig: ProviderConfig | undefined;
|
|
545
598
|
/** @internal */ _validateFn: ((body: TBody) => void | Promise<void>) | undefined;
|
|
599
|
+
/** @internal */ _settlement: SettlementLifecycle<TBody> | undefined;
|
|
546
600
|
/** @internal */ _mppInfo: MppProtocolInfo | undefined;
|
|
547
601
|
constructor(key: string, registry: RouteRegistry, deps: OrchestrateDeps);
|
|
548
602
|
private fork;
|
|
549
|
-
paid(pricing: string, options?: PaidOptions): RouteBuilder<TBody, TQuery, TOutput, True, False, HasBody
|
|
603
|
+
paid(pricing: string, options?: PaidOptions): RouteBuilder<TBody, TQuery, TOutput, True, False, HasBody>;
|
|
550
604
|
paid<TBodyIn>(pricing: (body: TBodyIn) => string | Promise<string>, options?: PaidOptions & {
|
|
551
605
|
maxPrice?: string;
|
|
552
|
-
}): RouteBuilder<TBody, TQuery, TOutput, True, True, HasBody
|
|
606
|
+
}): RouteBuilder<TBody, TQuery, TOutput, True, True, HasBody>;
|
|
553
607
|
paid(pricing: {
|
|
554
608
|
field: string;
|
|
555
609
|
tiers: Record<string, {
|
|
@@ -557,21 +611,26 @@ declare class RouteBuilder<TBody = undefined, TQuery = undefined, TOutput = unde
|
|
|
557
611
|
label?: string;
|
|
558
612
|
}>;
|
|
559
613
|
default?: string;
|
|
560
|
-
}, options?: PaidOptions): RouteBuilder<TBody, TQuery, TOutput, True, True, HasBody
|
|
561
|
-
siwx(): RouteBuilder<TBody, TQuery, TOutput, True, False, HasBody
|
|
562
|
-
apiKey(resolver: (key: string) => unknown | Promise<unknown>): RouteBuilder<TBody, TQuery, TOutput, True, NeedsBody, HasBody
|
|
563
|
-
unprotected(): RouteBuilder<TBody, TQuery, TOutput, True, False, HasBody
|
|
614
|
+
}, options?: PaidOptions): RouteBuilder<TBody, TQuery, TOutput, True, True, HasBody>;
|
|
615
|
+
siwx(): RouteBuilder<TBody, TQuery, TOutput, True, False, HasBody>;
|
|
616
|
+
apiKey(resolver: (key: string) => unknown | Promise<unknown>): RouteBuilder<TBody, TQuery, TOutput, True, NeedsBody, HasBody>;
|
|
617
|
+
unprotected(): RouteBuilder<TBody, TQuery, TOutput, True, False, HasBody>;
|
|
564
618
|
provider(name: string, config?: ProviderConfig): this;
|
|
565
|
-
body<T>(schema: ZodType<T>): RouteBuilder<T, TQuery, TOutput, HasAuth, NeedsBody, True
|
|
566
|
-
|
|
567
|
-
|
|
619
|
+
body<T>(schema: ZodType<T>): RouteBuilder<T, TQuery, TOutput, HasAuth, NeedsBody, True>;
|
|
620
|
+
body<T>(schema: ZodType<T>, example: T & JsonObject): RouteBuilder<T, TQuery, TOutput, HasAuth, NeedsBody, True>;
|
|
621
|
+
query<T>(schema: ZodType<T>): RouteBuilder<TBody, T, TOutput, HasAuth, NeedsBody, HasBody>;
|
|
622
|
+
query<T>(schema: ZodType<T>, example: T & JsonObject): RouteBuilder<TBody, T, TOutput, HasAuth, NeedsBody, HasBody>;
|
|
623
|
+
output<T>(schema: ZodType<T>): RouteBuilder<TBody, TQuery, T, HasAuth, NeedsBody, HasBody>;
|
|
624
|
+
output<T>(schema: ZodType<T>, example: T & JsonValue): RouteBuilder<TBody, TQuery, T, HasAuth, NeedsBody, HasBody>;
|
|
568
625
|
/**
|
|
569
626
|
* Provide a conforming example of the request input (body or query params).
|
|
570
627
|
*
|
|
571
|
-
*
|
|
572
|
-
*
|
|
573
|
-
*
|
|
574
|
-
*
|
|
628
|
+
* Optional. When provided, the example is validated against the request schema
|
|
629
|
+
* at route registration and embedded in the bazaar discovery extension so
|
|
630
|
+
* indexers can advertise a working sample call.
|
|
631
|
+
*
|
|
632
|
+
* For the common case, pass the example directly to `.body(schema, example)` or
|
|
633
|
+
* `.query(schema, example)` instead.
|
|
575
634
|
*
|
|
576
635
|
* @example
|
|
577
636
|
* ```ts
|
|
@@ -582,14 +641,15 @@ declare class RouteBuilder<TBody = undefined, TQuery = undefined, TOutput = unde
|
|
|
582
641
|
* .handler(async ({ body }) => { ... });
|
|
583
642
|
* ```
|
|
584
643
|
*/
|
|
585
|
-
inputExample(example: InputTypeFor<TBody, TQuery> & JsonObject): RouteBuilder<TBody, TQuery, TOutput, HasAuth, NeedsBody, HasBody
|
|
644
|
+
inputExample(example: InputTypeFor<TBody, TQuery> & JsonObject): RouteBuilder<TBody, TQuery, TOutput, HasAuth, NeedsBody, HasBody>;
|
|
586
645
|
/**
|
|
587
646
|
* Provide a conforming example of the response output.
|
|
588
647
|
*
|
|
589
|
-
*
|
|
590
|
-
*
|
|
591
|
-
*
|
|
592
|
-
*
|
|
648
|
+
* Optional. When provided, the example is validated against the output schema
|
|
649
|
+
* at route registration and embedded in the bazaar discovery extension so
|
|
650
|
+
* indexers can advertise the response shape.
|
|
651
|
+
*
|
|
652
|
+
* For the common case, pass the example directly to `.output(schema, example)` instead.
|
|
593
653
|
*
|
|
594
654
|
* Accepts any JSON value (objects, arrays, or primitives) — top-level array
|
|
595
655
|
* or primitive responses (e.g. `z.array(...)`) are supported alongside the
|
|
@@ -611,7 +671,7 @@ declare class RouteBuilder<TBody = undefined, TQuery = undefined, TOutput = unde
|
|
|
611
671
|
* .handler(async () => { ... });
|
|
612
672
|
* ```
|
|
613
673
|
*/
|
|
614
|
-
outputExample(example: TOutput & JsonValue): RouteBuilder<TBody, TQuery, TOutput, HasAuth, NeedsBody, HasBody
|
|
674
|
+
outputExample(example: TOutput & JsonValue): RouteBuilder<TBody, TQuery, TOutput, HasAuth, NeedsBody, HasBody>;
|
|
615
675
|
description(text: string): this;
|
|
616
676
|
path(p: string): this;
|
|
617
677
|
method(m: 'GET' | 'POST' | 'DELETE' | 'PUT' | 'PATCH'): this;
|
|
@@ -636,10 +696,57 @@ declare class RouteBuilder<TBody = undefined, TQuery = undefined, TOutput = unde
|
|
|
636
696
|
* .handler(async ({ body }) => { ... });
|
|
637
697
|
* ```
|
|
638
698
|
*/
|
|
639
|
-
validate(fn: (body: TBody) => void | Promise<void>): RouteBuilder<TBody, TQuery, TOutput, HasAuth, NeedsBody, HasBody
|
|
640
|
-
|
|
699
|
+
validate(fn: (body: TBody) => void | Promise<void>): RouteBuilder<TBody, TQuery, TOutput, HasAuth, NeedsBody, HasBody>;
|
|
700
|
+
/**
|
|
701
|
+
* Add route-specific settlement hooks.
|
|
702
|
+
*
|
|
703
|
+
* `beforeSettle` runs after a successful handler response but before
|
|
704
|
+
* router-controlled settlement/broadcast, so it can still prevent the charge
|
|
705
|
+
* for x402 and MPP transaction-payload flows. `afterSettle` runs after
|
|
706
|
+
* settlement and is intended for durable ledgers or app-owned refund queues.
|
|
707
|
+
*/
|
|
708
|
+
settlement(lifecycle: SettlementLifecycle<TBody>): RouteBuilder<TBody, TQuery, TOutput, HasAuth, NeedsBody, HasBody>;
|
|
709
|
+
handler(fn: HandlerArg<TBody, TQuery, HasAuth, NeedsBody, HasBody>): (request: NextRequest) => Promise<Response>;
|
|
641
710
|
}
|
|
642
711
|
|
|
712
|
+
declare const BASE_NETWORK = "eip155:8453";
|
|
713
|
+
declare const SOLANA_MAINNET_NETWORK = "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp";
|
|
714
|
+
declare const TEMPO_USDC_CURRENCY = "0x20c000000000000000000000b9537d11c60e8b50";
|
|
715
|
+
declare const ZERO_EVM_ADDRESS = "0x0000000000000000000000000000000000000000";
|
|
716
|
+
|
|
717
|
+
type RouterEnv = Record<string, string | undefined>;
|
|
718
|
+
type RouterConfigIssueCode = 'missing_base_url' | 'empty_protocols' | 'missing_x402_accepts' | 'missing_x402_network' | 'unsupported_x402_network' | 'missing_x402_asset' | 'invalid_x402_decimals' | 'missing_x402_payee' | 'missing_cdp_keys' | 'placeholder_payee' | 'missing_mpp_config' | 'missing_mpp_secret_key' | 'missing_mpp_currency' | 'invalid_mpp_currency' | 'missing_mpp_recipient' | 'invalid_mpp_recipient' | 'missing_mpp_rpc_url' | 'invalid_mpp_fee_payer_key' | 'missing_mpp_default_store_env';
|
|
719
|
+
interface RouterConfigIssue {
|
|
720
|
+
code: RouterConfigIssueCode;
|
|
721
|
+
message: string;
|
|
722
|
+
protocol?: ProtocolType;
|
|
723
|
+
}
|
|
724
|
+
interface RouterConfigValidationOptions {
|
|
725
|
+
env?: RouterEnv;
|
|
726
|
+
requireCdpKeys?: boolean;
|
|
727
|
+
}
|
|
728
|
+
declare class RouterConfigError extends Error {
|
|
729
|
+
readonly issues: RouterConfigIssue[];
|
|
730
|
+
constructor(issues: RouterConfigIssue[]);
|
|
731
|
+
}
|
|
732
|
+
declare function validateRouterConfig(config: RouterConfig, options?: RouterConfigValidationOptions): void;
|
|
733
|
+
declare function getRouterConfigIssues(config: RouterConfig, options?: RouterConfigValidationOptions): RouterConfigIssue[];
|
|
734
|
+
declare function formatRouterConfigIssues(issues: readonly RouterConfigIssue[]): string;
|
|
735
|
+
declare function mppFromEnv(env: RouterEnv, options?: {
|
|
736
|
+
recipient?: string;
|
|
737
|
+
require?: boolean;
|
|
738
|
+
useDefaultStore?: boolean;
|
|
739
|
+
feePayerKey?: string;
|
|
740
|
+
}): RouterConfig['mpp'] | undefined;
|
|
741
|
+
declare function x402AcceptsFromEnv(env: RouterEnv, options?: {
|
|
742
|
+
payeeAddress?: string;
|
|
743
|
+
payeeEnv?: string;
|
|
744
|
+
network?: string;
|
|
745
|
+
solanaPayeeAddress?: string;
|
|
746
|
+
solanaPayeeEnv?: string;
|
|
747
|
+
}): X402AcceptConfig[];
|
|
748
|
+
declare function paidOptionsForProtocols(protocols: readonly ProtocolType[]): PaidOptions;
|
|
749
|
+
|
|
643
750
|
interface MonitorEntry {
|
|
644
751
|
provider: string;
|
|
645
752
|
route: string;
|
|
@@ -649,7 +756,7 @@ interface MonitorEntry {
|
|
|
649
756
|
critical?: number;
|
|
650
757
|
}
|
|
651
758
|
interface ServiceRouter<TPriceKeys extends string = never> {
|
|
652
|
-
route<K extends string>(keyOrDefinition: K | RouteDefinition<K>): [K] extends [TPriceKeys] ? RouteBuilder<undefined, undefined, undefined, true, false, false
|
|
759
|
+
route<K extends string>(keyOrDefinition: K | RouteDefinition<K>): [K] extends [TPriceKeys] ? RouteBuilder<undefined, undefined, undefined, true, false, false> : RouteBuilder<undefined, undefined, undefined, false, false, false>;
|
|
653
760
|
wellKnown(): (request: NextRequest) => Promise<NextResponse>;
|
|
654
761
|
openapi(): (request: NextRequest) => Promise<NextResponse>;
|
|
655
762
|
llmsTxt(): (request: NextRequest) => Promise<NextResponse>;
|
|
@@ -660,4 +767,4 @@ declare function createRouter<const P extends Record<string, string> = Record<ne
|
|
|
660
767
|
prices?: P;
|
|
661
768
|
}): ServiceRouter<Extract<keyof P, string>>;
|
|
662
769
|
|
|
663
|
-
export { type AlertEvent, type AlertFn, type AlertLevel, type AuthEvent, type AuthMode, type DiscoveryConfig, type EntitlementStore, type ErrorEvent, type HandlerContext, HttpError, MemoryEntitlementStore, MemoryNonceStore, type MonitorEntry, type MppProtocolInfo, type NonceStore, type OveragePolicy, type PaidOptions, type PayToConfig, type PaymentEvent, type PluginContext, type PricingConfig, type ProtocolType, type ProviderConfig, type ProviderQuotaEvent, type QuotaInfo, type QuotaLevel, type RedisEntitlementStoreOptions, type RedisNonceStoreOptions, type RequestMeta, type ResponseMeta, RouteBuilder, type RouteEntry, RouteRegistry, type RouterConfig, type RouterPlugin, SIWX_CHALLENGE_EXPIRY_MS, type ServiceRouter, type SettlementEvent, type TierConfig, type X402AcceptConfig, type X402FacilitatorTarget, type X402FacilitatorsConfig, type X402ResolvedAccept, type X402RouterFacilitatorConfig, type X402Server, consolePlugin, createRedisEntitlementStore, createRedisNonceStore, createRouter };
|
|
770
|
+
export { type AlertEvent, type AlertFn, type AlertLevel, type AuthEvent, type AuthMode, BASE_NETWORK, type DiscoveryConfig, type EntitlementStore, type ErrorEvent, type HandlerContext, type HandlerPaymentContext, HttpError, MemoryEntitlementStore, MemoryNonceStore, type MonitorEntry, type MppProtocolInfo, type NonceStore, type OveragePolicy, type PaidOptions, type PayToConfig, type PaymentEvent, type PaymentStatus, type PluginContext, type PricingConfig, type ProtocolType, type ProviderConfig, type ProviderQuotaEvent, type QuotaInfo, type QuotaLevel, type RedisEntitlementStoreOptions, type RedisNonceStoreOptions, type RequestMeta, type ResponseMeta, RouteBuilder, type RouteEntry, RouteRegistry, type RouterConfig, RouterConfigError, type RouterConfigIssue, type RouterConfigIssueCode, type RouterConfigValidationOptions, type RouterEnv, type RouterPlugin, SIWX_CHALLENGE_EXPIRY_MS, SOLANA_MAINNET_NETWORK, type ServiceRouter, type SettledHandlerErrorContext, type SettlementErrorContext, type SettlementEvent, type SettlementLifecycle, type SettlementLifecycleContext, type SettlementSettledContext, TEMPO_USDC_CURRENCY, type TierConfig, type X402AcceptConfig, type X402FacilitatorTarget, type X402FacilitatorsConfig, type X402ResolvedAccept, type X402RouterFacilitatorConfig, type X402Server, ZERO_EVM_ADDRESS, consolePlugin, createRedisEntitlementStore, createRedisNonceStore, createRouter, formatRouterConfigIssues, getRouterConfigIssues, mppFromEnv, paidOptionsForProtocols, validateRouterConfig, x402AcceptsFromEnv };
|