uvd-x402-sdk 2.86.0 → 2.87.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,3 +1,3 @@
1
1
  import '../wallet-w7BnImDG.mjs';
2
2
  import '../index-DOBhTF-j.mjs';
3
- export { A as AMBIGUOUS_LEASE_REASONS, a9 as AdvancedAuthorizationResult, aa as AdvancedEscrowClient, ab as AdvancedEscrowClientOptions, ac as AdvancedEscrowContracts, ad as AdvancedEscrowTaskTier, ae as AdvancedPaymentInfo, af as AdvancedTransactionResult, ag as AgentId, ah as AgentIdentity, ai as AgentRegistration, aj as AgentRegistrationFile, ak as AgentService, al as AtomStats, am as BASE_MAINNET_CONTRACTS, an as BazaarClient, ao as BazaarClientOptions, ap as BazaarDiscoverOptions, aq as BazaarDiscoverResponse, ar as BazaarRegisterOptions, as as BazaarResource, at as CreateEscrowOptions, D as DEFAULT_FACILITATOR_RETRIES, a as DEFAULT_RETRY_AFTER_SECONDS, au as DEPOSIT_LIMIT_USDC, av as DiscoveryAccepts, aw as DiscoveryCuration, ax as DiscoveryHealth, ay as DiscoveryHealthStatus, az as DiscoveryListOptions, aA as DiscoveryPagination, aB as DiscoveryRegisterOptions, aC as DiscoveryResource, aD as DiscoveryResponse, aE as DiscoverySource, aF as DiscoveryStats, aG as DiscoveryTier, aH as Dispute, aI as DisputeOutcome, aJ as ERC8004_CONTRACTS, aK as ERC8004_EXTENSION_ID, aL as ESCROW_CONTRACTS, aM as ESCROW_TIMEOUT_MS, aN as Erc8004Client, aO as Erc8004ClientOptions, aP as Erc8004LookupError, aQ as Erc8004Network, aR as EscrowClient, aS as EscrowClientOptions, aT as EscrowPayment, aU as EscrowStateResponse, aV as EscrowStatus, F as FacilitatorClient, b as FacilitatorClientOptions, c as FacilitatorErrorInfo, d as FacilitatorFailureFields, e as FacilitatorFetchOptions, aW as FeedbackEntry, aX as FeedbackParams, aY as FeedbackRequest, aZ as FeedbackResponse, a_ as HEALTH_FILTERS, H as HonoMiddlewareOptions, a$ as IdentityByOwnerResponse, b0 as IdentityMetadataResponse, b1 as IdentityTotalSupplyResponse, b2 as LifecycleAuthOptions, M as MAX_RETRY_AFTER_SECONDS, b3 as MAX_SEARCH_LEN, b4 as MetadataEntryParam, b5 as OPERATOR_ABI, b6 as OPERATOR_ABI_CREATE3, b7 as PAYMENT_INFO_TYPEHASH, P as ParsedFacilitatorErrorBody, p as PaymentAcceptance, q as PaymentMiddlewareOptions, r as PaymentPayloadV2, b8 as PaymentRequirementResolver, b9 as PaymentRequirements, ba as PaymentRequirementsOptions, s as PaymentRequirementsV2, bb as PrepareRelayFeedbackRequest, bc as PrepareRelayFeedbackResponse, bd as PrepareRelayResponseRequest, be as ProofOfPayment, bf as RELAYED_FEEDBACK_NETWORKS, R as REPLAYABLE_LEASE_REASONS, bg as RefundRequest, bh as RefundStatus, bi as RegisterAgentRequest, bj as RegisterAgentResponse, bk as RegisterJobResponse, bl as RegisterJobStatus, bm as RegistrationPendingError, bn as RelayAuthorizationParams, bo as ReputationResponse, bp as ReputationSummary, bq as RequestRefundOptions, t as ResourceInfoV2, S as SETTLEMENT_UNCONFIRMED, br as SettleRequest, u as SettleRequestV2, bs as SettleResponse, bt as SettleResponseWithProof, bu as SubmitRelayFeedbackRequest, bv as SubmitRelayResponseRequest, bw as TIER_FILTERS, bx as TIER_TIMINGS, by as USDC_DOMAIN_NAME, bz as UnavailableBody, bA as UnavailableResponse, V as VerifiedPaymentState, bB as VerifyRequest, v as VerifyRequestV2, bC as VerifyResponse, W as WRITER_LEASE_REASONS, x as WriterLeaseReason, X as X402_CORS_HEADERS, y as X402_HEADER_NAMES, bD as ZERO_ADDRESS, bE as buildErc8004PaymentRequirements, E as buildPaymentRequirements, G as buildSettleRequest, I as buildSettleRequestForVersion, J as buildSettleRequestV2, bF as buildUnavailableResponse, K as buildVerifyRequest, N as buildVerifyRequestForVersion, O as buildVerifyRequestV2, bG as canRefundEscrow, bH as canReleaseEscrow, bI as carryFailureFields, Q as create402Response, T as createHonoMiddleware, U as createPaymentMiddleware, bJ as epochToDate, bK as escrowTimeRemaining, Y as extractPaymentFromHeaders, Z as facilitatorFetch, _ as getCorsHeaders, bL as getEscrowContractsByChainId, bM as getEscrowSupportedChainIds, bN as isAlive, $ as isAmbiguousLeaseReason, bO as isEscrowExpired, bP as isEscrowSupportedOnChain, bQ as isRegisterJobTerminal, a0 as isReplayableLeaseReason, a1 as isSettlementUnconfirmed, a2 as parseFacilitatorErrorBody, bR as parsePaymentHeader, a3 as parseRetryAfterSeconds, a4 as readFacilitatorError, a5 as resolveEnvelopeVersion, bS as supportsRelayedFeedback, a6 as toPaymentRequirementsV2, a7 as toResourceInfoV2, bT as wireNetwork } from '../index-De03nksW.mjs';
3
+ export { A as AMBIGUOUS_LEASE_REASONS, ab as AdvancedAuthorizationResult, ac as AdvancedEscrowClient, ad as AdvancedEscrowClientOptions, ae as AdvancedEscrowContracts, af as AdvancedEscrowTaskTier, ag as AdvancedPaymentInfo, ah as AdvancedTransactionResult, ai as AgentId, aj as AgentIdentity, ak as AgentRegistration, al as AgentRegistrationFile, am as AgentService, an as AtomStats, ao as BASE_MAINNET_CONTRACTS, ap as BazaarClient, aq as BazaarClientOptions, ar as BazaarDiscoverOptions, as as BazaarDiscoverResponse, at as BazaarRegisterOptions, au as BazaarResource, av as CreateEscrowOptions, D as DEFAULT_FACILITATOR_RETRIES, a as DEFAULT_RETRY_AFTER_SECONDS, aw as DEPOSIT_LIMIT_USDC, ax as DiscoveryAccepts, ay as DiscoveryCuration, az as DiscoveryHealth, aA as DiscoveryHealthStatus, aB as DiscoveryListOptions, aC as DiscoveryPagination, aD as DiscoveryRegisterOptions, aE as DiscoveryResource, aF as DiscoveryResponse, aG as DiscoverySource, aH as DiscoveryStats, aI as DiscoveryTier, aJ as Dispute, aK as DisputeOutcome, aL as ERC8004_CONTRACTS, aM as ERC8004_EXTENSION_ID, aN as ESCROW_CONTRACTS, aO as ESCROW_TIMEOUT_MS, aP as Erc8004Client, aQ as Erc8004ClientOptions, aR as Erc8004LookupError, aS as Erc8004Network, aT as EscrowClient, aU as EscrowClientOptions, aV as EscrowPayment, aW as EscrowStateResponse, aX as EscrowStatus, F as FacilitatorClient, b as FacilitatorClientOptions, c as FacilitatorErrorInfo, d as FacilitatorFailureFields, e as FacilitatorFetchOptions, aY as FeedbackEntry, aZ as FeedbackParams, a_ as FeedbackRequest, a$ as FeedbackResponse, b0 as HEALTH_FILTERS, H as HonoMiddlewareOptions, b1 as IdentityByOwnerResponse, b2 as IdentityMetadataResponse, b3 as IdentityTotalSupplyResponse, b4 as LifecycleAuthOptions, M as MAX_RETRY_AFTER_SECONDS, b5 as MAX_SEARCH_LEN, b6 as MetadataEntryParam, b7 as OPERATOR_ABI, b8 as OPERATOR_ABI_CREATE3, b9 as PAYMENT_INFO_TYPEHASH, P as ParsedFacilitatorErrorBody, q as PaymentAcceptance, r as PaymentMiddlewareOptions, s as PaymentPayloadV2, ba as PaymentRequirementResolver, bb as PaymentRequirements, bc as PaymentRequirementsOptions, t as PaymentRequirementsV2, bd as PrepareRelayFeedbackRequest, be as PrepareRelayFeedbackResponse, bf as PrepareRelayResponseRequest, bg as ProofOfPayment, bh as RELAYED_FEEDBACK_NETWORKS, R as REPLAYABLE_LEASE_REASONS, bi as RefundRequest, bj as RefundStatus, bk as RegisterAgentRequest, bl as RegisterAgentResponse, bm as RegisterJobResponse, bn as RegisterJobStatus, bo as RegistrationPendingError, bp as RelayAuthorizationParams, bq as ReputationResponse, br as ReputationSummary, bs as RequestRefundOptions, u as ResourceInfoV2, S as SETTLEMENT_UNCONFIRMED, bt as SettleRequest, v as SettleRequestV2, bu as SettleResponse, bv as SettleResponseWithProof, bw as SubmitRelayFeedbackRequest, bx as SubmitRelayResponseRequest, by as TIER_FILTERS, bz as TIER_TIMINGS, bA as USDC_DOMAIN_NAME, bB as UnavailableBody, bC as UnavailableResponse, V as VerifiedPaymentState, bD as VerifyRequest, w as VerifyRequestV2, bE as VerifyResponse, W as WRITER_LEASE_REASONS, y as WriterLeaseReason, X as X402_CORS_HEADERS, z as X402_HEADER_NAMES, bF as ZERO_ADDRESS, bG as buildErc8004PaymentRequirements, G as buildPaymentRequirements, I as buildSettleRequest, J as buildSettleRequestForVersion, K as buildSettleRequestV2, bH as buildUnavailableResponse, N as buildVerifyRequest, O as buildVerifyRequestForVersion, Q as buildVerifyRequestV2, bI as canRefundEscrow, bJ as canReleaseEscrow, bK as carryFailureFields, T as create402Response, U as createHonoMiddleware, Y as createPaymentMiddleware, bL as epochToDate, bM as escrowTimeRemaining, Z as extractPaymentFromHeaders, _ as facilitatorFetch, $ as getCorsHeaders, bN as getEscrowContractsByChainId, bO as getEscrowSupportedChainIds, bP as isAlive, a0 as isAmbiguousLeaseReason, bQ as isEscrowExpired, bR as isEscrowSupportedOnChain, bS as isRegisterJobTerminal, a1 as isReplayableLeaseReason, a2 as isSettlementUnconfirmed, a4 as parseFacilitatorErrorBody, bT as parsePaymentHeader, a5 as parseRetryAfterSeconds, a6 as readFacilitatorError, a7 as resolveEnvelopeVersion, bU as supportsRelayedFeedback, a8 as toPaymentRequirementsV2, a9 as toResourceInfoV2, bV as wireNetwork } from '../index-BHfYxpzI.mjs';
@@ -1,3 +1,3 @@
1
1
  import '../wallet-w7BnImDG.js';
2
2
  import '../index-DOBhTF-j.js';
3
- export { A as AMBIGUOUS_LEASE_REASONS, a9 as AdvancedAuthorizationResult, aa as AdvancedEscrowClient, ab as AdvancedEscrowClientOptions, ac as AdvancedEscrowContracts, ad as AdvancedEscrowTaskTier, ae as AdvancedPaymentInfo, af as AdvancedTransactionResult, ag as AgentId, ah as AgentIdentity, ai as AgentRegistration, aj as AgentRegistrationFile, ak as AgentService, al as AtomStats, am as BASE_MAINNET_CONTRACTS, an as BazaarClient, ao as BazaarClientOptions, ap as BazaarDiscoverOptions, aq as BazaarDiscoverResponse, ar as BazaarRegisterOptions, as as BazaarResource, at as CreateEscrowOptions, D as DEFAULT_FACILITATOR_RETRIES, a as DEFAULT_RETRY_AFTER_SECONDS, au as DEPOSIT_LIMIT_USDC, av as DiscoveryAccepts, aw as DiscoveryCuration, ax as DiscoveryHealth, ay as DiscoveryHealthStatus, az as DiscoveryListOptions, aA as DiscoveryPagination, aB as DiscoveryRegisterOptions, aC as DiscoveryResource, aD as DiscoveryResponse, aE as DiscoverySource, aF as DiscoveryStats, aG as DiscoveryTier, aH as Dispute, aI as DisputeOutcome, aJ as ERC8004_CONTRACTS, aK as ERC8004_EXTENSION_ID, aL as ESCROW_CONTRACTS, aM as ESCROW_TIMEOUT_MS, aN as Erc8004Client, aO as Erc8004ClientOptions, aP as Erc8004LookupError, aQ as Erc8004Network, aR as EscrowClient, aS as EscrowClientOptions, aT as EscrowPayment, aU as EscrowStateResponse, aV as EscrowStatus, F as FacilitatorClient, b as FacilitatorClientOptions, c as FacilitatorErrorInfo, d as FacilitatorFailureFields, e as FacilitatorFetchOptions, aW as FeedbackEntry, aX as FeedbackParams, aY as FeedbackRequest, aZ as FeedbackResponse, a_ as HEALTH_FILTERS, H as HonoMiddlewareOptions, a$ as IdentityByOwnerResponse, b0 as IdentityMetadataResponse, b1 as IdentityTotalSupplyResponse, b2 as LifecycleAuthOptions, M as MAX_RETRY_AFTER_SECONDS, b3 as MAX_SEARCH_LEN, b4 as MetadataEntryParam, b5 as OPERATOR_ABI, b6 as OPERATOR_ABI_CREATE3, b7 as PAYMENT_INFO_TYPEHASH, P as ParsedFacilitatorErrorBody, p as PaymentAcceptance, q as PaymentMiddlewareOptions, r as PaymentPayloadV2, b8 as PaymentRequirementResolver, b9 as PaymentRequirements, ba as PaymentRequirementsOptions, s as PaymentRequirementsV2, bb as PrepareRelayFeedbackRequest, bc as PrepareRelayFeedbackResponse, bd as PrepareRelayResponseRequest, be as ProofOfPayment, bf as RELAYED_FEEDBACK_NETWORKS, R as REPLAYABLE_LEASE_REASONS, bg as RefundRequest, bh as RefundStatus, bi as RegisterAgentRequest, bj as RegisterAgentResponse, bk as RegisterJobResponse, bl as RegisterJobStatus, bm as RegistrationPendingError, bn as RelayAuthorizationParams, bo as ReputationResponse, bp as ReputationSummary, bq as RequestRefundOptions, t as ResourceInfoV2, S as SETTLEMENT_UNCONFIRMED, br as SettleRequest, u as SettleRequestV2, bs as SettleResponse, bt as SettleResponseWithProof, bu as SubmitRelayFeedbackRequest, bv as SubmitRelayResponseRequest, bw as TIER_FILTERS, bx as TIER_TIMINGS, by as USDC_DOMAIN_NAME, bz as UnavailableBody, bA as UnavailableResponse, V as VerifiedPaymentState, bB as VerifyRequest, v as VerifyRequestV2, bC as VerifyResponse, W as WRITER_LEASE_REASONS, x as WriterLeaseReason, X as X402_CORS_HEADERS, y as X402_HEADER_NAMES, bD as ZERO_ADDRESS, bE as buildErc8004PaymentRequirements, E as buildPaymentRequirements, G as buildSettleRequest, I as buildSettleRequestForVersion, J as buildSettleRequestV2, bF as buildUnavailableResponse, K as buildVerifyRequest, N as buildVerifyRequestForVersion, O as buildVerifyRequestV2, bG as canRefundEscrow, bH as canReleaseEscrow, bI as carryFailureFields, Q as create402Response, T as createHonoMiddleware, U as createPaymentMiddleware, bJ as epochToDate, bK as escrowTimeRemaining, Y as extractPaymentFromHeaders, Z as facilitatorFetch, _ as getCorsHeaders, bL as getEscrowContractsByChainId, bM as getEscrowSupportedChainIds, bN as isAlive, $ as isAmbiguousLeaseReason, bO as isEscrowExpired, bP as isEscrowSupportedOnChain, bQ as isRegisterJobTerminal, a0 as isReplayableLeaseReason, a1 as isSettlementUnconfirmed, a2 as parseFacilitatorErrorBody, bR as parsePaymentHeader, a3 as parseRetryAfterSeconds, a4 as readFacilitatorError, a5 as resolveEnvelopeVersion, bS as supportsRelayedFeedback, a6 as toPaymentRequirementsV2, a7 as toResourceInfoV2, bT as wireNetwork } from '../index-4_LWWlyF.js';
3
+ export { A as AMBIGUOUS_LEASE_REASONS, ab as AdvancedAuthorizationResult, ac as AdvancedEscrowClient, ad as AdvancedEscrowClientOptions, ae as AdvancedEscrowContracts, af as AdvancedEscrowTaskTier, ag as AdvancedPaymentInfo, ah as AdvancedTransactionResult, ai as AgentId, aj as AgentIdentity, ak as AgentRegistration, al as AgentRegistrationFile, am as AgentService, an as AtomStats, ao as BASE_MAINNET_CONTRACTS, ap as BazaarClient, aq as BazaarClientOptions, ar as BazaarDiscoverOptions, as as BazaarDiscoverResponse, at as BazaarRegisterOptions, au as BazaarResource, av as CreateEscrowOptions, D as DEFAULT_FACILITATOR_RETRIES, a as DEFAULT_RETRY_AFTER_SECONDS, aw as DEPOSIT_LIMIT_USDC, ax as DiscoveryAccepts, ay as DiscoveryCuration, az as DiscoveryHealth, aA as DiscoveryHealthStatus, aB as DiscoveryListOptions, aC as DiscoveryPagination, aD as DiscoveryRegisterOptions, aE as DiscoveryResource, aF as DiscoveryResponse, aG as DiscoverySource, aH as DiscoveryStats, aI as DiscoveryTier, aJ as Dispute, aK as DisputeOutcome, aL as ERC8004_CONTRACTS, aM as ERC8004_EXTENSION_ID, aN as ESCROW_CONTRACTS, aO as ESCROW_TIMEOUT_MS, aP as Erc8004Client, aQ as Erc8004ClientOptions, aR as Erc8004LookupError, aS as Erc8004Network, aT as EscrowClient, aU as EscrowClientOptions, aV as EscrowPayment, aW as EscrowStateResponse, aX as EscrowStatus, F as FacilitatorClient, b as FacilitatorClientOptions, c as FacilitatorErrorInfo, d as FacilitatorFailureFields, e as FacilitatorFetchOptions, aY as FeedbackEntry, aZ as FeedbackParams, a_ as FeedbackRequest, a$ as FeedbackResponse, b0 as HEALTH_FILTERS, H as HonoMiddlewareOptions, b1 as IdentityByOwnerResponse, b2 as IdentityMetadataResponse, b3 as IdentityTotalSupplyResponse, b4 as LifecycleAuthOptions, M as MAX_RETRY_AFTER_SECONDS, b5 as MAX_SEARCH_LEN, b6 as MetadataEntryParam, b7 as OPERATOR_ABI, b8 as OPERATOR_ABI_CREATE3, b9 as PAYMENT_INFO_TYPEHASH, P as ParsedFacilitatorErrorBody, q as PaymentAcceptance, r as PaymentMiddlewareOptions, s as PaymentPayloadV2, ba as PaymentRequirementResolver, bb as PaymentRequirements, bc as PaymentRequirementsOptions, t as PaymentRequirementsV2, bd as PrepareRelayFeedbackRequest, be as PrepareRelayFeedbackResponse, bf as PrepareRelayResponseRequest, bg as ProofOfPayment, bh as RELAYED_FEEDBACK_NETWORKS, R as REPLAYABLE_LEASE_REASONS, bi as RefundRequest, bj as RefundStatus, bk as RegisterAgentRequest, bl as RegisterAgentResponse, bm as RegisterJobResponse, bn as RegisterJobStatus, bo as RegistrationPendingError, bp as RelayAuthorizationParams, bq as ReputationResponse, br as ReputationSummary, bs as RequestRefundOptions, u as ResourceInfoV2, S as SETTLEMENT_UNCONFIRMED, bt as SettleRequest, v as SettleRequestV2, bu as SettleResponse, bv as SettleResponseWithProof, bw as SubmitRelayFeedbackRequest, bx as SubmitRelayResponseRequest, by as TIER_FILTERS, bz as TIER_TIMINGS, bA as USDC_DOMAIN_NAME, bB as UnavailableBody, bC as UnavailableResponse, V as VerifiedPaymentState, bD as VerifyRequest, w as VerifyRequestV2, bE as VerifyResponse, W as WRITER_LEASE_REASONS, y as WriterLeaseReason, X as X402_CORS_HEADERS, z as X402_HEADER_NAMES, bF as ZERO_ADDRESS, bG as buildErc8004PaymentRequirements, G as buildPaymentRequirements, I as buildSettleRequest, J as buildSettleRequestForVersion, K as buildSettleRequestV2, bH as buildUnavailableResponse, N as buildVerifyRequest, O as buildVerifyRequestForVersion, Q as buildVerifyRequestV2, bI as canRefundEscrow, bJ as canReleaseEscrow, bK as carryFailureFields, T as create402Response, U as createHonoMiddleware, Y as createPaymentMiddleware, bL as epochToDate, bM as escrowTimeRemaining, Z as extractPaymentFromHeaders, _ as facilitatorFetch, $ as getCorsHeaders, bN as getEscrowContractsByChainId, bO as getEscrowSupportedChainIds, bP as isAlive, a0 as isAmbiguousLeaseReason, bQ as isEscrowExpired, bR as isEscrowSupportedOnChain, bS as isRegisterJobTerminal, a1 as isReplayableLeaseReason, a2 as isSettlementUnconfirmed, a4 as parseFacilitatorErrorBody, bT as parsePaymentHeader, a5 as parseRetryAfterSeconds, a6 as readFacilitatorError, a7 as resolveEnvelopeVersion, bU as supportsRelayedFeedback, a8 as toPaymentRequirementsV2, a9 as toResourceInfoV2, bV as wireNetwork } from '../index-D67eNxY8.js';
@@ -1213,6 +1213,14 @@ function randomNonce() {
1213
1213
  }
1214
1214
  return ethers.ethers.hexlify(ethers.ethers.randomBytes(32));
1215
1215
  }
1216
+ function resolveOrderTiming(params) {
1217
+ const nowSec = params.now === void 0 ? Math.floor(Date.now() / 1e3) : Math.floor(params.now);
1218
+ return {
1219
+ nowSec,
1220
+ deadline: params.deadline === void 0 ? nowSec + LIFECYCLE_DEFAULT_DEADLINE_SECS : Math.floor(params.deadline),
1221
+ nonce: params.nonce === void 0 ? randomNonce() : params.nonce
1222
+ };
1223
+ }
1216
1224
  function toUintString(value, field) {
1217
1225
  let n;
1218
1226
  try {
@@ -1226,7 +1234,8 @@ function toUintString(value, field) {
1226
1234
  return n.toString();
1227
1235
  }
1228
1236
  function buildLifecycleTypedData(params) {
1229
- const { action, paymentInfo, payer, amount, chainId, deadline, nonce } = params;
1237
+ const { action, paymentInfo, payer, amount, chainId } = params;
1238
+ const { deadline, nonce } = resolveOrderTiming(params);
1230
1239
  if (!LIFECYCLE_ACTIONS.includes(action)) {
1231
1240
  throw new X402Error(
1232
1241
  `unknown lifecycle action ${String(action)}; the facilitator only signs ${LIFECYCLE_ACTIONS.join(", ")}`,
@@ -1285,10 +1294,8 @@ function buildLifecycleTypedData(params) {
1285
1294
  };
1286
1295
  }
1287
1296
  async function buildLifecycleAuth(params) {
1288
- const { wallet, deadline, nonce, now, ...rest } = params;
1289
- const nowSec = now === void 0 ? Math.floor(Date.now() / 1e3) : Math.floor(now);
1290
- const dl = deadline === void 0 ? nowSec + LIFECYCLE_DEFAULT_DEADLINE_SECS : Math.floor(deadline);
1291
- const nonceHex = nonce === void 0 ? randomNonce() : nonce;
1297
+ const { wallet, ...rest } = params;
1298
+ const { nowSec, deadline: dl, nonce: nonceHex } = resolveOrderTiming(params);
1292
1299
  if (dl < nowSec) {
1293
1300
  throw new X402Error(
1294
1301
  `deadline ${dl} is in the past (now ${nowSec}): the facilitator discards it as \`expired\``,
@@ -4259,6 +4266,25 @@ var TIER_TIMINGS = {
4259
4266
  premium: { pre: 14400, auth: 172800, refund: 1209600 },
4260
4267
  enterprise: { pre: 86400, auth: 604800, refund: 2592e3 }
4261
4268
  };
4269
+ async function resolveLifecycleAuth(action, options, order) {
4270
+ if (options?.lifecycleSigner && options?.lifecycleAuth) {
4271
+ throw new X402Error(
4272
+ "lifecycleSigner and lifecycleAuth are mutually exclusive: the first signs an order here, the second was already signed elsewhere. Passing both means two different orders exist and only one can travel.",
4273
+ "INVALID_CONFIG"
4274
+ );
4275
+ }
4276
+ if (options?.lifecycleAuth) return options.lifecycleAuth;
4277
+ if (!options?.lifecycleSigner) return void 0;
4278
+ return buildLifecycleAuth({
4279
+ action,
4280
+ paymentInfo: order.paymentInfo,
4281
+ payer: order.payer,
4282
+ amount: order.amount,
4283
+ chainId: order.chainId,
4284
+ wallet: options.lifecycleSigner,
4285
+ deadline: options.lifecycleDeadline
4286
+ });
4287
+ }
4262
4288
  var OPERATOR_ABI = [
4263
4289
  "function release(tuple(address operator, address payer, address receiver, address token, uint120 maxAmount, uint48 preApprovalExpiry, uint48 authorizationExpiry, uint48 refundExpiry, uint16 minFeeBps, uint16 maxFeeBps, address feeReceiver, uint256 salt) paymentInfo, uint256 amount)",
4264
4290
  "function refundInEscrow(tuple(address operator, address payer, address receiver, address token, uint120 maxAmount, uint48 preApprovalExpiry, uint48 authorizationExpiry, uint48 refundExpiry, uint16 minFeeBps, uint16 maxFeeBps, address feeReceiver, uint256 salt) paymentInfo, uint120 amount)",
@@ -4669,6 +4695,13 @@ var AdvancedEscrowClient = class {
4669
4695
  * lifecycleSigner: payerWallet, // EnvKeyAdapter, OWS, wagmiLifecycleSigner(...)
4670
4696
  * });
4671
4697
  * ```
4698
+ *
4699
+ * @example Transporting an order the publisher signed in their browser
4700
+ * ```typescript
4701
+ * // The browser sent back a signature over a document THIS backend built.
4702
+ * const lifecycleAuth = lifecycleAuthFromSignature(typedData, signature, payer);
4703
+ * await client.releaseViaFacilitator(pi, amount, { lifecycleAuth });
4704
+ * ```
4672
4705
  */
4673
4706
  async releaseViaFacilitator(paymentInfo, amount, options) {
4674
4707
  if (!this.payerAddress) await this.init();
@@ -4687,15 +4720,12 @@ var AdvancedEscrowClient = class {
4687
4720
  salt: paymentInfo.salt
4688
4721
  };
4689
4722
  const releaseAmount = amount || paymentInfo.maxAmount;
4690
- const lifecycleAuth = options?.lifecycleSigner ? await buildLifecycleAuth({
4691
- action: "release",
4723
+ const lifecycleAuth = await resolveLifecycleAuth("release", options, {
4692
4724
  paymentInfo: wirePaymentInfo,
4693
4725
  payer: this.payerAddress,
4694
4726
  amount: releaseAmount,
4695
- chainId: this.chainId,
4696
- wallet: options.lifecycleSigner,
4697
- deadline: options.lifecycleDeadline
4698
- }) : void 0;
4727
+ chainId: this.chainId
4728
+ });
4699
4729
  const payload = {
4700
4730
  x402Version: 2,
4701
4731
  scheme: "escrow",
@@ -4824,15 +4854,12 @@ var AdvancedEscrowClient = class {
4824
4854
  salt: paymentInfo.salt
4825
4855
  };
4826
4856
  const refundAmount = amount || paymentInfo.maxAmount;
4827
- const lifecycleAuth = options?.lifecycleSigner ? await buildLifecycleAuth({
4828
- action: "refundInEscrow",
4857
+ const lifecycleAuth = await resolveLifecycleAuth("refundInEscrow", options, {
4829
4858
  paymentInfo: wirePaymentInfo,
4830
4859
  payer: this.payerAddress,
4831
4860
  amount: refundAmount,
4832
- chainId: this.chainId,
4833
- wallet: options.lifecycleSigner,
4834
- deadline: options.lifecycleDeadline
4835
- }) : void 0;
4861
+ chainId: this.chainId
4862
+ });
4836
4863
  const payload = {
4837
4864
  x402Version: 2,
4838
4865
  scheme: "escrow",