@zkp2p/sdk 0.5.4 → 0.5.5
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/{chunk-VJ33XYCV.mjs → chunk-NKTSEXJB.mjs} +138 -101
- package/dist/{chunk-VJ33XYCV.mjs.map → chunk-NKTSEXJB.mjs.map} +1 -1
- package/dist/index.cjs +221 -179
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +29 -22
- package/dist/index.mjs.map +1 -1
- package/dist/protocolViewerParsers-3JGPLQGP.mjs +5 -0
- package/dist/{protocolViewerParsers-XN63B2S5.mjs.map → protocolViewerParsers-3JGPLQGP.mjs.map} +1 -1
- package/package.json +1 -1
- package/dist/protocolViewerParsers-XN63B2S5.mjs +0 -5
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export { TAKER_TIER_CAPS, TAKER_TIER_ORDER, TAKER_TIER_SCHEDULE, ZERO_RATE_MANAGER_ID, classifyDelegationState, getDelegationRoute, getNextTakerTier, isZeroRateManagerId, normalizeRateManagerId, normalizeRegistry } from './chunk-TGMRXUP2.mjs';
|
|
2
2
|
import { APIError, NetworkError, ValidationError } from './chunk-GHQK65J2.mjs';
|
|
3
3
|
export { APIError, ContractError, ErrorCode, NetworkError, ValidationError, ZKP2PError } from './chunk-GHQK65J2.mjs';
|
|
4
|
-
import { getContracts, getRateManagerContracts, getPaymentMethodsCatalog, resolvePaymentMethodHashFromCatalog, getGatingServiceAddress, parseBigIntLike, resolveFiatCurrencyBytes32, resolvePaymentMethodNameFromHash } from './chunk-
|
|
5
|
-
export { asciiToBytes32, enrichPvDepositView, enrichPvIntentView, ensureBytes32, getContracts, getGatingServiceAddress, getPaymentMethodsCatalog, getRateManagerContracts, parseDepositView, parseIntentView, resolveFiatCurrencyBytes32, resolvePaymentMethodHash, resolvePaymentMethodHashFromCatalog, resolvePaymentMethodNameFromHash } from './chunk-
|
|
4
|
+
import { getContracts, getRateManagerContracts, getPaymentMethodsCatalog, resolvePaymentMethodHashFromCatalog, getGatingServiceAddress, parseBigIntLike, resolveFiatCurrencyBytes32, resolvePaymentMethodNameFromHash } from './chunk-NKTSEXJB.mjs';
|
|
5
|
+
export { asciiToBytes32, enrichPvDepositView, enrichPvIntentView, ensureBytes32, getContracts, getGatingServiceAddress, getPaymentMethodsCatalog, getRateManagerContracts, parseDepositView, parseIntentView, resolveFiatCurrencyBytes32, resolvePaymentMethodHash, resolvePaymentMethodHashFromCatalog, resolvePaymentMethodNameFromHash } from './chunk-NKTSEXJB.mjs';
|
|
6
6
|
import { Currency, currencyKeccak256 } from './chunk-ZFBH4HD7.mjs';
|
|
7
7
|
export { Currency, currencyInfo, getCurrencyCodeFromHash, getCurrencyInfoFromCountryCode, getCurrencyInfoFromHash, isSupportedCurrencyHash, mapConversionRatesToOnchainMinRate } from './chunk-ZFBH4HD7.mjs';
|
|
8
8
|
import './chunk-J5LGTIGS.mjs';
|
|
@@ -716,7 +716,7 @@ var PAYMENT_PLATFORMS = [
|
|
|
716
716
|
// src/utils/constants.ts
|
|
717
717
|
var DEFAULT_BASE_API_URL = "https://api.zkp2p.xyz";
|
|
718
718
|
|
|
719
|
-
// ../../node_modules/.pnpm/@zkp2p+contracts-v2@0.2.
|
|
719
|
+
// ../../node_modules/.pnpm/@zkp2p+contracts-v2@0.2.2_ethers@6.16.0_bufferutil@4.1.0_utf-8-validate@5.0.10__typescript@5.9.3_zod@4.2.1/node_modules/@zkp2p/contracts-v2/oracleFeeds/chainlink.json
|
|
720
720
|
var chainlink_default = {
|
|
721
721
|
feeds: [
|
|
722
722
|
{
|
|
@@ -999,10 +999,7 @@ var PLATFORM_ATTESTATION_CONFIG = {
|
|
|
999
999
|
chime: { actionType: "transfer_chime", actionPlatform: "chime" },
|
|
1000
1000
|
luxon: { actionType: "transfer_luxon", actionPlatform: "luxon" },
|
|
1001
1001
|
n26: { actionType: "transfer_n26", actionPlatform: "n26" },
|
|
1002
|
-
alipay: { actionType: "transfer_alipay", actionPlatform: "alipay" }
|
|
1003
|
-
"zelle-chase": { actionType: "transfer_zelle", actionPlatform: "chase" },
|
|
1004
|
-
"zelle-bofa": { actionType: "transfer_zelle", actionPlatform: "bankofamerica" },
|
|
1005
|
-
"zelle-citi": { actionType: "transfer_zelle", actionPlatform: "citi" }
|
|
1002
|
+
alipay: { actionType: "transfer_alipay", actionPlatform: "alipay" }
|
|
1006
1003
|
};
|
|
1007
1004
|
function resolvePlatformAttestationConfig(platformName) {
|
|
1008
1005
|
const normalized = platformName.toLowerCase();
|
|
@@ -1033,22 +1030,32 @@ var GENERIC_ZELLE_ATTESTATION_ACTION_TYPES = /* @__PURE__ */ new Set([
|
|
|
1033
1030
|
"transfer_zelle_chase",
|
|
1034
1031
|
"transfer_zelle_citi"
|
|
1035
1032
|
]);
|
|
1033
|
+
function hasBuyerTeeRouteOverrides(buyerTeeProof) {
|
|
1034
|
+
return Boolean(buyerTeeProof.actionPlatform && buyerTeeProof.actionType);
|
|
1035
|
+
}
|
|
1036
1036
|
function resolveBuyerTeeAttestationRoute(platformName, buyerTeeProof) {
|
|
1037
|
-
|
|
1038
|
-
|
|
1037
|
+
const normalizedPlatformName = platformName.toLowerCase();
|
|
1038
|
+
if (normalizedPlatformName === "zelle") {
|
|
1039
|
+
if (buyerTeeProof.actionPlatform !== "zelle" || !buyerTeeProof.actionType || !GENERIC_ZELLE_ATTESTATION_ACTION_TYPES.has(buyerTeeProof.actionType)) {
|
|
1040
|
+
throw new Error(
|
|
1041
|
+
'Generic Zelle buyer TEE fulfillment requires actionPlatform "zelle" and a bank-specific transfer_zelle_* actionType.'
|
|
1042
|
+
);
|
|
1043
|
+
}
|
|
1039
1044
|
return {
|
|
1040
|
-
actionPlatform: buyerTeeProof.actionPlatform
|
|
1041
|
-
actionType: buyerTeeProof.actionType
|
|
1045
|
+
actionPlatform: buyerTeeProof.actionPlatform,
|
|
1046
|
+
actionType: buyerTeeProof.actionType
|
|
1042
1047
|
};
|
|
1043
1048
|
}
|
|
1044
|
-
if (
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1049
|
+
if (hasBuyerTeeRouteOverrides(buyerTeeProof)) {
|
|
1050
|
+
return {
|
|
1051
|
+
actionPlatform: buyerTeeProof.actionPlatform,
|
|
1052
|
+
actionType: buyerTeeProof.actionType
|
|
1053
|
+
};
|
|
1048
1054
|
}
|
|
1055
|
+
const platformConfig = resolvePlatformAttestationConfig(platformName);
|
|
1049
1056
|
return {
|
|
1050
|
-
actionPlatform:
|
|
1051
|
-
actionType:
|
|
1057
|
+
actionPlatform: platformConfig.actionPlatform,
|
|
1058
|
+
actionType: platformConfig.actionType
|
|
1052
1059
|
};
|
|
1053
1060
|
}
|
|
1054
1061
|
var IntentOperations = class {
|
|
@@ -1813,7 +1820,7 @@ var ProtocolViewerReader = class {
|
|
|
1813
1820
|
if (inputCount === null) {
|
|
1814
1821
|
throw new Error("Configured ProtocolViewer ABI does not expose getDeposit");
|
|
1815
1822
|
}
|
|
1816
|
-
const { parseDepositView: parseDepositView2 } = await import('./protocolViewerParsers-
|
|
1823
|
+
const { parseDepositView: parseDepositView2 } = await import('./protocolViewerParsers-3JGPLQGP.mjs');
|
|
1817
1824
|
if (inputCount >= 3) {
|
|
1818
1825
|
return tryContexts(
|
|
1819
1826
|
protocolViewerContexts,
|
|
@@ -1892,7 +1899,7 @@ var ProtocolViewerReader = class {
|
|
|
1892
1899
|
return Promise.all(ids.map((id) => this.config.host.getPvDepositById(id)));
|
|
1893
1900
|
}
|
|
1894
1901
|
const bn = ids.map((id) => typeof id === "bigint" ? id : parseRawDepositId(id));
|
|
1895
|
-
const { parseDepositView: parseDepositView2 } = await import('./protocolViewerParsers-
|
|
1902
|
+
const { parseDepositView: parseDepositView2 } = await import('./protocolViewerParsers-3JGPLQGP.mjs');
|
|
1896
1903
|
if (inputCount >= 2) {
|
|
1897
1904
|
const requests = ids.map((id, index) => ({
|
|
1898
1905
|
index,
|
|
@@ -1997,7 +2004,7 @@ var ProtocolViewerReader = class {
|
|
|
1997
2004
|
if (!protocolViewerAddress || !protocolViewerAbi || inputCount === null) {
|
|
1998
2005
|
return this.config.host.getPvAccountDepositsFromIndexer(owner);
|
|
1999
2006
|
}
|
|
2000
|
-
const { parseDepositView: parseDepositView2 } = await import('./protocolViewerParsers-
|
|
2007
|
+
const { parseDepositView: parseDepositView2 } = await import('./protocolViewerParsers-3JGPLQGP.mjs');
|
|
2001
2008
|
const { address, abi } = this.config.host.requireProtocolViewer();
|
|
2002
2009
|
if (inputCount >= 2) {
|
|
2003
2010
|
const readAndFilter = async (raw2) => {
|
|
@@ -2068,7 +2075,7 @@ var ProtocolViewerReader = class {
|
|
|
2068
2075
|
if (protocolViewerEntries.length === 0) {
|
|
2069
2076
|
throw new Error("ProtocolViewer not available for this network");
|
|
2070
2077
|
}
|
|
2071
|
-
const { parseIntentView: parseIntentView2 } = await import('./protocolViewerParsers-
|
|
2078
|
+
const { parseIntentView: parseIntentView2 } = await import('./protocolViewerParsers-3JGPLQGP.mjs');
|
|
2072
2079
|
const intentsByHash = /* @__PURE__ */ new Map();
|
|
2073
2080
|
let attemptedRead = false;
|
|
2074
2081
|
let hadSuccessfulRead = false;
|
|
@@ -2176,7 +2183,7 @@ var ProtocolViewerReader = class {
|
|
|
2176
2183
|
if (protocolViewerEntries.length === 0) {
|
|
2177
2184
|
throw new Error("ProtocolViewer not available for this network");
|
|
2178
2185
|
}
|
|
2179
|
-
const { parseIntentView: parseIntentView2 } = await import('./protocolViewerParsers-
|
|
2186
|
+
const { parseIntentView: parseIntentView2 } = await import('./protocolViewerParsers-3JGPLQGP.mjs');
|
|
2180
2187
|
let lastError;
|
|
2181
2188
|
for (const pvEntry of protocolViewerEntries) {
|
|
2182
2189
|
const inputCount = this.pvEntryFunctionInputCount(pvEntry, "getIntent");
|