@zkp2p/sdk 0.5.5 → 0.5.7
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-NKTSEXJB.mjs → chunk-NMIFJSZ3.mjs} +101 -129
- package/dist/{chunk-NKTSEXJB.mjs.map → chunk-NMIFJSZ3.mjs.map} +1 -1
- package/dist/index.cjs +178 -199
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +19 -12
- package/dist/index.mjs.map +1 -1
- package/dist/protocolViewerParsers-N5SJ4KHJ.mjs +5 -0
- package/dist/{protocolViewerParsers-3JGPLQGP.mjs.map → protocolViewerParsers-N5SJ4KHJ.mjs.map} +1 -1
- package/package.json +2 -2
- package/dist/protocolViewerParsers-3JGPLQGP.mjs +0 -5
package/dist/index.d.mts
CHANGED
|
@@ -217,7 +217,7 @@ declare function apiCreateSellerCredentialBundle(payload: SellerCredentialUpload
|
|
|
217
217
|
declare function apiUploadSellerCredentialBundle(params: UploadSellerCredentialBundleParams, baseApiUrl?: string | null, timeoutMs?: number): Promise<CuratorSellerCredentialUploadResponse>;
|
|
218
218
|
|
|
219
219
|
declare function apiPostDepositDetails(req: PostDepositDetailsRequest, baseApiUrl: string, timeoutMs?: number): Promise<PostDepositDetailsResponse>;
|
|
220
|
-
declare function apiGetQuotesBestByPlatform(req: QuotesBestByPlatformRequest, baseApiUrl: string, timeoutMs?: number): Promise<BestByPlatformResponse>;
|
|
220
|
+
declare function apiGetQuotesBestByPlatform(req: QuotesBestByPlatformRequest, baseApiUrl: string, timeoutMs?: number, apiKey?: string): Promise<BestByPlatformResponse>;
|
|
221
221
|
declare function apiGetPayeeDetails(req: GetPayeeDetailsRequest, baseApiUrl: string, timeoutMs?: number): Promise<GetPayeeDetailsResponse>;
|
|
222
222
|
declare function apiValidatePayeeDetails(req: ValidatePayeeDetailsRequest, baseApiUrl: string, timeoutMs?: number): Promise<ValidatePayeeDetailsResponse>;
|
|
223
223
|
declare function apiGetOwnerDeposits(req: GetOwnerDepositsRequest, apiKey: string | undefined, baseApiUrl: string, authToken?: string, timeoutMs?: number): Promise<GetOwnerDepositsResponse>;
|
package/dist/index.d.ts
CHANGED
|
@@ -217,7 +217,7 @@ declare function apiCreateSellerCredentialBundle(payload: SellerCredentialUpload
|
|
|
217
217
|
declare function apiUploadSellerCredentialBundle(params: UploadSellerCredentialBundleParams, baseApiUrl?: string | null, timeoutMs?: number): Promise<CuratorSellerCredentialUploadResponse>;
|
|
218
218
|
|
|
219
219
|
declare function apiPostDepositDetails(req: PostDepositDetailsRequest, baseApiUrl: string, timeoutMs?: number): Promise<PostDepositDetailsResponse>;
|
|
220
|
-
declare function apiGetQuotesBestByPlatform(req: QuotesBestByPlatformRequest, baseApiUrl: string, timeoutMs?: number): Promise<BestByPlatformResponse>;
|
|
220
|
+
declare function apiGetQuotesBestByPlatform(req: QuotesBestByPlatformRequest, baseApiUrl: string, timeoutMs?: number, apiKey?: string): Promise<BestByPlatformResponse>;
|
|
221
221
|
declare function apiGetPayeeDetails(req: GetPayeeDetailsRequest, baseApiUrl: string, timeoutMs?: number): Promise<GetPayeeDetailsResponse>;
|
|
222
222
|
declare function apiValidatePayeeDetails(req: ValidatePayeeDetailsRequest, baseApiUrl: string, timeoutMs?: number): Promise<ValidatePayeeDetailsResponse>;
|
|
223
223
|
declare function apiGetOwnerDeposits(req: GetOwnerDepositsRequest, apiKey: string | undefined, baseApiUrl: string, authToken?: string, timeoutMs?: number): Promise<GetOwnerDepositsResponse>;
|
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-NMIFJSZ3.mjs';
|
|
5
|
+
export { asciiToBytes32, enrichPvDepositView, enrichPvIntentView, ensureBytes32, getContracts, getGatingServiceAddress, getPaymentMethodsCatalog, getRateManagerContracts, parseDepositView, parseIntentView, resolveFiatCurrencyBytes32, resolvePaymentMethodHash, resolvePaymentMethodHashFromCatalog, resolvePaymentMethodNameFromHash } from './chunk-NMIFJSZ3.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.4_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
|
{
|
|
@@ -1820,7 +1820,7 @@ var ProtocolViewerReader = class {
|
|
|
1820
1820
|
if (inputCount === null) {
|
|
1821
1821
|
throw new Error("Configured ProtocolViewer ABI does not expose getDeposit");
|
|
1822
1822
|
}
|
|
1823
|
-
const { parseDepositView: parseDepositView2 } = await import('./protocolViewerParsers-
|
|
1823
|
+
const { parseDepositView: parseDepositView2 } = await import('./protocolViewerParsers-N5SJ4KHJ.mjs');
|
|
1824
1824
|
if (inputCount >= 3) {
|
|
1825
1825
|
return tryContexts(
|
|
1826
1826
|
protocolViewerContexts,
|
|
@@ -1899,7 +1899,7 @@ var ProtocolViewerReader = class {
|
|
|
1899
1899
|
return Promise.all(ids.map((id) => this.config.host.getPvDepositById(id)));
|
|
1900
1900
|
}
|
|
1901
1901
|
const bn = ids.map((id) => typeof id === "bigint" ? id : parseRawDepositId(id));
|
|
1902
|
-
const { parseDepositView: parseDepositView2 } = await import('./protocolViewerParsers-
|
|
1902
|
+
const { parseDepositView: parseDepositView2 } = await import('./protocolViewerParsers-N5SJ4KHJ.mjs');
|
|
1903
1903
|
if (inputCount >= 2) {
|
|
1904
1904
|
const requests = ids.map((id, index) => ({
|
|
1905
1905
|
index,
|
|
@@ -2004,7 +2004,7 @@ var ProtocolViewerReader = class {
|
|
|
2004
2004
|
if (!protocolViewerAddress || !protocolViewerAbi || inputCount === null) {
|
|
2005
2005
|
return this.config.host.getPvAccountDepositsFromIndexer(owner);
|
|
2006
2006
|
}
|
|
2007
|
-
const { parseDepositView: parseDepositView2 } = await import('./protocolViewerParsers-
|
|
2007
|
+
const { parseDepositView: parseDepositView2 } = await import('./protocolViewerParsers-N5SJ4KHJ.mjs');
|
|
2008
2008
|
const { address, abi } = this.config.host.requireProtocolViewer();
|
|
2009
2009
|
if (inputCount >= 2) {
|
|
2010
2010
|
const readAndFilter = async (raw2) => {
|
|
@@ -2075,7 +2075,7 @@ var ProtocolViewerReader = class {
|
|
|
2075
2075
|
if (protocolViewerEntries.length === 0) {
|
|
2076
2076
|
throw new Error("ProtocolViewer not available for this network");
|
|
2077
2077
|
}
|
|
2078
|
-
const { parseIntentView: parseIntentView2 } = await import('./protocolViewerParsers-
|
|
2078
|
+
const { parseIntentView: parseIntentView2 } = await import('./protocolViewerParsers-N5SJ4KHJ.mjs');
|
|
2079
2079
|
const intentsByHash = /* @__PURE__ */ new Map();
|
|
2080
2080
|
let attemptedRead = false;
|
|
2081
2081
|
let hadSuccessfulRead = false;
|
|
@@ -2183,7 +2183,7 @@ var ProtocolViewerReader = class {
|
|
|
2183
2183
|
if (protocolViewerEntries.length === 0) {
|
|
2184
2184
|
throw new Error("ProtocolViewer not available for this network");
|
|
2185
2185
|
}
|
|
2186
|
-
const { parseIntentView: parseIntentView2 } = await import('./protocolViewerParsers-
|
|
2186
|
+
const { parseIntentView: parseIntentView2 } = await import('./protocolViewerParsers-N5SJ4KHJ.mjs');
|
|
2187
2187
|
let lastError;
|
|
2188
2188
|
for (const pvEntry of protocolViewerEntries) {
|
|
2189
2189
|
const inputCount = this.pvEntryFunctionInputCount(pvEntry, "getIntent");
|
|
@@ -5254,7 +5254,7 @@ async function apiPostDepositDetails(req, baseApiUrl, timeoutMs) {
|
|
|
5254
5254
|
timeoutMs
|
|
5255
5255
|
});
|
|
5256
5256
|
}
|
|
5257
|
-
async function apiGetQuote(req, baseApiUrl, timeoutMs) {
|
|
5257
|
+
async function apiGetQuote(req, baseApiUrl, timeoutMs, apiKey) {
|
|
5258
5258
|
if (req.quotesToReturn !== void 0) {
|
|
5259
5259
|
if (!Number.isInteger(req.quotesToReturn) || req.quotesToReturn < 1) {
|
|
5260
5260
|
throw new ValidationError("quotesToReturn must be a positive integer", "quotesToReturn");
|
|
@@ -5289,10 +5289,11 @@ async function apiGetQuote(req, baseApiUrl, timeoutMs) {
|
|
|
5289
5289
|
url,
|
|
5290
5290
|
method: "POST",
|
|
5291
5291
|
body: requestBody,
|
|
5292
|
+
apiKey,
|
|
5292
5293
|
timeoutMs
|
|
5293
5294
|
});
|
|
5294
5295
|
}
|
|
5295
|
-
async function apiGetQuotesBestByPlatform(req, baseApiUrl, timeoutMs) {
|
|
5296
|
+
async function apiGetQuotesBestByPlatform(req, baseApiUrl, timeoutMs, apiKey) {
|
|
5296
5297
|
const isExactFiat = req.isExactFiat !== false;
|
|
5297
5298
|
const endpoint = isExactFiat ? "best-by-platform" : "best-by-platform-exact-token";
|
|
5298
5299
|
const url = `${withApiBase(baseApiUrl)}/v2/quote/${endpoint}`;
|
|
@@ -5310,6 +5311,7 @@ async function apiGetQuotesBestByPlatform(req, baseApiUrl, timeoutMs) {
|
|
|
5310
5311
|
url,
|
|
5311
5312
|
method: "POST",
|
|
5312
5313
|
body: requestBody,
|
|
5314
|
+
apiKey,
|
|
5313
5315
|
timeoutMs
|
|
5314
5316
|
});
|
|
5315
5317
|
}
|
|
@@ -7982,7 +7984,7 @@ var Zkp2pClient = class {
|
|
|
7982
7984
|
reqWithEscrow.escrowAddresses = configuredEscrows;
|
|
7983
7985
|
}
|
|
7984
7986
|
}
|
|
7985
|
-
const quote = await apiGetQuote(reqWithEscrow, baseApiUrl, timeoutMs);
|
|
7987
|
+
const quote = await apiGetQuote(reqWithEscrow, baseApiUrl, timeoutMs, this.apiKey);
|
|
7986
7988
|
const quotes = quote?.responseObject?.quotes ?? [];
|
|
7987
7989
|
for (const q of quotes) {
|
|
7988
7990
|
const maker = q?.maker;
|
|
@@ -8020,7 +8022,12 @@ var Zkp2pClient = class {
|
|
|
8020
8022
|
reqWithEscrow.escrowAddresses = configuredEscrows;
|
|
8021
8023
|
}
|
|
8022
8024
|
}
|
|
8023
|
-
const quote = await apiGetQuotesBestByPlatform(
|
|
8025
|
+
const quote = await apiGetQuotesBestByPlatform(
|
|
8026
|
+
reqWithEscrow,
|
|
8027
|
+
baseApiUrl,
|
|
8028
|
+
timeoutMs,
|
|
8029
|
+
this.apiKey
|
|
8030
|
+
);
|
|
8024
8031
|
const enrichedQuote = quote ? {
|
|
8025
8032
|
...quote,
|
|
8026
8033
|
responseObject: {
|