@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
package/dist/index.cjs
CHANGED
|
@@ -169,6 +169,7 @@ __export(index_exports, {
|
|
|
169
169
|
BuildError: () => BuildError,
|
|
170
170
|
BuildFailedError: () => BuildFailedError,
|
|
171
171
|
ConflictError: () => ConflictError,
|
|
172
|
+
ERC20ABI: () => ERC20_default,
|
|
172
173
|
ForbiddenError: () => ForbiddenError,
|
|
173
174
|
NoopClient: () => NoopClient,
|
|
174
175
|
NotFoundError: () => NotFoundError,
|
|
@@ -176,6 +177,7 @@ __export(index_exports, {
|
|
|
176
177
|
PostHogClient: () => PostHogClient,
|
|
177
178
|
SessionError: () => SessionError,
|
|
178
179
|
TimeoutError: () => TimeoutError,
|
|
180
|
+
USDCCreditsABI: () => USDCCredits_default,
|
|
179
181
|
UserApiClient: () => UserApiClient,
|
|
180
182
|
addHexPrefix: () => addHexPrefix,
|
|
181
183
|
addMetric: () => addMetric,
|
|
@@ -183,6 +185,7 @@ __export(index_exports, {
|
|
|
183
185
|
assertValidFilePath: () => assertValidFilePath,
|
|
184
186
|
assertValidImageReference: () => assertValidImageReference,
|
|
185
187
|
assertValidPrivateKey: () => assertValidPrivateKey,
|
|
188
|
+
calculateAppID: () => calculateAppID,
|
|
186
189
|
checkERC7702Delegation: () => checkERC7702Delegation,
|
|
187
190
|
createApp: () => createApp,
|
|
188
191
|
createAppEnvironment: () => createAppEnvironment,
|
|
@@ -212,9 +215,11 @@ __export(index_exports, {
|
|
|
212
215
|
getAddressFromPrivateKey: () => getAddressFromPrivateKey,
|
|
213
216
|
getAllAppsByDeveloper: () => getAllAppsByDeveloper,
|
|
214
217
|
getAppLatestReleaseBlockNumbers: () => getAppLatestReleaseBlockNumbers,
|
|
218
|
+
getAppsByBillingAccount: () => getAppsByBillingAccount,
|
|
215
219
|
getAvailableEnvironments: () => getAvailableEnvironments,
|
|
216
220
|
getAvailableTemplates: () => getAvailableTemplates,
|
|
217
221
|
getBillingEnvironmentConfig: () => getBillingEnvironmentConfig,
|
|
222
|
+
getBillingType: () => getBillingType,
|
|
218
223
|
getBlockTimestamps: () => getBlockTimestamps,
|
|
219
224
|
getBuildType: () => getBuildType,
|
|
220
225
|
getCategoryDescriptions: () => getCategoryDescriptions,
|
|
@@ -566,7 +571,7 @@ var PushPermissionError = class extends Error {
|
|
|
566
571
|
var import_handlebars = __toESM(require("handlebars"), 1);
|
|
567
572
|
|
|
568
573
|
// src/client/common/templates/Dockerfile.layered.tmpl
|
|
569
|
-
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
|
|
574
|
+
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';
|
|
570
575
|
|
|
571
576
|
// src/client/common/templates/dockerfileTemplate.ts
|
|
572
577
|
function processDockerfileTemplate(data) {
|
|
@@ -2840,6 +2845,71 @@ var AppController_default = [
|
|
|
2840
2845
|
],
|
|
2841
2846
|
stateMutability: "nonpayable"
|
|
2842
2847
|
},
|
|
2848
|
+
{
|
|
2849
|
+
type: "function",
|
|
2850
|
+
name: "createAppWithIsolatedBilling",
|
|
2851
|
+
inputs: [
|
|
2852
|
+
{
|
|
2853
|
+
name: "salt",
|
|
2854
|
+
type: "bytes32",
|
|
2855
|
+
internalType: "bytes32"
|
|
2856
|
+
},
|
|
2857
|
+
{
|
|
2858
|
+
name: "release",
|
|
2859
|
+
type: "tuple",
|
|
2860
|
+
internalType: "structIAppController.Release",
|
|
2861
|
+
components: [
|
|
2862
|
+
{
|
|
2863
|
+
name: "rmsRelease",
|
|
2864
|
+
type: "tuple",
|
|
2865
|
+
internalType: "structIReleaseManagerTypes.Release",
|
|
2866
|
+
components: [
|
|
2867
|
+
{
|
|
2868
|
+
name: "artifacts",
|
|
2869
|
+
type: "tuple[]",
|
|
2870
|
+
internalType: "structIReleaseManagerTypes.Artifact[]",
|
|
2871
|
+
components: [
|
|
2872
|
+
{
|
|
2873
|
+
name: "digest",
|
|
2874
|
+
type: "bytes32",
|
|
2875
|
+
internalType: "bytes32"
|
|
2876
|
+
},
|
|
2877
|
+
{
|
|
2878
|
+
name: "registry",
|
|
2879
|
+
type: "string",
|
|
2880
|
+
internalType: "string"
|
|
2881
|
+
}
|
|
2882
|
+
]
|
|
2883
|
+
},
|
|
2884
|
+
{
|
|
2885
|
+
name: "upgradeByTime",
|
|
2886
|
+
type: "uint32",
|
|
2887
|
+
internalType: "uint32"
|
|
2888
|
+
}
|
|
2889
|
+
]
|
|
2890
|
+
},
|
|
2891
|
+
{
|
|
2892
|
+
name: "publicEnv",
|
|
2893
|
+
type: "bytes",
|
|
2894
|
+
internalType: "bytes"
|
|
2895
|
+
},
|
|
2896
|
+
{
|
|
2897
|
+
name: "encryptedEnv",
|
|
2898
|
+
type: "bytes",
|
|
2899
|
+
internalType: "bytes"
|
|
2900
|
+
}
|
|
2901
|
+
]
|
|
2902
|
+
}
|
|
2903
|
+
],
|
|
2904
|
+
outputs: [
|
|
2905
|
+
{
|
|
2906
|
+
name: "app",
|
|
2907
|
+
type: "address",
|
|
2908
|
+
internalType: "contractIApp"
|
|
2909
|
+
}
|
|
2910
|
+
],
|
|
2911
|
+
stateMutability: "nonpayable"
|
|
2912
|
+
},
|
|
2843
2913
|
{
|
|
2844
2914
|
type: "function",
|
|
2845
2915
|
name: "domainSeparator",
|
|
@@ -2872,6 +2942,25 @@ var AppController_default = [
|
|
|
2872
2942
|
],
|
|
2873
2943
|
stateMutability: "view"
|
|
2874
2944
|
},
|
|
2945
|
+
{
|
|
2946
|
+
type: "function",
|
|
2947
|
+
name: "getBillingType",
|
|
2948
|
+
inputs: [
|
|
2949
|
+
{
|
|
2950
|
+
name: "app",
|
|
2951
|
+
type: "address",
|
|
2952
|
+
internalType: "address"
|
|
2953
|
+
}
|
|
2954
|
+
],
|
|
2955
|
+
outputs: [
|
|
2956
|
+
{
|
|
2957
|
+
name: "",
|
|
2958
|
+
type: "uint8",
|
|
2959
|
+
internalType: "uint8"
|
|
2960
|
+
}
|
|
2961
|
+
],
|
|
2962
|
+
stateMutability: "view"
|
|
2963
|
+
},
|
|
2875
2964
|
{
|
|
2876
2965
|
type: "function",
|
|
2877
2966
|
name: "getAppCreator",
|
|
@@ -2999,6 +3088,62 @@ var AppController_default = [
|
|
|
2999
3088
|
],
|
|
3000
3089
|
stateMutability: "view"
|
|
3001
3090
|
},
|
|
3091
|
+
{
|
|
3092
|
+
type: "function",
|
|
3093
|
+
name: "getAppsByBillingAccount",
|
|
3094
|
+
inputs: [
|
|
3095
|
+
{
|
|
3096
|
+
name: "account",
|
|
3097
|
+
type: "address",
|
|
3098
|
+
internalType: "address"
|
|
3099
|
+
},
|
|
3100
|
+
{
|
|
3101
|
+
name: "offset",
|
|
3102
|
+
type: "uint256",
|
|
3103
|
+
internalType: "uint256"
|
|
3104
|
+
},
|
|
3105
|
+
{
|
|
3106
|
+
name: "limit",
|
|
3107
|
+
type: "uint256",
|
|
3108
|
+
internalType: "uint256"
|
|
3109
|
+
}
|
|
3110
|
+
],
|
|
3111
|
+
outputs: [
|
|
3112
|
+
{
|
|
3113
|
+
name: "apps",
|
|
3114
|
+
type: "address[]",
|
|
3115
|
+
internalType: "contractIApp[]"
|
|
3116
|
+
},
|
|
3117
|
+
{
|
|
3118
|
+
name: "appConfigsMem",
|
|
3119
|
+
type: "tuple[]",
|
|
3120
|
+
internalType: "structIAppController.AppConfig[]",
|
|
3121
|
+
components: [
|
|
3122
|
+
{
|
|
3123
|
+
name: "creator",
|
|
3124
|
+
type: "address",
|
|
3125
|
+
internalType: "address"
|
|
3126
|
+
},
|
|
3127
|
+
{
|
|
3128
|
+
name: "operatorSetId",
|
|
3129
|
+
type: "uint32",
|
|
3130
|
+
internalType: "uint32"
|
|
3131
|
+
},
|
|
3132
|
+
{
|
|
3133
|
+
name: "latestReleaseBlockNumber",
|
|
3134
|
+
type: "uint32",
|
|
3135
|
+
internalType: "uint32"
|
|
3136
|
+
},
|
|
3137
|
+
{
|
|
3138
|
+
name: "status",
|
|
3139
|
+
type: "uint8",
|
|
3140
|
+
internalType: "enumIAppController.AppStatus"
|
|
3141
|
+
}
|
|
3142
|
+
]
|
|
3143
|
+
}
|
|
3144
|
+
],
|
|
3145
|
+
stateMutability: "view"
|
|
3146
|
+
},
|
|
3002
3147
|
{
|
|
3003
3148
|
type: "function",
|
|
3004
3149
|
name: "getAppsByCreator",
|
|
@@ -4254,9 +4399,10 @@ async function prepareDeployBatch(options, logger = noopLogger) {
|
|
|
4254
4399
|
publicEnv: (0, import_viem3.bytesToHex)(release.publicEnv),
|
|
4255
4400
|
encryptedEnv: (0, import_viem3.bytesToHex)(release.encryptedEnv)
|
|
4256
4401
|
};
|
|
4402
|
+
const functionName = options.billTo === "app" ? "createAppWithIsolatedBilling" : "createApp";
|
|
4257
4403
|
const createData = (0, import_viem3.encodeFunctionData)({
|
|
4258
4404
|
abi: AppController_default,
|
|
4259
|
-
functionName
|
|
4405
|
+
functionName,
|
|
4260
4406
|
args: [saltHex, releaseForViem]
|
|
4261
4407
|
});
|
|
4262
4408
|
const acceptAdminData = (0, import_viem3.encodeFunctionData)({
|
|
@@ -4572,6 +4718,24 @@ async function getAppsByDeveloper(publicClient, environmentConfig, developer, of
|
|
|
4572
4718
|
appConfigs: result[1]
|
|
4573
4719
|
};
|
|
4574
4720
|
}
|
|
4721
|
+
async function getBillingType(publicClient, environmentConfig, app) {
|
|
4722
|
+
const result = await publicClient.readContract({
|
|
4723
|
+
address: environmentConfig.appControllerAddress,
|
|
4724
|
+
abi: AppController_default,
|
|
4725
|
+
functionName: "getBillingType",
|
|
4726
|
+
args: [app]
|
|
4727
|
+
});
|
|
4728
|
+
return Number(result);
|
|
4729
|
+
}
|
|
4730
|
+
async function getAppsByBillingAccount(publicClient, environmentConfig, account, offset, limit) {
|
|
4731
|
+
const result = await publicClient.readContract({
|
|
4732
|
+
address: environmentConfig.appControllerAddress,
|
|
4733
|
+
abi: AppController_default,
|
|
4734
|
+
functionName: "getAppsByBillingAccount",
|
|
4735
|
+
args: [account, offset, limit]
|
|
4736
|
+
});
|
|
4737
|
+
return { apps: result[0], appConfigs: result[1] };
|
|
4738
|
+
}
|
|
4575
4739
|
async function getAllAppsByDeveloper(publicClient, env, developer, pageSize = 100n) {
|
|
4576
4740
|
let offset = 0n;
|
|
4577
4741
|
const allApps = [];
|
|
@@ -4790,7 +4954,7 @@ var CanViewAppLogsPermission = "0x2fd3f2fe";
|
|
|
4790
4954
|
var CanViewSensitiveAppInfoPermission = "0x0e67b22f";
|
|
4791
4955
|
var CanUpdateAppProfilePermission = "0x036fef61";
|
|
4792
4956
|
function getDefaultClientId() {
|
|
4793
|
-
const version = true ? "0.
|
|
4957
|
+
const version = true ? "0.4.0-dev.0" : "0.0.0";
|
|
4794
4958
|
return `ecloud-sdk/v${version}`;
|
|
4795
4959
|
}
|
|
4796
4960
|
var UserApiClient = class {
|
|
@@ -5570,7 +5734,8 @@ var ENVIRONMENTS = {
|
|
|
5570
5734
|
erc7702DelegatorAddress: CommonAddresses.ERC7702Delegator,
|
|
5571
5735
|
kmsServerURL: "http://10.128.0.57:8080",
|
|
5572
5736
|
userApiServerURL: "https://userapi-compute-sepolia-dev.eigencloud.xyz",
|
|
5573
|
-
defaultRPCURL: "https://ethereum-sepolia-rpc.publicnode.com"
|
|
5737
|
+
defaultRPCURL: "https://ethereum-sepolia-rpc.publicnode.com",
|
|
5738
|
+
usdcCreditsAddress: "0xbdA3897c3A428763B59015C64AB766c288C97376"
|
|
5574
5739
|
},
|
|
5575
5740
|
sepolia: {
|
|
5576
5741
|
name: "sepolia",
|
|
@@ -5627,7 +5792,7 @@ function getBillingEnvironmentConfig(build) {
|
|
|
5627
5792
|
return config;
|
|
5628
5793
|
}
|
|
5629
5794
|
function getBuildType() {
|
|
5630
|
-
const buildTimeType = true ? "
|
|
5795
|
+
const buildTimeType = true ? "dev"?.toLowerCase() : void 0;
|
|
5631
5796
|
const runtimeType = process.env.BUILD_TYPE?.toLowerCase();
|
|
5632
5797
|
const buildType = buildTimeType || runtimeType;
|
|
5633
5798
|
if (buildType === "dev") {
|
|
@@ -6120,7 +6285,7 @@ function getPostHogAPIKey() {
|
|
|
6120
6285
|
if (process.env.ECLOUD_POSTHOG_KEY) {
|
|
6121
6286
|
return process.env.ECLOUD_POSTHOG_KEY;
|
|
6122
6287
|
}
|
|
6123
|
-
return
|
|
6288
|
+
return typeof POSTHOG_API_KEY_BUILD_TIME !== "undefined" ? POSTHOG_API_KEY_BUILD_TIME : void 0;
|
|
6124
6289
|
}
|
|
6125
6290
|
function getPostHogEndpoint() {
|
|
6126
6291
|
return process.env.ECLOUD_POSTHOG_ENDPOINT || "https://us.i.posthog.com";
|
|
@@ -6276,8 +6441,6 @@ async function prepareDeployFromVerifiableBuild(options, logger = defaultLogger)
|
|
|
6276
6441
|
},
|
|
6277
6442
|
logger
|
|
6278
6443
|
);
|
|
6279
|
-
logger.debug("Checking quota availability...");
|
|
6280
|
-
await checkQuotaAvailable(preflightCtx);
|
|
6281
6444
|
const salt = generateRandomSalt();
|
|
6282
6445
|
logger.debug(`Generated salt: ${Buffer.from(salt).toString("hex")}`);
|
|
6283
6446
|
logger.debug("Calculating app ID...");
|
|
@@ -6290,6 +6453,13 @@ async function prepareDeployFromVerifiableBuild(options, logger = defaultLogger)
|
|
|
6290
6453
|
logger.info(``);
|
|
6291
6454
|
logger.info(`App ID: ${appIDToBeDeployed}`);
|
|
6292
6455
|
logger.info(``);
|
|
6456
|
+
if (!options.skipQuotaCheck) {
|
|
6457
|
+
logger.debug("Checking quota availability...");
|
|
6458
|
+
await checkQuotaAvailable(
|
|
6459
|
+
preflightCtx,
|
|
6460
|
+
options.billTo === "app" ? appIDToBeDeployed : void 0
|
|
6461
|
+
);
|
|
6462
|
+
}
|
|
6293
6463
|
const release = await createReleaseFromImageDigest(
|
|
6294
6464
|
{
|
|
6295
6465
|
imageRef: options.imageRef,
|
|
@@ -6310,7 +6480,8 @@ async function prepareDeployFromVerifiableBuild(options, logger = defaultLogger)
|
|
|
6310
6480
|
salt,
|
|
6311
6481
|
release,
|
|
6312
6482
|
publicLogs,
|
|
6313
|
-
imageRef: options.imageRef
|
|
6483
|
+
imageRef: options.imageRef,
|
|
6484
|
+
billTo: options.billTo
|
|
6314
6485
|
},
|
|
6315
6486
|
logger
|
|
6316
6487
|
);
|
|
@@ -6391,8 +6562,6 @@ async function deploy(options, logger = defaultLogger) {
|
|
|
6391
6562
|
},
|
|
6392
6563
|
logger
|
|
6393
6564
|
);
|
|
6394
|
-
logger.debug("Checking quota availability...");
|
|
6395
|
-
await checkQuotaAvailable(preflightCtx);
|
|
6396
6565
|
logger.debug("Checking Docker...");
|
|
6397
6566
|
await ensureDockerIsRunning();
|
|
6398
6567
|
const dockerfilePath = options.dockerfilePath || "";
|
|
@@ -6412,6 +6581,13 @@ async function deploy(options, logger = defaultLogger) {
|
|
|
6412
6581
|
logger.info(``);
|
|
6413
6582
|
logger.info(`App ID: ${appIDToBeDeployed}`);
|
|
6414
6583
|
logger.info(``);
|
|
6584
|
+
if (!options.skipQuotaCheck) {
|
|
6585
|
+
logger.debug("Checking quota availability...");
|
|
6586
|
+
await checkQuotaAvailable(
|
|
6587
|
+
preflightCtx,
|
|
6588
|
+
options.billTo === "app" ? appIDToBeDeployed : void 0
|
|
6589
|
+
);
|
|
6590
|
+
}
|
|
6415
6591
|
logger.info("Preparing release...");
|
|
6416
6592
|
const { release, finalImageRef } = await prepareRelease(
|
|
6417
6593
|
{
|
|
@@ -6460,8 +6636,9 @@ async function deploy(options, logger = defaultLogger) {
|
|
|
6460
6636
|
}
|
|
6461
6637
|
);
|
|
6462
6638
|
}
|
|
6463
|
-
async function checkQuotaAvailable(preflightCtx) {
|
|
6464
|
-
const { publicClient, environmentConfig
|
|
6639
|
+
async function checkQuotaAvailable(preflightCtx, quotaAddress) {
|
|
6640
|
+
const { publicClient, environmentConfig } = preflightCtx;
|
|
6641
|
+
const userAddress = quotaAddress || preflightCtx.selfAddress;
|
|
6465
6642
|
let maxQuota;
|
|
6466
6643
|
try {
|
|
6467
6644
|
maxQuota = await getMaxActiveAppsPerUser(publicClient, environmentConfig, userAddress);
|
|
@@ -6512,8 +6689,6 @@ async function prepareDeploy(options, logger = defaultLogger) {
|
|
|
6512
6689
|
},
|
|
6513
6690
|
logger
|
|
6514
6691
|
);
|
|
6515
|
-
logger.debug("Checking quota availability...");
|
|
6516
|
-
await checkQuotaAvailable(preflightCtx);
|
|
6517
6692
|
logger.debug("Checking Docker...");
|
|
6518
6693
|
await ensureDockerIsRunning();
|
|
6519
6694
|
const dockerfilePath = options.dockerfilePath || "";
|
|
@@ -6521,8 +6696,8 @@ async function prepareDeploy(options, logger = defaultLogger) {
|
|
|
6521
6696
|
const appName = options.appName;
|
|
6522
6697
|
const envFilePath = options.envFilePath || "";
|
|
6523
6698
|
const instanceType = options.instanceType;
|
|
6524
|
-
const salt = generateRandomSalt();
|
|
6525
|
-
logger.debug(
|
|
6699
|
+
const salt = options.salt ?? generateRandomSalt();
|
|
6700
|
+
logger.debug(`${options.salt ? "Using provided" : "Generated"} salt: ${Buffer.from(salt).toString("hex")}`);
|
|
6526
6701
|
logger.debug("Calculating app ID...");
|
|
6527
6702
|
const appIDToBeDeployed = await calculateAppID({
|
|
6528
6703
|
publicClient: preflightCtx.publicClient,
|
|
@@ -6533,6 +6708,13 @@ async function prepareDeploy(options, logger = defaultLogger) {
|
|
|
6533
6708
|
logger.info(``);
|
|
6534
6709
|
logger.info(`App ID: ${appIDToBeDeployed}`);
|
|
6535
6710
|
logger.info(``);
|
|
6711
|
+
if (!options.skipQuotaCheck) {
|
|
6712
|
+
logger.debug("Checking quota availability...");
|
|
6713
|
+
await checkQuotaAvailable(
|
|
6714
|
+
preflightCtx,
|
|
6715
|
+
options.billTo === "app" ? appIDToBeDeployed : void 0
|
|
6716
|
+
);
|
|
6717
|
+
}
|
|
6536
6718
|
logger.info("Preparing release...");
|
|
6537
6719
|
const { release, finalImageRef } = await prepareRelease(
|
|
6538
6720
|
{
|
|
@@ -6556,7 +6738,8 @@ async function prepareDeploy(options, logger = defaultLogger) {
|
|
|
6556
6738
|
salt,
|
|
6557
6739
|
release,
|
|
6558
6740
|
publicLogs,
|
|
6559
|
-
imageRef: finalImageRef
|
|
6741
|
+
imageRef: finalImageRef,
|
|
6742
|
+
billTo: options.billTo
|
|
6560
6743
|
},
|
|
6561
6744
|
logger
|
|
6562
6745
|
);
|
|
@@ -7718,6 +7901,9 @@ function createAppModule(ctx) {
|
|
|
7718
7901
|
imageRef: opts.imageRef,
|
|
7719
7902
|
logVisibility: opts.logVisibility,
|
|
7720
7903
|
resourceUsageMonitoring: opts.resourceUsageMonitoring,
|
|
7904
|
+
billTo: opts.billTo,
|
|
7905
|
+
skipQuotaCheck: opts.skipQuotaCheck,
|
|
7906
|
+
salt: opts.salt,
|
|
7721
7907
|
skipTelemetry
|
|
7722
7908
|
},
|
|
7723
7909
|
logger
|
|
@@ -7736,6 +7922,7 @@ function createAppModule(ctx) {
|
|
|
7736
7922
|
imageDigest: opts.imageDigest,
|
|
7737
7923
|
logVisibility: opts.logVisibility,
|
|
7738
7924
|
resourceUsageMonitoring: opts.resourceUsageMonitoring,
|
|
7925
|
+
billTo: opts.billTo,
|
|
7739
7926
|
skipTelemetry
|
|
7740
7927
|
},
|
|
7741
7928
|
logger
|
|
@@ -7963,6 +8150,12 @@ function createAppModule(ctx) {
|
|
|
7963
8150
|
}
|
|
7964
8151
|
);
|
|
7965
8152
|
},
|
|
8153
|
+
async getBillingType(appId) {
|
|
8154
|
+
return getBillingType(publicClient, environment, appId);
|
|
8155
|
+
},
|
|
8156
|
+
async getAppsByBillingAccount(account2, offset, limit) {
|
|
8157
|
+
return getAppsByBillingAccount(publicClient, environment, account2, offset, limit);
|
|
8158
|
+
},
|
|
7966
8159
|
async isDelegated() {
|
|
7967
8160
|
return isDelegated({
|
|
7968
8161
|
publicClient,
|
|
@@ -8861,6 +9054,95 @@ async function getCurrentInstanceType(preflightCtx, appID, logger, clientId) {
|
|
|
8861
9054
|
}
|
|
8862
9055
|
}
|
|
8863
9056
|
|
|
9057
|
+
// src/client/common/abis/USDCCredits.json
|
|
9058
|
+
var USDCCredits_default = [
|
|
9059
|
+
{
|
|
9060
|
+
type: "function",
|
|
9061
|
+
name: "purchaseCreditsFor",
|
|
9062
|
+
stateMutability: "nonpayable",
|
|
9063
|
+
inputs: [
|
|
9064
|
+
{ name: "amount", type: "uint256" },
|
|
9065
|
+
{ name: "account", type: "address" }
|
|
9066
|
+
],
|
|
9067
|
+
outputs: []
|
|
9068
|
+
},
|
|
9069
|
+
{
|
|
9070
|
+
type: "function",
|
|
9071
|
+
name: "purchaseCredits",
|
|
9072
|
+
stateMutability: "nonpayable",
|
|
9073
|
+
inputs: [
|
|
9074
|
+
{ name: "amount", type: "uint256" }
|
|
9075
|
+
],
|
|
9076
|
+
outputs: []
|
|
9077
|
+
},
|
|
9078
|
+
{
|
|
9079
|
+
type: "function",
|
|
9080
|
+
name: "usdc",
|
|
9081
|
+
stateMutability: "view",
|
|
9082
|
+
inputs: [],
|
|
9083
|
+
outputs: [
|
|
9084
|
+
{ name: "", type: "address" }
|
|
9085
|
+
]
|
|
9086
|
+
},
|
|
9087
|
+
{
|
|
9088
|
+
type: "function",
|
|
9089
|
+
name: "minimumPurchase",
|
|
9090
|
+
stateMutability: "view",
|
|
9091
|
+
inputs: [],
|
|
9092
|
+
outputs: [
|
|
9093
|
+
{ name: "", type: "uint256" }
|
|
9094
|
+
]
|
|
9095
|
+
},
|
|
9096
|
+
{
|
|
9097
|
+
type: "event",
|
|
9098
|
+
name: "CreditsPurchased",
|
|
9099
|
+
inputs: [
|
|
9100
|
+
{ name: "purchaser", type: "address", indexed: true },
|
|
9101
|
+
{ name: "account", type: "address", indexed: true },
|
|
9102
|
+
{ name: "amount", type: "uint256", indexed: false }
|
|
9103
|
+
]
|
|
9104
|
+
}
|
|
9105
|
+
];
|
|
9106
|
+
|
|
9107
|
+
// src/client/common/abis/ERC20.json
|
|
9108
|
+
var ERC20_default = [
|
|
9109
|
+
{
|
|
9110
|
+
type: "function",
|
|
9111
|
+
name: "approve",
|
|
9112
|
+
stateMutability: "nonpayable",
|
|
9113
|
+
inputs: [
|
|
9114
|
+
{ name: "spender", type: "address" },
|
|
9115
|
+
{ name: "amount", type: "uint256" }
|
|
9116
|
+
],
|
|
9117
|
+
outputs: [
|
|
9118
|
+
{ name: "", type: "bool" }
|
|
9119
|
+
]
|
|
9120
|
+
},
|
|
9121
|
+
{
|
|
9122
|
+
type: "function",
|
|
9123
|
+
name: "balanceOf",
|
|
9124
|
+
stateMutability: "view",
|
|
9125
|
+
inputs: [
|
|
9126
|
+
{ name: "account", type: "address" }
|
|
9127
|
+
],
|
|
9128
|
+
outputs: [
|
|
9129
|
+
{ name: "", type: "uint256" }
|
|
9130
|
+
]
|
|
9131
|
+
},
|
|
9132
|
+
{
|
|
9133
|
+
type: "function",
|
|
9134
|
+
name: "allowance",
|
|
9135
|
+
stateMutability: "view",
|
|
9136
|
+
inputs: [
|
|
9137
|
+
{ name: "owner", type: "address" },
|
|
9138
|
+
{ name: "spender", type: "address" }
|
|
9139
|
+
],
|
|
9140
|
+
outputs: [
|
|
9141
|
+
{ name: "", type: "uint256" }
|
|
9142
|
+
]
|
|
9143
|
+
}
|
|
9144
|
+
];
|
|
9145
|
+
|
|
8864
9146
|
// src/client/index.ts
|
|
8865
9147
|
function createECloudClient(cfg) {
|
|
8866
9148
|
cfg.privateKey = addHexPrefix(cfg.privateKey);
|
|
@@ -8907,6 +9189,7 @@ function createECloudClient(cfg) {
|
|
|
8907
9189
|
BuildError,
|
|
8908
9190
|
BuildFailedError,
|
|
8909
9191
|
ConflictError,
|
|
9192
|
+
ERC20ABI,
|
|
8910
9193
|
ForbiddenError,
|
|
8911
9194
|
NoopClient,
|
|
8912
9195
|
NotFoundError,
|
|
@@ -8914,6 +9197,7 @@ function createECloudClient(cfg) {
|
|
|
8914
9197
|
PostHogClient,
|
|
8915
9198
|
SessionError,
|
|
8916
9199
|
TimeoutError,
|
|
9200
|
+
USDCCreditsABI,
|
|
8917
9201
|
UserApiClient,
|
|
8918
9202
|
addHexPrefix,
|
|
8919
9203
|
addMetric,
|
|
@@ -8921,6 +9205,7 @@ function createECloudClient(cfg) {
|
|
|
8921
9205
|
assertValidFilePath,
|
|
8922
9206
|
assertValidImageReference,
|
|
8923
9207
|
assertValidPrivateKey,
|
|
9208
|
+
calculateAppID,
|
|
8924
9209
|
checkERC7702Delegation,
|
|
8925
9210
|
createApp,
|
|
8926
9211
|
createAppEnvironment,
|
|
@@ -8950,9 +9235,11 @@ function createECloudClient(cfg) {
|
|
|
8950
9235
|
getAddressFromPrivateKey,
|
|
8951
9236
|
getAllAppsByDeveloper,
|
|
8952
9237
|
getAppLatestReleaseBlockNumbers,
|
|
9238
|
+
getAppsByBillingAccount,
|
|
8953
9239
|
getAvailableEnvironments,
|
|
8954
9240
|
getAvailableTemplates,
|
|
8955
9241
|
getBillingEnvironmentConfig,
|
|
9242
|
+
getBillingType,
|
|
8956
9243
|
getBlockTimestamps,
|
|
8957
9244
|
getBuildType,
|
|
8958
9245
|
getCategoryDescriptions,
|