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 +13 -8
- package/dist/backend/index.d.mts +1 -1
- package/dist/backend/index.d.ts +1 -1
- package/dist/backend/index.js +238 -6
- package/dist/backend/index.js.map +1 -1
- package/dist/backend/index.mjs +232 -7
- package/dist/backend/index.mjs.map +1 -1
- package/dist/{index-DNTFp6WT.d.ts → index-BiL4seGs.d.ts} +124 -7
- package/dist/{index-ClOAmprt.d.mts → index-SaqboHsK.d.mts} +124 -7
- 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 +343 -15
- 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
package/dist/index.mjs
CHANGED
|
@@ -5036,6 +5036,7 @@ function buildSignatureParams(params) {
|
|
|
5036
5036
|
}
|
|
5037
5037
|
|
|
5038
5038
|
// src/escrow-preauth.ts
|
|
5039
|
+
init_chains();
|
|
5039
5040
|
init_types();
|
|
5040
5041
|
|
|
5041
5042
|
// src/erc7702.ts
|
|
@@ -5143,6 +5144,13 @@ var ESCROW_TIER_WINDOWS = {
|
|
|
5143
5144
|
};
|
|
5144
5145
|
var REVIEW_WINDOW_SEC = 7 * 24 * 3600;
|
|
5145
5146
|
var REFUND_WINDOW_SEC = 7 * 24 * 3600;
|
|
5147
|
+
var VERIFIED_USDC_DOMAINS = Object.fromEntries(
|
|
5148
|
+
["arc", "arc-testnet"].map((network) => {
|
|
5149
|
+
const chain = getChainByName(network);
|
|
5150
|
+
if (!chain) throw new Error(`The chain registry has no '${network}'.`);
|
|
5151
|
+
return [chain.chainId, { name: chain.usdc.name, version: chain.usdc.version }];
|
|
5152
|
+
})
|
|
5153
|
+
);
|
|
5146
5154
|
var REQUIRED_NETWORK_KEYS = [
|
|
5147
5155
|
"chain_id",
|
|
5148
5156
|
"operator",
|
|
@@ -5208,6 +5216,13 @@ async function buildEscrowPreAuth(wallet, params) {
|
|
|
5208
5216
|
"INVALID_CONFIG"
|
|
5209
5217
|
);
|
|
5210
5218
|
}
|
|
5219
|
+
const verified = VERIFIED_USDC_DOMAINS[cfg.chain_id];
|
|
5220
|
+
if (verified && (cfg.usdc_domain_name !== verified.name || cfg.usdc_domain_version !== verified.version)) {
|
|
5221
|
+
throw new X402Error(
|
|
5222
|
+
`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.`,
|
|
5223
|
+
"INVALID_CONFIG"
|
|
5224
|
+
);
|
|
5225
|
+
}
|
|
5211
5226
|
const maxAmount = BigInt(params.bountyAtomic);
|
|
5212
5227
|
if (maxAmount <= 0n) {
|
|
5213
5228
|
throw new X402Error(
|
|
@@ -7116,7 +7131,29 @@ var ESCROW_TIMEOUT_MS = {
|
|
|
7116
7131
|
143: 9e4
|
|
7117
7132
|
// Monad: 90s
|
|
7118
7133
|
};
|
|
7134
|
+
function arcUsdc(network) {
|
|
7135
|
+
const chain = getChainByName(network);
|
|
7136
|
+
if (!chain) throw new Error(`The chain registry has no '${network}'.`);
|
|
7137
|
+
return chain.usdc;
|
|
7138
|
+
}
|
|
7139
|
+
({
|
|
7140
|
+
// Monad
|
|
7141
|
+
5042: arcUsdc("arc").name,
|
|
7142
|
+
// Arc ('USDC', from src/chains)
|
|
7143
|
+
5042002: arcUsdc("arc-testnet").name
|
|
7144
|
+
// Arc Testnet ('USDC', from src/chains)
|
|
7145
|
+
});
|
|
7146
|
+
({
|
|
7147
|
+
// Arc (chain 5042) - x402r canonical escrow, 'v3' operator
|
|
7148
|
+
5042: {
|
|
7149
|
+
usdc: arcUsdc("arc").address
|
|
7150
|
+
},
|
|
7151
|
+
// Arc Testnet (chain 5042002) - same canonical addresses as Arc
|
|
7152
|
+
5042002: {
|
|
7153
|
+
usdc: arcUsdc("arc-testnet").address
|
|
7154
|
+
}
|
|
7155
|
+
});
|
|
7119
7156
|
|
|
7120
|
-
export { AMBIGUOUS_LEASE_REASONS, ANCHOR_MAX_REQUEST_BYTES, AUTHORIZATION_ALREADY_SETTLED, AUTHORIZATION_IN_FLIGHT, CAIP2_IDENTIFIERS, CAIP2_TO_CHAIN, ContentHashMismatch, DEFAULT_CHAIN, DEFAULT_CONFIG, DEFAULT_FACILITATOR_RETRIES, DEFAULT_FACILITATOR_URL, DEFAULT_MAX_FEE_BPS, DEFAULT_MIN_FEE_BPS, DEFAULT_PAYMENT_HEADER, DEFAULT_RETRY_AFTER_SECONDS, DEFAULT_VALIDITY_SECONDS, DELEGATE_PREFIX, DX402Error, ESCROW_DEPOSIT_LIMIT_USD, ESCROW_TIER_WINDOWS, EVENT_KINDS, EVIDENCE_HEADER, EnvKeyAdapter, EvidenceSkipped, FACILITATOR_ADDRESSES, FacilitatorClient, HEDERA_NETWORKS, HederaProvider, IDEMPOTENCY_KEY_HEADER, IDEMPOTENT_REPLAYED_HEADER, KEEPALIVE_INTERVAL_MS, LIFECYCLE_ACTIONS, LIFECYCLE_DEFAULT_DEADLINE_SECS, LIFECYCLE_DOMAIN_NAME, LIFECYCLE_DOMAIN_VERSION, LIFECYCLE_MAX_DEADLINE_SECS, LIFECYCLE_ORDER_TYPES, MAX_PROTOCOL_FEE_BPS, MAX_RETRY_AFTER_SECONDS, MAX_VALIDITY_SECONDS, OFFER_VALIDITY_EXTENSION, OPERATOR_FEE_BPS, OWSWalletAdapter, PAYMENT_HEADER_NAMES, PolicyRefusedError, PurchasePolicy, RECEIPT_ISSUER, RECEIPT_REQUEST_CONFLICT, REPLAYABLE_LEASE_REASONS, SETTLEMENT_UNCONFIRMED, SMA_WRAP_TARGETS, SSEParser, SUPPORTED_CHAINS, TrafficStreamError, WRITER_LEASE_REASONS, X402Client, X402Error, X402_CORS_HEADERS, X402_HEADER_NAMES, ZERO_ADDRESS, anchorDigest, anchorEvidence, assetKey, availableBackends, buildEscrowPreAuth, buildHederaRequest, buildHederaRequirements, buildLifecycleAuth, buildLifecycleTypedData, buildPaymentConflictResponse, buildPaymentRequirements, buildSettleRequest, buildSettleRequestForVersion, buildSettleRequestV2, buildSignatureBase, buildSignatureParams, buildTokenMetadata, buildVerifyRequest, buildVerifyRequestForVersion, buildVerifyRequestV2, caip2ToChain, canonicalReceiptJson, canonicalRecipient, chainToCAIP2, clampValiditySeconds, computeEscrowNonce, contentHash, convertX402Header, create402Response, createHonoMiddleware, createIdempotencyKey, createPaymentHeaders, createPaymentMiddleware, createPurchaseContext, createSignedFetch, createX402Header, createX402V1Header, createX402V2Header, decideOnChallenge, decodeBase64Utf8, decodeX402Header, delegateTarget, dereferencePointer, detectX402Version, paymentId as dx402PaymentId, ed25519ToX25519, encodeBase64Json, encodeBase64Utf8, encodeX402Header, evidenceFromHeaders, evidenceHeader, extractPaymentFromHeaders, facilitatorFetch, fetchNonce, fetchWithReceipt, generatePaymentOptions, getAlgorandChains, getChainById, getChainByName, getChainsByNetworkType, getChainsByToken, getCorsHeaders, getEVMChainIds, getEnabledChains, getExplorerAddressUrl, getExplorerTxUrl, getFacilitatorAddress, getFacilitatorReceipt, getNetworkType, getPaymentHeader, getSVMChains, getSuiChains, getSupportedTokens, getTokenByAddress, getTokenConfig, getXRPLChains, isAlgorandChain, isAmbiguousLeaseReason, isAuthorizationAlreadyUsed, isAuthorizationInFlight, isCAIP2Format, isChainSupported, isDelegated, isEndToEnd, isReplayableLeaseReason, isSVMChain, isSettlementUnconfirmed, isSuiChain, isTokenSupported, isXRPLChain, lifecycleAuthFromSignature, matchesFilters, mergeHeaderList, mergePaymentResponseHeaders, needsAccountWrap, noReadableOffer, offerAsset, offerValidUntil, parseEvidenceHeader, parseFacilitatorErrorBody, parseFacilitatorReceipt, parseNetworkIdentifier, parseRetryAfterSeconds, parseSealed, parseTrafficEvent, payerKeyFromEvmSignature, payerKeyFromSolanaAddress, paymentChallengeFrom, paymentResponseHeaders, purchaseContextHeader, readFacilitatorError, receiptCommitment, receiptFromErrorBody, receiptFromResponse, recoverEvidence, replaySafeTypedData, resolveDelegation, resolveEnvelopeVersion, resolveValiditySeconds, rpcDelegationResolver, sealEvidence, sealEvidenceTo, sealedRoles, sellerDigestFor, signAnchorEd25519, signAnchorEvm, signRequest, signRequestWithSigner, signRequestWithWallet, streamTrafficEvents, toPaymentRequirementsV2, toResourceInfoV2, unseal, validateAmount, validateHederaRequirements, validatePurchaseContext, validateRecipient, verifyFacilitatorReceipt, wagmiLifecycleSigner, wrapSignature };
|
|
7157
|
+
export { AMBIGUOUS_LEASE_REASONS, ANCHOR_MAX_REQUEST_BYTES, AUTHORIZATION_ALREADY_SETTLED, AUTHORIZATION_IN_FLIGHT, CAIP2_IDENTIFIERS, CAIP2_TO_CHAIN, ContentHashMismatch, DEFAULT_CHAIN, DEFAULT_CONFIG, DEFAULT_FACILITATOR_RETRIES, DEFAULT_FACILITATOR_URL, DEFAULT_MAX_FEE_BPS, DEFAULT_MIN_FEE_BPS, DEFAULT_PAYMENT_HEADER, DEFAULT_RETRY_AFTER_SECONDS, DEFAULT_VALIDITY_SECONDS, DELEGATE_PREFIX, DX402Error, ESCROW_DEPOSIT_LIMIT_USD, ESCROW_TIER_WINDOWS, EVENT_KINDS, EVIDENCE_HEADER, EnvKeyAdapter, EvidenceSkipped, FACILITATOR_ADDRESSES, FacilitatorClient, HEDERA_NETWORKS, HederaProvider, IDEMPOTENCY_KEY_HEADER, IDEMPOTENT_REPLAYED_HEADER, KEEPALIVE_INTERVAL_MS, LIFECYCLE_ACTIONS, LIFECYCLE_DEFAULT_DEADLINE_SECS, LIFECYCLE_DOMAIN_NAME, LIFECYCLE_DOMAIN_VERSION, LIFECYCLE_MAX_DEADLINE_SECS, LIFECYCLE_ORDER_TYPES, MAX_PROTOCOL_FEE_BPS, MAX_RETRY_AFTER_SECONDS, MAX_VALIDITY_SECONDS, OFFER_VALIDITY_EXTENSION, OPERATOR_FEE_BPS, OWSWalletAdapter, PAYMENT_HEADER_NAMES, PolicyRefusedError, PurchasePolicy, RECEIPT_ISSUER, RECEIPT_REQUEST_CONFLICT, REPLAYABLE_LEASE_REASONS, SETTLEMENT_UNCONFIRMED, SMA_WRAP_TARGETS, SSEParser, SUPPORTED_CHAINS, TrafficStreamError, VERIFIED_USDC_DOMAINS, WRITER_LEASE_REASONS, X402Client, X402Error, X402_CORS_HEADERS, X402_HEADER_NAMES, ZERO_ADDRESS, anchorDigest, anchorEvidence, assetKey, availableBackends, buildEscrowPreAuth, buildHederaRequest, buildHederaRequirements, buildLifecycleAuth, buildLifecycleTypedData, buildPaymentConflictResponse, buildPaymentRequirements, buildSettleRequest, buildSettleRequestForVersion, buildSettleRequestV2, buildSignatureBase, buildSignatureParams, buildTokenMetadata, buildVerifyRequest, buildVerifyRequestForVersion, buildVerifyRequestV2, caip2ToChain, canonicalReceiptJson, canonicalRecipient, chainToCAIP2, clampValiditySeconds, computeEscrowNonce, contentHash, convertX402Header, create402Response, createHonoMiddleware, createIdempotencyKey, createPaymentHeaders, createPaymentMiddleware, createPurchaseContext, createSignedFetch, createX402Header, createX402V1Header, createX402V2Header, decideOnChallenge, decodeBase64Utf8, decodeX402Header, delegateTarget, dereferencePointer, detectX402Version, paymentId as dx402PaymentId, ed25519ToX25519, encodeBase64Json, encodeBase64Utf8, encodeX402Header, evidenceFromHeaders, evidenceHeader, extractPaymentFromHeaders, facilitatorFetch, fetchNonce, fetchWithReceipt, generatePaymentOptions, getAlgorandChains, getChainById, getChainByName, getChainsByNetworkType, getChainsByToken, getCorsHeaders, getEVMChainIds, getEnabledChains, getExplorerAddressUrl, getExplorerTxUrl, getFacilitatorAddress, getFacilitatorReceipt, getNetworkType, getPaymentHeader, getSVMChains, getSuiChains, getSupportedTokens, getTokenByAddress, getTokenConfig, getXRPLChains, isAlgorandChain, isAmbiguousLeaseReason, isAuthorizationAlreadyUsed, isAuthorizationInFlight, isCAIP2Format, isChainSupported, isDelegated, isEndToEnd, isReplayableLeaseReason, isSVMChain, isSettlementUnconfirmed, isSuiChain, isTokenSupported, isXRPLChain, lifecycleAuthFromSignature, matchesFilters, mergeHeaderList, mergePaymentResponseHeaders, needsAccountWrap, noReadableOffer, offerAsset, offerValidUntil, parseEvidenceHeader, parseFacilitatorErrorBody, parseFacilitatorReceipt, parseNetworkIdentifier, parseRetryAfterSeconds, parseSealed, parseTrafficEvent, payerKeyFromEvmSignature, payerKeyFromSolanaAddress, paymentChallengeFrom, paymentResponseHeaders, purchaseContextHeader, readFacilitatorError, receiptCommitment, receiptFromErrorBody, receiptFromResponse, recoverEvidence, replaySafeTypedData, resolveDelegation, resolveEnvelopeVersion, resolveValiditySeconds, rpcDelegationResolver, sealEvidence, sealEvidenceTo, sealedRoles, sellerDigestFor, signAnchorEd25519, signAnchorEvm, signRequest, signRequestWithSigner, signRequestWithWallet, streamTrafficEvents, toPaymentRequirementsV2, toResourceInfoV2, unseal, validateAmount, validateHederaRequirements, validatePurchaseContext, validateRecipient, verifyFacilitatorReceipt, wagmiLifecycleSigner, wrapSignature };
|
|
7121
7158
|
//# sourceMappingURL=index.mjs.map
|
|
7122
7159
|
//# sourceMappingURL=index.mjs.map
|