@layr-labs/ecloud-sdk 1.0.0-dev.2 → 1.0.0-dev.4
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/VERSION +2 -2
- package/dist/billing.cjs +147 -34
- package/dist/billing.cjs.map +1 -1
- package/dist/billing.d.cts +13 -3
- package/dist/billing.d.ts +13 -3
- package/dist/billing.js +147 -34
- package/dist/billing.js.map +1 -1
- package/dist/browser.cjs +50 -9
- package/dist/browser.cjs.map +1 -1
- package/dist/browser.d.cts +4 -4
- package/dist/browser.d.ts +4 -4
- package/dist/browser.js +51 -10
- package/dist/browser.js.map +1 -1
- package/dist/{compute-Cnw6rwSB.d.ts → compute-B6SZ0VQG.d.ts} +1 -1
- package/dist/{compute-Ckyn8ils.d.cts → compute-BK4PxhNh.d.cts} +1 -1
- package/dist/compute.cjs +15 -5
- package/dist/compute.cjs.map +1 -1
- package/dist/compute.d.cts +2 -2
- package/dist/compute.d.ts +2 -2
- package/dist/compute.js +16 -6
- package/dist/compute.js.map +1 -1
- package/dist/{helpers-DZL2bg9p.d.cts → helpers-F7CeDSVX.d.ts} +7 -2
- package/dist/{helpers-Dj2ME5rp.d.ts → helpers-Qq5W-qNn.d.cts} +7 -2
- package/dist/{index-U2vKBrry.d.cts → index-BoCE0hIh.d.cts} +19 -1
- package/dist/{index-U2vKBrry.d.ts → index-BoCE0hIh.d.ts} +19 -1
- package/dist/index.cjs +116 -28
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -7
- package/dist/index.d.ts +7 -7
- package/dist/index.js +116 -29
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/tools/tls-keygen-linux-amd64 +0 -0
package/dist/browser.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { A as AppId } from './index-
|
|
2
|
-
export { a as AlreadyActiveResponse, b as AppConfig, c as AppProfile, d as AppProfileResponse, e as AppRecord, B as BatchedDeployResult, f as BillingEnvironmentConfig, C as CalculateAppIDOptions, g as CancelResponse, h as CancelSuccessResponse, i as ChainID, j as CheckoutCreatedResponse, k as CreateSubscriptionOptions, l as CreateSubscriptionResponse, D as DeployAppOptions,
|
|
3
|
-
import { C as ComputeApiConfig, S as SessionInfo, a as SessionError, b as SiweMessageParams } from './helpers-
|
|
4
|
-
export { A as AppInfo, c as AppInfoResponse, d as AppMetrics, e as AppProfileInfo, B as BillingApiClient, f as BillingApiClientOptions, g as BillingApiConfig, h as BillingLoginRequest, i as BillingLoginResult, j as BillingSessionError, k as BillingSessionInfo, l as CreateAppParams, E as EstimateBatchGasOptions, m as ExecuteBatchOptions, n as Execution, G as GeneratedKey, L as LogVisibility, o as LoginRequest, p as LoginResult, q as LogsParams, r as SiweMessageResult, U as UserApiClient, s as UserApiClientOptions, t as addHexPrefix, u as assertValidImageReference, v as assertValidPrivateKey, w as checkERC7702Delegation, x as createSiweMessage, y as estimateBatchGas, z as executeBatch, D as extractAppNameFromImage, F as generateNewPrivateKey, H as generateNonce, I as getAvailableEnvironments, J as getBillingApiSession, K as getBillingEnvironmentConfig, M as getBuildType, N as getChainFromID, O as getComputeApiSession, P as getEnvironmentConfig, Q as isBillingSessionValid, R as isEnvironmentAvailable, T as isMainnet, V as isSessionValid, W as isSiweMessageExpired, X as isSiweMessageNotYetValid, Y as isSubscriptionActive, Z as loginToBillingApi, _ as loginToBothApis, $ as loginToComputeApi, a0 as logoutFromBillingApi, a1 as logoutFromBothApis, a2 as logoutFromComputeApi, a3 as parseSiweMessage, a4 as sanitizeString, a5 as sanitizeURL, a6 as sanitizeXURL, a7 as stripHexPrefix, a8 as validateAppID, a9 as validateAppName, aa as validateCreateAppParams, ab as validateDescription, ac as validateImageReference, ad as validateInstanceTypeSKU, ae as validateLogVisibility, af as validateLogsParams, ag as validatePrivateKeyFormat, ah as validateURL, ai as validateXURL } from './helpers-
|
|
1
|
+
import { A as AppId } from './index-BoCE0hIh.cjs';
|
|
2
|
+
export { a as AlreadyActiveResponse, b as AppConfig, c as AppProfile, d as AppProfileResponse, e as AppRecord, B as BatchedDeployResult, f as BillingEnvironmentConfig, C as CalculateAppIDOptions, g as CancelResponse, h as CancelSuccessResponse, i as ChainID, j as CheckoutCreatedResponse, k as CreateSubscriptionOptions, l as CreateSubscriptionResponse, m as CreditPurchaseResponse, D as DeployAppOptions, n as DeployAppOpts, o as DeployOptions, p as DeployProgressCallback, q as DeployResult, r as DeployStep, s as DockerImageConfig, E as EnvironmentConfig, t as EstimateGasOptions, u as ExecuteDeployBatchedOptions, v as ExecuteDeployResult, w as ExecuteDeploySequentialOptions, x as ExecuteUpgradeResult, G as GasEstimate, y as GasOpts, z as GetSubscriptionOptions, I as ImageDigestResult, F as IsDelegatedOptions, L as LifecycleOpts, H as Logger, N as NoActiveSubscriptionResponse, P as ParsedEnvironment, J as PaymentIssueResponse, K as PaymentMethod, M as PaymentMethodsResponse, O as PrepareDeployBatchOptions, Q as PrepareDeployFromVerifiableBuildOpts, R as PrepareDeployOpts, S as PrepareUpgradeBatchOptions, T as PrepareUpgradeFromVerifiableBuildOpts, U as PrepareUpgradeOpts, V as PreparedDeploy, W as PreparedDeployBatch, X as PreparedDeployData, Y as PreparedUpgrade, Z as PreparedUpgradeBatch, _ as PreparedUpgradeData, $ as ProductID, a0 as ProductSubscriptionResponse, a1 as Release, a2 as SendTransactionOptions, a3 as SequentialDeployResult, a4 as SubscribeResponse, a5 as SubscriptionLineItem, a6 as SubscriptionOpts, a7 as SubscriptionStatus, a8 as SuspendOptions, a9 as UndelegateOptions, aa as UpgradeAppOptions, ab as UpgradeAppOpts, ac as calculateAppID, ad as deployApp, ae as estimateTransactionGas, af as executeDeployBatch, ag as executeDeployBatched, ah as executeDeploySequential, ai as executeUpgradeBatch, aj as formatETH, ak as getActiveAppCount, al as getAllAppsByDeveloper, am as getAppsByBillingAccount, an as getAppsByCreator, ao as getAppsByDeveloper, ap as getBillingType, aq as getMaxActiveAppsPerUser, ar as isDelegated, as as logVisibility, at as noopLogger, au as prepareDeployBatch, av as prepareUpgradeBatch, aw as sendAndWaitForTransaction, ax as supportsEIP5792, ay as supportsEIP7702, az as suspend, aA as undelegate, aB as upgradeApp } from './index-BoCE0hIh.cjs';
|
|
3
|
+
import { C as ComputeApiConfig, S as SessionInfo, a as SessionError, b as SiweMessageParams } from './helpers-Qq5W-qNn.cjs';
|
|
4
|
+
export { A as AppInfo, c as AppInfoResponse, d as AppMetrics, e as AppProfileInfo, B as BillingApiClient, f as BillingApiClientOptions, g as BillingApiConfig, h as BillingLoginRequest, i as BillingLoginResult, j as BillingSessionError, k as BillingSessionInfo, l as CreateAppParams, E as EstimateBatchGasOptions, m as ExecuteBatchOptions, n as Execution, G as GeneratedKey, L as LogVisibility, o as LoginRequest, p as LoginResult, q as LogsParams, r as SiweMessageResult, U as UserApiClient, s as UserApiClientOptions, t as addHexPrefix, u as assertValidImageReference, v as assertValidPrivateKey, w as checkERC7702Delegation, x as createSiweMessage, y as estimateBatchGas, z as executeBatch, D as extractAppNameFromImage, F as generateNewPrivateKey, H as generateNonce, I as getAvailableEnvironments, J as getBillingApiSession, K as getBillingEnvironmentConfig, M as getBuildType, N as getChainFromID, O as getComputeApiSession, P as getEnvironmentConfig, Q as isBillingSessionValid, R as isEnvironmentAvailable, T as isMainnet, V as isSessionValid, W as isSiweMessageExpired, X as isSiweMessageNotYetValid, Y as isSubscriptionActive, Z as loginToBillingApi, _ as loginToBothApis, $ as loginToComputeApi, a0 as logoutFromBillingApi, a1 as logoutFromBothApis, a2 as logoutFromComputeApi, a3 as parseSiweMessage, a4 as sanitizeString, a5 as sanitizeURL, a6 as sanitizeXURL, a7 as stripHexPrefix, a8 as validateAppID, a9 as validateAppName, aa as validateCreateAppParams, ab as validateDescription, ac as validateImageReference, ad as validateInstanceTypeSKU, ae as validateLogVisibility, af as validateLogsParams, ag as validatePrivateKeyFormat, ah as validateURL, ai as validateXURL } from './helpers-Qq5W-qNn.cjs';
|
|
5
5
|
import { WalletClient, Address, Hex } from 'viem';
|
|
6
6
|
import { Buffer as Buffer$1 } from 'buffer';
|
|
7
7
|
|
package/dist/browser.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { A as AppId } from './index-
|
|
2
|
-
export { a as AlreadyActiveResponse, b as AppConfig, c as AppProfile, d as AppProfileResponse, e as AppRecord, B as BatchedDeployResult, f as BillingEnvironmentConfig, C as CalculateAppIDOptions, g as CancelResponse, h as CancelSuccessResponse, i as ChainID, j as CheckoutCreatedResponse, k as CreateSubscriptionOptions, l as CreateSubscriptionResponse, D as DeployAppOptions,
|
|
3
|
-
import { C as ComputeApiConfig, S as SessionInfo, a as SessionError, b as SiweMessageParams } from './helpers-
|
|
4
|
-
export { A as AppInfo, c as AppInfoResponse, d as AppMetrics, e as AppProfileInfo, B as BillingApiClient, f as BillingApiClientOptions, g as BillingApiConfig, h as BillingLoginRequest, i as BillingLoginResult, j as BillingSessionError, k as BillingSessionInfo, l as CreateAppParams, E as EstimateBatchGasOptions, m as ExecuteBatchOptions, n as Execution, G as GeneratedKey, L as LogVisibility, o as LoginRequest, p as LoginResult, q as LogsParams, r as SiweMessageResult, U as UserApiClient, s as UserApiClientOptions, t as addHexPrefix, u as assertValidImageReference, v as assertValidPrivateKey, w as checkERC7702Delegation, x as createSiweMessage, y as estimateBatchGas, z as executeBatch, D as extractAppNameFromImage, F as generateNewPrivateKey, H as generateNonce, I as getAvailableEnvironments, J as getBillingApiSession, K as getBillingEnvironmentConfig, M as getBuildType, N as getChainFromID, O as getComputeApiSession, P as getEnvironmentConfig, Q as isBillingSessionValid, R as isEnvironmentAvailable, T as isMainnet, V as isSessionValid, W as isSiweMessageExpired, X as isSiweMessageNotYetValid, Y as isSubscriptionActive, Z as loginToBillingApi, _ as loginToBothApis, $ as loginToComputeApi, a0 as logoutFromBillingApi, a1 as logoutFromBothApis, a2 as logoutFromComputeApi, a3 as parseSiweMessage, a4 as sanitizeString, a5 as sanitizeURL, a6 as sanitizeXURL, a7 as stripHexPrefix, a8 as validateAppID, a9 as validateAppName, aa as validateCreateAppParams, ab as validateDescription, ac as validateImageReference, ad as validateInstanceTypeSKU, ae as validateLogVisibility, af as validateLogsParams, ag as validatePrivateKeyFormat, ah as validateURL, ai as validateXURL } from './helpers-
|
|
1
|
+
import { A as AppId } from './index-BoCE0hIh.js';
|
|
2
|
+
export { a as AlreadyActiveResponse, b as AppConfig, c as AppProfile, d as AppProfileResponse, e as AppRecord, B as BatchedDeployResult, f as BillingEnvironmentConfig, C as CalculateAppIDOptions, g as CancelResponse, h as CancelSuccessResponse, i as ChainID, j as CheckoutCreatedResponse, k as CreateSubscriptionOptions, l as CreateSubscriptionResponse, m as CreditPurchaseResponse, D as DeployAppOptions, n as DeployAppOpts, o as DeployOptions, p as DeployProgressCallback, q as DeployResult, r as DeployStep, s as DockerImageConfig, E as EnvironmentConfig, t as EstimateGasOptions, u as ExecuteDeployBatchedOptions, v as ExecuteDeployResult, w as ExecuteDeploySequentialOptions, x as ExecuteUpgradeResult, G as GasEstimate, y as GasOpts, z as GetSubscriptionOptions, I as ImageDigestResult, F as IsDelegatedOptions, L as LifecycleOpts, H as Logger, N as NoActiveSubscriptionResponse, P as ParsedEnvironment, J as PaymentIssueResponse, K as PaymentMethod, M as PaymentMethodsResponse, O as PrepareDeployBatchOptions, Q as PrepareDeployFromVerifiableBuildOpts, R as PrepareDeployOpts, S as PrepareUpgradeBatchOptions, T as PrepareUpgradeFromVerifiableBuildOpts, U as PrepareUpgradeOpts, V as PreparedDeploy, W as PreparedDeployBatch, X as PreparedDeployData, Y as PreparedUpgrade, Z as PreparedUpgradeBatch, _ as PreparedUpgradeData, $ as ProductID, a0 as ProductSubscriptionResponse, a1 as Release, a2 as SendTransactionOptions, a3 as SequentialDeployResult, a4 as SubscribeResponse, a5 as SubscriptionLineItem, a6 as SubscriptionOpts, a7 as SubscriptionStatus, a8 as SuspendOptions, a9 as UndelegateOptions, aa as UpgradeAppOptions, ab as UpgradeAppOpts, ac as calculateAppID, ad as deployApp, ae as estimateTransactionGas, af as executeDeployBatch, ag as executeDeployBatched, ah as executeDeploySequential, ai as executeUpgradeBatch, aj as formatETH, ak as getActiveAppCount, al as getAllAppsByDeveloper, am as getAppsByBillingAccount, an as getAppsByCreator, ao as getAppsByDeveloper, ap as getBillingType, aq as getMaxActiveAppsPerUser, ar as isDelegated, as as logVisibility, at as noopLogger, au as prepareDeployBatch, av as prepareUpgradeBatch, aw as sendAndWaitForTransaction, ax as supportsEIP5792, ay as supportsEIP7702, az as suspend, aA as undelegate, aB as upgradeApp } from './index-BoCE0hIh.js';
|
|
3
|
+
import { C as ComputeApiConfig, S as SessionInfo, a as SessionError, b as SiweMessageParams } from './helpers-F7CeDSVX.js';
|
|
4
|
+
export { A as AppInfo, c as AppInfoResponse, d as AppMetrics, e as AppProfileInfo, B as BillingApiClient, f as BillingApiClientOptions, g as BillingApiConfig, h as BillingLoginRequest, i as BillingLoginResult, j as BillingSessionError, k as BillingSessionInfo, l as CreateAppParams, E as EstimateBatchGasOptions, m as ExecuteBatchOptions, n as Execution, G as GeneratedKey, L as LogVisibility, o as LoginRequest, p as LoginResult, q as LogsParams, r as SiweMessageResult, U as UserApiClient, s as UserApiClientOptions, t as addHexPrefix, u as assertValidImageReference, v as assertValidPrivateKey, w as checkERC7702Delegation, x as createSiweMessage, y as estimateBatchGas, z as executeBatch, D as extractAppNameFromImage, F as generateNewPrivateKey, H as generateNonce, I as getAvailableEnvironments, J as getBillingApiSession, K as getBillingEnvironmentConfig, M as getBuildType, N as getChainFromID, O as getComputeApiSession, P as getEnvironmentConfig, Q as isBillingSessionValid, R as isEnvironmentAvailable, T as isMainnet, V as isSessionValid, W as isSiweMessageExpired, X as isSiweMessageNotYetValid, Y as isSubscriptionActive, Z as loginToBillingApi, _ as loginToBothApis, $ as loginToComputeApi, a0 as logoutFromBillingApi, a1 as logoutFromBothApis, a2 as logoutFromComputeApi, a3 as parseSiweMessage, a4 as sanitizeString, a5 as sanitizeURL, a6 as sanitizeXURL, a7 as stripHexPrefix, a8 as validateAppID, a9 as validateAppName, aa as validateCreateAppParams, ab as validateDescription, ac as validateImageReference, ad as validateInstanceTypeSKU, ae as validateLogVisibility, af as validateLogsParams, ag as validatePrivateKeyFormat, ah as validateURL, ai as validateXURL } from './helpers-F7CeDSVX.js';
|
|
5
5
|
import { WalletClient, Address, Hex } from 'viem';
|
|
6
6
|
import { Buffer as Buffer$1 } from 'buffer';
|
|
7
7
|
|
package/dist/browser.js
CHANGED
|
@@ -189,7 +189,9 @@ var ENVIRONMENTS = {
|
|
|
189
189
|
kmsServerURL: "http://10.128.0.57:8080",
|
|
190
190
|
userApiServerURL: "https://userapi-compute-sepolia-dev.eigencloud.xyz",
|
|
191
191
|
defaultRPCURL: "https://ethereum-sepolia-rpc.publicnode.com",
|
|
192
|
-
usdcCreditsAddress: "0xbdA3897c3A428763B59015C64AB766c288C97376"
|
|
192
|
+
usdcCreditsAddress: "0xbdA3897c3A428763B59015C64AB766c288C97376",
|
|
193
|
+
baseUsdcCreditsAddress: "0x7673a47463F80c6a3553Db9E54c8cDcd5313d0ac",
|
|
194
|
+
baseRPCURL: "https://base-sepolia-rpc.publicnode.com"
|
|
193
195
|
},
|
|
194
196
|
sepolia: {
|
|
195
197
|
name: "sepolia",
|
|
@@ -201,7 +203,9 @@ var ENVIRONMENTS = {
|
|
|
201
203
|
userApiServerURL: "https://userapi-compute-sepolia-prod.eigencloud.xyz",
|
|
202
204
|
defaultRPCURL: "https://ethereum-sepolia-rpc.publicnode.com",
|
|
203
205
|
billingRPCURL: "https://ethereum-rpc.publicnode.com",
|
|
204
|
-
usdcCreditsAddress: "0xed9c88640ca9149Bd9f7ee6620074af10F2E145d"
|
|
206
|
+
usdcCreditsAddress: "0xed9c88640ca9149Bd9f7ee6620074af10F2E145d",
|
|
207
|
+
baseUsdcCreditsAddress: "0x7673a47463F80c6a3553Db9E54c8cDcd5313d0ac",
|
|
208
|
+
baseRPCURL: "https://base-sepolia-rpc.publicnode.com"
|
|
205
209
|
},
|
|
206
210
|
"mainnet-alpha": {
|
|
207
211
|
name: "mainnet-alpha",
|
|
@@ -246,7 +250,13 @@ function getEnvironmentConfig(environment, chainID) {
|
|
|
246
250
|
return {
|
|
247
251
|
...env,
|
|
248
252
|
chainID: BigInt(resolvedChainID),
|
|
249
|
-
...apiUrlOverride ? { userApiServerURL: apiUrlOverride } : {}
|
|
253
|
+
...apiUrlOverride ? { userApiServerURL: apiUrlOverride } : {},
|
|
254
|
+
...process.env.ECLOUD_USER_API_URL && {
|
|
255
|
+
userApiServerURL: process.env.ECLOUD_USER_API_URL
|
|
256
|
+
},
|
|
257
|
+
...process.env.ECLOUD_RPC_URL && {
|
|
258
|
+
defaultRPCURL: process.env.ECLOUD_RPC_URL
|
|
259
|
+
}
|
|
250
260
|
};
|
|
251
261
|
}
|
|
252
262
|
function getBillingEnvironmentConfig(build) {
|
|
@@ -258,7 +268,12 @@ function getBillingEnvironmentConfig(build) {
|
|
|
258
268
|
if (apiUrlOverride) {
|
|
259
269
|
return { billingApiServerURL: apiUrlOverride };
|
|
260
270
|
}
|
|
261
|
-
return
|
|
271
|
+
return {
|
|
272
|
+
...config,
|
|
273
|
+
...process.env.ECLOUD_BILLING_API_URL && {
|
|
274
|
+
billingApiServerURL: process.env.ECLOUD_BILLING_API_URL
|
|
275
|
+
}
|
|
276
|
+
};
|
|
262
277
|
}
|
|
263
278
|
function getBuildType() {
|
|
264
279
|
const buildTimeType = true ? "dev"?.toLowerCase() : void 0;
|
|
@@ -292,8 +307,8 @@ import { sepolia as sepolia2 } from "viem/chains";
|
|
|
292
307
|
import { privateKeyToAccount } from "viem/accounts";
|
|
293
308
|
|
|
294
309
|
// src/client/common/constants.ts
|
|
295
|
-
import { sepolia, mainnet } from "viem/chains";
|
|
296
|
-
var SUPPORTED_CHAINS = [mainnet, sepolia];
|
|
310
|
+
import { sepolia, mainnet, baseSepolia } from "viem/chains";
|
|
311
|
+
var SUPPORTED_CHAINS = [mainnet, sepolia, baseSepolia];
|
|
297
312
|
|
|
298
313
|
// src/client/common/utils/helpers.ts
|
|
299
314
|
function getChainFromID(chainID, fallback2 = sepolia2) {
|
|
@@ -618,7 +633,7 @@ var CanViewAppLogsPermission = "0x2fd3f2fe";
|
|
|
618
633
|
var CanViewSensitiveAppInfoPermission = "0x0e67b22f";
|
|
619
634
|
var CanUpdateAppProfilePermission = "0x036fef61";
|
|
620
635
|
function getDefaultClientId() {
|
|
621
|
-
const version = true ? "1.0.0-dev.
|
|
636
|
+
const version = true ? "1.0.0-dev.4" : "0.0.0";
|
|
622
637
|
return `ecloud-sdk/v${version}`;
|
|
623
638
|
}
|
|
624
639
|
var UserApiClient = class {
|
|
@@ -1206,6 +1221,20 @@ var BillingApiClient = class {
|
|
|
1206
1221
|
const endpoint = `${this.config.billingApiServerURL}/products/${productId}/subscription`;
|
|
1207
1222
|
await this.makeAuthenticatedRequest(endpoint, "DELETE", productId);
|
|
1208
1223
|
}
|
|
1224
|
+
async getPaymentMethods() {
|
|
1225
|
+
const endpoint = `${this.config.billingApiServerURL}/v1/payment-methods`;
|
|
1226
|
+
const resp = await this.makeAuthenticatedRequest(endpoint, "GET", "compute");
|
|
1227
|
+
return resp.json();
|
|
1228
|
+
}
|
|
1229
|
+
async purchaseCredits(amountCents, paymentMethodId) {
|
|
1230
|
+
const endpoint = `${this.config.billingApiServerURL}/v1/credits/purchase`;
|
|
1231
|
+
const body = { amountCents };
|
|
1232
|
+
if (paymentMethodId) {
|
|
1233
|
+
body.paymentMethodId = paymentMethodId;
|
|
1234
|
+
}
|
|
1235
|
+
const resp = await this.makeAuthenticatedRequest(endpoint, "POST", "compute", body);
|
|
1236
|
+
return resp.json();
|
|
1237
|
+
}
|
|
1209
1238
|
// ==========================================================================
|
|
1210
1239
|
// Internal Methods
|
|
1211
1240
|
// ==========================================================================
|
|
@@ -1215,10 +1244,22 @@ var BillingApiClient = class {
|
|
|
1215
1244
|
* Uses session auth if useSession is true, otherwise uses EIP-712 signature auth.
|
|
1216
1245
|
*/
|
|
1217
1246
|
async makeAuthenticatedRequest(url, method, productId, body) {
|
|
1218
|
-
if (this.
|
|
1219
|
-
|
|
1247
|
+
if (this.options.verbose) {
|
|
1248
|
+
console.debug(`[BillingAPI] ${method} ${url}`);
|
|
1249
|
+
if (body) {
|
|
1250
|
+
console.debug(`[BillingAPI] Payload:`, JSON.stringify(body, null, 2));
|
|
1251
|
+
}
|
|
1252
|
+
}
|
|
1253
|
+
const resp = this.useSession ? await this.makeSessionAuthenticatedRequest(url, method, body) : await this.makeSignatureAuthenticatedRequest(url, method, productId, body);
|
|
1254
|
+
if (this.options.verbose) {
|
|
1255
|
+
const data = await resp.json();
|
|
1256
|
+
console.debug(`[BillingAPI] Response:`, JSON.stringify(data, null, 2));
|
|
1257
|
+
return {
|
|
1258
|
+
json: async () => data,
|
|
1259
|
+
text: async () => JSON.stringify(data)
|
|
1260
|
+
};
|
|
1220
1261
|
}
|
|
1221
|
-
return
|
|
1262
|
+
return resp;
|
|
1222
1263
|
}
|
|
1223
1264
|
/**
|
|
1224
1265
|
* Make a request using session-based authentication (cookies)
|