@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.cjs
CHANGED
|
@@ -42284,15 +42284,19 @@ init_errors();
|
|
|
42284
42284
|
init_errors();
|
|
42285
42285
|
function parseAPIError(response, responseText) {
|
|
42286
42286
|
let message = `Request failed: ${response.statusText}`;
|
|
42287
|
+
let parsedBody;
|
|
42287
42288
|
try {
|
|
42288
|
-
|
|
42289
|
-
if (
|
|
42290
|
-
|
|
42289
|
+
parsedBody = responseText ? JSON.parse(responseText) : void 0;
|
|
42290
|
+
if (parsedBody && typeof parsedBody === "object") {
|
|
42291
|
+
const body = parsedBody;
|
|
42292
|
+
if (body.error || body.message) {
|
|
42293
|
+
message = body.error || body.message;
|
|
42294
|
+
}
|
|
42291
42295
|
}
|
|
42292
42296
|
} catch {
|
|
42293
42297
|
if (responseText && responseText.length < 200) message = responseText;
|
|
42294
42298
|
}
|
|
42295
|
-
return new exports.APIError(message, response.status, { url: response.url });
|
|
42299
|
+
return new exports.APIError(message, response.status, { url: response.url, responseBody: parsedBody });
|
|
42296
42300
|
}
|
|
42297
42301
|
async function withRetry(fn, maxRetries = 3, delayMs = 1e3, timeoutMs) {
|
|
42298
42302
|
let lastErr;
|
|
@@ -42370,6 +42374,61 @@ init_errors();
|
|
|
42370
42374
|
function headers() {
|
|
42371
42375
|
return { "Content-Type": "application/json" };
|
|
42372
42376
|
}
|
|
42377
|
+
function normalizeOptionalString(value) {
|
|
42378
|
+
if (typeof value !== "string") {
|
|
42379
|
+
return null;
|
|
42380
|
+
}
|
|
42381
|
+
const normalized = value.trim();
|
|
42382
|
+
return normalized.length > 0 ? normalized : null;
|
|
42383
|
+
}
|
|
42384
|
+
function normalizeBaseUrl(value, label) {
|
|
42385
|
+
const normalized = normalizeOptionalString(value)?.replace(/\/+$/u, "");
|
|
42386
|
+
if (!normalized) {
|
|
42387
|
+
throw new Error(`${label} is required for buyer TEE session encryption.`);
|
|
42388
|
+
}
|
|
42389
|
+
return normalized;
|
|
42390
|
+
}
|
|
42391
|
+
function isPayeeBoundSellerCredentialUploadInput(payload) {
|
|
42392
|
+
return typeof payload.payeeId === "string";
|
|
42393
|
+
}
|
|
42394
|
+
function isWiseCredentialUploadInput(payload) {
|
|
42395
|
+
return typeof payload.sessionMaterial?.apiToken === "string";
|
|
42396
|
+
}
|
|
42397
|
+
async function createEncryptedSellerCredentialUploadForPlatform({
|
|
42398
|
+
attestationServiceUrl,
|
|
42399
|
+
attestationRuntime,
|
|
42400
|
+
payload,
|
|
42401
|
+
platform,
|
|
42402
|
+
timeoutMs
|
|
42403
|
+
}) {
|
|
42404
|
+
if (platform === "wise") {
|
|
42405
|
+
if (!isWiseCredentialUploadInput(payload)) {
|
|
42406
|
+
throw new Error("apiToken is required for wise seller credential uploads");
|
|
42407
|
+
}
|
|
42408
|
+
return zkp2pAttestation.createEncryptedSellerCredentialUpload({
|
|
42409
|
+
attestationServiceUrl,
|
|
42410
|
+
platform: "wise",
|
|
42411
|
+
sessionMaterial: payload.sessionMaterial,
|
|
42412
|
+
...typeof timeoutMs === "number" ? { timeoutMs } : {},
|
|
42413
|
+
...attestationRuntime?.fetch ? { fetch: attestationRuntime.fetch } : {},
|
|
42414
|
+
...attestationRuntime?.subtle ? { subtle: attestationRuntime.subtle } : {},
|
|
42415
|
+
...attestationRuntime?.getRandomValues ? { getRandomValues: attestationRuntime.getRandomValues } : {}
|
|
42416
|
+
});
|
|
42417
|
+
}
|
|
42418
|
+
if (!isPayeeBoundSellerCredentialUploadInput(payload)) {
|
|
42419
|
+
throw new Error(`payeeId is required for ${platform} seller credential uploads`);
|
|
42420
|
+
}
|
|
42421
|
+
return zkp2pAttestation.createEncryptedSellerCredentialUpload({
|
|
42422
|
+
attestationServiceUrl,
|
|
42423
|
+
platform,
|
|
42424
|
+
payeeId: payload.payeeId,
|
|
42425
|
+
sessionMaterial: payload.sessionMaterial,
|
|
42426
|
+
...typeof timeoutMs === "number" ? { timeoutMs } : {},
|
|
42427
|
+
...attestationRuntime?.fetch ? { fetch: attestationRuntime.fetch } : {},
|
|
42428
|
+
...attestationRuntime?.subtle ? { subtle: attestationRuntime.subtle } : {},
|
|
42429
|
+
...attestationRuntime?.getRandomValues ? { getRandomValues: attestationRuntime.getRandomValues } : {}
|
|
42430
|
+
});
|
|
42431
|
+
}
|
|
42373
42432
|
async function apiCreatePaymentAttestation(payload, attestationServiceUrl, platform, actionType) {
|
|
42374
42433
|
return withRetry(async () => {
|
|
42375
42434
|
let res;
|
|
@@ -42393,18 +42452,61 @@ async function apiCreatePaymentAttestation(payload, attestationServiceUrl, platf
|
|
|
42393
42452
|
return res.json();
|
|
42394
42453
|
});
|
|
42395
42454
|
}
|
|
42455
|
+
async function apiVerifyBuyerTeePayment(payload, attestationServiceUrl, platform, actionType) {
|
|
42456
|
+
return withRetry(async () => {
|
|
42457
|
+
let res;
|
|
42458
|
+
try {
|
|
42459
|
+
const endpoint = `/buyer/verify/${encodeURIComponent(platform)}/${encodeURIComponent(
|
|
42460
|
+
actionType
|
|
42461
|
+
)}`;
|
|
42462
|
+
res = await fetch(`${attestationServiceUrl}${endpoint}`, {
|
|
42463
|
+
method: "POST",
|
|
42464
|
+
headers: headers(),
|
|
42465
|
+
body: JSON.stringify(payload)
|
|
42466
|
+
});
|
|
42467
|
+
} catch (error) {
|
|
42468
|
+
throw new exports.NetworkError("Failed to connect to Attestation Service", {
|
|
42469
|
+
endpoint: `/buyer/verify/${platform}/${actionType}`,
|
|
42470
|
+
error
|
|
42471
|
+
});
|
|
42472
|
+
}
|
|
42473
|
+
if (!res.ok) {
|
|
42474
|
+
const errorText = await res.text();
|
|
42475
|
+
throw parseAPIError(res, errorText);
|
|
42476
|
+
}
|
|
42477
|
+
return res.json();
|
|
42478
|
+
});
|
|
42479
|
+
}
|
|
42480
|
+
async function createEncryptedBuyerTeeSessionMaterial({
|
|
42481
|
+
actionType,
|
|
42482
|
+
attestationRuntime,
|
|
42483
|
+
attestationServiceUrl,
|
|
42484
|
+
platform,
|
|
42485
|
+
sessionMaterial,
|
|
42486
|
+
timeoutMs
|
|
42487
|
+
}) {
|
|
42488
|
+
const params = {
|
|
42489
|
+
actionType,
|
|
42490
|
+
attestationServiceUrl: normalizeBaseUrl(attestationServiceUrl, "Attestation Service URL"),
|
|
42491
|
+
platform,
|
|
42492
|
+
sessionMaterial,
|
|
42493
|
+
...timeoutMs == null ? {} : { timeoutMs },
|
|
42494
|
+
...attestationRuntime?.fetch ? { fetch: attestationRuntime.fetch } : {},
|
|
42495
|
+
...attestationRuntime?.subtle ? { subtle: attestationRuntime.subtle } : {},
|
|
42496
|
+
...attestationRuntime?.getRandomValues ? { getRandomValues: attestationRuntime.getRandomValues } : {}
|
|
42497
|
+
};
|
|
42498
|
+
return zkp2pAttestation.createEncryptedBuyerTeeSessionMaterial(params);
|
|
42499
|
+
}
|
|
42396
42500
|
async function apiCreateSellerCredentialBundle(payload, attestationServiceUrl, platform, timeoutMs, attestationRuntime) {
|
|
42397
42501
|
return withRetry(
|
|
42398
42502
|
async () => {
|
|
42399
42503
|
const requestFetch = attestationRuntime?.fetch ?? fetch;
|
|
42400
|
-
const encryptedUpload = await
|
|
42504
|
+
const encryptedUpload = await createEncryptedSellerCredentialUploadForPlatform({
|
|
42401
42505
|
attestationServiceUrl,
|
|
42402
|
-
|
|
42403
|
-
|
|
42404
|
-
|
|
42405
|
-
|
|
42406
|
-
...attestationRuntime?.subtle ? { subtle: attestationRuntime.subtle } : {},
|
|
42407
|
-
...attestationRuntime?.getRandomValues ? { getRandomValues: attestationRuntime.getRandomValues } : {}
|
|
42506
|
+
attestationRuntime,
|
|
42507
|
+
payload,
|
|
42508
|
+
platform,
|
|
42509
|
+
timeoutMs
|
|
42408
42510
|
});
|
|
42409
42511
|
let res;
|
|
42410
42512
|
try {
|
|
@@ -42449,12 +42551,13 @@ function encodePaymentAttestation(attestation) {
|
|
|
42449
42551
|
const dataHash = td.dataHash;
|
|
42450
42552
|
const signatures = [resp.signature];
|
|
42451
42553
|
const encodedPaymentDetails = resp.encodedPaymentDetails;
|
|
42554
|
+
const metadata = typeof resp.metadata === "string" && resp.metadata.length > 0 ? resp.metadata : "0x";
|
|
42452
42555
|
if (!intentHash || !releaseAmount || !dataHash || !encodedPaymentDetails) {
|
|
42453
42556
|
throw new Error("Attestation response missing required fields");
|
|
42454
42557
|
}
|
|
42455
42558
|
return abiCoder.encode(
|
|
42456
42559
|
["tuple(bytes32,uint256,bytes32,bytes[],bytes,bytes)"],
|
|
42457
|
-
[[intentHash, releaseAmount, dataHash, signatures, encodedPaymentDetails,
|
|
42560
|
+
[[intentHash, releaseAmount, dataHash, signatures, encodedPaymentDetails, metadata]]
|
|
42458
42561
|
);
|
|
42459
42562
|
}
|
|
42460
42563
|
|
|
@@ -42863,6 +42966,7 @@ var PLATFORM_ATTESTATION_CONFIG = {
|
|
|
42863
42966
|
chime: { actionType: "transfer_chime", actionPlatform: "chime" },
|
|
42864
42967
|
luxon: { actionType: "transfer_luxon", actionPlatform: "luxon" },
|
|
42865
42968
|
n26: { actionType: "transfer_n26", actionPlatform: "n26" },
|
|
42969
|
+
alipay: { actionType: "transfer_alipay", actionPlatform: "alipay" },
|
|
42866
42970
|
"zelle-chase": { actionType: "transfer_zelle", actionPlatform: "chase" },
|
|
42867
42971
|
"zelle-bofa": { actionType: "transfer_zelle", actionPlatform: "bankofamerica" },
|
|
42868
42972
|
"zelle-citi": { actionType: "transfer_zelle", actionPlatform: "citi" }
|
|
@@ -43163,6 +43267,8 @@ var IntentOperations = class {
|
|
|
43163
43267
|
paymentProof = precomputed.paymentProof;
|
|
43164
43268
|
verificationData = precomputed.verificationData;
|
|
43165
43269
|
} else {
|
|
43270
|
+
const { proof } = params;
|
|
43271
|
+
const buyerTeeProof = parseBuyerTeePaymentProofInput(proof);
|
|
43166
43272
|
const attestationServiceUrl = params.attestationServiceUrl ?? this.defaultAttestationService();
|
|
43167
43273
|
const inputs = await this.config.host.getFulfillIntentInputs(intentHash, {
|
|
43168
43274
|
orchestratorAddress: orchestratorContext.address
|
|
@@ -43177,24 +43283,33 @@ var IntentOperations = class {
|
|
|
43177
43283
|
throw new Error("Unknown paymentMethodHash for this network/env; update SDK catalogs.");
|
|
43178
43284
|
}
|
|
43179
43285
|
const platformConfig = resolvePlatformAttestationConfig(platformName);
|
|
43180
|
-
const
|
|
43181
|
-
|
|
43182
|
-
|
|
43183
|
-
|
|
43184
|
-
|
|
43185
|
-
|
|
43186
|
-
|
|
43187
|
-
|
|
43188
|
-
|
|
43189
|
-
paymentMethod: paymentMethodHash,
|
|
43190
|
-
fiatCurrency: inputs.fiatCurrency,
|
|
43191
|
-
conversionRate: inputs.conversionRate,
|
|
43192
|
-
payeeDetails: inputs.payeeDetails,
|
|
43193
|
-
timestampBufferMs: params.timestampBufferMs ?? "300000"
|
|
43194
|
-
}
|
|
43286
|
+
const intent = {
|
|
43287
|
+
intentHash,
|
|
43288
|
+
amount: inputs.amount,
|
|
43289
|
+
timestampMs: inputs.intentTimestampMs,
|
|
43290
|
+
paymentMethod: paymentMethodHash,
|
|
43291
|
+
fiatCurrency: inputs.fiatCurrency,
|
|
43292
|
+
conversionRate: inputs.conversionRate,
|
|
43293
|
+
payeeDetails: inputs.payeeDetails,
|
|
43294
|
+
timestampBufferMs: params.timestampBufferMs ?? "300000"
|
|
43195
43295
|
};
|
|
43196
|
-
const attestation = await
|
|
43197
|
-
|
|
43296
|
+
const attestation = buyerTeeProof ? await apiVerifyBuyerTeePayment(
|
|
43297
|
+
{
|
|
43298
|
+
encryptedSessionMaterial: buyerTeeProof.encryptedSessionMaterial,
|
|
43299
|
+
params: buyerTeeProof.params,
|
|
43300
|
+
chainId: this.config.getChainId(),
|
|
43301
|
+
intent
|
|
43302
|
+
},
|
|
43303
|
+
attestationServiceUrl,
|
|
43304
|
+
platformConfig.actionPlatform,
|
|
43305
|
+
platformConfig.actionType
|
|
43306
|
+
) : await apiCreatePaymentAttestation(
|
|
43307
|
+
{
|
|
43308
|
+
proofType: "reclaim",
|
|
43309
|
+
proof: typeof proof === "string" ? proof : serializeProofInput(proof),
|
|
43310
|
+
chainId: this.config.getChainId(),
|
|
43311
|
+
intent
|
|
43312
|
+
},
|
|
43198
43313
|
attestationServiceUrl,
|
|
43199
43314
|
platformConfig.actionPlatform,
|
|
43200
43315
|
platformConfig.actionType
|
|
@@ -43312,6 +43427,27 @@ function serializeProofInput(proof) {
|
|
|
43312
43427
|
(_key, value) => typeof value === "bigint" ? value.toString() : value
|
|
43313
43428
|
);
|
|
43314
43429
|
}
|
|
43430
|
+
function isRecord(value) {
|
|
43431
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
43432
|
+
}
|
|
43433
|
+
function isBuyerTeeParams(value) {
|
|
43434
|
+
return isRecord(value) && Object.values(value).every(
|
|
43435
|
+
(entry) => typeof entry === "string" || typeof entry === "number" || typeof entry === "boolean"
|
|
43436
|
+
);
|
|
43437
|
+
}
|
|
43438
|
+
function parseBuyerTeePaymentProofInput(proof) {
|
|
43439
|
+
if (!isRecord(proof) || proof.proofType !== "buyerTee") {
|
|
43440
|
+
return null;
|
|
43441
|
+
}
|
|
43442
|
+
if (typeof proof.encryptedSessionMaterial !== "string" || !isBuyerTeeParams(proof.params)) {
|
|
43443
|
+
throw new Error("Buyer TEE proof requires encryptedSessionMaterial and params.");
|
|
43444
|
+
}
|
|
43445
|
+
return {
|
|
43446
|
+
proofType: "buyerTee",
|
|
43447
|
+
encryptedSessionMaterial: proof.encryptedSessionMaterial,
|
|
43448
|
+
params: proof.params
|
|
43449
|
+
};
|
|
43450
|
+
}
|
|
43315
43451
|
function normalizeSignalIntentReferralFees(params) {
|
|
43316
43452
|
if (params.referralFees) {
|
|
43317
43453
|
return params.referralFees.map((referralFee) => ({
|
|
@@ -47089,6 +47225,19 @@ async function apiUploadSellerCredential(processorName, payeeDetails, bundle, ba
|
|
|
47089
47225
|
timeoutMs
|
|
47090
47226
|
});
|
|
47091
47227
|
}
|
|
47228
|
+
async function apiConfirmPayPalForwarding(payeeDetails, body, baseApiUrl, opts) {
|
|
47229
|
+
const endpoint = `/v2/makers/paypal/${encodeURIComponent(
|
|
47230
|
+
payeeDetails
|
|
47231
|
+
)}/seller-credential/forwarding-confirmation`;
|
|
47232
|
+
return apiFetch({
|
|
47233
|
+
url: `${withApiBase(baseApiUrl)}${endpoint}`,
|
|
47234
|
+
method: "POST",
|
|
47235
|
+
body,
|
|
47236
|
+
apiKey: opts?.apiKey,
|
|
47237
|
+
authToken: opts?.authToken,
|
|
47238
|
+
timeoutMs: opts?.timeoutMs
|
|
47239
|
+
});
|
|
47240
|
+
}
|
|
47092
47241
|
async function apiGetSellerCredentialStatus(processorName, payeeDetails, baseApiUrl, timeoutMs) {
|
|
47093
47242
|
const endpoint = `/v2/makers/${encodeURIComponent(processorName)}/${encodeURIComponent(
|
|
47094
47243
|
payeeDetails
|
|
@@ -47100,10 +47249,16 @@ async function apiGetSellerCredentialStatus(processorName, payeeDetails, baseApi
|
|
|
47100
47249
|
});
|
|
47101
47250
|
}
|
|
47102
47251
|
async function apiVerifySellerPayment(platform, req, baseApiUrl, timeoutMs, apiKey, authToken) {
|
|
47252
|
+
const body = {
|
|
47253
|
+
txId: req.txId,
|
|
47254
|
+
chainId: req.chainId,
|
|
47255
|
+
intent: req.intent,
|
|
47256
|
+
...req.metadata !== void 0 ? { metadata: req.metadata } : {}
|
|
47257
|
+
};
|
|
47103
47258
|
return apiFetch({
|
|
47104
47259
|
url: `${withApiBase(baseApiUrl)}/v2/verify/seller/${encodeURIComponent(platform)}`,
|
|
47105
47260
|
method: "POST",
|
|
47106
|
-
body
|
|
47261
|
+
body,
|
|
47107
47262
|
apiKey,
|
|
47108
47263
|
authToken,
|
|
47109
47264
|
timeoutMs
|
|
@@ -47185,6 +47340,11 @@ var applyReferrerFeeDisplayFieldsToTokenAmount = (tokenAmount, referrerFeeConfig
|
|
|
47185
47340
|
}
|
|
47186
47341
|
};
|
|
47187
47342
|
var applyReferrerFeeDisplayFieldsToQuote = (quote, referrerFeeConfig, decimals) => {
|
|
47343
|
+
const enrichedQuote = quote;
|
|
47344
|
+
const hasCuratorReferrerFeeFields = enrichedQuote.referrerFeeAmount != null || enrichedQuote.referrerFeeBps != null;
|
|
47345
|
+
if (hasCuratorReferrerFeeFields) {
|
|
47346
|
+
return enrichedQuote;
|
|
47347
|
+
}
|
|
47188
47348
|
const signalIntentAmount = quote.signalIntentAmount ?? quote.intent?.amount ?? quote.tokenAmount;
|
|
47189
47349
|
const adjusted = applyReferrerFeeDisplayFieldsToTokenAmount(
|
|
47190
47350
|
quote.tokenAmount,
|
|
@@ -48154,7 +48314,7 @@ var Zkp2pClient = class {
|
|
|
48154
48314
|
* ```
|
|
48155
48315
|
*
|
|
48156
48316
|
* @param params.intentHash - The intent hash to fulfill (0x-prefixed, 32 bytes)
|
|
48157
|
-
* @param params.proof - Payment proof from Reclaim (object or JSON string)
|
|
48317
|
+
* @param params.proof - Payment proof from Reclaim (object or JSON string) or buyer TEE proof input
|
|
48158
48318
|
* @param params.timestampBufferMs - Allowed timestamp variance (default: 300000ms)
|
|
48159
48319
|
* @param params.attestationServiceUrl - Override attestation service URL
|
|
48160
48320
|
* @param params.postIntentHookData - Data to pass to post-intent hook
|
|
@@ -49712,8 +49872,10 @@ var Zkp2pClient = class {
|
|
|
49712
49872
|
* seller-automated-release availability is governed by curator's probe/revalidation state
|
|
49713
49873
|
* rather than these timestamps.
|
|
49714
49874
|
*
|
|
49715
|
-
*
|
|
49716
|
-
*
|
|
49875
|
+
* Create a signed seller credential bundle with attestation-service and store it via
|
|
49876
|
+
* curator's platform plus hashed payee-details route. Session-cookie platforms register
|
|
49877
|
+
* or recover the payee maker row before upload; Wise derives the payee hash inside the enclave
|
|
49878
|
+
* from the submitted Personal API Token.
|
|
49717
49879
|
*/
|
|
49718
49880
|
async uploadSellerCredential(params, opts) {
|
|
49719
49881
|
const baseApiUrl = this.stripTrailingSlash(
|
|
@@ -49723,6 +49885,33 @@ var Zkp2pClient = class {
|
|
|
49723
49885
|
const attestationServiceUrl = this.stripTrailingSlash(
|
|
49724
49886
|
opts?.attestationServiceUrl ?? this.defaultAttestationServiceForBaseApiUrl(baseApiUrl)
|
|
49725
49887
|
);
|
|
49888
|
+
const createBundle = (uploadPayload2) => opts?.attestationRuntime ? apiCreateSellerCredentialBundle(
|
|
49889
|
+
uploadPayload2,
|
|
49890
|
+
attestationServiceUrl,
|
|
49891
|
+
params.platform,
|
|
49892
|
+
timeoutMs,
|
|
49893
|
+
opts.attestationRuntime
|
|
49894
|
+
) : apiCreateSellerCredentialBundle(
|
|
49895
|
+
uploadPayload2,
|
|
49896
|
+
attestationServiceUrl,
|
|
49897
|
+
params.platform,
|
|
49898
|
+
timeoutMs
|
|
49899
|
+
);
|
|
49900
|
+
if (params.platform === "wise") {
|
|
49901
|
+
const bundleResponse2 = await createBundle({
|
|
49902
|
+
sessionMaterial: params.sessionMaterial
|
|
49903
|
+
});
|
|
49904
|
+
if (!bundleResponse2.success || !bundleResponse2.responseObject) {
|
|
49905
|
+
throw new Error(bundleResponse2.message || "Failed to create seller credential bundle");
|
|
49906
|
+
}
|
|
49907
|
+
return apiUploadSellerCredential(
|
|
49908
|
+
params.platform,
|
|
49909
|
+
bundleResponse2.responseObject.payeeIdHash,
|
|
49910
|
+
bundleResponse2.responseObject,
|
|
49911
|
+
baseApiUrl,
|
|
49912
|
+
timeoutMs
|
|
49913
|
+
);
|
|
49914
|
+
}
|
|
49726
49915
|
const registeredPayeePayload = {
|
|
49727
49916
|
offchainId: params.offchainId,
|
|
49728
49917
|
processorName: params.platform
|
|
@@ -49745,18 +49934,7 @@ var Zkp2pClient = class {
|
|
|
49745
49934
|
payeeId: params.payeeId,
|
|
49746
49935
|
sessionMaterial: params.sessionMaterial
|
|
49747
49936
|
};
|
|
49748
|
-
const bundleResponse =
|
|
49749
|
-
uploadPayload,
|
|
49750
|
-
attestationServiceUrl,
|
|
49751
|
-
params.platform,
|
|
49752
|
-
timeoutMs,
|
|
49753
|
-
opts.attestationRuntime
|
|
49754
|
-
) : await apiCreateSellerCredentialBundle(
|
|
49755
|
-
uploadPayload,
|
|
49756
|
-
attestationServiceUrl,
|
|
49757
|
-
params.platform,
|
|
49758
|
-
timeoutMs
|
|
49759
|
-
);
|
|
49937
|
+
const bundleResponse = await createBundle(uploadPayload);
|
|
49760
49938
|
if (!bundleResponse.success || !bundleResponse.responseObject) {
|
|
49761
49939
|
throw new Error(bundleResponse.message || "Failed to create seller credential bundle");
|
|
49762
49940
|
}
|
|
@@ -49772,6 +49950,32 @@ var Zkp2pClient = class {
|
|
|
49772
49950
|
timeoutMs
|
|
49773
49951
|
);
|
|
49774
49952
|
}
|
|
49953
|
+
/**
|
|
49954
|
+
* Confirms the PayPal Gmail-forwarding setup for an existing maker payee hash.
|
|
49955
|
+
*
|
|
49956
|
+
* Uses curator's `/forwarding-confirmation` route and forwards both API key and
|
|
49957
|
+
* bearer token so either auth strategy can satisfy the hybrid gate. The endpoint
|
|
49958
|
+
* is rate-limited server-side; callers should surface retry guidance from APIError.
|
|
49959
|
+
*/
|
|
49960
|
+
async confirmPayPalForwarding(params, opts) {
|
|
49961
|
+
const baseApiUrl = this.stripTrailingSlash(
|
|
49962
|
+
opts?.baseApiUrl ?? this.baseApiUrl ?? DEFAULT_BASE_API_URL
|
|
49963
|
+
);
|
|
49964
|
+
const timeoutMs = opts?.timeoutMs ?? this.apiTimeoutMs;
|
|
49965
|
+
return apiConfirmPayPalForwarding(
|
|
49966
|
+
params.payeeDetails,
|
|
49967
|
+
{
|
|
49968
|
+
payeeEmail: params.payeeEmail,
|
|
49969
|
+
forwardingInitiatorEmail: params.forwardingInitiatorEmail
|
|
49970
|
+
},
|
|
49971
|
+
baseApiUrl,
|
|
49972
|
+
{
|
|
49973
|
+
apiKey: this.apiKey,
|
|
49974
|
+
authToken: this.authorizationToken,
|
|
49975
|
+
timeoutMs
|
|
49976
|
+
}
|
|
49977
|
+
);
|
|
49978
|
+
}
|
|
49775
49979
|
/**
|
|
49776
49980
|
* Status is a coarse curator-owned signal (`active` / `inactive` / `missing`) and intentionally
|
|
49777
49981
|
* omits low-level diagnostics. Curator may still re-probe stale credentials during verify, so callers
|
|
@@ -49810,7 +50014,8 @@ var Zkp2pClient = class {
|
|
|
49810
50014
|
{
|
|
49811
50015
|
txId: params.txId,
|
|
49812
50016
|
chainId: params.chainId,
|
|
49813
|
-
intent: params.intent
|
|
50017
|
+
intent: params.intent,
|
|
50018
|
+
...params.metadata !== void 0 ? { metadata: params.metadata } : {}
|
|
49814
50019
|
},
|
|
49815
50020
|
baseApiUrl,
|
|
49816
50021
|
timeoutMs,
|
|
@@ -50009,7 +50214,7 @@ var assertObjectInput = (params) => {
|
|
|
50009
50214
|
}
|
|
50010
50215
|
return params;
|
|
50011
50216
|
};
|
|
50012
|
-
var
|
|
50217
|
+
var normalizeOptionalString2 = (value, label) => {
|
|
50013
50218
|
if (value === void 0) {
|
|
50014
50219
|
return void 0;
|
|
50015
50220
|
}
|
|
@@ -50023,7 +50228,7 @@ var normalizeOptionalString = (value, label) => {
|
|
|
50023
50228
|
return trimmed;
|
|
50024
50229
|
};
|
|
50025
50230
|
var normalizeOptionalUrl = (value, label) => {
|
|
50026
|
-
const trimmed =
|
|
50231
|
+
const trimmed = normalizeOptionalString2(value, label);
|
|
50027
50232
|
if (trimmed === void 0) {
|
|
50028
50233
|
return void 0;
|
|
50029
50234
|
}
|
|
@@ -50150,20 +50355,20 @@ var buildOnrampQueryString = (params) => {
|
|
|
50150
50355
|
searchParams.set(key, value);
|
|
50151
50356
|
}
|
|
50152
50357
|
};
|
|
50153
|
-
setParam("referrer",
|
|
50358
|
+
setParam("referrer", normalizeOptionalString2(validated.referrer, "referrer"));
|
|
50154
50359
|
setParam("referrerLogo", normalizeOptionalUrl(validated.referrerLogo, "referrerLogo"));
|
|
50155
|
-
setParam("inputCurrency",
|
|
50360
|
+
setParam("inputCurrency", normalizeOptionalString2(validated.inputCurrency, "inputCurrency"));
|
|
50156
50361
|
setParam("inputAmount", normalizeFiatAmount(validated.inputAmount));
|
|
50157
50362
|
setParam(
|
|
50158
50363
|
"paymentPlatform",
|
|
50159
|
-
|
|
50364
|
+
normalizeOptionalString2(validated.paymentPlatform, "paymentPlatform")
|
|
50160
50365
|
);
|
|
50161
50366
|
setParam("depositId", normalizeIntegerParam(validated.depositId, "depositId"));
|
|
50162
|
-
setParam("toToken",
|
|
50367
|
+
setParam("toToken", normalizeOptionalString2(validated.toToken, "toToken"));
|
|
50163
50368
|
setParam("amountUsdc", normalizeUsdcAmount(validated.amountUsdc));
|
|
50164
50369
|
setParam(
|
|
50165
50370
|
"recipientAddress",
|
|
50166
|
-
|
|
50371
|
+
normalizeOptionalString2(validated.recipientAddress, "recipientAddress")
|
|
50167
50372
|
);
|
|
50168
50373
|
setParam("intentHash", normalizeIntentHash(validated.intentHash));
|
|
50169
50374
|
return searchParams.toString();
|
|
@@ -50283,6 +50488,7 @@ exports.ZERO_RATE_MANAGER_ID = ZERO_RATE_MANAGER_ID;
|
|
|
50283
50488
|
exports.ZKP2P_ANDROID_REFERRER = ZKP2P_ANDROID_REFERRER;
|
|
50284
50489
|
exports.ZKP2P_IOS_REFERRER = ZKP2P_IOS_REFERRER;
|
|
50285
50490
|
exports.Zkp2pClient = Zkp2pClient;
|
|
50491
|
+
exports.apiConfirmPayPalForwarding = apiConfirmPayPalForwarding;
|
|
50286
50492
|
exports.apiCreateSellerCredentialBundle = apiCreateSellerCredentialBundle;
|
|
50287
50493
|
exports.apiGetDepositBundle = apiGetDepositBundle;
|
|
50288
50494
|
exports.apiGetOrderbook = apiGetOrderbook;
|
|
@@ -50301,6 +50507,7 @@ exports.convertDepositsForLiquidity = convertDepositsForLiquidity;
|
|
|
50301
50507
|
exports.convertIndexerDepositToEscrowView = convertIndexerDepositToEscrowView;
|
|
50302
50508
|
exports.convertIndexerIntentsToEscrowViews = convertIndexerIntentsToEscrowViews;
|
|
50303
50509
|
exports.createCompositeDepositId = createCompositeDepositId;
|
|
50510
|
+
exports.createEncryptedBuyerTeeSessionMaterial = createEncryptedBuyerTeeSessionMaterial;
|
|
50304
50511
|
exports.createPeerExtensionSdk = createPeerExtensionSdk;
|
|
50305
50512
|
exports.defaultIndexerEndpoint = defaultIndexerEndpoint;
|
|
50306
50513
|
exports.encodePythAdapterConfig = encodePythAdapterConfig;
|