@zkp2p/sdk 0.5.6 → 0.5.8
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/index.cjs +16 -5
- 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 +16 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
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
|
@@ -371,9 +371,11 @@ async function apiSignIntentV3(request, opts) {
|
|
|
371
371
|
async () => {
|
|
372
372
|
let res;
|
|
373
373
|
try {
|
|
374
|
+
const headers2 = { "Content-Type": "application/json" };
|
|
375
|
+
if (opts.apiKey) headers2["x-api-key"] = opts.apiKey;
|
|
374
376
|
res = await fetch(url, {
|
|
375
377
|
method: "POST",
|
|
376
|
-
headers:
|
|
378
|
+
headers: headers2,
|
|
377
379
|
body: JSON.stringify(request)
|
|
378
380
|
});
|
|
379
381
|
} catch (error) {
|
|
@@ -1105,6 +1107,7 @@ var IntentOperations = class {
|
|
|
1105
1107
|
if ((!gatingServiceSignature || !signatureExpiration) && baseApiUrl) {
|
|
1106
1108
|
const apiOpts = {
|
|
1107
1109
|
baseApiUrl,
|
|
1110
|
+
apiKey: this.config.getApiKey(),
|
|
1108
1111
|
timeoutMs: this.config.getApiTimeoutMs()
|
|
1109
1112
|
};
|
|
1110
1113
|
const response = await apiSignIntentV3(
|
|
@@ -5254,7 +5257,7 @@ async function apiPostDepositDetails(req, baseApiUrl, timeoutMs) {
|
|
|
5254
5257
|
timeoutMs
|
|
5255
5258
|
});
|
|
5256
5259
|
}
|
|
5257
|
-
async function apiGetQuote(req, baseApiUrl, timeoutMs) {
|
|
5260
|
+
async function apiGetQuote(req, baseApiUrl, timeoutMs, apiKey) {
|
|
5258
5261
|
if (req.quotesToReturn !== void 0) {
|
|
5259
5262
|
if (!Number.isInteger(req.quotesToReturn) || req.quotesToReturn < 1) {
|
|
5260
5263
|
throw new ValidationError("quotesToReturn must be a positive integer", "quotesToReturn");
|
|
@@ -5289,10 +5292,11 @@ async function apiGetQuote(req, baseApiUrl, timeoutMs) {
|
|
|
5289
5292
|
url,
|
|
5290
5293
|
method: "POST",
|
|
5291
5294
|
body: requestBody,
|
|
5295
|
+
apiKey,
|
|
5292
5296
|
timeoutMs
|
|
5293
5297
|
});
|
|
5294
5298
|
}
|
|
5295
|
-
async function apiGetQuotesBestByPlatform(req, baseApiUrl, timeoutMs) {
|
|
5299
|
+
async function apiGetQuotesBestByPlatform(req, baseApiUrl, timeoutMs, apiKey) {
|
|
5296
5300
|
const isExactFiat = req.isExactFiat !== false;
|
|
5297
5301
|
const endpoint = isExactFiat ? "best-by-platform" : "best-by-platform-exact-token";
|
|
5298
5302
|
const url = `${withApiBase(baseApiUrl)}/v2/quote/${endpoint}`;
|
|
@@ -5310,6 +5314,7 @@ async function apiGetQuotesBestByPlatform(req, baseApiUrl, timeoutMs) {
|
|
|
5310
5314
|
url,
|
|
5311
5315
|
method: "POST",
|
|
5312
5316
|
body: requestBody,
|
|
5317
|
+
apiKey,
|
|
5313
5318
|
timeoutMs
|
|
5314
5319
|
});
|
|
5315
5320
|
}
|
|
@@ -6727,6 +6732,7 @@ var Zkp2pClient = class {
|
|
|
6727
6732
|
getChainId: () => this.chainId,
|
|
6728
6733
|
getRuntimeEnv: () => this.runtimeEnv,
|
|
6729
6734
|
getBaseApiUrl: () => this.baseApiUrl,
|
|
6735
|
+
getApiKey: () => this.apiKey,
|
|
6730
6736
|
getApiTimeoutMs: () => this.apiTimeoutMs,
|
|
6731
6737
|
getProtocolViewerAddress: () => this.protocolViewerAddress,
|
|
6732
6738
|
getProtocolViewerAbi: () => this.protocolViewerAbi,
|
|
@@ -7982,7 +7988,7 @@ var Zkp2pClient = class {
|
|
|
7982
7988
|
reqWithEscrow.escrowAddresses = configuredEscrows;
|
|
7983
7989
|
}
|
|
7984
7990
|
}
|
|
7985
|
-
const quote = await apiGetQuote(reqWithEscrow, baseApiUrl, timeoutMs);
|
|
7991
|
+
const quote = await apiGetQuote(reqWithEscrow, baseApiUrl, timeoutMs, this.apiKey);
|
|
7986
7992
|
const quotes = quote?.responseObject?.quotes ?? [];
|
|
7987
7993
|
for (const q of quotes) {
|
|
7988
7994
|
const maker = q?.maker;
|
|
@@ -8020,7 +8026,12 @@ var Zkp2pClient = class {
|
|
|
8020
8026
|
reqWithEscrow.escrowAddresses = configuredEscrows;
|
|
8021
8027
|
}
|
|
8022
8028
|
}
|
|
8023
|
-
const quote = await apiGetQuotesBestByPlatform(
|
|
8029
|
+
const quote = await apiGetQuotesBestByPlatform(
|
|
8030
|
+
reqWithEscrow,
|
|
8031
|
+
baseApiUrl,
|
|
8032
|
+
timeoutMs,
|
|
8033
|
+
this.apiKey
|
|
8034
|
+
);
|
|
8024
8035
|
const enrichedQuote = quote ? {
|
|
8025
8036
|
...quote,
|
|
8026
8037
|
responseObject: {
|