uvd-x402-sdk 2.97.0 → 2.99.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.
package/README.md CHANGED
@@ -19,7 +19,7 @@ Users sign a message or transaction, and the Ultravioleta facilitator handles on
19
19
  - **React & Wagmi**: First-class integrations
20
20
  - **Signing Wallet Adapters**: EnvKeyAdapter (server/CLI), OWSWalletAdapter (Open Wallet Standard), or bring your own
21
21
  - **ERC-8128 Signed Requests**: Authenticate HTTP requests with a wallet (RFC 9421 + EIP-191) — no API keys
22
- - **ERC-8004 Trustless Agents**: On-chain reputation and identity across 21 networks (19 EVM + 2 Solana)
22
+ - **ERC-8004 Trustless Agents**: On-chain reputation and identity across 23 networks (21 EVM + 2 Solana)
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
@@ -1229,16 +1229,19 @@ response.
1229
1229
 
1230
1230
  ## ERC-8004 Trustless Agents
1231
1231
 
1232
- Build verifiable on-chain reputation for AI agents and services. Supports **21 networks** (19 EVM + 2 Solana).
1232
+ Build verifiable on-chain reputation for AI agents and services. Supports **23 networks** (21 EVM + 2 Solana).
1233
1233
 
1234
1234
  > Name Base as `'base'`. The old `'base-mainnet'` spelling is rejected by the facilitator
1235
1235
  > (`400 Invalid network`); the SDK now rewrites it for you, but new code should use `'base'`.
1236
1236
 
1237
1237
  On EVM networks, agent IDs are sequential numbers. On Solana, agent IDs are base58 pubkey strings. The `AgentId` type (`number | string`) handles both.
1238
1238
 
1239
- ### EVM Networks (18)
1239
+ ### EVM Networks (21)
1240
1240
 
1241
- ethereum, base-mainnet, polygon, arbitrum, optimism, celo, bsc, monad, avalanche, skale-base, ethereum-sepolia, base-sepolia, polygon-amoy, arbitrum-sepolia, optimism-sepolia, celo-sepolia, avalanche-fuji, skale-base-sepolia
1241
+ ethereum, base, polygon, arbitrum, optimism, celo, bsc, monad, avalanche, scroll, skale-base, arc, ethereum-sepolia, base-sepolia, polygon-amoy, arbitrum-sepolia, optimism-sepolia, celo-sepolia, avalanche-fuji, skale-base-sepolia, arc-testnet
1242
+
1243
+ Arc (`arc`, `arc-testnet`) since 2.98.0, with the canonical registries on both; see
1244
+ [ERC-8004 on Arc](docs/networks/arc.md#erc-8004-on-arc-2980).
1242
1245
 
1243
1246
  ### Solana Networks (2)
1244
1247
 
@@ -1356,14 +1359,16 @@ Pass the **same** feedback parameters, `deadline` and `nonce` back to
1356
1359
  registry calldata from them and refuses to relay anything the rater's signature
1357
1360
  does not cover.
1358
1361
 
1359
- Available on the nine networks in `RELAYED_FEEDBACK_NETWORKS` -- the eight
1362
+ Available on the ten networks in `RELAYED_FEEDBACK_NETWORKS` -- the nine
1360
1363
  mainnets with a deployed `FeedbackDelegate` (base, ethereum, polygon, arbitrum,
1361
- optimism, celo, bsc, monad) plus base-sepolia. **Avalanche is not one of them
1364
+ optimism, celo, bsc, monad, arc) plus base-sepolia. **Avalanche is not one of them
1362
1365
  and is not waiting to become one**: its C-Chain rejects the transaction type
1363
1366
  itself (`-32000 transaction type not supported`), so anchor the rating on a
1364
1367
  chain that supports EIP-7702 -- the payment stays where it was made.
1368
+ `arc-testnet` serves ERC-8004 reads but not this rail: no delegate is deployed
1369
+ there, and `prepare` answers 400.
1365
1370
 
1366
- Requires facilitator v1.93.0+ for the mainnets; base-sepolia since v1.74.0.
1371
+ Requires facilitator v1.93.0+ for the mainnets (2.38.0+ for arc); base-sepolia since v1.74.0.
1367
1372
 
1368
1373
  ### The same thing on Solana, without a delegate
1369
1374
 
@@ -1488,7 +1493,7 @@ const state = await escrow.getEscrowState({
1488
1493
 
1489
1494
  Full escrow lifecycle management for EVM chains. Supports both `ethers.Signer` and `SigningWalletAdapter` (EnvKey, OWS) for signing.
1490
1495
 
1491
- Supported on 10 EVM networks: Base, Base Sepolia, Ethereum, Ethereum Sepolia, Polygon, Arbitrum, Optimism, Celo, Monad, Avalanche.
1496
+ Supported on 10 EVM networks: Base, Base Sepolia, Ethereum, Ethereum Sepolia, Polygon, Arbitrum, Optimism, Celo, Monad, Avalanche. Since 2.99.0 also on Arc and Arc Testnet, on the x402r canonical escrow: there `release` sends `capture` and `refundInEscrow` sends `void`, which only returns the whole capturable amount. See [Escrow on Arc](docs/networks/arc.md#escrow-on-arc-2990).
1492
1497
 
1493
1498
  ### With Private Key (ethers.Signer)
1494
1499
 
@@ -1,4 +1,4 @@
1
1
  import '../wallet-w7BnImDG.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 canonicalReceiptJson, f as createPurchaseContext, g as fetchWithReceipt, h as getFacilitatorReceipt, m as mergeHeaderList, i as mergePaymentResponseHeaders, p as parseFacilitatorReceipt, j as paymentResponseHeaders, k as purchaseContextHeader, r as receiptCommitment, l as receiptFromErrorBody, n as receiptFromResponse, v as validatePurchaseContext, o as verifyFacilitatorReceipt } from '../receipts-D0zg-8uK.mjs';
3
3
  import '../index-BsKsZzP3.mjs';
4
- export { A as AMBIGUOUS_LEASE_REASONS, a as AUTHORIZATION_ALREADY_SETTLED, b as AUTHORIZATION_IN_FLIGHT, c as AdmittedAuthorizationCode, ap as AdvancedAuthorizationResult, aq as AdvancedEscrowClient, ar as AdvancedEscrowClientOptions, as as AdvancedEscrowContracts, at as AdvancedEscrowTaskTier, au as AdvancedPaymentInfo, av as AdvancedTransactionResult, aw as AgentId, ax as AgentIdentity, ay as AgentRegistration, az as AgentRegistrationFile, aA as AgentService, aB as AtomStats, aC as BASE_MAINNET_CONTRACTS, aD as BazaarClient, aE as BazaarClientOptions, aF as BazaarDiscoverOptions, aG as BazaarDiscoverResponse, aH as BazaarRegisterOptions, aI as BazaarResource, aJ as CreateEscrowOptions, D as DEFAULT_FACILITATOR_RETRIES, d as DEFAULT_RETRY_AFTER_SECONDS, aK as DEPOSIT_LIMIT_USDC, aL as DiscoveryAccepts, aM as DiscoveryCuration, aN as DiscoveryHealth, aO as DiscoveryHealthStatus, aP as DiscoveryListOptions, aQ as DiscoveryPagination, aR as DiscoveryRegisterOptions, aS as DiscoveryResource, aT as DiscoveryResponse, aU as DiscoverySource, aV as DiscoveryStats, aW as DiscoveryTier, aX as Dispute, aY as DisputeOutcome, aZ as ERC8004_CONTRACTS, a_ as ERC8004_EXTENSION_ID, a$ as ESCROW_CONTRACTS, b0 as ESCROW_TIMEOUT_MS, b1 as Erc8004Client, b2 as Erc8004ClientOptions, b3 as Erc8004LookupError, b4 as Erc8004Network, b5 as EscrowClient, b6 as EscrowClientOptions, b7 as EscrowPayment, b8 as EscrowStateResponse, b9 as EscrowStatus, F as FacilitatorCallOptions, e as FacilitatorClient, f as FacilitatorClientOptions, g as FacilitatorErrorInfo, h as FacilitatorFailureFields, i as FacilitatorFetchOptions, ba as FeedbackEntry, bb as FeedbackParams, bc as FeedbackRequest, bd as FeedbackResponse, be as HEALTH_FILTERS, H as HonoMiddlewareOptions, I as IDEMPOTENCY_KEY_HEADER, j as IDEMPOTENT_REPLAYED_HEADER, bf as IdentityByOwnerResponse, bg as IdentityMetadataResponse, bh as IdentityTotalSupplyResponse, bi as LifecycleAuthOptions, M as MAX_RETRY_AFTER_SECONDS, bj as MAX_SEARCH_LEN, bk as MetadataEntryParam, bl as OPERATOR_ABI, bm as OPERATOR_ABI_CREATE3, bn as PAYMENT_INFO_TYPEHASH, P as ParsedFacilitatorErrorBody, v as PaymentAcceptance, w as PaymentConflictResponse, x as PaymentMiddlewareOptions, y as PaymentPayloadV2, bo as PaymentRequirementResolver, bp as PaymentRequirements, bq as PaymentRequirementsOptions, z as PaymentRequirementsV2, br as PrepareRelayFeedbackRequest, bs as PrepareRelayFeedbackResponse, bt as PrepareRelayResponseRequest, bu as PrepareSolanaFeedbackRequest, bv as PrepareSolanaFeedbackResponse, bw as ProofOfPayment, R as RECEIPT_REQUEST_CONFLICT, bx as RELAYED_FEEDBACK_NETWORKS, C as REPLAYABLE_LEASE_REASONS, by as RefundRequest, bz as RefundStatus, bA as RegisterAgentRequest, bB as RegisterAgentResponse, bC as RegisterJobResponse, bD as RegisterJobStatus, bE as RegistrationPendingError, bF as RelayAuthorizationParams, bG as ReputationResponse, bH as ReputationSummary, bI as RequestRefundOptions, E as ResourceInfoV2, S as SETTLEMENT_UNCONFIRMED, bJ as SOLANA_FEEDBACK_NETWORKS, bK as SettleRequest, G as SettleRequestV2, J as SettleResponse, bL as SettleResponseWithProof, bM as SubmitRelayFeedbackRequest, bN as SubmitRelayResponseRequest, bO as SubmitSolanaFeedbackRequest, bP as TIER_FILTERS, bQ as TIER_TIMINGS, bR as USDC_DOMAIN_NAME, bS as UnavailableBody, bT as UnavailableResponse, V as VerifiedPaymentState, bU as VerifyRequest, K as VerifyRequestV2, N as VerifyResponse, W as WRITER_LEASE_REASONS, Q as WriterLeaseReason, X as X402_CORS_HEADERS, T as X402_HEADER_NAMES, bV as ZERO_ADDRESS, bW as buildErc8004PaymentRequirements, Z as buildPaymentConflictResponse, _ as buildPaymentRequirements, $ as buildSettleRequest, a0 as buildSettleRequestForVersion, a1 as buildSettleRequestV2, bX as buildUnavailableResponse, a2 as buildVerifyRequest, a3 as buildVerifyRequestForVersion, a4 as buildVerifyRequestV2, bY as canRefundEscrow, bZ as canReleaseEscrow, b_ as carryFailureFields, a5 as create402Response, a6 as createHonoMiddleware, a7 as createIdempotencyKey, a8 as createPaymentMiddleware, b$ as epochToDate, c0 as escrowTimeRemaining, a9 as extractPaymentFromHeaders, aa as facilitatorFetch, ab as getCorsHeaders, c1 as getEscrowContractsByChainId, c2 as getEscrowSupportedChainIds, c3 as isAlive, ac as isAmbiguousLeaseReason, ad as isAuthorizationAlreadyUsed, ae as isAuthorizationInFlight, c4 as isEscrowExpired, c5 as isEscrowSupportedOnChain, c6 as isRegisterJobTerminal, af as isReplayableLeaseReason, ag as isSettlementUnconfirmed, ai as parseFacilitatorErrorBody, c7 as parsePaymentHeader, aj as parseRetryAfterSeconds, ak as readFacilitatorError, al as resolveEnvelopeVersion, c8 as supportsRelayedFeedback, c9 as supportsSolanaFeedback, am as toPaymentRequirementsV2, an as toResourceInfoV2, ca as wireNetwork } from '../index-ClOAmprt.mjs';
4
+ export { A as AMBIGUOUS_LEASE_REASONS, a as AUTHORIZATION_ALREADY_SETTLED, b as AUTHORIZATION_IN_FLIGHT, c as AdmittedAuthorizationCode, ap as AdvancedAuthorizationResult, aq as AdvancedEscrowClient, ar as AdvancedEscrowClientOptions, as as AdvancedEscrowContracts, at as AdvancedEscrowTaskTier, au as AdvancedPaymentInfo, av as AdvancedTransactionResult, aw as AgentId, ax as AgentIdentity, ay as AgentRegistration, az as AgentRegistrationFile, aA as AgentService, aB as AtomStats, aC as BASE_MAINNET_CONTRACTS, aD as BazaarClient, aE as BazaarClientOptions, aF as BazaarDiscoverOptions, aG as BazaarDiscoverResponse, aH as BazaarRegisterOptions, aI as BazaarResource, aJ as CreateEscrowOptions, D as DEFAULT_FACILITATOR_RETRIES, d as DEFAULT_RETRY_AFTER_SECONDS, aK as DEPOSIT_LIMIT_USDC, aL as DiscoveryAccepts, aM as DiscoveryCuration, aN as DiscoveryHealth, aO as DiscoveryHealthStatus, aP as DiscoveryListOptions, aQ as DiscoveryPagination, aR as DiscoveryRegisterOptions, aS as DiscoveryResource, aT as DiscoveryResponse, aU as DiscoverySource, aV as DiscoveryStats, aW as DiscoveryTier, aX as Dispute, aY as DisputeOutcome, aZ as ERC8004_CONTRACTS, a_ as ERC8004_EXTENSION_ID, a$ as ESCROW_CONTRACTS, b0 as ESCROW_NOTHING_TO_VOID, b1 as ESCROW_OPERATOR_GENERATION, b2 as ESCROW_OPERATOR_NOT_DEPLOYED, b3 as ESCROW_TIMEOUT_MS, b4 as ESCROW_UNSUPPORTED_ON_GENERATION, b5 as ESCROW_VOID_AMOUNT_MISMATCH, b6 as Erc8004Client, b7 as Erc8004ClientOptions, b8 as Erc8004LookupError, b9 as Erc8004Network, ba as EscrowClient, bb as EscrowClientOptions, bc as EscrowOperatorGeneration, bd as EscrowPayment, be as EscrowStateResponse, bf as EscrowStatus, F as FacilitatorCallOptions, e as FacilitatorClient, f as FacilitatorClientOptions, g as FacilitatorErrorInfo, h as FacilitatorFailureFields, i as FacilitatorFetchOptions, bg as FeedbackEntry, bh as FeedbackParams, bi as FeedbackRequest, bj as FeedbackResponse, bk as HEALTH_FILTERS, H as HonoMiddlewareOptions, I as IDEMPOTENCY_KEY_HEADER, j as IDEMPOTENT_REPLAYED_HEADER, bl as IdentityByOwnerResponse, bm as IdentityMetadataResponse, bn as IdentityTotalSupplyResponse, bo as LifecycleAuthOptions, M as MAX_RETRY_AFTER_SECONDS, bp as MAX_SEARCH_LEN, bq as MetadataEntryParam, br as OPERATOR_ABI, bs as OPERATOR_ABI_CREATE3, bt as OPERATOR_ABI_V3, bu as PAYMENT_INFO_TYPEHASH, P as ParsedFacilitatorErrorBody, v as PaymentAcceptance, w as PaymentConflictResponse, x as PaymentMiddlewareOptions, y as PaymentPayloadV2, bv as PaymentRequirementResolver, bw as PaymentRequirements, bx as PaymentRequirementsOptions, z as PaymentRequirementsV2, by as PrepareRelayFeedbackRequest, bz as PrepareRelayFeedbackResponse, bA as PrepareRelayResponseRequest, bB as PrepareSolanaFeedbackRequest, bC as PrepareSolanaFeedbackResponse, bD as ProofOfPayment, R as RECEIPT_REQUEST_CONFLICT, bE as RELAYED_FEEDBACK_NETWORKS, C as REPLAYABLE_LEASE_REASONS, bF as RefundRequest, bG as RefundStatus, bH as RegisterAgentRequest, bI as RegisterAgentResponse, bJ as RegisterJobResponse, bK as RegisterJobStatus, bL as RegistrationPendingError, bM as RelayAuthorizationParams, bN as ReputationResponse, bO as ReputationSummary, bP as RequestRefundOptions, E as ResourceInfoV2, S as SETTLEMENT_UNCONFIRMED, bQ as SOLANA_FEEDBACK_NETWORKS, bR as SettleRequest, G as SettleRequestV2, J as SettleResponse, bS as SettleResponseWithProof, bT as SubmitRelayFeedbackRequest, bU as SubmitRelayResponseRequest, bV as SubmitSolanaFeedbackRequest, bW as TIER_FILTERS, bX as TIER_TIMINGS, bY as USDC_DOMAIN_NAME, bZ as UnavailableBody, b_ as UnavailableResponse, V as VerifiedPaymentState, b$ as VerifyRequest, K as VerifyRequestV2, N as VerifyResponse, W as WRITER_LEASE_REASONS, Q as WriterLeaseReason, X as X402_CORS_HEADERS, T as X402_HEADER_NAMES, c0 as ZERO_ADDRESS, c1 as buildErc8004PaymentRequirements, Z as buildPaymentConflictResponse, _ as buildPaymentRequirements, $ as buildSettleRequest, a0 as buildSettleRequestForVersion, a1 as buildSettleRequestV2, c2 as buildUnavailableResponse, a2 as buildVerifyRequest, a3 as buildVerifyRequestForVersion, a4 as buildVerifyRequestV2, c3 as canRefundEscrow, c4 as canReleaseEscrow, c5 as carryFailureFields, a5 as create402Response, a6 as createHonoMiddleware, a7 as createIdempotencyKey, a8 as createPaymentMiddleware, c6 as epochToDate, c7 as escrowTimeRemaining, a9 as extractPaymentFromHeaders, aa as facilitatorFetch, ab as getCorsHeaders, c8 as getEscrowContractsByChainId, c9 as getEscrowOperatorGeneration, ca as getEscrowSupportedChainIds, cb as isAlive, ac as isAmbiguousLeaseReason, ad as isAuthorizationAlreadyUsed, ae as isAuthorizationInFlight, cc as isEscrowExpired, cd as isEscrowSupportedOnChain, ce as isRegisterJobTerminal, af as isReplayableLeaseReason, ag as isSettlementUnconfirmed, ai as parseFacilitatorErrorBody, cf as parsePaymentHeader, aj as parseRetryAfterSeconds, ak as readFacilitatorError, al as resolveEnvelopeVersion, cg as supportsRelayedFeedback, ch as supportsSolanaFeedback, am as toPaymentRequirementsV2, an as toResourceInfoV2, ci as wireNetwork } from '../index-SaqboHsK.mjs';
@@ -1,4 +1,4 @@
1
1
  import '../wallet-w7BnImDG.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 canonicalReceiptJson, f as createPurchaseContext, g as fetchWithReceipt, h as getFacilitatorReceipt, m as mergeHeaderList, i as mergePaymentResponseHeaders, p as parseFacilitatorReceipt, j as paymentResponseHeaders, k as purchaseContextHeader, r as receiptCommitment, l as receiptFromErrorBody, n as receiptFromResponse, v as validatePurchaseContext, o as verifyFacilitatorReceipt } from '../receipts-Co6C9FPO.js';
3
3
  import '../index-BsKsZzP3.js';
4
- export { A as AMBIGUOUS_LEASE_REASONS, a as AUTHORIZATION_ALREADY_SETTLED, b as AUTHORIZATION_IN_FLIGHT, c as AdmittedAuthorizationCode, ap as AdvancedAuthorizationResult, aq as AdvancedEscrowClient, ar as AdvancedEscrowClientOptions, as as AdvancedEscrowContracts, at as AdvancedEscrowTaskTier, au as AdvancedPaymentInfo, av as AdvancedTransactionResult, aw as AgentId, ax as AgentIdentity, ay as AgentRegistration, az as AgentRegistrationFile, aA as AgentService, aB as AtomStats, aC as BASE_MAINNET_CONTRACTS, aD as BazaarClient, aE as BazaarClientOptions, aF as BazaarDiscoverOptions, aG as BazaarDiscoverResponse, aH as BazaarRegisterOptions, aI as BazaarResource, aJ as CreateEscrowOptions, D as DEFAULT_FACILITATOR_RETRIES, d as DEFAULT_RETRY_AFTER_SECONDS, aK as DEPOSIT_LIMIT_USDC, aL as DiscoveryAccepts, aM as DiscoveryCuration, aN as DiscoveryHealth, aO as DiscoveryHealthStatus, aP as DiscoveryListOptions, aQ as DiscoveryPagination, aR as DiscoveryRegisterOptions, aS as DiscoveryResource, aT as DiscoveryResponse, aU as DiscoverySource, aV as DiscoveryStats, aW as DiscoveryTier, aX as Dispute, aY as DisputeOutcome, aZ as ERC8004_CONTRACTS, a_ as ERC8004_EXTENSION_ID, a$ as ESCROW_CONTRACTS, b0 as ESCROW_TIMEOUT_MS, b1 as Erc8004Client, b2 as Erc8004ClientOptions, b3 as Erc8004LookupError, b4 as Erc8004Network, b5 as EscrowClient, b6 as EscrowClientOptions, b7 as EscrowPayment, b8 as EscrowStateResponse, b9 as EscrowStatus, F as FacilitatorCallOptions, e as FacilitatorClient, f as FacilitatorClientOptions, g as FacilitatorErrorInfo, h as FacilitatorFailureFields, i as FacilitatorFetchOptions, ba as FeedbackEntry, bb as FeedbackParams, bc as FeedbackRequest, bd as FeedbackResponse, be as HEALTH_FILTERS, H as HonoMiddlewareOptions, I as IDEMPOTENCY_KEY_HEADER, j as IDEMPOTENT_REPLAYED_HEADER, bf as IdentityByOwnerResponse, bg as IdentityMetadataResponse, bh as IdentityTotalSupplyResponse, bi as LifecycleAuthOptions, M as MAX_RETRY_AFTER_SECONDS, bj as MAX_SEARCH_LEN, bk as MetadataEntryParam, bl as OPERATOR_ABI, bm as OPERATOR_ABI_CREATE3, bn as PAYMENT_INFO_TYPEHASH, P as ParsedFacilitatorErrorBody, v as PaymentAcceptance, w as PaymentConflictResponse, x as PaymentMiddlewareOptions, y as PaymentPayloadV2, bo as PaymentRequirementResolver, bp as PaymentRequirements, bq as PaymentRequirementsOptions, z as PaymentRequirementsV2, br as PrepareRelayFeedbackRequest, bs as PrepareRelayFeedbackResponse, bt as PrepareRelayResponseRequest, bu as PrepareSolanaFeedbackRequest, bv as PrepareSolanaFeedbackResponse, bw as ProofOfPayment, R as RECEIPT_REQUEST_CONFLICT, bx as RELAYED_FEEDBACK_NETWORKS, C as REPLAYABLE_LEASE_REASONS, by as RefundRequest, bz as RefundStatus, bA as RegisterAgentRequest, bB as RegisterAgentResponse, bC as RegisterJobResponse, bD as RegisterJobStatus, bE as RegistrationPendingError, bF as RelayAuthorizationParams, bG as ReputationResponse, bH as ReputationSummary, bI as RequestRefundOptions, E as ResourceInfoV2, S as SETTLEMENT_UNCONFIRMED, bJ as SOLANA_FEEDBACK_NETWORKS, bK as SettleRequest, G as SettleRequestV2, J as SettleResponse, bL as SettleResponseWithProof, bM as SubmitRelayFeedbackRequest, bN as SubmitRelayResponseRequest, bO as SubmitSolanaFeedbackRequest, bP as TIER_FILTERS, bQ as TIER_TIMINGS, bR as USDC_DOMAIN_NAME, bS as UnavailableBody, bT as UnavailableResponse, V as VerifiedPaymentState, bU as VerifyRequest, K as VerifyRequestV2, N as VerifyResponse, W as WRITER_LEASE_REASONS, Q as WriterLeaseReason, X as X402_CORS_HEADERS, T as X402_HEADER_NAMES, bV as ZERO_ADDRESS, bW as buildErc8004PaymentRequirements, Z as buildPaymentConflictResponse, _ as buildPaymentRequirements, $ as buildSettleRequest, a0 as buildSettleRequestForVersion, a1 as buildSettleRequestV2, bX as buildUnavailableResponse, a2 as buildVerifyRequest, a3 as buildVerifyRequestForVersion, a4 as buildVerifyRequestV2, bY as canRefundEscrow, bZ as canReleaseEscrow, b_ as carryFailureFields, a5 as create402Response, a6 as createHonoMiddleware, a7 as createIdempotencyKey, a8 as createPaymentMiddleware, b$ as epochToDate, c0 as escrowTimeRemaining, a9 as extractPaymentFromHeaders, aa as facilitatorFetch, ab as getCorsHeaders, c1 as getEscrowContractsByChainId, c2 as getEscrowSupportedChainIds, c3 as isAlive, ac as isAmbiguousLeaseReason, ad as isAuthorizationAlreadyUsed, ae as isAuthorizationInFlight, c4 as isEscrowExpired, c5 as isEscrowSupportedOnChain, c6 as isRegisterJobTerminal, af as isReplayableLeaseReason, ag as isSettlementUnconfirmed, ai as parseFacilitatorErrorBody, c7 as parsePaymentHeader, aj as parseRetryAfterSeconds, ak as readFacilitatorError, al as resolveEnvelopeVersion, c8 as supportsRelayedFeedback, c9 as supportsSolanaFeedback, am as toPaymentRequirementsV2, an as toResourceInfoV2, ca as wireNetwork } from '../index-DNTFp6WT.js';
4
+ export { A as AMBIGUOUS_LEASE_REASONS, a as AUTHORIZATION_ALREADY_SETTLED, b as AUTHORIZATION_IN_FLIGHT, c as AdmittedAuthorizationCode, ap as AdvancedAuthorizationResult, aq as AdvancedEscrowClient, ar as AdvancedEscrowClientOptions, as as AdvancedEscrowContracts, at as AdvancedEscrowTaskTier, au as AdvancedPaymentInfo, av as AdvancedTransactionResult, aw as AgentId, ax as AgentIdentity, ay as AgentRegistration, az as AgentRegistrationFile, aA as AgentService, aB as AtomStats, aC as BASE_MAINNET_CONTRACTS, aD as BazaarClient, aE as BazaarClientOptions, aF as BazaarDiscoverOptions, aG as BazaarDiscoverResponse, aH as BazaarRegisterOptions, aI as BazaarResource, aJ as CreateEscrowOptions, D as DEFAULT_FACILITATOR_RETRIES, d as DEFAULT_RETRY_AFTER_SECONDS, aK as DEPOSIT_LIMIT_USDC, aL as DiscoveryAccepts, aM as DiscoveryCuration, aN as DiscoveryHealth, aO as DiscoveryHealthStatus, aP as DiscoveryListOptions, aQ as DiscoveryPagination, aR as DiscoveryRegisterOptions, aS as DiscoveryResource, aT as DiscoveryResponse, aU as DiscoverySource, aV as DiscoveryStats, aW as DiscoveryTier, aX as Dispute, aY as DisputeOutcome, aZ as ERC8004_CONTRACTS, a_ as ERC8004_EXTENSION_ID, a$ as ESCROW_CONTRACTS, b0 as ESCROW_NOTHING_TO_VOID, b1 as ESCROW_OPERATOR_GENERATION, b2 as ESCROW_OPERATOR_NOT_DEPLOYED, b3 as ESCROW_TIMEOUT_MS, b4 as ESCROW_UNSUPPORTED_ON_GENERATION, b5 as ESCROW_VOID_AMOUNT_MISMATCH, b6 as Erc8004Client, b7 as Erc8004ClientOptions, b8 as Erc8004LookupError, b9 as Erc8004Network, ba as EscrowClient, bb as EscrowClientOptions, bc as EscrowOperatorGeneration, bd as EscrowPayment, be as EscrowStateResponse, bf as EscrowStatus, F as FacilitatorCallOptions, e as FacilitatorClient, f as FacilitatorClientOptions, g as FacilitatorErrorInfo, h as FacilitatorFailureFields, i as FacilitatorFetchOptions, bg as FeedbackEntry, bh as FeedbackParams, bi as FeedbackRequest, bj as FeedbackResponse, bk as HEALTH_FILTERS, H as HonoMiddlewareOptions, I as IDEMPOTENCY_KEY_HEADER, j as IDEMPOTENT_REPLAYED_HEADER, bl as IdentityByOwnerResponse, bm as IdentityMetadataResponse, bn as IdentityTotalSupplyResponse, bo as LifecycleAuthOptions, M as MAX_RETRY_AFTER_SECONDS, bp as MAX_SEARCH_LEN, bq as MetadataEntryParam, br as OPERATOR_ABI, bs as OPERATOR_ABI_CREATE3, bt as OPERATOR_ABI_V3, bu as PAYMENT_INFO_TYPEHASH, P as ParsedFacilitatorErrorBody, v as PaymentAcceptance, w as PaymentConflictResponse, x as PaymentMiddlewareOptions, y as PaymentPayloadV2, bv as PaymentRequirementResolver, bw as PaymentRequirements, bx as PaymentRequirementsOptions, z as PaymentRequirementsV2, by as PrepareRelayFeedbackRequest, bz as PrepareRelayFeedbackResponse, bA as PrepareRelayResponseRequest, bB as PrepareSolanaFeedbackRequest, bC as PrepareSolanaFeedbackResponse, bD as ProofOfPayment, R as RECEIPT_REQUEST_CONFLICT, bE as RELAYED_FEEDBACK_NETWORKS, C as REPLAYABLE_LEASE_REASONS, bF as RefundRequest, bG as RefundStatus, bH as RegisterAgentRequest, bI as RegisterAgentResponse, bJ as RegisterJobResponse, bK as RegisterJobStatus, bL as RegistrationPendingError, bM as RelayAuthorizationParams, bN as ReputationResponse, bO as ReputationSummary, bP as RequestRefundOptions, E as ResourceInfoV2, S as SETTLEMENT_UNCONFIRMED, bQ as SOLANA_FEEDBACK_NETWORKS, bR as SettleRequest, G as SettleRequestV2, J as SettleResponse, bS as SettleResponseWithProof, bT as SubmitRelayFeedbackRequest, bU as SubmitRelayResponseRequest, bV as SubmitSolanaFeedbackRequest, bW as TIER_FILTERS, bX as TIER_TIMINGS, bY as USDC_DOMAIN_NAME, bZ as UnavailableBody, b_ as UnavailableResponse, V as VerifiedPaymentState, b$ as VerifyRequest, K as VerifyRequestV2, N as VerifyResponse, W as WRITER_LEASE_REASONS, Q as WriterLeaseReason, X as X402_CORS_HEADERS, T as X402_HEADER_NAMES, c0 as ZERO_ADDRESS, c1 as buildErc8004PaymentRequirements, Z as buildPaymentConflictResponse, _ as buildPaymentRequirements, $ as buildSettleRequest, a0 as buildSettleRequestForVersion, a1 as buildSettleRequestV2, c2 as buildUnavailableResponse, a2 as buildVerifyRequest, a3 as buildVerifyRequestForVersion, a4 as buildVerifyRequestV2, c3 as canRefundEscrow, c4 as canReleaseEscrow, c5 as carryFailureFields, a5 as create402Response, a6 as createHonoMiddleware, a7 as createIdempotencyKey, a8 as createPaymentMiddleware, c6 as epochToDate, c7 as escrowTimeRemaining, a9 as extractPaymentFromHeaders, aa as facilitatorFetch, ab as getCorsHeaders, c8 as getEscrowContractsByChainId, c9 as getEscrowOperatorGeneration, ca as getEscrowSupportedChainIds, cb as isAlive, ac as isAmbiguousLeaseReason, ad as isAuthorizationAlreadyUsed, ae as isAuthorizationInFlight, cc as isEscrowExpired, cd as isEscrowSupportedOnChain, ce as isRegisterJobTerminal, af as isReplayableLeaseReason, ag as isSettlementUnconfirmed, ai as parseFacilitatorErrorBody, cf as parsePaymentHeader, aj as parseRetryAfterSeconds, ak as readFacilitatorError, al as resolveEnvelopeVersion, cg as supportsRelayedFeedback, ch as supportsSolanaFeedback, am as toPaymentRequirementsV2, an as toResourceInfoV2, ci as wireNetwork } from '../index-BiL4seGs.js';
@@ -1521,6 +1521,13 @@ var DEFAULT_MIN_FEE_BPS = 0;
1521
1521
  var DEFAULT_MAX_FEE_BPS = OPERATOR_FEE_BPS + MAX_PROTOCOL_FEE_BPS;
1522
1522
  var REVIEW_WINDOW_SEC = 7 * 24 * 3600;
1523
1523
  var REFUND_WINDOW_SEC = 7 * 24 * 3600;
1524
+ Object.fromEntries(
1525
+ ["arc", "arc-testnet"].map((network) => {
1526
+ const chain = getChainByName(network);
1527
+ if (!chain) throw new Error(`The chain registry has no '${network}'.`);
1528
+ return [chain.chainId, { name: chain.usdc.name, version: chain.usdc.version }];
1529
+ })
1530
+ );
1524
1531
  var LIFECYCLE_DOMAIN_NAME = "x402 escrow lifecycle";
1525
1532
  var LIFECYCLE_DOMAIN_VERSION = "1";
1526
1533
  var LIFECYCLE_MAX_DEADLINE_SECS = 900;
@@ -3679,7 +3686,7 @@ var TESTNET_VALIDATION = "0x8004Cb1BF31DAf7788923b405b754f57acEB4272";
3679
3686
  var SOLANA_AGENT_REGISTRY = "8oo4dC4JvBLwy5tGgiH3WwK4B9PWxL9Z4XjA2jzkQMbQ";
3680
3687
  var SOLANA_ATOM_ENGINE = "AToMw53aiPQ8j7iHVb4fGt6nzUNxUhcPc3tbPBZuzVVb";
3681
3688
  var ERC8004_CONTRACTS = {
3682
- // Mainnets (11)
3689
+ // Mainnets (12)
3683
3690
  ethereum: {
3684
3691
  identityRegistry: MAINNET_IDENTITY,
3685
3692
  reputationRegistry: MAINNET_REPUTATION,
@@ -3736,13 +3743,22 @@ var ERC8004_CONTRACTS = {
3736
3743
  identityRegistry: MAINNET_IDENTITY,
3737
3744
  reputationRegistry: MAINNET_REPUTATION
3738
3745
  },
3746
+ // Arc (Circle, chain 5042). The facilitator names these three in
3747
+ // ARC_MAINNET_CONTRACTS (x402-rs 2.37.0+). Read on 2026-09-23 against
3748
+ // rpc.mainnet.arc.io: each is a 130-byte EIP-1967 proxy whose implementation
3749
+ // is the one Base runs, and getVersion() answers 2.0.0.
3750
+ arc: {
3751
+ identityRegistry: MAINNET_IDENTITY,
3752
+ reputationRegistry: MAINNET_REPUTATION,
3753
+ validationRegistry: MAINNET_VALIDATION
3754
+ },
3739
3755
  // Deprecated alias for 'base' -- kept so existing lookups keep resolving.
3740
3756
  "base-mainnet": {
3741
3757
  identityRegistry: MAINNET_IDENTITY,
3742
3758
  reputationRegistry: MAINNET_REPUTATION,
3743
3759
  validationRegistry: MAINNET_VALIDATION
3744
3760
  },
3745
- // Testnets (8)
3761
+ // Testnets (9)
3746
3762
  "ethereum-sepolia": {
3747
3763
  identityRegistry: TESTNET_IDENTITY,
3748
3764
  reputationRegistry: TESTNET_REPUTATION,
@@ -3783,6 +3799,15 @@ var ERC8004_CONTRACTS = {
3783
3799
  reputationRegistry: TESTNET_REPUTATION,
3784
3800
  validationRegistry: TESTNET_VALIDATION
3785
3801
  },
3802
+ // Arc testnet (chain 5042002), ARC_TESTNET_CONTRACTS in the facilitator. Read
3803
+ // on 2026-09-23 against rpc.testnet.arc.io and rpc.testnet.arc.network: the
3804
+ // proxies Base Sepolia runs, validation registry included. Reads only -- no
3805
+ // FeedbackDelegate is deployed here, so it is not in RELAYED_FEEDBACK_NETWORKS.
3806
+ "arc-testnet": {
3807
+ identityRegistry: TESTNET_IDENTITY,
3808
+ reputationRegistry: TESTNET_REPUTATION,
3809
+ validationRegistry: TESTNET_VALIDATION
3810
+ },
3786
3811
  // Solana (2) - uses QuantuLabs 8004-solana Anchor program + ATOM Engine
3787
3812
  solana: {
3788
3813
  agentRegistryProgram: SOLANA_AGENT_REGISTRY,
@@ -3805,6 +3830,7 @@ var RELAYED_FEEDBACK_NETWORKS = [
3805
3830
  "celo",
3806
3831
  "bsc",
3807
3832
  "monad",
3833
+ "arc",
3808
3834
  "base-sepolia"
3809
3835
  ];
3810
3836
  function supportsRelayedFeedback(network) {
@@ -4923,6 +4949,11 @@ var ESCROW_TIMEOUT_MS = {
4923
4949
  // Monad: 90s
4924
4950
  };
4925
4951
  var DEFAULT_ESCROW_TIMEOUT_MS = 3e4;
4952
+ function arcUsdc(network) {
4953
+ const chain = getChainByName(network);
4954
+ if (!chain) throw new Error(`The chain registry has no '${network}'.`);
4955
+ return chain.usdc;
4956
+ }
4926
4957
  var USDC_DOMAIN_NAME = {
4927
4958
  8453: "USD Coin",
4928
4959
  // Base Mainnet
@@ -4940,8 +4971,12 @@ var USDC_DOMAIN_NAME = {
4940
4971
  // Avalanche
4941
4972
  42220: "USDC",
4942
4973
  // Celo
4943
- 143: "USDC"
4974
+ 143: "USDC",
4944
4975
  // Monad
4976
+ 5042: arcUsdc("arc").name,
4977
+ // Arc ('USDC', from src/chains)
4978
+ 5042002: arcUsdc("arc-testnet").name
4979
+ // Arc Testnet ('USDC', from src/chains)
4945
4980
  };
4946
4981
  var ESCROW_CONTRACTS = {
4947
4982
  // Base Sepolia (testnet, chain 84532)
@@ -5042,6 +5077,24 @@ var ESCROW_CONTRACTS = {
5042
5077
  protocolFeeConfig: "0xf62788834C99B2E85a6891C0b46D1EB996f8f596",
5043
5078
  refundRequest: "0x69e9BF2b40Ed472b55E47e9D4205d93Ed673093F",
5044
5079
  usdc: "0x85889c8c714505E0c94b30fcfcF64fE3Ac8FCb20"
5080
+ },
5081
+ // Arc (chain 5042) - x402r canonical escrow, 'v3' operator
5082
+ 5042: {
5083
+ operator: "0x0258472A1410Ac3Ad720f1BC83f22B3c0af1Fd9D",
5084
+ escrow: "0xBdEA0D1bcC5966192B070Fdf62aB4EF5b4420cff",
5085
+ tokenCollector: "0x0E3dF9510de65469C4518D7843919c0b8C7A7757",
5086
+ protocolFeeConfig: "0xBe2d24614F339a1eB103A399F93AA2a39Ca815Bc",
5087
+ refundRequest: "0xe971C674fD5c3462023f3F891dF6289DFbC9CEFC",
5088
+ usdc: arcUsdc("arc").address
5089
+ },
5090
+ // Arc Testnet (chain 5042002) - same canonical addresses as Arc
5091
+ 5042002: {
5092
+ operator: "0x0258472A1410Ac3Ad720f1BC83f22B3c0af1Fd9D",
5093
+ escrow: "0xBdEA0D1bcC5966192B070Fdf62aB4EF5b4420cff",
5094
+ tokenCollector: "0x0E3dF9510de65469C4518D7843919c0b8C7A7757",
5095
+ protocolFeeConfig: "0xBe2d24614F339a1eB103A399F93AA2a39Ca815Bc",
5096
+ refundRequest: "0xe971C674fD5c3462023f3F891dF6289DFbC9CEFC",
5097
+ usdc: arcUsdc("arc-testnet").address
5045
5098
  }
5046
5099
  };
5047
5100
  var BASE_MAINNET_CONTRACTS = ESCROW_CONTRACTS[8453];
@@ -5091,7 +5144,56 @@ var OPERATOR_ABI_CREATE3 = [
5091
5144
  "function charge(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, address tokenCollector, bytes collectorData)",
5092
5145
  "function refundPostEscrow(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, address tokenCollector, bytes collectorData)"
5093
5146
  ];
5094
- var CREATE3_CHAIN_IDS = /* @__PURE__ */ new Set([1187947933]);
5147
+ var OPERATOR_ABI_V3 = [
5148
+ "function capture(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, bytes data)",
5149
+ "function void(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, bytes data)",
5150
+ "function refund(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, address tokenCollector, bytes collectorData)",
5151
+ "function FEE_RECEIVER() view returns (address)",
5152
+ "function AUTHORIZE_PRE_ACTION_CONDITION() view returns (address)",
5153
+ "function CHARGE_PRE_ACTION_CONDITION() view returns (address)",
5154
+ "function CAPTURE_PRE_ACTION_CONDITION() view returns (address)",
5155
+ "function VOID_PRE_ACTION_CONDITION() view returns (address)",
5156
+ "function REFUND_PRE_ACTION_CONDITION() view returns (address)"
5157
+ ];
5158
+ var AUTH_CAPTURE_ESCROW_STATE_ABI = [
5159
+ "function getHash(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) view returns (bytes32)",
5160
+ "function paymentState(bytes32 paymentInfoHash) view returns (bool hasCollectedPayment, uint120 capturableAmount, uint120 refundableAmount)"
5161
+ ];
5162
+ var ESCROW_VOID_AMOUNT_MISMATCH = "escrow_void_amount_mismatch";
5163
+ var ESCROW_NOTHING_TO_VOID = "escrow_nothing_to_void";
5164
+ var ESCROW_OPERATOR_NOT_DEPLOYED = "escrow_operator_not_deployed";
5165
+ var ESCROW_UNSUPPORTED_ON_GENERATION = "escrow_unsupported_on_generation";
5166
+ var ESCROW_OPERATOR_GENERATION = {
5167
+ 84532: "v1",
5168
+ // Base Sepolia
5169
+ 8453: "v1",
5170
+ // Base
5171
+ 11155111: "v1",
5172
+ // Ethereum Sepolia
5173
+ 1: "v1",
5174
+ // Ethereum
5175
+ 137: "v1",
5176
+ // Polygon
5177
+ 42161: "v1",
5178
+ // Arbitrum
5179
+ 42220: "v1",
5180
+ // Celo
5181
+ 143: "v1",
5182
+ // Monad
5183
+ 43114: "v1",
5184
+ // Avalanche
5185
+ 10: "v1",
5186
+ // Optimism
5187
+ 1187947933: "v2",
5188
+ // SKALE Base
5189
+ 5042: "v3",
5190
+ // Arc
5191
+ 5042002: "v3"
5192
+ // Arc Testnet
5193
+ };
5194
+ function getEscrowOperatorGeneration(chainId) {
5195
+ return ESCROW_OPERATOR_GENERATION[chainId] ?? "v1";
5196
+ }
5095
5197
  var AdvancedEscrowClient = class {
5096
5198
  facilitatorUrl;
5097
5199
  chainId;
@@ -5397,6 +5499,10 @@ var AdvancedEscrowClient = class {
5397
5499
  *
5398
5500
  * Calls PaymentOperator.release() -> escrow.capture()
5399
5501
  *
5502
+ * On a `'v3'` operator (Arc, Arc Testnet) it calls
5503
+ * `PaymentOperator.capture(paymentInfo, amount, 0x)` instead, after checking
5504
+ * that the operator has code ({@link ESCROW_OPERATOR_NOT_DEPLOYED}).
5505
+ *
5400
5506
  * @param paymentInfo - PaymentInfo from the authorize step
5401
5507
  * @param amount - Amount to release (defaults to maxAmount)
5402
5508
  */
@@ -5404,10 +5510,14 @@ var AdvancedEscrowClient = class {
5404
5510
  if (!this.payerAddress) await this.init();
5405
5511
  try {
5406
5512
  const { ethers: ethers4 } = await import('ethers');
5407
- const isCreate3 = CREATE3_CHAIN_IDS.has(this.chainId);
5513
+ const generation = getEscrowOperatorGeneration(this.chainId);
5514
+ const isCreate3 = generation === "v2";
5408
5515
  const abi = isCreate3 ? OPERATOR_ABI_CREATE3 : OPERATOR_ABI;
5409
5516
  const amt = amount || paymentInfo.maxAmount;
5410
5517
  const tuple = this.buildTuple(paymentInfo);
5518
+ if (generation === "v3") {
5519
+ return await this.sendV3OperatorCall(ethers4, this.v3Provider(ethers4), "capture", [tuple, amt, "0x"]);
5520
+ }
5411
5521
  if (this.walletAdapter) {
5412
5522
  return this.sendViaAdapter(ethers4, abi, (iface) => {
5413
5523
  return isCreate3 ? iface.encodeFunctionData("release", [tuple, amt, "0x"]) : iface.encodeFunctionData("release", [tuple, amt]);
@@ -5431,6 +5541,16 @@ var AdvancedEscrowClient = class {
5431
5541
  *
5432
5542
  * Calls PaymentOperator.refundInEscrow() -> escrow.partialVoid()
5433
5543
  *
5544
+ * On a `'v3'` operator (Arc, Arc Testnet) it calls
5545
+ * `PaymentOperator.void(paymentInfo, 0x)`, which takes no amount and returns
5546
+ * the WHOLE `capturableAmount`. So it first reads that amount on-chain
5547
+ * (`AuthCaptureEscrow.getHash` + `paymentState`) and sends only when
5548
+ * `amount` equals it. Otherwise nothing is sent and `errorCode` says why:
5549
+ * {@link ESCROW_NOTHING_TO_VOID} when it is 0,
5550
+ * {@link ESCROW_VOID_AMOUNT_MISMATCH} for any other amount. To return part
5551
+ * of an escrow on v3, `release` the part the receiver keeps, then
5552
+ * `refundInEscrow` what is left.
5553
+ *
5434
5554
  * @param paymentInfo - PaymentInfo from the authorize step
5435
5555
  * @param amount - Amount to refund (defaults to maxAmount)
5436
5556
  */
@@ -5438,10 +5558,14 @@ var AdvancedEscrowClient = class {
5438
5558
  if (!this.payerAddress) await this.init();
5439
5559
  try {
5440
5560
  const { ethers: ethers4 } = await import('ethers');
5441
- const isCreate3 = CREATE3_CHAIN_IDS.has(this.chainId);
5561
+ const generation = getEscrowOperatorGeneration(this.chainId);
5562
+ const isCreate3 = generation === "v2";
5442
5563
  const abi = isCreate3 ? OPERATOR_ABI_CREATE3 : OPERATOR_ABI;
5443
5564
  const amt = amount || paymentInfo.maxAmount;
5444
5565
  const tuple = this.buildTuple(paymentInfo);
5566
+ if (generation === "v3") {
5567
+ return await this.voidWholeCapturable(ethers4, tuple, amt);
5568
+ }
5445
5569
  if (this.walletAdapter) {
5446
5570
  return this.sendViaAdapter(ethers4, abi, (iface) => {
5447
5571
  return isCreate3 ? iface.encodeFunctionData("refundInEscrow", [tuple, amt, "0x"]) : iface.encodeFunctionData("refundInEscrow", [tuple, amt]);
@@ -5776,10 +5900,15 @@ var AdvancedEscrowClient = class {
5776
5900
  * Calls PaymentOperator.charge() -> escrow.charge()
5777
5901
  * Funds go directly from payer to receiver.
5778
5902
  *
5903
+ * Not available on a `'v3'` operator (Arc, Arc Testnet): it returns
5904
+ * {@link ESCROW_UNSUPPORTED_ON_GENERATION} without signing or sending.
5905
+ *
5779
5906
  * @param paymentInfo - PaymentInfo with receiver and amount
5780
5907
  * @param amount - Amount to charge (defaults to maxAmount)
5781
5908
  */
5782
5909
  async charge(paymentInfo, amount) {
5910
+ const unsupported = this.unsupportedOnV3("charge");
5911
+ if (unsupported) return unsupported;
5783
5912
  if (!this.payerAddress) await this.init();
5784
5913
  try {
5785
5914
  const { ethers: ethers4 } = await import('ethers');
@@ -5840,6 +5969,11 @@ var AdvancedEscrowClient = class {
5840
5969
  *
5841
5970
  * Kept for future use when tokenCollector is implemented.
5842
5971
  *
5972
+ * On a `'v3'` operator (Arc, Arc Testnet) it calls
5973
+ * `PaymentOperator.refund(paymentInfo, amount, tokenCollector, collectorData)`
5974
+ * -> escrow.refund(), the same arguments, after checking that the operator
5975
+ * has code ({@link ESCROW_OPERATOR_NOT_DEPLOYED}).
5976
+ *
5843
5977
  * @param paymentInfo - PaymentInfo from the original authorization
5844
5978
  * @param amount - Amount to refund (defaults to maxAmount)
5845
5979
  * @param tokenCollector - Address of token collector for refund sourcing
@@ -5851,6 +5985,14 @@ var AdvancedEscrowClient = class {
5851
5985
  const { ethers: ethers4 } = await import('ethers');
5852
5986
  const amt = amount || paymentInfo.maxAmount;
5853
5987
  const tuple = this.buildTuple(paymentInfo);
5988
+ if (getEscrowOperatorGeneration(this.chainId) === "v3") {
5989
+ return await this.sendV3OperatorCall(ethers4, this.v3Provider(ethers4), "refund", [
5990
+ tuple,
5991
+ amt,
5992
+ tokenCollector || ZERO_ADDRESS,
5993
+ collectorData || "0x"
5994
+ ]);
5995
+ }
5854
5996
  if (this.walletAdapter) {
5855
5997
  return this.sendViaAdapter(ethers4, OPERATOR_ABI, (iface) => {
5856
5998
  return iface.encodeFunctionData("refundPostEscrow", [
@@ -5881,6 +6023,89 @@ var AdvancedEscrowClient = class {
5881
6023
  }
5882
6024
  }
5883
6025
  // ==========================================================================
6026
+ // INTERNAL: 'v3' operator (Arc, Arc Testnet)
6027
+ // ==========================================================================
6028
+ /** The refusal of a call a 'v3' operator does not have, or null elsewhere. */
6029
+ unsupportedOnV3(method) {
6030
+ if (getEscrowOperatorGeneration(this.chainId) !== "v3") return null;
6031
+ return {
6032
+ success: false,
6033
+ errorCode: ESCROW_UNSUPPORTED_ON_GENERATION,
6034
+ error: `${method} is not available on the v3 escrow operator of chain ${this.chainId} (OPERATOR_ABI_V3). Nothing was signed or sent.`
6035
+ };
6036
+ }
6037
+ /** The provider a 'v3' call reads with before it sends anything. */
6038
+ v3Provider(ethersModule) {
6039
+ const provider = this.walletAdapter ? new ethersModule.JsonRpcProvider(this.rpcUrl) : this.signer?.provider;
6040
+ if (!provider) {
6041
+ throw new Error(
6042
+ `AdvancedEscrowClient: chain ${this.chainId} uses a v3 escrow operator, which is read on-chain before any call; the signer has no provider to read with.`
6043
+ );
6044
+ }
6045
+ return provider;
6046
+ }
6047
+ /**
6048
+ * Send one OPERATOR_ABI_V3 call, once the operator is known to have code.
6049
+ * A call to an address with no code succeeds and moves nothing, and would be
6050
+ * reported as a success.
6051
+ */
6052
+ async sendV3OperatorCall(ethersModule, provider, method, args) {
6053
+ const code = await provider.getCode(this.contracts.operator);
6054
+ if (!code || code === "0x") {
6055
+ return {
6056
+ success: false,
6057
+ errorCode: ESCROW_OPERATOR_NOT_DEPLOYED,
6058
+ error: `The escrow operator ${this.contracts.operator} has no code on chain ${this.chainId}. Nothing was sent.`
6059
+ };
6060
+ }
6061
+ if (this.walletAdapter) {
6062
+ return await this.sendViaAdapter(
6063
+ ethersModule,
6064
+ OPERATOR_ABI_V3,
6065
+ (iface) => iface.encodeFunctionData(method, args)
6066
+ );
6067
+ }
6068
+ const contract = new ethersModule.Contract(this.contracts.operator, OPERATOR_ABI_V3, this.signer);
6069
+ const tx = await contract.getFunction(method)(...args, { gasLimit: this.gasLimit });
6070
+ const receipt = await tx.wait();
6071
+ return {
6072
+ success: receipt.status === 1,
6073
+ transactionHash: receipt.hash,
6074
+ gasUsed: Number(receipt.gasUsed),
6075
+ error: receipt.status !== 1 ? "Transaction reverted" : void 0
6076
+ };
6077
+ }
6078
+ /**
6079
+ * `refundInEscrow` on a 'v3' operator: `void` returns the whole capturable
6080
+ * amount, so it is sent only when that is exactly what was asked for.
6081
+ */
6082
+ async voidWholeCapturable(ethersModule, tuple, amount) {
6083
+ const requested = BigInt(amount);
6084
+ if (requested <= 0n) {
6085
+ return { success: false, error: `refundInEscrow amount must be positive, got ${amount}. Nothing was sent.` };
6086
+ }
6087
+ const provider = this.v3Provider(ethersModule);
6088
+ const escrow = new ethersModule.Contract(this.contracts.escrow, AUTH_CAPTURE_ESCROW_STATE_ABI, provider);
6089
+ const paymentInfoHash = await escrow.getHash(tuple);
6090
+ const [, capturable] = await escrow.paymentState(paymentInfoHash);
6091
+ const capturableAmount = BigInt(capturable);
6092
+ if (capturableAmount === 0n) {
6093
+ return {
6094
+ success: false,
6095
+ errorCode: ESCROW_NOTHING_TO_VOID,
6096
+ error: `Nothing to void on chain ${this.chainId}: capturableAmount is 0 for payment ${paymentInfoHash}. Nothing was sent.`
6097
+ };
6098
+ }
6099
+ if (requested !== capturableAmount) {
6100
+ return {
6101
+ success: false,
6102
+ errorCode: ESCROW_VOID_AMOUNT_MISMATCH,
6103
+ error: `refundInEscrow asked for ${requested} but the v3 operator's void() returns the whole capturableAmount, ${capturableAmount}. Pass ${capturableAmount}, or release the part the receiver keeps first. Nothing was sent.`
6104
+ };
6105
+ }
6106
+ return await this.sendV3OperatorCall(ethersModule, provider, "void", [tuple, "0x"]);
6107
+ }
6108
+ // ==========================================================================
5884
6109
  // INTERNAL: Adapter-based transaction signing and broadcast
5885
6110
  // ==========================================================================
5886
6111
  /**
@@ -5936,7 +6161,12 @@ exports.DEPOSIT_LIMIT_USDC = DEPOSIT_LIMIT_USDC;
5936
6161
  exports.ERC8004_CONTRACTS = ERC8004_CONTRACTS;
5937
6162
  exports.ERC8004_EXTENSION_ID = ERC8004_EXTENSION_ID;
5938
6163
  exports.ESCROW_CONTRACTS = ESCROW_CONTRACTS;
6164
+ exports.ESCROW_NOTHING_TO_VOID = ESCROW_NOTHING_TO_VOID;
6165
+ exports.ESCROW_OPERATOR_GENERATION = ESCROW_OPERATOR_GENERATION;
6166
+ exports.ESCROW_OPERATOR_NOT_DEPLOYED = ESCROW_OPERATOR_NOT_DEPLOYED;
5939
6167
  exports.ESCROW_TIMEOUT_MS = ESCROW_TIMEOUT_MS;
6168
+ exports.ESCROW_UNSUPPORTED_ON_GENERATION = ESCROW_UNSUPPORTED_ON_GENERATION;
6169
+ exports.ESCROW_VOID_AMOUNT_MISMATCH = ESCROW_VOID_AMOUNT_MISMATCH;
5940
6170
  exports.Erc8004Client = Erc8004Client;
5941
6171
  exports.Erc8004LookupError = Erc8004LookupError;
5942
6172
  exports.EscrowClient = EscrowClient;
@@ -5948,6 +6178,7 @@ exports.MAX_RETRY_AFTER_SECONDS = MAX_RETRY_AFTER_SECONDS;
5948
6178
  exports.MAX_SEARCH_LEN = MAX_SEARCH_LEN;
5949
6179
  exports.OPERATOR_ABI = OPERATOR_ABI;
5950
6180
  exports.OPERATOR_ABI_CREATE3 = OPERATOR_ABI_CREATE3;
6181
+ exports.OPERATOR_ABI_V3 = OPERATOR_ABI_V3;
5951
6182
  exports.PAYMENT_INFO_TYPEHASH = PAYMENT_INFO_TYPEHASH;
5952
6183
  exports.RECEIPT_ISSUER = RECEIPT_ISSUER;
5953
6184
  exports.RECEIPT_REQUEST_CONFLICT = RECEIPT_REQUEST_CONFLICT;
@@ -5989,6 +6220,7 @@ exports.facilitatorFetch = facilitatorFetch;
5989
6220
  exports.fetchWithReceipt = fetchWithReceipt;
5990
6221
  exports.getCorsHeaders = getCorsHeaders;
5991
6222
  exports.getEscrowContractsByChainId = getEscrowContractsByChainId;
6223
+ exports.getEscrowOperatorGeneration = getEscrowOperatorGeneration;
5992
6224
  exports.getEscrowSupportedChainIds = getEscrowSupportedChainIds;
5993
6225
  exports.getFacilitatorReceipt = getFacilitatorReceipt;
5994
6226
  exports.isAlive = isAlive;