@layr-labs/ecloud-sdk 0.2.2-dev → 0.3.0-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.
- 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 +527 -147
- 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 +527 -147
- package/dist/browser.js.map +1 -1
- package/dist/{compute-BYhSs8en.d.ts → compute-CdZxISln.d.ts} +1 -1
- package/dist/{compute-Bpjb3hYD.d.cts → compute-Dstl0CA0.d.cts} +1 -1
- package/dist/compute.cjs +130 -120
- 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 +132 -120
- package/dist/compute.js.map +1 -1
- package/dist/{helpers-CEvhJz7f.d.cts → helpers-4w0Iojmm.d.ts} +245 -4
- package/dist/{helpers-CQuBwQnu.d.ts → helpers-Dk0zwgms.d.cts} +245 -4
- package/dist/{index-DeQzn_yM.d.cts → index-C0w92tCs.d.cts} +4 -0
- package/dist/{index-DeQzn_yM.d.ts → index-C0w92tCs.d.ts} +4 -0
- package/dist/index.cjs +489 -148
- 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 +491 -148
- 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-C0w92tCs.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-C0w92tCs.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, {
|
|
@@ -4315,126 +4443,8 @@ async function calculatePermissionSignature(options) {
|
|
|
4315
4443
|
return { signature, digest };
|
|
4316
4444
|
}
|
|
4317
4445
|
|
|
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
4446
|
// src/client/common/utils/userapi.ts
|
|
4447
|
+
init_session();
|
|
4438
4448
|
function isJsonObject(value) {
|
|
4439
4449
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
4440
4450
|
}
|
|
@@ -4451,7 +4461,7 @@ var CanViewAppLogsPermission = "0x2fd3f2fe";
|
|
|
4451
4461
|
var CanViewSensitiveAppInfoPermission = "0x0e67b22f";
|
|
4452
4462
|
var CanUpdateAppProfilePermission = "0x036fef61";
|
|
4453
4463
|
function getDefaultClientId() {
|
|
4454
|
-
const version = true ? "0.
|
|
4464
|
+
const version = true ? "0.3.0-dev" : "0.0.0";
|
|
4455
4465
|
return `ecloud-sdk/v${version}`;
|
|
4456
4466
|
}
|
|
4457
4467
|
var UserApiClient = class {
|