@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
package/dist/compute.d.cts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { A as AppModule, j as AppModuleConfig, C as ComputeModule, d as ComputeModuleConfig, i as createAppModule, b as createComputeModule, e as encodeStartAppData, f as encodeStopAppData, h as encodeTerminateAppData } from './compute-
|
|
1
|
+
export { A as AppModule, j as AppModuleConfig, C as ComputeModule, d as ComputeModuleConfig, i as createAppModule, b as createComputeModule, e as encodeStartAppData, f as encodeStopAppData, h as encodeTerminateAppData } from './compute-Dstl0CA0.cjs';
|
|
2
2
|
import 'viem';
|
|
3
|
-
import './index-
|
|
3
|
+
import './index-C0w92tCs.cjs';
|
package/dist/compute.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { A as AppModule, j as AppModuleConfig, C as ComputeModule, d as ComputeModuleConfig, i as createAppModule, b as createComputeModule, e as encodeStartAppData, f as encodeStopAppData, h as encodeTerminateAppData } from './compute-
|
|
1
|
+
export { A as AppModule, j as AppModuleConfig, C as ComputeModule, d as ComputeModuleConfig, i as createAppModule, b as createComputeModule, e as encodeStartAppData, f as encodeStopAppData, h as encodeTerminateAppData } from './compute-CdZxISln.js';
|
|
2
2
|
import 'viem';
|
|
3
|
-
import './index-
|
|
3
|
+
import './index-C0w92tCs.js';
|
package/dist/compute.js
CHANGED
|
@@ -1,3 +1,133 @@
|
|
|
1
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
2
|
+
var __esm = (fn, res) => function __init() {
|
|
3
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
4
|
+
};
|
|
5
|
+
|
|
6
|
+
// src/client/common/auth/session.ts
|
|
7
|
+
function stripHexPrefix2(hex) {
|
|
8
|
+
return hex.startsWith("0x") ? hex.slice(2) : hex;
|
|
9
|
+
}
|
|
10
|
+
async function parseErrorResponse(response) {
|
|
11
|
+
try {
|
|
12
|
+
const data = await response.json();
|
|
13
|
+
return data.error || response.statusText;
|
|
14
|
+
} catch {
|
|
15
|
+
return response.statusText;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
async function loginToComputeApi(config, request) {
|
|
19
|
+
let response;
|
|
20
|
+
try {
|
|
21
|
+
response = await fetch(`${config.baseUrl}/auth/siwe/login`, {
|
|
22
|
+
method: "POST",
|
|
23
|
+
credentials: "include",
|
|
24
|
+
// Include cookies for session management
|
|
25
|
+
headers: {
|
|
26
|
+
"Content-Type": "application/json"
|
|
27
|
+
},
|
|
28
|
+
body: JSON.stringify({
|
|
29
|
+
message: request.message,
|
|
30
|
+
signature: stripHexPrefix2(request.signature)
|
|
31
|
+
})
|
|
32
|
+
});
|
|
33
|
+
} catch (error) {
|
|
34
|
+
throw new SessionError(
|
|
35
|
+
`Network error connecting to ${config.baseUrl}: ${error instanceof Error ? error.message : String(error)}`,
|
|
36
|
+
"NETWORK_ERROR"
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
if (!response.ok) {
|
|
40
|
+
const errorMessage = await parseErrorResponse(response);
|
|
41
|
+
const status = response.status;
|
|
42
|
+
if (status === 400) {
|
|
43
|
+
if (errorMessage.toLowerCase().includes("siwe")) {
|
|
44
|
+
throw new SessionError(`Invalid SIWE message: ${errorMessage}`, "INVALID_MESSAGE", status);
|
|
45
|
+
}
|
|
46
|
+
throw new SessionError(`Bad request: ${errorMessage}`, "INVALID_MESSAGE", status);
|
|
47
|
+
}
|
|
48
|
+
if (status === 401) {
|
|
49
|
+
throw new SessionError(`Invalid signature: ${errorMessage}`, "INVALID_SIGNATURE", status);
|
|
50
|
+
}
|
|
51
|
+
throw new SessionError(`Login failed: ${errorMessage}`, "UNKNOWN", status);
|
|
52
|
+
}
|
|
53
|
+
const data = await response.json();
|
|
54
|
+
return {
|
|
55
|
+
success: data.success,
|
|
56
|
+
address: data.address
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
async function getComputeApiSession(config) {
|
|
60
|
+
let response;
|
|
61
|
+
try {
|
|
62
|
+
response = await fetch(`${config.baseUrl}/auth/session`, {
|
|
63
|
+
method: "GET",
|
|
64
|
+
credentials: "include",
|
|
65
|
+
// Include cookies for session management
|
|
66
|
+
headers: {
|
|
67
|
+
"Content-Type": "application/json"
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
} catch {
|
|
71
|
+
return {
|
|
72
|
+
authenticated: false
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
if (response.status === 401) {
|
|
76
|
+
return {
|
|
77
|
+
authenticated: false
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
if (!response.ok) {
|
|
81
|
+
const errorMessage = await parseErrorResponse(response);
|
|
82
|
+
throw new SessionError(`Failed to get session: ${errorMessage}`, "UNKNOWN", response.status);
|
|
83
|
+
}
|
|
84
|
+
const data = await response.json();
|
|
85
|
+
return {
|
|
86
|
+
authenticated: data.authenticated,
|
|
87
|
+
address: data.address,
|
|
88
|
+
chainId: data.chain_id
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
async function logoutFromComputeApi(config) {
|
|
92
|
+
let response;
|
|
93
|
+
try {
|
|
94
|
+
response = await fetch(`${config.baseUrl}/auth/logout`, {
|
|
95
|
+
method: "POST",
|
|
96
|
+
credentials: "include",
|
|
97
|
+
// Include cookies for session management
|
|
98
|
+
headers: {
|
|
99
|
+
"Content-Type": "application/json"
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
} catch (error) {
|
|
103
|
+
throw new SessionError(
|
|
104
|
+
`Network error connecting to ${config.baseUrl}: ${error instanceof Error ? error.message : String(error)}`,
|
|
105
|
+
"NETWORK_ERROR"
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
if (response.status === 401) {
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
if (!response.ok) {
|
|
112
|
+
const errorMessage = await parseErrorResponse(response);
|
|
113
|
+
throw new SessionError(`Logout failed: ${errorMessage}`, "UNKNOWN", response.status);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
var SessionError;
|
|
117
|
+
var init_session = __esm({
|
|
118
|
+
"src/client/common/auth/session.ts"() {
|
|
119
|
+
"use strict";
|
|
120
|
+
SessionError = class extends Error {
|
|
121
|
+
constructor(message, code, statusCode) {
|
|
122
|
+
super(message);
|
|
123
|
+
this.code = code;
|
|
124
|
+
this.statusCode = statusCode;
|
|
125
|
+
this.name = "SessionError";
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
|
|
1
131
|
// src/client/modules/compute/app/index.ts
|
|
2
132
|
import { parseAbi as parseAbi2, encodeFunctionData as encodeFunctionData3 } from "viem";
|
|
3
133
|
|
|
@@ -4274,126 +4404,8 @@ async function calculatePermissionSignature(options) {
|
|
|
4274
4404
|
return { signature, digest };
|
|
4275
4405
|
}
|
|
4276
4406
|
|
|
4277
|
-
// src/client/common/auth/session.ts
|
|
4278
|
-
var SessionError = class extends Error {
|
|
4279
|
-
constructor(message, code, statusCode) {
|
|
4280
|
-
super(message);
|
|
4281
|
-
this.code = code;
|
|
4282
|
-
this.statusCode = statusCode;
|
|
4283
|
-
this.name = "SessionError";
|
|
4284
|
-
}
|
|
4285
|
-
};
|
|
4286
|
-
function stripHexPrefix2(hex) {
|
|
4287
|
-
return hex.startsWith("0x") ? hex.slice(2) : hex;
|
|
4288
|
-
}
|
|
4289
|
-
async function parseErrorResponse(response) {
|
|
4290
|
-
try {
|
|
4291
|
-
const data = await response.json();
|
|
4292
|
-
return data.error || response.statusText;
|
|
4293
|
-
} catch {
|
|
4294
|
-
return response.statusText;
|
|
4295
|
-
}
|
|
4296
|
-
}
|
|
4297
|
-
async function loginToComputeApi(config, request) {
|
|
4298
|
-
let response;
|
|
4299
|
-
try {
|
|
4300
|
-
response = await fetch(`${config.baseUrl}/auth/siwe/login`, {
|
|
4301
|
-
method: "POST",
|
|
4302
|
-
credentials: "include",
|
|
4303
|
-
// Include cookies for session management
|
|
4304
|
-
headers: {
|
|
4305
|
-
"Content-Type": "application/json"
|
|
4306
|
-
},
|
|
4307
|
-
body: JSON.stringify({
|
|
4308
|
-
message: request.message,
|
|
4309
|
-
signature: stripHexPrefix2(request.signature)
|
|
4310
|
-
})
|
|
4311
|
-
});
|
|
4312
|
-
} catch (error) {
|
|
4313
|
-
throw new SessionError(
|
|
4314
|
-
`Network error connecting to ${config.baseUrl}: ${error instanceof Error ? error.message : String(error)}`,
|
|
4315
|
-
"NETWORK_ERROR"
|
|
4316
|
-
);
|
|
4317
|
-
}
|
|
4318
|
-
if (!response.ok) {
|
|
4319
|
-
const errorMessage = await parseErrorResponse(response);
|
|
4320
|
-
const status = response.status;
|
|
4321
|
-
if (status === 400) {
|
|
4322
|
-
if (errorMessage.toLowerCase().includes("siwe")) {
|
|
4323
|
-
throw new SessionError(`Invalid SIWE message: ${errorMessage}`, "INVALID_MESSAGE", status);
|
|
4324
|
-
}
|
|
4325
|
-
throw new SessionError(`Bad request: ${errorMessage}`, "INVALID_MESSAGE", status);
|
|
4326
|
-
}
|
|
4327
|
-
if (status === 401) {
|
|
4328
|
-
throw new SessionError(`Invalid signature: ${errorMessage}`, "INVALID_SIGNATURE", status);
|
|
4329
|
-
}
|
|
4330
|
-
throw new SessionError(`Login failed: ${errorMessage}`, "UNKNOWN", status);
|
|
4331
|
-
}
|
|
4332
|
-
const data = await response.json();
|
|
4333
|
-
return {
|
|
4334
|
-
success: data.success,
|
|
4335
|
-
address: data.address
|
|
4336
|
-
};
|
|
4337
|
-
}
|
|
4338
|
-
async function getComputeApiSession(config) {
|
|
4339
|
-
let response;
|
|
4340
|
-
try {
|
|
4341
|
-
response = await fetch(`${config.baseUrl}/auth/session`, {
|
|
4342
|
-
method: "GET",
|
|
4343
|
-
credentials: "include",
|
|
4344
|
-
// Include cookies for session management
|
|
4345
|
-
headers: {
|
|
4346
|
-
"Content-Type": "application/json"
|
|
4347
|
-
}
|
|
4348
|
-
});
|
|
4349
|
-
} catch {
|
|
4350
|
-
return {
|
|
4351
|
-
authenticated: false
|
|
4352
|
-
};
|
|
4353
|
-
}
|
|
4354
|
-
if (response.status === 401) {
|
|
4355
|
-
return {
|
|
4356
|
-
authenticated: false
|
|
4357
|
-
};
|
|
4358
|
-
}
|
|
4359
|
-
if (!response.ok) {
|
|
4360
|
-
const errorMessage = await parseErrorResponse(response);
|
|
4361
|
-
throw new SessionError(`Failed to get session: ${errorMessage}`, "UNKNOWN", response.status);
|
|
4362
|
-
}
|
|
4363
|
-
const data = await response.json();
|
|
4364
|
-
return {
|
|
4365
|
-
authenticated: data.authenticated,
|
|
4366
|
-
address: data.address,
|
|
4367
|
-
chainId: data.chain_id
|
|
4368
|
-
};
|
|
4369
|
-
}
|
|
4370
|
-
async function logoutFromComputeApi(config) {
|
|
4371
|
-
let response;
|
|
4372
|
-
try {
|
|
4373
|
-
response = await fetch(`${config.baseUrl}/auth/logout`, {
|
|
4374
|
-
method: "POST",
|
|
4375
|
-
credentials: "include",
|
|
4376
|
-
// Include cookies for session management
|
|
4377
|
-
headers: {
|
|
4378
|
-
"Content-Type": "application/json"
|
|
4379
|
-
}
|
|
4380
|
-
});
|
|
4381
|
-
} catch (error) {
|
|
4382
|
-
throw new SessionError(
|
|
4383
|
-
`Network error connecting to ${config.baseUrl}: ${error instanceof Error ? error.message : String(error)}`,
|
|
4384
|
-
"NETWORK_ERROR"
|
|
4385
|
-
);
|
|
4386
|
-
}
|
|
4387
|
-
if (response.status === 401) {
|
|
4388
|
-
return;
|
|
4389
|
-
}
|
|
4390
|
-
if (!response.ok) {
|
|
4391
|
-
const errorMessage = await parseErrorResponse(response);
|
|
4392
|
-
throw new SessionError(`Logout failed: ${errorMessage}`, "UNKNOWN", response.status);
|
|
4393
|
-
}
|
|
4394
|
-
}
|
|
4395
|
-
|
|
4396
4407
|
// src/client/common/utils/userapi.ts
|
|
4408
|
+
init_session();
|
|
4397
4409
|
function isJsonObject(value) {
|
|
4398
4410
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
4399
4411
|
}
|
|
@@ -4410,7 +4422,7 @@ var CanViewAppLogsPermission = "0x2fd3f2fe";
|
|
|
4410
4422
|
var CanViewSensitiveAppInfoPermission = "0x0e67b22f";
|
|
4411
4423
|
var CanUpdateAppProfilePermission = "0x036fef61";
|
|
4412
4424
|
function getDefaultClientId() {
|
|
4413
|
-
const version = true ? "0.
|
|
4425
|
+
const version = true ? "0.3.0-dev" : "0.0.0";
|
|
4414
4426
|
return `ecloud-sdk/v${version}`;
|
|
4415
4427
|
}
|
|
4416
4428
|
var UserApiClient = class {
|