@zkp2p/sdk 0.5.0 → 0.5.4
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 +10 -6
- package/dist/{chunk-LPJE2MN7.mjs → chunk-TGMRXUP2.mjs} +28 -3
- package/dist/chunk-TGMRXUP2.mjs.map +1 -0
- package/dist/{chunk-L526MKG3.mjs → chunk-VJ33XYCV.mjs} +123 -128
- package/dist/{chunk-L526MKG3.mjs.map → chunk-VJ33XYCV.mjs.map} +1 -1
- package/dist/index.cjs +401 -397
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +44 -21
- package/dist/index.d.ts +44 -21
- package/dist/index.mjs +200 -209
- package/dist/index.mjs.map +1 -1
- package/dist/protocolViewerParsers-XN63B2S5.mjs +5 -0
- package/dist/{protocolViewerParsers-GGSM2243.mjs.map → protocolViewerParsers-XN63B2S5.mjs.map} +1 -1
- package/dist/react.cjs +31 -16
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.mts +2 -2
- package/dist/react.d.ts +2 -2
- package/dist/react.mjs +6 -18
- package/dist/react.mjs.map +1 -1
- package/dist/{vaultUtils-BL8tzsmH.d.mts → vaultUtils-DOOl9QUP.d.mts} +35 -67
- package/dist/{vaultUtils-BL8tzsmH.d.ts → vaultUtils-DOOl9QUP.d.ts} +35 -67
- package/package.json +3 -3
- package/dist/chunk-LPJE2MN7.mjs.map +0 -1
- package/dist/protocolViewerParsers-GGSM2243.mjs +0 -5
package/dist/index.mjs
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
export { ZERO_RATE_MANAGER_ID, classifyDelegationState, getDelegationRoute, isZeroRateManagerId, normalizeRateManagerId, normalizeRegistry } from './chunk-
|
|
1
|
+
export { TAKER_TIER_CAPS, TAKER_TIER_ORDER, TAKER_TIER_SCHEDULE, ZERO_RATE_MANAGER_ID, classifyDelegationState, getDelegationRoute, getNextTakerTier, isZeroRateManagerId, normalizeRateManagerId, normalizeRegistry } from './chunk-TGMRXUP2.mjs';
|
|
2
2
|
import { APIError, NetworkError, ValidationError } from './chunk-GHQK65J2.mjs';
|
|
3
3
|
export { APIError, ContractError, ErrorCode, NetworkError, ValidationError, ZKP2PError } from './chunk-GHQK65J2.mjs';
|
|
4
|
-
import { getContracts, getRateManagerContracts, getPaymentMethodsCatalog, resolvePaymentMethodHashFromCatalog, getGatingServiceAddress, parseBigIntLike, resolveFiatCurrencyBytes32, resolvePaymentMethodNameFromHash } from './chunk-
|
|
5
|
-
export { asciiToBytes32, enrichPvDepositView, enrichPvIntentView, ensureBytes32, getContracts, getGatingServiceAddress, getPaymentMethodsCatalog, getRateManagerContracts, parseDepositView, parseIntentView, resolveFiatCurrencyBytes32, resolvePaymentMethodHash, resolvePaymentMethodHashFromCatalog, resolvePaymentMethodNameFromHash } from './chunk-
|
|
4
|
+
import { getContracts, getRateManagerContracts, getPaymentMethodsCatalog, resolvePaymentMethodHashFromCatalog, getGatingServiceAddress, parseBigIntLike, resolveFiatCurrencyBytes32, resolvePaymentMethodNameFromHash } from './chunk-VJ33XYCV.mjs';
|
|
5
|
+
export { asciiToBytes32, enrichPvDepositView, enrichPvIntentView, ensureBytes32, getContracts, getGatingServiceAddress, getPaymentMethodsCatalog, getRateManagerContracts, parseDepositView, parseIntentView, resolveFiatCurrencyBytes32, resolvePaymentMethodHash, resolvePaymentMethodHashFromCatalog, resolvePaymentMethodNameFromHash } from './chunk-VJ33XYCV.mjs';
|
|
6
6
|
import { Currency, currencyKeccak256 } from './chunk-ZFBH4HD7.mjs';
|
|
7
7
|
export { Currency, currencyInfo, getCurrencyCodeFromHash, getCurrencyInfoFromCountryCode, getCurrencyInfoFromHash, isSupportedCurrencyHash, mapConversionRatesToOnchainMinRate } from './chunk-ZFBH4HD7.mjs';
|
|
8
8
|
import './chunk-J5LGTIGS.mjs';
|
|
9
9
|
import { concatHex, encodeFunctionData, encodeAbiParameters, createPublicClient, http, formatUnits } from 'viem';
|
|
10
10
|
import { hardhat, base } from 'viem/chains';
|
|
11
11
|
import { createEncryptedBuyerTeeSessionMaterial as createEncryptedBuyerTeeSessionMaterial$1, createEncryptedSellerCredentialUpload } from '@zkp2p/zkp2p-attestation';
|
|
12
|
+
export { createNitroAttestationClient } from '@zkp2p/zkp2p-attestation';
|
|
12
13
|
import { AbiCoder } from 'ethers';
|
|
13
14
|
import { Attribution } from 'ox/erc8021';
|
|
14
15
|
|
|
@@ -364,13 +365,6 @@ async function withRetry(fn, maxRetries = 3, delayMs = 1e3, timeoutMs) {
|
|
|
364
365
|
}
|
|
365
366
|
|
|
366
367
|
// src/adapters/verification.ts
|
|
367
|
-
function createHeaders(apiKey, authorizationToken) {
|
|
368
|
-
const headers2 = { "Content-Type": "application/json" };
|
|
369
|
-
if (apiKey) headers2["x-api-key"] = apiKey;
|
|
370
|
-
if (authorizationToken)
|
|
371
|
-
headers2["Authorization"] = authorizationToken.startsWith("Bearer ") ? authorizationToken : `Bearer ${authorizationToken}`;
|
|
372
|
-
return headers2;
|
|
373
|
-
}
|
|
374
368
|
async function apiSignIntentV3(request, opts) {
|
|
375
369
|
const url = `${opts.baseApiUrl.replace(/\/$/, "")}/v3/intent/sign`;
|
|
376
370
|
const json = await withRetry(
|
|
@@ -379,7 +373,7 @@ async function apiSignIntentV3(request, opts) {
|
|
|
379
373
|
try {
|
|
380
374
|
res = await fetch(url, {
|
|
381
375
|
method: "POST",
|
|
382
|
-
headers:
|
|
376
|
+
headers: { "Content-Type": "application/json" },
|
|
383
377
|
body: JSON.stringify(request)
|
|
384
378
|
});
|
|
385
379
|
} catch (error) {
|
|
@@ -468,29 +462,6 @@ async function createEncryptedSellerCredentialUploadForPlatform({
|
|
|
468
462
|
...attestationRuntime?.getRandomValues ? { getRandomValues: attestationRuntime.getRandomValues } : {}
|
|
469
463
|
});
|
|
470
464
|
}
|
|
471
|
-
async function apiCreatePaymentAttestation(payload, attestationServiceUrl, platform, actionType) {
|
|
472
|
-
return withRetry(async () => {
|
|
473
|
-
let res;
|
|
474
|
-
try {
|
|
475
|
-
const endpoint = `/verify/${encodeURIComponent(platform)}/${encodeURIComponent(actionType)}`;
|
|
476
|
-
res = await fetch(`${attestationServiceUrl}${endpoint}`, {
|
|
477
|
-
method: "POST",
|
|
478
|
-
headers: headers(),
|
|
479
|
-
body: JSON.stringify(payload)
|
|
480
|
-
});
|
|
481
|
-
} catch (error) {
|
|
482
|
-
throw new NetworkError("Failed to connect to Attestation Service", {
|
|
483
|
-
endpoint: `/verify/${platform}/${actionType}`,
|
|
484
|
-
error
|
|
485
|
-
});
|
|
486
|
-
}
|
|
487
|
-
if (!res.ok) {
|
|
488
|
-
const errorText = await res.text();
|
|
489
|
-
throw parseAPIError(res, errorText);
|
|
490
|
-
}
|
|
491
|
-
return res.json();
|
|
492
|
-
});
|
|
493
|
-
}
|
|
494
465
|
async function apiVerifyBuyerTeePayment(payload, attestationServiceUrl, platform, actionType) {
|
|
495
466
|
return withRetry(async () => {
|
|
496
467
|
let res;
|
|
@@ -528,6 +499,7 @@ async function apiRequestIdentityAttestation(payload, attestationServiceUrl, pla
|
|
|
528
499
|
body: JSON.stringify({
|
|
529
500
|
platform,
|
|
530
501
|
actionType,
|
|
502
|
+
callerAddress: payload.callerAddress,
|
|
531
503
|
encryptedSessionMaterial: payload.encryptedSessionMaterial,
|
|
532
504
|
params: payload.params
|
|
533
505
|
})
|
|
@@ -744,7 +716,7 @@ var PAYMENT_PLATFORMS = [
|
|
|
744
716
|
// src/utils/constants.ts
|
|
745
717
|
var DEFAULT_BASE_API_URL = "https://api.zkp2p.xyz";
|
|
746
718
|
|
|
747
|
-
// ../../node_modules/.pnpm/@zkp2p+contracts-v2@0.2.
|
|
719
|
+
// ../../node_modules/.pnpm/@zkp2p+contracts-v2@0.2.4_ethers@6.16.0_bufferutil@4.1.0_utf-8-validate@5.0.10__typescript@5.9.3_zod@4.2.1/node_modules/@zkp2p/contracts-v2/oracleFeeds/chainlink.json
|
|
748
720
|
var chainlink_default = {
|
|
749
721
|
feeds: [
|
|
750
722
|
{
|
|
@@ -1034,6 +1006,11 @@ var PLATFORM_ATTESTATION_CONFIG = {
|
|
|
1034
1006
|
};
|
|
1035
1007
|
function resolvePlatformAttestationConfig(platformName) {
|
|
1036
1008
|
const normalized = platformName.toLowerCase();
|
|
1009
|
+
if (normalized === "zelle") {
|
|
1010
|
+
throw new Error(
|
|
1011
|
+
"Generic Zelle buyer TEE fulfillment requires a bank-specific actionType override."
|
|
1012
|
+
);
|
|
1013
|
+
}
|
|
1037
1014
|
const config = PLATFORM_ATTESTATION_CONFIG[normalized];
|
|
1038
1015
|
if (!config) {
|
|
1039
1016
|
throw new Error(`Unknown payment platform: ${platformName}`);
|
|
@@ -1042,6 +1019,38 @@ function resolvePlatformAttestationConfig(platformName) {
|
|
|
1042
1019
|
}
|
|
1043
1020
|
|
|
1044
1021
|
// src/client/IntentOperations.ts
|
|
1022
|
+
var INTENT_MIN_AT_SIGNAL_ABI = [
|
|
1023
|
+
{
|
|
1024
|
+
type: "function",
|
|
1025
|
+
name: "getIntentMinAtSignal",
|
|
1026
|
+
stateMutability: "view",
|
|
1027
|
+
inputs: [{ name: "_intentHash", type: "bytes32" }],
|
|
1028
|
+
outputs: [{ name: "", type: "uint256" }]
|
|
1029
|
+
}
|
|
1030
|
+
];
|
|
1031
|
+
var GENERIC_ZELLE_ATTESTATION_ACTION_TYPES = /* @__PURE__ */ new Set([
|
|
1032
|
+
"transfer_zelle_bofa",
|
|
1033
|
+
"transfer_zelle_chase",
|
|
1034
|
+
"transfer_zelle_citi"
|
|
1035
|
+
]);
|
|
1036
|
+
function resolveBuyerTeeAttestationRoute(platformName, buyerTeeProof) {
|
|
1037
|
+
if (platformName.toLowerCase() !== "zelle") {
|
|
1038
|
+
const platformConfig = resolvePlatformAttestationConfig(platformName);
|
|
1039
|
+
return {
|
|
1040
|
+
actionPlatform: buyerTeeProof.actionPlatform ?? platformConfig.actionPlatform,
|
|
1041
|
+
actionType: buyerTeeProof.actionType ?? platformConfig.actionType
|
|
1042
|
+
};
|
|
1043
|
+
}
|
|
1044
|
+
if (buyerTeeProof.actionPlatform !== "zelle" || !buyerTeeProof.actionType || !GENERIC_ZELLE_ATTESTATION_ACTION_TYPES.has(buyerTeeProof.actionType)) {
|
|
1045
|
+
throw new Error(
|
|
1046
|
+
'Generic Zelle buyer TEE fulfillment requires actionPlatform "zelle" and a bank-specific transfer_zelle_* actionType.'
|
|
1047
|
+
);
|
|
1048
|
+
}
|
|
1049
|
+
return {
|
|
1050
|
+
actionPlatform: buyerTeeProof.actionPlatform,
|
|
1051
|
+
actionType: buyerTeeProof.actionType
|
|
1052
|
+
};
|
|
1053
|
+
}
|
|
1045
1054
|
var IntentOperations = class {
|
|
1046
1055
|
constructor(config) {
|
|
1047
1056
|
this.config = config;
|
|
@@ -1086,13 +1095,9 @@ var IntentOperations = class {
|
|
|
1086
1095
|
let { gatingServiceSignature, signatureExpiration } = params;
|
|
1087
1096
|
let preIntentHookData = params.preIntentHookData;
|
|
1088
1097
|
const baseApiUrl = this.config.getBaseApiUrl();
|
|
1089
|
-
|
|
1090
|
-
const authorizationToken = this.config.getAuthorizationToken();
|
|
1091
|
-
if ((!gatingServiceSignature || !signatureExpiration) && baseApiUrl && (apiKey || authorizationToken)) {
|
|
1098
|
+
if ((!gatingServiceSignature || !signatureExpiration) && baseApiUrl) {
|
|
1092
1099
|
const apiOpts = {
|
|
1093
1100
|
baseApiUrl,
|
|
1094
|
-
apiKey,
|
|
1095
|
-
authorizationToken,
|
|
1096
1101
|
timeoutMs: this.config.getApiTimeoutMs()
|
|
1097
1102
|
};
|
|
1098
1103
|
const response = await apiSignIntentV3(
|
|
@@ -1328,8 +1333,7 @@ var IntentOperations = class {
|
|
|
1328
1333
|
paymentProof = precomputed.paymentProof;
|
|
1329
1334
|
verificationData = precomputed.verificationData;
|
|
1330
1335
|
} else {
|
|
1331
|
-
const
|
|
1332
|
-
const buyerTeeProof = parseBuyerTeePaymentProofInput(proof);
|
|
1336
|
+
const buyerTeeProof = parseBuyerTeePaymentProofInput(params.proof);
|
|
1333
1337
|
const attestationServiceUrl = params.attestationServiceUrl ?? this.defaultAttestationService();
|
|
1334
1338
|
const inputs = await this.config.host.getFulfillIntentInputs(intentHash, {
|
|
1335
1339
|
orchestratorAddress: orchestratorContext.address
|
|
@@ -1343,7 +1347,7 @@ var IntentOperations = class {
|
|
|
1343
1347
|
if (!platformName) {
|
|
1344
1348
|
throw new Error("Unknown paymentMethodHash for this network/env; update SDK catalogs.");
|
|
1345
1349
|
}
|
|
1346
|
-
const
|
|
1350
|
+
const attestationRoute = resolveBuyerTeeAttestationRoute(platformName, buyerTeeProof);
|
|
1347
1351
|
const intent = {
|
|
1348
1352
|
intentHash,
|
|
1349
1353
|
amount: inputs.amount,
|
|
@@ -1354,7 +1358,7 @@ var IntentOperations = class {
|
|
|
1354
1358
|
payeeDetails: inputs.payeeDetails,
|
|
1355
1359
|
timestampBufferMs: params.timestampBufferMs ?? "300000"
|
|
1356
1360
|
};
|
|
1357
|
-
const attestation =
|
|
1361
|
+
const attestation = await apiVerifyBuyerTeePayment(
|
|
1358
1362
|
{
|
|
1359
1363
|
encryptedSessionMaterial: buyerTeeProof.encryptedSessionMaterial,
|
|
1360
1364
|
params: buyerTeeProof.params,
|
|
@@ -1362,19 +1366,10 @@ var IntentOperations = class {
|
|
|
1362
1366
|
intent
|
|
1363
1367
|
},
|
|
1364
1368
|
attestationServiceUrl,
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
) : await apiCreatePaymentAttestation(
|
|
1368
|
-
{
|
|
1369
|
-
proofType: "reclaim",
|
|
1370
|
-
proof: typeof proof === "string" ? proof : serializeProofInput(proof),
|
|
1371
|
-
chainId: this.config.getChainId(),
|
|
1372
|
-
intent
|
|
1373
|
-
},
|
|
1374
|
-
attestationServiceUrl,
|
|
1375
|
-
platformConfig.actionPlatform,
|
|
1376
|
-
platformConfig.actionType
|
|
1369
|
+
attestationRoute.actionPlatform,
|
|
1370
|
+
attestationRoute.actionType
|
|
1377
1371
|
);
|
|
1372
|
+
assertReleaseAmountMeetsMinimum(attestation, inputs.minimumReleaseAmount);
|
|
1378
1373
|
paymentProof = encodePaymentAttestation(attestation);
|
|
1379
1374
|
verificationData = encodeVerifyPaymentData({
|
|
1380
1375
|
intentHash,
|
|
@@ -1425,13 +1420,19 @@ var IntentOperations = class {
|
|
|
1425
1420
|
);
|
|
1426
1421
|
const payee2 = matched?.verificationData?.payeeDetails;
|
|
1427
1422
|
if (payee2) {
|
|
1423
|
+
const minimumReleaseAmount2 = await this.resolveIntentMinimumReleaseAmount(
|
|
1424
|
+
intentHash,
|
|
1425
|
+
options?.orchestratorAddress,
|
|
1426
|
+
view.deposit.deposit.intentAmountRange.min
|
|
1427
|
+
);
|
|
1428
1428
|
return {
|
|
1429
1429
|
amount: view.intent.amount.toString(),
|
|
1430
1430
|
fiatCurrency: view.intent.fiatCurrency,
|
|
1431
1431
|
conversionRate: view.intent.conversionRate.toString(),
|
|
1432
1432
|
payeeDetails: payee2,
|
|
1433
1433
|
intentTimestampMs: (BigInt(view.intent.timestamp) * 1000n).toString(),
|
|
1434
|
-
paymentMethodHash: view.intent.paymentMethod
|
|
1434
|
+
paymentMethodHash: view.intent.paymentMethod,
|
|
1435
|
+
...minimumReleaseAmount2 ? { minimumReleaseAmount: minimumReleaseAmount2 } : {}
|
|
1435
1436
|
};
|
|
1436
1437
|
}
|
|
1437
1438
|
}
|
|
@@ -1451,6 +1452,8 @@ var IntentOperations = class {
|
|
|
1451
1452
|
depositId
|
|
1452
1453
|
signalTimestamp
|
|
1453
1454
|
verifier
|
|
1455
|
+
status
|
|
1456
|
+
isExpired
|
|
1454
1457
|
}
|
|
1455
1458
|
}
|
|
1456
1459
|
`
|
|
@@ -1459,19 +1462,39 @@ var IntentOperations = class {
|
|
|
1459
1462
|
});
|
|
1460
1463
|
const record = response?.Intent?.[0];
|
|
1461
1464
|
if (!record) throw new Error("Intent not found on indexer");
|
|
1465
|
+
if (record.status && record.status !== "SIGNALED") {
|
|
1466
|
+
throw new ValidationError(
|
|
1467
|
+
`Intent not found or no longer fulfillable (status: ${record.status})`,
|
|
1468
|
+
"intentHash",
|
|
1469
|
+
{ intentHash, status: record.status }
|
|
1470
|
+
);
|
|
1471
|
+
}
|
|
1472
|
+
if (record.isExpired) {
|
|
1473
|
+
throw new ValidationError("Intent expired and can no longer be fulfilled", "intentHash", {
|
|
1474
|
+
intentHash
|
|
1475
|
+
});
|
|
1476
|
+
}
|
|
1462
1477
|
if (!record.signalTimestamp) throw new Error("Intent signal timestamp not found on indexer");
|
|
1463
1478
|
const deposit = await this.config.getIndexerService().fetchDepositWithRelations(record.depositId, {
|
|
1464
1479
|
includeIntents: false
|
|
1465
1480
|
});
|
|
1481
|
+
if (!deposit) {
|
|
1482
|
+
throw new Error(`Deposit ${record.depositId} not found on indexer for intent ${intentHash}`);
|
|
1483
|
+
}
|
|
1466
1484
|
let payee;
|
|
1467
1485
|
const paymentMethodHashLower = (record.paymentMethodHash || "").toLowerCase();
|
|
1468
|
-
for (const paymentMethod of deposit
|
|
1486
|
+
for (const paymentMethod of deposit.paymentMethods || []) {
|
|
1469
1487
|
if ((paymentMethod.paymentMethodHash || "").toLowerCase() === paymentMethodHashLower) {
|
|
1470
1488
|
payee = paymentMethod.payeeDetailsHash;
|
|
1471
1489
|
break;
|
|
1472
1490
|
}
|
|
1473
1491
|
}
|
|
1474
1492
|
if (!payee) throw new Error("Payee details not found for intent");
|
|
1493
|
+
const minimumReleaseAmount = await this.resolveIntentMinimumReleaseAmount(
|
|
1494
|
+
intentHash,
|
|
1495
|
+
options?.orchestratorAddress,
|
|
1496
|
+
deposit.intentAmountMin
|
|
1497
|
+
);
|
|
1475
1498
|
return {
|
|
1476
1499
|
amount: record.amount,
|
|
1477
1500
|
fiatCurrency: record.fiatCurrency,
|
|
@@ -1479,14 +1502,49 @@ var IntentOperations = class {
|
|
|
1479
1502
|
payeeDetails: payee,
|
|
1480
1503
|
intentTimestampMs: (BigInt(record.signalTimestamp) * 1000n).toString(),
|
|
1481
1504
|
paymentMethodHash: record.paymentMethodHash || "0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
1482
|
-
paymentVerifier: record.verifier || void 0
|
|
1505
|
+
paymentVerifier: record.verifier || void 0,
|
|
1506
|
+
...minimumReleaseAmount ? { minimumReleaseAmount } : {}
|
|
1483
1507
|
};
|
|
1484
1508
|
}
|
|
1509
|
+
async resolveIntentMinimumReleaseAmount(intentHash, orchestratorAddress, fallbackMinimum) {
|
|
1510
|
+
const snapshotMinimum = await this.readIntentMinAtSignal(intentHash, orchestratorAddress);
|
|
1511
|
+
if (snapshotMinimum && snapshotMinimum !== "0") {
|
|
1512
|
+
return snapshotMinimum;
|
|
1513
|
+
}
|
|
1514
|
+
if (fallbackMinimum === void 0 || fallbackMinimum === null) {
|
|
1515
|
+
return snapshotMinimum;
|
|
1516
|
+
}
|
|
1517
|
+
return BigInt(fallbackMinimum).toString();
|
|
1518
|
+
}
|
|
1519
|
+
async readIntentMinAtSignal(intentHash, orchestratorAddress) {
|
|
1520
|
+
const address = orchestratorAddress ?? this.config.getOrchestratorV2Address();
|
|
1521
|
+
if (!address) return void 0;
|
|
1522
|
+
try {
|
|
1523
|
+
const value = await this.config.getPublicClient().readContract({
|
|
1524
|
+
address,
|
|
1525
|
+
abi: INTENT_MIN_AT_SIGNAL_ABI,
|
|
1526
|
+
functionName: "getIntentMinAtSignal",
|
|
1527
|
+
args: [intentHash]
|
|
1528
|
+
});
|
|
1529
|
+
return value.toString();
|
|
1530
|
+
} catch {
|
|
1531
|
+
return void 0;
|
|
1532
|
+
}
|
|
1533
|
+
}
|
|
1485
1534
|
};
|
|
1486
|
-
function
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1535
|
+
function assertReleaseAmountMeetsMinimum(attestation, minimumReleaseAmount) {
|
|
1536
|
+
if (!minimumReleaseAmount) return;
|
|
1537
|
+
const minimum = BigInt(minimumReleaseAmount);
|
|
1538
|
+
if (minimum === 0n) return;
|
|
1539
|
+
const releaseAmount = BigInt(attestation.responseObject.typedDataValue.releaseAmount);
|
|
1540
|
+
if (releaseAmount >= minimum) return;
|
|
1541
|
+
throw new ValidationError(
|
|
1542
|
+
`Payment amount is below the minimum required for this intent. Release amount ${releaseAmount.toString()} is below minimum ${minimum.toString()}.`,
|
|
1543
|
+
"releaseAmount",
|
|
1544
|
+
{
|
|
1545
|
+
releaseAmount: releaseAmount.toString(),
|
|
1546
|
+
minimumReleaseAmount: minimum.toString()
|
|
1547
|
+
}
|
|
1490
1548
|
);
|
|
1491
1549
|
}
|
|
1492
1550
|
function isRecord(value) {
|
|
@@ -1499,7 +1557,9 @@ function isBuyerTeeParams(value) {
|
|
|
1499
1557
|
}
|
|
1500
1558
|
function parseBuyerTeePaymentProofInput(proof) {
|
|
1501
1559
|
if (!isRecord(proof) || proof.proofType !== "buyerTee") {
|
|
1502
|
-
|
|
1560
|
+
throw new Error(
|
|
1561
|
+
"Buyer TEE proof input is required; legacy proof inputs are no longer supported."
|
|
1562
|
+
);
|
|
1503
1563
|
}
|
|
1504
1564
|
if (typeof proof.encryptedSessionMaterial !== "string" || !isBuyerTeeParams(proof.params)) {
|
|
1505
1565
|
throw new Error("Buyer TEE proof requires encryptedSessionMaterial and params.");
|
|
@@ -1753,7 +1813,7 @@ var ProtocolViewerReader = class {
|
|
|
1753
1813
|
if (inputCount === null) {
|
|
1754
1814
|
throw new Error("Configured ProtocolViewer ABI does not expose getDeposit");
|
|
1755
1815
|
}
|
|
1756
|
-
const { parseDepositView: parseDepositView2 } = await import('./protocolViewerParsers-
|
|
1816
|
+
const { parseDepositView: parseDepositView2 } = await import('./protocolViewerParsers-XN63B2S5.mjs');
|
|
1757
1817
|
if (inputCount >= 3) {
|
|
1758
1818
|
return tryContexts(
|
|
1759
1819
|
protocolViewerContexts,
|
|
@@ -1832,7 +1892,7 @@ var ProtocolViewerReader = class {
|
|
|
1832
1892
|
return Promise.all(ids.map((id) => this.config.host.getPvDepositById(id)));
|
|
1833
1893
|
}
|
|
1834
1894
|
const bn = ids.map((id) => typeof id === "bigint" ? id : parseRawDepositId(id));
|
|
1835
|
-
const { parseDepositView: parseDepositView2 } = await import('./protocolViewerParsers-
|
|
1895
|
+
const { parseDepositView: parseDepositView2 } = await import('./protocolViewerParsers-XN63B2S5.mjs');
|
|
1836
1896
|
if (inputCount >= 2) {
|
|
1837
1897
|
const requests = ids.map((id, index) => ({
|
|
1838
1898
|
index,
|
|
@@ -1937,7 +1997,7 @@ var ProtocolViewerReader = class {
|
|
|
1937
1997
|
if (!protocolViewerAddress || !protocolViewerAbi || inputCount === null) {
|
|
1938
1998
|
return this.config.host.getPvAccountDepositsFromIndexer(owner);
|
|
1939
1999
|
}
|
|
1940
|
-
const { parseDepositView: parseDepositView2 } = await import('./protocolViewerParsers-
|
|
2000
|
+
const { parseDepositView: parseDepositView2 } = await import('./protocolViewerParsers-XN63B2S5.mjs');
|
|
1941
2001
|
const { address, abi } = this.config.host.requireProtocolViewer();
|
|
1942
2002
|
if (inputCount >= 2) {
|
|
1943
2003
|
const readAndFilter = async (raw2) => {
|
|
@@ -2008,7 +2068,7 @@ var ProtocolViewerReader = class {
|
|
|
2008
2068
|
if (protocolViewerEntries.length === 0) {
|
|
2009
2069
|
throw new Error("ProtocolViewer not available for this network");
|
|
2010
2070
|
}
|
|
2011
|
-
const { parseIntentView: parseIntentView2 } = await import('./protocolViewerParsers-
|
|
2071
|
+
const { parseIntentView: parseIntentView2 } = await import('./protocolViewerParsers-XN63B2S5.mjs');
|
|
2012
2072
|
const intentsByHash = /* @__PURE__ */ new Map();
|
|
2013
2073
|
let attemptedRead = false;
|
|
2014
2074
|
let hadSuccessfulRead = false;
|
|
@@ -2116,7 +2176,7 @@ var ProtocolViewerReader = class {
|
|
|
2116
2176
|
if (protocolViewerEntries.length === 0) {
|
|
2117
2177
|
throw new Error("ProtocolViewer not available for this network");
|
|
2118
2178
|
}
|
|
2119
|
-
const { parseIntentView: parseIntentView2 } = await import('./protocolViewerParsers-
|
|
2179
|
+
const { parseIntentView: parseIntentView2 } = await import('./protocolViewerParsers-XN63B2S5.mjs');
|
|
2120
2180
|
let lastError;
|
|
2121
2181
|
for (const pvEntry of protocolViewerEntries) {
|
|
2122
2182
|
const inputCount = this.pvEntryFunctionInputCount(pvEntry, "getIntent");
|
|
@@ -4975,12 +5035,48 @@ async function fetchFulfillmentAndPayment(client, intentHash) {
|
|
|
4975
5035
|
});
|
|
4976
5036
|
}
|
|
4977
5037
|
|
|
5038
|
+
// src/utils/logger.ts
|
|
5039
|
+
var currentLevel = "info";
|
|
5040
|
+
function setLogLevel(level) {
|
|
5041
|
+
currentLevel = level;
|
|
5042
|
+
}
|
|
5043
|
+
function shouldLog(level) {
|
|
5044
|
+
switch (currentLevel) {
|
|
5045
|
+
case "debug":
|
|
5046
|
+
return true;
|
|
5047
|
+
case "info":
|
|
5048
|
+
return level !== "debug";
|
|
5049
|
+
case "error":
|
|
5050
|
+
return level === "error";
|
|
5051
|
+
default:
|
|
5052
|
+
return true;
|
|
5053
|
+
}
|
|
5054
|
+
}
|
|
5055
|
+
var logger = {
|
|
5056
|
+
debug: (...args) => {
|
|
5057
|
+
if (shouldLog("debug")) {
|
|
5058
|
+
console.log("[DEBUG]", ...args);
|
|
5059
|
+
}
|
|
5060
|
+
},
|
|
5061
|
+
info: (...args) => {
|
|
5062
|
+
if (shouldLog("info")) {
|
|
5063
|
+
console.log("[INFO]", ...args);
|
|
5064
|
+
}
|
|
5065
|
+
},
|
|
5066
|
+
warn: (...args) => {
|
|
5067
|
+
if (shouldLog("info")) {
|
|
5068
|
+
console.warn("[WARN]", ...args);
|
|
5069
|
+
}
|
|
5070
|
+
},
|
|
5071
|
+
error: (...args) => {
|
|
5072
|
+
console.error("[ERROR]", ...args);
|
|
5073
|
+
}
|
|
5074
|
+
};
|
|
5075
|
+
|
|
4978
5076
|
// src/adapters/api.ts
|
|
4979
|
-
function
|
|
5077
|
+
function createHeaders(apiKey) {
|
|
4980
5078
|
const headers2 = { "Content-Type": "application/json" };
|
|
4981
5079
|
if (apiKey) headers2["x-api-key"] = apiKey;
|
|
4982
|
-
if (authToken)
|
|
4983
|
-
headers2["Authorization"] = authToken.startsWith("Bearer ") ? authToken : `Bearer ${authToken}`;
|
|
4984
5080
|
return headers2;
|
|
4985
5081
|
}
|
|
4986
5082
|
function withApiBase(baseApiUrl) {
|
|
@@ -4995,7 +5091,6 @@ async function apiFetch({
|
|
|
4995
5091
|
method = "GET",
|
|
4996
5092
|
body,
|
|
4997
5093
|
apiKey,
|
|
4998
|
-
authToken,
|
|
4999
5094
|
timeoutMs,
|
|
5000
5095
|
retryCount = 3,
|
|
5001
5096
|
retryDelayMs = 1e3
|
|
@@ -5007,7 +5102,7 @@ async function apiFetch({
|
|
|
5007
5102
|
try {
|
|
5008
5103
|
const options = {
|
|
5009
5104
|
method,
|
|
5010
|
-
headers:
|
|
5105
|
+
headers: createHeaders(apiKey)
|
|
5011
5106
|
};
|
|
5012
5107
|
if (body && method !== "GET") {
|
|
5013
5108
|
options.body = JSON.stringify(body);
|
|
@@ -5082,10 +5177,17 @@ function buildLegacyVerifierCurrencies(deposit) {
|
|
|
5082
5177
|
const currenciesByMethod = /* @__PURE__ */ new Map();
|
|
5083
5178
|
for (const currency of deposit.currencies ?? []) {
|
|
5084
5179
|
const methodHash = currency.paymentMethodHash;
|
|
5180
|
+
const resolvedConversionRate = currency.conversionRate ?? currency.minConversionRate;
|
|
5181
|
+
if (resolvedConversionRate === null || resolvedConversionRate === void 0) {
|
|
5182
|
+
logger.warn(
|
|
5183
|
+
`[sdk] Skipping currency with missing conversion rate (deposit ${deposit.depositId}, currency ${currency.currencyCode})`
|
|
5184
|
+
);
|
|
5185
|
+
continue;
|
|
5186
|
+
}
|
|
5085
5187
|
const bucket = currenciesByMethod.get(methodHash) ?? [];
|
|
5086
5188
|
bucket.push({
|
|
5087
5189
|
currencyCode: currency.currencyCode,
|
|
5088
|
-
conversionRate:
|
|
5190
|
+
conversionRate: resolvedConversionRate,
|
|
5089
5191
|
minConversionRate: currency.minConversionRate,
|
|
5090
5192
|
managerRate: currency.managerRate ?? null,
|
|
5091
5193
|
rateManagerId: currency.rateManagerId ?? null
|
|
@@ -5137,7 +5239,7 @@ function convertIndexerDepositToLegacyApiDeposit(deposit) {
|
|
|
5137
5239
|
verifiers
|
|
5138
5240
|
};
|
|
5139
5241
|
}
|
|
5140
|
-
async function apiPostDepositDetails(req, baseApiUrl, timeoutMs
|
|
5242
|
+
async function apiPostDepositDetails(req, baseApiUrl, timeoutMs) {
|
|
5141
5243
|
return apiFetch({
|
|
5142
5244
|
url: `${withApiBase(baseApiUrl)}/v2/makers/create`,
|
|
5143
5245
|
method: "POST",
|
|
@@ -5145,7 +5247,7 @@ async function apiPostDepositDetails(req, baseApiUrl, timeoutMs, _apiKey, _authT
|
|
|
5145
5247
|
timeoutMs
|
|
5146
5248
|
});
|
|
5147
5249
|
}
|
|
5148
|
-
async function apiGetQuote(req, baseApiUrl, timeoutMs
|
|
5250
|
+
async function apiGetQuote(req, baseApiUrl, timeoutMs) {
|
|
5149
5251
|
if (req.quotesToReturn !== void 0) {
|
|
5150
5252
|
if (!Number.isInteger(req.quotesToReturn) || req.quotesToReturn < 1) {
|
|
5151
5253
|
throw new ValidationError("quotesToReturn must be a positive integer", "quotesToReturn");
|
|
@@ -5180,12 +5282,10 @@ async function apiGetQuote(req, baseApiUrl, timeoutMs, apiKey, authToken) {
|
|
|
5180
5282
|
url,
|
|
5181
5283
|
method: "POST",
|
|
5182
5284
|
body: requestBody,
|
|
5183
|
-
apiKey,
|
|
5184
|
-
authToken,
|
|
5185
5285
|
timeoutMs
|
|
5186
5286
|
});
|
|
5187
5287
|
}
|
|
5188
|
-
async function apiGetQuotesBestByPlatform(req, baseApiUrl, timeoutMs
|
|
5288
|
+
async function apiGetQuotesBestByPlatform(req, baseApiUrl, timeoutMs) {
|
|
5189
5289
|
const isExactFiat = req.isExactFiat !== false;
|
|
5190
5290
|
const endpoint = isExactFiat ? "best-by-platform" : "best-by-platform-exact-token";
|
|
5191
5291
|
const url = `${withApiBase(baseApiUrl)}/v2/quote/${endpoint}`;
|
|
@@ -5203,17 +5303,13 @@ async function apiGetQuotesBestByPlatform(req, baseApiUrl, timeoutMs, apiKey, au
|
|
|
5203
5303
|
url,
|
|
5204
5304
|
method: "POST",
|
|
5205
5305
|
body: requestBody,
|
|
5206
|
-
apiKey,
|
|
5207
|
-
authToken,
|
|
5208
5306
|
timeoutMs
|
|
5209
5307
|
});
|
|
5210
5308
|
}
|
|
5211
|
-
async function apiGetPayeeDetails(req,
|
|
5309
|
+
async function apiGetPayeeDetails(req, baseApiUrl, timeoutMs) {
|
|
5212
5310
|
return apiFetch({
|
|
5213
5311
|
url: `${baseApiUrl.replace(/\/$/, "")}/v2/makers/${req.processorName}/${req.hashedOnchainId}`,
|
|
5214
5312
|
method: "GET",
|
|
5215
|
-
apiKey,
|
|
5216
|
-
authToken,
|
|
5217
5313
|
timeoutMs
|
|
5218
5314
|
});
|
|
5219
5315
|
}
|
|
@@ -5264,7 +5360,7 @@ async function apiGetOwnerDeposits(req, apiKey, baseApiUrl, authToken, timeoutMs
|
|
|
5264
5360
|
statusCode: 200
|
|
5265
5361
|
};
|
|
5266
5362
|
}
|
|
5267
|
-
async function apiGetTakerTier(req,
|
|
5363
|
+
async function apiGetTakerTier(req, baseApiUrl, timeoutMs) {
|
|
5268
5364
|
const normalizedOwner = req.owner.toLowerCase();
|
|
5269
5365
|
const query = new URLSearchParams({
|
|
5270
5366
|
owner: normalizedOwner,
|
|
@@ -5288,19 +5384,6 @@ async function apiUploadSellerCredential(processorName, payeeDetails, bundle, ba
|
|
|
5288
5384
|
timeoutMs
|
|
5289
5385
|
});
|
|
5290
5386
|
}
|
|
5291
|
-
async function apiConfirmPayPalForwarding(payeeDetails, body, baseApiUrl, opts) {
|
|
5292
|
-
const endpoint = `/v2/makers/paypal/${encodeURIComponent(
|
|
5293
|
-
payeeDetails
|
|
5294
|
-
)}/seller-credential/forwarding-confirmation`;
|
|
5295
|
-
return apiFetch({
|
|
5296
|
-
url: `${withApiBase(baseApiUrl)}${endpoint}`,
|
|
5297
|
-
method: "POST",
|
|
5298
|
-
body,
|
|
5299
|
-
apiKey: opts?.apiKey,
|
|
5300
|
-
authToken: opts?.authToken,
|
|
5301
|
-
timeoutMs: opts?.timeoutMs
|
|
5302
|
-
});
|
|
5303
|
-
}
|
|
5304
5387
|
async function apiUploadGoogleOAuthSellerCredential(processorName, payeeDetails, body, baseApiUrl, opts) {
|
|
5305
5388
|
const endpoint = `/v2/makers/${encodeURIComponent(processorName)}/${encodeURIComponent(
|
|
5306
5389
|
payeeDetails
|
|
@@ -5309,8 +5392,6 @@ async function apiUploadGoogleOAuthSellerCredential(processorName, payeeDetails,
|
|
|
5309
5392
|
url: `${withApiBase(baseApiUrl)}${endpoint}`,
|
|
5310
5393
|
method: "POST",
|
|
5311
5394
|
body,
|
|
5312
|
-
apiKey: opts?.apiKey,
|
|
5313
|
-
authToken: opts?.authToken,
|
|
5314
5395
|
timeoutMs: opts?.timeoutMs
|
|
5315
5396
|
});
|
|
5316
5397
|
}
|
|
@@ -5324,7 +5405,7 @@ async function apiGetSellerCredentialStatus(processorName, payeeDetails, baseApi
|
|
|
5324
5405
|
timeoutMs
|
|
5325
5406
|
});
|
|
5326
5407
|
}
|
|
5327
|
-
async function apiVerifySellerPayment(platform, req, baseApiUrl, timeoutMs, apiKey
|
|
5408
|
+
async function apiVerifySellerPayment(platform, req, baseApiUrl, timeoutMs, apiKey) {
|
|
5328
5409
|
const body = {
|
|
5329
5410
|
txId: req.txId,
|
|
5330
5411
|
chainId: req.chainId,
|
|
@@ -5336,15 +5417,13 @@ async function apiVerifySellerPayment(platform, req, baseApiUrl, timeoutMs, apiK
|
|
|
5336
5417
|
method: "POST",
|
|
5337
5418
|
body,
|
|
5338
5419
|
apiKey,
|
|
5339
|
-
authToken,
|
|
5340
5420
|
timeoutMs
|
|
5341
5421
|
});
|
|
5342
5422
|
}
|
|
5343
|
-
async function apiGetOrderbook(params, optsOrBaseApiUrl, timeoutMs
|
|
5423
|
+
async function apiGetOrderbook(params, optsOrBaseApiUrl, timeoutMs) {
|
|
5344
5424
|
const opts = typeof optsOrBaseApiUrl === "string" ? {
|
|
5345
5425
|
baseApiUrl: optsOrBaseApiUrl,
|
|
5346
|
-
timeoutMs
|
|
5347
|
-
apiKey
|
|
5426
|
+
timeoutMs
|
|
5348
5427
|
} : optsOrBaseApiUrl;
|
|
5349
5428
|
const query = new URLSearchParams();
|
|
5350
5429
|
Object.entries(params).forEach(([key, value]) => {
|
|
@@ -5354,17 +5433,14 @@ async function apiGetOrderbook(params, optsOrBaseApiUrl, timeoutMs, apiKey) {
|
|
|
5354
5433
|
const response = await apiFetch({
|
|
5355
5434
|
url: `${withApiBase(opts.baseApiUrl)}/v2/orderbook?${query.toString()}`,
|
|
5356
5435
|
method: "GET",
|
|
5357
|
-
apiKey: opts.apiKey,
|
|
5358
|
-
authToken: opts.authToken,
|
|
5359
5436
|
timeoutMs: opts.timeoutMs
|
|
5360
5437
|
});
|
|
5361
5438
|
return response.responseObject;
|
|
5362
5439
|
}
|
|
5363
|
-
async function apiGetDepositBundle(params, optsOrBaseApiUrl, timeoutMs
|
|
5440
|
+
async function apiGetDepositBundle(params, optsOrBaseApiUrl, timeoutMs) {
|
|
5364
5441
|
const opts = typeof optsOrBaseApiUrl === "string" ? {
|
|
5365
5442
|
baseApiUrl: optsOrBaseApiUrl,
|
|
5366
|
-
timeoutMs
|
|
5367
|
-
apiKey
|
|
5443
|
+
timeoutMs
|
|
5368
5444
|
} : optsOrBaseApiUrl;
|
|
5369
5445
|
const escrowAddress = requireEscrowAddress(
|
|
5370
5446
|
params.escrowAddress,
|
|
@@ -5377,8 +5453,6 @@ async function apiGetDepositBundle(params, optsOrBaseApiUrl, timeoutMs, apiKey)
|
|
|
5377
5453
|
const response = await apiFetch({
|
|
5378
5454
|
url: `${withApiBase(opts.baseApiUrl)}/v2/deposits/${params.depositId}/bundle?${query.toString()}`,
|
|
5379
5455
|
method: "GET",
|
|
5380
|
-
apiKey: opts.apiKey,
|
|
5381
|
-
authToken: opts.authToken,
|
|
5382
5456
|
timeoutMs: opts.timeoutMs
|
|
5383
5457
|
});
|
|
5384
5458
|
return response.responseObject;
|
|
@@ -6214,9 +6288,9 @@ var Zkp2pClient = class {
|
|
|
6214
6288
|
* sending fiat payment to the deposit's payee.
|
|
6215
6289
|
*
|
|
6216
6290
|
* If `gatingServiceSignature` is not provided, the SDK will automatically
|
|
6217
|
-
* fetch one from curator `/v3/intent/sign` when `
|
|
6218
|
-
*
|
|
6219
|
-
*
|
|
6291
|
+
* fetch one from curator `/v3/intent/sign` when `baseApiUrl` is configured.
|
|
6292
|
+
* Otherwise you must provide `gatingServiceSignature` and `signatureExpiration`
|
|
6293
|
+
* yourself.
|
|
6220
6294
|
*
|
|
6221
6295
|
* **Prepare Mode**: Use `.prepare()` to get the transaction calldata without sending:
|
|
6222
6296
|
* ```typescript
|
|
@@ -6437,7 +6511,7 @@ var Zkp2pClient = class {
|
|
|
6437
6511
|
* ```
|
|
6438
6512
|
*
|
|
6439
6513
|
* @param params.intentHash - The intent hash to fulfill (0x-prefixed, 32 bytes)
|
|
6440
|
-
* @param params.proof -
|
|
6514
|
+
* @param params.proof - Buyer TEE payment proof input
|
|
6441
6515
|
* @param params.timestampBufferMs - Allowed timestamp variance (default: 300000ms)
|
|
6442
6516
|
* @param params.attestationServiceUrl - Override attestation service URL
|
|
6443
6517
|
* @param params.postIntentHookData - Data to pass to post-intent hook
|
|
@@ -6646,8 +6720,6 @@ var Zkp2pClient = class {
|
|
|
6646
6720
|
getChainId: () => this.chainId,
|
|
6647
6721
|
getRuntimeEnv: () => this.runtimeEnv,
|
|
6648
6722
|
getBaseApiUrl: () => this.baseApiUrl,
|
|
6649
|
-
getApiKey: () => this.apiKey,
|
|
6650
|
-
getAuthorizationToken: () => this.authorizationToken,
|
|
6651
6723
|
getApiTimeoutMs: () => this.apiTimeoutMs,
|
|
6652
6724
|
getProtocolViewerAddress: () => this.protocolViewerAddress,
|
|
6653
6725
|
getProtocolViewerAbi: () => this.protocolViewerAbi,
|
|
@@ -7903,13 +7975,7 @@ var Zkp2pClient = class {
|
|
|
7903
7975
|
reqWithEscrow.escrowAddresses = configuredEscrows;
|
|
7904
7976
|
}
|
|
7905
7977
|
}
|
|
7906
|
-
const quote = await apiGetQuote(
|
|
7907
|
-
reqWithEscrow,
|
|
7908
|
-
baseApiUrl,
|
|
7909
|
-
timeoutMs,
|
|
7910
|
-
this.apiKey,
|
|
7911
|
-
this.authorizationToken
|
|
7912
|
-
);
|
|
7978
|
+
const quote = await apiGetQuote(reqWithEscrow, baseApiUrl, timeoutMs);
|
|
7913
7979
|
const quotes = quote?.responseObject?.quotes ?? [];
|
|
7914
7980
|
for (const q of quotes) {
|
|
7915
7981
|
const maker = q?.maker;
|
|
@@ -7923,8 +7989,8 @@ var Zkp2pClient = class {
|
|
|
7923
7989
|
/**
|
|
7924
7990
|
* **Supporting Method** - Fetches the best available quote per supported payment platform.
|
|
7925
7991
|
*
|
|
7926
|
-
* Returns one quote per platform when available.
|
|
7927
|
-
*
|
|
7992
|
+
* Returns one quote per platform when available. The API returns payee details
|
|
7993
|
+
* in each platform's best quote when available.
|
|
7928
7994
|
*
|
|
7929
7995
|
* @param req - Best-by-platform quote request parameters
|
|
7930
7996
|
* @param opts - Optional overrides for API URL and timeout
|
|
@@ -7947,13 +8013,7 @@ var Zkp2pClient = class {
|
|
|
7947
8013
|
reqWithEscrow.escrowAddresses = configuredEscrows;
|
|
7948
8014
|
}
|
|
7949
8015
|
}
|
|
7950
|
-
const quote = await apiGetQuotesBestByPlatform(
|
|
7951
|
-
reqWithEscrow,
|
|
7952
|
-
baseApiUrl,
|
|
7953
|
-
timeoutMs,
|
|
7954
|
-
this.apiKey,
|
|
7955
|
-
this.authorizationToken
|
|
7956
|
-
);
|
|
8016
|
+
const quote = await apiGetQuotesBestByPlatform(reqWithEscrow, baseApiUrl, timeoutMs);
|
|
7957
8017
|
const enrichedQuote = quote ? {
|
|
7958
8018
|
...quote,
|
|
7959
8019
|
responseObject: {
|
|
@@ -7990,7 +8050,7 @@ var Zkp2pClient = class {
|
|
|
7990
8050
|
""
|
|
7991
8051
|
);
|
|
7992
8052
|
const timeoutMs = opts?.timeoutMs ?? this.apiTimeoutMs;
|
|
7993
|
-
return apiGetTakerTier(req,
|
|
8053
|
+
return apiGetTakerTier(req, baseApiUrl, timeoutMs);
|
|
7994
8054
|
}
|
|
7995
8055
|
/**
|
|
7996
8056
|
* The signed `credentialValidatedAt` field is an upload-time freshness witness minted by
|
|
@@ -8068,32 +8128,6 @@ var Zkp2pClient = class {
|
|
|
8068
8128
|
const timeoutMs = opts?.timeoutMs ?? this.apiTimeoutMs;
|
|
8069
8129
|
return apiUploadSellerCredentialBundle(params, baseApiUrl, timeoutMs);
|
|
8070
8130
|
}
|
|
8071
|
-
/**
|
|
8072
|
-
* Confirms the PayPal Gmail-forwarding setup for an existing maker payee hash.
|
|
8073
|
-
*
|
|
8074
|
-
* Uses curator's `/forwarding-confirmation` route and forwards both API key and
|
|
8075
|
-
* bearer token so either auth strategy can satisfy the hybrid gate. The endpoint
|
|
8076
|
-
* is rate-limited server-side; callers should surface retry guidance from APIError.
|
|
8077
|
-
*/
|
|
8078
|
-
async confirmPayPalForwarding(params, opts) {
|
|
8079
|
-
const baseApiUrl = this.stripTrailingSlash(
|
|
8080
|
-
opts?.baseApiUrl ?? this.baseApiUrl ?? DEFAULT_BASE_API_URL
|
|
8081
|
-
);
|
|
8082
|
-
const timeoutMs = opts?.timeoutMs ?? this.apiTimeoutMs;
|
|
8083
|
-
return apiConfirmPayPalForwarding(
|
|
8084
|
-
params.payeeDetails,
|
|
8085
|
-
{
|
|
8086
|
-
payeeEmail: params.payeeEmail,
|
|
8087
|
-
forwardingInitiatorEmail: params.forwardingInitiatorEmail
|
|
8088
|
-
},
|
|
8089
|
-
baseApiUrl,
|
|
8090
|
-
{
|
|
8091
|
-
apiKey: this.apiKey,
|
|
8092
|
-
authToken: this.authorizationToken,
|
|
8093
|
-
timeoutMs
|
|
8094
|
-
}
|
|
8095
|
-
);
|
|
8096
|
-
}
|
|
8097
8131
|
/**
|
|
8098
8132
|
* Upload a seller Gmail OAuth authorization code through curator.
|
|
8099
8133
|
*
|
|
@@ -8116,8 +8150,6 @@ var Zkp2pClient = class {
|
|
|
8116
8150
|
},
|
|
8117
8151
|
baseApiUrl,
|
|
8118
8152
|
{
|
|
8119
|
-
apiKey: this.apiKey,
|
|
8120
|
-
authToken: this.authorizationToken,
|
|
8121
8153
|
timeoutMs
|
|
8122
8154
|
}
|
|
8123
8155
|
);
|
|
@@ -8132,8 +8164,6 @@ var Zkp2pClient = class {
|
|
|
8132
8164
|
},
|
|
8133
8165
|
baseApiUrl,
|
|
8134
8166
|
{
|
|
8135
|
-
apiKey: this.apiKey,
|
|
8136
|
-
authToken: this.authorizationToken,
|
|
8137
8167
|
timeoutMs
|
|
8138
8168
|
}
|
|
8139
8169
|
);
|
|
@@ -8160,8 +8190,8 @@ var Zkp2pClient = class {
|
|
|
8160
8190
|
);
|
|
8161
8191
|
}
|
|
8162
8192
|
/**
|
|
8163
|
-
* Internal-use endpoint. The curator route requires an internal `x-api-key`;
|
|
8164
|
-
* API keys will be rejected
|
|
8193
|
+
* Internal-use endpoint. The curator route requires an internal `x-api-key`; non-internal
|
|
8194
|
+
* API keys will be rejected. Returns 410 GONE when curator has marked the credential inactive
|
|
8165
8195
|
* or a stale credential fails its synchronous re-probe.
|
|
8166
8196
|
*
|
|
8167
8197
|
* Verify a seller payment via curator's seller-credential proxy.
|
|
@@ -8181,8 +8211,7 @@ var Zkp2pClient = class {
|
|
|
8181
8211
|
},
|
|
8182
8212
|
baseApiUrl,
|
|
8183
8213
|
timeoutMs,
|
|
8184
|
-
this.apiKey
|
|
8185
|
-
this.authorizationToken
|
|
8214
|
+
this.apiKey
|
|
8186
8215
|
);
|
|
8187
8216
|
}
|
|
8188
8217
|
// ╔═══════════════════════════════════════════════════════════════════════════╗
|
|
@@ -8377,44 +8406,6 @@ var createPeerExtensionSdk = (options = {}) => ({
|
|
|
8377
8406
|
});
|
|
8378
8407
|
var peerExtensionSdk = createPeerExtensionSdk();
|
|
8379
8408
|
|
|
8380
|
-
|
|
8381
|
-
var currentLevel = "info";
|
|
8382
|
-
function setLogLevel(level) {
|
|
8383
|
-
currentLevel = level;
|
|
8384
|
-
}
|
|
8385
|
-
function shouldLog(level) {
|
|
8386
|
-
switch (currentLevel) {
|
|
8387
|
-
case "debug":
|
|
8388
|
-
return true;
|
|
8389
|
-
case "info":
|
|
8390
|
-
return level !== "debug";
|
|
8391
|
-
case "error":
|
|
8392
|
-
return level === "error";
|
|
8393
|
-
default:
|
|
8394
|
-
return true;
|
|
8395
|
-
}
|
|
8396
|
-
}
|
|
8397
|
-
var logger = {
|
|
8398
|
-
debug: (...args) => {
|
|
8399
|
-
if (shouldLog("debug")) {
|
|
8400
|
-
console.log("[DEBUG]", ...args);
|
|
8401
|
-
}
|
|
8402
|
-
},
|
|
8403
|
-
info: (...args) => {
|
|
8404
|
-
if (shouldLog("info")) {
|
|
8405
|
-
console.log("[INFO]", ...args);
|
|
8406
|
-
}
|
|
8407
|
-
},
|
|
8408
|
-
warn: (...args) => {
|
|
8409
|
-
if (shouldLog("info")) {
|
|
8410
|
-
console.warn("[WARN]", ...args);
|
|
8411
|
-
}
|
|
8412
|
-
},
|
|
8413
|
-
error: (...args) => {
|
|
8414
|
-
console.error("[ERROR]", ...args);
|
|
8415
|
-
}
|
|
8416
|
-
};
|
|
8417
|
-
|
|
8418
|
-
export { BASE_BUILDER_CODE, CHAINLINK_ORACLE_ADAPTER, CHAINLINK_ORACLE_FEEDS, ContractRouter, DEFAULT_ORACLE_MAX_STALENESS_SECONDS, IndexerClient, IndexerDepositService, IndexerRateManagerService, Zkp2pClient as OfframpClient, PAYMENT_PLATFORMS, PEER_EXTENSION_CHROME_URL, PLATFORM_METADATA, PYTH_CONTRACT_BASE, PYTH_ORACLE_ADAPTER, PYTH_ORACLE_FEEDS, SPREAD_ORACLE_FEEDS, SUPPORTED_CHAIN_IDS, TOKEN_METADATA, ZKP2P_ANDROID_REFERRER, ZKP2P_IOS_REFERRER, Zkp2pClient, apiConfirmPayPalForwarding, apiCreateSellerCredentialBundle, apiGetDepositBundle, apiGetOrderbook, apiGetOwnerDeposits, apiGetPayeeDetails, apiGetQuotesBestByPlatform, apiGetTakerTier, apiPostDepositDetails, apiRequestIdentityAttestation, apiUploadGoogleOAuthSellerCredential, apiUploadSellerCredentialBundle, apiValidatePayeeDetails, appendAttributionToCalldata, assertValidReferrerFeeConfig, compareEventCursorIdsByRecency, convertDepositsForLiquidity, convertIndexerDepositToEscrowView, convertIndexerIntentsToEscrowViews, createCompositeDepositId, createEncryptedBuyerTeeSessionMaterial, createPeerExtensionSdk, defaultIndexerEndpoint, encodePythAdapterConfig, encodeSpreadOracleAdapterConfig, encodeWithAttribution, fetchFulfillmentAndPayment as fetchIndexerFulfillmentAndPayment, getAttributionDataSuffix, getPeerExtensionState, getSpreadOracleConfig, isPeerExtensionAvailable, isValidReferrerFeeBps, isValidReferrerFeeRecipient, logger, openPeerExtensionInstallPage, parseReferrerFeeConfig, peerExtensionSdk, referrerFeeConfigToPreciseUnits, sendTransactionWithAttribution, setLogLevel, validateOracleFeedsOnChain };
|
|
8409
|
+
export { BASE_BUILDER_CODE, CHAINLINK_ORACLE_ADAPTER, CHAINLINK_ORACLE_FEEDS, ContractRouter, DEFAULT_ORACLE_MAX_STALENESS_SECONDS, IndexerClient, IndexerDepositService, IndexerRateManagerService, Zkp2pClient as OfframpClient, PAYMENT_PLATFORMS, PEER_EXTENSION_CHROME_URL, PLATFORM_METADATA, PYTH_CONTRACT_BASE, PYTH_ORACLE_ADAPTER, PYTH_ORACLE_FEEDS, SPREAD_ORACLE_FEEDS, SUPPORTED_CHAIN_IDS, TOKEN_METADATA, ZKP2P_ANDROID_REFERRER, ZKP2P_IOS_REFERRER, Zkp2pClient, apiCreateSellerCredentialBundle, apiGetDepositBundle, apiGetOrderbook, apiGetOwnerDeposits, apiGetPayeeDetails, apiGetQuotesBestByPlatform, apiGetTakerTier, apiPostDepositDetails, apiRequestIdentityAttestation, apiUploadGoogleOAuthSellerCredential, apiUploadSellerCredentialBundle, apiValidatePayeeDetails, appendAttributionToCalldata, assertValidReferrerFeeConfig, compareEventCursorIdsByRecency, convertDepositsForLiquidity, convertIndexerDepositToEscrowView, convertIndexerIntentsToEscrowViews, createCompositeDepositId, createEncryptedBuyerTeeSessionMaterial, createPeerExtensionSdk, defaultIndexerEndpoint, encodePythAdapterConfig, encodeSpreadOracleAdapterConfig, encodeWithAttribution, fetchFulfillmentAndPayment as fetchIndexerFulfillmentAndPayment, getAttributionDataSuffix, getPeerExtensionState, getSpreadOracleConfig, isPeerExtensionAvailable, isValidReferrerFeeBps, isValidReferrerFeeRecipient, logger, openPeerExtensionInstallPage, parseReferrerFeeConfig, peerExtensionSdk, referrerFeeConfigToPreciseUnits, sendTransactionWithAttribution, setLogLevel, validateOracleFeedsOnChain };
|
|
8419
8410
|
//# sourceMappingURL=index.mjs.map
|
|
8420
8411
|
//# sourceMappingURL=index.mjs.map
|