uvd-x402-sdk 2.104.3 → 2.106.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 (47) hide show
  1. package/README.md +39 -0
  2. package/dist/backend/index.d.mts +1 -1
  3. package/dist/backend/index.d.ts +1 -1
  4. package/dist/backend/index.js +6 -4
  5. package/dist/backend/index.js.map +1 -1
  6. package/dist/backend/index.mjs +6 -4
  7. package/dist/backend/index.mjs.map +1 -1
  8. package/dist/batch-settlement/index.d.mts +322 -0
  9. package/dist/batch-settlement/index.d.ts +322 -0
  10. package/dist/batch-settlement/index.js +585 -0
  11. package/dist/batch-settlement/index.js.map +1 -0
  12. package/dist/batch-settlement/index.mjs +555 -0
  13. package/dist/batch-settlement/index.mjs.map +1 -0
  14. package/dist/erc7702-CC-UIL7E.d.mts +158 -0
  15. package/dist/erc7702-CC-UIL7E.d.ts +158 -0
  16. package/dist/{escrow-contracts-amyDktMD.d.mts → escrow-contracts-D3iLODtY.d.mts} +2 -2
  17. package/dist/{escrow-contracts-Bf3PU_Ub.d.ts → escrow-contracts-RTO6mJCW.d.ts} +2 -2
  18. package/dist/index.d.mts +4 -159
  19. package/dist/index.d.ts +4 -159
  20. package/dist/index.js.map +1 -1
  21. package/dist/index.mjs.map +1 -1
  22. package/dist/reputation/index.d.mts +1159 -0
  23. package/dist/reputation/index.d.ts +1159 -0
  24. package/dist/reputation/index.js +3670 -0
  25. package/dist/reputation/index.js.map +1 -0
  26. package/dist/reputation/index.mjs +3603 -0
  27. package/dist/reputation/index.mjs.map +1 -0
  28. package/package.json +23 -2
  29. package/src/backend/index.ts +8 -3
  30. package/src/batch-settlement.ts +882 -0
  31. package/src/reputation/README.md +167 -0
  32. package/src/reputation/canonical.ts +76 -0
  33. package/src/reputation/constants.ts +136 -0
  34. package/src/reputation/directory.ts +60 -0
  35. package/src/reputation/errors.ts +108 -0
  36. package/src/reputation/evidence.ts +321 -0
  37. package/src/reputation/governor.ts +389 -0
  38. package/src/reputation/index.ts +144 -0
  39. package/src/reputation/message-ref.ts +63 -0
  40. package/src/reputation/outbox.ts +510 -0
  41. package/src/reputation/payment.ts +490 -0
  42. package/src/reputation/redact.ts +82 -0
  43. package/src/reputation/sign.ts +227 -0
  44. package/src/reputation/sqlite-outbox.ts +244 -0
  45. package/src/reputation/submit.ts +1005 -0
  46. package/src/reputation/validate.ts +372 -0
  47. package/src/reputation/values.ts +106 -0
package/README.md CHANGED
@@ -23,6 +23,8 @@ Users sign a message or transaction, and the Ultravioleta facilitator handles on
23
23
  - **Escrow & Refunds**: Hold payments with dispute resolution
24
24
  - **Advanced Escrow**: Full escrow lifecycle (authorize, release, refund, charge) with SigningWalletAdapter support
25
25
  - **Escrow Pre-Auth**: Sign-on-assignment `X-Payment-Auth` builder (`buildEscrowPreAuth`) — vector-pinned parity with the Python SDK and Execution Market
26
+ - **Batch Settlement (buyer)**: `uvd-x402-sdk/batch-settlement` — one ERC-3009 deposit opens a channel, each later request pays with a cumulative voucher; capped deposits, vector-pinned parity with the Python SDK
27
+ - **Reputation (rater-authored ERC-8004)**: `uvd-x402-sdk/reputation` — anchor payment, checked prepare, low-s signatures, a persistent outbox that never prepares twice, caps and a circuit breaker, evidence without chat text; vector-pinned parity with the Python SDK
26
28
  - **Commerce Scheme**: `'commerce'` scheme alias for marketplace integrations (identical to `'escrow'` on-chain)
27
29
  - **`/accepts` Negotiation**: Discover facilitator capabilities before constructing payments
28
30
  - **Bazaar Discovery**: Register and discover paid resources across the x402 network
@@ -686,6 +688,43 @@ const paymentAuth = await buildEscrowPreAuth(new EnvKeyAdapter(), {
686
688
 
687
689
  Any `SigningWalletAdapter` works as the signer (only `signTypedData` is used); browser wallets can pass a minimal `{ signTypedData }` wrapper. Validation fails loud instead of falling back: incomplete network config, unknown tier, bounty outside the on-chain deposit limit ($100), or a `maxFeeBps` below the operator's 1300 bps all throw before anything is signed. What the config asserts is also checked against the SDK's own tables before signing, as in the Python SDK: the `chain_id` against the `network` you name (a registry name or `eip155:<id>`), the escrow, token collector and USDC against `ESCROW_CONTRACTS`, the operator against `ESCROW_OPERATORS`, `maxFeeBps` against the chain's ceiling in `ESCROW_MAX_FEE_BPS`, and the USDC EIP-712 domain (`usdc_domain_name` / `usdc_domain_version`) against the token's on-chain domain in `VERIFIED_USDC_DOMAINS`. A contradiction throws `INVALID_CONFIG`, and so do a `network` the SDK does not register and a chain without a row in each of the four tables, with or without `network`; name the network you expect to pay on, from your own code, never one read from the config. A server-published tier window must be an integer from 0 to its `ESCROW_TIER_WINDOW_MAX`, and `authorizationExpiry` at most `ESCROW_MAX_AUTHORIZATION_SEC` after now: past either, the SDK refuses, it never clamps. `computeEscrowNonce` is exported to reproduce `AuthCaptureEscrow.getHash` externally.
688
690
 
691
+ ## Batch Settlement (buyer)
692
+
693
+ The buyer side of the x402 `batch-settlement` scheme on EVM ([spec](https://github.com/coinbase/x402/tree/main/specs/schemes/batch-settlement)): the first paid request signs an ERC-3009 deposit into a payment channel plus a voucher, and every later request on that channel signs only the next cumulative voucher. Same API and the same golden vectors as the Python SDK's `uvd_x402_sdk.batch_settlement`.
694
+
695
+ ```typescript
696
+ import { EnvKeyAdapter } from 'uvd-x402-sdk';
697
+ import { BatchSettlementClient, FileChannelStorage } from 'uvd-x402-sdk/batch-settlement';
698
+
699
+ const client = new BatchSettlementClient(new EnvKeyAdapter(), {
700
+ storage: new FileChannelStorage('./channels.json'), // Node; MemoryChannelStorage by default
701
+ maxDeposit: 1_000_000n, // the default: 1 USDC in atomic units
702
+ });
703
+
704
+ const prepared = await client.createPayment(accepted, { url }); // accepted = the 402's batch-settlement accept
705
+ const res = await fetch(url, { headers: { 'PAYMENT-SIGNATURE': prepared.header() } });
706
+ if (res.ok) await client.confirm(prepared, settleResponse.extra); // from the PAYMENT-RESPONSE header
707
+ ```
708
+
709
+ A deposit is never above `maxDeposit`: the seller's `extra.minDeposit` is a target, and a deposit the next voucher needs above the cap throws `BatchSettlementError` with nothing signed. Only `eip155:*` networks and the ERC-3009 deposit are signed (`assetTransferMethod: 'permit2'` throws). `confirm` records previous cumulative + `chargedAmount` and never copies the seller's `channelState`; a mismatch leaves the local state untouched and resolves to `false`. If the payer may be an EIP-7702 delegated account (a Paybox wallet), pass `delegationResolver` (e.g. `rpcDelegationResolver(rpcUrl)`): the deposit authorization is then wrapped for ERC-1271 when the delegate needs it, and an unreadable chain refuses instead of signing plain. Not included: Permit2 deposits, the cooperative refund and the corrective-402 resync.
710
+
711
+ ## Reputation (rater-authored ERC-8004)
712
+
713
+ Ratings the chain records as authored by your program's own rater wallet, relayed by the facilitator, each anchored by a small USDC payment from the rater to the rated wallet. One module for every program, the same contract and shared vectors as the Python SDK's `uvd_x402_sdk.reputation`. Integration in fifteen lines, the money rules, the outbox states and `!forgetme`: [`src/reputation/README.md`](src/reputation/README.md).
714
+
715
+ ```typescript
716
+ import { Erc8004Client } from 'uvd-x402-sdk/backend';
717
+ import { Governor, SqliteRatingOutbox, describeNetHealth, messageRef, processRating } from 'uvd-x402-sdk/reputation';
718
+
719
+ const outbox = new SqliteRatingOutbox(db); // a better-sqlite3 Database (optional peer dependency), synchronous = FULL
720
+ const governor = new Governor(caps, describeNetHealth(), { store: outbox }); // caps: eight parameters, no defaults
721
+ const ref = messageRef('my-app:v1', streamId, messageId);
722
+ await outbox.enqueue({ ref, network: 'base', subject: wallet, streamId, value: 90, amount: 1000, viewerId });
723
+ await processRating(ref, { outbox, governor, client: new Erc8004Client(), rpc, signer, resolveAgent, buildFeedback });
724
+ ```
725
+
726
+ The module never reads a key (it signs through the `signer` you pass), never pays a wallet whose agent it has not resolved and checked, refuses to sign any prepare that is not the exact rating asked for, stores the signed payment before broadcasting it and the signed rating before sending it, and once a rating is signed it only reads the chain until the deadline, and the delegate's own spent-nonce cell in the rater's storage, prove it did not land.
727
+
689
728
  ## Multi-Stablecoin (EVM)
690
729
 
691
730
  ```typescript
@@ -1,4 +1,4 @@
1
1
  import '../wallet-T0NFUUkT.mjs';
2
2
  export { a as FacilitatorReceipt, F as FetchReceiptResult, P as PaymentState, b as PurchaseContext, c as RECEIPT_ISSUER, R as ReceiptFetchOptions, d as ReceiptKeys, e as STACK_KEY_HEADER, S as StackKeyOptions, f as StackKeyRedirectError, g as canonicalReceiptJson, h as createPurchaseContext, i as fetchWithReceipt, j as getFacilitatorReceipt, m as mergeHeaderList, k as mergePaymentResponseHeaders, p as parseFacilitatorReceipt, l as paymentResponseHeaders, n as purchaseContextHeader, r as receiptCommitment, o as receiptFromErrorBody, q as receiptFromResponse, v as validatePurchaseContext, s as verifyFacilitatorReceipt } from '../receipts-DsOSK0yB.mjs';
3
3
  import '../index-DARXHuQl.mjs';
4
- export { A as AMBIGUOUS_LEASE_REASONS, b as AUTHORIZATION_ALREADY_SETTLED, c as AUTHORIZATION_IN_FLIGHT, d as AdmittedAuthorizationCode, bf as AdvancedAuthorizationResult, bg as AdvancedEscrowClient, bh as AdvancedEscrowClientOptions, bi as AdvancedEscrowContracts, bj as AdvancedEscrowTaskTier, bk as AdvancedPaymentInfo, bl as AdvancedTransactionResult, bm as AgentId, bn as AgentIdentity, bo as AgentRegistration, bp as AgentRegistrationFile, bq as AgentService, br as AtomStats, bs as BASE_MAINNET_CONTRACTS, B as BAZAAR_BODY_METHODS, g as BAZAAR_BODY_TYPES, h as BAZAAR_QUERY_METHODS, j as BazaarBodyEndpoint, k as BazaarBodyMethod, l as BazaarBodyType, bt as BazaarClient, bu as BazaarClientOptions, bv as BazaarDiscoverOptions, bw as BazaarDiscoverResponse, m as BazaarExtensionOptions, n as BazaarOutput, o as BazaarQueryEndpoint, p as BazaarQueryMethod, bx as BazaarRegisterOptions, by as BazaarResource, bz as CreateEscrowOptions, D as DEFAULT_FACILITATOR_RETRIES, bA as DEFAULT_MAX_SEARCH_LEN, r as DEFAULT_RETRY_AFTER_SECONDS, bB as DEPOSIT_LIMIT_USDC, s as DURABLE_DEFAULT_TIMEOUT_MS, bC as DiscoveryAccepts, bD as DiscoveryCuration, bE as DiscoveryHealth, bF as DiscoveryHealthStatus, bG as DiscoveryKind, bH as DiscoveryListOptions, bI as DiscoveryMethod, bJ as DiscoveryPagination, bK as DiscoveryRegisterOptions, bL as DiscoveryResource, bM as DiscoveryResponse, bN as DiscoverySource, bO as DiscoveryStats, bP as DiscoveryTier, bQ as Dispute, bR as DisputeOutcome, u as DurableEvidenceContext, v as DurableEvidenceOptions, bS as ERC8004_CONTRACTS, bT as ERC8004_EXTENSION_ID, bU as ESCROW_CONTRACTS, bV as ESCROW_NOTHING_TO_VOID, bW as ESCROW_OPERATOR_GENERATION, bX as ESCROW_OPERATOR_NOT_DEPLOYED, bY as ESCROW_TIMEOUT_MS, bZ as ESCROW_UNSUPPORTED_ON_GENERATION, b_ as ESCROW_VOID_AMOUNT_MISMATCH, b$ as Erc8004Client, c0 as Erc8004ClientOptions, c1 as Erc8004LookupError, c2 as Erc8004Network, c3 as EscrowClient, c4 as EscrowClientOptions, c5 as EscrowOperatorGeneration, c6 as EscrowPayment, c7 as EscrowStateResponse, c8 as EscrowStatus, F as FacilitatorCallOptions, G as FacilitatorClient, H as FacilitatorClientOptions, I as FacilitatorErrorInfo, J as FacilitatorFailureFields, K as FacilitatorFetchOptions, c9 as FeedbackEntry, ca as FeedbackParams, cb as FeedbackRequest, cc as FeedbackResponse, L as FetchPaywall, M as FetchPaywallOptions, N as FetchRouteInput, cd as HEALTH_FILTERS, O as HonoMiddlewareOptions, P as IDEMPOTENCY_KEY_HEADER, Q as IDEMPOTENT_REPLAYED_HEADER, ce as IdentityByOwnerResponse, cf as IdentityMetadataResponse, cg as IdentityTotalSupplyResponse, ch as KIND_FILTERS, ci as LifecycleAuthOptions, a1 as MAX_RETRY_AFTER_SECONDS, cj as MAX_SEARCH_LEN, ck as METHOD_FILTERS, cl as MetadataEntryParam, cm as OPERATOR_ABI, cn as OPERATOR_ABI_CREATE3, co as OPERATOR_ABI_V3, cp as PAYMENT_INFO_TYPEHASH, a2 as ParsedFacilitatorErrorBody, a3 as PaymentAcceptance, a4 as PaymentConflictResponse, a5 as PaymentMiddlewareOptions, a6 as PaymentPayloadV2, cq as PaymentRequirementResolver, cr as PaymentRequirements, cs as PaymentRequirementsOptions, a7 as PaymentRequirementsV2, ct as PrepareRelayFeedbackRequest, cu as PrepareRelayFeedbackResponse, cv as PrepareRelayResponseRequest, cw as PrepareSolanaFeedbackRequest, cx as PrepareSolanaFeedbackResponse, cy as ProofOfPayment, a8 as RECEIPT_REQUEST_CONFLICT, cz as RELAYED_FEEDBACK_NETWORKS, a9 as REPLAYABLE_LEASE_REASONS, cA as RefundRequest, cB as RefundStatus, cC as RegisterAgentRequest, cD as RegisterAgentResponse, cE as RegisterJobResponse, cF as RegisterJobStatus, cG as RegistrationPendingError, cH as RelayAuthorizationParams, cI as ReputationResponse, cJ as ReputationSummary, cK as RequestRefundOptions, ab as ResourceInfoV2, ac as SETTLEMENT_UNCONFIRMED, cL as SOLANA_FEEDBACK_NETWORKS, cM as SettleRequest, ad as SettleRequestV2, ae as SettleResponse, cN as SettleResponseWithProof, cO as SubmitRelayFeedbackRequest, cP as SubmitRelayResponseRequest, cQ as SubmitSolanaFeedbackRequest, cR as TIER_FILTERS, cS as TIER_TIMINGS, cT as USDC_DOMAIN_NAME, cU as UnavailableBody, cV as UnavailableResponse, af as VerifiedPaymentState, cW as VerifyRequest, ag as VerifyRequestV2, ah as VerifyResponse, ai as WRITER_LEASE_REASONS, ak as WriterLeaseReason, al as X402_CORS_HEADERS, am as X402_HEADER_NAMES, cX as ZERO_ADDRESS, ar as bazaarExtension, cY as buildErc8004PaymentRequirements, au as buildPaymentConflictResponse, av as buildPaymentRequirements, aw as buildSettleRequest, ax as buildSettleRequestForVersion, ay as buildSettleRequestV2, cZ as buildUnavailableResponse, az as buildVerifyRequest, aA as buildVerifyRequestForVersion, aB as buildVerifyRequestV2, c_ as canRefundEscrow, c$ as canReleaseEscrow, d0 as carryFailureFields, aD as create402Response, aE as createFetchPaywall, aF as createHonoMiddleware, aG as createIdempotencyKey, aH as createPaymentMiddleware, d1 as epochToDate, d2 as escrowTimeRemaining, aN as extractPaymentFromHeaders, aO as facilitatorFetch, aP as getCorsHeaders, d3 as getEscrowContractsByChainId, d4 as getEscrowOperatorGeneration, d5 as getEscrowSupportedChainIds, d6 as isAlive, aQ as isAmbiguousLeaseReason, aR as isAuthorizationAlreadyUsed, aS as isAuthorizationInFlight, d7 as isEscrowExpired, d8 as isEscrowSupportedOnChain, d9 as isRegisterJobTerminal, aU as isReplayableLeaseReason, aV as isSettlementUnconfirmed, aY as parseFacilitatorErrorBody, da as parsePaymentHeader, aZ as parseRetryAfterSeconds, b1 as readFacilitatorError, b3 as resolveEnvelopeVersion, db as supportsRelayedFeedback, dc as supportsSolanaFeedback, ba as toPaymentRequirementsV2, bb as toResourceInfoV2, dd as wireNetwork, be as withDiscoverable } from '../escrow-contracts-amyDktMD.mjs';
4
+ export { A as AMBIGUOUS_LEASE_REASONS, b as AUTHORIZATION_ALREADY_SETTLED, c as AUTHORIZATION_IN_FLIGHT, d as AdmittedAuthorizationCode, bi as AdvancedAuthorizationResult, bj as AdvancedEscrowClient, bk as AdvancedEscrowClientOptions, bl as AdvancedEscrowContracts, bm as AdvancedEscrowTaskTier, bn as AdvancedPaymentInfo, bo as AdvancedTransactionResult, bp as AgentId, bq as AgentIdentity, br as AgentRegistration, bs as AgentRegistrationFile, bt as AgentService, bu as AtomStats, bv as BASE_MAINNET_CONTRACTS, B as BAZAAR_BODY_METHODS, g as BAZAAR_BODY_TYPES, h as BAZAAR_QUERY_METHODS, j as BazaarBodyEndpoint, k as BazaarBodyMethod, l as BazaarBodyType, bw as BazaarClient, bx as BazaarClientOptions, by as BazaarDiscoverOptions, bz as BazaarDiscoverResponse, m as BazaarExtensionOptions, n as BazaarOutput, o as BazaarQueryEndpoint, p as BazaarQueryMethod, bA as BazaarRegisterOptions, bB as BazaarResource, bC as CreateEscrowOptions, D as DEFAULT_FACILITATOR_RETRIES, bD as DEFAULT_MAX_SEARCH_LEN, r as DEFAULT_RETRY_AFTER_SECONDS, bE as DEPOSIT_LIMIT_USDC, s as DURABLE_DEFAULT_TIMEOUT_MS, bF as DiscoveryAccepts, bG as DiscoveryCuration, bH as DiscoveryHealth, bI as DiscoveryHealthStatus, bJ as DiscoveryKind, bK as DiscoveryListOptions, bL as DiscoveryMethod, bM as DiscoveryPagination, bN as DiscoveryRegisterOptions, bO as DiscoveryResource, bP as DiscoveryResponse, bQ as DiscoverySource, bR as DiscoveryStats, bS as DiscoveryTier, bT as Dispute, bU as DisputeOutcome, u as DurableEvidenceContext, v as DurableEvidenceOptions, bV as ERC8004_CONTRACTS, bW as ERC8004_EXTENSION_ID, bX as ESCROW_CONTRACTS, bY as ESCROW_NOTHING_TO_VOID, bZ as ESCROW_OPERATOR_GENERATION, b_ as ESCROW_OPERATOR_NOT_DEPLOYED, b$ as ESCROW_TIMEOUT_MS, c0 as ESCROW_UNSUPPORTED_ON_GENERATION, c1 as ESCROW_VOID_AMOUNT_MISMATCH, c2 as Erc8004Client, c3 as Erc8004ClientOptions, c4 as Erc8004LookupError, c5 as Erc8004Network, c6 as EscrowClient, c7 as EscrowClientOptions, c8 as EscrowOperatorGeneration, c9 as EscrowPayment, ca as EscrowStateResponse, cb as EscrowStatus, F as FacilitatorCallOptions, G as FacilitatorClient, H as FacilitatorClientOptions, I as FacilitatorErrorInfo, J as FacilitatorFailureFields, K as FacilitatorFetchOptions, cc as FeedbackEntry, cd as FeedbackParams, ce as FeedbackRequest, cf as FeedbackResponse, L as FetchPaywall, M as FetchPaywallOptions, N as FetchRouteInput, cg as HEALTH_FILTERS, O as HonoMiddlewareOptions, P as IDEMPOTENCY_KEY_HEADER, Q as IDEMPOTENT_REPLAYED_HEADER, ch as IdentityByOwnerResponse, ci as IdentityMetadataResponse, cj as IdentityTotalSupplyResponse, ck as KIND_FILTERS, cl as LifecycleAuthOptions, a1 as MAX_RETRY_AFTER_SECONDS, cm as MAX_SEARCH_LEN, cn as METHOD_FILTERS, co as MetadataEntryParam, cp as OPERATOR_ABI, cq as OPERATOR_ABI_CREATE3, cr as OPERATOR_ABI_V3, cs as PAYMENT_INFO_TYPEHASH, a2 as ParsedFacilitatorErrorBody, a3 as PaymentAcceptance, a4 as PaymentConflictResponse, a5 as PaymentMiddlewareOptions, a6 as PaymentPayloadV2, ct as PaymentRequirementResolver, cu as PaymentRequirements, cv as PaymentRequirementsOptions, a7 as PaymentRequirementsV2, bg as PrepareRelayFeedbackRequest, cw as PrepareRelayFeedbackResponse, cx as PrepareRelayResponseRequest, cy as PrepareSolanaFeedbackRequest, cz as PrepareSolanaFeedbackResponse, bf as ProofOfPayment, a8 as RECEIPT_REQUEST_CONFLICT, cA as RELAYED_FEEDBACK_NETWORKS, a9 as REPLAYABLE_LEASE_REASONS, cB as RefundRequest, cC as RefundStatus, cD as RegisterAgentRequest, cE as RegisterAgentResponse, cF as RegisterJobResponse, cG as RegisterJobStatus, cH as RegistrationPendingError, cI as RelayAuthorizationParams, cJ as ReputationResponse, cK as ReputationSummary, cL as RequestRefundOptions, ab as ResourceInfoV2, ac as SETTLEMENT_UNCONFIRMED, cM as SOLANA_FEEDBACK_NETWORKS, cN as SettleRequest, ad as SettleRequestV2, ae as SettleResponse, cO as SettleResponseWithProof, bh as SubmitRelayFeedbackRequest, cP as SubmitRelayResponseRequest, cQ as SubmitSolanaFeedbackRequest, cR as TIER_FILTERS, cS as TIER_TIMINGS, cT as USDC_DOMAIN_NAME, cU as UnavailableBody, cV as UnavailableResponse, af as VerifiedPaymentState, cW as VerifyRequest, ag as VerifyRequestV2, ah as VerifyResponse, ai as WRITER_LEASE_REASONS, ak as WriterLeaseReason, al as X402_CORS_HEADERS, am as X402_HEADER_NAMES, cX as ZERO_ADDRESS, ar as bazaarExtension, cY as buildErc8004PaymentRequirements, au as buildPaymentConflictResponse, av as buildPaymentRequirements, aw as buildSettleRequest, ax as buildSettleRequestForVersion, ay as buildSettleRequestV2, cZ as buildUnavailableResponse, az as buildVerifyRequest, aA as buildVerifyRequestForVersion, aB as buildVerifyRequestV2, c_ as canRefundEscrow, c$ as canReleaseEscrow, d0 as carryFailureFields, aD as create402Response, aE as createFetchPaywall, aF as createHonoMiddleware, aG as createIdempotencyKey, aH as createPaymentMiddleware, d1 as epochToDate, d2 as escrowTimeRemaining, aN as extractPaymentFromHeaders, aO as facilitatorFetch, aP as getCorsHeaders, d3 as getEscrowContractsByChainId, d4 as getEscrowOperatorGeneration, d5 as getEscrowSupportedChainIds, d6 as isAlive, aQ as isAmbiguousLeaseReason, aR as isAuthorizationAlreadyUsed, aS as isAuthorizationInFlight, d7 as isEscrowExpired, d8 as isEscrowSupportedOnChain, d9 as isRegisterJobTerminal, aU as isReplayableLeaseReason, aV as isSettlementUnconfirmed, aY as parseFacilitatorErrorBody, da as parsePaymentHeader, aZ as parseRetryAfterSeconds, b1 as readFacilitatorError, b3 as resolveEnvelopeVersion, db as supportsRelayedFeedback, dc as supportsSolanaFeedback, ba as toPaymentRequirementsV2, bb as toResourceInfoV2, dd as wireNetwork, be as withDiscoverable } from '../escrow-contracts-D3iLODtY.mjs';
@@ -1,4 +1,4 @@
1
1
  import '../wallet-T0NFUUkT.js';
2
2
  export { a as FacilitatorReceipt, F as FetchReceiptResult, P as PaymentState, b as PurchaseContext, c as RECEIPT_ISSUER, R as ReceiptFetchOptions, d as ReceiptKeys, e as STACK_KEY_HEADER, S as StackKeyOptions, f as StackKeyRedirectError, g as canonicalReceiptJson, h as createPurchaseContext, i as fetchWithReceipt, j as getFacilitatorReceipt, m as mergeHeaderList, k as mergePaymentResponseHeaders, p as parseFacilitatorReceipt, l as paymentResponseHeaders, n as purchaseContextHeader, r as receiptCommitment, o as receiptFromErrorBody, q as receiptFromResponse, v as validatePurchaseContext, s as verifyFacilitatorReceipt } from '../receipts-CMuWVtO0.js';
3
3
  import '../index-DARXHuQl.js';
4
- export { A as AMBIGUOUS_LEASE_REASONS, b as AUTHORIZATION_ALREADY_SETTLED, c as AUTHORIZATION_IN_FLIGHT, d as AdmittedAuthorizationCode, bf as AdvancedAuthorizationResult, bg as AdvancedEscrowClient, bh as AdvancedEscrowClientOptions, bi as AdvancedEscrowContracts, bj as AdvancedEscrowTaskTier, bk as AdvancedPaymentInfo, bl as AdvancedTransactionResult, bm as AgentId, bn as AgentIdentity, bo as AgentRegistration, bp as AgentRegistrationFile, bq as AgentService, br as AtomStats, bs as BASE_MAINNET_CONTRACTS, B as BAZAAR_BODY_METHODS, g as BAZAAR_BODY_TYPES, h as BAZAAR_QUERY_METHODS, j as BazaarBodyEndpoint, k as BazaarBodyMethod, l as BazaarBodyType, bt as BazaarClient, bu as BazaarClientOptions, bv as BazaarDiscoverOptions, bw as BazaarDiscoverResponse, m as BazaarExtensionOptions, n as BazaarOutput, o as BazaarQueryEndpoint, p as BazaarQueryMethod, bx as BazaarRegisterOptions, by as BazaarResource, bz as CreateEscrowOptions, D as DEFAULT_FACILITATOR_RETRIES, bA as DEFAULT_MAX_SEARCH_LEN, r as DEFAULT_RETRY_AFTER_SECONDS, bB as DEPOSIT_LIMIT_USDC, s as DURABLE_DEFAULT_TIMEOUT_MS, bC as DiscoveryAccepts, bD as DiscoveryCuration, bE as DiscoveryHealth, bF as DiscoveryHealthStatus, bG as DiscoveryKind, bH as DiscoveryListOptions, bI as DiscoveryMethod, bJ as DiscoveryPagination, bK as DiscoveryRegisterOptions, bL as DiscoveryResource, bM as DiscoveryResponse, bN as DiscoverySource, bO as DiscoveryStats, bP as DiscoveryTier, bQ as Dispute, bR as DisputeOutcome, u as DurableEvidenceContext, v as DurableEvidenceOptions, bS as ERC8004_CONTRACTS, bT as ERC8004_EXTENSION_ID, bU as ESCROW_CONTRACTS, bV as ESCROW_NOTHING_TO_VOID, bW as ESCROW_OPERATOR_GENERATION, bX as ESCROW_OPERATOR_NOT_DEPLOYED, bY as ESCROW_TIMEOUT_MS, bZ as ESCROW_UNSUPPORTED_ON_GENERATION, b_ as ESCROW_VOID_AMOUNT_MISMATCH, b$ as Erc8004Client, c0 as Erc8004ClientOptions, c1 as Erc8004LookupError, c2 as Erc8004Network, c3 as EscrowClient, c4 as EscrowClientOptions, c5 as EscrowOperatorGeneration, c6 as EscrowPayment, c7 as EscrowStateResponse, c8 as EscrowStatus, F as FacilitatorCallOptions, G as FacilitatorClient, H as FacilitatorClientOptions, I as FacilitatorErrorInfo, J as FacilitatorFailureFields, K as FacilitatorFetchOptions, c9 as FeedbackEntry, ca as FeedbackParams, cb as FeedbackRequest, cc as FeedbackResponse, L as FetchPaywall, M as FetchPaywallOptions, N as FetchRouteInput, cd as HEALTH_FILTERS, O as HonoMiddlewareOptions, P as IDEMPOTENCY_KEY_HEADER, Q as IDEMPOTENT_REPLAYED_HEADER, ce as IdentityByOwnerResponse, cf as IdentityMetadataResponse, cg as IdentityTotalSupplyResponse, ch as KIND_FILTERS, ci as LifecycleAuthOptions, a1 as MAX_RETRY_AFTER_SECONDS, cj as MAX_SEARCH_LEN, ck as METHOD_FILTERS, cl as MetadataEntryParam, cm as OPERATOR_ABI, cn as OPERATOR_ABI_CREATE3, co as OPERATOR_ABI_V3, cp as PAYMENT_INFO_TYPEHASH, a2 as ParsedFacilitatorErrorBody, a3 as PaymentAcceptance, a4 as PaymentConflictResponse, a5 as PaymentMiddlewareOptions, a6 as PaymentPayloadV2, cq as PaymentRequirementResolver, cr as PaymentRequirements, cs as PaymentRequirementsOptions, a7 as PaymentRequirementsV2, ct as PrepareRelayFeedbackRequest, cu as PrepareRelayFeedbackResponse, cv as PrepareRelayResponseRequest, cw as PrepareSolanaFeedbackRequest, cx as PrepareSolanaFeedbackResponse, cy as ProofOfPayment, a8 as RECEIPT_REQUEST_CONFLICT, cz as RELAYED_FEEDBACK_NETWORKS, a9 as REPLAYABLE_LEASE_REASONS, cA as RefundRequest, cB as RefundStatus, cC as RegisterAgentRequest, cD as RegisterAgentResponse, cE as RegisterJobResponse, cF as RegisterJobStatus, cG as RegistrationPendingError, cH as RelayAuthorizationParams, cI as ReputationResponse, cJ as ReputationSummary, cK as RequestRefundOptions, ab as ResourceInfoV2, ac as SETTLEMENT_UNCONFIRMED, cL as SOLANA_FEEDBACK_NETWORKS, cM as SettleRequest, ad as SettleRequestV2, ae as SettleResponse, cN as SettleResponseWithProof, cO as SubmitRelayFeedbackRequest, cP as SubmitRelayResponseRequest, cQ as SubmitSolanaFeedbackRequest, cR as TIER_FILTERS, cS as TIER_TIMINGS, cT as USDC_DOMAIN_NAME, cU as UnavailableBody, cV as UnavailableResponse, af as VerifiedPaymentState, cW as VerifyRequest, ag as VerifyRequestV2, ah as VerifyResponse, ai as WRITER_LEASE_REASONS, ak as WriterLeaseReason, al as X402_CORS_HEADERS, am as X402_HEADER_NAMES, cX as ZERO_ADDRESS, ar as bazaarExtension, cY as buildErc8004PaymentRequirements, au as buildPaymentConflictResponse, av as buildPaymentRequirements, aw as buildSettleRequest, ax as buildSettleRequestForVersion, ay as buildSettleRequestV2, cZ as buildUnavailableResponse, az as buildVerifyRequest, aA as buildVerifyRequestForVersion, aB as buildVerifyRequestV2, c_ as canRefundEscrow, c$ as canReleaseEscrow, d0 as carryFailureFields, aD as create402Response, aE as createFetchPaywall, aF as createHonoMiddleware, aG as createIdempotencyKey, aH as createPaymentMiddleware, d1 as epochToDate, d2 as escrowTimeRemaining, aN as extractPaymentFromHeaders, aO as facilitatorFetch, aP as getCorsHeaders, d3 as getEscrowContractsByChainId, d4 as getEscrowOperatorGeneration, d5 as getEscrowSupportedChainIds, d6 as isAlive, aQ as isAmbiguousLeaseReason, aR as isAuthorizationAlreadyUsed, aS as isAuthorizationInFlight, d7 as isEscrowExpired, d8 as isEscrowSupportedOnChain, d9 as isRegisterJobTerminal, aU as isReplayableLeaseReason, aV as isSettlementUnconfirmed, aY as parseFacilitatorErrorBody, da as parsePaymentHeader, aZ as parseRetryAfterSeconds, b1 as readFacilitatorError, b3 as resolveEnvelopeVersion, db as supportsRelayedFeedback, dc as supportsSolanaFeedback, ba as toPaymentRequirementsV2, bb as toResourceInfoV2, dd as wireNetwork, be as withDiscoverable } from '../escrow-contracts-Bf3PU_Ub.js';
4
+ export { A as AMBIGUOUS_LEASE_REASONS, b as AUTHORIZATION_ALREADY_SETTLED, c as AUTHORIZATION_IN_FLIGHT, d as AdmittedAuthorizationCode, bi as AdvancedAuthorizationResult, bj as AdvancedEscrowClient, bk as AdvancedEscrowClientOptions, bl as AdvancedEscrowContracts, bm as AdvancedEscrowTaskTier, bn as AdvancedPaymentInfo, bo as AdvancedTransactionResult, bp as AgentId, bq as AgentIdentity, br as AgentRegistration, bs as AgentRegistrationFile, bt as AgentService, bu as AtomStats, bv as BASE_MAINNET_CONTRACTS, B as BAZAAR_BODY_METHODS, g as BAZAAR_BODY_TYPES, h as BAZAAR_QUERY_METHODS, j as BazaarBodyEndpoint, k as BazaarBodyMethod, l as BazaarBodyType, bw as BazaarClient, bx as BazaarClientOptions, by as BazaarDiscoverOptions, bz as BazaarDiscoverResponse, m as BazaarExtensionOptions, n as BazaarOutput, o as BazaarQueryEndpoint, p as BazaarQueryMethod, bA as BazaarRegisterOptions, bB as BazaarResource, bC as CreateEscrowOptions, D as DEFAULT_FACILITATOR_RETRIES, bD as DEFAULT_MAX_SEARCH_LEN, r as DEFAULT_RETRY_AFTER_SECONDS, bE as DEPOSIT_LIMIT_USDC, s as DURABLE_DEFAULT_TIMEOUT_MS, bF as DiscoveryAccepts, bG as DiscoveryCuration, bH as DiscoveryHealth, bI as DiscoveryHealthStatus, bJ as DiscoveryKind, bK as DiscoveryListOptions, bL as DiscoveryMethod, bM as DiscoveryPagination, bN as DiscoveryRegisterOptions, bO as DiscoveryResource, bP as DiscoveryResponse, bQ as DiscoverySource, bR as DiscoveryStats, bS as DiscoveryTier, bT as Dispute, bU as DisputeOutcome, u as DurableEvidenceContext, v as DurableEvidenceOptions, bV as ERC8004_CONTRACTS, bW as ERC8004_EXTENSION_ID, bX as ESCROW_CONTRACTS, bY as ESCROW_NOTHING_TO_VOID, bZ as ESCROW_OPERATOR_GENERATION, b_ as ESCROW_OPERATOR_NOT_DEPLOYED, b$ as ESCROW_TIMEOUT_MS, c0 as ESCROW_UNSUPPORTED_ON_GENERATION, c1 as ESCROW_VOID_AMOUNT_MISMATCH, c2 as Erc8004Client, c3 as Erc8004ClientOptions, c4 as Erc8004LookupError, c5 as Erc8004Network, c6 as EscrowClient, c7 as EscrowClientOptions, c8 as EscrowOperatorGeneration, c9 as EscrowPayment, ca as EscrowStateResponse, cb as EscrowStatus, F as FacilitatorCallOptions, G as FacilitatorClient, H as FacilitatorClientOptions, I as FacilitatorErrorInfo, J as FacilitatorFailureFields, K as FacilitatorFetchOptions, cc as FeedbackEntry, cd as FeedbackParams, ce as FeedbackRequest, cf as FeedbackResponse, L as FetchPaywall, M as FetchPaywallOptions, N as FetchRouteInput, cg as HEALTH_FILTERS, O as HonoMiddlewareOptions, P as IDEMPOTENCY_KEY_HEADER, Q as IDEMPOTENT_REPLAYED_HEADER, ch as IdentityByOwnerResponse, ci as IdentityMetadataResponse, cj as IdentityTotalSupplyResponse, ck as KIND_FILTERS, cl as LifecycleAuthOptions, a1 as MAX_RETRY_AFTER_SECONDS, cm as MAX_SEARCH_LEN, cn as METHOD_FILTERS, co as MetadataEntryParam, cp as OPERATOR_ABI, cq as OPERATOR_ABI_CREATE3, cr as OPERATOR_ABI_V3, cs as PAYMENT_INFO_TYPEHASH, a2 as ParsedFacilitatorErrorBody, a3 as PaymentAcceptance, a4 as PaymentConflictResponse, a5 as PaymentMiddlewareOptions, a6 as PaymentPayloadV2, ct as PaymentRequirementResolver, cu as PaymentRequirements, cv as PaymentRequirementsOptions, a7 as PaymentRequirementsV2, bg as PrepareRelayFeedbackRequest, cw as PrepareRelayFeedbackResponse, cx as PrepareRelayResponseRequest, cy as PrepareSolanaFeedbackRequest, cz as PrepareSolanaFeedbackResponse, bf as ProofOfPayment, a8 as RECEIPT_REQUEST_CONFLICT, cA as RELAYED_FEEDBACK_NETWORKS, a9 as REPLAYABLE_LEASE_REASONS, cB as RefundRequest, cC as RefundStatus, cD as RegisterAgentRequest, cE as RegisterAgentResponse, cF as RegisterJobResponse, cG as RegisterJobStatus, cH as RegistrationPendingError, cI as RelayAuthorizationParams, cJ as ReputationResponse, cK as ReputationSummary, cL as RequestRefundOptions, ab as ResourceInfoV2, ac as SETTLEMENT_UNCONFIRMED, cM as SOLANA_FEEDBACK_NETWORKS, cN as SettleRequest, ad as SettleRequestV2, ae as SettleResponse, cO as SettleResponseWithProof, bh as SubmitRelayFeedbackRequest, cP as SubmitRelayResponseRequest, cQ as SubmitSolanaFeedbackRequest, cR as TIER_FILTERS, cS as TIER_TIMINGS, cT as USDC_DOMAIN_NAME, cU as UnavailableBody, cV as UnavailableResponse, af as VerifiedPaymentState, cW as VerifyRequest, ag as VerifyRequestV2, ah as VerifyResponse, ai as WRITER_LEASE_REASONS, ak as WriterLeaseReason, al as X402_CORS_HEADERS, am as X402_HEADER_NAMES, cX as ZERO_ADDRESS, ar as bazaarExtension, cY as buildErc8004PaymentRequirements, au as buildPaymentConflictResponse, av as buildPaymentRequirements, aw as buildSettleRequest, ax as buildSettleRequestForVersion, ay as buildSettleRequestV2, cZ as buildUnavailableResponse, az as buildVerifyRequest, aA as buildVerifyRequestForVersion, aB as buildVerifyRequestV2, c_ as canRefundEscrow, c$ as canReleaseEscrow, d0 as carryFailureFields, aD as create402Response, aE as createFetchPaywall, aF as createHonoMiddleware, aG as createIdempotencyKey, aH as createPaymentMiddleware, d1 as epochToDate, d2 as escrowTimeRemaining, aN as extractPaymentFromHeaders, aO as facilitatorFetch, aP as getCorsHeaders, d3 as getEscrowContractsByChainId, d4 as getEscrowOperatorGeneration, d5 as getEscrowSupportedChainIds, d6 as isAlive, aQ as isAmbiguousLeaseReason, aR as isAuthorizationAlreadyUsed, aS as isAuthorizationInFlight, d7 as isEscrowExpired, d8 as isEscrowSupportedOnChain, d9 as isRegisterJobTerminal, aU as isReplayableLeaseReason, aV as isSettlementUnconfirmed, aY as parseFacilitatorErrorBody, da as parsePaymentHeader, aZ as parseRetryAfterSeconds, b1 as readFacilitatorError, b3 as resolveEnvelopeVersion, db as supportsRelayedFeedback, dc as supportsSolanaFeedback, ba as toPaymentRequirementsV2, bb as toResourceInfoV2, dd as wireNetwork, be as withDiscoverable } from '../escrow-contracts-RTO6mJCW.js';
@@ -5786,13 +5786,14 @@ var Erc8004Client = class {
5786
5786
  });
5787
5787
  clearTimeout(timeoutId);
5788
5788
  if (!response.ok) {
5789
- const errorText = await response.text();
5789
+ const info = await readFacilitatorError(response);
5790
5790
  return {
5791
5791
  success: false,
5792
5792
  delegated: false,
5793
5793
  chainId: 0,
5794
- error: `Facilitator error: ${response.status} - ${errorText}`,
5795
- network: request.network
5794
+ error: info.error,
5795
+ network: request.network,
5796
+ ...failureFields(info)
5796
5797
  };
5797
5798
  }
5798
5799
  return refuseInexactRelayTypedData(await response.json(), request.network);
@@ -5803,7 +5804,8 @@ var Erc8004Client = class {
5803
5804
  delegated: false,
5804
5805
  chainId: 0,
5805
5806
  error: error instanceof Error ? error.message : "Unknown error",
5806
- network: request.network
5807
+ network: request.network,
5808
+ retryable: true
5807
5809
  };
5808
5810
  }
5809
5811
  }