@zkp2p/sdk 0.4.0-rc.4 → 0.4.1
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/dist/index.cjs +260 -53
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +13 -4
- package/dist/index.d.ts +13 -4
- package/dist/index.mjs +260 -55
- package/dist/index.mjs.map +1 -1
- package/dist/react.d.mts +2 -2
- package/dist/react.d.ts +2 -2
- package/dist/{vaultUtils-ChVrAlJN.d.mts → vaultUtils-Dt7ZOITQ.d.mts} +99 -15
- package/dist/{vaultUtils-ChVrAlJN.d.ts → vaultUtils-Dt7ZOITQ.d.ts} +99 -15
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -8,7 +8,7 @@ export { Currency, currencyInfo, getCurrencyCodeFromHash, getCurrencyInfoFromCou
|
|
|
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
|
-
import { createEncryptedSellerCredentialUpload } from '@zkp2p/zkp2p-attestation';
|
|
11
|
+
import { createEncryptedBuyerTeeSessionMaterial as createEncryptedBuyerTeeSessionMaterial$1, createEncryptedSellerCredentialUpload } from '@zkp2p/zkp2p-attestation';
|
|
12
12
|
import { AbiCoder } from 'ethers';
|
|
13
13
|
import { Attribution } from 'ox/erc8021';
|
|
14
14
|
|
|
@@ -326,15 +326,19 @@ var ContractRouter = class {
|
|
|
326
326
|
// src/errors/utils.ts
|
|
327
327
|
function parseAPIError(response, responseText) {
|
|
328
328
|
let message = `Request failed: ${response.statusText}`;
|
|
329
|
+
let parsedBody;
|
|
329
330
|
try {
|
|
330
|
-
|
|
331
|
-
if (
|
|
332
|
-
|
|
331
|
+
parsedBody = responseText ? JSON.parse(responseText) : void 0;
|
|
332
|
+
if (parsedBody && typeof parsedBody === "object") {
|
|
333
|
+
const body = parsedBody;
|
|
334
|
+
if (body.error || body.message) {
|
|
335
|
+
message = body.error || body.message;
|
|
336
|
+
}
|
|
333
337
|
}
|
|
334
338
|
} catch {
|
|
335
339
|
if (responseText && responseText.length < 200) message = responseText;
|
|
336
340
|
}
|
|
337
|
-
return new APIError(message, response.status, { url: response.url });
|
|
341
|
+
return new APIError(message, response.status, { url: response.url, responseBody: parsedBody });
|
|
338
342
|
}
|
|
339
343
|
async function withRetry(fn, maxRetries = 3, delayMs = 1e3, timeoutMs) {
|
|
340
344
|
let lastErr;
|
|
@@ -409,6 +413,61 @@ async function apiSignIntentV3(request, opts) {
|
|
|
409
413
|
function headers() {
|
|
410
414
|
return { "Content-Type": "application/json" };
|
|
411
415
|
}
|
|
416
|
+
function normalizeOptionalString(value) {
|
|
417
|
+
if (typeof value !== "string") {
|
|
418
|
+
return null;
|
|
419
|
+
}
|
|
420
|
+
const normalized = value.trim();
|
|
421
|
+
return normalized.length > 0 ? normalized : null;
|
|
422
|
+
}
|
|
423
|
+
function normalizeBaseUrl(value, label) {
|
|
424
|
+
const normalized = normalizeOptionalString(value)?.replace(/\/+$/u, "");
|
|
425
|
+
if (!normalized) {
|
|
426
|
+
throw new Error(`${label} is required for buyer TEE session encryption.`);
|
|
427
|
+
}
|
|
428
|
+
return normalized;
|
|
429
|
+
}
|
|
430
|
+
function isPayeeBoundSellerCredentialUploadInput(payload) {
|
|
431
|
+
return typeof payload.payeeId === "string";
|
|
432
|
+
}
|
|
433
|
+
function isWiseCredentialUploadInput(payload) {
|
|
434
|
+
return typeof payload.sessionMaterial?.apiToken === "string";
|
|
435
|
+
}
|
|
436
|
+
async function createEncryptedSellerCredentialUploadForPlatform({
|
|
437
|
+
attestationServiceUrl,
|
|
438
|
+
attestationRuntime,
|
|
439
|
+
payload,
|
|
440
|
+
platform,
|
|
441
|
+
timeoutMs
|
|
442
|
+
}) {
|
|
443
|
+
if (platform === "wise") {
|
|
444
|
+
if (!isWiseCredentialUploadInput(payload)) {
|
|
445
|
+
throw new Error("apiToken is required for wise seller credential uploads");
|
|
446
|
+
}
|
|
447
|
+
return createEncryptedSellerCredentialUpload({
|
|
448
|
+
attestationServiceUrl,
|
|
449
|
+
platform: "wise",
|
|
450
|
+
sessionMaterial: payload.sessionMaterial,
|
|
451
|
+
...typeof timeoutMs === "number" ? { timeoutMs } : {},
|
|
452
|
+
...attestationRuntime?.fetch ? { fetch: attestationRuntime.fetch } : {},
|
|
453
|
+
...attestationRuntime?.subtle ? { subtle: attestationRuntime.subtle } : {},
|
|
454
|
+
...attestationRuntime?.getRandomValues ? { getRandomValues: attestationRuntime.getRandomValues } : {}
|
|
455
|
+
});
|
|
456
|
+
}
|
|
457
|
+
if (!isPayeeBoundSellerCredentialUploadInput(payload)) {
|
|
458
|
+
throw new Error(`payeeId is required for ${platform} seller credential uploads`);
|
|
459
|
+
}
|
|
460
|
+
return createEncryptedSellerCredentialUpload({
|
|
461
|
+
attestationServiceUrl,
|
|
462
|
+
platform,
|
|
463
|
+
payeeId: payload.payeeId,
|
|
464
|
+
sessionMaterial: payload.sessionMaterial,
|
|
465
|
+
...typeof timeoutMs === "number" ? { timeoutMs } : {},
|
|
466
|
+
...attestationRuntime?.fetch ? { fetch: attestationRuntime.fetch } : {},
|
|
467
|
+
...attestationRuntime?.subtle ? { subtle: attestationRuntime.subtle } : {},
|
|
468
|
+
...attestationRuntime?.getRandomValues ? { getRandomValues: attestationRuntime.getRandomValues } : {}
|
|
469
|
+
});
|
|
470
|
+
}
|
|
412
471
|
async function apiCreatePaymentAttestation(payload, attestationServiceUrl, platform, actionType) {
|
|
413
472
|
return withRetry(async () => {
|
|
414
473
|
let res;
|
|
@@ -432,18 +491,61 @@ async function apiCreatePaymentAttestation(payload, attestationServiceUrl, platf
|
|
|
432
491
|
return res.json();
|
|
433
492
|
});
|
|
434
493
|
}
|
|
494
|
+
async function apiVerifyBuyerTeePayment(payload, attestationServiceUrl, platform, actionType) {
|
|
495
|
+
return withRetry(async () => {
|
|
496
|
+
let res;
|
|
497
|
+
try {
|
|
498
|
+
const endpoint = `/buyer/verify/${encodeURIComponent(platform)}/${encodeURIComponent(
|
|
499
|
+
actionType
|
|
500
|
+
)}`;
|
|
501
|
+
res = await fetch(`${attestationServiceUrl}${endpoint}`, {
|
|
502
|
+
method: "POST",
|
|
503
|
+
headers: headers(),
|
|
504
|
+
body: JSON.stringify(payload)
|
|
505
|
+
});
|
|
506
|
+
} catch (error) {
|
|
507
|
+
throw new NetworkError("Failed to connect to Attestation Service", {
|
|
508
|
+
endpoint: `/buyer/verify/${platform}/${actionType}`,
|
|
509
|
+
error
|
|
510
|
+
});
|
|
511
|
+
}
|
|
512
|
+
if (!res.ok) {
|
|
513
|
+
const errorText = await res.text();
|
|
514
|
+
throw parseAPIError(res, errorText);
|
|
515
|
+
}
|
|
516
|
+
return res.json();
|
|
517
|
+
});
|
|
518
|
+
}
|
|
519
|
+
async function createEncryptedBuyerTeeSessionMaterial({
|
|
520
|
+
actionType,
|
|
521
|
+
attestationRuntime,
|
|
522
|
+
attestationServiceUrl,
|
|
523
|
+
platform,
|
|
524
|
+
sessionMaterial,
|
|
525
|
+
timeoutMs
|
|
526
|
+
}) {
|
|
527
|
+
const params = {
|
|
528
|
+
actionType,
|
|
529
|
+
attestationServiceUrl: normalizeBaseUrl(attestationServiceUrl, "Attestation Service URL"),
|
|
530
|
+
platform,
|
|
531
|
+
sessionMaterial,
|
|
532
|
+
...timeoutMs == null ? {} : { timeoutMs },
|
|
533
|
+
...attestationRuntime?.fetch ? { fetch: attestationRuntime.fetch } : {},
|
|
534
|
+
...attestationRuntime?.subtle ? { subtle: attestationRuntime.subtle } : {},
|
|
535
|
+
...attestationRuntime?.getRandomValues ? { getRandomValues: attestationRuntime.getRandomValues } : {}
|
|
536
|
+
};
|
|
537
|
+
return createEncryptedBuyerTeeSessionMaterial$1(params);
|
|
538
|
+
}
|
|
435
539
|
async function apiCreateSellerCredentialBundle(payload, attestationServiceUrl, platform, timeoutMs, attestationRuntime) {
|
|
436
540
|
return withRetry(
|
|
437
541
|
async () => {
|
|
438
542
|
const requestFetch = attestationRuntime?.fetch ?? fetch;
|
|
439
|
-
const encryptedUpload = await
|
|
543
|
+
const encryptedUpload = await createEncryptedSellerCredentialUploadForPlatform({
|
|
440
544
|
attestationServiceUrl,
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
...attestationRuntime?.subtle ? { subtle: attestationRuntime.subtle } : {},
|
|
446
|
-
...attestationRuntime?.getRandomValues ? { getRandomValues: attestationRuntime.getRandomValues } : {}
|
|
545
|
+
attestationRuntime,
|
|
546
|
+
payload,
|
|
547
|
+
platform,
|
|
548
|
+
timeoutMs
|
|
447
549
|
});
|
|
448
550
|
let res;
|
|
449
551
|
try {
|
|
@@ -488,12 +590,13 @@ function encodePaymentAttestation(attestation) {
|
|
|
488
590
|
const dataHash = td.dataHash;
|
|
489
591
|
const signatures = [resp.signature];
|
|
490
592
|
const encodedPaymentDetails = resp.encodedPaymentDetails;
|
|
593
|
+
const metadata = typeof resp.metadata === "string" && resp.metadata.length > 0 ? resp.metadata : "0x";
|
|
491
594
|
if (!intentHash || !releaseAmount || !dataHash || !encodedPaymentDetails) {
|
|
492
595
|
throw new Error("Attestation response missing required fields");
|
|
493
596
|
}
|
|
494
597
|
return abiCoder.encode(
|
|
495
598
|
["tuple(bytes32,uint256,bytes32,bytes[],bytes,bytes)"],
|
|
496
|
-
[[intentHash, releaseAmount, dataHash, signatures, encodedPaymentDetails,
|
|
599
|
+
[[intentHash, releaseAmount, dataHash, signatures, encodedPaymentDetails, metadata]]
|
|
497
600
|
);
|
|
498
601
|
}
|
|
499
602
|
|
|
@@ -895,6 +998,7 @@ var PLATFORM_ATTESTATION_CONFIG = {
|
|
|
895
998
|
chime: { actionType: "transfer_chime", actionPlatform: "chime" },
|
|
896
999
|
luxon: { actionType: "transfer_luxon", actionPlatform: "luxon" },
|
|
897
1000
|
n26: { actionType: "transfer_n26", actionPlatform: "n26" },
|
|
1001
|
+
alipay: { actionType: "transfer_alipay", actionPlatform: "alipay" },
|
|
898
1002
|
"zelle-chase": { actionType: "transfer_zelle", actionPlatform: "chase" },
|
|
899
1003
|
"zelle-bofa": { actionType: "transfer_zelle", actionPlatform: "bankofamerica" },
|
|
900
1004
|
"zelle-citi": { actionType: "transfer_zelle", actionPlatform: "citi" }
|
|
@@ -1195,6 +1299,8 @@ var IntentOperations = class {
|
|
|
1195
1299
|
paymentProof = precomputed.paymentProof;
|
|
1196
1300
|
verificationData = precomputed.verificationData;
|
|
1197
1301
|
} else {
|
|
1302
|
+
const { proof } = params;
|
|
1303
|
+
const buyerTeeProof = parseBuyerTeePaymentProofInput(proof);
|
|
1198
1304
|
const attestationServiceUrl = params.attestationServiceUrl ?? this.defaultAttestationService();
|
|
1199
1305
|
const inputs = await this.config.host.getFulfillIntentInputs(intentHash, {
|
|
1200
1306
|
orchestratorAddress: orchestratorContext.address
|
|
@@ -1209,24 +1315,33 @@ var IntentOperations = class {
|
|
|
1209
1315
|
throw new Error("Unknown paymentMethodHash for this network/env; update SDK catalogs.");
|
|
1210
1316
|
}
|
|
1211
1317
|
const platformConfig = resolvePlatformAttestationConfig(platformName);
|
|
1212
|
-
const
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
paymentMethod: paymentMethodHash,
|
|
1222
|
-
fiatCurrency: inputs.fiatCurrency,
|
|
1223
|
-
conversionRate: inputs.conversionRate,
|
|
1224
|
-
payeeDetails: inputs.payeeDetails,
|
|
1225
|
-
timestampBufferMs: params.timestampBufferMs ?? "300000"
|
|
1226
|
-
}
|
|
1318
|
+
const intent = {
|
|
1319
|
+
intentHash,
|
|
1320
|
+
amount: inputs.amount,
|
|
1321
|
+
timestampMs: inputs.intentTimestampMs,
|
|
1322
|
+
paymentMethod: paymentMethodHash,
|
|
1323
|
+
fiatCurrency: inputs.fiatCurrency,
|
|
1324
|
+
conversionRate: inputs.conversionRate,
|
|
1325
|
+
payeeDetails: inputs.payeeDetails,
|
|
1326
|
+
timestampBufferMs: params.timestampBufferMs ?? "300000"
|
|
1227
1327
|
};
|
|
1228
|
-
const attestation = await
|
|
1229
|
-
|
|
1328
|
+
const attestation = buyerTeeProof ? await apiVerifyBuyerTeePayment(
|
|
1329
|
+
{
|
|
1330
|
+
encryptedSessionMaterial: buyerTeeProof.encryptedSessionMaterial,
|
|
1331
|
+
params: buyerTeeProof.params,
|
|
1332
|
+
chainId: this.config.getChainId(),
|
|
1333
|
+
intent
|
|
1334
|
+
},
|
|
1335
|
+
attestationServiceUrl,
|
|
1336
|
+
platformConfig.actionPlatform,
|
|
1337
|
+
platformConfig.actionType
|
|
1338
|
+
) : await apiCreatePaymentAttestation(
|
|
1339
|
+
{
|
|
1340
|
+
proofType: "reclaim",
|
|
1341
|
+
proof: typeof proof === "string" ? proof : serializeProofInput(proof),
|
|
1342
|
+
chainId: this.config.getChainId(),
|
|
1343
|
+
intent
|
|
1344
|
+
},
|
|
1230
1345
|
attestationServiceUrl,
|
|
1231
1346
|
platformConfig.actionPlatform,
|
|
1232
1347
|
platformConfig.actionType
|
|
@@ -1344,6 +1459,27 @@ function serializeProofInput(proof) {
|
|
|
1344
1459
|
(_key, value) => typeof value === "bigint" ? value.toString() : value
|
|
1345
1460
|
);
|
|
1346
1461
|
}
|
|
1462
|
+
function isRecord(value) {
|
|
1463
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
1464
|
+
}
|
|
1465
|
+
function isBuyerTeeParams(value) {
|
|
1466
|
+
return isRecord(value) && Object.values(value).every(
|
|
1467
|
+
(entry) => typeof entry === "string" || typeof entry === "number" || typeof entry === "boolean"
|
|
1468
|
+
);
|
|
1469
|
+
}
|
|
1470
|
+
function parseBuyerTeePaymentProofInput(proof) {
|
|
1471
|
+
if (!isRecord(proof) || proof.proofType !== "buyerTee") {
|
|
1472
|
+
return null;
|
|
1473
|
+
}
|
|
1474
|
+
if (typeof proof.encryptedSessionMaterial !== "string" || !isBuyerTeeParams(proof.params)) {
|
|
1475
|
+
throw new Error("Buyer TEE proof requires encryptedSessionMaterial and params.");
|
|
1476
|
+
}
|
|
1477
|
+
return {
|
|
1478
|
+
proofType: "buyerTee",
|
|
1479
|
+
encryptedSessionMaterial: proof.encryptedSessionMaterial,
|
|
1480
|
+
params: proof.params
|
|
1481
|
+
};
|
|
1482
|
+
}
|
|
1347
1483
|
function normalizeSignalIntentReferralFees(params) {
|
|
1348
1484
|
if (params.referralFees) {
|
|
1349
1485
|
return params.referralFees.map((referralFee) => ({
|
|
@@ -5114,6 +5250,19 @@ async function apiUploadSellerCredential(processorName, payeeDetails, bundle, ba
|
|
|
5114
5250
|
timeoutMs
|
|
5115
5251
|
});
|
|
5116
5252
|
}
|
|
5253
|
+
async function apiConfirmPayPalForwarding(payeeDetails, body, baseApiUrl, opts) {
|
|
5254
|
+
const endpoint = `/v2/makers/paypal/${encodeURIComponent(
|
|
5255
|
+
payeeDetails
|
|
5256
|
+
)}/seller-credential/forwarding-confirmation`;
|
|
5257
|
+
return apiFetch({
|
|
5258
|
+
url: `${withApiBase(baseApiUrl)}${endpoint}`,
|
|
5259
|
+
method: "POST",
|
|
5260
|
+
body,
|
|
5261
|
+
apiKey: opts?.apiKey,
|
|
5262
|
+
authToken: opts?.authToken,
|
|
5263
|
+
timeoutMs: opts?.timeoutMs
|
|
5264
|
+
});
|
|
5265
|
+
}
|
|
5117
5266
|
async function apiGetSellerCredentialStatus(processorName, payeeDetails, baseApiUrl, timeoutMs) {
|
|
5118
5267
|
const endpoint = `/v2/makers/${encodeURIComponent(processorName)}/${encodeURIComponent(
|
|
5119
5268
|
payeeDetails
|
|
@@ -5125,10 +5274,16 @@ async function apiGetSellerCredentialStatus(processorName, payeeDetails, baseApi
|
|
|
5125
5274
|
});
|
|
5126
5275
|
}
|
|
5127
5276
|
async function apiVerifySellerPayment(platform, req, baseApiUrl, timeoutMs, apiKey, authToken) {
|
|
5277
|
+
const body = {
|
|
5278
|
+
txId: req.txId,
|
|
5279
|
+
chainId: req.chainId,
|
|
5280
|
+
intent: req.intent,
|
|
5281
|
+
...req.metadata !== void 0 ? { metadata: req.metadata } : {}
|
|
5282
|
+
};
|
|
5128
5283
|
return apiFetch({
|
|
5129
5284
|
url: `${withApiBase(baseApiUrl)}/v2/verify/seller/${encodeURIComponent(platform)}`,
|
|
5130
5285
|
method: "POST",
|
|
5131
|
-
body
|
|
5286
|
+
body,
|
|
5132
5287
|
apiKey,
|
|
5133
5288
|
authToken,
|
|
5134
5289
|
timeoutMs
|
|
@@ -5205,6 +5360,11 @@ var applyReferrerFeeDisplayFieldsToTokenAmount = (tokenAmount, referrerFeeConfig
|
|
|
5205
5360
|
}
|
|
5206
5361
|
};
|
|
5207
5362
|
var applyReferrerFeeDisplayFieldsToQuote = (quote, referrerFeeConfig, decimals) => {
|
|
5363
|
+
const enrichedQuote = quote;
|
|
5364
|
+
const hasCuratorReferrerFeeFields = enrichedQuote.referrerFeeAmount != null || enrichedQuote.referrerFeeBps != null;
|
|
5365
|
+
if (hasCuratorReferrerFeeFields) {
|
|
5366
|
+
return enrichedQuote;
|
|
5367
|
+
}
|
|
5208
5368
|
const signalIntentAmount = quote.signalIntentAmount ?? quote.intent?.amount ?? quote.tokenAmount;
|
|
5209
5369
|
const adjusted = applyReferrerFeeDisplayFieldsToTokenAmount(
|
|
5210
5370
|
quote.tokenAmount,
|
|
@@ -6174,7 +6334,7 @@ var Zkp2pClient = class {
|
|
|
6174
6334
|
* ```
|
|
6175
6335
|
*
|
|
6176
6336
|
* @param params.intentHash - The intent hash to fulfill (0x-prefixed, 32 bytes)
|
|
6177
|
-
* @param params.proof - Payment proof from Reclaim (object or JSON string)
|
|
6337
|
+
* @param params.proof - Payment proof from Reclaim (object or JSON string) or buyer TEE proof input
|
|
6178
6338
|
* @param params.timestampBufferMs - Allowed timestamp variance (default: 300000ms)
|
|
6179
6339
|
* @param params.attestationServiceUrl - Override attestation service URL
|
|
6180
6340
|
* @param params.postIntentHookData - Data to pass to post-intent hook
|
|
@@ -7732,8 +7892,10 @@ var Zkp2pClient = class {
|
|
|
7732
7892
|
* seller-automated-release availability is governed by curator's probe/revalidation state
|
|
7733
7893
|
* rather than these timestamps.
|
|
7734
7894
|
*
|
|
7735
|
-
*
|
|
7736
|
-
*
|
|
7895
|
+
* Create a signed seller credential bundle with attestation-service and store it via
|
|
7896
|
+
* curator's platform plus hashed payee-details route. Session-cookie platforms register
|
|
7897
|
+
* or recover the payee maker row before upload; Wise derives the payee hash inside the enclave
|
|
7898
|
+
* from the submitted Personal API Token.
|
|
7737
7899
|
*/
|
|
7738
7900
|
async uploadSellerCredential(params, opts) {
|
|
7739
7901
|
const baseApiUrl = this.stripTrailingSlash(
|
|
@@ -7743,6 +7905,33 @@ var Zkp2pClient = class {
|
|
|
7743
7905
|
const attestationServiceUrl = this.stripTrailingSlash(
|
|
7744
7906
|
opts?.attestationServiceUrl ?? this.defaultAttestationServiceForBaseApiUrl(baseApiUrl)
|
|
7745
7907
|
);
|
|
7908
|
+
const createBundle = (uploadPayload2) => opts?.attestationRuntime ? apiCreateSellerCredentialBundle(
|
|
7909
|
+
uploadPayload2,
|
|
7910
|
+
attestationServiceUrl,
|
|
7911
|
+
params.platform,
|
|
7912
|
+
timeoutMs,
|
|
7913
|
+
opts.attestationRuntime
|
|
7914
|
+
) : apiCreateSellerCredentialBundle(
|
|
7915
|
+
uploadPayload2,
|
|
7916
|
+
attestationServiceUrl,
|
|
7917
|
+
params.platform,
|
|
7918
|
+
timeoutMs
|
|
7919
|
+
);
|
|
7920
|
+
if (params.platform === "wise") {
|
|
7921
|
+
const bundleResponse2 = await createBundle({
|
|
7922
|
+
sessionMaterial: params.sessionMaterial
|
|
7923
|
+
});
|
|
7924
|
+
if (!bundleResponse2.success || !bundleResponse2.responseObject) {
|
|
7925
|
+
throw new Error(bundleResponse2.message || "Failed to create seller credential bundle");
|
|
7926
|
+
}
|
|
7927
|
+
return apiUploadSellerCredential(
|
|
7928
|
+
params.platform,
|
|
7929
|
+
bundleResponse2.responseObject.payeeIdHash,
|
|
7930
|
+
bundleResponse2.responseObject,
|
|
7931
|
+
baseApiUrl,
|
|
7932
|
+
timeoutMs
|
|
7933
|
+
);
|
|
7934
|
+
}
|
|
7746
7935
|
const registeredPayeePayload = {
|
|
7747
7936
|
offchainId: params.offchainId,
|
|
7748
7937
|
processorName: params.platform
|
|
@@ -7765,18 +7954,7 @@ var Zkp2pClient = class {
|
|
|
7765
7954
|
payeeId: params.payeeId,
|
|
7766
7955
|
sessionMaterial: params.sessionMaterial
|
|
7767
7956
|
};
|
|
7768
|
-
const bundleResponse =
|
|
7769
|
-
uploadPayload,
|
|
7770
|
-
attestationServiceUrl,
|
|
7771
|
-
params.platform,
|
|
7772
|
-
timeoutMs,
|
|
7773
|
-
opts.attestationRuntime
|
|
7774
|
-
) : await apiCreateSellerCredentialBundle(
|
|
7775
|
-
uploadPayload,
|
|
7776
|
-
attestationServiceUrl,
|
|
7777
|
-
params.platform,
|
|
7778
|
-
timeoutMs
|
|
7779
|
-
);
|
|
7957
|
+
const bundleResponse = await createBundle(uploadPayload);
|
|
7780
7958
|
if (!bundleResponse.success || !bundleResponse.responseObject) {
|
|
7781
7959
|
throw new Error(bundleResponse.message || "Failed to create seller credential bundle");
|
|
7782
7960
|
}
|
|
@@ -7792,6 +7970,32 @@ var Zkp2pClient = class {
|
|
|
7792
7970
|
timeoutMs
|
|
7793
7971
|
);
|
|
7794
7972
|
}
|
|
7973
|
+
/**
|
|
7974
|
+
* Confirms the PayPal Gmail-forwarding setup for an existing maker payee hash.
|
|
7975
|
+
*
|
|
7976
|
+
* Uses curator's `/forwarding-confirmation` route and forwards both API key and
|
|
7977
|
+
* bearer token so either auth strategy can satisfy the hybrid gate. The endpoint
|
|
7978
|
+
* is rate-limited server-side; callers should surface retry guidance from APIError.
|
|
7979
|
+
*/
|
|
7980
|
+
async confirmPayPalForwarding(params, opts) {
|
|
7981
|
+
const baseApiUrl = this.stripTrailingSlash(
|
|
7982
|
+
opts?.baseApiUrl ?? this.baseApiUrl ?? DEFAULT_BASE_API_URL
|
|
7983
|
+
);
|
|
7984
|
+
const timeoutMs = opts?.timeoutMs ?? this.apiTimeoutMs;
|
|
7985
|
+
return apiConfirmPayPalForwarding(
|
|
7986
|
+
params.payeeDetails,
|
|
7987
|
+
{
|
|
7988
|
+
payeeEmail: params.payeeEmail,
|
|
7989
|
+
forwardingInitiatorEmail: params.forwardingInitiatorEmail
|
|
7990
|
+
},
|
|
7991
|
+
baseApiUrl,
|
|
7992
|
+
{
|
|
7993
|
+
apiKey: this.apiKey,
|
|
7994
|
+
authToken: this.authorizationToken,
|
|
7995
|
+
timeoutMs
|
|
7996
|
+
}
|
|
7997
|
+
);
|
|
7998
|
+
}
|
|
7795
7999
|
/**
|
|
7796
8000
|
* Status is a coarse curator-owned signal (`active` / `inactive` / `missing`) and intentionally
|
|
7797
8001
|
* omits low-level diagnostics. Curator may still re-probe stale credentials during verify, so callers
|
|
@@ -7830,7 +8034,8 @@ var Zkp2pClient = class {
|
|
|
7830
8034
|
{
|
|
7831
8035
|
txId: params.txId,
|
|
7832
8036
|
chainId: params.chainId,
|
|
7833
|
-
intent: params.intent
|
|
8037
|
+
intent: params.intent,
|
|
8038
|
+
...params.metadata !== void 0 ? { metadata: params.metadata } : {}
|
|
7834
8039
|
},
|
|
7835
8040
|
baseApiUrl,
|
|
7836
8041
|
timeoutMs,
|
|
@@ -8029,7 +8234,7 @@ var assertObjectInput = (params) => {
|
|
|
8029
8234
|
}
|
|
8030
8235
|
return params;
|
|
8031
8236
|
};
|
|
8032
|
-
var
|
|
8237
|
+
var normalizeOptionalString2 = (value, label) => {
|
|
8033
8238
|
if (value === void 0) {
|
|
8034
8239
|
return void 0;
|
|
8035
8240
|
}
|
|
@@ -8043,7 +8248,7 @@ var normalizeOptionalString = (value, label) => {
|
|
|
8043
8248
|
return trimmed;
|
|
8044
8249
|
};
|
|
8045
8250
|
var normalizeOptionalUrl = (value, label) => {
|
|
8046
|
-
const trimmed =
|
|
8251
|
+
const trimmed = normalizeOptionalString2(value, label);
|
|
8047
8252
|
if (trimmed === void 0) {
|
|
8048
8253
|
return void 0;
|
|
8049
8254
|
}
|
|
@@ -8170,20 +8375,20 @@ var buildOnrampQueryString = (params) => {
|
|
|
8170
8375
|
searchParams.set(key, value);
|
|
8171
8376
|
}
|
|
8172
8377
|
};
|
|
8173
|
-
setParam("referrer",
|
|
8378
|
+
setParam("referrer", normalizeOptionalString2(validated.referrer, "referrer"));
|
|
8174
8379
|
setParam("referrerLogo", normalizeOptionalUrl(validated.referrerLogo, "referrerLogo"));
|
|
8175
|
-
setParam("inputCurrency",
|
|
8380
|
+
setParam("inputCurrency", normalizeOptionalString2(validated.inputCurrency, "inputCurrency"));
|
|
8176
8381
|
setParam("inputAmount", normalizeFiatAmount(validated.inputAmount));
|
|
8177
8382
|
setParam(
|
|
8178
8383
|
"paymentPlatform",
|
|
8179
|
-
|
|
8384
|
+
normalizeOptionalString2(validated.paymentPlatform, "paymentPlatform")
|
|
8180
8385
|
);
|
|
8181
8386
|
setParam("depositId", normalizeIntegerParam(validated.depositId, "depositId"));
|
|
8182
|
-
setParam("toToken",
|
|
8387
|
+
setParam("toToken", normalizeOptionalString2(validated.toToken, "toToken"));
|
|
8183
8388
|
setParam("amountUsdc", normalizeUsdcAmount(validated.amountUsdc));
|
|
8184
8389
|
setParam(
|
|
8185
8390
|
"recipientAddress",
|
|
8186
|
-
|
|
8391
|
+
normalizeOptionalString2(validated.recipientAddress, "recipientAddress")
|
|
8187
8392
|
);
|
|
8188
8393
|
setParam("intentHash", normalizeIntentHash(validated.intentHash));
|
|
8189
8394
|
return searchParams.toString();
|
|
@@ -8244,6 +8449,6 @@ var logger = {
|
|
|
8244
8449
|
}
|
|
8245
8450
|
};
|
|
8246
8451
|
|
|
8247
|
-
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, apiValidatePayeeDetails, appendAttributionToCalldata, assertValidReferrerFeeConfig, compareEventCursorIdsByRecency, convertDepositsForLiquidity, convertIndexerDepositToEscrowView, convertIndexerIntentsToEscrowViews, createCompositeDepositId, createPeerExtensionSdk, defaultIndexerEndpoint, encodePythAdapterConfig, encodeSpreadOracleAdapterConfig, encodeWithAttribution, fetchFulfillmentAndPayment as fetchIndexerFulfillmentAndPayment, getAttributionDataSuffix, getPeerExtensionState, getSpreadOracleConfig, isPeerExtensionAvailable, isValidReferrerFeeBps, isValidReferrerFeeRecipient, logger, openPeerExtensionInstallPage, parseReferrerFeeConfig, peerExtensionSdk, referrerFeeConfigToPreciseUnits, sendTransactionWithAttribution, setLogLevel, validateOracleFeedsOnChain };
|
|
8452
|
+
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, 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 };
|
|
8248
8453
|
//# sourceMappingURL=index.mjs.map
|
|
8249
8454
|
//# sourceMappingURL=index.mjs.map
|