@layr-labs/ecloud-sdk 1.0.0-dev.1 → 1.0.0-dev.2
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 +17 -45
- package/dist/billing.cjs.map +1 -1
- package/dist/billing.d.cts +1 -3
- package/dist/billing.d.ts +1 -3
- package/dist/billing.js +17 -45
- package/dist/billing.js.map +1 -1
- package/dist/browser.cjs +17 -39
- 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 +17 -39
- package/dist/browser.js.map +1 -1
- package/dist/{compute-Bn6KcW3x.d.cts → compute-Ckyn8ils.d.cts} +1 -1
- package/dist/{compute-Do2t0Fo8.d.ts → compute-Cnw6rwSB.d.ts} +1 -1
- package/dist/compute.cjs +9 -7
- 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 +9 -7
- package/dist/compute.js.map +1 -1
- package/dist/{helpers-BRamdfGn.d.ts → helpers-DZL2bg9p.d.cts} +1 -5
- package/dist/{helpers-CfsfcGJO.d.cts → helpers-Dj2ME5rp.d.ts} +1 -5
- package/dist/{index-BbH7ZCIu.d.cts → index-U2vKBrry.d.cts} +1 -15
- package/dist/{index-BbH7ZCIu.d.ts → index-U2vKBrry.d.ts} +1 -15
- package/dist/index.cjs +18 -46
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -6
- package/dist/index.d.ts +6 -6
- package/dist/index.js +18 -46
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
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,
|
|
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-U2vKBrry.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, D as DeployAppOptions, m as DeployAppOpts, n as DeployOptions, o as DeployProgressCallback, p as DeployResult, q as DeployStep, r as DockerImageConfig, E as EnvironmentConfig, s as EstimateGasOptions, t as ExecuteDeployBatchedOptions, u as ExecuteDeployResult, v as ExecuteDeploySequentialOptions, w as ExecuteUpgradeResult, G as GasEstimate, x as GasOpts, y as GetSubscriptionOptions, I as ImageDigestResult, z as IsDelegatedOptions, L as LifecycleOpts, F as Logger, N as NoActiveSubscriptionResponse, P as ParsedEnvironment, H as PaymentIssueResponse, J as PrepareDeployBatchOptions, K as PrepareDeployFromVerifiableBuildOpts, M as PrepareDeployOpts, O as PrepareUpgradeBatchOptions, Q as PrepareUpgradeFromVerifiableBuildOpts, R as PrepareUpgradeOpts, S as PreparedDeploy, T as PreparedDeployBatch, U as PreparedDeployData, V as PreparedUpgrade, W as PreparedUpgradeBatch, X as PreparedUpgradeData, Y as ProductID, Z as ProductSubscriptionResponse, _ as Release, $ as SendTransactionOptions, a0 as SequentialDeployResult, a1 as SubscribeResponse, a2 as SubscriptionLineItem, a3 as SubscriptionOpts, a4 as SubscriptionStatus, a5 as SuspendOptions, a6 as UndelegateOptions, a7 as UpgradeAppOptions, a8 as UpgradeAppOpts, a9 as calculateAppID, aa as deployApp, ab as estimateTransactionGas, ac as executeDeployBatch, ad as executeDeployBatched, ae as executeDeploySequential, af as executeUpgradeBatch, ag as formatETH, ah as getActiveAppCount, ai as getAllAppsByDeveloper, aj as getAppsByBillingAccount, ak as getAppsByCreator, al as getAppsByDeveloper, am as getBillingType, an as getMaxActiveAppsPerUser, ao as isDelegated, ap as logVisibility, aq as noopLogger, ar as prepareDeployBatch, as as prepareUpgradeBatch, at as sendAndWaitForTransaction, au as supportsEIP5792, av as supportsEIP7702, aw as suspend, ax as undelegate, ay as upgradeApp } from './index-U2vKBrry.cjs';
|
|
3
|
+
import { C as ComputeApiConfig, S as SessionInfo, a as SessionError, b as SiweMessageParams } from './helpers-DZL2bg9p.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-DZL2bg9p.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,
|
|
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-U2vKBrry.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, D as DeployAppOptions, m as DeployAppOpts, n as DeployOptions, o as DeployProgressCallback, p as DeployResult, q as DeployStep, r as DockerImageConfig, E as EnvironmentConfig, s as EstimateGasOptions, t as ExecuteDeployBatchedOptions, u as ExecuteDeployResult, v as ExecuteDeploySequentialOptions, w as ExecuteUpgradeResult, G as GasEstimate, x as GasOpts, y as GetSubscriptionOptions, I as ImageDigestResult, z as IsDelegatedOptions, L as LifecycleOpts, F as Logger, N as NoActiveSubscriptionResponse, P as ParsedEnvironment, H as PaymentIssueResponse, J as PrepareDeployBatchOptions, K as PrepareDeployFromVerifiableBuildOpts, M as PrepareDeployOpts, O as PrepareUpgradeBatchOptions, Q as PrepareUpgradeFromVerifiableBuildOpts, R as PrepareUpgradeOpts, S as PreparedDeploy, T as PreparedDeployBatch, U as PreparedDeployData, V as PreparedUpgrade, W as PreparedUpgradeBatch, X as PreparedUpgradeData, Y as ProductID, Z as ProductSubscriptionResponse, _ as Release, $ as SendTransactionOptions, a0 as SequentialDeployResult, a1 as SubscribeResponse, a2 as SubscriptionLineItem, a3 as SubscriptionOpts, a4 as SubscriptionStatus, a5 as SuspendOptions, a6 as UndelegateOptions, a7 as UpgradeAppOptions, a8 as UpgradeAppOpts, a9 as calculateAppID, aa as deployApp, ab as estimateTransactionGas, ac as executeDeployBatch, ad as executeDeployBatched, ae as executeDeploySequential, af as executeUpgradeBatch, ag as formatETH, ah as getActiveAppCount, ai as getAllAppsByDeveloper, aj as getAppsByBillingAccount, ak as getAppsByCreator, al as getAppsByDeveloper, am as getBillingType, an as getMaxActiveAppsPerUser, ao as isDelegated, ap as logVisibility, aq as noopLogger, ar as prepareDeployBatch, as as prepareUpgradeBatch, at as sendAndWaitForTransaction, au as supportsEIP5792, av as supportsEIP7702, aw as suspend, ax as undelegate, ay as upgradeApp } from './index-U2vKBrry.js';
|
|
3
|
+
import { C as ComputeApiConfig, S as SessionInfo, a as SessionError, b as SiweMessageParams } from './helpers-Dj2ME5rp.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-Dj2ME5rp.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
|
@@ -219,6 +219,12 @@ var CHAIN_ID_TO_ENVIRONMENT = {
|
|
|
219
219
|
[SEPOLIA_CHAIN_ID.toString()]: "sepolia",
|
|
220
220
|
[MAINNET_CHAIN_ID.toString()]: "mainnet-alpha"
|
|
221
221
|
};
|
|
222
|
+
function getApiUrlOverride() {
|
|
223
|
+
const raw = process.env.ECLOUD_API_URL;
|
|
224
|
+
if (!raw) return void 0;
|
|
225
|
+
const trimmed = raw.trim().replace(/\/+$/, "");
|
|
226
|
+
return trimmed.length > 0 ? trimmed : void 0;
|
|
227
|
+
}
|
|
222
228
|
function getEnvironmentConfig(environment, chainID) {
|
|
223
229
|
const env = ENVIRONMENTS[environment];
|
|
224
230
|
if (!env) {
|
|
@@ -236,15 +242,11 @@ function getEnvironmentConfig(environment, chainID) {
|
|
|
236
242
|
}
|
|
237
243
|
}
|
|
238
244
|
const resolvedChainID = chainID || (environment === "sepolia" || environment === "sepolia-dev" ? SEPOLIA_CHAIN_ID : MAINNET_CHAIN_ID);
|
|
245
|
+
const apiUrlOverride = getApiUrlOverride();
|
|
239
246
|
return {
|
|
240
247
|
...env,
|
|
241
248
|
chainID: BigInt(resolvedChainID),
|
|
242
|
-
...
|
|
243
|
-
userApiServerURL: process.env.ECLOUD_USER_API_URL
|
|
244
|
-
},
|
|
245
|
-
...process.env.ECLOUD_RPC_URL && {
|
|
246
|
-
defaultRPCURL: process.env.ECLOUD_RPC_URL
|
|
247
|
-
}
|
|
249
|
+
...apiUrlOverride ? { userApiServerURL: apiUrlOverride } : {}
|
|
248
250
|
};
|
|
249
251
|
}
|
|
250
252
|
function getBillingEnvironmentConfig(build) {
|
|
@@ -252,12 +254,11 @@ function getBillingEnvironmentConfig(build) {
|
|
|
252
254
|
if (!config) {
|
|
253
255
|
throw new Error(`Unknown billing environment: ${build}`);
|
|
254
256
|
}
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
};
|
|
257
|
+
const apiUrlOverride = getApiUrlOverride();
|
|
258
|
+
if (apiUrlOverride) {
|
|
259
|
+
return { billingApiServerURL: apiUrlOverride };
|
|
260
|
+
}
|
|
261
|
+
return config;
|
|
261
262
|
}
|
|
262
263
|
function getBuildType() {
|
|
263
264
|
const buildTimeType = true ? "dev"?.toLowerCase() : void 0;
|
|
@@ -617,7 +618,7 @@ var CanViewAppLogsPermission = "0x2fd3f2fe";
|
|
|
617
618
|
var CanViewSensitiveAppInfoPermission = "0x0e67b22f";
|
|
618
619
|
var CanUpdateAppProfilePermission = "0x036fef61";
|
|
619
620
|
function getDefaultClientId() {
|
|
620
|
-
const version = true ? "1.0.0-dev.
|
|
621
|
+
const version = true ? "1.0.0-dev.2" : "0.0.0";
|
|
621
622
|
return `ecloud-sdk/v${version}`;
|
|
622
623
|
}
|
|
623
624
|
var UserApiClient = class {
|
|
@@ -1205,20 +1206,6 @@ var BillingApiClient = class {
|
|
|
1205
1206
|
const endpoint = `${this.config.billingApiServerURL}/products/${productId}/subscription`;
|
|
1206
1207
|
await this.makeAuthenticatedRequest(endpoint, "DELETE", productId);
|
|
1207
1208
|
}
|
|
1208
|
-
async getPaymentMethods() {
|
|
1209
|
-
const endpoint = `${this.config.billingApiServerURL}/v1/payment-methods`;
|
|
1210
|
-
const resp = await this.makeAuthenticatedRequest(endpoint, "GET", "compute");
|
|
1211
|
-
return resp.json();
|
|
1212
|
-
}
|
|
1213
|
-
async purchaseCredits(amountCents, paymentMethodId) {
|
|
1214
|
-
const endpoint = `${this.config.billingApiServerURL}/v1/credits/purchase`;
|
|
1215
|
-
const body = { amountCents };
|
|
1216
|
-
if (paymentMethodId) {
|
|
1217
|
-
body.paymentMethodId = paymentMethodId;
|
|
1218
|
-
}
|
|
1219
|
-
const resp = await this.makeAuthenticatedRequest(endpoint, "POST", "compute", body);
|
|
1220
|
-
return resp.json();
|
|
1221
|
-
}
|
|
1222
1209
|
// ==========================================================================
|
|
1223
1210
|
// Internal Methods
|
|
1224
1211
|
// ==========================================================================
|
|
@@ -1228,19 +1215,10 @@ var BillingApiClient = class {
|
|
|
1228
1215
|
* Uses session auth if useSession is true, otherwise uses EIP-712 signature auth.
|
|
1229
1216
|
*/
|
|
1230
1217
|
async makeAuthenticatedRequest(url, method, productId, body) {
|
|
1231
|
-
if (this.
|
|
1232
|
-
|
|
1233
|
-
}
|
|
1234
|
-
const resp = this.useSession ? await this.makeSessionAuthenticatedRequest(url, method, body) : await this.makeSignatureAuthenticatedRequest(url, method, productId, body);
|
|
1235
|
-
if (this.options.verbose) {
|
|
1236
|
-
const data = await resp.json();
|
|
1237
|
-
console.debug(`[BillingAPI] Response:`, JSON.stringify(data, null, 2));
|
|
1238
|
-
return {
|
|
1239
|
-
json: async () => data,
|
|
1240
|
-
text: async () => JSON.stringify(data)
|
|
1241
|
-
};
|
|
1218
|
+
if (this.useSession) {
|
|
1219
|
+
return this.makeSessionAuthenticatedRequest(url, method, body);
|
|
1242
1220
|
}
|
|
1243
|
-
return
|
|
1221
|
+
return this.makeSignatureAuthenticatedRequest(url, method, productId, body);
|
|
1244
1222
|
}
|
|
1245
1223
|
/**
|
|
1246
1224
|
* Make a request using session-based authentication (cookies)
|