@zkp2p/sdk 0.14.2-rc.1 → 0.14.2-rc.3
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 +18 -11
- package/dist/build-metadata.json +2 -2
- package/dist/{chunk-DOZJKZTL.mjs → chunk-DNKX73LN.mjs} +3 -3
- package/dist/{chunk-DOZJKZTL.mjs.map → chunk-DNKX73LN.mjs.map} +1 -1
- package/dist/{chunk-PBNUROW5.mjs → chunk-VGVHGGQU.mjs} +3 -3
- package/dist/{chunk-PBNUROW5.mjs.map → chunk-VGVHGGQU.mjs.map} +1 -1
- package/dist/{currency-DFRG54XQ.mjs → currency-LT7VKBBS.mjs} +3 -3
- package/dist/{currency-DFRG54XQ.mjs.map → currency-LT7VKBBS.mjs.map} +1 -1
- package/dist/index.cjs +123 -46
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +7 -4
- package/dist/index.d.ts +7 -4
- package/dist/index.mjs +132 -56
- package/dist/index.mjs.map +1 -1
- package/dist/protocolViewerParsers-FQ3FBMNT.mjs +5 -0
- package/dist/{protocolViewerParsers-WVXVSWCY.mjs.map → protocolViewerParsers-FQ3FBMNT.mjs.map} +1 -1
- package/dist/react.d.mts +2 -2
- package/dist/react.d.ts +2 -2
- package/dist/react.mjs +1 -1
- package/dist/{timeout-7LS5AHSS.mjs → timeout-P7V7KVRD.mjs} +3 -3
- package/dist/{timeout-7LS5AHSS.mjs.map → timeout-P7V7KVRD.mjs.map} +1 -1
- package/dist/{vaultUtils-Llr7Gh2R.d.mts → vaultUtils-D3J7IDTF.d.mts} +40 -10
- package/dist/{vaultUtils-Llr7Gh2R.d.ts → vaultUtils-D3J7IDTF.d.ts} +40 -10
- package/package.json +1 -1
- package/dist/protocolViewerParsers-WVXVSWCY.mjs +0 -5
|
@@ -5,8 +5,8 @@ var __export = (target, all) => {
|
|
|
5
5
|
};
|
|
6
6
|
|
|
7
7
|
// <define:__ZKP2P_SDK_BUILD_METADATA__>
|
|
8
|
-
var define_ZKP2P_SDK_BUILD_METADATA_default = { schemaVersion: 2, source: { repository: "zkp2p/zkp2p-clients", commitSha: "
|
|
8
|
+
var define_ZKP2P_SDK_BUILD_METADATA_default = { schemaVersion: 2, source: { repository: "zkp2p/zkp2p-clients", commitSha: "aaeaeda52c93c46337bd6f3e6d7a49535622fbd2", kind: "github", distributable: true }, sdkPackageVersion: "0.14.2-rc.3", contractsPackageVersion: "0.4.2-rc.2", indexerSchemaPackageVersion: "0.22.0", activeDisputeStack: { base: { version: 2, selectionHash: "ba40c2954b408d0c658881a8d28e5bfcc9bade5cc3d953fd17eae1eca69d841c" }, baseStaging: { version: 2, selectionHash: "6c49c1ce51eec594a22385c4efcab08aa9926b6b63a725e14a0027ec5d2f4fc9" } } };
|
|
9
9
|
|
|
10
10
|
export { __export, define_ZKP2P_SDK_BUILD_METADATA_default };
|
|
11
|
-
//# sourceMappingURL=chunk-
|
|
12
|
-
//# sourceMappingURL=chunk-
|
|
11
|
+
//# sourceMappingURL=chunk-VGVHGGQU.mjs.map
|
|
12
|
+
//# sourceMappingURL=chunk-VGVHGGQU.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["%3Cdefine:__ZKP2P_SDK_BUILD_METADATA__%3E"],"names":[],"mappings":";;;;;;;AAAA,IAAA,uCAAA,GAAA,EAAC,aAAA,EAAgB,CAAA,EAAE,MAAA,EAAS,EAAC,YAAa,qBAAA,EAAsB,SAAA,EAAY,0CAAA,EAA2C,IAAA,EAAO,UAAS,aAAA,EAAgB,IAAA,EAAI,EAAE,iBAAA,EAAoB,eAAc,uBAAA,EAA0B,YAAA,EAAa,2BAAA,EAA8B,QAAA,EAAS,oBAAqB,EAAC,IAAA,EAAO,EAAC,OAAA,EAAU,GAAE,aAAA,EAAgB,kEAAA,EAAkE,EAAE,WAAA,EAAc,EAAC,OAAA,EAAU,CAAA,EAAE,aAAA,EAAgB,kEAAA,IAAmE","file":"chunk-
|
|
1
|
+
{"version":3,"sources":["%3Cdefine:__ZKP2P_SDK_BUILD_METADATA__%3E"],"names":[],"mappings":";;;;;;;AAAA,IAAA,uCAAA,GAAA,EAAC,aAAA,EAAgB,CAAA,EAAE,MAAA,EAAS,EAAC,YAAa,qBAAA,EAAsB,SAAA,EAAY,0CAAA,EAA2C,IAAA,EAAO,UAAS,aAAA,EAAgB,IAAA,EAAI,EAAE,iBAAA,EAAoB,eAAc,uBAAA,EAA0B,YAAA,EAAa,2BAAA,EAA8B,QAAA,EAAS,oBAAqB,EAAC,IAAA,EAAO,EAAC,OAAA,EAAU,GAAE,aAAA,EAAgB,kEAAA,EAAkE,EAAE,WAAA,EAAc,EAAC,OAAA,EAAU,CAAA,EAAE,aAAA,EAAgB,kEAAA,IAAmE","file":"chunk-VGVHGGQU.mjs","sourcesContent":["{\"schemaVersion\":2,\"source\":{\"repository\":\"zkp2p/zkp2p-clients\",\"commitSha\":\"aaeaeda52c93c46337bd6f3e6d7a49535622fbd2\",\"kind\":\"github\",\"distributable\":true},\"sdkPackageVersion\":\"0.14.2-rc.3\",\"contractsPackageVersion\":\"0.4.2-rc.2\",\"indexerSchemaPackageVersion\":\"0.22.0\",\"activeDisputeStack\":{\"base\":{\"version\":2,\"selectionHash\":\"ba40c2954b408d0c658881a8d28e5bfcc9bade5cc3d953fd17eae1eca69d841c\"},\"baseStaging\":{\"version\":2,\"selectionHash\":\"6c49c1ce51eec594a22385c4efcab08aa9926b6b63a725e14a0027ec5d2f4fc9\"}}}"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { Currency, currencyInfo, getCurrencyCodeFromHash, getCurrencyInfoFromCountryCode, getCurrencyInfoFromHash, isSupportedCurrencyHash, mapConversionRatesToOnchain, mapConversionRatesToOnchainMinRate } from './chunk-ZB22BZLZ.mjs';
|
|
2
|
-
import './chunk-
|
|
3
|
-
//# sourceMappingURL=currency-
|
|
4
|
-
//# sourceMappingURL=currency-
|
|
2
|
+
import './chunk-VGVHGGQU.mjs';
|
|
3
|
+
//# sourceMappingURL=currency-LT7VKBBS.mjs.map
|
|
4
|
+
//# sourceMappingURL=currency-LT7VKBBS.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"currency-
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"currency-LT7VKBBS.mjs"}
|
package/dist/index.cjs
CHANGED
|
@@ -21,7 +21,7 @@ var __export = (target, all) => {
|
|
|
21
21
|
var define_ZKP2P_SDK_BUILD_METADATA_default;
|
|
22
22
|
var init_define_ZKP2P_SDK_BUILD_METADATA = __esm({
|
|
23
23
|
"<define:__ZKP2P_SDK_BUILD_METADATA__>"() {
|
|
24
|
-
define_ZKP2P_SDK_BUILD_METADATA_default = { schemaVersion: 2, source: { repository: "zkp2p/zkp2p-clients", commitSha: "
|
|
24
|
+
define_ZKP2P_SDK_BUILD_METADATA_default = { schemaVersion: 2, source: { repository: "zkp2p/zkp2p-clients", commitSha: "aaeaeda52c93c46337bd6f3e6d7a49535622fbd2", kind: "github", distributable: true }, sdkPackageVersion: "0.14.2-rc.3", contractsPackageVersion: "0.4.2-rc.2", indexerSchemaPackageVersion: "0.22.0", activeDisputeStack: { base: { version: 2, selectionHash: "ba40c2954b408d0c658881a8d28e5bfcc9bade5cc3d953fd17eae1eca69d841c" }, baseStaging: { version: 2, selectionHash: "6c49c1ce51eec594a22385c4efcab08aa9926b6b63a725e14a0027ec5d2f4fc9" } } };
|
|
25
25
|
}
|
|
26
26
|
});
|
|
27
27
|
|
|
@@ -99565,6 +99565,24 @@ async function createEncryptedSellerCredentialUploadForPlatform({
|
|
|
99565
99565
|
timeoutMs
|
|
99566
99566
|
}) {
|
|
99567
99567
|
try {
|
|
99568
|
+
if (platform === "upi") {
|
|
99569
|
+
const material = payload.sessionMaterial;
|
|
99570
|
+
if (!payload.callerAddress || !("userAgent" in material) || !("sessionCookie" in material) || "payeeId" in payload) {
|
|
99571
|
+
throw new Error(
|
|
99572
|
+
"Amazon Pay requires callerAddress, sessionCookie and userAgent without a claimed payeeId"
|
|
99573
|
+
);
|
|
99574
|
+
}
|
|
99575
|
+
return await zkp2pAttestation.createEncryptedSellerCredentialUpload({
|
|
99576
|
+
attestationServiceUrl,
|
|
99577
|
+
platform: "upi",
|
|
99578
|
+
callerAddress: payload.callerAddress,
|
|
99579
|
+
sessionMaterial: { sessionCookie: material.sessionCookie, userAgent: material.userAgent },
|
|
99580
|
+
...typeof timeoutMs === "number" ? { timeoutMs } : {},
|
|
99581
|
+
fetch: attestationTransport.fetch,
|
|
99582
|
+
...cryptoRuntime?.subtle ? { subtle: cryptoRuntime.subtle } : {},
|
|
99583
|
+
...cryptoRuntime?.getRandomValues ? { getRandomValues: cryptoRuntime.getRandomValues } : {}
|
|
99584
|
+
});
|
|
99585
|
+
}
|
|
99568
99586
|
if (platform === "wise") {
|
|
99569
99587
|
if (!isWiseCredentialUploadInput(payload)) {
|
|
99570
99588
|
throw new Error("apiToken is required for wise seller credential uploads");
|
|
@@ -102727,12 +102745,12 @@ var STAKE_LOCKS_QUERY = (
|
|
|
102727
102745
|
var STAKE_ACTIVITY_QUERY = (
|
|
102728
102746
|
/* GraphQL */
|
|
102729
102747
|
`
|
|
102730
|
-
query StakeActivityPage(
|
|
102731
|
-
|
|
102732
|
-
|
|
102733
|
-
|
|
102734
|
-
|
|
102735
|
-
) {
|
|
102748
|
+
query StakeActivityPage(
|
|
102749
|
+
$where: StakeActivity_bool_exp!
|
|
102750
|
+
$limit: Int!
|
|
102751
|
+
$orderBy: [StakeActivity_order_by!]!
|
|
102752
|
+
) {
|
|
102753
|
+
StakeActivity(where: $where, order_by: $orderBy, limit: $limit) {
|
|
102736
102754
|
id
|
|
102737
102755
|
chainId
|
|
102738
102756
|
vaultAddress
|
|
@@ -104035,22 +104053,26 @@ async function apiFetch({
|
|
|
104035
104053
|
headers: extraHeaders,
|
|
104036
104054
|
timeoutMs,
|
|
104037
104055
|
retryCount = 3,
|
|
104038
|
-
retryDelayMs = 1e3
|
|
104056
|
+
retryDelayMs = 1e3,
|
|
104057
|
+
signal
|
|
104039
104058
|
}) {
|
|
104040
104059
|
const endpoint = url.replace(/^[^/]*\/\/[^/]*/, "");
|
|
104041
104060
|
return withRetry(
|
|
104042
104061
|
async () => {
|
|
104062
|
+
if (signal?.aborted) throw new Error("API request cancelled.");
|
|
104043
104063
|
let res;
|
|
104044
104064
|
try {
|
|
104045
104065
|
const options = {
|
|
104046
104066
|
method,
|
|
104047
|
-
headers: createHeaders(apiKey, authorizationToken, extraHeaders)
|
|
104067
|
+
headers: createHeaders(apiKey, authorizationToken, extraHeaders),
|
|
104068
|
+
...signal ? { signal } : {}
|
|
104048
104069
|
};
|
|
104049
104070
|
if (body && method !== "GET") {
|
|
104050
104071
|
options.body = JSON.stringify(body);
|
|
104051
104072
|
}
|
|
104052
104073
|
res = await fetch(url, options);
|
|
104053
104074
|
} catch (error) {
|
|
104075
|
+
if (signal?.aborted) throw new Error("API request cancelled.");
|
|
104054
104076
|
throw new exports.NetworkError("Failed to connect to API server", { endpoint, error });
|
|
104055
104077
|
}
|
|
104056
104078
|
if (!res.ok) {
|
|
@@ -104468,7 +104490,7 @@ async function apiUploadSellerCredential(processorName, payeeDetails, bundle, ba
|
|
|
104468
104490
|
});
|
|
104469
104491
|
}
|
|
104470
104492
|
async function apiUploadGoogleOAuthSellerCredential(processorName, payeeDetails, body, baseApiUrl, opts) {
|
|
104471
|
-
if (processorName !== "paypal") {
|
|
104493
|
+
if (processorName !== "paypal" && processorName !== "venmo") {
|
|
104472
104494
|
throw new exports.ValidationError(
|
|
104473
104495
|
`Unsupported Google OAuth seller credential platform: ${String(processorName)}`,
|
|
104474
104496
|
"processorName"
|
|
@@ -104477,13 +104499,32 @@ async function apiUploadGoogleOAuthSellerCredential(processorName, payeeDetails,
|
|
|
104477
104499
|
const endpoint = `/v2/makers/${encodeURIComponent(processorName)}/${encodeURIComponent(
|
|
104478
104500
|
payeeDetails
|
|
104479
104501
|
)}/seller-credential/google-oauth`;
|
|
104480
|
-
|
|
104481
|
-
|
|
104482
|
-
|
|
104483
|
-
|
|
104484
|
-
|
|
104485
|
-
|
|
104486
|
-
|
|
104502
|
+
if (opts?.signal?.aborted) throw new Error("Google OAuth upload cancelled.");
|
|
104503
|
+
const controller = new AbortController();
|
|
104504
|
+
const abort = () => controller.abort();
|
|
104505
|
+
opts?.signal?.addEventListener("abort", abort, { once: true });
|
|
104506
|
+
let timedOut = false;
|
|
104507
|
+
const timeout = opts?.timeoutMs ? setTimeout(() => {
|
|
104508
|
+
timedOut = true;
|
|
104509
|
+
controller.abort();
|
|
104510
|
+
}, opts.timeoutMs) : void 0;
|
|
104511
|
+
try {
|
|
104512
|
+
return await apiFetch({
|
|
104513
|
+
url: `${withApiBase(baseApiUrl)}${endpoint}`,
|
|
104514
|
+
method: "POST",
|
|
104515
|
+
body,
|
|
104516
|
+
authorizationToken: opts?.authorizationToken,
|
|
104517
|
+
signal: controller.signal,
|
|
104518
|
+
// A lost response may already have consumed the one-time Google code.
|
|
104519
|
+
retryCount: 1
|
|
104520
|
+
});
|
|
104521
|
+
} catch (error) {
|
|
104522
|
+
if (timedOut) throw new Error("Google OAuth upload timed out.");
|
|
104523
|
+
throw error;
|
|
104524
|
+
} finally {
|
|
104525
|
+
opts?.signal?.removeEventListener("abort", abort);
|
|
104526
|
+
if (timeout !== void 0) clearTimeout(timeout);
|
|
104527
|
+
}
|
|
104487
104528
|
}
|
|
104488
104529
|
async function apiGetSellerCredentialStatus(processorName, payeeDetails, baseApiUrl, timeoutMs) {
|
|
104489
104530
|
const endpoint = `/v2/makers/${encodeURIComponent(processorName)}/${encodeURIComponent(
|
|
@@ -106347,21 +106388,22 @@ function compareEventCursor(left, right) {
|
|
|
106347
106388
|
if (leftLog !== rightLog) return leftLog < rightLog ? -1 : 1;
|
|
106348
106389
|
return left.id === right.id ? 0 : left.id < right.id ? -1 : 1;
|
|
106349
106390
|
}
|
|
106350
|
-
function eventKeysetPredicate(cursor, blockField, logField) {
|
|
106391
|
+
function eventKeysetPredicate(cursor, blockField, logField, direction = "asc") {
|
|
106392
|
+
const operator = direction === "desc" ? "_lt" : "_gt";
|
|
106351
106393
|
return {
|
|
106352
106394
|
_or: [
|
|
106353
|
-
{ [blockField]: {
|
|
106395
|
+
{ [blockField]: { [operator]: cursor.blockNumber } },
|
|
106354
106396
|
{
|
|
106355
106397
|
_and: [
|
|
106356
106398
|
{ [blockField]: { _eq: cursor.blockNumber } },
|
|
106357
|
-
{ [logField]: {
|
|
106399
|
+
{ [logField]: { [operator]: cursor.logIndex } }
|
|
106358
106400
|
]
|
|
106359
106401
|
},
|
|
106360
106402
|
{
|
|
106361
106403
|
_and: [
|
|
106362
106404
|
{ [blockField]: { _eq: cursor.blockNumber } },
|
|
106363
106405
|
{ [logField]: { _eq: cursor.logIndex } },
|
|
106364
|
-
{ id: {
|
|
106406
|
+
{ id: { [operator]: cursor.id } }
|
|
106365
106407
|
]
|
|
106366
106408
|
}
|
|
106367
106409
|
]
|
|
@@ -106721,7 +106763,12 @@ var IndexerStakingService = class {
|
|
|
106721
106763
|
const vaultAddress = normalizeAddress4(params.vaultAddress, "vaultAddress");
|
|
106722
106764
|
const merchant = normalizeAddress4(params.merchant, "merchant");
|
|
106723
106765
|
const kind = params.kind ? normalizeActivityKind(params.kind, "kind") : void 0;
|
|
106724
|
-
const
|
|
106766
|
+
const direction = params.orderDirection ?? "asc";
|
|
106767
|
+
if (direction !== "asc" && direction !== "desc") {
|
|
106768
|
+
throw new exports.ValidationError("orderDirection must be asc or desc", "orderDirection");
|
|
106769
|
+
}
|
|
106770
|
+
const cursorKind = direction === "desc" ? "zkp2p-activity-desc-v1" : "zkp2p-activity-v1";
|
|
106771
|
+
const after = params.cursor ? decodeEventCursor(params.cursor, cursorKind) : void 0;
|
|
106725
106772
|
const filters = [
|
|
106726
106773
|
{ chainId: { _eq: params.chainId } },
|
|
106727
106774
|
{ vaultAddress: { _eq: vaultAddress } },
|
|
@@ -106730,11 +106777,15 @@ var IndexerStakingService = class {
|
|
|
106730
106777
|
}
|
|
106731
106778
|
];
|
|
106732
106779
|
if (kind) filters.push({ kind: { _eq: kind } });
|
|
106733
|
-
if (after) filters.push(eventKeysetPredicate(after, "blockNumber", "logIndex"));
|
|
106780
|
+
if (after) filters.push(eventKeysetPredicate(after, "blockNumber", "logIndex", direction));
|
|
106734
106781
|
const data144 = await this.client.query(
|
|
106735
106782
|
{
|
|
106736
106783
|
query: STAKE_ACTIVITY_QUERY,
|
|
106737
|
-
variables: {
|
|
106784
|
+
variables: {
|
|
106785
|
+
limit: limit + 1,
|
|
106786
|
+
where: { _and: filters },
|
|
106787
|
+
orderBy: [{ blockNumber: direction }, { logIndex: direction }, { id: direction }]
|
|
106788
|
+
}
|
|
106738
106789
|
},
|
|
106739
106790
|
init
|
|
106740
106791
|
);
|
|
@@ -106746,7 +106797,7 @@ var IndexerStakingService = class {
|
|
|
106746
106797
|
merchant,
|
|
106747
106798
|
kind
|
|
106748
106799
|
});
|
|
106749
|
-
if (previous && compareEventCursor(result.cursor, previous) <= 0) {
|
|
106800
|
+
if (previous && compareEventCursor(result.cursor, previous) * (direction === "desc" ? -1 : 1) <= 0) {
|
|
106750
106801
|
throw new Error("StakeActivity cursor did not advance");
|
|
106751
106802
|
}
|
|
106752
106803
|
previous = result.cursor;
|
|
@@ -106754,10 +106805,11 @@ var IndexerStakingService = class {
|
|
|
106754
106805
|
});
|
|
106755
106806
|
const visible = normalized.slice(0, limit);
|
|
106756
106807
|
const last = visible[visible.length - 1];
|
|
106808
|
+
const latest = direction === "desc" ? visible[0] : last;
|
|
106757
106809
|
return {
|
|
106758
106810
|
items: visible.map(({ item }) => item),
|
|
106759
|
-
nextCursor: normalized.length > limit && last ? encodeCursor(
|
|
106760
|
-
asOf:
|
|
106811
|
+
nextCursor: normalized.length > limit && last ? encodeCursor(cursorKind, last.cursor) : null,
|
|
106812
|
+
asOf: latest ? { blockNumber: latest.item.blockNumber, timestamp: latest.item.timestamp } : null
|
|
106761
106813
|
};
|
|
106762
106814
|
}
|
|
106763
106815
|
async fetchDisputeProtectionIntents(params, init) {
|
|
@@ -108068,6 +108120,13 @@ async function apiUploadSellerCredentialBundle(params, baseApiUrl, timeoutMs, au
|
|
|
108068
108120
|
authorizationToken
|
|
108069
108121
|
);
|
|
108070
108122
|
}
|
|
108123
|
+
function getAmazonPaySellerIdentity(bundle) {
|
|
108124
|
+
const attestation = bundle.identityAttestation;
|
|
108125
|
+
if (bundle.platform !== "upi" || attestation?.platform !== "upi" || attestation.actionType !== "register_upi_amazonpay" || attestation.identity.platform !== "upi" || attestation.identity.actionType !== "register_upi_amazonpay" || !attestation.identity.payeeId?.trim()) {
|
|
108126
|
+
throw new Error("Amazon Pay credential bundle is missing its receiving UPI identity");
|
|
108127
|
+
}
|
|
108128
|
+
return attestation.identity.payeeId;
|
|
108129
|
+
}
|
|
108071
108130
|
|
|
108072
108131
|
// src/client/Zkp2pClient.ts
|
|
108073
108132
|
init_contracts2();
|
|
@@ -111090,6 +111149,9 @@ var Zkp2pClient = class {
|
|
|
111090
111149
|
* from the submitted Personal API Token.
|
|
111091
111150
|
*/
|
|
111092
111151
|
async uploadSellerCredential(params, opts) {
|
|
111152
|
+
if (!["cashapp", "wise", "upi"].includes(params.platform)) {
|
|
111153
|
+
throw new Error("Use uploadGoogleOAuthSellerCredential to connect Venmo or PayPal Gmail.");
|
|
111154
|
+
}
|
|
111093
111155
|
const baseApiUrl = this.stripTrailingSlash(
|
|
111094
111156
|
opts?.baseApiUrl ?? this.baseApiUrl ?? DEFAULT_BASE_API_URL
|
|
111095
111157
|
);
|
|
@@ -111105,6 +111167,23 @@ var Zkp2pClient = class {
|
|
|
111105
111167
|
opts?.attestationRuntime,
|
|
111106
111168
|
opts?.attestationServiceFallbackUrls ? { fallbackUrls: opts.attestationServiceFallbackUrls } : void 0
|
|
111107
111169
|
);
|
|
111170
|
+
if (params.platform === "upi") {
|
|
111171
|
+
const bundleResponse2 = await createBundle({
|
|
111172
|
+
callerAddress: params.callerAddress,
|
|
111173
|
+
sessionMaterial: params.sessionMaterial
|
|
111174
|
+
});
|
|
111175
|
+
if (!bundleResponse2.success || !bundleResponse2.responseObject) {
|
|
111176
|
+
throw new Error(bundleResponse2.message || "Failed to create seller credential bundle");
|
|
111177
|
+
}
|
|
111178
|
+
return this.uploadSellerCredentialBundle(
|
|
111179
|
+
{
|
|
111180
|
+
bundle: bundleResponse2.responseObject,
|
|
111181
|
+
offchainId: getAmazonPaySellerIdentity(bundleResponse2.responseObject),
|
|
111182
|
+
platform: "upi"
|
|
111183
|
+
},
|
|
111184
|
+
{ baseApiUrl, timeoutMs }
|
|
111185
|
+
);
|
|
111186
|
+
}
|
|
111108
111187
|
if (params.platform === "wise") {
|
|
111109
111188
|
const bundleResponse2 = await createBundle({
|
|
111110
111189
|
...params.callerAddress ? { callerAddress: params.callerAddress } : {},
|
|
@@ -111159,8 +111238,9 @@ var Zkp2pClient = class {
|
|
|
111159
111238
|
* callers send the one-time Google code plus the stable seller identity.
|
|
111160
111239
|
*/
|
|
111161
111240
|
async uploadGoogleOAuthSellerCredential(params, opts) {
|
|
111241
|
+
if (opts?.signal?.aborted) throw new Error("Google OAuth upload cancelled.");
|
|
111162
111242
|
const platform = params.platform;
|
|
111163
|
-
if (platform !== "paypal") {
|
|
111243
|
+
if (platform !== "paypal" && platform !== "venmo") {
|
|
111164
111244
|
throw new exports.ValidationError(
|
|
111165
111245
|
`Unsupported Google OAuth seller credential platform: ${String(platform)}`,
|
|
111166
111246
|
"platform"
|
|
@@ -111170,28 +111250,21 @@ var Zkp2pClient = class {
|
|
|
111170
111250
|
opts?.baseApiUrl ?? this.baseApiUrl ?? DEFAULT_BASE_API_URL
|
|
111171
111251
|
);
|
|
111172
111252
|
const timeoutMs = opts?.timeoutMs ?? this.apiTimeoutMs;
|
|
111173
|
-
const
|
|
111174
|
-
|
|
111175
|
-
|
|
111176
|
-
|
|
111177
|
-
} catch {
|
|
111178
|
-
authorizationToken = void 0;
|
|
111179
|
-
}
|
|
111180
|
-
return {
|
|
111181
|
-
timeoutMs,
|
|
111182
|
-
...authorizationToken ? { authorizationToken } : {}
|
|
111183
|
-
};
|
|
111253
|
+
const authorizationToken = await this.resolveAuthorizationToken();
|
|
111254
|
+
const body = {
|
|
111255
|
+
authorizationCode: params.authorizationCode,
|
|
111256
|
+
redirectUri: params.redirectUri
|
|
111184
111257
|
};
|
|
111185
111258
|
return apiUploadGoogleOAuthSellerCredential(
|
|
111186
|
-
|
|
111259
|
+
params.platform,
|
|
111187
111260
|
params.payeeDetails,
|
|
111188
|
-
{
|
|
111189
|
-
payeeEmail: params.payeeEmail,
|
|
111190
|
-
authorizationCode: params.authorizationCode,
|
|
111191
|
-
redirectUri: params.redirectUri
|
|
111192
|
-
},
|
|
111261
|
+
params.platform === "paypal" ? { ...body, payeeEmail: params.payeeEmail } : body,
|
|
111193
111262
|
baseApiUrl,
|
|
111194
|
-
|
|
111263
|
+
{
|
|
111264
|
+
timeoutMs,
|
|
111265
|
+
...opts?.signal ? { signal: opts.signal } : {},
|
|
111266
|
+
...authorizationToken ? { authorizationToken } : {}
|
|
111267
|
+
}
|
|
111195
111268
|
);
|
|
111196
111269
|
}
|
|
111197
111270
|
/**
|
|
@@ -111409,6 +111482,9 @@ var getPeerExtensionState = async (options) => {
|
|
|
111409
111482
|
}
|
|
111410
111483
|
};
|
|
111411
111484
|
var sanitizePeerAuthenticateParams = (params) => {
|
|
111485
|
+
if (params.captureMode === "sellerCredential" && params.platform !== "cashapp" && params.platform !== "upi") {
|
|
111486
|
+
throw new Error(`Seller credential capture is not supported for ${params.platform}.`);
|
|
111487
|
+
}
|
|
111412
111488
|
const sanitizedParams = { ...params };
|
|
111413
111489
|
delete sanitizedParams.providerConfig;
|
|
111414
111490
|
return sanitizedParams;
|
|
@@ -111568,6 +111644,7 @@ exports.enrichPvDepositView = enrichPvDepositView;
|
|
|
111568
111644
|
exports.enrichPvIntentView = enrichPvIntentView;
|
|
111569
111645
|
exports.ensureBytes32 = ensureBytes32;
|
|
111570
111646
|
exports.fetchIndexerFulfillmentAndPayment = fetchFulfillmentAndPayment;
|
|
111647
|
+
exports.getAmazonPaySellerIdentity = getAmazonPaySellerIdentity;
|
|
111571
111648
|
exports.getAttributionDataSuffix = getAttributionDataSuffix;
|
|
111572
111649
|
exports.getContracts = getContracts;
|
|
111573
111650
|
exports.getCurrencyCodeFromHash = getCurrencyCodeFromHash;
|