@layr-labs/ecloud-sdk 0.2.2-dev → 0.3.0-dev.0
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/billing.cjs +273 -4
- package/dist/billing.cjs.map +1 -1
- package/dist/billing.d.cts +1 -1
- package/dist/billing.d.ts +1 -1
- package/dist/billing.js +275 -4
- package/dist/billing.js.map +1 -1
- package/dist/browser.cjs +569 -173
- package/dist/browser.cjs.map +1 -1
- package/dist/browser.d.cts +53 -12
- package/dist/browser.d.ts +53 -12
- package/dist/browser.js +569 -173
- package/dist/browser.js.map +1 -1
- package/dist/{compute-BYhSs8en.d.ts → compute-BcJuIxc1.d.ts} +1 -1
- package/dist/{compute-Bpjb3hYD.d.cts → compute-oD9uqLtr.d.cts} +1 -1
- package/dist/compute.cjs +240 -154
- package/dist/compute.cjs.map +1 -1
- package/dist/compute.d.cts +2 -2
- package/dist/compute.d.ts +2 -2
- package/dist/compute.js +242 -154
- package/dist/compute.js.map +1 -1
- package/dist/{helpers-CQuBwQnu.d.ts → helpers-BNGcO-VX.d.cts} +249 -5
- package/dist/{helpers-CEvhJz7f.d.cts → helpers-Cp8qGRTb.d.ts} +249 -5
- package/dist/{index-DeQzn_yM.d.cts → index-5y9NG_Id.d.cts} +9 -1
- package/dist/{index-DeQzn_yM.d.ts → index-5y9NG_Id.d.ts} +9 -1
- package/dist/index.cjs +631 -214
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -6
- package/dist/index.d.ts +6 -6
- package/dist/index.js +633 -214
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Address, WalletClient, PublicClient, Hex } from 'viem';
|
|
2
|
-
import { ab as Logger, a6 as EnvironmentConfig, N as DeployAppOpts, A as AppId, O as UpgradeAppOpts, Q as PrepareDeployOpts, $ as PreparedDeploy, G as GasEstimate, T as PrepareDeployFromVerifiableBuildOpts, X as ExecuteDeployResult, R as PrepareUpgradeOpts, a0 as PreparedUpgrade, V as PrepareUpgradeFromVerifiableBuildOpts, Y as ExecuteUpgradeResult, ac as AppProfile, ad as AppProfileResponse, a1 as LifecycleOpts } from './index-
|
|
2
|
+
import { ab as Logger, a6 as EnvironmentConfig, N as DeployAppOpts, A as AppId, O as UpgradeAppOpts, Q as PrepareDeployOpts, $ as PreparedDeploy, G as GasEstimate, T as PrepareDeployFromVerifiableBuildOpts, X as ExecuteDeployResult, R as PrepareUpgradeOpts, a0 as PreparedUpgrade, V as PrepareUpgradeFromVerifiableBuildOpts, Y as ExecuteUpgradeResult, ac as AppProfile, ad as AppProfileResponse, a1 as LifecycleOpts } from './index-5y9NG_Id.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Create command
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Address, WalletClient, PublicClient, Hex } from 'viem';
|
|
2
|
-
import { ab as Logger, a6 as EnvironmentConfig, N as DeployAppOpts, A as AppId, O as UpgradeAppOpts, Q as PrepareDeployOpts, $ as PreparedDeploy, G as GasEstimate, T as PrepareDeployFromVerifiableBuildOpts, X as ExecuteDeployResult, R as PrepareUpgradeOpts, a0 as PreparedUpgrade, V as PrepareUpgradeFromVerifiableBuildOpts, Y as ExecuteUpgradeResult, ac as AppProfile, ad as AppProfileResponse, a1 as LifecycleOpts } from './index-
|
|
2
|
+
import { ab as Logger, a6 as EnvironmentConfig, N as DeployAppOpts, A as AppId, O as UpgradeAppOpts, Q as PrepareDeployOpts, $ as PreparedDeploy, G as GasEstimate, T as PrepareDeployFromVerifiableBuildOpts, X as ExecuteDeployResult, R as PrepareUpgradeOpts, a0 as PreparedUpgrade, V as PrepareUpgradeFromVerifiableBuildOpts, Y as ExecuteUpgradeResult, ac as AppProfile, ad as AppProfileResponse, a1 as LifecycleOpts } from './index-5y9NG_Id.cjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Create command
|
package/dist/compute.cjs
CHANGED
|
@@ -5,6 +5,9 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __esm = (fn, res) => function __init() {
|
|
9
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
10
|
+
};
|
|
8
11
|
var __export = (target, all) => {
|
|
9
12
|
for (var name in all)
|
|
10
13
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -27,6 +30,131 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
27
30
|
));
|
|
28
31
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
32
|
|
|
33
|
+
// src/client/common/auth/session.ts
|
|
34
|
+
function stripHexPrefix2(hex) {
|
|
35
|
+
return hex.startsWith("0x") ? hex.slice(2) : hex;
|
|
36
|
+
}
|
|
37
|
+
async function parseErrorResponse(response) {
|
|
38
|
+
try {
|
|
39
|
+
const data = await response.json();
|
|
40
|
+
return data.error || response.statusText;
|
|
41
|
+
} catch {
|
|
42
|
+
return response.statusText;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
async function loginToComputeApi(config, request) {
|
|
46
|
+
let response;
|
|
47
|
+
try {
|
|
48
|
+
response = await fetch(`${config.baseUrl}/auth/siwe/login`, {
|
|
49
|
+
method: "POST",
|
|
50
|
+
credentials: "include",
|
|
51
|
+
// Include cookies for session management
|
|
52
|
+
headers: {
|
|
53
|
+
"Content-Type": "application/json"
|
|
54
|
+
},
|
|
55
|
+
body: JSON.stringify({
|
|
56
|
+
message: request.message,
|
|
57
|
+
signature: stripHexPrefix2(request.signature)
|
|
58
|
+
})
|
|
59
|
+
});
|
|
60
|
+
} catch (error) {
|
|
61
|
+
throw new SessionError(
|
|
62
|
+
`Network error connecting to ${config.baseUrl}: ${error instanceof Error ? error.message : String(error)}`,
|
|
63
|
+
"NETWORK_ERROR"
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
if (!response.ok) {
|
|
67
|
+
const errorMessage = await parseErrorResponse(response);
|
|
68
|
+
const status = response.status;
|
|
69
|
+
if (status === 400) {
|
|
70
|
+
if (errorMessage.toLowerCase().includes("siwe")) {
|
|
71
|
+
throw new SessionError(`Invalid SIWE message: ${errorMessage}`, "INVALID_MESSAGE", status);
|
|
72
|
+
}
|
|
73
|
+
throw new SessionError(`Bad request: ${errorMessage}`, "INVALID_MESSAGE", status);
|
|
74
|
+
}
|
|
75
|
+
if (status === 401) {
|
|
76
|
+
throw new SessionError(`Invalid signature: ${errorMessage}`, "INVALID_SIGNATURE", status);
|
|
77
|
+
}
|
|
78
|
+
throw new SessionError(`Login failed: ${errorMessage}`, "UNKNOWN", status);
|
|
79
|
+
}
|
|
80
|
+
const data = await response.json();
|
|
81
|
+
return {
|
|
82
|
+
success: data.success,
|
|
83
|
+
address: data.address
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
async function getComputeApiSession(config) {
|
|
87
|
+
let response;
|
|
88
|
+
try {
|
|
89
|
+
response = await fetch(`${config.baseUrl}/auth/session`, {
|
|
90
|
+
method: "GET",
|
|
91
|
+
credentials: "include",
|
|
92
|
+
// Include cookies for session management
|
|
93
|
+
headers: {
|
|
94
|
+
"Content-Type": "application/json"
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
} catch {
|
|
98
|
+
return {
|
|
99
|
+
authenticated: false
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
if (response.status === 401) {
|
|
103
|
+
return {
|
|
104
|
+
authenticated: false
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
if (!response.ok) {
|
|
108
|
+
const errorMessage = await parseErrorResponse(response);
|
|
109
|
+
throw new SessionError(`Failed to get session: ${errorMessage}`, "UNKNOWN", response.status);
|
|
110
|
+
}
|
|
111
|
+
const data = await response.json();
|
|
112
|
+
return {
|
|
113
|
+
authenticated: data.authenticated,
|
|
114
|
+
address: data.address,
|
|
115
|
+
chainId: data.chain_id
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
async function logoutFromComputeApi(config) {
|
|
119
|
+
let response;
|
|
120
|
+
try {
|
|
121
|
+
response = await fetch(`${config.baseUrl}/auth/logout`, {
|
|
122
|
+
method: "POST",
|
|
123
|
+
credentials: "include",
|
|
124
|
+
// Include cookies for session management
|
|
125
|
+
headers: {
|
|
126
|
+
"Content-Type": "application/json"
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
} catch (error) {
|
|
130
|
+
throw new SessionError(
|
|
131
|
+
`Network error connecting to ${config.baseUrl}: ${error instanceof Error ? error.message : String(error)}`,
|
|
132
|
+
"NETWORK_ERROR"
|
|
133
|
+
);
|
|
134
|
+
}
|
|
135
|
+
if (response.status === 401) {
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
if (!response.ok) {
|
|
139
|
+
const errorMessage = await parseErrorResponse(response);
|
|
140
|
+
throw new SessionError(`Logout failed: ${errorMessage}`, "UNKNOWN", response.status);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
var SessionError;
|
|
144
|
+
var init_session = __esm({
|
|
145
|
+
"src/client/common/auth/session.ts"() {
|
|
146
|
+
"use strict";
|
|
147
|
+
SessionError = class extends Error {
|
|
148
|
+
constructor(message, code, statusCode) {
|
|
149
|
+
super(message);
|
|
150
|
+
this.code = code;
|
|
151
|
+
this.statusCode = statusCode;
|
|
152
|
+
this.name = "SessionError";
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
|
|
30
158
|
// src/compute.ts
|
|
31
159
|
var compute_exports = {};
|
|
32
160
|
__export(compute_exports, {
|
|
@@ -2208,7 +2336,7 @@ function encodeExecuteBatchData(executions) {
|
|
|
2208
2336
|
});
|
|
2209
2337
|
}
|
|
2210
2338
|
async function estimateBatchGas(options) {
|
|
2211
|
-
const { publicClient, account, executions } = options;
|
|
2339
|
+
const { publicClient, account, executions, authorizationList } = options;
|
|
2212
2340
|
const executeBatchData = encodeExecuteBatchData(executions);
|
|
2213
2341
|
const [gasTipCap, block, estimatedGas] = await Promise.all([
|
|
2214
2342
|
publicClient.estimateMaxPriorityFeePerGas(),
|
|
@@ -2216,7 +2344,8 @@ async function estimateBatchGas(options) {
|
|
|
2216
2344
|
publicClient.estimateGas({
|
|
2217
2345
|
account,
|
|
2218
2346
|
to: account,
|
|
2219
|
-
data: executeBatchData
|
|
2347
|
+
data: executeBatchData,
|
|
2348
|
+
authorizationList
|
|
2220
2349
|
})
|
|
2221
2350
|
]);
|
|
2222
2351
|
const baseFee = block.baseFeePerGas ?? 0n;
|
|
@@ -2239,8 +2368,44 @@ async function checkERC7702Delegation(publicClient, account, delegatorAddress) {
|
|
|
2239
2368
|
const expectedCode = `0xef0100${delegatorAddress.slice(2)}`;
|
|
2240
2369
|
return code.toLowerCase() === expectedCode.toLowerCase();
|
|
2241
2370
|
}
|
|
2371
|
+
async function createAuthorizationList(options) {
|
|
2372
|
+
const { walletClient, publicClient, environmentConfig } = options;
|
|
2373
|
+
const account = walletClient.account;
|
|
2374
|
+
if (!account) {
|
|
2375
|
+
throw new Error("Wallet client must have an account");
|
|
2376
|
+
}
|
|
2377
|
+
const isDelegated2 = await checkERC7702Delegation(
|
|
2378
|
+
publicClient,
|
|
2379
|
+
account.address,
|
|
2380
|
+
environmentConfig.erc7702DelegatorAddress
|
|
2381
|
+
);
|
|
2382
|
+
if (isDelegated2) {
|
|
2383
|
+
return void 0;
|
|
2384
|
+
}
|
|
2385
|
+
const transactionNonce = await publicClient.getTransactionCount({
|
|
2386
|
+
address: account.address,
|
|
2387
|
+
blockTag: "pending"
|
|
2388
|
+
});
|
|
2389
|
+
const chainId = await publicClient.getChainId();
|
|
2390
|
+
const authorizationNonce = transactionNonce + 1;
|
|
2391
|
+
const signedAuthorization = await walletClient.signAuthorization({
|
|
2392
|
+
account,
|
|
2393
|
+
contractAddress: environmentConfig.erc7702DelegatorAddress,
|
|
2394
|
+
chainId,
|
|
2395
|
+
nonce: Number(authorizationNonce)
|
|
2396
|
+
});
|
|
2397
|
+
return [signedAuthorization];
|
|
2398
|
+
}
|
|
2242
2399
|
async function executeBatch(options, logger = noopLogger) {
|
|
2243
|
-
const {
|
|
2400
|
+
const {
|
|
2401
|
+
walletClient,
|
|
2402
|
+
publicClient,
|
|
2403
|
+
environmentConfig,
|
|
2404
|
+
executions,
|
|
2405
|
+
pendingMessage,
|
|
2406
|
+
gas,
|
|
2407
|
+
authorizationList: providedAuthList
|
|
2408
|
+
} = options;
|
|
2244
2409
|
const account = walletClient.account;
|
|
2245
2410
|
if (!account) {
|
|
2246
2411
|
throw new Error("Wallet client must have an account");
|
|
@@ -2250,27 +2415,29 @@ async function executeBatch(options, logger = noopLogger) {
|
|
|
2250
2415
|
throw new Error("Wallet client must have a chain");
|
|
2251
2416
|
}
|
|
2252
2417
|
const executeBatchData = encodeExecuteBatchData(executions);
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2418
|
+
let authorizationList = providedAuthList || [];
|
|
2419
|
+
if (authorizationList.length === 0) {
|
|
2420
|
+
const isDelegated2 = await checkERC7702Delegation(
|
|
2421
|
+
publicClient,
|
|
2422
|
+
account.address,
|
|
2423
|
+
environmentConfig.erc7702DelegatorAddress
|
|
2424
|
+
);
|
|
2425
|
+
if (!isDelegated2) {
|
|
2426
|
+
const transactionNonce = await publicClient.getTransactionCount({
|
|
2427
|
+
address: account.address,
|
|
2428
|
+
blockTag: "pending"
|
|
2429
|
+
});
|
|
2430
|
+
const chainId = await publicClient.getChainId();
|
|
2431
|
+
const authorizationNonce = transactionNonce + 1;
|
|
2432
|
+
logger.debug("Using wallet client signing for EIP-7702 authorization");
|
|
2433
|
+
const signedAuthorization = await walletClient.signAuthorization({
|
|
2434
|
+
account,
|
|
2435
|
+
contractAddress: environmentConfig.erc7702DelegatorAddress,
|
|
2436
|
+
chainId,
|
|
2437
|
+
nonce: Number(authorizationNonce)
|
|
2438
|
+
});
|
|
2439
|
+
authorizationList = [signedAuthorization];
|
|
2440
|
+
}
|
|
2274
2441
|
}
|
|
2275
2442
|
if (pendingMessage) {
|
|
2276
2443
|
logger.info(pendingMessage);
|
|
@@ -2285,6 +2452,9 @@ async function executeBatch(options, logger = noopLogger) {
|
|
|
2285
2452
|
if (authorizationList.length > 0) {
|
|
2286
2453
|
txRequest.authorizationList = authorizationList;
|
|
2287
2454
|
}
|
|
2455
|
+
if (gas?.gasLimit) {
|
|
2456
|
+
txRequest.gas = gas.gasLimit;
|
|
2457
|
+
}
|
|
2288
2458
|
if (gas?.maxFeePerGas) {
|
|
2289
2459
|
txRequest.maxFeePerGas = gas.maxFeePerGas;
|
|
2290
2460
|
}
|
|
@@ -3996,7 +4166,8 @@ async function executeDeployBatch(data, context, gas, logger = noopLogger) {
|
|
|
3996
4166
|
environmentConfig: context.environmentConfig,
|
|
3997
4167
|
executions: data.executions,
|
|
3998
4168
|
pendingMessage,
|
|
3999
|
-
gas
|
|
4169
|
+
gas,
|
|
4170
|
+
authorizationList: data.authorizationList
|
|
4000
4171
|
},
|
|
4001
4172
|
logger
|
|
4002
4173
|
);
|
|
@@ -4107,7 +4278,8 @@ async function executeUpgradeBatch(data, context, gas, logger = noopLogger) {
|
|
|
4107
4278
|
environmentConfig: context.environmentConfig,
|
|
4108
4279
|
executions: data.executions,
|
|
4109
4280
|
pendingMessage,
|
|
4110
|
-
gas
|
|
4281
|
+
gas,
|
|
4282
|
+
authorizationList: data.authorizationList
|
|
4111
4283
|
},
|
|
4112
4284
|
logger
|
|
4113
4285
|
);
|
|
@@ -4315,126 +4487,8 @@ async function calculatePermissionSignature(options) {
|
|
|
4315
4487
|
return { signature, digest };
|
|
4316
4488
|
}
|
|
4317
4489
|
|
|
4318
|
-
// src/client/common/auth/session.ts
|
|
4319
|
-
var SessionError = class extends Error {
|
|
4320
|
-
constructor(message, code, statusCode) {
|
|
4321
|
-
super(message);
|
|
4322
|
-
this.code = code;
|
|
4323
|
-
this.statusCode = statusCode;
|
|
4324
|
-
this.name = "SessionError";
|
|
4325
|
-
}
|
|
4326
|
-
};
|
|
4327
|
-
function stripHexPrefix2(hex) {
|
|
4328
|
-
return hex.startsWith("0x") ? hex.slice(2) : hex;
|
|
4329
|
-
}
|
|
4330
|
-
async function parseErrorResponse(response) {
|
|
4331
|
-
try {
|
|
4332
|
-
const data = await response.json();
|
|
4333
|
-
return data.error || response.statusText;
|
|
4334
|
-
} catch {
|
|
4335
|
-
return response.statusText;
|
|
4336
|
-
}
|
|
4337
|
-
}
|
|
4338
|
-
async function loginToComputeApi(config, request) {
|
|
4339
|
-
let response;
|
|
4340
|
-
try {
|
|
4341
|
-
response = await fetch(`${config.baseUrl}/auth/siwe/login`, {
|
|
4342
|
-
method: "POST",
|
|
4343
|
-
credentials: "include",
|
|
4344
|
-
// Include cookies for session management
|
|
4345
|
-
headers: {
|
|
4346
|
-
"Content-Type": "application/json"
|
|
4347
|
-
},
|
|
4348
|
-
body: JSON.stringify({
|
|
4349
|
-
message: request.message,
|
|
4350
|
-
signature: stripHexPrefix2(request.signature)
|
|
4351
|
-
})
|
|
4352
|
-
});
|
|
4353
|
-
} catch (error) {
|
|
4354
|
-
throw new SessionError(
|
|
4355
|
-
`Network error connecting to ${config.baseUrl}: ${error instanceof Error ? error.message : String(error)}`,
|
|
4356
|
-
"NETWORK_ERROR"
|
|
4357
|
-
);
|
|
4358
|
-
}
|
|
4359
|
-
if (!response.ok) {
|
|
4360
|
-
const errorMessage = await parseErrorResponse(response);
|
|
4361
|
-
const status = response.status;
|
|
4362
|
-
if (status === 400) {
|
|
4363
|
-
if (errorMessage.toLowerCase().includes("siwe")) {
|
|
4364
|
-
throw new SessionError(`Invalid SIWE message: ${errorMessage}`, "INVALID_MESSAGE", status);
|
|
4365
|
-
}
|
|
4366
|
-
throw new SessionError(`Bad request: ${errorMessage}`, "INVALID_MESSAGE", status);
|
|
4367
|
-
}
|
|
4368
|
-
if (status === 401) {
|
|
4369
|
-
throw new SessionError(`Invalid signature: ${errorMessage}`, "INVALID_SIGNATURE", status);
|
|
4370
|
-
}
|
|
4371
|
-
throw new SessionError(`Login failed: ${errorMessage}`, "UNKNOWN", status);
|
|
4372
|
-
}
|
|
4373
|
-
const data = await response.json();
|
|
4374
|
-
return {
|
|
4375
|
-
success: data.success,
|
|
4376
|
-
address: data.address
|
|
4377
|
-
};
|
|
4378
|
-
}
|
|
4379
|
-
async function getComputeApiSession(config) {
|
|
4380
|
-
let response;
|
|
4381
|
-
try {
|
|
4382
|
-
response = await fetch(`${config.baseUrl}/auth/session`, {
|
|
4383
|
-
method: "GET",
|
|
4384
|
-
credentials: "include",
|
|
4385
|
-
// Include cookies for session management
|
|
4386
|
-
headers: {
|
|
4387
|
-
"Content-Type": "application/json"
|
|
4388
|
-
}
|
|
4389
|
-
});
|
|
4390
|
-
} catch {
|
|
4391
|
-
return {
|
|
4392
|
-
authenticated: false
|
|
4393
|
-
};
|
|
4394
|
-
}
|
|
4395
|
-
if (response.status === 401) {
|
|
4396
|
-
return {
|
|
4397
|
-
authenticated: false
|
|
4398
|
-
};
|
|
4399
|
-
}
|
|
4400
|
-
if (!response.ok) {
|
|
4401
|
-
const errorMessage = await parseErrorResponse(response);
|
|
4402
|
-
throw new SessionError(`Failed to get session: ${errorMessage}`, "UNKNOWN", response.status);
|
|
4403
|
-
}
|
|
4404
|
-
const data = await response.json();
|
|
4405
|
-
return {
|
|
4406
|
-
authenticated: data.authenticated,
|
|
4407
|
-
address: data.address,
|
|
4408
|
-
chainId: data.chain_id
|
|
4409
|
-
};
|
|
4410
|
-
}
|
|
4411
|
-
async function logoutFromComputeApi(config) {
|
|
4412
|
-
let response;
|
|
4413
|
-
try {
|
|
4414
|
-
response = await fetch(`${config.baseUrl}/auth/logout`, {
|
|
4415
|
-
method: "POST",
|
|
4416
|
-
credentials: "include",
|
|
4417
|
-
// Include cookies for session management
|
|
4418
|
-
headers: {
|
|
4419
|
-
"Content-Type": "application/json"
|
|
4420
|
-
}
|
|
4421
|
-
});
|
|
4422
|
-
} catch (error) {
|
|
4423
|
-
throw new SessionError(
|
|
4424
|
-
`Network error connecting to ${config.baseUrl}: ${error instanceof Error ? error.message : String(error)}`,
|
|
4425
|
-
"NETWORK_ERROR"
|
|
4426
|
-
);
|
|
4427
|
-
}
|
|
4428
|
-
if (response.status === 401) {
|
|
4429
|
-
return;
|
|
4430
|
-
}
|
|
4431
|
-
if (!response.ok) {
|
|
4432
|
-
const errorMessage = await parseErrorResponse(response);
|
|
4433
|
-
throw new SessionError(`Logout failed: ${errorMessage}`, "UNKNOWN", response.status);
|
|
4434
|
-
}
|
|
4435
|
-
}
|
|
4436
|
-
|
|
4437
4490
|
// src/client/common/utils/userapi.ts
|
|
4491
|
+
init_session();
|
|
4438
4492
|
function isJsonObject(value) {
|
|
4439
4493
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
4440
4494
|
}
|
|
@@ -4451,7 +4505,7 @@ var CanViewAppLogsPermission = "0x2fd3f2fe";
|
|
|
4451
4505
|
var CanViewSensitiveAppInfoPermission = "0x0e67b22f";
|
|
4452
4506
|
var CanUpdateAppProfilePermission = "0x036fef61";
|
|
4453
4507
|
function getDefaultClientId() {
|
|
4454
|
-
const version = true ? "0.
|
|
4508
|
+
const version = true ? "0.3.0-dev.0" : "0.0.0";
|
|
4455
4509
|
return `ecloud-sdk/v${version}`;
|
|
4456
4510
|
}
|
|
4457
4511
|
var UserApiClient = class {
|
|
@@ -5394,16 +5448,24 @@ async function prepareDeployFromVerifiableBuild(options, logger = defaultLogger)
|
|
|
5394
5448
|
},
|
|
5395
5449
|
logger
|
|
5396
5450
|
);
|
|
5451
|
+
logger.debug("Checking delegation status...");
|
|
5452
|
+
const authorizationList = await createAuthorizationList({
|
|
5453
|
+
walletClient: batch.walletClient,
|
|
5454
|
+
publicClient: batch.publicClient,
|
|
5455
|
+
environmentConfig: batch.environmentConfig
|
|
5456
|
+
});
|
|
5397
5457
|
logger.debug("Estimating gas...");
|
|
5398
5458
|
const gasEstimate = await estimateBatchGas({
|
|
5399
5459
|
publicClient: batch.publicClient,
|
|
5400
5460
|
account: batch.walletClient.account.address,
|
|
5401
|
-
executions: batch.executions
|
|
5461
|
+
executions: batch.executions,
|
|
5462
|
+
authorizationList
|
|
5402
5463
|
});
|
|
5403
5464
|
const data = {
|
|
5404
5465
|
appId: batch.appId,
|
|
5405
5466
|
salt: batch.salt,
|
|
5406
|
-
executions: batch.executions
|
|
5467
|
+
executions: batch.executions,
|
|
5468
|
+
authorizationList
|
|
5407
5469
|
};
|
|
5408
5470
|
return {
|
|
5409
5471
|
prepared: {
|
|
@@ -5632,16 +5694,24 @@ async function prepareDeploy(options, logger = defaultLogger) {
|
|
|
5632
5694
|
},
|
|
5633
5695
|
logger
|
|
5634
5696
|
);
|
|
5697
|
+
logger.debug("Checking delegation status...");
|
|
5698
|
+
const authorizationList = await createAuthorizationList({
|
|
5699
|
+
walletClient: batch.walletClient,
|
|
5700
|
+
publicClient: batch.publicClient,
|
|
5701
|
+
environmentConfig: batch.environmentConfig
|
|
5702
|
+
});
|
|
5635
5703
|
logger.debug("Estimating gas...");
|
|
5636
5704
|
const gasEstimate = await estimateBatchGas({
|
|
5637
5705
|
publicClient: batch.publicClient,
|
|
5638
5706
|
account: batch.walletClient.account.address,
|
|
5639
|
-
executions: batch.executions
|
|
5707
|
+
executions: batch.executions,
|
|
5708
|
+
authorizationList
|
|
5640
5709
|
});
|
|
5641
5710
|
const data = {
|
|
5642
5711
|
appId: batch.appId,
|
|
5643
5712
|
salt: batch.salt,
|
|
5644
|
-
executions: batch.executions
|
|
5713
|
+
executions: batch.executions,
|
|
5714
|
+
authorizationList
|
|
5645
5715
|
};
|
|
5646
5716
|
return {
|
|
5647
5717
|
prepared: {
|
|
@@ -5772,15 +5842,23 @@ async function prepareUpgradeFromVerifiableBuild(options, logger = defaultLogger
|
|
|
5772
5842
|
needsPermissionChange,
|
|
5773
5843
|
imageRef: options.imageRef
|
|
5774
5844
|
});
|
|
5845
|
+
logger.debug("Checking delegation status...");
|
|
5846
|
+
const authorizationList = await createAuthorizationList({
|
|
5847
|
+
walletClient: batch.walletClient,
|
|
5848
|
+
publicClient: batch.publicClient,
|
|
5849
|
+
environmentConfig: batch.environmentConfig
|
|
5850
|
+
});
|
|
5775
5851
|
logger.debug("Estimating gas...");
|
|
5776
5852
|
const gasEstimate = await estimateBatchGas({
|
|
5777
5853
|
publicClient: batch.publicClient,
|
|
5778
5854
|
account: batch.walletClient.account.address,
|
|
5779
|
-
executions: batch.executions
|
|
5855
|
+
executions: batch.executions,
|
|
5856
|
+
authorizationList
|
|
5780
5857
|
});
|
|
5781
5858
|
const data = {
|
|
5782
5859
|
appId: batch.appId,
|
|
5783
|
-
executions: batch.executions
|
|
5860
|
+
executions: batch.executions,
|
|
5861
|
+
authorizationList
|
|
5784
5862
|
};
|
|
5785
5863
|
return {
|
|
5786
5864
|
prepared: {
|
|
@@ -5953,15 +6031,23 @@ async function prepareUpgrade(options, logger = defaultLogger) {
|
|
|
5953
6031
|
needsPermissionChange,
|
|
5954
6032
|
imageRef: finalImageRef
|
|
5955
6033
|
});
|
|
6034
|
+
logger.debug("Checking delegation status...");
|
|
6035
|
+
const authorizationList = await createAuthorizationList({
|
|
6036
|
+
walletClient: batch.walletClient,
|
|
6037
|
+
publicClient: batch.publicClient,
|
|
6038
|
+
environmentConfig: batch.environmentConfig
|
|
6039
|
+
});
|
|
5956
6040
|
logger.debug("Estimating gas...");
|
|
5957
6041
|
const gasEstimate = await estimateBatchGas({
|
|
5958
6042
|
publicClient: batch.publicClient,
|
|
5959
6043
|
account: batch.walletClient.account.address,
|
|
5960
|
-
executions: batch.executions
|
|
6044
|
+
executions: batch.executions,
|
|
6045
|
+
authorizationList
|
|
5961
6046
|
});
|
|
5962
6047
|
const data = {
|
|
5963
6048
|
appId: batch.appId,
|
|
5964
|
-
executions: batch.executions
|
|
6049
|
+
executions: batch.executions,
|
|
6050
|
+
authorizationList
|
|
5965
6051
|
};
|
|
5966
6052
|
return {
|
|
5967
6053
|
prepared: {
|