@layr-labs/ecloud-sdk 0.2.0-dev → 0.2.0-dev.1

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.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, e as PrepareDeployFromVerifiableBuildOpts, G as GasOpts, g as ExecuteDeployResult, d as PrepareUpgradeOpts, a as PreparedUpgrade, f as PrepareUpgradeFromVerifiableBuildOpts, h as ExecuteUpgradeResult, q as AppProfile, r as AppProfileResponse, k as LifecycleOpts } from './index-D2QufVB9.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,68 @@ 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
+ prepareDeployFromVerifiableBuild: (opts: PrepareDeployFromVerifiableBuildOpts) => Promise<{
212
+ prepared: PreparedDeploy;
213
+ gasEstimate: GasEstimate;
214
+ }>;
215
+ executeDeploy: (prepared: PreparedDeploy, gas?: GasOpts) => Promise<ExecuteDeployResult>;
216
+ watchDeployment: (appId: AppId) => Promise<string | undefined>;
217
+ prepareUpgrade: (appId: AppId, opts: PrepareUpgradeOpts) => Promise<{
218
+ prepared: PreparedUpgrade;
219
+ gasEstimate: GasEstimate;
220
+ }>;
221
+ prepareUpgradeFromVerifiableBuild: (appId: AppId, opts: PrepareUpgradeFromVerifiableBuildOpts) => Promise<{
222
+ prepared: PreparedUpgrade;
223
+ gasEstimate: GasEstimate;
224
+ }>;
225
+ executeUpgrade: (prepared: PreparedUpgrade, gas?: GasOpts) => Promise<ExecuteUpgradeResult>;
226
+ watchUpgrade: (appId: AppId) => Promise<void>;
227
+ setProfile: (appId: AppId, profile: AppProfile) => Promise<AppProfileResponse>;
142
228
  logs: (opts: LogsOptions) => Promise<void>;
143
229
  start: (appId: AppId, opts?: LifecycleOpts) => Promise<{
144
- tx: `0x${string}` | false;
230
+ tx: Hex | false;
145
231
  }>;
146
232
  stop: (appId: AppId, opts?: LifecycleOpts) => Promise<{
147
- tx: `0x${string}` | false;
233
+ tx: Hex | false;
148
234
  }>;
149
235
  terminate: (appId: AppId, opts?: LifecycleOpts) => Promise<{
150
- tx: `0x${string}` | false;
236
+ tx: Hex | false;
151
237
  }>;
152
238
  isDelegated: () => Promise<boolean>;
153
239
  undelegate: () => Promise<{
154
- tx: `0x${string}` | false;
240
+ tx: Hex | false;
155
241
  }>;
156
242
  }
157
243
  interface AppModuleConfig {
158
244
  verbose?: boolean;
159
- privateKey: `0x${string}`;
245
+ privateKey: Hex;
160
246
  rpcUrl: string;
161
247
  environment: string;
162
248
  clientId?: string;
@@ -173,7 +259,7 @@ interface ComputeModule {
173
259
  }
174
260
  interface ComputeModuleConfig {
175
261
  verbose?: boolean;
176
- privateKey: `0x${string}`;
262
+ privateKey: Hex;
177
263
  rpcUrl: string;
178
264
  environment: string;
179
265
  clientId?: string;
@@ -181,4 +267,4 @@ interface ComputeModuleConfig {
181
267
  }
182
268
  declare function createComputeModule(config: ComputeModuleConfig): ComputeModule;
183
269
 
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 };
270
+ 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.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, e as PrepareDeployFromVerifiableBuildOpts, G as GasOpts, g as ExecuteDeployResult, d as PrepareUpgradeOpts, a as PreparedUpgrade, f as PrepareUpgradeFromVerifiableBuildOpts, h as ExecuteUpgradeResult, q as AppProfile, r as AppProfileResponse, k as LifecycleOpts } from './index-D2QufVB9.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,68 @@ 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
+ prepareDeployFromVerifiableBuild: (opts: PrepareDeployFromVerifiableBuildOpts) => Promise<{
212
+ prepared: PreparedDeploy;
213
+ gasEstimate: GasEstimate;
214
+ }>;
215
+ executeDeploy: (prepared: PreparedDeploy, gas?: GasOpts) => Promise<ExecuteDeployResult>;
216
+ watchDeployment: (appId: AppId) => Promise<string | undefined>;
217
+ prepareUpgrade: (appId: AppId, opts: PrepareUpgradeOpts) => Promise<{
218
+ prepared: PreparedUpgrade;
219
+ gasEstimate: GasEstimate;
220
+ }>;
221
+ prepareUpgradeFromVerifiableBuild: (appId: AppId, opts: PrepareUpgradeFromVerifiableBuildOpts) => Promise<{
222
+ prepared: PreparedUpgrade;
223
+ gasEstimate: GasEstimate;
224
+ }>;
225
+ executeUpgrade: (prepared: PreparedUpgrade, gas?: GasOpts) => Promise<ExecuteUpgradeResult>;
226
+ watchUpgrade: (appId: AppId) => Promise<void>;
227
+ setProfile: (appId: AppId, profile: AppProfile) => Promise<AppProfileResponse>;
142
228
  logs: (opts: LogsOptions) => Promise<void>;
143
229
  start: (appId: AppId, opts?: LifecycleOpts) => Promise<{
144
- tx: `0x${string}` | false;
230
+ tx: Hex | false;
145
231
  }>;
146
232
  stop: (appId: AppId, opts?: LifecycleOpts) => Promise<{
147
- tx: `0x${string}` | false;
233
+ tx: Hex | false;
148
234
  }>;
149
235
  terminate: (appId: AppId, opts?: LifecycleOpts) => Promise<{
150
- tx: `0x${string}` | false;
236
+ tx: Hex | false;
151
237
  }>;
152
238
  isDelegated: () => Promise<boolean>;
153
239
  undelegate: () => Promise<{
154
- tx: `0x${string}` | false;
240
+ tx: Hex | false;
155
241
  }>;
156
242
  }
157
243
  interface AppModuleConfig {
158
244
  verbose?: boolean;
159
- privateKey: `0x${string}`;
245
+ privateKey: Hex;
160
246
  rpcUrl: string;
161
247
  environment: string;
162
248
  clientId?: string;
@@ -173,7 +259,7 @@ interface ComputeModule {
173
259
  }
174
260
  interface ComputeModuleConfig {
175
261
  verbose?: boolean;
176
- privateKey: `0x${string}`;
262
+ privateKey: Hex;
177
263
  rpcUrl: string;
178
264
  environment: string;
179
265
  clientId?: string;
@@ -181,4 +267,4 @@ interface ComputeModuleConfig {
181
267
  }
182
268
  declare function createComputeModule(config: ComputeModuleConfig): ComputeModule;
183
269
 
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 };
270
+ 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 };