uvd-x402-sdk 2.98.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 +1 -1
- package/dist/backend/index.d.mts +1 -1
- package/dist/backend/index.d.ts +1 -1
- package/dist/backend/index.js +217 -4
- package/dist/backend/index.js.map +1 -1
- package/dist/backend/index.mjs +211 -5
- package/dist/backend/index.mjs.map +1 -1
- package/dist/{index-BUlo1dYN.d.ts → index-BiL4seGs.d.ts} +112 -3
- package/dist/{index-Dy7eJ6hX.d.mts → index-SaqboHsK.d.mts} +112 -3
- package/dist/index.d.mts +28 -6
- package/dist/index.d.ts +28 -6
- package/dist/index.js +38 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +38 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/backend/index.ts +306 -6
- package/src/escrow-preauth.arc-vector.json +101 -0
- package/src/escrow-preauth.ts +45 -4
- package/src/fixtures/arc-escrow-d.rpc.json +553 -0
- package/src/fixtures/escrow-operator-snapshot.json +1254 -0
- package/src/index.ts +1 -0
|
@@ -3733,6 +3733,13 @@ declare const USDC_DOMAIN_NAME: Record<number, string>;
|
|
|
3733
3733
|
* resolve the real operator from the marketplace's own escrow config
|
|
3734
3734
|
* ({@link EscrowNetworkConfig}) and pass it via `options.contracts`.
|
|
3735
3735
|
* See {@link OPERATOR_FEE_BPS} for the commands.
|
|
3736
|
+
*
|
|
3737
|
+
* Arc (5042) and Arc Testnet (5042002) use the x402r canonical escrow
|
|
3738
|
+
* (AuthCaptureEscrow `0xBdEA0D1b…`, PaymentOperatorFactory v1.0.2
|
|
3739
|
+
* `0xc24153B7…`). Their `operator` is a PaymentOperator address: the one the
|
|
3740
|
+
* factory's `computeAddress` returns, recorded on both chains in
|
|
3741
|
+
* `src/fixtures/arc-escrow-d.rpc.json`. Their operator generation is `'v3'`
|
|
3742
|
+
* ({@link OPERATOR_ABI_V3}).
|
|
3736
3743
|
*/
|
|
3737
3744
|
declare const ESCROW_CONTRACTS: Record<number, AdvancedEscrowContracts>;
|
|
3738
3745
|
/**
|
|
@@ -3914,7 +3921,8 @@ interface AdvancedEscrowClientOptions {
|
|
|
3914
3921
|
* Chain ID (default: 8453 for Base Mainnet).
|
|
3915
3922
|
* Supported chains: 8453 (Base), 84532 (Base Sepolia), 1 (Ethereum),
|
|
3916
3923
|
* 11155111 (Ethereum Sepolia), 137 (Polygon), 42161 (Arbitrum),
|
|
3917
|
-
* 10 (Optimism), 42220 (Celo), 143 (Monad), 43114 (Avalanche)
|
|
3924
|
+
* 10 (Optimism), 42220 (Celo), 143 (Monad), 43114 (Avalanche),
|
|
3925
|
+
* 1187947933 (SKALE Base), 5042 (Arc), 5042002 (Arc Testnet).
|
|
3918
3926
|
*/
|
|
3919
3927
|
chainId?: number;
|
|
3920
3928
|
/** Contract addresses (auto-resolved from chainId if not provided) */
|
|
@@ -3965,13 +3973,77 @@ declare const OPERATOR_ABI: string[];
|
|
|
3965
3973
|
* on release() and refundInEscrow(). Pass empty bytes (0x) for the data parameter.
|
|
3966
3974
|
*/
|
|
3967
3975
|
declare const OPERATOR_ABI_CREATE3: string[];
|
|
3976
|
+
/**
|
|
3977
|
+
* PaymentOperator of the x402r canonical PaymentOperatorFactory v1.0.2
|
|
3978
|
+
* (`0xc24153B7ED8DC03e551F29DDEeA5CadFe57e2716`), the operator generation of
|
|
3979
|
+
* Arc and Arc Testnet. Source: BackTrackCo/x402r-contracts
|
|
3980
|
+
* `src/operator/payment/PaymentOperator.sol` @ 8345776e.
|
|
3981
|
+
*
|
|
3982
|
+
* It has no `release` and no `refundInEscrow`:
|
|
3983
|
+
* - `capture(paymentInfo, amount, data)` pays the receiver;
|
|
3984
|
+
* - `void(paymentInfo, data)` takes NO amount: it returns the whole
|
|
3985
|
+
* `capturableAmount` to the payer;
|
|
3986
|
+
* - `refund(...)` returns funds after a capture;
|
|
3987
|
+
* - the owner is `FEE_RECEIVER()`.
|
|
3988
|
+
*
|
|
3989
|
+
* Every selector here is checked against the factory bytecode recorded on
|
|
3990
|
+
* Arc (`src/fixtures/arc-escrow-d.rpc.json`): `capture` 0xf12b86f6, `void`
|
|
3991
|
+
* 0xc3c5090e, `FEE_RECEIVER` 0xd3e78e4d.
|
|
3992
|
+
*/
|
|
3993
|
+
declare const OPERATOR_ABI_V3: string[];
|
|
3994
|
+
/**
|
|
3995
|
+
* `refundInEscrow` on a v3 operator was given an amount other than the whole
|
|
3996
|
+
* `capturableAmount`. `void` takes no amount, so sending it would return more
|
|
3997
|
+
* than was asked. Nothing was sent. `errorCode` of the result.
|
|
3998
|
+
*/
|
|
3999
|
+
declare const ESCROW_VOID_AMOUNT_MISMATCH = "escrow_void_amount_mismatch";
|
|
4000
|
+
/**
|
|
4001
|
+
* `refundInEscrow` on a v3 operator found `capturableAmount` = 0: nothing is
|
|
4002
|
+
* left to return. Nothing was sent. `errorCode` of the result.
|
|
4003
|
+
*/
|
|
4004
|
+
declare const ESCROW_NOTHING_TO_VOID = "escrow_nothing_to_void";
|
|
4005
|
+
/**
|
|
4006
|
+
* The v3 operator has no code on the chain. A call to it would succeed and
|
|
4007
|
+
* move nothing, so the SDK does not send one. `errorCode` of the result.
|
|
4008
|
+
*/
|
|
4009
|
+
declare const ESCROW_OPERATOR_NOT_DEPLOYED = "escrow_operator_not_deployed";
|
|
4010
|
+
/**
|
|
4011
|
+
* The call has no counterpart on the chain's operator generation (`charge` on
|
|
4012
|
+
* a v3 operator). Nothing was signed or sent. `errorCode` of the result.
|
|
4013
|
+
*/
|
|
4014
|
+
declare const ESCROW_UNSUPPORTED_ON_GENERATION = "escrow_unsupported_on_generation";
|
|
4015
|
+
/**
|
|
4016
|
+
* Which PaymentOperator ABI a chain's escrow operator speaks.
|
|
4017
|
+
*
|
|
4018
|
+
* - `'v1'`: {@link OPERATOR_ABI} — `release(PaymentInfo, amount)` and
|
|
4019
|
+
* `refundInEscrow(PaymentInfo, amount)`.
|
|
4020
|
+
* - `'v2'`: {@link OPERATOR_ABI_CREATE3} — the same two with a trailing
|
|
4021
|
+
* `bytes data`.
|
|
4022
|
+
* - `'v3'`: {@link OPERATOR_ABI_V3} — `capture(PaymentInfo, amount, data)` and
|
|
4023
|
+
* `void(PaymentInfo, data)`.
|
|
4024
|
+
*/
|
|
4025
|
+
type EscrowOperatorGeneration = 'v1' | 'v2' | 'v3';
|
|
4026
|
+
/**
|
|
4027
|
+
* Operator generation per chain — the single source the escrow client reads
|
|
4028
|
+
* to pick the operator ABI. A chain absent from this table is `'v1'`, which is
|
|
4029
|
+
* what a custom `options.contracts` on an unlisted chain has always used.
|
|
4030
|
+
*/
|
|
4031
|
+
declare const ESCROW_OPERATOR_GENERATION: Record<number, EscrowOperatorGeneration>;
|
|
4032
|
+
/** Operator generation of a chain; `'v1'` when the chain is not listed. */
|
|
4033
|
+
declare function getEscrowOperatorGeneration(chainId: number): EscrowOperatorGeneration;
|
|
3968
4034
|
/**
|
|
3969
4035
|
* AdvancedEscrowClient provides the 5 Advanced Escrow flows via the
|
|
3970
4036
|
* PaymentOperator contract on 9 supported EVM networks.
|
|
3971
4037
|
*
|
|
3972
4038
|
* Supported chains: Base (8453), Base Sepolia (84532), Ethereum (1),
|
|
3973
4039
|
* Ethereum Sepolia (11155111), Polygon (137), Arbitrum (42161),
|
|
3974
|
-
* Optimism (10), Celo (42220), Monad (143), Avalanche (43114)
|
|
4040
|
+
* Optimism (10), Celo (42220), Monad (143), Avalanche (43114),
|
|
4041
|
+
* SKALE Base (1187947933), Arc (5042), Arc Testnet (5042002).
|
|
4042
|
+
*
|
|
4043
|
+
* The operator ABI follows the chain's {@link ESCROW_OPERATOR_GENERATION}.
|
|
4044
|
+
* On Arc and Arc Testnet (`'v3'`) `release` sends `capture`, `refundInEscrow`
|
|
4045
|
+
* sends `void` (whole capturable amount only), `refundPostEscrow` sends
|
|
4046
|
+
* `refund`, and `charge` refuses without signing or sending.
|
|
3975
4047
|
*
|
|
3976
4048
|
* Contract addresses are auto-resolved from the chain ID.
|
|
3977
4049
|
* Pass custom contracts to override.
|
|
@@ -4097,6 +4169,10 @@ declare class AdvancedEscrowClient {
|
|
|
4097
4169
|
*
|
|
4098
4170
|
* Calls PaymentOperator.release() -> escrow.capture()
|
|
4099
4171
|
*
|
|
4172
|
+
* On a `'v3'` operator (Arc, Arc Testnet) it calls
|
|
4173
|
+
* `PaymentOperator.capture(paymentInfo, amount, 0x)` instead, after checking
|
|
4174
|
+
* that the operator has code ({@link ESCROW_OPERATOR_NOT_DEPLOYED}).
|
|
4175
|
+
*
|
|
4100
4176
|
* @param paymentInfo - PaymentInfo from the authorize step
|
|
4101
4177
|
* @param amount - Amount to release (defaults to maxAmount)
|
|
4102
4178
|
*/
|
|
@@ -4106,6 +4182,16 @@ declare class AdvancedEscrowClient {
|
|
|
4106
4182
|
*
|
|
4107
4183
|
* Calls PaymentOperator.refundInEscrow() -> escrow.partialVoid()
|
|
4108
4184
|
*
|
|
4185
|
+
* On a `'v3'` operator (Arc, Arc Testnet) it calls
|
|
4186
|
+
* `PaymentOperator.void(paymentInfo, 0x)`, which takes no amount and returns
|
|
4187
|
+
* the WHOLE `capturableAmount`. So it first reads that amount on-chain
|
|
4188
|
+
* (`AuthCaptureEscrow.getHash` + `paymentState`) and sends only when
|
|
4189
|
+
* `amount` equals it. Otherwise nothing is sent and `errorCode` says why:
|
|
4190
|
+
* {@link ESCROW_NOTHING_TO_VOID} when it is 0,
|
|
4191
|
+
* {@link ESCROW_VOID_AMOUNT_MISMATCH} for any other amount. To return part
|
|
4192
|
+
* of an escrow on v3, `release` the part the receiver keeps, then
|
|
4193
|
+
* `refundInEscrow` what is left.
|
|
4194
|
+
*
|
|
4109
4195
|
* @param paymentInfo - PaymentInfo from the authorize step
|
|
4110
4196
|
* @param amount - Amount to refund (defaults to maxAmount)
|
|
4111
4197
|
*/
|
|
@@ -4223,6 +4309,9 @@ declare class AdvancedEscrowClient {
|
|
|
4223
4309
|
* Calls PaymentOperator.charge() -> escrow.charge()
|
|
4224
4310
|
* Funds go directly from payer to receiver.
|
|
4225
4311
|
*
|
|
4312
|
+
* Not available on a `'v3'` operator (Arc, Arc Testnet): it returns
|
|
4313
|
+
* {@link ESCROW_UNSUPPORTED_ON_GENERATION} without signing or sending.
|
|
4314
|
+
*
|
|
4226
4315
|
* @param paymentInfo - PaymentInfo with receiver and amount
|
|
4227
4316
|
* @param amount - Amount to charge (defaults to maxAmount)
|
|
4228
4317
|
*/
|
|
@@ -4242,12 +4331,32 @@ declare class AdvancedEscrowClient {
|
|
|
4242
4331
|
*
|
|
4243
4332
|
* Kept for future use when tokenCollector is implemented.
|
|
4244
4333
|
*
|
|
4334
|
+
* On a `'v3'` operator (Arc, Arc Testnet) it calls
|
|
4335
|
+
* `PaymentOperator.refund(paymentInfo, amount, tokenCollector, collectorData)`
|
|
4336
|
+
* -> escrow.refund(), the same arguments, after checking that the operator
|
|
4337
|
+
* has code ({@link ESCROW_OPERATOR_NOT_DEPLOYED}).
|
|
4338
|
+
*
|
|
4245
4339
|
* @param paymentInfo - PaymentInfo from the original authorization
|
|
4246
4340
|
* @param amount - Amount to refund (defaults to maxAmount)
|
|
4247
4341
|
* @param tokenCollector - Address of token collector for refund sourcing
|
|
4248
4342
|
* @param collectorData - Data for the token collector
|
|
4249
4343
|
*/
|
|
4250
4344
|
refundPostEscrow(paymentInfo: AdvancedPaymentInfo, amount?: string, tokenCollector?: string, collectorData?: string): Promise<AdvancedTransactionResult>;
|
|
4345
|
+
/** The refusal of a call a 'v3' operator does not have, or null elsewhere. */
|
|
4346
|
+
private unsupportedOnV3;
|
|
4347
|
+
/** The provider a 'v3' call reads with before it sends anything. */
|
|
4348
|
+
private v3Provider;
|
|
4349
|
+
/**
|
|
4350
|
+
* Send one OPERATOR_ABI_V3 call, once the operator is known to have code.
|
|
4351
|
+
* A call to an address with no code succeeds and moves nothing, and would be
|
|
4352
|
+
* reported as a success.
|
|
4353
|
+
*/
|
|
4354
|
+
private sendV3OperatorCall;
|
|
4355
|
+
/**
|
|
4356
|
+
* `refundInEscrow` on a 'v3' operator: `void` returns the whole capturable
|
|
4357
|
+
* amount, so it is sent only when that is exactly what was asked for.
|
|
4358
|
+
*/
|
|
4359
|
+
private voidWholeCapturable;
|
|
4251
4360
|
/**
|
|
4252
4361
|
* Build an unsigned transaction, sign via SigningWalletAdapter, and broadcast.
|
|
4253
4362
|
*
|
|
@@ -4263,4 +4372,4 @@ declare class AdvancedEscrowClient {
|
|
|
4263
4372
|
private sendViaAdapter;
|
|
4264
4373
|
}
|
|
4265
4374
|
|
|
4266
|
-
export { buildSettleRequest as $, AMBIGUOUS_LEASE_REASONS as A, type BuildLifecycleAuthParams as B, REPLAYABLE_LEASE_REASONS as C, DEFAULT_FACILITATOR_RETRIES as D, type ResourceInfoV2 as E, type FacilitatorCallOptions as F, type SettleRequestV2 as G, type HonoMiddlewareOptions as H, IDEMPOTENCY_KEY_HEADER as I, type SettleResponse as J, type VerifyRequestV2 as K, LIFECYCLE_ACTIONS as L, MAX_RETRY_AFTER_SECONDS as M, type VerifyResponse as N, type WagmiLifecycleWalletClient as O, type ParsedFacilitatorErrorBody as P, type WriterLeaseReason as Q, RECEIPT_REQUEST_CONFLICT as R, SETTLEMENT_UNCONFIRMED as S, X402_HEADER_NAMES as T, buildLifecycleAuth as U, type VerifiedPaymentState as V, WRITER_LEASE_REASONS as W, X402_CORS_HEADERS as X, buildLifecycleTypedData as Y, buildPaymentConflictResponse as Z, buildPaymentRequirements as _, AUTHORIZATION_ALREADY_SETTLED as a, ESCROW_CONTRACTS as a$, buildSettleRequestForVersion as a0, buildSettleRequestV2 as a1, buildVerifyRequest as a2, buildVerifyRequestForVersion as a3, buildVerifyRequestV2 as a4, create402Response as a5, createHonoMiddleware as a6, createIdempotencyKey as a7, createPaymentMiddleware as a8, extractPaymentFromHeaders as a9, type AgentService as aA, type AtomStats as aB, BASE_MAINNET_CONTRACTS as aC, BazaarClient as aD, type BazaarClientOptions as aE, type BazaarDiscoverOptions as aF, type BazaarDiscoverResponse as aG, type BazaarRegisterOptions as aH, type BazaarResource as aI, type CreateEscrowOptions as aJ, DEPOSIT_LIMIT_USDC as aK, type DiscoveryAccepts as aL, type DiscoveryCuration as aM, type DiscoveryHealth as aN, type DiscoveryHealthStatus as aO, type DiscoveryListOptions as aP, type DiscoveryPagination as aQ, type DiscoveryRegisterOptions as aR, type DiscoveryResource as aS, type DiscoveryResponse as aT, type DiscoverySource as aU, type DiscoveryStats as aV, type DiscoveryTier as aW, type Dispute as aX, type DisputeOutcome as aY, ERC8004_CONTRACTS as aZ, ERC8004_EXTENSION_ID as a_, facilitatorFetch as aa, getCorsHeaders as ab, isAmbiguousLeaseReason as ac, isAuthorizationAlreadyUsed as ad, isAuthorizationInFlight as ae, isReplayableLeaseReason as af, isSettlementUnconfirmed as ag, lifecycleAuthFromSignature as ah, parseFacilitatorErrorBody as ai, parseRetryAfterSeconds as aj, readFacilitatorError as ak, resolveEnvelopeVersion as al, toPaymentRequirementsV2 as am, toResourceInfoV2 as an, wagmiLifecycleSigner as ao, type AdvancedAuthorizationResult as ap, AdvancedEscrowClient as aq, type AdvancedEscrowClientOptions as ar, type AdvancedEscrowContracts as as, type AdvancedEscrowTaskTier as at, type AdvancedPaymentInfo as au, type AdvancedTransactionResult as av, type AgentId as aw, type AgentIdentity as ax, type AgentRegistration as ay, type AgentRegistrationFile as az, AUTHORIZATION_IN_FLIGHT as b,
|
|
4375
|
+
export { buildSettleRequest as $, AMBIGUOUS_LEASE_REASONS as A, type BuildLifecycleAuthParams as B, REPLAYABLE_LEASE_REASONS as C, DEFAULT_FACILITATOR_RETRIES as D, type ResourceInfoV2 as E, type FacilitatorCallOptions as F, type SettleRequestV2 as G, type HonoMiddlewareOptions as H, IDEMPOTENCY_KEY_HEADER as I, type SettleResponse as J, type VerifyRequestV2 as K, LIFECYCLE_ACTIONS as L, MAX_RETRY_AFTER_SECONDS as M, type VerifyResponse as N, type WagmiLifecycleWalletClient as O, type ParsedFacilitatorErrorBody as P, type WriterLeaseReason as Q, RECEIPT_REQUEST_CONFLICT as R, SETTLEMENT_UNCONFIRMED as S, X402_HEADER_NAMES as T, buildLifecycleAuth as U, type VerifiedPaymentState as V, WRITER_LEASE_REASONS as W, X402_CORS_HEADERS as X, buildLifecycleTypedData as Y, buildPaymentConflictResponse as Z, buildPaymentRequirements as _, AUTHORIZATION_ALREADY_SETTLED as a, ESCROW_CONTRACTS as a$, buildSettleRequestForVersion as a0, buildSettleRequestV2 as a1, buildVerifyRequest as a2, buildVerifyRequestForVersion as a3, buildVerifyRequestV2 as a4, create402Response as a5, createHonoMiddleware as a6, createIdempotencyKey as a7, createPaymentMiddleware as a8, extractPaymentFromHeaders as a9, type AgentService as aA, type AtomStats as aB, BASE_MAINNET_CONTRACTS as aC, BazaarClient as aD, type BazaarClientOptions as aE, type BazaarDiscoverOptions as aF, type BazaarDiscoverResponse as aG, type BazaarRegisterOptions as aH, type BazaarResource as aI, type CreateEscrowOptions as aJ, DEPOSIT_LIMIT_USDC as aK, type DiscoveryAccepts as aL, type DiscoveryCuration as aM, type DiscoveryHealth as aN, type DiscoveryHealthStatus as aO, type DiscoveryListOptions as aP, type DiscoveryPagination as aQ, type DiscoveryRegisterOptions as aR, type DiscoveryResource as aS, type DiscoveryResponse as aT, type DiscoverySource as aU, type DiscoveryStats as aV, type DiscoveryTier as aW, type Dispute as aX, type DisputeOutcome as aY, ERC8004_CONTRACTS as aZ, ERC8004_EXTENSION_ID as a_, facilitatorFetch as aa, getCorsHeaders as ab, isAmbiguousLeaseReason as ac, isAuthorizationAlreadyUsed as ad, isAuthorizationInFlight as ae, isReplayableLeaseReason as af, isSettlementUnconfirmed as ag, lifecycleAuthFromSignature as ah, parseFacilitatorErrorBody as ai, parseRetryAfterSeconds as aj, readFacilitatorError as ak, resolveEnvelopeVersion as al, toPaymentRequirementsV2 as am, toResourceInfoV2 as an, wagmiLifecycleSigner as ao, type AdvancedAuthorizationResult as ap, AdvancedEscrowClient as aq, type AdvancedEscrowClientOptions as ar, type AdvancedEscrowContracts as as, type AdvancedEscrowTaskTier as at, type AdvancedPaymentInfo as au, type AdvancedTransactionResult as av, type AgentId as aw, type AgentIdentity as ax, type AgentRegistration as ay, type AgentRegistrationFile as az, AUTHORIZATION_IN_FLIGHT as b, type VerifyRequest as b$, ESCROW_NOTHING_TO_VOID as b0, ESCROW_OPERATOR_GENERATION as b1, ESCROW_OPERATOR_NOT_DEPLOYED as b2, ESCROW_TIMEOUT_MS as b3, ESCROW_UNSUPPORTED_ON_GENERATION as b4, ESCROW_VOID_AMOUNT_MISMATCH as b5, Erc8004Client as b6, type Erc8004ClientOptions as b7, Erc8004LookupError as b8, type Erc8004Network as b9, type PrepareRelayResponseRequest as bA, type PrepareSolanaFeedbackRequest as bB, type PrepareSolanaFeedbackResponse as bC, type ProofOfPayment as bD, RELAYED_FEEDBACK_NETWORKS as bE, type RefundRequest as bF, type RefundStatus as bG, type RegisterAgentRequest as bH, type RegisterAgentResponse as bI, type RegisterJobResponse as bJ, type RegisterJobStatus as bK, RegistrationPendingError as bL, type RelayAuthorizationParams as bM, type ReputationResponse as bN, type ReputationSummary as bO, type RequestRefundOptions as bP, SOLANA_FEEDBACK_NETWORKS as bQ, type SettleRequest as bR, type SettleResponseWithProof as bS, type SubmitRelayFeedbackRequest as bT, type SubmitRelayResponseRequest as bU, type SubmitSolanaFeedbackRequest as bV, TIER_FILTERS as bW, TIER_TIMINGS as bX, USDC_DOMAIN_NAME as bY, type UnavailableBody as bZ, type UnavailableResponse as b_, EscrowClient as ba, type EscrowClientOptions as bb, type EscrowOperatorGeneration as bc, type EscrowPayment as bd, type EscrowStateResponse as be, type EscrowStatus as bf, type FeedbackEntry as bg, type FeedbackParams as bh, type FeedbackRequest as bi, type FeedbackResponse as bj, HEALTH_FILTERS as bk, type IdentityByOwnerResponse as bl, type IdentityMetadataResponse as bm, type IdentityTotalSupplyResponse as bn, type LifecycleAuthOptions as bo, MAX_SEARCH_LEN as bp, type MetadataEntryParam as bq, OPERATOR_ABI as br, OPERATOR_ABI_CREATE3 as bs, OPERATOR_ABI_V3 as bt, PAYMENT_INFO_TYPEHASH as bu, type PaymentRequirementResolver as bv, type PaymentRequirements as bw, type PaymentRequirementsOptions as bx, type PrepareRelayFeedbackRequest as by, type PrepareRelayFeedbackResponse as bz, type AdmittedAuthorizationCode as c, ZERO_ADDRESS as c0, buildErc8004PaymentRequirements as c1, buildUnavailableResponse as c2, canRefundEscrow as c3, canReleaseEscrow as c4, carryFailureFields as c5, epochToDate as c6, escrowTimeRemaining as c7, getEscrowContractsByChainId as c8, getEscrowOperatorGeneration as c9, getEscrowSupportedChainIds as ca, isAlive as cb, isEscrowExpired as cc, isEscrowSupportedOnChain as cd, isRegisterJobTerminal as ce, parsePaymentHeader as cf, supportsRelayedFeedback as cg, supportsSolanaFeedback as ch, wireNetwork as ci, DEFAULT_RETRY_AFTER_SECONDS as d, FacilitatorClient as e, type FacilitatorClientOptions as f, type FacilitatorErrorInfo as g, type FacilitatorFailureFields as h, type FacilitatorFetchOptions as i, IDEMPOTENT_REPLAYED_HEADER as j, LIFECYCLE_DEFAULT_DEADLINE_SECS as k, LIFECYCLE_DOMAIN_NAME as l, LIFECYCLE_DOMAIN_VERSION as m, LIFECYCLE_MAX_DEADLINE_SECS as n, LIFECYCLE_ORDER_TYPES as o, type LifecycleAction as p, type LifecycleAuth as q, type LifecyclePaymentInfo as r, type LifecycleSigner as s, type LifecycleTypedData as t, type LifecycleTypedDataParams as u, type PaymentAcceptance as v, type PaymentConflictResponse as w, type PaymentMiddlewareOptions as x, type PaymentPayloadV2 as y, type PaymentRequirementsV2 as z };
|
|
@@ -3733,6 +3733,13 @@ declare const USDC_DOMAIN_NAME: Record<number, string>;
|
|
|
3733
3733
|
* resolve the real operator from the marketplace's own escrow config
|
|
3734
3734
|
* ({@link EscrowNetworkConfig}) and pass it via `options.contracts`.
|
|
3735
3735
|
* See {@link OPERATOR_FEE_BPS} for the commands.
|
|
3736
|
+
*
|
|
3737
|
+
* Arc (5042) and Arc Testnet (5042002) use the x402r canonical escrow
|
|
3738
|
+
* (AuthCaptureEscrow `0xBdEA0D1b…`, PaymentOperatorFactory v1.0.2
|
|
3739
|
+
* `0xc24153B7…`). Their `operator` is a PaymentOperator address: the one the
|
|
3740
|
+
* factory's `computeAddress` returns, recorded on both chains in
|
|
3741
|
+
* `src/fixtures/arc-escrow-d.rpc.json`. Their operator generation is `'v3'`
|
|
3742
|
+
* ({@link OPERATOR_ABI_V3}).
|
|
3736
3743
|
*/
|
|
3737
3744
|
declare const ESCROW_CONTRACTS: Record<number, AdvancedEscrowContracts>;
|
|
3738
3745
|
/**
|
|
@@ -3914,7 +3921,8 @@ interface AdvancedEscrowClientOptions {
|
|
|
3914
3921
|
* Chain ID (default: 8453 for Base Mainnet).
|
|
3915
3922
|
* Supported chains: 8453 (Base), 84532 (Base Sepolia), 1 (Ethereum),
|
|
3916
3923
|
* 11155111 (Ethereum Sepolia), 137 (Polygon), 42161 (Arbitrum),
|
|
3917
|
-
* 10 (Optimism), 42220 (Celo), 143 (Monad), 43114 (Avalanche)
|
|
3924
|
+
* 10 (Optimism), 42220 (Celo), 143 (Monad), 43114 (Avalanche),
|
|
3925
|
+
* 1187947933 (SKALE Base), 5042 (Arc), 5042002 (Arc Testnet).
|
|
3918
3926
|
*/
|
|
3919
3927
|
chainId?: number;
|
|
3920
3928
|
/** Contract addresses (auto-resolved from chainId if not provided) */
|
|
@@ -3965,13 +3973,77 @@ declare const OPERATOR_ABI: string[];
|
|
|
3965
3973
|
* on release() and refundInEscrow(). Pass empty bytes (0x) for the data parameter.
|
|
3966
3974
|
*/
|
|
3967
3975
|
declare const OPERATOR_ABI_CREATE3: string[];
|
|
3976
|
+
/**
|
|
3977
|
+
* PaymentOperator of the x402r canonical PaymentOperatorFactory v1.0.2
|
|
3978
|
+
* (`0xc24153B7ED8DC03e551F29DDEeA5CadFe57e2716`), the operator generation of
|
|
3979
|
+
* Arc and Arc Testnet. Source: BackTrackCo/x402r-contracts
|
|
3980
|
+
* `src/operator/payment/PaymentOperator.sol` @ 8345776e.
|
|
3981
|
+
*
|
|
3982
|
+
* It has no `release` and no `refundInEscrow`:
|
|
3983
|
+
* - `capture(paymentInfo, amount, data)` pays the receiver;
|
|
3984
|
+
* - `void(paymentInfo, data)` takes NO amount: it returns the whole
|
|
3985
|
+
* `capturableAmount` to the payer;
|
|
3986
|
+
* - `refund(...)` returns funds after a capture;
|
|
3987
|
+
* - the owner is `FEE_RECEIVER()`.
|
|
3988
|
+
*
|
|
3989
|
+
* Every selector here is checked against the factory bytecode recorded on
|
|
3990
|
+
* Arc (`src/fixtures/arc-escrow-d.rpc.json`): `capture` 0xf12b86f6, `void`
|
|
3991
|
+
* 0xc3c5090e, `FEE_RECEIVER` 0xd3e78e4d.
|
|
3992
|
+
*/
|
|
3993
|
+
declare const OPERATOR_ABI_V3: string[];
|
|
3994
|
+
/**
|
|
3995
|
+
* `refundInEscrow` on a v3 operator was given an amount other than the whole
|
|
3996
|
+
* `capturableAmount`. `void` takes no amount, so sending it would return more
|
|
3997
|
+
* than was asked. Nothing was sent. `errorCode` of the result.
|
|
3998
|
+
*/
|
|
3999
|
+
declare const ESCROW_VOID_AMOUNT_MISMATCH = "escrow_void_amount_mismatch";
|
|
4000
|
+
/**
|
|
4001
|
+
* `refundInEscrow` on a v3 operator found `capturableAmount` = 0: nothing is
|
|
4002
|
+
* left to return. Nothing was sent. `errorCode` of the result.
|
|
4003
|
+
*/
|
|
4004
|
+
declare const ESCROW_NOTHING_TO_VOID = "escrow_nothing_to_void";
|
|
4005
|
+
/**
|
|
4006
|
+
* The v3 operator has no code on the chain. A call to it would succeed and
|
|
4007
|
+
* move nothing, so the SDK does not send one. `errorCode` of the result.
|
|
4008
|
+
*/
|
|
4009
|
+
declare const ESCROW_OPERATOR_NOT_DEPLOYED = "escrow_operator_not_deployed";
|
|
4010
|
+
/**
|
|
4011
|
+
* The call has no counterpart on the chain's operator generation (`charge` on
|
|
4012
|
+
* a v3 operator). Nothing was signed or sent. `errorCode` of the result.
|
|
4013
|
+
*/
|
|
4014
|
+
declare const ESCROW_UNSUPPORTED_ON_GENERATION = "escrow_unsupported_on_generation";
|
|
4015
|
+
/**
|
|
4016
|
+
* Which PaymentOperator ABI a chain's escrow operator speaks.
|
|
4017
|
+
*
|
|
4018
|
+
* - `'v1'`: {@link OPERATOR_ABI} — `release(PaymentInfo, amount)` and
|
|
4019
|
+
* `refundInEscrow(PaymentInfo, amount)`.
|
|
4020
|
+
* - `'v2'`: {@link OPERATOR_ABI_CREATE3} — the same two with a trailing
|
|
4021
|
+
* `bytes data`.
|
|
4022
|
+
* - `'v3'`: {@link OPERATOR_ABI_V3} — `capture(PaymentInfo, amount, data)` and
|
|
4023
|
+
* `void(PaymentInfo, data)`.
|
|
4024
|
+
*/
|
|
4025
|
+
type EscrowOperatorGeneration = 'v1' | 'v2' | 'v3';
|
|
4026
|
+
/**
|
|
4027
|
+
* Operator generation per chain — the single source the escrow client reads
|
|
4028
|
+
* to pick the operator ABI. A chain absent from this table is `'v1'`, which is
|
|
4029
|
+
* what a custom `options.contracts` on an unlisted chain has always used.
|
|
4030
|
+
*/
|
|
4031
|
+
declare const ESCROW_OPERATOR_GENERATION: Record<number, EscrowOperatorGeneration>;
|
|
4032
|
+
/** Operator generation of a chain; `'v1'` when the chain is not listed. */
|
|
4033
|
+
declare function getEscrowOperatorGeneration(chainId: number): EscrowOperatorGeneration;
|
|
3968
4034
|
/**
|
|
3969
4035
|
* AdvancedEscrowClient provides the 5 Advanced Escrow flows via the
|
|
3970
4036
|
* PaymentOperator contract on 9 supported EVM networks.
|
|
3971
4037
|
*
|
|
3972
4038
|
* Supported chains: Base (8453), Base Sepolia (84532), Ethereum (1),
|
|
3973
4039
|
* Ethereum Sepolia (11155111), Polygon (137), Arbitrum (42161),
|
|
3974
|
-
* Optimism (10), Celo (42220), Monad (143), Avalanche (43114)
|
|
4040
|
+
* Optimism (10), Celo (42220), Monad (143), Avalanche (43114),
|
|
4041
|
+
* SKALE Base (1187947933), Arc (5042), Arc Testnet (5042002).
|
|
4042
|
+
*
|
|
4043
|
+
* The operator ABI follows the chain's {@link ESCROW_OPERATOR_GENERATION}.
|
|
4044
|
+
* On Arc and Arc Testnet (`'v3'`) `release` sends `capture`, `refundInEscrow`
|
|
4045
|
+
* sends `void` (whole capturable amount only), `refundPostEscrow` sends
|
|
4046
|
+
* `refund`, and `charge` refuses without signing or sending.
|
|
3975
4047
|
*
|
|
3976
4048
|
* Contract addresses are auto-resolved from the chain ID.
|
|
3977
4049
|
* Pass custom contracts to override.
|
|
@@ -4097,6 +4169,10 @@ declare class AdvancedEscrowClient {
|
|
|
4097
4169
|
*
|
|
4098
4170
|
* Calls PaymentOperator.release() -> escrow.capture()
|
|
4099
4171
|
*
|
|
4172
|
+
* On a `'v3'` operator (Arc, Arc Testnet) it calls
|
|
4173
|
+
* `PaymentOperator.capture(paymentInfo, amount, 0x)` instead, after checking
|
|
4174
|
+
* that the operator has code ({@link ESCROW_OPERATOR_NOT_DEPLOYED}).
|
|
4175
|
+
*
|
|
4100
4176
|
* @param paymentInfo - PaymentInfo from the authorize step
|
|
4101
4177
|
* @param amount - Amount to release (defaults to maxAmount)
|
|
4102
4178
|
*/
|
|
@@ -4106,6 +4182,16 @@ declare class AdvancedEscrowClient {
|
|
|
4106
4182
|
*
|
|
4107
4183
|
* Calls PaymentOperator.refundInEscrow() -> escrow.partialVoid()
|
|
4108
4184
|
*
|
|
4185
|
+
* On a `'v3'` operator (Arc, Arc Testnet) it calls
|
|
4186
|
+
* `PaymentOperator.void(paymentInfo, 0x)`, which takes no amount and returns
|
|
4187
|
+
* the WHOLE `capturableAmount`. So it first reads that amount on-chain
|
|
4188
|
+
* (`AuthCaptureEscrow.getHash` + `paymentState`) and sends only when
|
|
4189
|
+
* `amount` equals it. Otherwise nothing is sent and `errorCode` says why:
|
|
4190
|
+
* {@link ESCROW_NOTHING_TO_VOID} when it is 0,
|
|
4191
|
+
* {@link ESCROW_VOID_AMOUNT_MISMATCH} for any other amount. To return part
|
|
4192
|
+
* of an escrow on v3, `release` the part the receiver keeps, then
|
|
4193
|
+
* `refundInEscrow` what is left.
|
|
4194
|
+
*
|
|
4109
4195
|
* @param paymentInfo - PaymentInfo from the authorize step
|
|
4110
4196
|
* @param amount - Amount to refund (defaults to maxAmount)
|
|
4111
4197
|
*/
|
|
@@ -4223,6 +4309,9 @@ declare class AdvancedEscrowClient {
|
|
|
4223
4309
|
* Calls PaymentOperator.charge() -> escrow.charge()
|
|
4224
4310
|
* Funds go directly from payer to receiver.
|
|
4225
4311
|
*
|
|
4312
|
+
* Not available on a `'v3'` operator (Arc, Arc Testnet): it returns
|
|
4313
|
+
* {@link ESCROW_UNSUPPORTED_ON_GENERATION} without signing or sending.
|
|
4314
|
+
*
|
|
4226
4315
|
* @param paymentInfo - PaymentInfo with receiver and amount
|
|
4227
4316
|
* @param amount - Amount to charge (defaults to maxAmount)
|
|
4228
4317
|
*/
|
|
@@ -4242,12 +4331,32 @@ declare class AdvancedEscrowClient {
|
|
|
4242
4331
|
*
|
|
4243
4332
|
* Kept for future use when tokenCollector is implemented.
|
|
4244
4333
|
*
|
|
4334
|
+
* On a `'v3'` operator (Arc, Arc Testnet) it calls
|
|
4335
|
+
* `PaymentOperator.refund(paymentInfo, amount, tokenCollector, collectorData)`
|
|
4336
|
+
* -> escrow.refund(), the same arguments, after checking that the operator
|
|
4337
|
+
* has code ({@link ESCROW_OPERATOR_NOT_DEPLOYED}).
|
|
4338
|
+
*
|
|
4245
4339
|
* @param paymentInfo - PaymentInfo from the original authorization
|
|
4246
4340
|
* @param amount - Amount to refund (defaults to maxAmount)
|
|
4247
4341
|
* @param tokenCollector - Address of token collector for refund sourcing
|
|
4248
4342
|
* @param collectorData - Data for the token collector
|
|
4249
4343
|
*/
|
|
4250
4344
|
refundPostEscrow(paymentInfo: AdvancedPaymentInfo, amount?: string, tokenCollector?: string, collectorData?: string): Promise<AdvancedTransactionResult>;
|
|
4345
|
+
/** The refusal of a call a 'v3' operator does not have, or null elsewhere. */
|
|
4346
|
+
private unsupportedOnV3;
|
|
4347
|
+
/** The provider a 'v3' call reads with before it sends anything. */
|
|
4348
|
+
private v3Provider;
|
|
4349
|
+
/**
|
|
4350
|
+
* Send one OPERATOR_ABI_V3 call, once the operator is known to have code.
|
|
4351
|
+
* A call to an address with no code succeeds and moves nothing, and would be
|
|
4352
|
+
* reported as a success.
|
|
4353
|
+
*/
|
|
4354
|
+
private sendV3OperatorCall;
|
|
4355
|
+
/**
|
|
4356
|
+
* `refundInEscrow` on a 'v3' operator: `void` returns the whole capturable
|
|
4357
|
+
* amount, so it is sent only when that is exactly what was asked for.
|
|
4358
|
+
*/
|
|
4359
|
+
private voidWholeCapturable;
|
|
4251
4360
|
/**
|
|
4252
4361
|
* Build an unsigned transaction, sign via SigningWalletAdapter, and broadcast.
|
|
4253
4362
|
*
|
|
@@ -4263,4 +4372,4 @@ declare class AdvancedEscrowClient {
|
|
|
4263
4372
|
private sendViaAdapter;
|
|
4264
4373
|
}
|
|
4265
4374
|
|
|
4266
|
-
export { buildSettleRequest as $, AMBIGUOUS_LEASE_REASONS as A, type BuildLifecycleAuthParams as B, REPLAYABLE_LEASE_REASONS as C, DEFAULT_FACILITATOR_RETRIES as D, type ResourceInfoV2 as E, type FacilitatorCallOptions as F, type SettleRequestV2 as G, type HonoMiddlewareOptions as H, IDEMPOTENCY_KEY_HEADER as I, type SettleResponse as J, type VerifyRequestV2 as K, LIFECYCLE_ACTIONS as L, MAX_RETRY_AFTER_SECONDS as M, type VerifyResponse as N, type WagmiLifecycleWalletClient as O, type ParsedFacilitatorErrorBody as P, type WriterLeaseReason as Q, RECEIPT_REQUEST_CONFLICT as R, SETTLEMENT_UNCONFIRMED as S, X402_HEADER_NAMES as T, buildLifecycleAuth as U, type VerifiedPaymentState as V, WRITER_LEASE_REASONS as W, X402_CORS_HEADERS as X, buildLifecycleTypedData as Y, buildPaymentConflictResponse as Z, buildPaymentRequirements as _, AUTHORIZATION_ALREADY_SETTLED as a, ESCROW_CONTRACTS as a$, buildSettleRequestForVersion as a0, buildSettleRequestV2 as a1, buildVerifyRequest as a2, buildVerifyRequestForVersion as a3, buildVerifyRequestV2 as a4, create402Response as a5, createHonoMiddleware as a6, createIdempotencyKey as a7, createPaymentMiddleware as a8, extractPaymentFromHeaders as a9, type AgentService as aA, type AtomStats as aB, BASE_MAINNET_CONTRACTS as aC, BazaarClient as aD, type BazaarClientOptions as aE, type BazaarDiscoverOptions as aF, type BazaarDiscoverResponse as aG, type BazaarRegisterOptions as aH, type BazaarResource as aI, type CreateEscrowOptions as aJ, DEPOSIT_LIMIT_USDC as aK, type DiscoveryAccepts as aL, type DiscoveryCuration as aM, type DiscoveryHealth as aN, type DiscoveryHealthStatus as aO, type DiscoveryListOptions as aP, type DiscoveryPagination as aQ, type DiscoveryRegisterOptions as aR, type DiscoveryResource as aS, type DiscoveryResponse as aT, type DiscoverySource as aU, type DiscoveryStats as aV, type DiscoveryTier as aW, type Dispute as aX, type DisputeOutcome as aY, ERC8004_CONTRACTS as aZ, ERC8004_EXTENSION_ID as a_, facilitatorFetch as aa, getCorsHeaders as ab, isAmbiguousLeaseReason as ac, isAuthorizationAlreadyUsed as ad, isAuthorizationInFlight as ae, isReplayableLeaseReason as af, isSettlementUnconfirmed as ag, lifecycleAuthFromSignature as ah, parseFacilitatorErrorBody as ai, parseRetryAfterSeconds as aj, readFacilitatorError as ak, resolveEnvelopeVersion as al, toPaymentRequirementsV2 as am, toResourceInfoV2 as an, wagmiLifecycleSigner as ao, type AdvancedAuthorizationResult as ap, AdvancedEscrowClient as aq, type AdvancedEscrowClientOptions as ar, type AdvancedEscrowContracts as as, type AdvancedEscrowTaskTier as at, type AdvancedPaymentInfo as au, type AdvancedTransactionResult as av, type AgentId as aw, type AgentIdentity as ax, type AgentRegistration as ay, type AgentRegistrationFile as az, AUTHORIZATION_IN_FLIGHT as b,
|
|
4375
|
+
export { buildSettleRequest as $, AMBIGUOUS_LEASE_REASONS as A, type BuildLifecycleAuthParams as B, REPLAYABLE_LEASE_REASONS as C, DEFAULT_FACILITATOR_RETRIES as D, type ResourceInfoV2 as E, type FacilitatorCallOptions as F, type SettleRequestV2 as G, type HonoMiddlewareOptions as H, IDEMPOTENCY_KEY_HEADER as I, type SettleResponse as J, type VerifyRequestV2 as K, LIFECYCLE_ACTIONS as L, MAX_RETRY_AFTER_SECONDS as M, type VerifyResponse as N, type WagmiLifecycleWalletClient as O, type ParsedFacilitatorErrorBody as P, type WriterLeaseReason as Q, RECEIPT_REQUEST_CONFLICT as R, SETTLEMENT_UNCONFIRMED as S, X402_HEADER_NAMES as T, buildLifecycleAuth as U, type VerifiedPaymentState as V, WRITER_LEASE_REASONS as W, X402_CORS_HEADERS as X, buildLifecycleTypedData as Y, buildPaymentConflictResponse as Z, buildPaymentRequirements as _, AUTHORIZATION_ALREADY_SETTLED as a, ESCROW_CONTRACTS as a$, buildSettleRequestForVersion as a0, buildSettleRequestV2 as a1, buildVerifyRequest as a2, buildVerifyRequestForVersion as a3, buildVerifyRequestV2 as a4, create402Response as a5, createHonoMiddleware as a6, createIdempotencyKey as a7, createPaymentMiddleware as a8, extractPaymentFromHeaders as a9, type AgentService as aA, type AtomStats as aB, BASE_MAINNET_CONTRACTS as aC, BazaarClient as aD, type BazaarClientOptions as aE, type BazaarDiscoverOptions as aF, type BazaarDiscoverResponse as aG, type BazaarRegisterOptions as aH, type BazaarResource as aI, type CreateEscrowOptions as aJ, DEPOSIT_LIMIT_USDC as aK, type DiscoveryAccepts as aL, type DiscoveryCuration as aM, type DiscoveryHealth as aN, type DiscoveryHealthStatus as aO, type DiscoveryListOptions as aP, type DiscoveryPagination as aQ, type DiscoveryRegisterOptions as aR, type DiscoveryResource as aS, type DiscoveryResponse as aT, type DiscoverySource as aU, type DiscoveryStats as aV, type DiscoveryTier as aW, type Dispute as aX, type DisputeOutcome as aY, ERC8004_CONTRACTS as aZ, ERC8004_EXTENSION_ID as a_, facilitatorFetch as aa, getCorsHeaders as ab, isAmbiguousLeaseReason as ac, isAuthorizationAlreadyUsed as ad, isAuthorizationInFlight as ae, isReplayableLeaseReason as af, isSettlementUnconfirmed as ag, lifecycleAuthFromSignature as ah, parseFacilitatorErrorBody as ai, parseRetryAfterSeconds as aj, readFacilitatorError as ak, resolveEnvelopeVersion as al, toPaymentRequirementsV2 as am, toResourceInfoV2 as an, wagmiLifecycleSigner as ao, type AdvancedAuthorizationResult as ap, AdvancedEscrowClient as aq, type AdvancedEscrowClientOptions as ar, type AdvancedEscrowContracts as as, type AdvancedEscrowTaskTier as at, type AdvancedPaymentInfo as au, type AdvancedTransactionResult as av, type AgentId as aw, type AgentIdentity as ax, type AgentRegistration as ay, type AgentRegistrationFile as az, AUTHORIZATION_IN_FLIGHT as b, type VerifyRequest as b$, ESCROW_NOTHING_TO_VOID as b0, ESCROW_OPERATOR_GENERATION as b1, ESCROW_OPERATOR_NOT_DEPLOYED as b2, ESCROW_TIMEOUT_MS as b3, ESCROW_UNSUPPORTED_ON_GENERATION as b4, ESCROW_VOID_AMOUNT_MISMATCH as b5, Erc8004Client as b6, type Erc8004ClientOptions as b7, Erc8004LookupError as b8, type Erc8004Network as b9, type PrepareRelayResponseRequest as bA, type PrepareSolanaFeedbackRequest as bB, type PrepareSolanaFeedbackResponse as bC, type ProofOfPayment as bD, RELAYED_FEEDBACK_NETWORKS as bE, type RefundRequest as bF, type RefundStatus as bG, type RegisterAgentRequest as bH, type RegisterAgentResponse as bI, type RegisterJobResponse as bJ, type RegisterJobStatus as bK, RegistrationPendingError as bL, type RelayAuthorizationParams as bM, type ReputationResponse as bN, type ReputationSummary as bO, type RequestRefundOptions as bP, SOLANA_FEEDBACK_NETWORKS as bQ, type SettleRequest as bR, type SettleResponseWithProof as bS, type SubmitRelayFeedbackRequest as bT, type SubmitRelayResponseRequest as bU, type SubmitSolanaFeedbackRequest as bV, TIER_FILTERS as bW, TIER_TIMINGS as bX, USDC_DOMAIN_NAME as bY, type UnavailableBody as bZ, type UnavailableResponse as b_, EscrowClient as ba, type EscrowClientOptions as bb, type EscrowOperatorGeneration as bc, type EscrowPayment as bd, type EscrowStateResponse as be, type EscrowStatus as bf, type FeedbackEntry as bg, type FeedbackParams as bh, type FeedbackRequest as bi, type FeedbackResponse as bj, HEALTH_FILTERS as bk, type IdentityByOwnerResponse as bl, type IdentityMetadataResponse as bm, type IdentityTotalSupplyResponse as bn, type LifecycleAuthOptions as bo, MAX_SEARCH_LEN as bp, type MetadataEntryParam as bq, OPERATOR_ABI as br, OPERATOR_ABI_CREATE3 as bs, OPERATOR_ABI_V3 as bt, PAYMENT_INFO_TYPEHASH as bu, type PaymentRequirementResolver as bv, type PaymentRequirements as bw, type PaymentRequirementsOptions as bx, type PrepareRelayFeedbackRequest as by, type PrepareRelayFeedbackResponse as bz, type AdmittedAuthorizationCode as c, ZERO_ADDRESS as c0, buildErc8004PaymentRequirements as c1, buildUnavailableResponse as c2, canRefundEscrow as c3, canReleaseEscrow as c4, carryFailureFields as c5, epochToDate as c6, escrowTimeRemaining as c7, getEscrowContractsByChainId as c8, getEscrowOperatorGeneration as c9, getEscrowSupportedChainIds as ca, isAlive as cb, isEscrowExpired as cc, isEscrowSupportedOnChain as cd, isRegisterJobTerminal as ce, parsePaymentHeader as cf, supportsRelayedFeedback as cg, supportsSolanaFeedback as ch, wireNetwork as ci, DEFAULT_RETRY_AFTER_SECONDS as d, FacilitatorClient as e, type FacilitatorClientOptions as f, type FacilitatorErrorInfo as g, type FacilitatorFailureFields as h, type FacilitatorFetchOptions as i, IDEMPOTENT_REPLAYED_HEADER as j, LIFECYCLE_DEFAULT_DEADLINE_SECS as k, LIFECYCLE_DOMAIN_NAME as l, LIFECYCLE_DOMAIN_VERSION as m, LIFECYCLE_MAX_DEADLINE_SECS as n, LIFECYCLE_ORDER_TYPES as o, type LifecycleAction as p, type LifecycleAuth as q, type LifecyclePaymentInfo as r, type LifecycleSigner as s, type LifecycleTypedData as t, type LifecycleTypedDataParams as u, type PaymentAcceptance as v, type PaymentConflictResponse as w, type PaymentMiddlewareOptions as x, type PaymentPayloadV2 as y, type PaymentRequirementsV2 as z };
|
package/dist/index.d.mts
CHANGED
|
@@ -4,7 +4,7 @@ export { D as DEFAULT_PAYMENT_HEADER, a as DEFAULT_VALIDITY_SECONDS, M as MAX_VA
|
|
|
4
4
|
import { S as SigningWalletAdapter } from './wallet-w7BnImDG.mjs';
|
|
5
5
|
export { a as EIP3009Authorization, E as EIP3009Params } from './wallet-w7BnImDG.mjs';
|
|
6
6
|
export { E as EnvKeyAdapter, O as OWSWallet, a as OWSWalletAdapter } from './ows-Z9v4GxOZ.mjs';
|
|
7
|
-
export { A as AMBIGUOUS_LEASE_REASONS, a as AUTHORIZATION_ALREADY_SETTLED, b as AUTHORIZATION_IN_FLIGHT, c as AdmittedAuthorizationCode, B as BuildLifecycleAuthParams, D as DEFAULT_FACILITATOR_RETRIES, d as DEFAULT_RETRY_AFTER_SECONDS, F as FacilitatorCallOptions, e as FacilitatorClient, f as FacilitatorClientOptions, g as FacilitatorErrorInfo, h as FacilitatorFailureFields, i as FacilitatorFetchOptions, H as HonoMiddlewareOptions, I as IDEMPOTENCY_KEY_HEADER, j as IDEMPOTENT_REPLAYED_HEADER, L as LIFECYCLE_ACTIONS, k as LIFECYCLE_DEFAULT_DEADLINE_SECS, l as LIFECYCLE_DOMAIN_NAME, m as LIFECYCLE_DOMAIN_VERSION, n as LIFECYCLE_MAX_DEADLINE_SECS, o as LIFECYCLE_ORDER_TYPES, p as LifecycleAction, q as LifecycleAuth, r as LifecyclePaymentInfo, s as LifecycleSigner, t as LifecycleTypedData, u as LifecycleTypedDataParams, M as MAX_RETRY_AFTER_SECONDS, P as ParsedFacilitatorErrorBody, v as PaymentAcceptance, w as PaymentConflictResponse, x as PaymentMiddlewareOptions, y as PaymentPayloadV2, z as PaymentRequirementsV2, R as RECEIPT_REQUEST_CONFLICT, C as REPLAYABLE_LEASE_REASONS, E as ResourceInfoV2, S as SETTLEMENT_UNCONFIRMED, G as SettleRequestV2, J as SettleResponse, V as VerifiedPaymentState, K as VerifyRequestV2, N as VerifyResponse, W as WRITER_LEASE_REASONS, O as WagmiLifecycleWalletClient, Q as WriterLeaseReason, X as X402_CORS_HEADERS, T as X402_HEADER_NAMES, U as buildLifecycleAuth, Y as buildLifecycleTypedData, Z as buildPaymentConflictResponse, _ as buildPaymentRequirements, $ as buildSettleRequest, a0 as buildSettleRequestForVersion, a1 as buildSettleRequestV2, a2 as buildVerifyRequest, a3 as buildVerifyRequestForVersion, a4 as buildVerifyRequestV2, a5 as create402Response, a6 as createHonoMiddleware, a7 as createIdempotencyKey, a8 as createPaymentMiddleware, a9 as extractPaymentFromHeaders, aa as facilitatorFetch, ab as getCorsHeaders, ac as isAmbiguousLeaseReason, ad as isAuthorizationAlreadyUsed, ae as isAuthorizationInFlight, af as isReplayableLeaseReason, ag as isSettlementUnconfirmed, ah as lifecycleAuthFromSignature, ai as parseFacilitatorErrorBody, aj as parseRetryAfterSeconds, ak as readFacilitatorError, al as resolveEnvelopeVersion, am as toPaymentRequirementsV2, an as toResourceInfoV2, ao as wagmiLifecycleSigner } from './index-
|
|
7
|
+
export { A as AMBIGUOUS_LEASE_REASONS, a as AUTHORIZATION_ALREADY_SETTLED, b as AUTHORIZATION_IN_FLIGHT, c as AdmittedAuthorizationCode, B as BuildLifecycleAuthParams, D as DEFAULT_FACILITATOR_RETRIES, d as DEFAULT_RETRY_AFTER_SECONDS, F as FacilitatorCallOptions, e as FacilitatorClient, f as FacilitatorClientOptions, g as FacilitatorErrorInfo, h as FacilitatorFailureFields, i as FacilitatorFetchOptions, H as HonoMiddlewareOptions, I as IDEMPOTENCY_KEY_HEADER, j as IDEMPOTENT_REPLAYED_HEADER, L as LIFECYCLE_ACTIONS, k as LIFECYCLE_DEFAULT_DEADLINE_SECS, l as LIFECYCLE_DOMAIN_NAME, m as LIFECYCLE_DOMAIN_VERSION, n as LIFECYCLE_MAX_DEADLINE_SECS, o as LIFECYCLE_ORDER_TYPES, p as LifecycleAction, q as LifecycleAuth, r as LifecyclePaymentInfo, s as LifecycleSigner, t as LifecycleTypedData, u as LifecycleTypedDataParams, M as MAX_RETRY_AFTER_SECONDS, P as ParsedFacilitatorErrorBody, v as PaymentAcceptance, w as PaymentConflictResponse, x as PaymentMiddlewareOptions, y as PaymentPayloadV2, z as PaymentRequirementsV2, R as RECEIPT_REQUEST_CONFLICT, C as REPLAYABLE_LEASE_REASONS, E as ResourceInfoV2, S as SETTLEMENT_UNCONFIRMED, G as SettleRequestV2, J as SettleResponse, V as VerifiedPaymentState, K as VerifyRequestV2, N as VerifyResponse, W as WRITER_LEASE_REASONS, O as WagmiLifecycleWalletClient, Q as WriterLeaseReason, X as X402_CORS_HEADERS, T as X402_HEADER_NAMES, U as buildLifecycleAuth, Y as buildLifecycleTypedData, Z as buildPaymentConflictResponse, _ as buildPaymentRequirements, $ as buildSettleRequest, a0 as buildSettleRequestForVersion, a1 as buildSettleRequestV2, a2 as buildVerifyRequest, a3 as buildVerifyRequestForVersion, a4 as buildVerifyRequestV2, a5 as create402Response, a6 as createHonoMiddleware, a7 as createIdempotencyKey, a8 as createPaymentMiddleware, a9 as extractPaymentFromHeaders, aa as facilitatorFetch, ab as getCorsHeaders, ac as isAmbiguousLeaseReason, ad as isAuthorizationAlreadyUsed, ae as isAuthorizationInFlight, af as isReplayableLeaseReason, ag as isSettlementUnconfirmed, ah as lifecycleAuthFromSignature, ai as parseFacilitatorErrorBody, aj as parseRetryAfterSeconds, ak as readFacilitatorError, al as resolveEnvelopeVersion, am as toPaymentRequirementsV2, an as toResourceInfoV2, ao as wagmiLifecycleSigner } from './index-SaqboHsK.mjs';
|
|
8
8
|
export { HEDERA_NETWORKS, HederaNetwork, HederaPaymentPayload, HederaProvider, HederaRequirements, buildHederaRequest, buildHederaRequirements, validateHederaRequirements } from './providers/hedera/index.mjs';
|
|
9
9
|
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';
|
|
10
10
|
|
|
@@ -1060,8 +1060,9 @@ declare function isDelegated(address: string, network: string, resolver?: Delega
|
|
|
1060
1060
|
* receiver fill" is on-chain unsound).
|
|
1061
1061
|
*
|
|
1062
1062
|
* Fail-loud policy: an incomplete network config, an unknown tier, a bounty
|
|
1063
|
-
* outside the on-chain deposit limit,
|
|
1064
|
-
* operator's static fee
|
|
1063
|
+
* outside the on-chain deposit limit, a `maxFeeBps` that cannot cover the
|
|
1064
|
+
* operator's static fee, or a USDC domain that contradicts
|
|
1065
|
+
* {@link VERIFIED_USDC_DOMAINS} all throw instead of falling back — a silent
|
|
1065
1066
|
* fallback would sign an EIP-3009 authorization with the WRONG EIP-712
|
|
1066
1067
|
* domain (chainId + verifyingContract): a mismatched, wallet-draining auth.
|
|
1067
1068
|
*
|
|
@@ -1201,6 +1202,26 @@ interface EscrowPaymentInfo {
|
|
|
1201
1202
|
/** 32-byte hex. */
|
|
1202
1203
|
salt: string;
|
|
1203
1204
|
}
|
|
1205
|
+
/**
|
|
1206
|
+
* USDC EIP-712 domains VERIFIED ON-CHAIN, per chain ID.
|
|
1207
|
+
*
|
|
1208
|
+
* `usdc_domain_name` / `usdc_domain_version` arrive with the server's config,
|
|
1209
|
+
* and they ARE the domain the authorization is signed under: a wrong pair
|
|
1210
|
+
* produces an authorization that never settles. For a chain in this table,
|
|
1211
|
+
* {@link buildEscrowPreAuth} refuses a config whose pair differs. A chain that
|
|
1212
|
+
* is not in the table is signed exactly as before.
|
|
1213
|
+
*
|
|
1214
|
+
* Only chains whose domain this SDK checked against the token's own
|
|
1215
|
+
* `DOMAIN_SEPARATOR()` are listed: Arc and Arc Testnet
|
|
1216
|
+
* (`src/fixtures/arc-escrow-d.rpc.json`, pinned by
|
|
1217
|
+
* `src/backend/escrow-arc-d.test.ts`). The values come from the chain
|
|
1218
|
+
* registry (`src/chains`), not typed again here. Mirrors the refusal policy of
|
|
1219
|
+
* the Python SDK's `escrow_signing.VERIFIED_USDC_DOMAINS`.
|
|
1220
|
+
*/
|
|
1221
|
+
declare const VERIFIED_USDC_DOMAINS: Record<number, {
|
|
1222
|
+
name: string;
|
|
1223
|
+
version: string;
|
|
1224
|
+
}>;
|
|
1204
1225
|
/**
|
|
1205
1226
|
* Compute the escrow EIP-3009 nonce = `AuthCaptureEscrow.getHash(paymentInfo)`.
|
|
1206
1227
|
*
|
|
@@ -1280,9 +1301,10 @@ interface EscrowPreAuthParams {
|
|
|
1280
1301
|
* `em_plugin_sdk.escrow_signing.build_escrow_pre_auth`.
|
|
1281
1302
|
*
|
|
1282
1303
|
* @throws {X402Error} `INVALID_CONFIG` on an incomplete network config,
|
|
1283
|
-
* unknown tier,
|
|
1284
|
-
* fee
|
|
1304
|
+
* unknown tier, a `maxFeeBps` that cannot cover the operator's static
|
|
1305
|
+
* fee, or a USDC domain that differs from {@link VERIFIED_USDC_DOMAINS};
|
|
1306
|
+
* `INVALID_AMOUNT` on a bounty outside (0, deposit limit].
|
|
1285
1307
|
*/
|
|
1286
1308
|
declare function buildEscrowPreAuth(wallet: EscrowPreAuthSigner, params: EscrowPreAuthParams): Promise<string>;
|
|
1287
1309
|
|
|
1288
|
-
export { ANCHOR_MAX_REQUEST_BYTES, type AnchorOptions, type AnchoredEvidence, type BackendOffer, ContentHashMismatch, type CreateSignedFetchConfig, DEFAULT_MAX_FEE_BPS, DEFAULT_MIN_FEE_BPS, DELEGATE_PREFIX, DX402Error, type DelegationResolver, type DelegationVerdict, type ERC8128RequestOptions, ESCROW_DEPOSIT_LIMIT_USD, ESCROW_TIER_WINDOWS, EVENT_KINDS, EVIDENCE_HEADER, type EscrowNetworkConfig, type EscrowPaymentInfo, type EscrowPreAuthParams, type EscrowPreAuthSigner, type EscrowTierWindows, type EvidenceMode, EvidenceSkipped, FACILITATOR_ADDRESSES, type FacilitatorAddresses, KEEPALIVE_INTERVAL_MS, MAX_PROTOCOL_FEE_BPS, OPERATOR_FEE_BPS, type RecipientRole, SMA_WRAP_TARGETS, type SSEFrame, SSEParser, type SignRequestOptions, type SignRequestWithSignerOptions, type SignatureBaseParams, type SignatureHeaders, type SignatureParamsInput, SigningWalletAdapter, type StreamTrafficEventsOptions, type TrafficEvent, type TrafficEventKind, TrafficStreamError, ZERO_ADDRESS, anchorDigest, anchorEvidence, availableBackends, buildEscrowPreAuth, buildSignatureBase, buildSignatureParams, computeEscrowNonce, contentHash, createSignedFetch, delegateTarget, dereferencePointer, paymentId as dx402PaymentId, ed25519ToX25519, evidenceFromHeaders, evidenceHeader, fetchNonce, getFacilitatorAddress, isDelegated, isEndToEnd, matchesFilters, needsAccountWrap, parseEvidenceHeader, parseSealed, parseTrafficEvent, payerKeyFromEvmSignature, payerKeyFromSolanaAddress, recoverEvidence, replaySafeTypedData, resolveDelegation, rpcDelegationResolver, sealEvidence, sealEvidenceTo, sealedRoles, sellerDigestFor, signAnchorEd25519, signAnchorEvm, signRequest, signRequestWithSigner, signRequestWithWallet, streamTrafficEvents, unseal, wrapSignature };
|
|
1310
|
+
export { ANCHOR_MAX_REQUEST_BYTES, type AnchorOptions, type AnchoredEvidence, type BackendOffer, ContentHashMismatch, type CreateSignedFetchConfig, DEFAULT_MAX_FEE_BPS, DEFAULT_MIN_FEE_BPS, DELEGATE_PREFIX, DX402Error, type DelegationResolver, type DelegationVerdict, type ERC8128RequestOptions, ESCROW_DEPOSIT_LIMIT_USD, ESCROW_TIER_WINDOWS, EVENT_KINDS, EVIDENCE_HEADER, type EscrowNetworkConfig, type EscrowPaymentInfo, type EscrowPreAuthParams, type EscrowPreAuthSigner, type EscrowTierWindows, type EvidenceMode, EvidenceSkipped, FACILITATOR_ADDRESSES, type FacilitatorAddresses, KEEPALIVE_INTERVAL_MS, MAX_PROTOCOL_FEE_BPS, OPERATOR_FEE_BPS, type RecipientRole, SMA_WRAP_TARGETS, type SSEFrame, SSEParser, type SignRequestOptions, type SignRequestWithSignerOptions, type SignatureBaseParams, type SignatureHeaders, type SignatureParamsInput, SigningWalletAdapter, type StreamTrafficEventsOptions, type TrafficEvent, type TrafficEventKind, TrafficStreamError, VERIFIED_USDC_DOMAINS, ZERO_ADDRESS, anchorDigest, anchorEvidence, availableBackends, buildEscrowPreAuth, buildSignatureBase, buildSignatureParams, computeEscrowNonce, contentHash, createSignedFetch, delegateTarget, dereferencePointer, paymentId as dx402PaymentId, ed25519ToX25519, evidenceFromHeaders, evidenceHeader, fetchNonce, getFacilitatorAddress, isDelegated, isEndToEnd, matchesFilters, needsAccountWrap, parseEvidenceHeader, parseSealed, parseTrafficEvent, payerKeyFromEvmSignature, payerKeyFromSolanaAddress, recoverEvidence, replaySafeTypedData, resolveDelegation, rpcDelegationResolver, sealEvidence, sealEvidenceTo, sealedRoles, sellerDigestFor, signAnchorEd25519, signAnchorEvm, signRequest, signRequestWithSigner, signRequestWithWallet, streamTrafficEvents, unseal, wrapSignature };
|
package/dist/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ export { D as DEFAULT_PAYMENT_HEADER, a as DEFAULT_VALIDITY_SECONDS, M as MAX_VA
|
|
|
4
4
|
import { S as SigningWalletAdapter } from './wallet-w7BnImDG.js';
|
|
5
5
|
export { a as EIP3009Authorization, E as EIP3009Params } from './wallet-w7BnImDG.js';
|
|
6
6
|
export { E as EnvKeyAdapter, O as OWSWallet, a as OWSWalletAdapter } from './ows-C-KmORG9.js';
|
|
7
|
-
export { A as AMBIGUOUS_LEASE_REASONS, a as AUTHORIZATION_ALREADY_SETTLED, b as AUTHORIZATION_IN_FLIGHT, c as AdmittedAuthorizationCode, B as BuildLifecycleAuthParams, D as DEFAULT_FACILITATOR_RETRIES, d as DEFAULT_RETRY_AFTER_SECONDS, F as FacilitatorCallOptions, e as FacilitatorClient, f as FacilitatorClientOptions, g as FacilitatorErrorInfo, h as FacilitatorFailureFields, i as FacilitatorFetchOptions, H as HonoMiddlewareOptions, I as IDEMPOTENCY_KEY_HEADER, j as IDEMPOTENT_REPLAYED_HEADER, L as LIFECYCLE_ACTIONS, k as LIFECYCLE_DEFAULT_DEADLINE_SECS, l as LIFECYCLE_DOMAIN_NAME, m as LIFECYCLE_DOMAIN_VERSION, n as LIFECYCLE_MAX_DEADLINE_SECS, o as LIFECYCLE_ORDER_TYPES, p as LifecycleAction, q as LifecycleAuth, r as LifecyclePaymentInfo, s as LifecycleSigner, t as LifecycleTypedData, u as LifecycleTypedDataParams, M as MAX_RETRY_AFTER_SECONDS, P as ParsedFacilitatorErrorBody, v as PaymentAcceptance, w as PaymentConflictResponse, x as PaymentMiddlewareOptions, y as PaymentPayloadV2, z as PaymentRequirementsV2, R as RECEIPT_REQUEST_CONFLICT, C as REPLAYABLE_LEASE_REASONS, E as ResourceInfoV2, S as SETTLEMENT_UNCONFIRMED, G as SettleRequestV2, J as SettleResponse, V as VerifiedPaymentState, K as VerifyRequestV2, N as VerifyResponse, W as WRITER_LEASE_REASONS, O as WagmiLifecycleWalletClient, Q as WriterLeaseReason, X as X402_CORS_HEADERS, T as X402_HEADER_NAMES, U as buildLifecycleAuth, Y as buildLifecycleTypedData, Z as buildPaymentConflictResponse, _ as buildPaymentRequirements, $ as buildSettleRequest, a0 as buildSettleRequestForVersion, a1 as buildSettleRequestV2, a2 as buildVerifyRequest, a3 as buildVerifyRequestForVersion, a4 as buildVerifyRequestV2, a5 as create402Response, a6 as createHonoMiddleware, a7 as createIdempotencyKey, a8 as createPaymentMiddleware, a9 as extractPaymentFromHeaders, aa as facilitatorFetch, ab as getCorsHeaders, ac as isAmbiguousLeaseReason, ad as isAuthorizationAlreadyUsed, ae as isAuthorizationInFlight, af as isReplayableLeaseReason, ag as isSettlementUnconfirmed, ah as lifecycleAuthFromSignature, ai as parseFacilitatorErrorBody, aj as parseRetryAfterSeconds, ak as readFacilitatorError, al as resolveEnvelopeVersion, am as toPaymentRequirementsV2, an as toResourceInfoV2, ao as wagmiLifecycleSigner } from './index-
|
|
7
|
+
export { A as AMBIGUOUS_LEASE_REASONS, a as AUTHORIZATION_ALREADY_SETTLED, b as AUTHORIZATION_IN_FLIGHT, c as AdmittedAuthorizationCode, B as BuildLifecycleAuthParams, D as DEFAULT_FACILITATOR_RETRIES, d as DEFAULT_RETRY_AFTER_SECONDS, F as FacilitatorCallOptions, e as FacilitatorClient, f as FacilitatorClientOptions, g as FacilitatorErrorInfo, h as FacilitatorFailureFields, i as FacilitatorFetchOptions, H as HonoMiddlewareOptions, I as IDEMPOTENCY_KEY_HEADER, j as IDEMPOTENT_REPLAYED_HEADER, L as LIFECYCLE_ACTIONS, k as LIFECYCLE_DEFAULT_DEADLINE_SECS, l as LIFECYCLE_DOMAIN_NAME, m as LIFECYCLE_DOMAIN_VERSION, n as LIFECYCLE_MAX_DEADLINE_SECS, o as LIFECYCLE_ORDER_TYPES, p as LifecycleAction, q as LifecycleAuth, r as LifecyclePaymentInfo, s as LifecycleSigner, t as LifecycleTypedData, u as LifecycleTypedDataParams, M as MAX_RETRY_AFTER_SECONDS, P as ParsedFacilitatorErrorBody, v as PaymentAcceptance, w as PaymentConflictResponse, x as PaymentMiddlewareOptions, y as PaymentPayloadV2, z as PaymentRequirementsV2, R as RECEIPT_REQUEST_CONFLICT, C as REPLAYABLE_LEASE_REASONS, E as ResourceInfoV2, S as SETTLEMENT_UNCONFIRMED, G as SettleRequestV2, J as SettleResponse, V as VerifiedPaymentState, K as VerifyRequestV2, N as VerifyResponse, W as WRITER_LEASE_REASONS, O as WagmiLifecycleWalletClient, Q as WriterLeaseReason, X as X402_CORS_HEADERS, T as X402_HEADER_NAMES, U as buildLifecycleAuth, Y as buildLifecycleTypedData, Z as buildPaymentConflictResponse, _ as buildPaymentRequirements, $ as buildSettleRequest, a0 as buildSettleRequestForVersion, a1 as buildSettleRequestV2, a2 as buildVerifyRequest, a3 as buildVerifyRequestForVersion, a4 as buildVerifyRequestV2, a5 as create402Response, a6 as createHonoMiddleware, a7 as createIdempotencyKey, a8 as createPaymentMiddleware, a9 as extractPaymentFromHeaders, aa as facilitatorFetch, ab as getCorsHeaders, ac as isAmbiguousLeaseReason, ad as isAuthorizationAlreadyUsed, ae as isAuthorizationInFlight, af as isReplayableLeaseReason, ag as isSettlementUnconfirmed, ah as lifecycleAuthFromSignature, ai as parseFacilitatorErrorBody, aj as parseRetryAfterSeconds, ak as readFacilitatorError, al as resolveEnvelopeVersion, am as toPaymentRequirementsV2, an as toResourceInfoV2, ao as wagmiLifecycleSigner } from './index-BiL4seGs.js';
|
|
8
8
|
export { HEDERA_NETWORKS, HederaNetwork, HederaPaymentPayload, HederaProvider, HederaRequirements, buildHederaRequest, buildHederaRequirements, validateHederaRequirements } from './providers/hedera/index.js';
|
|
9
9
|
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';
|
|
10
10
|
|
|
@@ -1060,8 +1060,9 @@ declare function isDelegated(address: string, network: string, resolver?: Delega
|
|
|
1060
1060
|
* receiver fill" is on-chain unsound).
|
|
1061
1061
|
*
|
|
1062
1062
|
* Fail-loud policy: an incomplete network config, an unknown tier, a bounty
|
|
1063
|
-
* outside the on-chain deposit limit,
|
|
1064
|
-
* operator's static fee
|
|
1063
|
+
* outside the on-chain deposit limit, a `maxFeeBps` that cannot cover the
|
|
1064
|
+
* operator's static fee, or a USDC domain that contradicts
|
|
1065
|
+
* {@link VERIFIED_USDC_DOMAINS} all throw instead of falling back — a silent
|
|
1065
1066
|
* fallback would sign an EIP-3009 authorization with the WRONG EIP-712
|
|
1066
1067
|
* domain (chainId + verifyingContract): a mismatched, wallet-draining auth.
|
|
1067
1068
|
*
|
|
@@ -1201,6 +1202,26 @@ interface EscrowPaymentInfo {
|
|
|
1201
1202
|
/** 32-byte hex. */
|
|
1202
1203
|
salt: string;
|
|
1203
1204
|
}
|
|
1205
|
+
/**
|
|
1206
|
+
* USDC EIP-712 domains VERIFIED ON-CHAIN, per chain ID.
|
|
1207
|
+
*
|
|
1208
|
+
* `usdc_domain_name` / `usdc_domain_version` arrive with the server's config,
|
|
1209
|
+
* and they ARE the domain the authorization is signed under: a wrong pair
|
|
1210
|
+
* produces an authorization that never settles. For a chain in this table,
|
|
1211
|
+
* {@link buildEscrowPreAuth} refuses a config whose pair differs. A chain that
|
|
1212
|
+
* is not in the table is signed exactly as before.
|
|
1213
|
+
*
|
|
1214
|
+
* Only chains whose domain this SDK checked against the token's own
|
|
1215
|
+
* `DOMAIN_SEPARATOR()` are listed: Arc and Arc Testnet
|
|
1216
|
+
* (`src/fixtures/arc-escrow-d.rpc.json`, pinned by
|
|
1217
|
+
* `src/backend/escrow-arc-d.test.ts`). The values come from the chain
|
|
1218
|
+
* registry (`src/chains`), not typed again here. Mirrors the refusal policy of
|
|
1219
|
+
* the Python SDK's `escrow_signing.VERIFIED_USDC_DOMAINS`.
|
|
1220
|
+
*/
|
|
1221
|
+
declare const VERIFIED_USDC_DOMAINS: Record<number, {
|
|
1222
|
+
name: string;
|
|
1223
|
+
version: string;
|
|
1224
|
+
}>;
|
|
1204
1225
|
/**
|
|
1205
1226
|
* Compute the escrow EIP-3009 nonce = `AuthCaptureEscrow.getHash(paymentInfo)`.
|
|
1206
1227
|
*
|
|
@@ -1280,9 +1301,10 @@ interface EscrowPreAuthParams {
|
|
|
1280
1301
|
* `em_plugin_sdk.escrow_signing.build_escrow_pre_auth`.
|
|
1281
1302
|
*
|
|
1282
1303
|
* @throws {X402Error} `INVALID_CONFIG` on an incomplete network config,
|
|
1283
|
-
* unknown tier,
|
|
1284
|
-
* fee
|
|
1304
|
+
* unknown tier, a `maxFeeBps` that cannot cover the operator's static
|
|
1305
|
+
* fee, or a USDC domain that differs from {@link VERIFIED_USDC_DOMAINS};
|
|
1306
|
+
* `INVALID_AMOUNT` on a bounty outside (0, deposit limit].
|
|
1285
1307
|
*/
|
|
1286
1308
|
declare function buildEscrowPreAuth(wallet: EscrowPreAuthSigner, params: EscrowPreAuthParams): Promise<string>;
|
|
1287
1309
|
|
|
1288
|
-
export { ANCHOR_MAX_REQUEST_BYTES, type AnchorOptions, type AnchoredEvidence, type BackendOffer, ContentHashMismatch, type CreateSignedFetchConfig, DEFAULT_MAX_FEE_BPS, DEFAULT_MIN_FEE_BPS, DELEGATE_PREFIX, DX402Error, type DelegationResolver, type DelegationVerdict, type ERC8128RequestOptions, ESCROW_DEPOSIT_LIMIT_USD, ESCROW_TIER_WINDOWS, EVENT_KINDS, EVIDENCE_HEADER, type EscrowNetworkConfig, type EscrowPaymentInfo, type EscrowPreAuthParams, type EscrowPreAuthSigner, type EscrowTierWindows, type EvidenceMode, EvidenceSkipped, FACILITATOR_ADDRESSES, type FacilitatorAddresses, KEEPALIVE_INTERVAL_MS, MAX_PROTOCOL_FEE_BPS, OPERATOR_FEE_BPS, type RecipientRole, SMA_WRAP_TARGETS, type SSEFrame, SSEParser, type SignRequestOptions, type SignRequestWithSignerOptions, type SignatureBaseParams, type SignatureHeaders, type SignatureParamsInput, SigningWalletAdapter, type StreamTrafficEventsOptions, type TrafficEvent, type TrafficEventKind, TrafficStreamError, ZERO_ADDRESS, anchorDigest, anchorEvidence, availableBackends, buildEscrowPreAuth, buildSignatureBase, buildSignatureParams, computeEscrowNonce, contentHash, createSignedFetch, delegateTarget, dereferencePointer, paymentId as dx402PaymentId, ed25519ToX25519, evidenceFromHeaders, evidenceHeader, fetchNonce, getFacilitatorAddress, isDelegated, isEndToEnd, matchesFilters, needsAccountWrap, parseEvidenceHeader, parseSealed, parseTrafficEvent, payerKeyFromEvmSignature, payerKeyFromSolanaAddress, recoverEvidence, replaySafeTypedData, resolveDelegation, rpcDelegationResolver, sealEvidence, sealEvidenceTo, sealedRoles, sellerDigestFor, signAnchorEd25519, signAnchorEvm, signRequest, signRequestWithSigner, signRequestWithWallet, streamTrafficEvents, unseal, wrapSignature };
|
|
1310
|
+
export { ANCHOR_MAX_REQUEST_BYTES, type AnchorOptions, type AnchoredEvidence, type BackendOffer, ContentHashMismatch, type CreateSignedFetchConfig, DEFAULT_MAX_FEE_BPS, DEFAULT_MIN_FEE_BPS, DELEGATE_PREFIX, DX402Error, type DelegationResolver, type DelegationVerdict, type ERC8128RequestOptions, ESCROW_DEPOSIT_LIMIT_USD, ESCROW_TIER_WINDOWS, EVENT_KINDS, EVIDENCE_HEADER, type EscrowNetworkConfig, type EscrowPaymentInfo, type EscrowPreAuthParams, type EscrowPreAuthSigner, type EscrowTierWindows, type EvidenceMode, EvidenceSkipped, FACILITATOR_ADDRESSES, type FacilitatorAddresses, KEEPALIVE_INTERVAL_MS, MAX_PROTOCOL_FEE_BPS, OPERATOR_FEE_BPS, type RecipientRole, SMA_WRAP_TARGETS, type SSEFrame, SSEParser, type SignRequestOptions, type SignRequestWithSignerOptions, type SignatureBaseParams, type SignatureHeaders, type SignatureParamsInput, SigningWalletAdapter, type StreamTrafficEventsOptions, type TrafficEvent, type TrafficEventKind, TrafficStreamError, VERIFIED_USDC_DOMAINS, ZERO_ADDRESS, anchorDigest, anchorEvidence, availableBackends, buildEscrowPreAuth, buildSignatureBase, buildSignatureParams, computeEscrowNonce, contentHash, createSignedFetch, delegateTarget, dereferencePointer, paymentId as dx402PaymentId, ed25519ToX25519, evidenceFromHeaders, evidenceHeader, fetchNonce, getFacilitatorAddress, isDelegated, isEndToEnd, matchesFilters, needsAccountWrap, parseEvidenceHeader, parseSealed, parseTrafficEvent, payerKeyFromEvmSignature, payerKeyFromSolanaAddress, recoverEvidence, replaySafeTypedData, resolveDelegation, rpcDelegationResolver, sealEvidence, sealEvidenceTo, sealedRoles, sellerDigestFor, signAnchorEd25519, signAnchorEvm, signRequest, signRequestWithSigner, signRequestWithWallet, streamTrafficEvents, unseal, wrapSignature };
|
package/dist/index.js
CHANGED
|
@@ -5038,6 +5038,7 @@ function buildSignatureParams(params) {
|
|
|
5038
5038
|
}
|
|
5039
5039
|
|
|
5040
5040
|
// src/escrow-preauth.ts
|
|
5041
|
+
init_chains();
|
|
5041
5042
|
init_types();
|
|
5042
5043
|
|
|
5043
5044
|
// src/erc7702.ts
|
|
@@ -5145,6 +5146,13 @@ var ESCROW_TIER_WINDOWS = {
|
|
|
5145
5146
|
};
|
|
5146
5147
|
var REVIEW_WINDOW_SEC = 7 * 24 * 3600;
|
|
5147
5148
|
var REFUND_WINDOW_SEC = 7 * 24 * 3600;
|
|
5149
|
+
var VERIFIED_USDC_DOMAINS = Object.fromEntries(
|
|
5150
|
+
["arc", "arc-testnet"].map((network) => {
|
|
5151
|
+
const chain = getChainByName(network);
|
|
5152
|
+
if (!chain) throw new Error(`The chain registry has no '${network}'.`);
|
|
5153
|
+
return [chain.chainId, { name: chain.usdc.name, version: chain.usdc.version }];
|
|
5154
|
+
})
|
|
5155
|
+
);
|
|
5148
5156
|
var REQUIRED_NETWORK_KEYS = [
|
|
5149
5157
|
"chain_id",
|
|
5150
5158
|
"operator",
|
|
@@ -5210,6 +5218,13 @@ async function buildEscrowPreAuth(wallet, params) {
|
|
|
5210
5218
|
"INVALID_CONFIG"
|
|
5211
5219
|
);
|
|
5212
5220
|
}
|
|
5221
|
+
const verified = VERIFIED_USDC_DOMAINS[cfg.chain_id];
|
|
5222
|
+
if (verified && (cfg.usdc_domain_name !== verified.name || cfg.usdc_domain_version !== verified.version)) {
|
|
5223
|
+
throw new exports.X402Error(
|
|
5224
|
+
`The escrow config gives chain ${cfg.chain_id} the USDC domain '${cfg.usdc_domain_name}' / '${cfg.usdc_domain_version}', but the token's on-chain domain is '${verified.name}' / '${verified.version}' \u2014 refusing to sign an authorization that could never settle.`,
|
|
5225
|
+
"INVALID_CONFIG"
|
|
5226
|
+
);
|
|
5227
|
+
}
|
|
5213
5228
|
const maxAmount = BigInt(params.bountyAtomic);
|
|
5214
5229
|
if (maxAmount <= 0n) {
|
|
5215
5230
|
throw new exports.X402Error(
|
|
@@ -7118,6 +7133,28 @@ var ESCROW_TIMEOUT_MS = {
|
|
|
7118
7133
|
143: 9e4
|
|
7119
7134
|
// Monad: 90s
|
|
7120
7135
|
};
|
|
7136
|
+
function arcUsdc(network) {
|
|
7137
|
+
const chain = getChainByName(network);
|
|
7138
|
+
if (!chain) throw new Error(`The chain registry has no '${network}'.`);
|
|
7139
|
+
return chain.usdc;
|
|
7140
|
+
}
|
|
7141
|
+
({
|
|
7142
|
+
// Monad
|
|
7143
|
+
5042: arcUsdc("arc").name,
|
|
7144
|
+
// Arc ('USDC', from src/chains)
|
|
7145
|
+
5042002: arcUsdc("arc-testnet").name
|
|
7146
|
+
// Arc Testnet ('USDC', from src/chains)
|
|
7147
|
+
});
|
|
7148
|
+
({
|
|
7149
|
+
// Arc (chain 5042) - x402r canonical escrow, 'v3' operator
|
|
7150
|
+
5042: {
|
|
7151
|
+
usdc: arcUsdc("arc").address
|
|
7152
|
+
},
|
|
7153
|
+
// Arc Testnet (chain 5042002) - same canonical addresses as Arc
|
|
7154
|
+
5042002: {
|
|
7155
|
+
usdc: arcUsdc("arc-testnet").address
|
|
7156
|
+
}
|
|
7157
|
+
});
|
|
7121
7158
|
|
|
7122
7159
|
exports.AMBIGUOUS_LEASE_REASONS = AMBIGUOUS_LEASE_REASONS;
|
|
7123
7160
|
exports.ANCHOR_MAX_REQUEST_BYTES = ANCHOR_MAX_REQUEST_BYTES;
|
|
@@ -7163,6 +7200,7 @@ exports.SETTLEMENT_UNCONFIRMED = SETTLEMENT_UNCONFIRMED;
|
|
|
7163
7200
|
exports.SMA_WRAP_TARGETS = SMA_WRAP_TARGETS;
|
|
7164
7201
|
exports.SSEParser = SSEParser;
|
|
7165
7202
|
exports.TrafficStreamError = TrafficStreamError;
|
|
7203
|
+
exports.VERIFIED_USDC_DOMAINS = VERIFIED_USDC_DOMAINS;
|
|
7166
7204
|
exports.WRITER_LEASE_REASONS = WRITER_LEASE_REASONS;
|
|
7167
7205
|
exports.X402Client = X402Client;
|
|
7168
7206
|
exports.X402_CORS_HEADERS = X402_CORS_HEADERS;
|