@layr-labs/ecloud-sdk 1.0.0-devep3 → 1.0.0-devep5

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 CHANGED
@@ -1,2 +1,2 @@
1
- version=1.0.0-devep3
2
- commit=ae7213bb77bd5448778a2774d92c43d3d9a7cb67
1
+ version=1.0.0-devep5
2
+ commit=8c8210ee1e833160b553cf2c9549908f55a0a88c
package/dist/browser.cjs CHANGED
@@ -749,7 +749,7 @@ var CanViewAppLogsPermission = "0x2fd3f2fe";
749
749
  var CanViewSensitiveAppInfoPermission = "0x0e67b22f";
750
750
  var CanUpdateAppProfilePermission = "0x036fef61";
751
751
  function getDefaultClientId() {
752
- const version = true ? "1.0.0-devep3" : "0.0.0";
752
+ const version = true ? "1.0.0-devep5" : "0.0.0";
753
753
  return `ecloud-sdk/v${version}`;
754
754
  }
755
755
  var UserApiClient = class {
package/dist/browser.js CHANGED
@@ -638,7 +638,7 @@ var CanViewAppLogsPermission = "0x2fd3f2fe";
638
638
  var CanViewSensitiveAppInfoPermission = "0x0e67b22f";
639
639
  var CanUpdateAppProfilePermission = "0x036fef61";
640
640
  function getDefaultClientId() {
641
- const version = true ? "1.0.0-devep3" : "0.0.0";
641
+ const version = true ? "1.0.0-devep5" : "0.0.0";
642
642
  return `ecloud-sdk/v${version}`;
643
643
  }
644
644
  var UserApiClient = class {
package/dist/compute.cjs CHANGED
@@ -457,7 +457,102 @@ var PushPermissionError = class extends Error {
457
457
  var import_handlebars = __toESM(require("handlebars"), 1);
458
458
 
459
459
  // src/client/common/templates/Dockerfile.layered.tmpl
460
- 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{{#if includeDrainWatcher}}\nCOPY ecloud-drain-watcher /usr/local/bin/\n{{/if}}\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 includeDrainWatcher}} \\\n && chmod 755 /usr/local/bin/ecloud-drain-watcher{{/if}}{{#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 includeDrainWatcher}} \\\n && chmod +x /usr/local/bin/ecloud-drain-watcher{{/if}}{{#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\n# Allow-list the envvars the ecloud-platform sets via GCE `tee-env-*`\n# metadata. Without this label, Confidential Space\'s launcher rejects\n# any `tee-env-*` override at container-start with\n# "env var {...} is not allowed to be overridden on this image" and\n# exits with code 1 \u2014 which terminates the VM before the entrypoint\n# ever runs. ECLOUD_PD_EXPECTED is set on PD-backed apps so the\n# entrypoint (compute-source-env.sh) knows to wait for the persistent\n# disk before exec\'ing the user workload. User-supplied env vars\n# flow through KMS (not tee-env-*) and don\'t need to be listed here.\nLABEL tee.launch_policy.allow_env_override=ECLOUD_PD_EXPECTED\n\nLABEL eigenx_cli_version={{ecloudCLIVersion}}\nLABEL eigenx_vm_image=eigen\nLABEL eigenx_container_contract=v1\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
+ var Dockerfile_layered_default = `{{#if includeTLS}}
461
+ # Get Caddy from official image
462
+ FROM caddy:2.10.2-alpine AS caddy
463
+ {{/if}}
464
+
465
+ FROM {{baseImage}}
466
+
467
+ {{#if originalUser}}
468
+ # Switch to root to perform setup (base image has non-root USER: {{originalUser}})
469
+ USER root
470
+ {{/if}}
471
+
472
+ # Copy core TEE components
473
+ COPY compute-source-env.sh /usr/local/bin/
474
+ COPY kms-client /usr/local/bin/
475
+ COPY kms-signing-public-key.pem /usr/local/bin/
476
+ {{#if includeDrainWatcher}}
477
+ COPY ecloud-drain-watcher /usr/local/bin/
478
+ {{/if}}
479
+
480
+ {{#if includeTLS}}
481
+ # Copy Caddy from official image
482
+ COPY --from=caddy /usr/bin/caddy /usr/local/bin/caddy
483
+
484
+ # Copy TLS components
485
+ COPY tls-keygen /usr/local/bin/
486
+ COPY Caddyfile /etc/caddy/
487
+ {{/if}}
488
+
489
+ {{#if originalUser}}
490
+ # Make binaries executable (755 for executables, 644 for keys)
491
+ RUN chmod 755 /usr/local/bin/compute-source-env.sh \\
492
+ && chmod 755 /usr/local/bin/kms-client{{#if includeDrainWatcher}} \\
493
+ && chmod 755 /usr/local/bin/ecloud-drain-watcher{{/if}}{{#if includeTLS}} \\
494
+ && chmod 755 /usr/local/bin/tls-keygen \\
495
+ && chmod 755 /usr/local/bin/caddy{{/if}} \\
496
+ && chmod 644 /usr/local/bin/kms-signing-public-key.pem
497
+
498
+ # Store original user - entrypoint will drop privileges to this user after TEE setup
499
+ ENV __ECLOUD_ORIGINAL_USER={{originalUser}}
500
+ {{else}}
501
+ # Make binaries executable (preserve existing permissions, just add execute)
502
+ RUN chmod +x /usr/local/bin/compute-source-env.sh \\
503
+ && chmod +x /usr/local/bin/kms-client{{#if includeDrainWatcher}} \\
504
+ && chmod +x /usr/local/bin/ecloud-drain-watcher{{/if}}{{#if includeTLS}} \\
505
+ && chmod +x /usr/local/bin/tls-keygen{{/if}}
506
+ {{/if}}
507
+
508
+ {{#if logRedirect}}
509
+
510
+ LABEL tee.launch_policy.log_redirect={{logRedirect}}
511
+ {{/if}}
512
+ {{#if resourceUsageAllow}}
513
+
514
+ LABEL tee.launch_policy.monitoring_memory_allow={{resourceUsageAllow}}
515
+ {{/if}}
516
+
517
+ # Allow-list the envvars the ecloud-platform sets via GCE \`tee-env-*\`
518
+ # metadata. Without this label, Confidential Space's launcher rejects
519
+ # any \`tee-env-*\` override at container-start with
520
+ # "env var {...} is not allowed to be overridden on this image" and
521
+ # exits with code 1 \u2014 which terminates the VM before the entrypoint
522
+ # ever runs. User-supplied env vars flow through KMS (not tee-env-*)
523
+ # and don't need to be listed here.
524
+ #
525
+ # Entries:
526
+ # - ECLOUD_PD_EXPECTED set on PD-backed apps so the entrypoint
527
+ # (compute-source-env.sh) knows to wait for
528
+ # the persistent disk before exec'ing the
529
+ # user workload.
530
+ # - ECLOUD_PLATFORM_HOST the platform-routed hostname
531
+ # (<addr>.<env>.eigencloud.xyz) so the
532
+ # entrypoint's setup_tls can issue an ACME
533
+ # cert for it. Injected by the CLI into
534
+ # publicEnv at deploy/upgrade time and
535
+ # propagated by ecloud-platform's
536
+ # compute.go as a tee-env-* metadata key.
537
+ #
538
+ # The CS launcher parses this label as a comma-separated list
539
+ # (go-tpm-tools/launcher/spec/launch_policy.go:185 \u2014 strings.Split
540
+ # on ","). Quotes are not required; keep the value bare for
541
+ # consistency with compute-tee's and eigenx-kms's existing labels.
542
+ LABEL tee.launch_policy.allow_env_override=ECLOUD_PD_EXPECTED,ECLOUD_PLATFORM_HOST
543
+
544
+ LABEL eigenx_cli_version={{ecloudCLIVersion}}
545
+ LABEL eigenx_vm_image=eigen
546
+ LABEL eigenx_container_contract=v1
547
+
548
+ {{#if includeTLS}}
549
+ # Expose both HTTP and HTTPS ports for Caddy
550
+ EXPOSE 80 443
551
+ {{/if}}
552
+
553
+ ENTRYPOINT ["/usr/local/bin/compute-source-env.sh"]
554
+ CMD {{{originalCmd}}}
555
+ `;
461
556
 
462
557
  // src/client/common/templates/dockerfileTemplate.ts
463
558
  function processDockerfileTemplate(data) {
@@ -1420,132 +1515,6 @@ async function encryptRSAOAEPAndAES256GCM(encryptionKeyPEM, plaintext, protected
1420
1515
  return jwe;
1421
1516
  }
1422
1517
 
1423
- // src/client/common/config/environment.ts
1424
- var SEPOLIA_CHAIN_ID = 11155111;
1425
- var MAINNET_CHAIN_ID = 1;
1426
- var CommonAddresses = {
1427
- ERC7702Delegator: "0x63c0c19a282a1b52b07dd5a65b58948a07dae32b"
1428
- };
1429
- var ChainAddresses = {
1430
- [MAINNET_CHAIN_ID]: {
1431
- PermissionController: "0x25E5F8B1E7aDf44518d35D5B2271f114e081f0E5"
1432
- },
1433
- [SEPOLIA_CHAIN_ID]: {
1434
- PermissionController: "0x44632dfBdCb6D3E21EF613B0ca8A6A0c618F5a37"
1435
- }
1436
- };
1437
- var PLATFORM_ENV_TESTNET_SEPOLIA = "testnet-sepolia";
1438
- var PLATFORM_ENV_MAINNET_ETHEREUM = "mainnet-ethereum";
1439
- var DEFAULT_APP_BASE_DOMAIN = "eigencloud.xyz";
1440
- var ENVIRONMENTS = {
1441
- "sepolia-dev": {
1442
- name: "sepolia",
1443
- build: "dev",
1444
- appControllerAddress: "0xa86DC1C47cb2518327fB4f9A1627F51966c83B92",
1445
- permissionControllerAddress: ChainAddresses[SEPOLIA_CHAIN_ID].PermissionController,
1446
- erc7702DelegatorAddress: CommonAddresses.ERC7702Delegator,
1447
- kmsServerURL: "http://10.128.0.57:8080",
1448
- userApiServerURL: "https://userapi-compute-sepolia-dev.eigencloud.xyz",
1449
- defaultRPCURL: "https://ethereum-sepolia-rpc.publicnode.com",
1450
- usdcCreditsAddress: "0xbdA3897c3A428763B59015C64AB766c288C97376",
1451
- platformEnv: PLATFORM_ENV_TESTNET_SEPOLIA,
1452
- appBaseDomain: DEFAULT_APP_BASE_DOMAIN
1453
- },
1454
- sepolia: {
1455
- name: "sepolia",
1456
- build: "prod",
1457
- appControllerAddress: "0x0dd810a6ffba6a9820a10d97b659f07d8d23d4E2",
1458
- permissionControllerAddress: ChainAddresses[SEPOLIA_CHAIN_ID].PermissionController,
1459
- erc7702DelegatorAddress: CommonAddresses.ERC7702Delegator,
1460
- kmsServerURL: "http://10.128.15.203:8080",
1461
- userApiServerURL: "https://userapi-compute-sepolia-prod.eigencloud.xyz",
1462
- defaultRPCURL: "https://ethereum-sepolia-rpc.publicnode.com",
1463
- billingRPCURL: "https://ethereum-rpc.publicnode.com",
1464
- usdcCreditsAddress: "0xed9c88640ca9149Bd9f7ee6620074af10F2E145d",
1465
- platformEnv: PLATFORM_ENV_TESTNET_SEPOLIA,
1466
- appBaseDomain: DEFAULT_APP_BASE_DOMAIN
1467
- },
1468
- "mainnet-alpha": {
1469
- name: "mainnet-alpha",
1470
- build: "prod",
1471
- appControllerAddress: "0xc38d35Fc995e75342A21CBd6D770305b142Fbe67",
1472
- permissionControllerAddress: ChainAddresses[MAINNET_CHAIN_ID].PermissionController,
1473
- erc7702DelegatorAddress: CommonAddresses.ERC7702Delegator,
1474
- kmsServerURL: "http://10.128.0.2:8080",
1475
- userApiServerURL: "https://userapi-compute.eigencloud.xyz",
1476
- defaultRPCURL: "https://ethereum-rpc.publicnode.com",
1477
- usdcCreditsAddress: "0xed9c88640ca9149Bd9f7ee6620074af10F2E145d",
1478
- platformEnv: PLATFORM_ENV_MAINNET_ETHEREUM,
1479
- appBaseDomain: DEFAULT_APP_BASE_DOMAIN
1480
- }
1481
- };
1482
- function derivePlatformHost(environmentConfig, appAddress) {
1483
- if (!environmentConfig.platformEnv || !environmentConfig.appBaseDomain) {
1484
- return "";
1485
- }
1486
- const addr = appAddress.toLowerCase().replace(/^0x/, "");
1487
- return `${addr}.${environmentConfig.platformEnv}.${environmentConfig.appBaseDomain}`;
1488
- }
1489
- var CHAIN_ID_TO_ENVIRONMENT = {
1490
- [SEPOLIA_CHAIN_ID.toString()]: "sepolia",
1491
- [MAINNET_CHAIN_ID.toString()]: "mainnet-alpha"
1492
- };
1493
- function getApiUrlOverride() {
1494
- const raw = process.env.ECLOUD_API_URL;
1495
- if (!raw) return void 0;
1496
- const trimmed = raw.trim().replace(/\/+$/, "");
1497
- return trimmed.length > 0 ? trimmed : void 0;
1498
- }
1499
- function getEnvironmentConfig(environment, chainID) {
1500
- const env = ENVIRONMENTS[environment];
1501
- if (!env) {
1502
- throw new Error(`Unknown environment: ${environment}`);
1503
- }
1504
- if (!isEnvironmentAvailable(environment)) {
1505
- throw new Error(
1506
- `Environment ${environment} is not available in this build type. Available environments: ${getAvailableEnvironments().join(", ")}`
1507
- );
1508
- }
1509
- if (chainID) {
1510
- const expectedEnv = CHAIN_ID_TO_ENVIRONMENT[chainID.toString()];
1511
- if (expectedEnv && expectedEnv !== environment) {
1512
- throw new Error(`Environment ${environment} does not match chain ID ${chainID}`);
1513
- }
1514
- }
1515
- const resolvedChainID = chainID || (environment === "sepolia" || environment === "sepolia-dev" ? SEPOLIA_CHAIN_ID : MAINNET_CHAIN_ID);
1516
- const apiUrlOverride = getApiUrlOverride();
1517
- return {
1518
- ...env,
1519
- chainID: BigInt(resolvedChainID),
1520
- ...apiUrlOverride ? { userApiServerURL: apiUrlOverride } : {},
1521
- ...process.env.ECLOUD_USER_API_URL && {
1522
- userApiServerURL: process.env.ECLOUD_USER_API_URL
1523
- },
1524
- ...process.env.ECLOUD_RPC_URL && {
1525
- defaultRPCURL: process.env.ECLOUD_RPC_URL
1526
- }
1527
- };
1528
- }
1529
- function getBuildType() {
1530
- const buildTimeType = true ? "dev"?.toLowerCase() : void 0;
1531
- const runtimeType = process.env.BUILD_TYPE?.toLowerCase();
1532
- const buildType = buildTimeType || runtimeType;
1533
- if (buildType === "dev") {
1534
- return "dev";
1535
- }
1536
- return "prod";
1537
- }
1538
- function getAvailableEnvironments() {
1539
- const buildType = getBuildType();
1540
- if (buildType === "dev") {
1541
- return ["sepolia-dev"];
1542
- }
1543
- return ["sepolia", "mainnet-alpha"];
1544
- }
1545
- function isEnvironmentAvailable(environment) {
1546
- return getAvailableEnvironments().includes(environment);
1547
- }
1548
-
1549
1518
  // src/client/common/env/parser.ts
1550
1519
  var fs2 = __toESM(require("fs"), 1);
1551
1520
  var MNEMONIC_ENV_VAR = "MNEMONIC";
@@ -1683,11 +1652,6 @@ Please verify the image exists: docker manifest inspect ${finalImageRef}`
1683
1652
  }
1684
1653
  publicEnv["EIGEN_MACHINE_TYPE_PUBLIC"] = instanceType;
1685
1654
  logger.info(`Instance type: ${instanceType}`);
1686
- const platformHost = derivePlatformHost(environmentConfig, options.appId);
1687
- if (platformHost !== "") {
1688
- publicEnv["ECLOUD_PLATFORM_HOST"] = platformHost;
1689
- logger.info(`Platform hostname: ${platformHost}`);
1690
- }
1691
1655
  logger.info("Encrypting environment variables...");
1692
1656
  const { encryptionKey } = getKMSKeysForEnvironment(
1693
1657
  environmentConfig.name,
@@ -5270,7 +5234,7 @@ var CanViewAppLogsPermission = "0x2fd3f2fe";
5270
5234
  var CanViewSensitiveAppInfoPermission = "0x0e67b22f";
5271
5235
  var CanUpdateAppProfilePermission = "0x036fef61";
5272
5236
  function getDefaultClientId() {
5273
- const version = true ? "1.0.0-devep3" : "0.0.0";
5237
+ const version = true ? "1.0.0-devep5" : "0.0.0";
5274
5238
  return `ecloud-sdk/v${version}`;
5275
5239
  }
5276
5240
  var UserApiClient = class {
@@ -5932,6 +5896,125 @@ function validateResourceUsageMonitoring(resourceUsageMonitoring) {
5932
5896
  }
5933
5897
  }
5934
5898
 
5899
+ // src/client/common/config/environment.ts
5900
+ var SEPOLIA_CHAIN_ID = 11155111;
5901
+ var MAINNET_CHAIN_ID = 1;
5902
+ var CommonAddresses = {
5903
+ ERC7702Delegator: "0x63c0c19a282a1b52b07dd5a65b58948a07dae32b"
5904
+ };
5905
+ var ChainAddresses = {
5906
+ [MAINNET_CHAIN_ID]: {
5907
+ PermissionController: "0x25E5F8B1E7aDf44518d35D5B2271f114e081f0E5"
5908
+ },
5909
+ [SEPOLIA_CHAIN_ID]: {
5910
+ PermissionController: "0x44632dfBdCb6D3E21EF613B0ca8A6A0c618F5a37"
5911
+ }
5912
+ };
5913
+ var PLATFORM_ENV_TESTNET_SEPOLIA = "testnet-sepolia";
5914
+ var PLATFORM_ENV_MAINNET_ETHEREUM = "mainnet-ethereum";
5915
+ var DEFAULT_APP_BASE_DOMAIN = "eigencloud.xyz";
5916
+ var ENVIRONMENTS = {
5917
+ "sepolia-dev": {
5918
+ name: "sepolia",
5919
+ build: "dev",
5920
+ appControllerAddress: "0xa86DC1C47cb2518327fB4f9A1627F51966c83B92",
5921
+ permissionControllerAddress: ChainAddresses[SEPOLIA_CHAIN_ID].PermissionController,
5922
+ erc7702DelegatorAddress: CommonAddresses.ERC7702Delegator,
5923
+ kmsServerURL: "http://10.128.0.57:8080",
5924
+ userApiServerURL: "https://userapi-compute-sepolia-dev.eigencloud.xyz",
5925
+ defaultRPCURL: "https://ethereum-sepolia-rpc.publicnode.com",
5926
+ usdcCreditsAddress: "0xbdA3897c3A428763B59015C64AB766c288C97376",
5927
+ platformEnv: PLATFORM_ENV_TESTNET_SEPOLIA,
5928
+ appBaseDomain: DEFAULT_APP_BASE_DOMAIN
5929
+ },
5930
+ sepolia: {
5931
+ name: "sepolia",
5932
+ build: "prod",
5933
+ appControllerAddress: "0x0dd810a6ffba6a9820a10d97b659f07d8d23d4E2",
5934
+ permissionControllerAddress: ChainAddresses[SEPOLIA_CHAIN_ID].PermissionController,
5935
+ erc7702DelegatorAddress: CommonAddresses.ERC7702Delegator,
5936
+ kmsServerURL: "http://10.128.15.203:8080",
5937
+ userApiServerURL: "https://userapi-compute-sepolia-prod.eigencloud.xyz",
5938
+ defaultRPCURL: "https://ethereum-sepolia-rpc.publicnode.com",
5939
+ billingRPCURL: "https://ethereum-rpc.publicnode.com",
5940
+ usdcCreditsAddress: "0xed9c88640ca9149Bd9f7ee6620074af10F2E145d",
5941
+ platformEnv: PLATFORM_ENV_TESTNET_SEPOLIA,
5942
+ appBaseDomain: DEFAULT_APP_BASE_DOMAIN
5943
+ },
5944
+ "mainnet-alpha": {
5945
+ name: "mainnet-alpha",
5946
+ build: "prod",
5947
+ appControllerAddress: "0xc38d35Fc995e75342A21CBd6D770305b142Fbe67",
5948
+ permissionControllerAddress: ChainAddresses[MAINNET_CHAIN_ID].PermissionController,
5949
+ erc7702DelegatorAddress: CommonAddresses.ERC7702Delegator,
5950
+ kmsServerURL: "http://10.128.0.2:8080",
5951
+ userApiServerURL: "https://userapi-compute.eigencloud.xyz",
5952
+ defaultRPCURL: "https://ethereum-rpc.publicnode.com",
5953
+ usdcCreditsAddress: "0xed9c88640ca9149Bd9f7ee6620074af10F2E145d",
5954
+ platformEnv: PLATFORM_ENV_MAINNET_ETHEREUM,
5955
+ appBaseDomain: DEFAULT_APP_BASE_DOMAIN
5956
+ }
5957
+ };
5958
+ var CHAIN_ID_TO_ENVIRONMENT = {
5959
+ [SEPOLIA_CHAIN_ID.toString()]: "sepolia",
5960
+ [MAINNET_CHAIN_ID.toString()]: "mainnet-alpha"
5961
+ };
5962
+ function getApiUrlOverride() {
5963
+ const raw = process.env.ECLOUD_API_URL;
5964
+ if (!raw) return void 0;
5965
+ const trimmed = raw.trim().replace(/\/+$/, "");
5966
+ return trimmed.length > 0 ? trimmed : void 0;
5967
+ }
5968
+ function getEnvironmentConfig(environment, chainID) {
5969
+ const env = ENVIRONMENTS[environment];
5970
+ if (!env) {
5971
+ throw new Error(`Unknown environment: ${environment}`);
5972
+ }
5973
+ if (!isEnvironmentAvailable(environment)) {
5974
+ throw new Error(
5975
+ `Environment ${environment} is not available in this build type. Available environments: ${getAvailableEnvironments().join(", ")}`
5976
+ );
5977
+ }
5978
+ if (chainID) {
5979
+ const expectedEnv = CHAIN_ID_TO_ENVIRONMENT[chainID.toString()];
5980
+ if (expectedEnv && expectedEnv !== environment) {
5981
+ throw new Error(`Environment ${environment} does not match chain ID ${chainID}`);
5982
+ }
5983
+ }
5984
+ const resolvedChainID = chainID || (environment === "sepolia" || environment === "sepolia-dev" ? SEPOLIA_CHAIN_ID : MAINNET_CHAIN_ID);
5985
+ const apiUrlOverride = getApiUrlOverride();
5986
+ return {
5987
+ ...env,
5988
+ chainID: BigInt(resolvedChainID),
5989
+ ...apiUrlOverride ? { userApiServerURL: apiUrlOverride } : {},
5990
+ ...process.env.ECLOUD_USER_API_URL && {
5991
+ userApiServerURL: process.env.ECLOUD_USER_API_URL
5992
+ },
5993
+ ...process.env.ECLOUD_RPC_URL && {
5994
+ defaultRPCURL: process.env.ECLOUD_RPC_URL
5995
+ }
5996
+ };
5997
+ }
5998
+ function getBuildType() {
5999
+ const buildTimeType = true ? "dev"?.toLowerCase() : void 0;
6000
+ const runtimeType = process.env.BUILD_TYPE?.toLowerCase();
6001
+ const buildType = buildTimeType || runtimeType;
6002
+ if (buildType === "dev") {
6003
+ return "dev";
6004
+ }
6005
+ return "prod";
6006
+ }
6007
+ function getAvailableEnvironments() {
6008
+ const buildType = getBuildType();
6009
+ if (buildType === "dev") {
6010
+ return ["sepolia-dev"];
6011
+ }
6012
+ return ["sepolia", "mainnet-alpha"];
6013
+ }
6014
+ function isEnvironmentAvailable(environment) {
6015
+ return getAvailableEnvironments().includes(environment);
6016
+ }
6017
+
5935
6018
  // src/client/common/utils/preflight.ts
5936
6019
  async function doPreflightChecks(options, logger) {
5937
6020
  const { walletClient, publicClient } = options;