@zkp2p/sdk 0.14.9 → 0.14.10
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 +17 -0
- package/dist/build-metadata.json +2 -2
- package/dist/chunk-DIHRDN2W.mjs +12 -0
- package/dist/chunk-DIHRDN2W.mjs.map +1 -0
- package/dist/{chunk-4GCGSZA2.mjs → chunk-PLUTAOT5.mjs} +3 -3
- package/dist/{chunk-4GCGSZA2.mjs.map → chunk-PLUTAOT5.mjs.map} +1 -1
- package/dist/{currency-AGVR2YDU.mjs → currency-74LZHM6Q.mjs} +3 -3
- package/dist/{currency-AGVR2YDU.mjs.map → currency-74LZHM6Q.mjs.map} +1 -1
- package/dist/index.cjs +76 -25
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +25 -5
- package/dist/index.d.ts +25 -5
- package/dist/index.mjs +77 -36
- package/dist/index.mjs.map +1 -1
- package/dist/protocolViewerParsers-6BOFKH3F.mjs +5 -0
- package/dist/{protocolViewerParsers-O5WTGTUK.mjs.map → protocolViewerParsers-6BOFKH3F.mjs.map} +1 -1
- package/dist/react.mjs +1 -1
- package/dist/{timeout-RXDD3LQG.mjs → timeout-WX76D6NU.mjs} +3 -3
- package/dist/{timeout-RXDD3LQG.mjs.map → timeout-WX76D6NU.mjs.map} +1 -1
- package/package.json +1 -1
- package/dist/chunk-ERJIIFAV.mjs +0 -12
- package/dist/chunk-ERJIIFAV.mjs.map +0 -1
- package/dist/protocolViewerParsers-O5WTGTUK.mjs +0 -5
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { Currency, currencyInfo, getCurrencyCodeFromHash, getCurrencyInfoFromCountryCode, getCurrencyInfoFromHash, isSupportedCurrencyHash, mapConversionRatesToOnchain, mapConversionRatesToOnchainMinRate } from './chunk-WDEEWFEU.mjs';
|
|
2
|
-
import './chunk-
|
|
3
|
-
//# sourceMappingURL=currency-
|
|
4
|
-
//# sourceMappingURL=currency-
|
|
2
|
+
import './chunk-DIHRDN2W.mjs';
|
|
3
|
+
//# sourceMappingURL=currency-74LZHM6Q.mjs.map
|
|
4
|
+
//# sourceMappingURL=currency-74LZHM6Q.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"currency-
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"currency-74LZHM6Q.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: "561ca15adeac3e97e582647c818656e69289020d", kind: "github", distributable: true }, sdkPackageVersion: "0.14.10", contractsPackageVersion: "0.4.4-rc.2", indexerSchemaPackageVersion: "0.22.0", activeDisputeStack: { base: { version: 2, selectionHash: "ba40c2954b408d0c658881a8d28e5bfcc9bade5cc3d953fd17eae1eca69d841c" }, baseStaging: { version: 2, selectionHash: "6c49c1ce51eec594a22385c4efcab08aa9926b6b63a725e14a0027ec5d2f4fc9" } } };
|
|
25
25
|
}
|
|
26
26
|
});
|
|
27
27
|
|
|
@@ -110410,15 +110410,15 @@ var DisputeProtectionReadinessReader = class {
|
|
|
110410
110410
|
async verifyRuntimeIdentities(names, blockNumber) {
|
|
110411
110411
|
await Promise.all(
|
|
110412
110412
|
names.map(async (name) => {
|
|
110413
|
-
const
|
|
110413
|
+
const identity2 = this.config.manifest.runtimeIdentities[name];
|
|
110414
110414
|
const bytecode = await this.config.publicClient.getBytecode({
|
|
110415
|
-
address:
|
|
110415
|
+
address: identity2.address,
|
|
110416
110416
|
blockNumber
|
|
110417
110417
|
});
|
|
110418
110418
|
if (!bytecode || bytecode === "0x") {
|
|
110419
110419
|
throw new ReadinessMismatch(`${name} runtime bytecode unavailable`);
|
|
110420
110420
|
}
|
|
110421
|
-
if (viem.keccak256(bytecode).toLowerCase() !==
|
|
110421
|
+
if (viem.keccak256(bytecode).toLowerCase() !== identity2.runtimeCodeHash.toLowerCase()) {
|
|
110422
110422
|
throw new ReadinessMismatch(`${name} runtime code hash mismatch`);
|
|
110423
110423
|
}
|
|
110424
110424
|
})
|
|
@@ -114782,6 +114782,9 @@ var getDelegationRoute = (_client, _escrow) => "v2";
|
|
|
114782
114782
|
|
|
114783
114783
|
// src/venmoGmail.ts
|
|
114784
114784
|
init_define_ZKP2P_SDK_BUILD_METADATA();
|
|
114785
|
+
|
|
114786
|
+
// src/mailboxConnect.ts
|
|
114787
|
+
init_define_ZKP2P_SDK_BUILD_METADATA();
|
|
114785
114788
|
init_errors();
|
|
114786
114789
|
|
|
114787
114790
|
// src/venmoGmailAppearance.ts
|
|
@@ -114853,22 +114856,18 @@ function getVenmoGmailPopupSize(popup = {}) {
|
|
|
114853
114856
|
return { width, height };
|
|
114854
114857
|
}
|
|
114855
114858
|
|
|
114856
|
-
// src/
|
|
114857
|
-
|
|
114858
|
-
constructor(code, message) {
|
|
114859
|
-
super(message);
|
|
114860
|
-
this.code = code;
|
|
114861
|
-
this.name = "VenmoGmailConnectError";
|
|
114862
|
-
}
|
|
114863
|
-
};
|
|
114864
|
-
function getVenmoGmailConnectUrl({
|
|
114859
|
+
// src/mailboxConnect.ts
|
|
114860
|
+
function getMailboxConnectUrl({
|
|
114865
114861
|
payeeDetails,
|
|
114862
|
+
platform,
|
|
114863
|
+
label,
|
|
114864
|
+
payeeUsername,
|
|
114866
114865
|
peerOrigin = "https://app.peer.xyz",
|
|
114867
114866
|
appearance,
|
|
114868
114867
|
returnUrl
|
|
114869
114868
|
}) {
|
|
114870
114869
|
if (!/^0x[0-9a-f]{64}$/i.test(payeeDetails)) {
|
|
114871
|
-
throw new exports.ValidationError(
|
|
114870
|
+
throw new exports.ValidationError(`Expected a ${label} payee hash`, "payeeDetails");
|
|
114872
114871
|
}
|
|
114873
114872
|
let origin;
|
|
114874
114873
|
try {
|
|
@@ -114879,7 +114878,7 @@ function getVenmoGmailConnectUrl({
|
|
|
114879
114878
|
if (origin.protocol !== "https:" && !(origin.protocol === "http:" && origin.hostname === "localhost") || origin.pathname !== "/" || origin.search || origin.hash || origin.username || origin.password) {
|
|
114880
114879
|
throw new exports.ValidationError("Expected an HTTPS Peer web origin", "peerOrigin");
|
|
114881
114880
|
}
|
|
114882
|
-
const url = new URL(
|
|
114881
|
+
const url = new URL(`/connect/${platform}`, origin);
|
|
114883
114882
|
if (returnUrl) {
|
|
114884
114883
|
try {
|
|
114885
114884
|
new URL(returnUrl);
|
|
@@ -114890,11 +114889,11 @@ function getVenmoGmailConnectUrl({
|
|
|
114890
114889
|
}
|
|
114891
114890
|
if (appearance)
|
|
114892
114891
|
url.searchParams.set("appearance", JSON.stringify(parseVenmoGmailAppearance(appearance)));
|
|
114893
|
-
url.hash = payeeDetails;
|
|
114892
|
+
url.hash = payeeUsername === void 0 ? payeeDetails : new URLSearchParams({ payeeDetails, payeeUsername }).toString();
|
|
114894
114893
|
return url.toString();
|
|
114895
114894
|
}
|
|
114896
|
-
function
|
|
114897
|
-
const url = new URL(
|
|
114895
|
+
function openMailboxConnect(options) {
|
|
114896
|
+
const url = new URL(getMailboxConnectUrl(options));
|
|
114898
114897
|
const { width, height } = getVenmoGmailPopupSize(options.popup);
|
|
114899
114898
|
const requestId = window.crypto.randomUUID();
|
|
114900
114899
|
url.searchParams.set("requestId", requestId);
|
|
@@ -114909,9 +114908,9 @@ function openVenmoGmailConnect(options) {
|
|
|
114909
114908
|
}
|
|
114910
114909
|
if (!popup) {
|
|
114911
114910
|
reject(
|
|
114912
|
-
new
|
|
114911
|
+
new options.ErrorClass(
|
|
114913
114912
|
"popup_blocked",
|
|
114914
|
-
|
|
114913
|
+
`Allow popups for this site, then link ${options.label} again.`
|
|
114915
114914
|
)
|
|
114916
114915
|
);
|
|
114917
114916
|
return;
|
|
@@ -114928,18 +114927,19 @@ function openVenmoGmailConnect(options) {
|
|
|
114928
114927
|
const data150 = event.data;
|
|
114929
114928
|
if (typeof data150 !== "object" || !data150) return;
|
|
114930
114929
|
const result = data150;
|
|
114931
|
-
if (result.type !==
|
|
114930
|
+
if (result.type !== `peer:${options.platform}-connect` || result.requestId !== requestId)
|
|
114931
|
+
return;
|
|
114932
114932
|
if (result.status === "connected" && typeof result.payeeDetails === "string" && result.payeeDetails.toLowerCase() === options.payeeDetails.toLowerCase()) {
|
|
114933
114933
|
finish();
|
|
114934
114934
|
} else if (result.status === "error" && typeof result.code === "string" && typeof result.message === "string") {
|
|
114935
|
-
finish(new
|
|
114935
|
+
finish(new options.ErrorClass(result.code, result.message));
|
|
114936
114936
|
}
|
|
114937
114937
|
};
|
|
114938
114938
|
const timeout = window.setTimeout(
|
|
114939
114939
|
() => finish(
|
|
114940
|
-
new
|
|
114940
|
+
new options.ErrorClass(
|
|
114941
114941
|
"connection_timeout",
|
|
114942
|
-
|
|
114942
|
+
`${options.label} linking timed out. Check the connection status before trying again.`
|
|
114943
114943
|
)
|
|
114944
114944
|
),
|
|
114945
114945
|
10 * 60 * 1e3
|
|
@@ -114947,7 +114947,7 @@ function openVenmoGmailConnect(options) {
|
|
|
114947
114947
|
const closedCheck = window.setInterval(() => {
|
|
114948
114948
|
if (popup.closed)
|
|
114949
114949
|
finish(
|
|
114950
|
-
new
|
|
114950
|
+
new options.ErrorClass(
|
|
114951
114951
|
"connection_closed",
|
|
114952
114952
|
"The linking window closed or became unavailable. Check the connection status before trying again."
|
|
114953
114953
|
)
|
|
@@ -114957,6 +114957,54 @@ function openVenmoGmailConnect(options) {
|
|
|
114957
114957
|
});
|
|
114958
114958
|
}
|
|
114959
114959
|
|
|
114960
|
+
// src/venmoGmail.ts
|
|
114961
|
+
var VenmoGmailConnectError = class extends Error {
|
|
114962
|
+
constructor(code, message) {
|
|
114963
|
+
super(message);
|
|
114964
|
+
this.code = code;
|
|
114965
|
+
this.name = "VenmoGmailConnectError";
|
|
114966
|
+
}
|
|
114967
|
+
};
|
|
114968
|
+
function getVenmoGmailConnectUrl(options) {
|
|
114969
|
+
return getMailboxConnectUrl({ ...options, platform: "venmo", label: "Venmo" });
|
|
114970
|
+
}
|
|
114971
|
+
function openVenmoGmailConnect(options) {
|
|
114972
|
+
return openMailboxConnect({
|
|
114973
|
+
...options,
|
|
114974
|
+
platform: "venmo",
|
|
114975
|
+
label: "Venmo",
|
|
114976
|
+
ErrorClass: VenmoGmailConnectError
|
|
114977
|
+
});
|
|
114978
|
+
}
|
|
114979
|
+
|
|
114980
|
+
// src/xMoneyConnect.ts
|
|
114981
|
+
init_define_ZKP2P_SDK_BUILD_METADATA();
|
|
114982
|
+
init_errors();
|
|
114983
|
+
var XMoneyConnectError = class extends Error {
|
|
114984
|
+
constructor(code, message) {
|
|
114985
|
+
super(message);
|
|
114986
|
+
this.code = code;
|
|
114987
|
+
this.name = "XMoneyConnectError";
|
|
114988
|
+
}
|
|
114989
|
+
};
|
|
114990
|
+
function identity(options) {
|
|
114991
|
+
const payeeUsername = options.payeeUsername.trim().replace(/^@/u, "").toLowerCase();
|
|
114992
|
+
if (!payeeUsername || viem.keccak256(viem.stringToBytes(payeeUsername)) !== options.payeeDetails.toLowerCase()) {
|
|
114993
|
+
throw new exports.ValidationError("X username must match the registered payee hash", "payeeUsername");
|
|
114994
|
+
}
|
|
114995
|
+
return { ...options, payeeUsername, platform: "xmoney", label: "X Money" };
|
|
114996
|
+
}
|
|
114997
|
+
function getXMoneyConnectUrl(options) {
|
|
114998
|
+
return getMailboxConnectUrl(identity(options));
|
|
114999
|
+
}
|
|
115000
|
+
function openXMoneyConnect(options) {
|
|
115001
|
+
return openMailboxConnect({
|
|
115002
|
+
...identity(options),
|
|
115003
|
+
popup: options.popup,
|
|
115004
|
+
ErrorClass: XMoneyConnectError
|
|
115005
|
+
});
|
|
115006
|
+
}
|
|
115007
|
+
|
|
114960
115008
|
Object.defineProperty(exports, "createNitroAttestationClient", {
|
|
114961
115009
|
enumerable: true,
|
|
114962
115010
|
get: function () { return zkp2pAttestation.createNitroAttestationClient; }
|
|
@@ -114991,6 +115039,7 @@ exports.SPREAD_ORACLE_FEEDS = SPREAD_ORACLE_FEEDS;
|
|
|
114991
115039
|
exports.SUPPORTED_CHAIN_IDS = SUPPORTED_CHAIN_IDS;
|
|
114992
115040
|
exports.TOKEN_METADATA = TOKEN_METADATA;
|
|
114993
115041
|
exports.VenmoGmailConnectError = VenmoGmailConnectError;
|
|
115042
|
+
exports.XMoneyConnectError = XMoneyConnectError;
|
|
114994
115043
|
exports.ZERO_RATE_MANAGER_ID = ZERO_RATE_MANAGER_ID;
|
|
114995
115044
|
exports.ZKP2P_ANDROID_REFERRER = ZKP2P_ANDROID_REFERRER;
|
|
114996
115045
|
exports.ZKP2P_IOS_REFERRER = ZKP2P_IOS_REFERRER;
|
|
@@ -115059,6 +115108,7 @@ exports.getRateManagerContracts = getRateManagerContracts;
|
|
|
115059
115108
|
exports.getSpreadOracleConfig = getSpreadOracleConfig;
|
|
115060
115109
|
exports.getStakeVaultContract = getStakeVaultContract;
|
|
115061
115110
|
exports.getVenmoGmailConnectUrl = getVenmoGmailConnectUrl;
|
|
115111
|
+
exports.getXMoneyConnectUrl = getXMoneyConnectUrl;
|
|
115062
115112
|
exports.hasIntentGuardian = hasIntentGuardian;
|
|
115063
115113
|
exports.isMailboxSellerCredentialType = isMailboxSellerCredentialType;
|
|
115064
115114
|
exports.isPeerExtensionAvailable = isPeerExtensionAvailable;
|
|
@@ -115074,6 +115124,7 @@ exports.normalizeReferralCode = normalizeReferralCode;
|
|
|
115074
115124
|
exports.normalizeRegistry = normalizeRegistry;
|
|
115075
115125
|
exports.openPeerExtensionInstallPage = openPeerExtensionInstallPage;
|
|
115076
115126
|
exports.openVenmoGmailConnect = openVenmoGmailConnect;
|
|
115127
|
+
exports.openXMoneyConnect = openXMoneyConnect;
|
|
115077
115128
|
exports.parseDepositView = parseDepositView;
|
|
115078
115129
|
exports.parseIntentView = parseIntentView;
|
|
115079
115130
|
exports.parseReferrerFeeConfig = parseReferrerFeeConfig;
|