uvd-x402-sdk 2.43.0 → 2.44.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 +31 -0
- package/dist/adapters/index.d.mts +1 -1
- package/dist/adapters/index.d.ts +1 -1
- package/dist/backend/index.d.mts +89 -2
- package/dist/backend/index.d.ts +89 -2
- package/dist/backend/index.js +26 -1
- package/dist/backend/index.js.map +1 -1
- package/dist/backend/index.mjs +25 -2
- package/dist/backend/index.mjs.map +1 -1
- package/dist/{index-Bw4S80Ph.d.mts → index-BidnFGw_.d.mts} +1 -1
- package/dist/{index-NDRI_c7e.d.mts → index-DgChnK_c.d.mts} +1 -1
- package/dist/{index-NDRI_c7e.d.ts → index-DgChnK_c.d.ts} +1 -1
- package/dist/{index-Dgus5K-7.d.ts → index-H64xdjKh.d.ts} +1 -1
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +26 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +25 -2
- package/dist/index.mjs.map +1 -1
- package/dist/providers/algorand/index.d.mts +1 -1
- package/dist/providers/algorand/index.d.ts +1 -1
- package/dist/providers/evm/index.d.mts +1 -1
- package/dist/providers/evm/index.d.ts +1 -1
- package/dist/providers/near/index.d.mts +1 -1
- package/dist/providers/near/index.d.ts +1 -1
- package/dist/providers/solana/index.d.mts +1 -1
- package/dist/providers/solana/index.d.ts +1 -1
- package/dist/providers/stellar/index.d.mts +1 -1
- package/dist/providers/stellar/index.d.ts +1 -1
- package/dist/providers/sui/index.d.mts +1 -1
- package/dist/providers/sui/index.d.ts +1 -1
- package/dist/providers/xrpl/index.d.mts +1 -1
- package/dist/providers/xrpl/index.d.ts +1 -1
- package/dist/react/index.d.mts +3 -3
- package/dist/react/index.d.ts +3 -3
- package/dist/utils/index.d.mts +1 -1
- package/dist/utils/index.d.ts +1 -1
- package/package.json +1 -1
- package/src/backend/index.ts +130 -1
- package/src/index.ts +7 -0
package/dist/backend/index.mjs
CHANGED
|
@@ -1094,6 +1094,22 @@ function buildVerifyRequest(paymentHeader, requirements) {
|
|
|
1094
1094
|
paymentRequirements: requirements
|
|
1095
1095
|
};
|
|
1096
1096
|
}
|
|
1097
|
+
function buildV2Envelope(payload, resource, accepted) {
|
|
1098
|
+
return {
|
|
1099
|
+
x402Version: 2,
|
|
1100
|
+
// The facilitator reads the payload from here; `resource` and `accepted` are
|
|
1101
|
+
// repeated at the top level because the v2 envelope declares both.
|
|
1102
|
+
paymentPayload: { x402Version: 2, resource, accepted, payload },
|
|
1103
|
+
resource,
|
|
1104
|
+
accepted
|
|
1105
|
+
};
|
|
1106
|
+
}
|
|
1107
|
+
function buildVerifyRequestV2(payload, resource, accepted) {
|
|
1108
|
+
return buildV2Envelope(payload, resource, accepted);
|
|
1109
|
+
}
|
|
1110
|
+
function buildSettleRequestV2(payload, resource, accepted) {
|
|
1111
|
+
return buildV2Envelope(payload, resource, accepted);
|
|
1112
|
+
}
|
|
1097
1113
|
function buildSettleRequest(paymentHeader, requirements) {
|
|
1098
1114
|
return {
|
|
1099
1115
|
x402Version: paymentHeader.x402Version,
|
|
@@ -1423,7 +1439,9 @@ function buildRequirementFromAcceptance(accept, resource, version, defaults) {
|
|
|
1423
1439
|
throw new Error("Payment accepts entries must include payTo");
|
|
1424
1440
|
}
|
|
1425
1441
|
return normalizeRequirementForVersion({
|
|
1426
|
-
scheme
|
|
1442
|
+
// Honour a caller-supplied scheme; 'exact' is the default, not an override.
|
|
1443
|
+
// Hardcoding it silently discarded 'escrow' / 'commerce' accepts.
|
|
1444
|
+
scheme: accept.scheme ?? "exact",
|
|
1427
1445
|
network: accept.network,
|
|
1428
1446
|
maxAmountRequired: accept.amount,
|
|
1429
1447
|
resource: accept.resource ?? defaults?.resource ?? resource,
|
|
@@ -1441,6 +1459,11 @@ function toPaymentAcceptance(requirements, facilitator) {
|
|
|
1441
1459
|
network: requirements.network,
|
|
1442
1460
|
asset: requirements.asset,
|
|
1443
1461
|
amount: requirements.maxAmountRequired,
|
|
1462
|
+
// scheme is REQUIRED by the facilitator's v2 PaymentRequirementsV2. Dropping it
|
|
1463
|
+
// here produced an accepts[] entry that no v2 client could pay: the spec makes
|
|
1464
|
+
// the client echo the accept verbatim, so the omission travelled downstream and
|
|
1465
|
+
// died in deserialization with an error naming no field.
|
|
1466
|
+
scheme: requirements.scheme,
|
|
1444
1467
|
payTo: requirements.payTo,
|
|
1445
1468
|
resource: requirements.resource,
|
|
1446
1469
|
description: requirements.description,
|
|
@@ -3860,6 +3883,6 @@ var AdvancedEscrowClient = class {
|
|
|
3860
3883
|
}
|
|
3861
3884
|
};
|
|
3862
3885
|
|
|
3863
|
-
export { AdvancedEscrowClient, BASE_MAINNET_CONTRACTS, BazaarClient, DEPOSIT_LIMIT_USDC, ERC8004_CONTRACTS, ERC8004_EXTENSION_ID, ESCROW_CONTRACTS, ESCROW_TIMEOUT_MS, Erc8004Client, EscrowClient, FacilitatorClient, HEALTH_FILTERS, MAX_SEARCH_LEN, OPERATOR_ABI, OPERATOR_ABI_CREATE3, PAYMENT_INFO_TYPEHASH, TIER_FILTERS, TIER_TIMINGS, USDC_DOMAIN_NAME, X402_CORS_HEADERS, X402_HEADER_NAMES, ZERO_ADDRESS, buildErc8004PaymentRequirements, buildPaymentRequirements, buildSettleRequest, buildVerifyRequest, canRefundEscrow, canReleaseEscrow, create402Response, createHonoMiddleware, createPaymentMiddleware, epochToDate, escrowTimeRemaining, extractPaymentFromHeaders, getCorsHeaders, getEscrowContractsByChainId, getEscrowSupportedChainIds, isAlive, isEscrowExpired, isEscrowSupportedOnChain, parsePaymentHeader };
|
|
3886
|
+
export { AdvancedEscrowClient, BASE_MAINNET_CONTRACTS, BazaarClient, DEPOSIT_LIMIT_USDC, ERC8004_CONTRACTS, ERC8004_EXTENSION_ID, ESCROW_CONTRACTS, ESCROW_TIMEOUT_MS, Erc8004Client, EscrowClient, FacilitatorClient, HEALTH_FILTERS, MAX_SEARCH_LEN, OPERATOR_ABI, OPERATOR_ABI_CREATE3, PAYMENT_INFO_TYPEHASH, TIER_FILTERS, TIER_TIMINGS, USDC_DOMAIN_NAME, X402_CORS_HEADERS, X402_HEADER_NAMES, ZERO_ADDRESS, buildErc8004PaymentRequirements, buildPaymentRequirements, buildSettleRequest, buildSettleRequestV2, buildVerifyRequest, buildVerifyRequestV2, canRefundEscrow, canReleaseEscrow, create402Response, createHonoMiddleware, createPaymentMiddleware, epochToDate, escrowTimeRemaining, extractPaymentFromHeaders, getCorsHeaders, getEscrowContractsByChainId, getEscrowSupportedChainIds, isAlive, isEscrowExpired, isEscrowSupportedOnChain, parsePaymentHeader };
|
|
3864
3887
|
//# sourceMappingURL=index.mjs.map
|
|
3865
3888
|
//# sourceMappingURL=index.mjs.map
|