@layr-labs/ecloud-sdk 1.0.0-devep2 → 1.0.0-devep4

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/browser.cjs CHANGED
@@ -290,6 +290,9 @@ var BILLING_ENVIRONMENTS = {
290
290
  billingApiServerURL: "https://billingapi.eigencloud.xyz"
291
291
  }
292
292
  };
293
+ var PLATFORM_ENV_TESTNET_SEPOLIA = "testnet-sepolia";
294
+ var PLATFORM_ENV_MAINNET_ETHEREUM = "mainnet-ethereum";
295
+ var DEFAULT_APP_BASE_DOMAIN = "eigencloud.xyz";
293
296
  var ENVIRONMENTS = {
294
297
  "sepolia-dev": {
295
298
  name: "sepolia",
@@ -300,7 +303,9 @@ var ENVIRONMENTS = {
300
303
  kmsServerURL: "http://10.128.0.57:8080",
301
304
  userApiServerURL: "https://userapi-compute-sepolia-dev.eigencloud.xyz",
302
305
  defaultRPCURL: "https://ethereum-sepolia-rpc.publicnode.com",
303
- usdcCreditsAddress: "0xbdA3897c3A428763B59015C64AB766c288C97376"
306
+ usdcCreditsAddress: "0xbdA3897c3A428763B59015C64AB766c288C97376",
307
+ platformEnv: PLATFORM_ENV_TESTNET_SEPOLIA,
308
+ appBaseDomain: DEFAULT_APP_BASE_DOMAIN
304
309
  },
305
310
  sepolia: {
306
311
  name: "sepolia",
@@ -312,7 +317,9 @@ var ENVIRONMENTS = {
312
317
  userApiServerURL: "https://userapi-compute-sepolia-prod.eigencloud.xyz",
313
318
  defaultRPCURL: "https://ethereum-sepolia-rpc.publicnode.com",
314
319
  billingRPCURL: "https://ethereum-rpc.publicnode.com",
315
- usdcCreditsAddress: "0xed9c88640ca9149Bd9f7ee6620074af10F2E145d"
320
+ usdcCreditsAddress: "0xed9c88640ca9149Bd9f7ee6620074af10F2E145d",
321
+ platformEnv: PLATFORM_ENV_TESTNET_SEPOLIA,
322
+ appBaseDomain: DEFAULT_APP_BASE_DOMAIN
316
323
  },
317
324
  "mainnet-alpha": {
318
325
  name: "mainnet-alpha",
@@ -323,7 +330,9 @@ var ENVIRONMENTS = {
323
330
  kmsServerURL: "http://10.128.0.2:8080",
324
331
  userApiServerURL: "https://userapi-compute.eigencloud.xyz",
325
332
  defaultRPCURL: "https://ethereum-rpc.publicnode.com",
326
- usdcCreditsAddress: "0xed9c88640ca9149Bd9f7ee6620074af10F2E145d"
333
+ usdcCreditsAddress: "0xed9c88640ca9149Bd9f7ee6620074af10F2E145d",
334
+ platformEnv: PLATFORM_ENV_MAINNET_ETHEREUM,
335
+ appBaseDomain: DEFAULT_APP_BASE_DOMAIN
327
336
  }
328
337
  };
329
338
  var CHAIN_ID_TO_ENVIRONMENT = {
@@ -740,7 +749,7 @@ var CanViewAppLogsPermission = "0x2fd3f2fe";
740
749
  var CanViewSensitiveAppInfoPermission = "0x0e67b22f";
741
750
  var CanUpdateAppProfilePermission = "0x036fef61";
742
751
  function getDefaultClientId() {
743
- const version = true ? "1.0.0-devep2" : "0.0.0";
752
+ const version = true ? "1.0.0-devep4" : "0.0.0";
744
753
  return `ecloud-sdk/v${version}`;
745
754
  }
746
755
  var UserApiClient = class {
@@ -775,6 +784,7 @@ var UserApiClient = class {
775
784
  status: app.app_status,
776
785
  ip: app.ip,
777
786
  machineType: app.machine_type,
787
+ hostname: app.hostname,
778
788
  profile: app.profile,
779
789
  metrics: app.metrics,
780
790
  evmAddresses,
@@ -840,6 +850,28 @@ var UserApiClient = class {
840
850
  status: app.app_status || app.App_Status || ""
841
851
  }));
842
852
  }
853
+ /**
854
+ * Get deployments for an app from the gRPC-gateway endpoint.
855
+ * Returns deployment records including upgrade_phase for tracking upgrade progress.
856
+ *
857
+ * Endpoint: GET /v1/apps/:appAddress/deployments
858
+ */
859
+ async getDeployments(appAddress) {
860
+ const endpoint = `${this.config.userApiServerURL}/v1/apps/${appAddress}/deployments`;
861
+ const response = await this.makeEIP712AuthenticatedRequest(endpoint);
862
+ const result = await response.json();
863
+ const deployments = result.deployments || [];
864
+ return deployments.map((dep) => ({
865
+ id: dep.id || "",
866
+ externalId: dep.external_id || dep.externalId || "",
867
+ endpoint: dep.endpoint || "",
868
+ releaseId: dep.release_id || dep.releaseId || "",
869
+ upgradePhase: dep.upgrade_phase || dep.upgradePhase || "",
870
+ replacesDeploymentId: dep.replaces_deployment_id || dep.replacesDeploymentId || "",
871
+ createdAt: dep.created_at || dep.createdAt || "",
872
+ updatedAt: dep.updated_at || dep.updatedAt || ""
873
+ }));
874
+ }
843
875
  /**
844
876
  * Upload app profile information with optional image
845
877
  *
@@ -973,6 +1005,48 @@ Please check:
973
1005
  "X-eigenx-expiry": expiry.toString()
974
1006
  };
975
1007
  }
1008
+ /**
1009
+ * Make an EIP-712 authenticated request to the gRPC-gateway endpoints.
1010
+ * Uses the billing/compute auth pattern: Authorization + X-Account + X-Expiry headers.
1011
+ */
1012
+ async makeEIP712AuthenticatedRequest(url) {
1013
+ const expiry = BigInt(Math.floor(Date.now() / 1e3) + 5 * 60);
1014
+ const { signature } = await calculateBillingAuthSignature({
1015
+ walletClient: this.walletClient,
1016
+ product: "compute",
1017
+ expiry
1018
+ });
1019
+ const headers = {
1020
+ Authorization: `Bearer ${signature}`,
1021
+ "X-Account": this.address,
1022
+ "X-Expiry": expiry.toString(),
1023
+ "x-client-id": this.clientId
1024
+ };
1025
+ try {
1026
+ const response = await requestWithRetry({
1027
+ method: "GET",
1028
+ url,
1029
+ headers,
1030
+ maxRedirects: 0,
1031
+ withCredentials: true
1032
+ });
1033
+ const status = response.status;
1034
+ if (status < 200 || status >= 300) {
1035
+ const body = typeof response.data === "string" ? response.data : JSON.stringify(response.data);
1036
+ throw new Error(`gRPC-gateway request failed: ${status} - ${body}`);
1037
+ }
1038
+ return {
1039
+ json: async () => response.data,
1040
+ text: async () => typeof response.data === "string" ? response.data : JSON.stringify(response.data)
1041
+ };
1042
+ } catch (error) {
1043
+ if (error.message?.includes("fetch failed") || error.message?.includes("ECONNREFUSED") || error.message?.includes("ENOTFOUND") || error.cause) {
1044
+ const cause = error.cause?.message || error.cause || error.message;
1045
+ throw new Error(`Failed to connect to API at ${url}: ${cause}`);
1046
+ }
1047
+ throw error;
1048
+ }
1049
+ }
976
1050
  // ==========================================================================
977
1051
  // SIWE Session Management
978
1052
  // ==========================================================================