@layr-labs/ecloud-sdk 1.0.0-devep4 → 1.0.0-devep6
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/browser.cjs +1 -1
- package/dist/browser.js +1 -1
- package/dist/compute.cjs +140 -192
- package/dist/compute.cjs.map +1 -1
- package/dist/compute.js +140 -192
- package/dist/compute.js.map +1 -1
- package/dist/index.cjs +167 -219
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +167 -219
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/VERSION
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
version=1.0.0-
|
|
2
|
-
commit=
|
|
1
|
+
version=1.0.0-devep6
|
|
2
|
+
commit=c4598644993dd4f7eac47847d2ffb1f699240dbc
|
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-
|
|
752
|
+
const version = true ? "1.0.0-devep6" : "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-
|
|
641
|
+
const version = true ? "1.0.0-devep6" : "0.0.0";
|
|
642
642
|
return `ecloud-sdk/v${version}`;
|
|
643
643
|
}
|
|
644
644
|
var UserApiClient = class {
|
package/dist/compute.cjs
CHANGED
|
@@ -627,45 +627,6 @@ else
|
|
|
627
627
|
exit 1
|
|
628
628
|
fi
|
|
629
629
|
|
|
630
|
-
# dns_points_here returns 0 if $1 resolves (A record) to our external
|
|
631
|
-
# IPv4. Used to gate ACME on DNS being wired before we start burning
|
|
632
|
-
# Let's Encrypt's 5-cert-per-domain-per-week rate limit. Returns 1 on
|
|
633
|
-
# any failure (tool missing, lookup error, mismatch) so callers treat
|
|
634
|
-
# "I can't tell" the same as "not ready yet".
|
|
635
|
-
dns_points_here() {
|
|
636
|
-
local host="$1"
|
|
637
|
-
local external_ip
|
|
638
|
-
# GCE metadata is always reachable from a VM on GCE. The
|
|
639
|
-
# alternative (dig OPT CHAOS to an upstream) adds a dependency;
|
|
640
|
-
# the metadata server is already a hard prereq for KMS auth above.
|
|
641
|
-
external_ip="$(curl -fsS -H 'Metadata-Flavor: Google' \\
|
|
642
|
-
'http://metadata.google.internal/computeMetadata/v1/instance/network-interfaces/0/access-configs/0/external-ip' 2>/dev/null || true)"
|
|
643
|
-
if [ -z "$external_ip" ]; then
|
|
644
|
-
echo "compute-source-env.sh: DNS precheck for $host skipped: no external IP from metadata"
|
|
645
|
-
return 1
|
|
646
|
-
fi
|
|
647
|
-
local resolved
|
|
648
|
-
if command -v getent >/dev/null 2>&1; then
|
|
649
|
-
resolved="$(getent ahostsv4 "$host" 2>/dev/null | awk 'NR==1{print $1}')"
|
|
650
|
-
elif command -v host >/dev/null 2>&1; then
|
|
651
|
-
resolved="$(host -t A "$host" 2>/dev/null | awk '/has address/{print $4; exit}')"
|
|
652
|
-
elif command -v dig >/dev/null 2>&1; then
|
|
653
|
-
resolved="$(dig +short A "$host" 2>/dev/null | awk 'NR==1{print}')"
|
|
654
|
-
else
|
|
655
|
-
echo "compute-source-env.sh: DNS precheck for $host skipped: no resolver tool available"
|
|
656
|
-
return 1
|
|
657
|
-
fi
|
|
658
|
-
if [ -z "$resolved" ]; then
|
|
659
|
-
echo "compute-source-env.sh: DNS precheck: $host has no A record yet"
|
|
660
|
-
return 1
|
|
661
|
-
fi
|
|
662
|
-
if [ "$resolved" != "$external_ip" ]; then
|
|
663
|
-
echo "compute-source-env.sh: DNS precheck: $host resolves to $resolved but this VM is $external_ip"
|
|
664
|
-
return 1
|
|
665
|
-
fi
|
|
666
|
-
return 0
|
|
667
|
-
}
|
|
668
|
-
|
|
669
630
|
# issue_cert_for runs tls-keygen for a single hostname and copies the
|
|
670
631
|
# produced fullchain/privkey into $1's output directory ($2). Returns
|
|
671
632
|
# 0 on success, non-zero on any failure (caller decides whether that's
|
|
@@ -697,9 +658,16 @@ issue_cert_for() {
|
|
|
697
658
|
# - ECLOUD_PLATFORM_HOST (platform-routed <addr>.<env>.eigencloud.xyz),
|
|
698
659
|
# when the CLI/platform has set it
|
|
699
660
|
# - DOMAIN (user-supplied custom domain), when set and non-localhost
|
|
700
|
-
#
|
|
701
|
-
#
|
|
702
|
-
#
|
|
661
|
+
#
|
|
662
|
+
# No client-side DNS precheck. Earlier versions tried to gate ACME on
|
|
663
|
+
# "does this hostname resolve to my external IP" but that's wrong for
|
|
664
|
+
# the platform-routing model (DNS points at the shared nginx NLB, not
|
|
665
|
+
# the VM) and was preventing cert issuance on the production path.
|
|
666
|
+
# tls-client (eigencompute-containers/tls-client) does its own DNS
|
|
667
|
+
# poll before calling ACME and surfaces a clear error when challenges
|
|
668
|
+
# can't reach the VM, which is the right place for that check \u2014
|
|
669
|
+
# attempting it here from inside the VM cannot tell platform-routed
|
|
670
|
+
# from compute-tee-routed apps.
|
|
703
671
|
setup_tls() {
|
|
704
672
|
# If tls-keygen isn't present, TLS wasn't configured during build
|
|
705
673
|
if [ ! -x /usr/local/bin/tls-keygen ]; then
|
|
@@ -758,30 +726,22 @@ setup_tls() {
|
|
|
758
726
|
local certs_issued=0
|
|
759
727
|
|
|
760
728
|
if [ -n "$platform_host" ]; then
|
|
761
|
-
if
|
|
762
|
-
|
|
763
|
-
certs_issued=$((certs_issued + 1))
|
|
764
|
-
else
|
|
765
|
-
echo "compute-source-env.sh: ERROR - failed to issue cert for platform host $platform_host"
|
|
766
|
-
echo "ECLOUD_FAIL tls_setup"
|
|
767
|
-
exit 1
|
|
768
|
-
fi
|
|
729
|
+
if issue_cert_for "$platform_host" "/run/tls/platform" "$mnemonic" "$challenge" "$staging_flag"; then
|
|
730
|
+
certs_issued=$((certs_issued + 1))
|
|
769
731
|
else
|
|
770
|
-
echo "compute-source-env.sh:
|
|
732
|
+
echo "compute-source-env.sh: ERROR - failed to issue cert for platform host $platform_host"
|
|
733
|
+
echo "ECLOUD_FAIL tls_setup"
|
|
734
|
+
exit 1
|
|
771
735
|
fi
|
|
772
736
|
fi
|
|
773
737
|
|
|
774
738
|
if [ -n "$user_domain" ]; then
|
|
775
|
-
if
|
|
776
|
-
|
|
777
|
-
certs_issued=$((certs_issued + 1))
|
|
778
|
-
else
|
|
779
|
-
echo "compute-source-env.sh: ERROR - failed to issue cert for user domain $user_domain"
|
|
780
|
-
echo "ECLOUD_FAIL tls_setup"
|
|
781
|
-
exit 1
|
|
782
|
-
fi
|
|
739
|
+
if issue_cert_for "$user_domain" "/run/tls/domain" "$mnemonic" "$challenge" "$staging_flag"; then
|
|
740
|
+
certs_issued=$((certs_issued + 1))
|
|
783
741
|
else
|
|
784
|
-
echo "compute-source-env.sh:
|
|
742
|
+
echo "compute-source-env.sh: ERROR - failed to issue cert for user domain $user_domain"
|
|
743
|
+
echo "ECLOUD_FAIL tls_setup"
|
|
744
|
+
exit 1
|
|
785
745
|
fi
|
|
786
746
|
fi
|
|
787
747
|
|
|
@@ -1515,132 +1475,6 @@ async function encryptRSAOAEPAndAES256GCM(encryptionKeyPEM, plaintext, protected
|
|
|
1515
1475
|
return jwe;
|
|
1516
1476
|
}
|
|
1517
1477
|
|
|
1518
|
-
// src/client/common/config/environment.ts
|
|
1519
|
-
var SEPOLIA_CHAIN_ID = 11155111;
|
|
1520
|
-
var MAINNET_CHAIN_ID = 1;
|
|
1521
|
-
var CommonAddresses = {
|
|
1522
|
-
ERC7702Delegator: "0x63c0c19a282a1b52b07dd5a65b58948a07dae32b"
|
|
1523
|
-
};
|
|
1524
|
-
var ChainAddresses = {
|
|
1525
|
-
[MAINNET_CHAIN_ID]: {
|
|
1526
|
-
PermissionController: "0x25E5F8B1E7aDf44518d35D5B2271f114e081f0E5"
|
|
1527
|
-
},
|
|
1528
|
-
[SEPOLIA_CHAIN_ID]: {
|
|
1529
|
-
PermissionController: "0x44632dfBdCb6D3E21EF613B0ca8A6A0c618F5a37"
|
|
1530
|
-
}
|
|
1531
|
-
};
|
|
1532
|
-
var PLATFORM_ENV_TESTNET_SEPOLIA = "testnet-sepolia";
|
|
1533
|
-
var PLATFORM_ENV_MAINNET_ETHEREUM = "mainnet-ethereum";
|
|
1534
|
-
var DEFAULT_APP_BASE_DOMAIN = "eigencloud.xyz";
|
|
1535
|
-
var ENVIRONMENTS = {
|
|
1536
|
-
"sepolia-dev": {
|
|
1537
|
-
name: "sepolia",
|
|
1538
|
-
build: "dev",
|
|
1539
|
-
appControllerAddress: "0xa86DC1C47cb2518327fB4f9A1627F51966c83B92",
|
|
1540
|
-
permissionControllerAddress: ChainAddresses[SEPOLIA_CHAIN_ID].PermissionController,
|
|
1541
|
-
erc7702DelegatorAddress: CommonAddresses.ERC7702Delegator,
|
|
1542
|
-
kmsServerURL: "http://10.128.0.57:8080",
|
|
1543
|
-
userApiServerURL: "https://userapi-compute-sepolia-dev.eigencloud.xyz",
|
|
1544
|
-
defaultRPCURL: "https://ethereum-sepolia-rpc.publicnode.com",
|
|
1545
|
-
usdcCreditsAddress: "0xbdA3897c3A428763B59015C64AB766c288C97376",
|
|
1546
|
-
platformEnv: PLATFORM_ENV_TESTNET_SEPOLIA,
|
|
1547
|
-
appBaseDomain: DEFAULT_APP_BASE_DOMAIN
|
|
1548
|
-
},
|
|
1549
|
-
sepolia: {
|
|
1550
|
-
name: "sepolia",
|
|
1551
|
-
build: "prod",
|
|
1552
|
-
appControllerAddress: "0x0dd810a6ffba6a9820a10d97b659f07d8d23d4E2",
|
|
1553
|
-
permissionControllerAddress: ChainAddresses[SEPOLIA_CHAIN_ID].PermissionController,
|
|
1554
|
-
erc7702DelegatorAddress: CommonAddresses.ERC7702Delegator,
|
|
1555
|
-
kmsServerURL: "http://10.128.15.203:8080",
|
|
1556
|
-
userApiServerURL: "https://userapi-compute-sepolia-prod.eigencloud.xyz",
|
|
1557
|
-
defaultRPCURL: "https://ethereum-sepolia-rpc.publicnode.com",
|
|
1558
|
-
billingRPCURL: "https://ethereum-rpc.publicnode.com",
|
|
1559
|
-
usdcCreditsAddress: "0xed9c88640ca9149Bd9f7ee6620074af10F2E145d",
|
|
1560
|
-
platformEnv: PLATFORM_ENV_TESTNET_SEPOLIA,
|
|
1561
|
-
appBaseDomain: DEFAULT_APP_BASE_DOMAIN
|
|
1562
|
-
},
|
|
1563
|
-
"mainnet-alpha": {
|
|
1564
|
-
name: "mainnet-alpha",
|
|
1565
|
-
build: "prod",
|
|
1566
|
-
appControllerAddress: "0xc38d35Fc995e75342A21CBd6D770305b142Fbe67",
|
|
1567
|
-
permissionControllerAddress: ChainAddresses[MAINNET_CHAIN_ID].PermissionController,
|
|
1568
|
-
erc7702DelegatorAddress: CommonAddresses.ERC7702Delegator,
|
|
1569
|
-
kmsServerURL: "http://10.128.0.2:8080",
|
|
1570
|
-
userApiServerURL: "https://userapi-compute.eigencloud.xyz",
|
|
1571
|
-
defaultRPCURL: "https://ethereum-rpc.publicnode.com",
|
|
1572
|
-
usdcCreditsAddress: "0xed9c88640ca9149Bd9f7ee6620074af10F2E145d",
|
|
1573
|
-
platformEnv: PLATFORM_ENV_MAINNET_ETHEREUM,
|
|
1574
|
-
appBaseDomain: DEFAULT_APP_BASE_DOMAIN
|
|
1575
|
-
}
|
|
1576
|
-
};
|
|
1577
|
-
function derivePlatformHost(environmentConfig, appAddress) {
|
|
1578
|
-
if (!environmentConfig.platformEnv || !environmentConfig.appBaseDomain) {
|
|
1579
|
-
return "";
|
|
1580
|
-
}
|
|
1581
|
-
const addr = appAddress.toLowerCase().replace(/^0x/, "");
|
|
1582
|
-
return `${addr}.${environmentConfig.platformEnv}.${environmentConfig.appBaseDomain}`;
|
|
1583
|
-
}
|
|
1584
|
-
var CHAIN_ID_TO_ENVIRONMENT = {
|
|
1585
|
-
[SEPOLIA_CHAIN_ID.toString()]: "sepolia",
|
|
1586
|
-
[MAINNET_CHAIN_ID.toString()]: "mainnet-alpha"
|
|
1587
|
-
};
|
|
1588
|
-
function getApiUrlOverride() {
|
|
1589
|
-
const raw = process.env.ECLOUD_API_URL;
|
|
1590
|
-
if (!raw) return void 0;
|
|
1591
|
-
const trimmed = raw.trim().replace(/\/+$/, "");
|
|
1592
|
-
return trimmed.length > 0 ? trimmed : void 0;
|
|
1593
|
-
}
|
|
1594
|
-
function getEnvironmentConfig(environment, chainID) {
|
|
1595
|
-
const env = ENVIRONMENTS[environment];
|
|
1596
|
-
if (!env) {
|
|
1597
|
-
throw new Error(`Unknown environment: ${environment}`);
|
|
1598
|
-
}
|
|
1599
|
-
if (!isEnvironmentAvailable(environment)) {
|
|
1600
|
-
throw new Error(
|
|
1601
|
-
`Environment ${environment} is not available in this build type. Available environments: ${getAvailableEnvironments().join(", ")}`
|
|
1602
|
-
);
|
|
1603
|
-
}
|
|
1604
|
-
if (chainID) {
|
|
1605
|
-
const expectedEnv = CHAIN_ID_TO_ENVIRONMENT[chainID.toString()];
|
|
1606
|
-
if (expectedEnv && expectedEnv !== environment) {
|
|
1607
|
-
throw new Error(`Environment ${environment} does not match chain ID ${chainID}`);
|
|
1608
|
-
}
|
|
1609
|
-
}
|
|
1610
|
-
const resolvedChainID = chainID || (environment === "sepolia" || environment === "sepolia-dev" ? SEPOLIA_CHAIN_ID : MAINNET_CHAIN_ID);
|
|
1611
|
-
const apiUrlOverride = getApiUrlOverride();
|
|
1612
|
-
return {
|
|
1613
|
-
...env,
|
|
1614
|
-
chainID: BigInt(resolvedChainID),
|
|
1615
|
-
...apiUrlOverride ? { userApiServerURL: apiUrlOverride } : {},
|
|
1616
|
-
...process.env.ECLOUD_USER_API_URL && {
|
|
1617
|
-
userApiServerURL: process.env.ECLOUD_USER_API_URL
|
|
1618
|
-
},
|
|
1619
|
-
...process.env.ECLOUD_RPC_URL && {
|
|
1620
|
-
defaultRPCURL: process.env.ECLOUD_RPC_URL
|
|
1621
|
-
}
|
|
1622
|
-
};
|
|
1623
|
-
}
|
|
1624
|
-
function getBuildType() {
|
|
1625
|
-
const buildTimeType = true ? "dev"?.toLowerCase() : void 0;
|
|
1626
|
-
const runtimeType = process.env.BUILD_TYPE?.toLowerCase();
|
|
1627
|
-
const buildType = buildTimeType || runtimeType;
|
|
1628
|
-
if (buildType === "dev") {
|
|
1629
|
-
return "dev";
|
|
1630
|
-
}
|
|
1631
|
-
return "prod";
|
|
1632
|
-
}
|
|
1633
|
-
function getAvailableEnvironments() {
|
|
1634
|
-
const buildType = getBuildType();
|
|
1635
|
-
if (buildType === "dev") {
|
|
1636
|
-
return ["sepolia-dev"];
|
|
1637
|
-
}
|
|
1638
|
-
return ["sepolia", "mainnet-alpha"];
|
|
1639
|
-
}
|
|
1640
|
-
function isEnvironmentAvailable(environment) {
|
|
1641
|
-
return getAvailableEnvironments().includes(environment);
|
|
1642
|
-
}
|
|
1643
|
-
|
|
1644
1478
|
// src/client/common/env/parser.ts
|
|
1645
1479
|
var fs2 = __toESM(require("fs"), 1);
|
|
1646
1480
|
var MNEMONIC_ENV_VAR = "MNEMONIC";
|
|
@@ -1778,11 +1612,6 @@ Please verify the image exists: docker manifest inspect ${finalImageRef}`
|
|
|
1778
1612
|
}
|
|
1779
1613
|
publicEnv["EIGEN_MACHINE_TYPE_PUBLIC"] = instanceType;
|
|
1780
1614
|
logger.info(`Instance type: ${instanceType}`);
|
|
1781
|
-
const platformHost = derivePlatformHost(environmentConfig, options.appId);
|
|
1782
|
-
if (platformHost !== "") {
|
|
1783
|
-
publicEnv["ECLOUD_PLATFORM_HOST"] = platformHost;
|
|
1784
|
-
logger.info(`Platform hostname: ${platformHost}`);
|
|
1785
|
-
}
|
|
1786
1615
|
logger.info("Encrypting environment variables...");
|
|
1787
1616
|
const { encryptionKey } = getKMSKeysForEnvironment(
|
|
1788
1617
|
environmentConfig.name,
|
|
@@ -5365,7 +5194,7 @@ var CanViewAppLogsPermission = "0x2fd3f2fe";
|
|
|
5365
5194
|
var CanViewSensitiveAppInfoPermission = "0x0e67b22f";
|
|
5366
5195
|
var CanUpdateAppProfilePermission = "0x036fef61";
|
|
5367
5196
|
function getDefaultClientId() {
|
|
5368
|
-
const version = true ? "1.0.0-
|
|
5197
|
+
const version = true ? "1.0.0-devep6" : "0.0.0";
|
|
5369
5198
|
return `ecloud-sdk/v${version}`;
|
|
5370
5199
|
}
|
|
5371
5200
|
var UserApiClient = class {
|
|
@@ -6027,6 +5856,125 @@ function validateResourceUsageMonitoring(resourceUsageMonitoring) {
|
|
|
6027
5856
|
}
|
|
6028
5857
|
}
|
|
6029
5858
|
|
|
5859
|
+
// src/client/common/config/environment.ts
|
|
5860
|
+
var SEPOLIA_CHAIN_ID = 11155111;
|
|
5861
|
+
var MAINNET_CHAIN_ID = 1;
|
|
5862
|
+
var CommonAddresses = {
|
|
5863
|
+
ERC7702Delegator: "0x63c0c19a282a1b52b07dd5a65b58948a07dae32b"
|
|
5864
|
+
};
|
|
5865
|
+
var ChainAddresses = {
|
|
5866
|
+
[MAINNET_CHAIN_ID]: {
|
|
5867
|
+
PermissionController: "0x25E5F8B1E7aDf44518d35D5B2271f114e081f0E5"
|
|
5868
|
+
},
|
|
5869
|
+
[SEPOLIA_CHAIN_ID]: {
|
|
5870
|
+
PermissionController: "0x44632dfBdCb6D3E21EF613B0ca8A6A0c618F5a37"
|
|
5871
|
+
}
|
|
5872
|
+
};
|
|
5873
|
+
var PLATFORM_ENV_TESTNET_SEPOLIA = "testnet-sepolia";
|
|
5874
|
+
var PLATFORM_ENV_MAINNET_ETHEREUM = "mainnet-ethereum";
|
|
5875
|
+
var DEFAULT_APP_BASE_DOMAIN = "eigencloud.xyz";
|
|
5876
|
+
var ENVIRONMENTS = {
|
|
5877
|
+
"sepolia-dev": {
|
|
5878
|
+
name: "sepolia",
|
|
5879
|
+
build: "dev",
|
|
5880
|
+
appControllerAddress: "0xa86DC1C47cb2518327fB4f9A1627F51966c83B92",
|
|
5881
|
+
permissionControllerAddress: ChainAddresses[SEPOLIA_CHAIN_ID].PermissionController,
|
|
5882
|
+
erc7702DelegatorAddress: CommonAddresses.ERC7702Delegator,
|
|
5883
|
+
kmsServerURL: "http://10.128.0.57:8080",
|
|
5884
|
+
userApiServerURL: "https://userapi-compute-sepolia-dev.eigencloud.xyz",
|
|
5885
|
+
defaultRPCURL: "https://ethereum-sepolia-rpc.publicnode.com",
|
|
5886
|
+
usdcCreditsAddress: "0xbdA3897c3A428763B59015C64AB766c288C97376",
|
|
5887
|
+
platformEnv: PLATFORM_ENV_TESTNET_SEPOLIA,
|
|
5888
|
+
appBaseDomain: DEFAULT_APP_BASE_DOMAIN
|
|
5889
|
+
},
|
|
5890
|
+
sepolia: {
|
|
5891
|
+
name: "sepolia",
|
|
5892
|
+
build: "prod",
|
|
5893
|
+
appControllerAddress: "0x0dd810a6ffba6a9820a10d97b659f07d8d23d4E2",
|
|
5894
|
+
permissionControllerAddress: ChainAddresses[SEPOLIA_CHAIN_ID].PermissionController,
|
|
5895
|
+
erc7702DelegatorAddress: CommonAddresses.ERC7702Delegator,
|
|
5896
|
+
kmsServerURL: "http://10.128.15.203:8080",
|
|
5897
|
+
userApiServerURL: "https://userapi-compute-sepolia-prod.eigencloud.xyz",
|
|
5898
|
+
defaultRPCURL: "https://ethereum-sepolia-rpc.publicnode.com",
|
|
5899
|
+
billingRPCURL: "https://ethereum-rpc.publicnode.com",
|
|
5900
|
+
usdcCreditsAddress: "0xed9c88640ca9149Bd9f7ee6620074af10F2E145d",
|
|
5901
|
+
platformEnv: PLATFORM_ENV_TESTNET_SEPOLIA,
|
|
5902
|
+
appBaseDomain: DEFAULT_APP_BASE_DOMAIN
|
|
5903
|
+
},
|
|
5904
|
+
"mainnet-alpha": {
|
|
5905
|
+
name: "mainnet-alpha",
|
|
5906
|
+
build: "prod",
|
|
5907
|
+
appControllerAddress: "0xc38d35Fc995e75342A21CBd6D770305b142Fbe67",
|
|
5908
|
+
permissionControllerAddress: ChainAddresses[MAINNET_CHAIN_ID].PermissionController,
|
|
5909
|
+
erc7702DelegatorAddress: CommonAddresses.ERC7702Delegator,
|
|
5910
|
+
kmsServerURL: "http://10.128.0.2:8080",
|
|
5911
|
+
userApiServerURL: "https://userapi-compute.eigencloud.xyz",
|
|
5912
|
+
defaultRPCURL: "https://ethereum-rpc.publicnode.com",
|
|
5913
|
+
usdcCreditsAddress: "0xed9c88640ca9149Bd9f7ee6620074af10F2E145d",
|
|
5914
|
+
platformEnv: PLATFORM_ENV_MAINNET_ETHEREUM,
|
|
5915
|
+
appBaseDomain: DEFAULT_APP_BASE_DOMAIN
|
|
5916
|
+
}
|
|
5917
|
+
};
|
|
5918
|
+
var CHAIN_ID_TO_ENVIRONMENT = {
|
|
5919
|
+
[SEPOLIA_CHAIN_ID.toString()]: "sepolia",
|
|
5920
|
+
[MAINNET_CHAIN_ID.toString()]: "mainnet-alpha"
|
|
5921
|
+
};
|
|
5922
|
+
function getApiUrlOverride() {
|
|
5923
|
+
const raw = process.env.ECLOUD_API_URL;
|
|
5924
|
+
if (!raw) return void 0;
|
|
5925
|
+
const trimmed = raw.trim().replace(/\/+$/, "");
|
|
5926
|
+
return trimmed.length > 0 ? trimmed : void 0;
|
|
5927
|
+
}
|
|
5928
|
+
function getEnvironmentConfig(environment, chainID) {
|
|
5929
|
+
const env = ENVIRONMENTS[environment];
|
|
5930
|
+
if (!env) {
|
|
5931
|
+
throw new Error(`Unknown environment: ${environment}`);
|
|
5932
|
+
}
|
|
5933
|
+
if (!isEnvironmentAvailable(environment)) {
|
|
5934
|
+
throw new Error(
|
|
5935
|
+
`Environment ${environment} is not available in this build type. Available environments: ${getAvailableEnvironments().join(", ")}`
|
|
5936
|
+
);
|
|
5937
|
+
}
|
|
5938
|
+
if (chainID) {
|
|
5939
|
+
const expectedEnv = CHAIN_ID_TO_ENVIRONMENT[chainID.toString()];
|
|
5940
|
+
if (expectedEnv && expectedEnv !== environment) {
|
|
5941
|
+
throw new Error(`Environment ${environment} does not match chain ID ${chainID}`);
|
|
5942
|
+
}
|
|
5943
|
+
}
|
|
5944
|
+
const resolvedChainID = chainID || (environment === "sepolia" || environment === "sepolia-dev" ? SEPOLIA_CHAIN_ID : MAINNET_CHAIN_ID);
|
|
5945
|
+
const apiUrlOverride = getApiUrlOverride();
|
|
5946
|
+
return {
|
|
5947
|
+
...env,
|
|
5948
|
+
chainID: BigInt(resolvedChainID),
|
|
5949
|
+
...apiUrlOverride ? { userApiServerURL: apiUrlOverride } : {},
|
|
5950
|
+
...process.env.ECLOUD_USER_API_URL && {
|
|
5951
|
+
userApiServerURL: process.env.ECLOUD_USER_API_URL
|
|
5952
|
+
},
|
|
5953
|
+
...process.env.ECLOUD_RPC_URL && {
|
|
5954
|
+
defaultRPCURL: process.env.ECLOUD_RPC_URL
|
|
5955
|
+
}
|
|
5956
|
+
};
|
|
5957
|
+
}
|
|
5958
|
+
function getBuildType() {
|
|
5959
|
+
const buildTimeType = true ? "dev"?.toLowerCase() : void 0;
|
|
5960
|
+
const runtimeType = process.env.BUILD_TYPE?.toLowerCase();
|
|
5961
|
+
const buildType = buildTimeType || runtimeType;
|
|
5962
|
+
if (buildType === "dev") {
|
|
5963
|
+
return "dev";
|
|
5964
|
+
}
|
|
5965
|
+
return "prod";
|
|
5966
|
+
}
|
|
5967
|
+
function getAvailableEnvironments() {
|
|
5968
|
+
const buildType = getBuildType();
|
|
5969
|
+
if (buildType === "dev") {
|
|
5970
|
+
return ["sepolia-dev"];
|
|
5971
|
+
}
|
|
5972
|
+
return ["sepolia", "mainnet-alpha"];
|
|
5973
|
+
}
|
|
5974
|
+
function isEnvironmentAvailable(environment) {
|
|
5975
|
+
return getAvailableEnvironments().includes(environment);
|
|
5976
|
+
}
|
|
5977
|
+
|
|
6030
5978
|
// src/client/common/utils/preflight.ts
|
|
6031
5979
|
async function doPreflightChecks(options, logger) {
|
|
6032
5980
|
const { walletClient, publicClient } = options;
|