@layr-labs/ecloud-sdk 0.1.0-rc.1 → 0.1.0-rc.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/README.md +2 -0
- package/VERSION +2 -2
- package/dist/index.cjs +39 -15
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.js +38 -15
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -358,6 +358,7 @@ interface AppModule {
|
|
|
358
358
|
terminate: (appId: AppId, opts?: LifecycleOpts) => Promise<{
|
|
359
359
|
tx: `0x${string}` | false;
|
|
360
360
|
}>;
|
|
361
|
+
isDelegated: () => Promise<boolean>;
|
|
361
362
|
undelegate: () => Promise<{
|
|
362
363
|
tx: `0x${string}` | false;
|
|
363
364
|
}>;
|
|
@@ -1064,6 +1065,10 @@ interface EstimateBatchGasOptions {
|
|
|
1064
1065
|
* through EIP-7702 can have variable costs.
|
|
1065
1066
|
*/
|
|
1066
1067
|
declare function estimateBatchGas(options: EstimateBatchGasOptions): Promise<GasEstimate>;
|
|
1068
|
+
/**
|
|
1069
|
+
* Check if account is delegated to ERC-7702 delegator
|
|
1070
|
+
*/
|
|
1071
|
+
declare function checkERC7702Delegation(publicClient: PublicClient, account: Address, delegatorAddress: Address): Promise<boolean>;
|
|
1067
1072
|
|
|
1068
1073
|
/**
|
|
1069
1074
|
* Preflight checks
|
|
@@ -1180,4 +1185,4 @@ interface ECloudClient {
|
|
|
1180
1185
|
}
|
|
1181
1186
|
declare function createECloudClient(cfg: ClientConfig): ECloudClient;
|
|
1182
1187
|
|
|
1183
|
-
export { type AlreadyActiveResponse, type AppId, type AppInfo, type AppMetrics, type AppModuleConfig, type AppProfile, type AppProfileInfo, type AppProfileResponse, type AppRecord, type BillingEnvironmentConfig, type BillingModuleConfig, type CancelResponse, type CancelSuccessResponse, type ChainID, type CheckoutCreatedResponse, type ClientConfig, type CreateAppOpts, type CreateAppParams, type CreateSubscriptionResponse, type DeployAppOpts, type DeployOptions, type DeployParams, type DeployResult, type DockerImageConfig, type ECloudClient, type Environment, type EnvironmentConfig, type EstimateBatchGasOptions, type EstimateGasOptions, type GasEstimate, type GeneratedKey, type ImageDigestResult, type LegacyKey, type LifecycleOpts, type LogVisibility, type Logger, type LogsOptions, type LogsParams, type NoActiveSubscriptionResponse, PRIMARY_LANGUAGES, type ParsedEnvironment, type PaymentIssueResponse, type PrepareDeployResult, type PrepareUpgradeResult, type PreparedDeploy, type PreparedUpgrade, type PrivateKeySource, type ProductID, type ProductSubscriptionResponse, type Release, type ResourceUsageMonitoring, type SDKCreateAppOpts, type SDKDeployOptions, type SDKLogsOptions, type SDKUpgradeOptions, type StoredKey, type SubscribeResponse, type SubscriptionLineItem, type SubscriptionOpts, type SubscriptionStatus, type UpgradeAppOpts, type UpgradeParams, UserApiClient, assertValidFilePath, assertValidImageReference, assertValidPrivateKey, createApp, createAppModule, createBillingModule, createECloudClient, deleteLegacyPrivateKey, deletePrivateKey, encodeStartAppData, encodeStopAppData, encodeTerminateAppData, estimateBatchGas, estimateTransactionGas, executeDeploy, executeUpgrade, extractAppNameFromImage, fetchTemplateCatalog, formatETH, generateNewPrivateKey, getAddressFromPrivateKey, getAllAppsByDeveloper, getAppLatestReleaseBlockNumbers, getAvailableEnvironments, getAvailableTemplates, getBlockTimestamps, getBuildType, getCategoryDescriptions, getCurrentInstanceType, getEnvironmentConfig, getLegacyKeys, getLegacyPrivateKey, getPrivateKey, getPrivateKeyWithSource, getTemplate, isEnvironmentAvailable, isMainnet, isSubscriptionActive, keyExists, listStoredKeys, type logVisibility, logs, prepareDeploy, prepareUpgrade, requirePrivateKey, sanitizeString, sanitizeURL, sanitizeXURL, storePrivateKey, validateAppID, validateAppName, validateCreateAppParams, validateDeployParams, validateDescription, validateFilePath, validateImagePath, validateImageReference, validateInstanceTypeSKU, validateLogVisibility, validateLogsParams, validatePrivateKey, validatePrivateKeyFormat, validateResourceUsageMonitoring, validateURL, validateUpgradeParams, validateXURL, watchDeployment, watchUpgrade };
|
|
1188
|
+
export { type AlreadyActiveResponse, type AppId, type AppInfo, type AppMetrics, type AppModuleConfig, type AppProfile, type AppProfileInfo, type AppProfileResponse, type AppRecord, type BillingEnvironmentConfig, type BillingModuleConfig, type CancelResponse, type CancelSuccessResponse, type ChainID, type CheckoutCreatedResponse, type ClientConfig, type CreateAppOpts, type CreateAppParams, type CreateSubscriptionResponse, type DeployAppOpts, type DeployOptions, type DeployParams, type DeployResult, type DockerImageConfig, type ECloudClient, type Environment, type EnvironmentConfig, type EstimateBatchGasOptions, type EstimateGasOptions, type GasEstimate, type GeneratedKey, type ImageDigestResult, type LegacyKey, type LifecycleOpts, type LogVisibility, type Logger, type LogsOptions, type LogsParams, type NoActiveSubscriptionResponse, PRIMARY_LANGUAGES, type ParsedEnvironment, type PaymentIssueResponse, type PrepareDeployResult, type PrepareUpgradeResult, type PreparedDeploy, type PreparedUpgrade, type PrivateKeySource, type ProductID, type ProductSubscriptionResponse, type Release, type ResourceUsageMonitoring, type SDKCreateAppOpts, type SDKDeployOptions, type SDKLogsOptions, type SDKUpgradeOptions, type StoredKey, type SubscribeResponse, type SubscriptionLineItem, type SubscriptionOpts, type SubscriptionStatus, type UpgradeAppOpts, type UpgradeParams, UserApiClient, assertValidFilePath, assertValidImageReference, assertValidPrivateKey, checkERC7702Delegation, createApp, createAppModule, createBillingModule, createECloudClient, deleteLegacyPrivateKey, deletePrivateKey, encodeStartAppData, encodeStopAppData, encodeTerminateAppData, estimateBatchGas, estimateTransactionGas, executeDeploy, executeUpgrade, extractAppNameFromImage, fetchTemplateCatalog, formatETH, generateNewPrivateKey, getAddressFromPrivateKey, getAllAppsByDeveloper, getAppLatestReleaseBlockNumbers, getAvailableEnvironments, getAvailableTemplates, getBlockTimestamps, getBuildType, getCategoryDescriptions, getCurrentInstanceType, getEnvironmentConfig, getLegacyKeys, getLegacyPrivateKey, getPrivateKey, getPrivateKeyWithSource, getTemplate, isEnvironmentAvailable, isMainnet, isSubscriptionActive, keyExists, listStoredKeys, type logVisibility, logs, prepareDeploy, prepareUpgrade, requirePrivateKey, sanitizeString, sanitizeURL, sanitizeXURL, storePrivateKey, validateAppID, validateAppName, validateCreateAppParams, validateDeployParams, validateDescription, validateFilePath, validateImagePath, validateImageReference, validateInstanceTypeSKU, validateLogVisibility, validateLogsParams, validatePrivateKey, validatePrivateKeyFormat, validateResourceUsageMonitoring, validateURL, validateUpgradeParams, validateXURL, watchDeployment, watchUpgrade };
|
package/dist/index.d.ts
CHANGED
|
@@ -358,6 +358,7 @@ interface AppModule {
|
|
|
358
358
|
terminate: (appId: AppId, opts?: LifecycleOpts) => Promise<{
|
|
359
359
|
tx: `0x${string}` | false;
|
|
360
360
|
}>;
|
|
361
|
+
isDelegated: () => Promise<boolean>;
|
|
361
362
|
undelegate: () => Promise<{
|
|
362
363
|
tx: `0x${string}` | false;
|
|
363
364
|
}>;
|
|
@@ -1064,6 +1065,10 @@ interface EstimateBatchGasOptions {
|
|
|
1064
1065
|
* through EIP-7702 can have variable costs.
|
|
1065
1066
|
*/
|
|
1066
1067
|
declare function estimateBatchGas(options: EstimateBatchGasOptions): Promise<GasEstimate>;
|
|
1068
|
+
/**
|
|
1069
|
+
* Check if account is delegated to ERC-7702 delegator
|
|
1070
|
+
*/
|
|
1071
|
+
declare function checkERC7702Delegation(publicClient: PublicClient, account: Address, delegatorAddress: Address): Promise<boolean>;
|
|
1067
1072
|
|
|
1068
1073
|
/**
|
|
1069
1074
|
* Preflight checks
|
|
@@ -1180,4 +1185,4 @@ interface ECloudClient {
|
|
|
1180
1185
|
}
|
|
1181
1186
|
declare function createECloudClient(cfg: ClientConfig): ECloudClient;
|
|
1182
1187
|
|
|
1183
|
-
export { type AlreadyActiveResponse, type AppId, type AppInfo, type AppMetrics, type AppModuleConfig, type AppProfile, type AppProfileInfo, type AppProfileResponse, type AppRecord, type BillingEnvironmentConfig, type BillingModuleConfig, type CancelResponse, type CancelSuccessResponse, type ChainID, type CheckoutCreatedResponse, type ClientConfig, type CreateAppOpts, type CreateAppParams, type CreateSubscriptionResponse, type DeployAppOpts, type DeployOptions, type DeployParams, type DeployResult, type DockerImageConfig, type ECloudClient, type Environment, type EnvironmentConfig, type EstimateBatchGasOptions, type EstimateGasOptions, type GasEstimate, type GeneratedKey, type ImageDigestResult, type LegacyKey, type LifecycleOpts, type LogVisibility, type Logger, type LogsOptions, type LogsParams, type NoActiveSubscriptionResponse, PRIMARY_LANGUAGES, type ParsedEnvironment, type PaymentIssueResponse, type PrepareDeployResult, type PrepareUpgradeResult, type PreparedDeploy, type PreparedUpgrade, type PrivateKeySource, type ProductID, type ProductSubscriptionResponse, type Release, type ResourceUsageMonitoring, type SDKCreateAppOpts, type SDKDeployOptions, type SDKLogsOptions, type SDKUpgradeOptions, type StoredKey, type SubscribeResponse, type SubscriptionLineItem, type SubscriptionOpts, type SubscriptionStatus, type UpgradeAppOpts, type UpgradeParams, UserApiClient, assertValidFilePath, assertValidImageReference, assertValidPrivateKey, createApp, createAppModule, createBillingModule, createECloudClient, deleteLegacyPrivateKey, deletePrivateKey, encodeStartAppData, encodeStopAppData, encodeTerminateAppData, estimateBatchGas, estimateTransactionGas, executeDeploy, executeUpgrade, extractAppNameFromImage, fetchTemplateCatalog, formatETH, generateNewPrivateKey, getAddressFromPrivateKey, getAllAppsByDeveloper, getAppLatestReleaseBlockNumbers, getAvailableEnvironments, getAvailableTemplates, getBlockTimestamps, getBuildType, getCategoryDescriptions, getCurrentInstanceType, getEnvironmentConfig, getLegacyKeys, getLegacyPrivateKey, getPrivateKey, getPrivateKeyWithSource, getTemplate, isEnvironmentAvailable, isMainnet, isSubscriptionActive, keyExists, listStoredKeys, type logVisibility, logs, prepareDeploy, prepareUpgrade, requirePrivateKey, sanitizeString, sanitizeURL, sanitizeXURL, storePrivateKey, validateAppID, validateAppName, validateCreateAppParams, validateDeployParams, validateDescription, validateFilePath, validateImagePath, validateImageReference, validateInstanceTypeSKU, validateLogVisibility, validateLogsParams, validatePrivateKey, validatePrivateKeyFormat, validateResourceUsageMonitoring, validateURL, validateUpgradeParams, validateXURL, watchDeployment, watchUpgrade };
|
|
1188
|
+
export { type AlreadyActiveResponse, type AppId, type AppInfo, type AppMetrics, type AppModuleConfig, type AppProfile, type AppProfileInfo, type AppProfileResponse, type AppRecord, type BillingEnvironmentConfig, type BillingModuleConfig, type CancelResponse, type CancelSuccessResponse, type ChainID, type CheckoutCreatedResponse, type ClientConfig, type CreateAppOpts, type CreateAppParams, type CreateSubscriptionResponse, type DeployAppOpts, type DeployOptions, type DeployParams, type DeployResult, type DockerImageConfig, type ECloudClient, type Environment, type EnvironmentConfig, type EstimateBatchGasOptions, type EstimateGasOptions, type GasEstimate, type GeneratedKey, type ImageDigestResult, type LegacyKey, type LifecycleOpts, type LogVisibility, type Logger, type LogsOptions, type LogsParams, type NoActiveSubscriptionResponse, PRIMARY_LANGUAGES, type ParsedEnvironment, type PaymentIssueResponse, type PrepareDeployResult, type PrepareUpgradeResult, type PreparedDeploy, type PreparedUpgrade, type PrivateKeySource, type ProductID, type ProductSubscriptionResponse, type Release, type ResourceUsageMonitoring, type SDKCreateAppOpts, type SDKDeployOptions, type SDKLogsOptions, type SDKUpgradeOptions, type StoredKey, type SubscribeResponse, type SubscriptionLineItem, type SubscriptionOpts, type SubscriptionStatus, type UpgradeAppOpts, type UpgradeParams, UserApiClient, assertValidFilePath, assertValidImageReference, assertValidPrivateKey, checkERC7702Delegation, createApp, createAppModule, createBillingModule, createECloudClient, deleteLegacyPrivateKey, deletePrivateKey, encodeStartAppData, encodeStopAppData, encodeTerminateAppData, estimateBatchGas, estimateTransactionGas, executeDeploy, executeUpgrade, extractAppNameFromImage, fetchTemplateCatalog, formatETH, generateNewPrivateKey, getAddressFromPrivateKey, getAllAppsByDeveloper, getAppLatestReleaseBlockNumbers, getAvailableEnvironments, getAvailableTemplates, getBlockTimestamps, getBuildType, getCategoryDescriptions, getCurrentInstanceType, getEnvironmentConfig, getLegacyKeys, getLegacyPrivateKey, getPrivateKey, getPrivateKeyWithSource, getTemplate, isEnvironmentAvailable, isMainnet, isSubscriptionActive, keyExists, listStoredKeys, type logVisibility, logs, prepareDeploy, prepareUpgrade, requirePrivateKey, sanitizeString, sanitizeURL, sanitizeXURL, storePrivateKey, validateAppID, validateAppName, validateCreateAppParams, validateDeployParams, validateDescription, validateFilePath, validateImagePath, validateImageReference, validateInstanceTypeSKU, validateLogVisibility, validateLogsParams, validatePrivateKey, validatePrivateKeyFormat, validateResourceUsageMonitoring, validateURL, validateUpgradeParams, validateXURL, watchDeployment, watchUpgrade };
|
package/dist/index.js
CHANGED
|
@@ -1112,7 +1112,7 @@ Please verify the image exists: docker manifest inspect ${finalImageRef}`
|
|
|
1112
1112
|
} else {
|
|
1113
1113
|
logger.info("Continuing without environment file");
|
|
1114
1114
|
}
|
|
1115
|
-
publicEnv["
|
|
1115
|
+
publicEnv["EIGEN_MACHINE_TYPE_PUBLIC"] = instanceType;
|
|
1116
1116
|
logger.info(`Instance type: ${instanceType}`);
|
|
1117
1117
|
logger.info("Encrypting environment variables...");
|
|
1118
1118
|
const { encryptionKey } = getKMSKeysForEnvironment(
|
|
@@ -2256,13 +2256,13 @@ async function executeBatch(options, logger) {
|
|
|
2256
2256
|
);
|
|
2257
2257
|
executeBatchData = concat([selector, encodedParams]);
|
|
2258
2258
|
}
|
|
2259
|
-
const
|
|
2259
|
+
const isDelegated2 = await checkERC7702Delegation(
|
|
2260
2260
|
publicClient,
|
|
2261
2261
|
account.address,
|
|
2262
2262
|
environmentConfig.erc7702DelegatorAddress
|
|
2263
2263
|
);
|
|
2264
2264
|
let authorizationList = [];
|
|
2265
|
-
if (!
|
|
2265
|
+
if (!isDelegated2) {
|
|
2266
2266
|
const transactionNonce = await publicClient.getTransactionCount({
|
|
2267
2267
|
address: account.address,
|
|
2268
2268
|
blockTag: "pending"
|
|
@@ -2420,7 +2420,7 @@ var CanViewAppLogsPermission = "0x2fd3f2fe";
|
|
|
2420
2420
|
var CanViewSensitiveAppInfoPermission = "0x0e67b22f";
|
|
2421
2421
|
var CanUpdateAppProfilePermission = "0x036fef61";
|
|
2422
2422
|
function getDefaultClientId() {
|
|
2423
|
-
const version = true ? "0.1.0-rc.
|
|
2423
|
+
const version = true ? "0.1.0-rc.2" : "0.0.0";
|
|
2424
2424
|
return `ecloud-sdk/v${version}`;
|
|
2425
2425
|
}
|
|
2426
2426
|
var UserApiClient = class {
|
|
@@ -4676,6 +4676,21 @@ async function getBlockTimestamps(rpcUrl, environmentConfig, blockNumbers) {
|
|
|
4676
4676
|
}
|
|
4677
4677
|
return timestamps;
|
|
4678
4678
|
}
|
|
4679
|
+
async function isDelegated(options) {
|
|
4680
|
+
const { privateKey, rpcUrl, environmentConfig } = options;
|
|
4681
|
+
const privateKeyHex = addHexPrefix(privateKey);
|
|
4682
|
+
const account = privateKeyToAccount2(privateKeyHex);
|
|
4683
|
+
const chain = getChainFromID(environmentConfig.chainID);
|
|
4684
|
+
const publicClient = createPublicClient2({
|
|
4685
|
+
chain,
|
|
4686
|
+
transport: http2(rpcUrl)
|
|
4687
|
+
});
|
|
4688
|
+
return checkERC7702Delegation(
|
|
4689
|
+
publicClient,
|
|
4690
|
+
account.address,
|
|
4691
|
+
environmentConfig.erc7702DelegatorAddress
|
|
4692
|
+
);
|
|
4693
|
+
}
|
|
4679
4694
|
async function undelegate(options, logger) {
|
|
4680
4695
|
const { privateKey, rpcUrl, environmentConfig } = options;
|
|
4681
4696
|
const privateKeyHex = addHexPrefix(privateKey);
|
|
@@ -4808,7 +4823,7 @@ async function watchUntilUpgradeComplete(options, logger) {
|
|
|
4808
4823
|
if (status === APP_STATUS_STOPPED && ip) {
|
|
4809
4824
|
logger.info("App upgrade complete.");
|
|
4810
4825
|
logger.info(`Status: ${status}`);
|
|
4811
|
-
logger.info(`To start the app, run:
|
|
4826
|
+
logger.info(`To start the app, run: ecloud compute app start ${appId}`);
|
|
4812
4827
|
return true;
|
|
4813
4828
|
}
|
|
4814
4829
|
}
|
|
@@ -4818,7 +4833,7 @@ async function watchUntilUpgradeComplete(options, logger) {
|
|
|
4818
4833
|
if (status === APP_STATUS_STOPPED && ip && hasChanged) {
|
|
4819
4834
|
logger.info("App upgrade complete.");
|
|
4820
4835
|
logger.info(`Status: ${status}`);
|
|
4821
|
-
logger.info(`To start the app, run:
|
|
4836
|
+
logger.info(`To start the app, run: ecloud compute app start ${appId}`);
|
|
4822
4837
|
return true;
|
|
4823
4838
|
}
|
|
4824
4839
|
if (status === APP_STATUS_RUNNING && ip && hasChanged) {
|
|
@@ -5335,7 +5350,7 @@ async function checkQuotaAvailable(preflightCtx) {
|
|
|
5335
5350
|
}
|
|
5336
5351
|
if (maxQuota === 0) {
|
|
5337
5352
|
throw new Error(
|
|
5338
|
-
"no app quota available. Run '
|
|
5353
|
+
"no app quota available. Run 'ecloud billing subscribe' to enable app deployment"
|
|
5339
5354
|
);
|
|
5340
5355
|
}
|
|
5341
5356
|
let activeCount;
|
|
@@ -5951,7 +5966,7 @@ Before deploying, you'll need:
|
|
|
5951
5966
|
## Deployment
|
|
5952
5967
|
|
|
5953
5968
|
\`\`\`bash
|
|
5954
|
-
|
|
5969
|
+
ecloud compute app deploy username/image-name
|
|
5955
5970
|
\`\`\`
|
|
5956
5971
|
|
|
5957
5972
|
The CLI will automatically detect the \`Dockerfile\` and build your app before deploying.
|
|
@@ -5959,13 +5974,13 @@ The CLI will automatically detect the \`Dockerfile\` and build your app before d
|
|
|
5959
5974
|
## Management & Monitoring
|
|
5960
5975
|
|
|
5961
5976
|
\`\`\`bash
|
|
5962
|
-
|
|
5963
|
-
|
|
5964
|
-
|
|
5965
|
-
|
|
5966
|
-
|
|
5967
|
-
|
|
5968
|
-
|
|
5977
|
+
ecloud compute app list # List all apps
|
|
5978
|
+
ecloud compute app info [app-name] # Get app details
|
|
5979
|
+
ecloud compute app logs [app-name] # View logs
|
|
5980
|
+
ecloud compute app start [app-name] # Start stopped app
|
|
5981
|
+
ecloud compute app stop [app-name] # Stop running app
|
|
5982
|
+
ecloud compute app terminate [app-name] # Terminate app
|
|
5983
|
+
ecloud compute app upgrade [app-name] [image] # Update deployment
|
|
5969
5984
|
\`\`\`
|
|
5970
5985
|
`;
|
|
5971
5986
|
}
|
|
@@ -6460,6 +6475,13 @@ function createAppModule(ctx) {
|
|
|
6460
6475
|
);
|
|
6461
6476
|
return { tx };
|
|
6462
6477
|
},
|
|
6478
|
+
async isDelegated() {
|
|
6479
|
+
return isDelegated({
|
|
6480
|
+
privateKey,
|
|
6481
|
+
rpcUrl: ctx.rpcUrl,
|
|
6482
|
+
environmentConfig: environment
|
|
6483
|
+
});
|
|
6484
|
+
},
|
|
6463
6485
|
async undelegate() {
|
|
6464
6486
|
const tx = await undelegate(
|
|
6465
6487
|
{
|
|
@@ -6907,6 +6929,7 @@ export {
|
|
|
6907
6929
|
assertValidFilePath,
|
|
6908
6930
|
assertValidImageReference,
|
|
6909
6931
|
assertValidPrivateKey,
|
|
6932
|
+
checkERC7702Delegation,
|
|
6910
6933
|
createApp,
|
|
6911
6934
|
createAppModule,
|
|
6912
6935
|
createBillingModule,
|