@layr-labs/ecloud-sdk 0.1.1-dev → 0.1.2-dev

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.
@@ -1,5 +1,5 @@
1
- import { L as Logger, a as DeployAppOpts, A as AppId, U as UpgradeAppOpts, b as LifecycleOpts } from './index-D-SUX3IG.js';
2
- import { Address } from 'viem';
1
+ import { Address, Hex } from 'viem';
2
+ import { L as Logger, E as EnvironmentConfig, b as DeployAppOpts, A as AppId, U as UpgradeAppOpts, c as PrepareDeployOpts, P as PreparedDeploy, G as GasOpts, e as ExecuteDeployResult, d as PrepareUpgradeOpts, a as PreparedUpgrade, f as ExecuteUpgradeResult, o as AppProfile, p as AppProfileResponse, i as LifecycleOpts } from './index-Fb_S-Cqk.cjs';
3
3
 
4
4
  /**
5
5
  * Create command
@@ -109,6 +109,71 @@ interface LogsOptions {
109
109
  */
110
110
  declare function logs(options: SDKLogsOptions | LogsOptions, logger?: Logger, skipTelemetry?: boolean): Promise<void>;
111
111
 
112
+ /**
113
+ * Contract interactions
114
+ *
115
+ * This module handles on-chain contract interactions using viem
116
+ */
117
+
118
+ /**
119
+ * Gas estimation result
120
+ */
121
+ interface GasEstimate {
122
+ /** Estimated gas limit for the transaction */
123
+ gasLimit: bigint;
124
+ /** Max fee per gas (EIP-1559) */
125
+ maxFeePerGas: bigint;
126
+ /** Max priority fee per gas (EIP-1559) */
127
+ maxPriorityFeePerGas: bigint;
128
+ /** Maximum cost in wei (gasLimit * maxFeePerGas) */
129
+ maxCostWei: bigint;
130
+ /** Maximum cost formatted as ETH string */
131
+ maxCostEth: string;
132
+ }
133
+ /**
134
+ * Options for estimating transaction gas
135
+ */
136
+ interface EstimateGasOptions {
137
+ privateKey: string;
138
+ rpcUrl: string;
139
+ environmentConfig: EnvironmentConfig;
140
+ to: Address;
141
+ data: Hex;
142
+ value?: bigint;
143
+ }
144
+ /**
145
+ * Format Wei to ETH string
146
+ */
147
+ declare function formatETH(wei: bigint): string;
148
+ /**
149
+ * Estimate gas cost for a transaction
150
+ *
151
+ * Use this to get cost estimate before prompting user for confirmation.
152
+ */
153
+ declare function estimateTransactionGas(options: EstimateGasOptions): Promise<GasEstimate>;
154
+ /**
155
+ * Get apps by creator (paginated)
156
+ */
157
+ interface AppConfig {
158
+ release: any;
159
+ status: number;
160
+ }
161
+ /**
162
+ * Fetch all apps by a developer by auto-pagination
163
+ */
164
+ declare function getAllAppsByDeveloper(rpcUrl: string, env: EnvironmentConfig, developer: Address, pageSize?: bigint): Promise<{
165
+ apps: Address[];
166
+ appConfigs: AppConfig[];
167
+ }>;
168
+ /**
169
+ * Get latest release block numbers for multiple apps
170
+ */
171
+ declare function getAppLatestReleaseBlockNumbers(rpcUrl: string, environmentConfig: EnvironmentConfig, appIDs: Address[]): Promise<Map<Address, number>>;
172
+ /**
173
+ * Get block timestamps for multiple block numbers
174
+ */
175
+ declare function getBlockTimestamps(rpcUrl: string, environmentConfig: EnvironmentConfig, blockNumbers: number[]): Promise<Map<number, number>>;
176
+
112
177
  /**
113
178
  * Main App namespace entry point
114
179
  */
@@ -116,47 +181,60 @@ declare function logs(options: SDKLogsOptions | LogsOptions, logger?: Logger, sk
116
181
  /**
117
182
  * Encode start app call data for gas estimation
118
183
  */
119
- declare function encodeStartAppData(appId: AppId): `0x${string}`;
184
+ declare function encodeStartAppData(appId: AppId): Hex;
120
185
  /**
121
186
  * Encode stop app call data for gas estimation
122
187
  */
123
- declare function encodeStopAppData(appId: AppId): `0x${string}`;
188
+ declare function encodeStopAppData(appId: AppId): Hex;
124
189
  /**
125
190
  * Encode terminate app call data for gas estimation
126
191
  */
127
- declare function encodeTerminateAppData(appId: AppId): `0x${string}`;
192
+ declare function encodeTerminateAppData(appId: AppId): Hex;
128
193
  interface AppModule {
129
194
  create: (opts: CreateAppOpts) => Promise<void>;
130
195
  deploy: (opts: DeployAppOpts) => Promise<{
131
196
  appId: AppId;
132
- tx: `0x${string}`;
197
+ tx: Hex;
133
198
  appName: string;
134
199
  imageRef: string;
135
200
  ipAddress?: string;
136
201
  }>;
137
202
  upgrade: (appId: AppId, opts: UpgradeAppOpts) => Promise<{
138
- tx: `0x${string}`;
139
- appId: string;
203
+ tx: Hex;
204
+ appId: AppId;
140
205
  imageRef: string;
141
206
  }>;
207
+ prepareDeploy: (opts: PrepareDeployOpts) => Promise<{
208
+ prepared: PreparedDeploy;
209
+ gasEstimate: GasEstimate;
210
+ }>;
211
+ executeDeploy: (prepared: PreparedDeploy, gas?: GasOpts) => Promise<ExecuteDeployResult>;
212
+ watchDeployment: (appId: AppId) => Promise<string | undefined>;
213
+ prepareUpgrade: (appId: AppId, opts: PrepareUpgradeOpts) => Promise<{
214
+ prepared: PreparedUpgrade;
215
+ gasEstimate: GasEstimate;
216
+ }>;
217
+ executeUpgrade: (prepared: PreparedUpgrade, gas?: GasOpts) => Promise<ExecuteUpgradeResult>;
218
+ watchUpgrade: (appId: AppId) => Promise<void>;
219
+ setProfile: (appId: AppId, profile: AppProfile) => Promise<AppProfileResponse>;
142
220
  logs: (opts: LogsOptions) => Promise<void>;
143
221
  start: (appId: AppId, opts?: LifecycleOpts) => Promise<{
144
- tx: `0x${string}` | false;
222
+ tx: Hex | false;
145
223
  }>;
146
224
  stop: (appId: AppId, opts?: LifecycleOpts) => Promise<{
147
- tx: `0x${string}` | false;
225
+ tx: Hex | false;
148
226
  }>;
149
227
  terminate: (appId: AppId, opts?: LifecycleOpts) => Promise<{
150
- tx: `0x${string}` | false;
228
+ tx: Hex | false;
151
229
  }>;
152
230
  isDelegated: () => Promise<boolean>;
153
231
  undelegate: () => Promise<{
154
- tx: `0x${string}` | false;
232
+ tx: Hex | false;
155
233
  }>;
156
234
  }
157
235
  interface AppModuleConfig {
158
236
  verbose?: boolean;
159
- privateKey: `0x${string}`;
237
+ privateKey: Hex;
160
238
  rpcUrl: string;
161
239
  environment: string;
162
240
  clientId?: string;
@@ -173,7 +251,7 @@ interface ComputeModule {
173
251
  }
174
252
  interface ComputeModuleConfig {
175
253
  verbose?: boolean;
176
- privateKey: `0x${string}`;
254
+ privateKey: Hex;
177
255
  rpcUrl: string;
178
256
  environment: string;
179
257
  clientId?: string;
@@ -181,4 +259,4 @@ interface ComputeModuleConfig {
181
259
  }
182
260
  declare function createComputeModule(config: ComputeModuleConfig): ComputeModule;
183
261
 
184
- export { type AppModule as A, type ComputeModule as C, type LogsOptions as L, PRIMARY_LANGUAGES as P, type SDKCreateAppOpts as S, type CreateAppOpts as a, type SDKLogsOptions as b, createApp as c, createComputeModule as d, type ComputeModuleConfig as e, encodeStartAppData as f, getAvailableTemplates as g, encodeStopAppData as h, encodeTerminateAppData as i, createAppModule as j, type AppModuleConfig as k, logs as l };
262
+ export { type AppModule as A, type ComputeModule as C, type EstimateGasOptions as E, type GasEstimate as G, type LogsOptions as L, PRIMARY_LANGUAGES as P, type SDKCreateAppOpts as S, type CreateAppOpts as a, type SDKLogsOptions as b, createApp as c, createComputeModule as d, type ComputeModuleConfig as e, encodeStartAppData as f, getAvailableTemplates as g, encodeStopAppData as h, encodeTerminateAppData as i, getAllAppsByDeveloper as j, getAppLatestReleaseBlockNumbers as k, logs as l, getBlockTimestamps as m, estimateTransactionGas as n, formatETH as o, createAppModule as p, type AppModuleConfig as q };
@@ -1,5 +1,5 @@
1
- import { L as Logger, a as DeployAppOpts, A as AppId, U as UpgradeAppOpts, b as LifecycleOpts } from './index-D-SUX3IG.cjs';
2
- import { Address } from 'viem';
1
+ import { Address, Hex } from 'viem';
2
+ import { L as Logger, E as EnvironmentConfig, b as DeployAppOpts, A as AppId, U as UpgradeAppOpts, c as PrepareDeployOpts, P as PreparedDeploy, G as GasOpts, e as ExecuteDeployResult, d as PrepareUpgradeOpts, a as PreparedUpgrade, f as ExecuteUpgradeResult, o as AppProfile, p as AppProfileResponse, i as LifecycleOpts } from './index-Fb_S-Cqk.js';
3
3
 
4
4
  /**
5
5
  * Create command
@@ -109,6 +109,71 @@ interface LogsOptions {
109
109
  */
110
110
  declare function logs(options: SDKLogsOptions | LogsOptions, logger?: Logger, skipTelemetry?: boolean): Promise<void>;
111
111
 
112
+ /**
113
+ * Contract interactions
114
+ *
115
+ * This module handles on-chain contract interactions using viem
116
+ */
117
+
118
+ /**
119
+ * Gas estimation result
120
+ */
121
+ interface GasEstimate {
122
+ /** Estimated gas limit for the transaction */
123
+ gasLimit: bigint;
124
+ /** Max fee per gas (EIP-1559) */
125
+ maxFeePerGas: bigint;
126
+ /** Max priority fee per gas (EIP-1559) */
127
+ maxPriorityFeePerGas: bigint;
128
+ /** Maximum cost in wei (gasLimit * maxFeePerGas) */
129
+ maxCostWei: bigint;
130
+ /** Maximum cost formatted as ETH string */
131
+ maxCostEth: string;
132
+ }
133
+ /**
134
+ * Options for estimating transaction gas
135
+ */
136
+ interface EstimateGasOptions {
137
+ privateKey: string;
138
+ rpcUrl: string;
139
+ environmentConfig: EnvironmentConfig;
140
+ to: Address;
141
+ data: Hex;
142
+ value?: bigint;
143
+ }
144
+ /**
145
+ * Format Wei to ETH string
146
+ */
147
+ declare function formatETH(wei: bigint): string;
148
+ /**
149
+ * Estimate gas cost for a transaction
150
+ *
151
+ * Use this to get cost estimate before prompting user for confirmation.
152
+ */
153
+ declare function estimateTransactionGas(options: EstimateGasOptions): Promise<GasEstimate>;
154
+ /**
155
+ * Get apps by creator (paginated)
156
+ */
157
+ interface AppConfig {
158
+ release: any;
159
+ status: number;
160
+ }
161
+ /**
162
+ * Fetch all apps by a developer by auto-pagination
163
+ */
164
+ declare function getAllAppsByDeveloper(rpcUrl: string, env: EnvironmentConfig, developer: Address, pageSize?: bigint): Promise<{
165
+ apps: Address[];
166
+ appConfigs: AppConfig[];
167
+ }>;
168
+ /**
169
+ * Get latest release block numbers for multiple apps
170
+ */
171
+ declare function getAppLatestReleaseBlockNumbers(rpcUrl: string, environmentConfig: EnvironmentConfig, appIDs: Address[]): Promise<Map<Address, number>>;
172
+ /**
173
+ * Get block timestamps for multiple block numbers
174
+ */
175
+ declare function getBlockTimestamps(rpcUrl: string, environmentConfig: EnvironmentConfig, blockNumbers: number[]): Promise<Map<number, number>>;
176
+
112
177
  /**
113
178
  * Main App namespace entry point
114
179
  */
@@ -116,47 +181,60 @@ declare function logs(options: SDKLogsOptions | LogsOptions, logger?: Logger, sk
116
181
  /**
117
182
  * Encode start app call data for gas estimation
118
183
  */
119
- declare function encodeStartAppData(appId: AppId): `0x${string}`;
184
+ declare function encodeStartAppData(appId: AppId): Hex;
120
185
  /**
121
186
  * Encode stop app call data for gas estimation
122
187
  */
123
- declare function encodeStopAppData(appId: AppId): `0x${string}`;
188
+ declare function encodeStopAppData(appId: AppId): Hex;
124
189
  /**
125
190
  * Encode terminate app call data for gas estimation
126
191
  */
127
- declare function encodeTerminateAppData(appId: AppId): `0x${string}`;
192
+ declare function encodeTerminateAppData(appId: AppId): Hex;
128
193
  interface AppModule {
129
194
  create: (opts: CreateAppOpts) => Promise<void>;
130
195
  deploy: (opts: DeployAppOpts) => Promise<{
131
196
  appId: AppId;
132
- tx: `0x${string}`;
197
+ tx: Hex;
133
198
  appName: string;
134
199
  imageRef: string;
135
200
  ipAddress?: string;
136
201
  }>;
137
202
  upgrade: (appId: AppId, opts: UpgradeAppOpts) => Promise<{
138
- tx: `0x${string}`;
139
- appId: string;
203
+ tx: Hex;
204
+ appId: AppId;
140
205
  imageRef: string;
141
206
  }>;
207
+ prepareDeploy: (opts: PrepareDeployOpts) => Promise<{
208
+ prepared: PreparedDeploy;
209
+ gasEstimate: GasEstimate;
210
+ }>;
211
+ executeDeploy: (prepared: PreparedDeploy, gas?: GasOpts) => Promise<ExecuteDeployResult>;
212
+ watchDeployment: (appId: AppId) => Promise<string | undefined>;
213
+ prepareUpgrade: (appId: AppId, opts: PrepareUpgradeOpts) => Promise<{
214
+ prepared: PreparedUpgrade;
215
+ gasEstimate: GasEstimate;
216
+ }>;
217
+ executeUpgrade: (prepared: PreparedUpgrade, gas?: GasOpts) => Promise<ExecuteUpgradeResult>;
218
+ watchUpgrade: (appId: AppId) => Promise<void>;
219
+ setProfile: (appId: AppId, profile: AppProfile) => Promise<AppProfileResponse>;
142
220
  logs: (opts: LogsOptions) => Promise<void>;
143
221
  start: (appId: AppId, opts?: LifecycleOpts) => Promise<{
144
- tx: `0x${string}` | false;
222
+ tx: Hex | false;
145
223
  }>;
146
224
  stop: (appId: AppId, opts?: LifecycleOpts) => Promise<{
147
- tx: `0x${string}` | false;
225
+ tx: Hex | false;
148
226
  }>;
149
227
  terminate: (appId: AppId, opts?: LifecycleOpts) => Promise<{
150
- tx: `0x${string}` | false;
228
+ tx: Hex | false;
151
229
  }>;
152
230
  isDelegated: () => Promise<boolean>;
153
231
  undelegate: () => Promise<{
154
- tx: `0x${string}` | false;
232
+ tx: Hex | false;
155
233
  }>;
156
234
  }
157
235
  interface AppModuleConfig {
158
236
  verbose?: boolean;
159
- privateKey: `0x${string}`;
237
+ privateKey: Hex;
160
238
  rpcUrl: string;
161
239
  environment: string;
162
240
  clientId?: string;
@@ -173,7 +251,7 @@ interface ComputeModule {
173
251
  }
174
252
  interface ComputeModuleConfig {
175
253
  verbose?: boolean;
176
- privateKey: `0x${string}`;
254
+ privateKey: Hex;
177
255
  rpcUrl: string;
178
256
  environment: string;
179
257
  clientId?: string;
@@ -181,4 +259,4 @@ interface ComputeModuleConfig {
181
259
  }
182
260
  declare function createComputeModule(config: ComputeModuleConfig): ComputeModule;
183
261
 
184
- export { type AppModule as A, type ComputeModule as C, type LogsOptions as L, PRIMARY_LANGUAGES as P, type SDKCreateAppOpts as S, type CreateAppOpts as a, type SDKLogsOptions as b, createApp as c, createComputeModule as d, type ComputeModuleConfig as e, encodeStartAppData as f, getAvailableTemplates as g, encodeStopAppData as h, encodeTerminateAppData as i, createAppModule as j, type AppModuleConfig as k, logs as l };
262
+ export { type AppModule as A, type ComputeModule as C, type EstimateGasOptions as E, type GasEstimate as G, type LogsOptions as L, PRIMARY_LANGUAGES as P, type SDKCreateAppOpts as S, type CreateAppOpts as a, type SDKLogsOptions as b, createApp as c, createComputeModule as d, type ComputeModuleConfig as e, encodeStartAppData as f, getAvailableTemplates as g, encodeStopAppData as h, encodeTerminateAppData as i, getAllAppsByDeveloper as j, getAppLatestReleaseBlockNumbers as k, logs as l, getBlockTimestamps as m, estimateTransactionGas as n, formatETH as o, createAppModule as p, type AppModuleConfig as q };