@agent-score/commerce 1.2.0 → 1.3.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 +26 -11
- package/dist/{_response-RpEB7-vl.d.ts → _response-C2yFQoIA.d.ts} +1 -1
- package/dist/{_response-DS-LR590.d.mts → _response-DpB-cm2c.d.mts} +1 -1
- package/dist/{agent_instructions-d3UWTdam.d.mts → agent_instructions-DiMSGkdm.d.mts} +10 -6
- package/dist/{agent_instructions-d3UWTdam.d.ts → agent_instructions-DiMSGkdm.d.ts} +10 -6
- package/dist/challenge/index.d.mts +18 -9
- package/dist/challenge/index.d.ts +18 -9
- package/dist/challenge/index.js +25 -24
- package/dist/challenge/index.js.map +1 -1
- package/dist/challenge/index.mjs +25 -24
- package/dist/challenge/index.mjs.map +1 -1
- package/dist/core.js +1 -1
- package/dist/core.js.map +1 -1
- package/dist/core.mjs +1 -1
- package/dist/core.mjs.map +1 -1
- package/dist/discovery/index.d.mts +130 -6
- package/dist/discovery/index.d.ts +130 -6
- package/dist/discovery/index.js +75 -59
- package/dist/discovery/index.js.map +1 -1
- package/dist/discovery/index.mjs +70 -58
- package/dist/discovery/index.mjs.map +1 -1
- package/dist/identity/express.d.mts +2 -2
- package/dist/identity/express.d.ts +2 -2
- package/dist/identity/express.js +48 -25
- package/dist/identity/express.js.map +1 -1
- package/dist/identity/express.mjs +48 -25
- package/dist/identity/express.mjs.map +1 -1
- package/dist/identity/fastify.d.mts +2 -2
- package/dist/identity/fastify.d.ts +2 -2
- package/dist/identity/fastify.js +48 -25
- package/dist/identity/fastify.js.map +1 -1
- package/dist/identity/fastify.mjs +48 -25
- package/dist/identity/fastify.mjs.map +1 -1
- package/dist/identity/hono.d.mts +2 -2
- package/dist/identity/hono.d.ts +2 -2
- package/dist/identity/hono.js +48 -25
- package/dist/identity/hono.js.map +1 -1
- package/dist/identity/hono.mjs +48 -25
- package/dist/identity/hono.mjs.map +1 -1
- package/dist/identity/nextjs.d.mts +2 -2
- package/dist/identity/nextjs.d.ts +2 -2
- package/dist/identity/nextjs.js +48 -25
- package/dist/identity/nextjs.js.map +1 -1
- package/dist/identity/nextjs.mjs +48 -25
- package/dist/identity/nextjs.mjs.map +1 -1
- package/dist/identity/web.d.mts +2 -2
- package/dist/identity/web.d.ts +2 -2
- package/dist/identity/web.js +48 -25
- package/dist/identity/web.js.map +1 -1
- package/dist/identity/web.mjs +48 -25
- package/dist/identity/web.mjs.map +1 -1
- package/dist/index.d.mts +12 -12
- package/dist/index.d.ts +12 -12
- package/dist/index.js +47 -24
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +47 -24
- package/dist/index.mjs.map +1 -1
- package/dist/payment/index.d.mts +158 -49
- package/dist/payment/index.d.ts +158 -49
- package/dist/payment/index.js +194 -73
- package/dist/payment/index.js.map +1 -1
- package/dist/payment/index.mjs +192 -72
- package/dist/payment/index.mjs.map +1 -1
- package/dist/{signer-Cvdwn6Cs.d.mts → signer-kCAJUZwp.d.mts} +10 -12
- package/dist/{signer-Cvdwn6Cs.d.ts → signer-kCAJUZwp.d.ts} +10 -12
- package/dist/stripe-multichain/index.d.mts +2 -2
- package/dist/stripe-multichain/index.d.ts +2 -2
- package/dist/stripe-multichain/index.js.map +1 -1
- package/dist/stripe-multichain/index.mjs.map +1 -1
- package/package.json +13 -4
package/dist/payment/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { P as PaymentRequiredHeaderInput, a as aliasAmountFields, p as paymentRequiredHeader, w as wwwAuthenticateHeader } from '../wwwauthenticate-CU1eNvMQ.mjs';
|
|
2
|
-
export { P as PaymentSigner, S as SignerNetwork, a as extractPaymentSigner, r as readX402PaymentHeader } from '../signer-
|
|
2
|
+
export { P as PaymentSigner, S as SignerNetwork, a as extractPaymentSigner, r as readX402PaymentHeader } from '../signer-kCAJUZwp.mjs';
|
|
3
3
|
|
|
4
4
|
interface PaymentRequestInput {
|
|
5
5
|
/** Symbolic rail name (e.g., 'tempo-mainnet', 'x402-base-mainnet') — fills in defaults */
|
|
@@ -190,15 +190,15 @@ declare const rails: {
|
|
|
190
190
|
readonly decimals: 6;
|
|
191
191
|
readonly asset: "0x036CbD53842c5426634e7929541eC2318f3dCF7e";
|
|
192
192
|
};
|
|
193
|
-
readonly '
|
|
194
|
-
readonly method: "
|
|
193
|
+
readonly 'mpp-solana-mainnet': {
|
|
194
|
+
readonly method: "solana";
|
|
195
195
|
readonly network: "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp";
|
|
196
196
|
readonly currency: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v";
|
|
197
197
|
readonly decimals: 6;
|
|
198
198
|
readonly asset: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v";
|
|
199
199
|
};
|
|
200
|
-
readonly '
|
|
201
|
-
readonly method: "
|
|
200
|
+
readonly 'mpp-solana-devnet': {
|
|
201
|
+
readonly method: "solana";
|
|
202
202
|
readonly network: "solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1";
|
|
203
203
|
readonly currency: "4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU";
|
|
204
204
|
readonly decimals: 6;
|
|
@@ -244,7 +244,7 @@ interface X402ServerLike {
|
|
|
244
244
|
*/
|
|
245
245
|
declare function registerX402SchemesV1V2(server: X402ServerLike, network: string, scheme: unknown): void;
|
|
246
246
|
|
|
247
|
-
type X402SymbolicRail = 'x402-base-mainnet' | 'x402-base-sepolia' | 'x402-
|
|
247
|
+
type X402SymbolicRail = 'x402-base-mainnet' | 'x402-base-sepolia' | 'x402-base-mainnet-upto' | 'x402-base-sepolia-upto';
|
|
248
248
|
type X402FacilitatorChoice = 'coinbase' | 'http' | unknown;
|
|
249
249
|
interface CreateX402ServerOptions {
|
|
250
250
|
/**
|
|
@@ -257,7 +257,7 @@ interface CreateX402ServerOptions {
|
|
|
257
257
|
facilitator?: X402FacilitatorChoice;
|
|
258
258
|
/**
|
|
259
259
|
* Symbolic rail names to register schemes for. Each gets v1+v2 dual-register applied.
|
|
260
|
-
* Requires
|
|
260
|
+
* Requires `@x402/evm` peer dep installed.
|
|
261
261
|
*/
|
|
262
262
|
rails?: X402SymbolicRail[];
|
|
263
263
|
/** Advanced: register custom {network, scheme} pairs (in addition to or instead of `rails`). */
|
|
@@ -293,26 +293,27 @@ interface X402Server {
|
|
|
293
293
|
*
|
|
294
294
|
* const server = await createX402Server({
|
|
295
295
|
* facilitator: 'coinbase',
|
|
296
|
-
* rails: ['x402-base-mainnet'
|
|
296
|
+
* rails: ['x402-base-mainnet'],
|
|
297
297
|
* bazaar: true,
|
|
298
298
|
* });
|
|
299
299
|
*/
|
|
300
300
|
declare function createX402Server(opts?: CreateX402ServerOptions): Promise<X402Server>;
|
|
301
301
|
|
|
302
302
|
/**
|
|
303
|
-
* `processX402Settle
|
|
303
|
+
* `processX402Settle`: single-call x402 verify+settle for merchants.
|
|
304
304
|
*
|
|
305
305
|
* Wraps the four x402-server steps every x402-accepting merchant repeats:
|
|
306
|
-
* 1. `buildPaymentRequirements(resourceConfig)
|
|
306
|
+
* 1. `buildPaymentRequirements(resourceConfig)`: builds the requirement entries the
|
|
307
307
|
* facilitator validates against
|
|
308
|
-
* 2. `enrichExtensions(extension, transportContext)
|
|
308
|
+
* 2. `enrichExtensions(extension, transportContext)`: folds in Bazaar (or other)
|
|
309
309
|
* extensions for the verify step
|
|
310
|
-
* 3. `processPaymentRequest(payload, resourceConfig, resourceMeta, extensions)
|
|
310
|
+
* 3. `processPaymentRequest(payload, resourceConfig, resourceMeta, extensions)`:
|
|
311
311
|
* runs verify against the facilitator
|
|
312
|
-
* 4. `settlePayment(payload, matchedRequirement)
|
|
312
|
+
* 4. `settlePayment(payload, matchedRequirement)`: settles on-chain
|
|
313
313
|
*
|
|
314
314
|
* Returns a tagged result so the caller can map errors to merchant-shaped responses
|
|
315
|
-
* without owning the orchestration boilerplate.
|
|
315
|
+
* without owning the orchestration boilerplate. Use `classifyX402SettleResult` to
|
|
316
|
+
* map the tagged result to a recommended HTTP response.
|
|
316
317
|
*/
|
|
317
318
|
|
|
318
319
|
interface ProcessX402SettleInput {
|
|
@@ -351,20 +352,88 @@ type ProcessX402SettleResult = {
|
|
|
351
352
|
success: true;
|
|
352
353
|
[key: string]: unknown;
|
|
353
354
|
};
|
|
354
|
-
}
|
|
355
|
+
}
|
|
356
|
+
/** No-requirements branch: `buildPaymentRequirements` returned an empty array, so
|
|
357
|
+
* there is nothing to verify against. Indicates a merchant-side misconfiguration
|
|
358
|
+
* (resource config doesn't match any registered scheme/network).
|
|
359
|
+
* Recommended response: log `reason` server-side; map to a controlled 500 to the
|
|
360
|
+
* consumer via `classifyX402SettleResult`. */
|
|
361
|
+
| {
|
|
355
362
|
success: false;
|
|
356
363
|
phase: 'no_requirements';
|
|
357
364
|
reason: string;
|
|
358
|
-
}
|
|
365
|
+
}
|
|
366
|
+
/** Verify-failed branch: the facilitator's verify step ran and returned
|
|
367
|
+
* `{ success: false, ... }`. Payload is structurally invalid, expired, signed by
|
|
368
|
+
* the wrong wallet, or otherwise rejected by facilitator policy.
|
|
369
|
+
* Recommended response: log `verifyResult` server-side; map to a controlled 400
|
|
370
|
+
* with `payment_proof_invalid` to the consumer via `classifyX402SettleResult`. */
|
|
371
|
+
| {
|
|
359
372
|
success: false;
|
|
360
373
|
phase: 'verify_failed';
|
|
361
374
|
verifyResult: unknown;
|
|
362
|
-
}
|
|
375
|
+
}
|
|
376
|
+
/** Settle-failed branch: verify succeeded but `settlePayment` threw (on-chain
|
|
377
|
+
* rejection, RPC outage, facilitator broadcast failure, etc.). The agent's
|
|
378
|
+
* credential was valid; funds did not move.
|
|
379
|
+
* Recommended response: log raw `error` server-side; map to a controlled 503 with
|
|
380
|
+
* `payment_provider_unavailable` to the consumer via `classifyX402SettleResult`. */
|
|
381
|
+
| {
|
|
363
382
|
success: false;
|
|
364
383
|
phase: 'settle_failed';
|
|
365
384
|
error: unknown;
|
|
366
385
|
matchedRequirement: unknown;
|
|
386
|
+
} | {
|
|
387
|
+
success: false;
|
|
388
|
+
/** Facilitator threw an unexpected error during one of the verify-stage calls
|
|
389
|
+
* (build requirements, extension enrich, or processPaymentRequest). Most common
|
|
390
|
+
* cause: the facilitator client rejects the configured network. Coinbase's CDP
|
|
391
|
+
* facilitator throws on Solana devnet because it only supports mainnet networks;
|
|
392
|
+
* Stripe's SPT facilitator throws on EVM networks; etc.
|
|
393
|
+
* Recommended response: log raw `error` server-side; map to a controlled 503
|
|
394
|
+
* with `payment_provider_unavailable` to the consumer via `classifyX402SettleResult`
|
|
395
|
+
* so the agent can pick a different rail. */
|
|
396
|
+
phase: 'facilitator_error';
|
|
397
|
+
/** Which verify-stage step threw. */
|
|
398
|
+
step: 'build_requirements' | 'enrich_extensions' | 'process_payment_request';
|
|
399
|
+
error: unknown;
|
|
367
400
|
};
|
|
401
|
+
/**
|
|
402
|
+
* The merchant-shaped response for a non-success `ProcessX402SettleResult`.
|
|
403
|
+
*
|
|
404
|
+
* `status` / `code` / `message` are safe to send back to the consumer. `nextSteps`
|
|
405
|
+
* is the agent-instructions block describing what the agent should do next. Raw
|
|
406
|
+
* facilitator errors stay server-side: do NOT serialize the original `error` /
|
|
407
|
+
* `verifyResult` / `reason` to the consumer; log them yourself.
|
|
408
|
+
*/
|
|
409
|
+
interface ClassifiedX402Error {
|
|
410
|
+
status: 400 | 500 | 503;
|
|
411
|
+
code: 'payment_proof_invalid' | 'payment_provider_unavailable' | 'payment_internal_error';
|
|
412
|
+
message: string;
|
|
413
|
+
nextSteps: {
|
|
414
|
+
action: string;
|
|
415
|
+
user_message: string;
|
|
416
|
+
retry_after_seconds?: number;
|
|
417
|
+
};
|
|
418
|
+
}
|
|
419
|
+
/**
|
|
420
|
+
* Map a `ProcessX402SettleResult` to the recommended merchant response.
|
|
421
|
+
*
|
|
422
|
+
* Returns `null` for `success: true`. For each error phase, returns a controlled
|
|
423
|
+
* status / code / message / nextSteps tuple. Replaces error-message string-sniffing
|
|
424
|
+
* with a phase-based dispatch so merchants stop coupling to facilitator-specific
|
|
425
|
+
* error text.
|
|
426
|
+
*
|
|
427
|
+
* Phase mapping:
|
|
428
|
+
* - `verify_failed` → 400 `payment_proof_invalid` / `regenerate_payment_credential`
|
|
429
|
+
* - `facilitator_error` → 503 `payment_provider_unavailable` / `try_different_rail`
|
|
430
|
+
* - `settle_failed` → 503 `payment_provider_unavailable` / `retry_or_swap_method`
|
|
431
|
+
* - `no_requirements` → 500 `payment_internal_error` / `contact_support`
|
|
432
|
+
*
|
|
433
|
+
* Always log the raw `result` server-side before responding; the returned object
|
|
434
|
+
* is intentionally facilitator-agnostic and never carries raw error detail.
|
|
435
|
+
*/
|
|
436
|
+
declare function classifyX402SettleResult(result: ProcessX402SettleResult): ClassifiedX402Error | null;
|
|
368
437
|
declare function processX402Settle(input: ProcessX402SettleInput): Promise<ProcessX402SettleResult>;
|
|
369
438
|
|
|
370
439
|
/**
|
|
@@ -372,32 +441,25 @@ declare function processX402Settle(input: ProcessX402SettleInput): Promise<Proce
|
|
|
372
441
|
*
|
|
373
442
|
* Two layers of validation every x402-accepting merchant repeats:
|
|
374
443
|
*
|
|
375
|
-
* - **Boot-time**: validate the configured `X402_BASE_NETWORK`
|
|
376
|
-
*
|
|
377
|
-
* family. Failing loud at boot is much better than per-request "unsupported
|
|
444
|
+
* - **Boot-time**: validate the configured `X402_BASE_NETWORK` env var is in the
|
|
445
|
+
* supported set. Failing loud at boot is much better than per-request "unsupported
|
|
378
446
|
* network" errors after a misconfigured deploy.
|
|
379
447
|
*
|
|
380
|
-
* - **Per-request**: when an x402 X-Payment header arrives, parse the base64
|
|
381
|
-
*
|
|
382
|
-
*
|
|
383
|
-
*
|
|
384
|
-
*
|
|
385
|
-
* hand across 4 conditions is fiddly.
|
|
448
|
+
* - **Per-request**: when an x402 X-Payment header arrives, parse the base64 payload,
|
|
449
|
+
* extract the signed network + payTo, validate against the merchant's accepted
|
|
450
|
+
* network, validate the payTo address shape, and check that the payTo was minted by
|
|
451
|
+
* THIS merchant (cache hit). Each step has its own denial code and `next_steps`
|
|
452
|
+
* shape — getting the message right by hand across 4 conditions is fiddly.
|
|
386
453
|
*/
|
|
387
454
|
/** CAIP-2 networks the commerce SDK supports for x402 Base (EVM USDC). */
|
|
388
455
|
declare const X402_SUPPORTED_BASE_NETWORKS: Set<string>;
|
|
389
|
-
/** CAIP-2 networks the commerce SDK supports for x402 Solana (SPL Token USDC). */
|
|
390
|
-
declare const X402_SUPPORTED_SVM_NETWORKS: Set<string>;
|
|
391
456
|
interface ValidateX402NetworkConfigInput {
|
|
392
457
|
/** CAIP-2 base network string (e.g. `'eip155:8453'`). */
|
|
393
458
|
baseNetwork: string;
|
|
394
|
-
/** CAIP-2 SVM network string (e.g. `'solana:5eykt…'`). */
|
|
395
|
-
svmNetwork: string;
|
|
396
459
|
}
|
|
397
460
|
/**
|
|
398
|
-
* Boot-time guard: throws if
|
|
399
|
-
*
|
|
400
|
-
* versa). Call once at module init / server boot.
|
|
461
|
+
* Boot-time guard: throws if the base network isn't supported. Call once at module
|
|
462
|
+
* init / server boot.
|
|
401
463
|
*
|
|
402
464
|
* Throws `Error` with a message that names the unsupported value AND lists the valid
|
|
403
465
|
* options — agents tracking down a misconfigured deploy don't need to grep for the
|
|
@@ -408,17 +470,11 @@ interface VerifyX402RequestInput {
|
|
|
408
470
|
/** The incoming Request — `verifyX402Request` reads the X-Payment / payment-signature header. */
|
|
409
471
|
request: Request;
|
|
410
472
|
/** Async lookup that returns true when the address was minted by this merchant
|
|
411
|
-
* (typically `piCache.hasAddress`). The
|
|
412
|
-
*
|
|
473
|
+
* (typically `piCache.hasAddress`). The check validates that the credential's
|
|
474
|
+
* deposit address matches one the merchant actually minted. */
|
|
413
475
|
isCachedAddress: (address: string) => Promise<boolean>;
|
|
414
|
-
/** The merchant's accepted
|
|
415
|
-
|
|
416
|
-
acceptedNetworks: {
|
|
417
|
-
/** CAIP-2 base network — e.g. `'eip155:8453'`. */
|
|
418
|
-
base: string;
|
|
419
|
-
/** CAIP-2 SVM network — e.g. `'solana:5eykt…'`. */
|
|
420
|
-
svm: string;
|
|
421
|
-
};
|
|
476
|
+
/** The merchant's accepted Base network. CAIP-2, e.g. `'eip155:8453'`. */
|
|
477
|
+
acceptedNetwork: string;
|
|
422
478
|
}
|
|
423
479
|
type VerifyX402RequestResult = {
|
|
424
480
|
ok: true;
|
|
@@ -434,8 +490,6 @@ type VerifyX402RequestResult = {
|
|
|
434
490
|
signedNetwork: string;
|
|
435
491
|
/** The on-chain pay-to address the agent signed for (already validated). */
|
|
436
492
|
signedPayTo: string;
|
|
437
|
-
/** True when the signed network is Solana — useful for routing settlement. */
|
|
438
|
-
isSolana: boolean;
|
|
439
493
|
} | {
|
|
440
494
|
ok: false;
|
|
441
495
|
/** Suitable as a JSON body for the merchant's denial response. Includes
|
|
@@ -461,8 +515,8 @@ type VerifyX402RequestResult = {
|
|
|
461
515
|
* confirm the address was minted by this merchant. One call replaces ~45 lines of
|
|
462
516
|
* inline header decode + regex validation + cache lookup.
|
|
463
517
|
*
|
|
464
|
-
* Returns `{ok: true, payload, signedNetwork, signedPayTo
|
|
465
|
-
*
|
|
518
|
+
* Returns `{ok: true, payload, signedNetwork, signedPayTo}` when valid; the caller
|
|
519
|
+
* passes `payload` straight into `processX402Settle`.
|
|
466
520
|
*
|
|
467
521
|
* Returns `{ok: false, body, status}` when invalid — the merchant just does
|
|
468
522
|
* `return c.json(body, status)` (or framework equivalent).
|
|
@@ -472,8 +526,9 @@ type VerifyX402RequestResult = {
|
|
|
472
526
|
*/
|
|
473
527
|
declare function verifyX402Request(input: VerifyX402RequestInput): Promise<VerifyX402RequestResult>;
|
|
474
528
|
|
|
529
|
+
type SolanaMppNetwork = 'mainnet-beta' | 'devnet' | 'localnet';
|
|
475
530
|
interface CreateMppxServerOptions {
|
|
476
|
-
/** Symbolic rail config — commerce wires the boilerplate (tempo.charge, mppStripe.charge, etc.). */
|
|
531
|
+
/** Symbolic rail config — commerce wires the boilerplate (tempo.charge, mppStripe.charge, solana.charge, etc.). */
|
|
477
532
|
rails?: {
|
|
478
533
|
/** One-shot Tempo USDC charge (intent: 'charge'). */
|
|
479
534
|
tempo?: {
|
|
@@ -483,6 +538,38 @@ interface CreateMppxServerOptions {
|
|
|
483
538
|
/** Use Tempo testnet (Moderato). Default false. */
|
|
484
539
|
testnet?: boolean;
|
|
485
540
|
};
|
|
541
|
+
/**
|
|
542
|
+
* Solana SPL charge (intent: 'charge'). Bakes createAssociatedTokenIdempotent
|
|
543
|
+
* into the buyer's tx so payments work against any payTo, fresh or warmed.
|
|
544
|
+
*
|
|
545
|
+
* Requires `@solana/mpp` + `@solana/kit` peer deps.
|
|
546
|
+
* Underlying spec: paymentauth.org/draft-solana-charge-00.
|
|
547
|
+
*/
|
|
548
|
+
solana?: {
|
|
549
|
+
/** Base58-encoded Solana recipient public key. */
|
|
550
|
+
recipient: string;
|
|
551
|
+
/** SPL token mint (base58). Default: USDC for the selected network. */
|
|
552
|
+
currency?: string;
|
|
553
|
+
/** Token decimals. Default 6 (USDC). */
|
|
554
|
+
decimals?: number;
|
|
555
|
+
/** Solana network. Default 'mainnet-beta'. */
|
|
556
|
+
network?: SolanaMppNetwork;
|
|
557
|
+
/** Custom RPC URL. Default: public RPC for the network. */
|
|
558
|
+
rpcUrl?: string;
|
|
559
|
+
/**
|
|
560
|
+
* Optional fee-payer signer for server-side fee sponsorship. When provided,
|
|
561
|
+
* the server's pubkey is advertised as `feePayerKey` in the 402 challenge and
|
|
562
|
+
* the server co-signs settle txs as fee payer (so buyers don't need SOL, and
|
|
563
|
+
* ATA-creation rent is server-funded). Construct via
|
|
564
|
+
* `@solana/kit`'s `createKeyPairSignerFromBytes` or equivalent.
|
|
565
|
+
*
|
|
566
|
+
* Typed as `unknown` to avoid a hard dep on @solana/kit at this layer; pass any
|
|
567
|
+
* `TransactionPartialSigner` from `@solana/kit`.
|
|
568
|
+
*/
|
|
569
|
+
signer?: unknown;
|
|
570
|
+
/** SPL token program hint (TOKEN_PROGRAM or TOKEN_2022_PROGRAM). Auto-detected when omitted. */
|
|
571
|
+
tokenProgram?: string;
|
|
572
|
+
};
|
|
486
573
|
/**
|
|
487
574
|
* Tempo session (intent: 'session') — pay-as-you-go channel for repeated calls or
|
|
488
575
|
* SSE-streamed responses. Vendor brings their own ChannelStore (DB-backed implementation
|
|
@@ -539,6 +626,28 @@ interface CreateMppxServerOptions {
|
|
|
539
626
|
* `mppx` is an OPTIONAL peer dependency — install it only if you accept MPP rails.
|
|
540
627
|
*/
|
|
541
628
|
declare function createMppxServer(opts: CreateMppxServerOptions): Promise<unknown>;
|
|
629
|
+
type SolanaChargeRequestArgs = {
|
|
630
|
+
credential?: unknown;
|
|
631
|
+
request?: unknown;
|
|
632
|
+
};
|
|
633
|
+
type SolanaChargeMethod = {
|
|
634
|
+
request?: (args: SolanaChargeRequestArgs) => Promise<unknown>;
|
|
635
|
+
} & Record<string, unknown>;
|
|
636
|
+
/**
|
|
637
|
+
* Wraps `@solana/mpp.charge()`'s Method so the issued challenge carries a
|
|
638
|
+
* `finalized` blockhash instead of `confirmed`.
|
|
639
|
+
*
|
|
640
|
+
* `@solana/mpp` <= 0.5.2 fetches `getLatestBlockhash` with `commitment: 'confirmed'`
|
|
641
|
+
* but its broadcast `sendTransaction` sets `skipPreflight: false` without an
|
|
642
|
+
* overridden `preflightCommitment`. The RPC server's default preflight commitment
|
|
643
|
+
* is `finalized`, which rejects any blockhash that hasn't yet finalized with a
|
|
644
|
+
* "Blockhash not found" error. Handing the client a `finalized` blockhash up
|
|
645
|
+
* front sidesteps the mismatch.
|
|
646
|
+
*
|
|
647
|
+
* Trade-off: the signing window shrinks from ~58s (confirmed) to ~46s (finalized).
|
|
648
|
+
* Fine for agent-driven flows; manual signing flows still have plenty of margin.
|
|
649
|
+
*/
|
|
650
|
+
declare function wrapSolanaChargeWithFinalizedBlockhash(baseMethod: SolanaChargeMethod, rpcUrl: string): SolanaChargeMethod;
|
|
542
651
|
|
|
543
652
|
interface SettlementHandlers<TPayload, TResult> {
|
|
544
653
|
evm?: (payload: TPayload) => TResult | Promise<TResult>;
|
|
@@ -713,4 +822,4 @@ declare function settlementOverrideHeader(overrides: SettlementOverrides): {
|
|
|
713
822
|
value: string;
|
|
714
823
|
};
|
|
715
824
|
|
|
716
|
-
export { type BuildIdempotencyKeyInput, type BuildPaymentDirectiveInput, type BuildPaymentHeadersInput, type CreateMppxServerOptions, type CreateX402ServerOptions, type NetworkFamily, type PaymentDirectiveInput, type PaymentHeadersRail, type PaymentHeadersResult, type PaymentRequestInput, type ProcessX402SettleInput, type ProcessX402SettleResult, type RailDefinition, type RailName, SETTLEMENT_OVERRIDES_HEADER, type SettlementHandlers, type SettlementOverrides, type SettlementPayloadLike, USDC, type ValidateX402NetworkConfigInput, type VerifyX402RequestInput, type VerifyX402RequestResult, type X402FacilitatorChoice, type X402Server, type X402ServerLike, type X402SymbolicRail, X402_SUPPORTED_BASE_NETWORKS,
|
|
825
|
+
export { type BuildIdempotencyKeyInput, type BuildPaymentDirectiveInput, type BuildPaymentHeadersInput, type ClassifiedX402Error, type CreateMppxServerOptions, type CreateX402ServerOptions, type NetworkFamily, type PaymentDirectiveInput, type PaymentHeadersRail, type PaymentHeadersResult, type PaymentRequestInput, type ProcessX402SettleInput, type ProcessX402SettleResult, type RailDefinition, type RailName, SETTLEMENT_OVERRIDES_HEADER, type SettlementHandlers, type SettlementOverrides, type SettlementPayloadLike, type SolanaMppNetwork, USDC, type ValidateX402NetworkConfigInput, type VerifyX402RequestInput, type VerifyX402RequestResult, type X402FacilitatorChoice, type X402Server, type X402ServerLike, type X402SymbolicRail, X402_SUPPORTED_BASE_NETWORKS, buildIdempotencyKey, buildPaymentDirective, buildPaymentHeaders, buildPaymentRequestBlob, classifyX402SettleResult, createMppxServer, createX402Server, dispatchSettlementByNetwork, lookupRail, networkFamily, networks, paymentDirective, processX402Settle, rails, registerX402SchemesV1V2, settlementOverrideHeader, validateX402NetworkConfig, verifyX402Request, wrapSolanaChargeWithFinalizedBlockhash };
|