@layr-labs/ecloud-sdk 0.3.4 → 0.4.0-dev.0
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/billing.cjs +4 -3
- package/dist/billing.cjs.map +1 -1
- package/dist/billing.d.cts +1 -1
- package/dist/billing.d.ts +1 -1
- package/dist/billing.js +4 -3
- package/dist/billing.js.map +1 -1
- package/dist/browser.cjs +168 -4
- 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 +166 -4
- package/dist/browser.js.map +1 -1
- package/dist/{compute-D0TNHHmD.d.ts → compute-DccJLbtV.d.cts} +6 -1
- package/dist/{compute-6WmcUluf.d.cts → compute-DlilmZYC.d.ts} +6 -1
- package/dist/compute.cjs +206 -18
- 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 +210 -19
- package/dist/compute.js.map +1 -1
- package/dist/{helpers-D0Mn-6TI.d.cts → helpers-BNeMZYcY.d.cts} +6 -1
- package/dist/{helpers-Dn6fECtP.d.ts → helpers-D_AbDeP4.d.ts} +6 -1
- package/dist/{index-WDunKGVL.d.cts → index-DD7ZLbqD.d.cts} +24 -1
- package/dist/{index-WDunKGVL.d.ts → index-DD7ZLbqD.d.ts} +24 -1
- package/dist/index.cjs +305 -18
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +159 -7
- package/dist/index.d.ts +159 -7
- package/dist/index.js +304 -19
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/tools/kms-client-linux-amd64 +0 -0
- package/VERSION +0 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Address, WalletClient, PublicClient, Hex } from 'viem';
|
|
2
|
-
import {
|
|
2
|
+
import { ad as Logger, a8 as EnvironmentConfig, Q as DeployAppOpts, A as AppId, R as UpgradeAppOpts, T as PrepareDeployOpts, a1 as PreparedDeploy, G as GasEstimate, W as PrepareDeployFromVerifiableBuildOpts, Z as ExecuteDeployResult, V as PrepareUpgradeOpts, a2 as PreparedUpgrade, X as PrepareUpgradeFromVerifiableBuildOpts, _ as ExecuteUpgradeResult, ae as AppProfile, af as AppProfileResponse, a3 as LifecycleOpts, y as AppConfig } from './index-DD7ZLbqD.cjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Create command
|
|
@@ -154,6 +154,11 @@ interface AppModule {
|
|
|
154
154
|
terminate: (appId: AppId, opts?: LifecycleOpts) => Promise<{
|
|
155
155
|
tx: Hex | false;
|
|
156
156
|
}>;
|
|
157
|
+
getBillingType: (appId: AppId) => Promise<number>;
|
|
158
|
+
getAppsByBillingAccount: (account: Address, offset: bigint, limit: bigint) => Promise<{
|
|
159
|
+
apps: Address[];
|
|
160
|
+
appConfigs: AppConfig[];
|
|
161
|
+
}>;
|
|
157
162
|
isDelegated: () => Promise<boolean>;
|
|
158
163
|
undelegate: () => Promise<{
|
|
159
164
|
tx: Hex | false;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Address, WalletClient, PublicClient, Hex } from 'viem';
|
|
2
|
-
import {
|
|
2
|
+
import { ad as Logger, a8 as EnvironmentConfig, Q as DeployAppOpts, A as AppId, R as UpgradeAppOpts, T as PrepareDeployOpts, a1 as PreparedDeploy, G as GasEstimate, W as PrepareDeployFromVerifiableBuildOpts, Z as ExecuteDeployResult, V as PrepareUpgradeOpts, a2 as PreparedUpgrade, X as PrepareUpgradeFromVerifiableBuildOpts, _ as ExecuteUpgradeResult, ae as AppProfile, af as AppProfileResponse, a3 as LifecycleOpts, y as AppConfig } from './index-DD7ZLbqD.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Create command
|
|
@@ -154,6 +154,11 @@ interface AppModule {
|
|
|
154
154
|
terminate: (appId: AppId, opts?: LifecycleOpts) => Promise<{
|
|
155
155
|
tx: Hex | false;
|
|
156
156
|
}>;
|
|
157
|
+
getBillingType: (appId: AppId) => Promise<number>;
|
|
158
|
+
getAppsByBillingAccount: (account: Address, offset: bigint, limit: bigint) => Promise<{
|
|
159
|
+
apps: Address[];
|
|
160
|
+
appConfigs: AppConfig[];
|
|
161
|
+
}>;
|
|
157
162
|
isDelegated: () => Promise<boolean>;
|
|
158
163
|
undelegate: () => Promise<{
|
|
159
164
|
tx: Hex | false;
|
package/dist/compute.cjs
CHANGED
|
@@ -456,7 +456,7 @@ var PushPermissionError = class extends Error {
|
|
|
456
456
|
var import_handlebars = __toESM(require("handlebars"), 1);
|
|
457
457
|
|
|
458
458
|
// src/client/common/templates/Dockerfile.layered.tmpl
|
|
459
|
-
var Dockerfile_layered_default = '{{#if includeTLS}}\n# Get Caddy from official image\nFROM caddy:2.10.2-alpine AS caddy\n{{/if}}\n\nFROM {{baseImage}}\n\n{{#if originalUser}}\n# Switch to root to perform setup (base image has non-root USER: {{originalUser}})\nUSER root\n{{/if}}\n\n# Copy core TEE components\nCOPY compute-source-env.sh /usr/local/bin/\nCOPY kms-client /usr/local/bin/\nCOPY kms-signing-public-key.pem /usr/local/bin/\n\n{{#if includeTLS}}\n# Copy Caddy from official image\nCOPY --from=caddy /usr/bin/caddy /usr/local/bin/caddy\n\n# Copy TLS components\nCOPY tls-keygen /usr/local/bin/\nCOPY Caddyfile /etc/caddy/\n{{/if}}\n\n{{#if originalUser}}\n# Make binaries executable (755 for executables, 644 for keys)\nRUN chmod 755 /usr/local/bin/compute-source-env.sh \\\n && chmod 755 /usr/local/bin/kms-client{{#if includeTLS}} \\\n && chmod 755 /usr/local/bin/tls-keygen \\\n && chmod 755 /usr/local/bin/caddy{{/if}} \\\n && chmod 644 /usr/local/bin/kms-signing-public-key.pem\n\n# Store original user - entrypoint will drop privileges to this user after TEE setup\nENV __ECLOUD_ORIGINAL_USER={{originalUser}}\n{{else}}\n# Make binaries executable (preserve existing permissions, just add execute)\nRUN chmod +x /usr/local/bin/compute-source-env.sh \\\n && chmod +x /usr/local/bin/kms-client{{#if includeTLS}} \\\n && chmod +x /usr/local/bin/tls-keygen{{/if}}\n{{/if}}\n\n{{#if logRedirect}}\n\nLABEL tee.launch_policy.log_redirect={{logRedirect}}\n{{/if}}\n{{#if resourceUsageAllow}}\n\nLABEL tee.launch_policy.monitoring_memory_allow={{resourceUsageAllow}}\n{{/if}}\n\nLABEL eigenx_cli_version={{ecloudCLIVersion}}\nLABEL
|
|
459
|
+
var Dockerfile_layered_default = '{{#if includeTLS}}\n# Get Caddy from official image\nFROM caddy:2.10.2-alpine AS caddy\n{{/if}}\n\nFROM {{baseImage}}\n\n{{#if originalUser}}\n# Switch to root to perform setup (base image has non-root USER: {{originalUser}})\nUSER root\n{{/if}}\n\n# Copy core TEE components\nCOPY compute-source-env.sh /usr/local/bin/\nCOPY kms-client /usr/local/bin/\nCOPY kms-signing-public-key.pem /usr/local/bin/\n\n{{#if includeTLS}}\n# Copy Caddy from official image\nCOPY --from=caddy /usr/bin/caddy /usr/local/bin/caddy\n\n# Copy TLS components\nCOPY tls-keygen /usr/local/bin/\nCOPY Caddyfile /etc/caddy/\n{{/if}}\n\n{{#if originalUser}}\n# Make binaries executable (755 for executables, 644 for keys)\nRUN chmod 755 /usr/local/bin/compute-source-env.sh \\\n && chmod 755 /usr/local/bin/kms-client{{#if includeTLS}} \\\n && chmod 755 /usr/local/bin/tls-keygen \\\n && chmod 755 /usr/local/bin/caddy{{/if}} \\\n && chmod 644 /usr/local/bin/kms-signing-public-key.pem\n\n# Store original user - entrypoint will drop privileges to this user after TEE setup\nENV __ECLOUD_ORIGINAL_USER={{originalUser}}\n{{else}}\n# Make binaries executable (preserve existing permissions, just add execute)\nRUN chmod +x /usr/local/bin/compute-source-env.sh \\\n && chmod +x /usr/local/bin/kms-client{{#if includeTLS}} \\\n && chmod +x /usr/local/bin/tls-keygen{{/if}}\n{{/if}}\n\n{{#if logRedirect}}\n\nLABEL tee.launch_policy.log_redirect={{logRedirect}}\n{{/if}}\n{{#if resourceUsageAllow}}\n\nLABEL tee.launch_policy.monitoring_memory_allow={{resourceUsageAllow}}\n{{/if}}\n\nLABEL eigenx_cli_version={{ecloudCLIVersion}}\nLABEL eigenx_vm_image=eigen\n\n{{#if includeTLS}}\n# Expose both HTTP and HTTPS ports for Caddy\nEXPOSE 80 443\n{{/if}}\n\nENTRYPOINT ["/usr/local/bin/compute-source-env.sh"]\nCMD {{{originalCmd}}}\n';
|
|
460
460
|
|
|
461
461
|
// src/client/common/templates/dockerfileTemplate.ts
|
|
462
462
|
function processDockerfileTemplate(data) {
|
|
@@ -2713,6 +2713,71 @@ var AppController_default = [
|
|
|
2713
2713
|
],
|
|
2714
2714
|
stateMutability: "nonpayable"
|
|
2715
2715
|
},
|
|
2716
|
+
{
|
|
2717
|
+
type: "function",
|
|
2718
|
+
name: "createAppWithIsolatedBilling",
|
|
2719
|
+
inputs: [
|
|
2720
|
+
{
|
|
2721
|
+
name: "salt",
|
|
2722
|
+
type: "bytes32",
|
|
2723
|
+
internalType: "bytes32"
|
|
2724
|
+
},
|
|
2725
|
+
{
|
|
2726
|
+
name: "release",
|
|
2727
|
+
type: "tuple",
|
|
2728
|
+
internalType: "structIAppController.Release",
|
|
2729
|
+
components: [
|
|
2730
|
+
{
|
|
2731
|
+
name: "rmsRelease",
|
|
2732
|
+
type: "tuple",
|
|
2733
|
+
internalType: "structIReleaseManagerTypes.Release",
|
|
2734
|
+
components: [
|
|
2735
|
+
{
|
|
2736
|
+
name: "artifacts",
|
|
2737
|
+
type: "tuple[]",
|
|
2738
|
+
internalType: "structIReleaseManagerTypes.Artifact[]",
|
|
2739
|
+
components: [
|
|
2740
|
+
{
|
|
2741
|
+
name: "digest",
|
|
2742
|
+
type: "bytes32",
|
|
2743
|
+
internalType: "bytes32"
|
|
2744
|
+
},
|
|
2745
|
+
{
|
|
2746
|
+
name: "registry",
|
|
2747
|
+
type: "string",
|
|
2748
|
+
internalType: "string"
|
|
2749
|
+
}
|
|
2750
|
+
]
|
|
2751
|
+
},
|
|
2752
|
+
{
|
|
2753
|
+
name: "upgradeByTime",
|
|
2754
|
+
type: "uint32",
|
|
2755
|
+
internalType: "uint32"
|
|
2756
|
+
}
|
|
2757
|
+
]
|
|
2758
|
+
},
|
|
2759
|
+
{
|
|
2760
|
+
name: "publicEnv",
|
|
2761
|
+
type: "bytes",
|
|
2762
|
+
internalType: "bytes"
|
|
2763
|
+
},
|
|
2764
|
+
{
|
|
2765
|
+
name: "encryptedEnv",
|
|
2766
|
+
type: "bytes",
|
|
2767
|
+
internalType: "bytes"
|
|
2768
|
+
}
|
|
2769
|
+
]
|
|
2770
|
+
}
|
|
2771
|
+
],
|
|
2772
|
+
outputs: [
|
|
2773
|
+
{
|
|
2774
|
+
name: "app",
|
|
2775
|
+
type: "address",
|
|
2776
|
+
internalType: "contractIApp"
|
|
2777
|
+
}
|
|
2778
|
+
],
|
|
2779
|
+
stateMutability: "nonpayable"
|
|
2780
|
+
},
|
|
2716
2781
|
{
|
|
2717
2782
|
type: "function",
|
|
2718
2783
|
name: "domainSeparator",
|
|
@@ -2745,6 +2810,25 @@ var AppController_default = [
|
|
|
2745
2810
|
],
|
|
2746
2811
|
stateMutability: "view"
|
|
2747
2812
|
},
|
|
2813
|
+
{
|
|
2814
|
+
type: "function",
|
|
2815
|
+
name: "getBillingType",
|
|
2816
|
+
inputs: [
|
|
2817
|
+
{
|
|
2818
|
+
name: "app",
|
|
2819
|
+
type: "address",
|
|
2820
|
+
internalType: "address"
|
|
2821
|
+
}
|
|
2822
|
+
],
|
|
2823
|
+
outputs: [
|
|
2824
|
+
{
|
|
2825
|
+
name: "",
|
|
2826
|
+
type: "uint8",
|
|
2827
|
+
internalType: "uint8"
|
|
2828
|
+
}
|
|
2829
|
+
],
|
|
2830
|
+
stateMutability: "view"
|
|
2831
|
+
},
|
|
2748
2832
|
{
|
|
2749
2833
|
type: "function",
|
|
2750
2834
|
name: "getAppCreator",
|
|
@@ -2872,6 +2956,62 @@ var AppController_default = [
|
|
|
2872
2956
|
],
|
|
2873
2957
|
stateMutability: "view"
|
|
2874
2958
|
},
|
|
2959
|
+
{
|
|
2960
|
+
type: "function",
|
|
2961
|
+
name: "getAppsByBillingAccount",
|
|
2962
|
+
inputs: [
|
|
2963
|
+
{
|
|
2964
|
+
name: "account",
|
|
2965
|
+
type: "address",
|
|
2966
|
+
internalType: "address"
|
|
2967
|
+
},
|
|
2968
|
+
{
|
|
2969
|
+
name: "offset",
|
|
2970
|
+
type: "uint256",
|
|
2971
|
+
internalType: "uint256"
|
|
2972
|
+
},
|
|
2973
|
+
{
|
|
2974
|
+
name: "limit",
|
|
2975
|
+
type: "uint256",
|
|
2976
|
+
internalType: "uint256"
|
|
2977
|
+
}
|
|
2978
|
+
],
|
|
2979
|
+
outputs: [
|
|
2980
|
+
{
|
|
2981
|
+
name: "apps",
|
|
2982
|
+
type: "address[]",
|
|
2983
|
+
internalType: "contractIApp[]"
|
|
2984
|
+
},
|
|
2985
|
+
{
|
|
2986
|
+
name: "appConfigsMem",
|
|
2987
|
+
type: "tuple[]",
|
|
2988
|
+
internalType: "structIAppController.AppConfig[]",
|
|
2989
|
+
components: [
|
|
2990
|
+
{
|
|
2991
|
+
name: "creator",
|
|
2992
|
+
type: "address",
|
|
2993
|
+
internalType: "address"
|
|
2994
|
+
},
|
|
2995
|
+
{
|
|
2996
|
+
name: "operatorSetId",
|
|
2997
|
+
type: "uint32",
|
|
2998
|
+
internalType: "uint32"
|
|
2999
|
+
},
|
|
3000
|
+
{
|
|
3001
|
+
name: "latestReleaseBlockNumber",
|
|
3002
|
+
type: "uint32",
|
|
3003
|
+
internalType: "uint32"
|
|
3004
|
+
},
|
|
3005
|
+
{
|
|
3006
|
+
name: "status",
|
|
3007
|
+
type: "uint8",
|
|
3008
|
+
internalType: "enumIAppController.AppStatus"
|
|
3009
|
+
}
|
|
3010
|
+
]
|
|
3011
|
+
}
|
|
3012
|
+
],
|
|
3013
|
+
stateMutability: "view"
|
|
3014
|
+
},
|
|
2875
3015
|
{
|
|
2876
3016
|
type: "function",
|
|
2877
3017
|
name: "getAppsByCreator",
|
|
@@ -4106,9 +4246,10 @@ async function prepareDeployBatch(options, logger = noopLogger) {
|
|
|
4106
4246
|
publicEnv: (0, import_viem3.bytesToHex)(release.publicEnv),
|
|
4107
4247
|
encryptedEnv: (0, import_viem3.bytesToHex)(release.encryptedEnv)
|
|
4108
4248
|
};
|
|
4249
|
+
const functionName = options.billTo === "app" ? "createAppWithIsolatedBilling" : "createApp";
|
|
4109
4250
|
const createData = (0, import_viem3.encodeFunctionData)({
|
|
4110
4251
|
abi: AppController_default,
|
|
4111
|
-
functionName
|
|
4252
|
+
functionName,
|
|
4112
4253
|
args: [saltHex, releaseForViem]
|
|
4113
4254
|
});
|
|
4114
4255
|
const acceptAdminData = (0, import_viem3.encodeFunctionData)({
|
|
@@ -4412,6 +4553,24 @@ async function getMaxActiveAppsPerUser(publicClient, environmentConfig, user) {
|
|
|
4412
4553
|
});
|
|
4413
4554
|
return Number(quota);
|
|
4414
4555
|
}
|
|
4556
|
+
async function getBillingType(publicClient, environmentConfig, app) {
|
|
4557
|
+
const result = await publicClient.readContract({
|
|
4558
|
+
address: environmentConfig.appControllerAddress,
|
|
4559
|
+
abi: AppController_default,
|
|
4560
|
+
functionName: "getBillingType",
|
|
4561
|
+
args: [app]
|
|
4562
|
+
});
|
|
4563
|
+
return Number(result);
|
|
4564
|
+
}
|
|
4565
|
+
async function getAppsByBillingAccount(publicClient, environmentConfig, account, offset, limit) {
|
|
4566
|
+
const result = await publicClient.readContract({
|
|
4567
|
+
address: environmentConfig.appControllerAddress,
|
|
4568
|
+
abi: AppController_default,
|
|
4569
|
+
functionName: "getAppsByBillingAccount",
|
|
4570
|
+
args: [account, offset, limit]
|
|
4571
|
+
});
|
|
4572
|
+
return { apps: result[0], appConfigs: result[1] };
|
|
4573
|
+
}
|
|
4415
4574
|
async function isDelegated(options) {
|
|
4416
4575
|
const { publicClient, environmentConfig, address } = options;
|
|
4417
4576
|
return checkERC7702Delegation(
|
|
@@ -4540,7 +4699,7 @@ var CanViewAppLogsPermission = "0x2fd3f2fe";
|
|
|
4540
4699
|
var CanViewSensitiveAppInfoPermission = "0x0e67b22f";
|
|
4541
4700
|
var CanUpdateAppProfilePermission = "0x036fef61";
|
|
4542
4701
|
function getDefaultClientId() {
|
|
4543
|
-
const version = true ? "0.
|
|
4702
|
+
const version = true ? "0.4.0-dev.0" : "0.0.0";
|
|
4544
4703
|
return `ecloud-sdk/v${version}`;
|
|
4545
4704
|
}
|
|
4546
4705
|
var UserApiClient = class {
|
|
@@ -5101,7 +5260,8 @@ var ENVIRONMENTS = {
|
|
|
5101
5260
|
erc7702DelegatorAddress: CommonAddresses.ERC7702Delegator,
|
|
5102
5261
|
kmsServerURL: "http://10.128.0.57:8080",
|
|
5103
5262
|
userApiServerURL: "https://userapi-compute-sepolia-dev.eigencloud.xyz",
|
|
5104
|
-
defaultRPCURL: "https://ethereum-sepolia-rpc.publicnode.com"
|
|
5263
|
+
defaultRPCURL: "https://ethereum-sepolia-rpc.publicnode.com",
|
|
5264
|
+
usdcCreditsAddress: "0xbdA3897c3A428763B59015C64AB766c288C97376"
|
|
5105
5265
|
},
|
|
5106
5266
|
sepolia: {
|
|
5107
5267
|
name: "sepolia",
|
|
@@ -5151,7 +5311,7 @@ function getEnvironmentConfig(environment, chainID) {
|
|
|
5151
5311
|
};
|
|
5152
5312
|
}
|
|
5153
5313
|
function getBuildType() {
|
|
5154
|
-
const buildTimeType = true ? "
|
|
5314
|
+
const buildTimeType = true ? "dev"?.toLowerCase() : void 0;
|
|
5155
5315
|
const runtimeType = process.env.BUILD_TYPE?.toLowerCase();
|
|
5156
5316
|
const buildType = buildTimeType || runtimeType;
|
|
5157
5317
|
if (buildType === "dev") {
|
|
@@ -5289,7 +5449,7 @@ function getPostHogAPIKey() {
|
|
|
5289
5449
|
if (process.env.ECLOUD_POSTHOG_KEY) {
|
|
5290
5450
|
return process.env.ECLOUD_POSTHOG_KEY;
|
|
5291
5451
|
}
|
|
5292
|
-
return
|
|
5452
|
+
return typeof POSTHOG_API_KEY_BUILD_TIME !== "undefined" ? POSTHOG_API_KEY_BUILD_TIME : void 0;
|
|
5293
5453
|
}
|
|
5294
5454
|
function getPostHogEndpoint() {
|
|
5295
5455
|
return process.env.ECLOUD_POSTHOG_ENDPOINT || "https://us.i.posthog.com";
|
|
@@ -5445,8 +5605,6 @@ async function prepareDeployFromVerifiableBuild(options, logger = defaultLogger)
|
|
|
5445
5605
|
},
|
|
5446
5606
|
logger
|
|
5447
5607
|
);
|
|
5448
|
-
logger.debug("Checking quota availability...");
|
|
5449
|
-
await checkQuotaAvailable(preflightCtx);
|
|
5450
5608
|
const salt = generateRandomSalt();
|
|
5451
5609
|
logger.debug(`Generated salt: ${Buffer.from(salt).toString("hex")}`);
|
|
5452
5610
|
logger.debug("Calculating app ID...");
|
|
@@ -5459,6 +5617,13 @@ async function prepareDeployFromVerifiableBuild(options, logger = defaultLogger)
|
|
|
5459
5617
|
logger.info(``);
|
|
5460
5618
|
logger.info(`App ID: ${appIDToBeDeployed}`);
|
|
5461
5619
|
logger.info(``);
|
|
5620
|
+
if (!options.skipQuotaCheck) {
|
|
5621
|
+
logger.debug("Checking quota availability...");
|
|
5622
|
+
await checkQuotaAvailable(
|
|
5623
|
+
preflightCtx,
|
|
5624
|
+
options.billTo === "app" ? appIDToBeDeployed : void 0
|
|
5625
|
+
);
|
|
5626
|
+
}
|
|
5462
5627
|
const release = await createReleaseFromImageDigest(
|
|
5463
5628
|
{
|
|
5464
5629
|
imageRef: options.imageRef,
|
|
@@ -5479,7 +5644,8 @@ async function prepareDeployFromVerifiableBuild(options, logger = defaultLogger)
|
|
|
5479
5644
|
salt,
|
|
5480
5645
|
release,
|
|
5481
5646
|
publicLogs,
|
|
5482
|
-
imageRef: options.imageRef
|
|
5647
|
+
imageRef: options.imageRef,
|
|
5648
|
+
billTo: options.billTo
|
|
5483
5649
|
},
|
|
5484
5650
|
logger
|
|
5485
5651
|
);
|
|
@@ -5560,8 +5726,6 @@ async function deploy(options, logger = defaultLogger) {
|
|
|
5560
5726
|
},
|
|
5561
5727
|
logger
|
|
5562
5728
|
);
|
|
5563
|
-
logger.debug("Checking quota availability...");
|
|
5564
|
-
await checkQuotaAvailable(preflightCtx);
|
|
5565
5729
|
logger.debug("Checking Docker...");
|
|
5566
5730
|
await ensureDockerIsRunning();
|
|
5567
5731
|
const dockerfilePath = options.dockerfilePath || "";
|
|
@@ -5581,6 +5745,13 @@ async function deploy(options, logger = defaultLogger) {
|
|
|
5581
5745
|
logger.info(``);
|
|
5582
5746
|
logger.info(`App ID: ${appIDToBeDeployed}`);
|
|
5583
5747
|
logger.info(``);
|
|
5748
|
+
if (!options.skipQuotaCheck) {
|
|
5749
|
+
logger.debug("Checking quota availability...");
|
|
5750
|
+
await checkQuotaAvailable(
|
|
5751
|
+
preflightCtx,
|
|
5752
|
+
options.billTo === "app" ? appIDToBeDeployed : void 0
|
|
5753
|
+
);
|
|
5754
|
+
}
|
|
5584
5755
|
logger.info("Preparing release...");
|
|
5585
5756
|
const { release, finalImageRef } = await prepareRelease(
|
|
5586
5757
|
{
|
|
@@ -5629,8 +5800,9 @@ async function deploy(options, logger = defaultLogger) {
|
|
|
5629
5800
|
}
|
|
5630
5801
|
);
|
|
5631
5802
|
}
|
|
5632
|
-
async function checkQuotaAvailable(preflightCtx) {
|
|
5633
|
-
const { publicClient, environmentConfig
|
|
5803
|
+
async function checkQuotaAvailable(preflightCtx, quotaAddress) {
|
|
5804
|
+
const { publicClient, environmentConfig } = preflightCtx;
|
|
5805
|
+
const userAddress = quotaAddress || preflightCtx.selfAddress;
|
|
5634
5806
|
let maxQuota;
|
|
5635
5807
|
try {
|
|
5636
5808
|
maxQuota = await getMaxActiveAppsPerUser(publicClient, environmentConfig, userAddress);
|
|
@@ -5681,8 +5853,6 @@ async function prepareDeploy(options, logger = defaultLogger) {
|
|
|
5681
5853
|
},
|
|
5682
5854
|
logger
|
|
5683
5855
|
);
|
|
5684
|
-
logger.debug("Checking quota availability...");
|
|
5685
|
-
await checkQuotaAvailable(preflightCtx);
|
|
5686
5856
|
logger.debug("Checking Docker...");
|
|
5687
5857
|
await ensureDockerIsRunning();
|
|
5688
5858
|
const dockerfilePath = options.dockerfilePath || "";
|
|
@@ -5690,8 +5860,8 @@ async function prepareDeploy(options, logger = defaultLogger) {
|
|
|
5690
5860
|
const appName = options.appName;
|
|
5691
5861
|
const envFilePath = options.envFilePath || "";
|
|
5692
5862
|
const instanceType = options.instanceType;
|
|
5693
|
-
const salt = generateRandomSalt();
|
|
5694
|
-
logger.debug(
|
|
5863
|
+
const salt = options.salt ?? generateRandomSalt();
|
|
5864
|
+
logger.debug(`${options.salt ? "Using provided" : "Generated"} salt: ${Buffer.from(salt).toString("hex")}`);
|
|
5695
5865
|
logger.debug("Calculating app ID...");
|
|
5696
5866
|
const appIDToBeDeployed = await calculateAppID({
|
|
5697
5867
|
publicClient: preflightCtx.publicClient,
|
|
@@ -5702,6 +5872,13 @@ async function prepareDeploy(options, logger = defaultLogger) {
|
|
|
5702
5872
|
logger.info(``);
|
|
5703
5873
|
logger.info(`App ID: ${appIDToBeDeployed}`);
|
|
5704
5874
|
logger.info(``);
|
|
5875
|
+
if (!options.skipQuotaCheck) {
|
|
5876
|
+
logger.debug("Checking quota availability...");
|
|
5877
|
+
await checkQuotaAvailable(
|
|
5878
|
+
preflightCtx,
|
|
5879
|
+
options.billTo === "app" ? appIDToBeDeployed : void 0
|
|
5880
|
+
);
|
|
5881
|
+
}
|
|
5705
5882
|
logger.info("Preparing release...");
|
|
5706
5883
|
const { release, finalImageRef } = await prepareRelease(
|
|
5707
5884
|
{
|
|
@@ -5725,7 +5902,8 @@ async function prepareDeploy(options, logger = defaultLogger) {
|
|
|
5725
5902
|
salt,
|
|
5726
5903
|
release,
|
|
5727
5904
|
publicLogs,
|
|
5728
|
-
imageRef: finalImageRef
|
|
5905
|
+
imageRef: finalImageRef,
|
|
5906
|
+
billTo: options.billTo
|
|
5729
5907
|
},
|
|
5730
5908
|
logger
|
|
5731
5909
|
);
|
|
@@ -6887,6 +7065,9 @@ function createAppModule(ctx) {
|
|
|
6887
7065
|
imageRef: opts.imageRef,
|
|
6888
7066
|
logVisibility: opts.logVisibility,
|
|
6889
7067
|
resourceUsageMonitoring: opts.resourceUsageMonitoring,
|
|
7068
|
+
billTo: opts.billTo,
|
|
7069
|
+
skipQuotaCheck: opts.skipQuotaCheck,
|
|
7070
|
+
salt: opts.salt,
|
|
6890
7071
|
skipTelemetry
|
|
6891
7072
|
},
|
|
6892
7073
|
logger
|
|
@@ -6905,6 +7086,7 @@ function createAppModule(ctx) {
|
|
|
6905
7086
|
imageDigest: opts.imageDigest,
|
|
6906
7087
|
logVisibility: opts.logVisibility,
|
|
6907
7088
|
resourceUsageMonitoring: opts.resourceUsageMonitoring,
|
|
7089
|
+
billTo: opts.billTo,
|
|
6908
7090
|
skipTelemetry
|
|
6909
7091
|
},
|
|
6910
7092
|
logger
|
|
@@ -7132,6 +7314,12 @@ function createAppModule(ctx) {
|
|
|
7132
7314
|
}
|
|
7133
7315
|
);
|
|
7134
7316
|
},
|
|
7317
|
+
async getBillingType(appId) {
|
|
7318
|
+
return getBillingType(publicClient, environment, appId);
|
|
7319
|
+
},
|
|
7320
|
+
async getAppsByBillingAccount(account2, offset, limit) {
|
|
7321
|
+
return getAppsByBillingAccount(publicClient, environment, account2, offset, limit);
|
|
7322
|
+
},
|
|
7135
7323
|
async isDelegated() {
|
|
7136
7324
|
return isDelegated({
|
|
7137
7325
|
publicClient,
|