@zkp2p/sdk 0.14.2-rc.3 → 0.14.2
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 +87 -0
- package/dist/build-metadata.json +2 -2
- package/dist/chunk-BVBHBKX7.mjs +12 -0
- package/dist/chunk-BVBHBKX7.mjs.map +1 -0
- package/dist/{chunk-DNKX73LN.mjs → chunk-OP2REHNS.mjs} +3 -3
- package/dist/{chunk-DNKX73LN.mjs.map → chunk-OP2REHNS.mjs.map} +1 -1
- package/dist/{currency-LT7VKBBS.mjs → currency-GBDKE3OV.mjs} +3 -3
- package/dist/{currency-LT7VKBBS.mjs.map → currency-GBDKE3OV.mjs.map} +1 -1
- package/dist/index.cjs +174 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +63 -3
- package/dist/index.d.ts +63 -3
- package/dist/index.mjs +173 -11
- package/dist/index.mjs.map +1 -1
- package/dist/protocolViewerParsers-Y2LKEF6H.mjs +5 -0
- package/dist/{protocolViewerParsers-FQ3FBMNT.mjs.map → protocolViewerParsers-Y2LKEF6H.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-P7V7KVRD.mjs → timeout-WPD7KDNF.mjs} +3 -3
- package/dist/{timeout-P7V7KVRD.mjs.map → timeout-WPD7KDNF.mjs.map} +1 -1
- package/dist/{vaultUtils-D3J7IDTF.d.mts → vaultUtils-DVps_hg9.d.mts} +1 -1
- package/dist/{vaultUtils-D3J7IDTF.d.ts → vaultUtils-DVps_hg9.d.ts} +1 -1
- package/package.json +1 -1
- package/dist/chunk-VGVHGGQU.mjs +0 -12
- package/dist/chunk-VGVHGGQU.mjs.map +0 -1
- package/dist/protocolViewerParsers-FQ3FBMNT.mjs +0 -5
|
@@ -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-BVBHBKX7.mjs';
|
|
3
|
+
//# sourceMappingURL=currency-GBDKE3OV.mjs.map
|
|
4
|
+
//# sourceMappingURL=currency-GBDKE3OV.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"currency-
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"currency-GBDKE3OV.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: "a87f38c512f987fc3b9234b5aee31115bf840a18", kind: "github", distributable: true }, sdkPackageVersion: "0.14.2", 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
|
|
|
@@ -111563,6 +111563,174 @@ var classifyDelegationState = (currentRateManagerId, currentRegistry, targetRate
|
|
|
111563
111563
|
};
|
|
111564
111564
|
var getDelegationRoute = (_client, _escrow) => "v2";
|
|
111565
111565
|
|
|
111566
|
+
// src/venmoGmail.ts
|
|
111567
|
+
init_define_ZKP2P_SDK_BUILD_METADATA();
|
|
111568
|
+
init_errors();
|
|
111569
|
+
|
|
111570
|
+
// src/venmoGmailAppearance.ts
|
|
111571
|
+
init_define_ZKP2P_SDK_BUILD_METADATA();
|
|
111572
|
+
init_errors();
|
|
111573
|
+
var color = (value) => typeof value === "string" && /^#(?:[\da-f]{3}|[\da-f]{6})$/i.test(value);
|
|
111574
|
+
var pixels = (min, max) => (value) => typeof value === "number" && Number.isFinite(value) && value >= min && value <= max;
|
|
111575
|
+
var font = (value) => typeof value === "string" && value.length <= 160 && /^[\w\s,"'-]+$/.test(value);
|
|
111576
|
+
var transform = (value) => value === "none" || value === "uppercase";
|
|
111577
|
+
var assetUrl = (value) => {
|
|
111578
|
+
if (typeof value !== "string" || value.length > 2048) return false;
|
|
111579
|
+
try {
|
|
111580
|
+
const url = new URL(value);
|
|
111581
|
+
return !url.username && !url.password && (url.protocol === "https:" || url.protocol === "http:" && url.hostname === "localhost");
|
|
111582
|
+
} catch {
|
|
111583
|
+
return false;
|
|
111584
|
+
}
|
|
111585
|
+
};
|
|
111586
|
+
var fields = {
|
|
111587
|
+
logoUrl: assetUrl,
|
|
111588
|
+
logoBackgroundColor: color,
|
|
111589
|
+
logoBorderColor: color,
|
|
111590
|
+
logoAlt: (value) => typeof value === "string" && value.length <= 80,
|
|
111591
|
+
fontUrl: assetUrl,
|
|
111592
|
+
fontFamily: font,
|
|
111593
|
+
headingFontFamily: font,
|
|
111594
|
+
backgroundColor: color,
|
|
111595
|
+
cardBackgroundColor: color,
|
|
111596
|
+
textColor: color,
|
|
111597
|
+
secondaryTextColor: color,
|
|
111598
|
+
buttonColor: color,
|
|
111599
|
+
buttonTextColor: color,
|
|
111600
|
+
buttonHoverColor: color,
|
|
111601
|
+
focusColor: color,
|
|
111602
|
+
borderColor: color,
|
|
111603
|
+
successColor: color,
|
|
111604
|
+
errorColor: color,
|
|
111605
|
+
fontSize: pixels(12, 24),
|
|
111606
|
+
headingFontSize: pixels(20, 48),
|
|
111607
|
+
headingTextTransform: transform,
|
|
111608
|
+
buttonTextTransform: transform,
|
|
111609
|
+
buttonBorderRadius: pixels(0, 40),
|
|
111610
|
+
buttonHeight: pixels(44, 80),
|
|
111611
|
+
cardBorderRadius: pixels(0, 40),
|
|
111612
|
+
contentWidth: pixels(280, 960),
|
|
111613
|
+
padding: pixels(16, 64),
|
|
111614
|
+
gap: pixels(12, 48),
|
|
111615
|
+
logoHeight: pixels(24, 80)
|
|
111616
|
+
};
|
|
111617
|
+
function parseVenmoGmailAppearance(value) {
|
|
111618
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
111619
|
+
throw new exports.ValidationError("Expected a Venmo appearance object", "appearance");
|
|
111620
|
+
}
|
|
111621
|
+
const entries = Object.entries(value).filter(
|
|
111622
|
+
([key]) => Object.prototype.hasOwnProperty.call(fields, key)
|
|
111623
|
+
);
|
|
111624
|
+
for (const [key, item] of entries) {
|
|
111625
|
+
if (!fields[key](item)) {
|
|
111626
|
+
throw new exports.ValidationError(`Invalid Venmo appearance option: ${key}`, `appearance.${key}`);
|
|
111627
|
+
}
|
|
111628
|
+
}
|
|
111629
|
+
return Object.fromEntries(entries);
|
|
111630
|
+
}
|
|
111631
|
+
function getVenmoGmailPopupSize(popup = {}) {
|
|
111632
|
+
const { width = 500, height = 700 } = popup;
|
|
111633
|
+
if (!pixels(320, 1200)(width) || !pixels(480, 1600)(height)) {
|
|
111634
|
+
throw new exports.ValidationError("Popup width must be 320\u20131200 and height 480\u20131600 pixels", "popup");
|
|
111635
|
+
}
|
|
111636
|
+
return { width, height };
|
|
111637
|
+
}
|
|
111638
|
+
|
|
111639
|
+
// src/venmoGmail.ts
|
|
111640
|
+
var VenmoGmailConnectError = class extends Error {
|
|
111641
|
+
constructor(code, message) {
|
|
111642
|
+
super(message);
|
|
111643
|
+
this.code = code;
|
|
111644
|
+
this.name = "VenmoGmailConnectError";
|
|
111645
|
+
}
|
|
111646
|
+
};
|
|
111647
|
+
function getVenmoGmailConnectUrl({
|
|
111648
|
+
payeeDetails,
|
|
111649
|
+
peerOrigin = "https://app.peer.xyz",
|
|
111650
|
+
appearance
|
|
111651
|
+
}) {
|
|
111652
|
+
if (!/^0x[0-9a-f]{64}$/i.test(payeeDetails)) {
|
|
111653
|
+
throw new exports.ValidationError("Expected a Venmo payee hash", "payeeDetails");
|
|
111654
|
+
}
|
|
111655
|
+
let origin;
|
|
111656
|
+
try {
|
|
111657
|
+
origin = new URL(peerOrigin);
|
|
111658
|
+
} catch {
|
|
111659
|
+
throw new exports.ValidationError("Expected an HTTPS Peer web origin", "peerOrigin");
|
|
111660
|
+
}
|
|
111661
|
+
if (origin.protocol !== "https:" && !(origin.protocol === "http:" && origin.hostname === "localhost") || origin.pathname !== "/" || origin.search || origin.hash || origin.username || origin.password) {
|
|
111662
|
+
throw new exports.ValidationError("Expected an HTTPS Peer web origin", "peerOrigin");
|
|
111663
|
+
}
|
|
111664
|
+
const url = new URL("/connect/venmo", origin);
|
|
111665
|
+
if (appearance)
|
|
111666
|
+
url.searchParams.set("appearance", JSON.stringify(parseVenmoGmailAppearance(appearance)));
|
|
111667
|
+
url.hash = payeeDetails;
|
|
111668
|
+
return url.toString();
|
|
111669
|
+
}
|
|
111670
|
+
function openVenmoGmailConnect(options) {
|
|
111671
|
+
const url = new URL(getVenmoGmailConnectUrl(options));
|
|
111672
|
+
const { width, height } = getVenmoGmailPopupSize(options.popup);
|
|
111673
|
+
const requestId = window.crypto.randomUUID();
|
|
111674
|
+
url.searchParams.set("requestId", requestId);
|
|
111675
|
+
url.searchParams.set("hostOrigin", window.location.origin);
|
|
111676
|
+
return new Promise((resolve, reject) => {
|
|
111677
|
+
let popup;
|
|
111678
|
+
try {
|
|
111679
|
+
const features = window.matchMedia("(max-width: 600px)").matches ? void 0 : `popup,width=${width},height=${height}`;
|
|
111680
|
+
popup = window.open(url.toString(), "_blank", features);
|
|
111681
|
+
} catch {
|
|
111682
|
+
popup = null;
|
|
111683
|
+
}
|
|
111684
|
+
if (!popup) {
|
|
111685
|
+
reject(
|
|
111686
|
+
new VenmoGmailConnectError(
|
|
111687
|
+
"popup_blocked",
|
|
111688
|
+
"Allow popups for this site, then link Venmo again."
|
|
111689
|
+
)
|
|
111690
|
+
);
|
|
111691
|
+
return;
|
|
111692
|
+
}
|
|
111693
|
+
const finish = (error) => {
|
|
111694
|
+
window.removeEventListener("message", onMessage);
|
|
111695
|
+
window.clearTimeout(timeout);
|
|
111696
|
+
window.clearInterval(closedCheck);
|
|
111697
|
+
if (error) reject(error);
|
|
111698
|
+
else resolve({ payeeDetails: options.payeeDetails });
|
|
111699
|
+
};
|
|
111700
|
+
const onMessage = (event) => {
|
|
111701
|
+
if (event.origin !== url.origin || event.source !== popup) return;
|
|
111702
|
+
const data144 = event.data;
|
|
111703
|
+
if (typeof data144 !== "object" || !data144) return;
|
|
111704
|
+
const result = data144;
|
|
111705
|
+
if (result.type !== "peer:venmo-connect" || result.requestId !== requestId) return;
|
|
111706
|
+
if (result.status === "connected" && typeof result.payeeDetails === "string" && result.payeeDetails.toLowerCase() === options.payeeDetails.toLowerCase()) {
|
|
111707
|
+
finish();
|
|
111708
|
+
} else if (result.status === "error" && typeof result.code === "string" && typeof result.message === "string") {
|
|
111709
|
+
finish(new VenmoGmailConnectError(result.code, result.message));
|
|
111710
|
+
}
|
|
111711
|
+
};
|
|
111712
|
+
const timeout = window.setTimeout(
|
|
111713
|
+
() => finish(
|
|
111714
|
+
new VenmoGmailConnectError(
|
|
111715
|
+
"connection_timeout",
|
|
111716
|
+
"Venmo linking timed out. Check the connection status before trying again."
|
|
111717
|
+
)
|
|
111718
|
+
),
|
|
111719
|
+
10 * 60 * 1e3
|
|
111720
|
+
);
|
|
111721
|
+
const closedCheck = window.setInterval(() => {
|
|
111722
|
+
if (popup.closed)
|
|
111723
|
+
finish(
|
|
111724
|
+
new VenmoGmailConnectError(
|
|
111725
|
+
"connection_closed",
|
|
111726
|
+
"The linking window closed or became unavailable. Check the connection status before trying again."
|
|
111727
|
+
)
|
|
111728
|
+
);
|
|
111729
|
+
}, 500);
|
|
111730
|
+
window.addEventListener("message", onMessage);
|
|
111731
|
+
});
|
|
111732
|
+
}
|
|
111733
|
+
|
|
111566
111734
|
Object.defineProperty(exports, "createNitroAttestationClient", {
|
|
111567
111735
|
enumerable: true,
|
|
111568
111736
|
get: function () { return zkp2pAttestation.createNitroAttestationClient; }
|
|
@@ -111595,6 +111763,7 @@ exports.SDK_BUILD_METADATA = SDK_BUILD_METADATA;
|
|
|
111595
111763
|
exports.SPREAD_ORACLE_FEEDS = SPREAD_ORACLE_FEEDS;
|
|
111596
111764
|
exports.SUPPORTED_CHAIN_IDS = SUPPORTED_CHAIN_IDS;
|
|
111597
111765
|
exports.TOKEN_METADATA = TOKEN_METADATA;
|
|
111766
|
+
exports.VenmoGmailConnectError = VenmoGmailConnectError;
|
|
111598
111767
|
exports.ZERO_RATE_MANAGER_ID = ZERO_RATE_MANAGER_ID;
|
|
111599
111768
|
exports.ZKP2P_ANDROID_REFERRER = ZKP2P_ANDROID_REFERRER;
|
|
111600
111769
|
exports.ZKP2P_IOS_REFERRER = ZKP2P_IOS_REFERRER;
|
|
@@ -111610,6 +111779,7 @@ exports.apiGetQuote = apiGetQuote;
|
|
|
111610
111779
|
exports.apiGetQuotesBestByPlatform = apiGetQuotesBestByPlatform;
|
|
111611
111780
|
exports.apiGetReferralDashboard = apiGetReferralDashboard;
|
|
111612
111781
|
exports.apiGetReferralEarnings = apiGetReferralEarnings;
|
|
111782
|
+
exports.apiGetSellerCredentialStatus = apiGetSellerCredentialStatus;
|
|
111613
111783
|
exports.apiLookupReferralCode = apiLookupReferralCode;
|
|
111614
111784
|
exports.apiPostDepositDetails = apiPostDepositDetails;
|
|
111615
111785
|
exports.apiRedeemReferralCode = apiRedeemReferralCode;
|
|
@@ -111660,6 +111830,7 @@ exports.getPeerExtensionState = getPeerExtensionState;
|
|
|
111660
111830
|
exports.getRateManagerContracts = getRateManagerContracts;
|
|
111661
111831
|
exports.getSpreadOracleConfig = getSpreadOracleConfig;
|
|
111662
111832
|
exports.getStakeVaultContract = getStakeVaultContract;
|
|
111833
|
+
exports.getVenmoGmailConnectUrl = getVenmoGmailConnectUrl;
|
|
111663
111834
|
exports.hasIntentGuardian = hasIntentGuardian;
|
|
111664
111835
|
exports.isPeerExtensionAvailable = isPeerExtensionAvailable;
|
|
111665
111836
|
exports.isSupportedCurrencyHash = isSupportedCurrencyHash;
|
|
@@ -111673,9 +111844,11 @@ exports.normalizeRateManagerId = normalizeRateManagerId2;
|
|
|
111673
111844
|
exports.normalizeReferralCode = normalizeReferralCode;
|
|
111674
111845
|
exports.normalizeRegistry = normalizeRegistry;
|
|
111675
111846
|
exports.openPeerExtensionInstallPage = openPeerExtensionInstallPage;
|
|
111847
|
+
exports.openVenmoGmailConnect = openVenmoGmailConnect;
|
|
111676
111848
|
exports.parseDepositView = parseDepositView;
|
|
111677
111849
|
exports.parseIntentView = parseIntentView;
|
|
111678
111850
|
exports.parseReferrerFeeConfig = parseReferrerFeeConfig;
|
|
111851
|
+
exports.parseVenmoGmailAppearance = parseVenmoGmailAppearance;
|
|
111679
111852
|
exports.peerExtensionSdk = peerExtensionSdk;
|
|
111680
111853
|
exports.readDisputeAttestationConfig = readDisputeAttestationConfig;
|
|
111681
111854
|
exports.referrerFeeConfigToPreciseUnits = referrerFeeConfigToPreciseUnits;
|