@layr-labs/ecloud-sdk 0.5.0-dev.3 → 1.0.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.
- package/VERSION +2 -2
- package/dist/attest.cjs +31 -9
- package/dist/attest.cjs.map +1 -1
- package/dist/attest.d.cts +3 -2
- package/dist/attest.d.ts +3 -2
- package/dist/attest.js +31 -9
- package/dist/attest.js.map +1 -1
- package/dist/billing.cjs +46 -6
- package/dist/billing.cjs.map +1 -1
- package/dist/billing.d.cts +3 -1
- package/dist/billing.d.ts +3 -1
- package/dist/billing.js +46 -6
- package/dist/billing.js.map +1 -1
- package/dist/browser.cjs +40 -6
- package/dist/browser.cjs.map +1 -1
- package/dist/browser.d.cts +4 -4
- package/dist/browser.d.ts +4 -4
- package/dist/browser.js +40 -6
- package/dist/browser.js.map +1 -1
- package/dist/{compute-Ckyn8ils.d.cts → compute-Bn6KcW3x.d.cts} +1 -1
- package/dist/{compute-Cnw6rwSB.d.ts → compute-Do2t0Fo8.d.ts} +1 -1
- package/dist/compute.cjs +8 -2
- 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 +8 -2
- package/dist/compute.js.map +1 -1
- package/dist/{helpers-DZL2bg9p.d.cts → helpers-BRamdfGn.d.ts} +5 -1
- package/dist/{helpers-Dj2ME5rp.d.ts → helpers-CfsfcGJO.d.cts} +5 -1
- package/dist/{index-U2vKBrry.d.cts → index-BbH7ZCIu.d.cts} +15 -1
- package/dist/{index-U2vKBrry.d.ts → index-BbH7ZCIu.d.ts} +15 -1
- package/dist/index.cjs +78 -16
- 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 +78 -16
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/browser.cjs
CHANGED
|
@@ -349,7 +349,13 @@ function getEnvironmentConfig(environment, chainID) {
|
|
|
349
349
|
const resolvedChainID = chainID || (environment === "sepolia" || environment === "sepolia-dev" ? SEPOLIA_CHAIN_ID : MAINNET_CHAIN_ID);
|
|
350
350
|
return {
|
|
351
351
|
...env,
|
|
352
|
-
chainID: BigInt(resolvedChainID)
|
|
352
|
+
chainID: BigInt(resolvedChainID),
|
|
353
|
+
...process.env.ECLOUD_USER_API_URL && {
|
|
354
|
+
userApiServerURL: process.env.ECLOUD_USER_API_URL
|
|
355
|
+
},
|
|
356
|
+
...process.env.ECLOUD_RPC_URL && {
|
|
357
|
+
defaultRPCURL: process.env.ECLOUD_RPC_URL
|
|
358
|
+
}
|
|
353
359
|
};
|
|
354
360
|
}
|
|
355
361
|
function getBillingEnvironmentConfig(build) {
|
|
@@ -357,7 +363,12 @@ function getBillingEnvironmentConfig(build) {
|
|
|
357
363
|
if (!config) {
|
|
358
364
|
throw new Error(`Unknown billing environment: ${build}`);
|
|
359
365
|
}
|
|
360
|
-
return
|
|
366
|
+
return {
|
|
367
|
+
...config,
|
|
368
|
+
...process.env.ECLOUD_BILLING_API_URL && {
|
|
369
|
+
billingApiServerURL: process.env.ECLOUD_BILLING_API_URL
|
|
370
|
+
}
|
|
371
|
+
};
|
|
361
372
|
}
|
|
362
373
|
function getBuildType() {
|
|
363
374
|
const buildTimeType = true ? "dev"?.toLowerCase() : void 0;
|
|
@@ -717,7 +728,7 @@ var CanViewAppLogsPermission = "0x2fd3f2fe";
|
|
|
717
728
|
var CanViewSensitiveAppInfoPermission = "0x0e67b22f";
|
|
718
729
|
var CanUpdateAppProfilePermission = "0x036fef61";
|
|
719
730
|
function getDefaultClientId() {
|
|
720
|
-
const version = true ? "0.
|
|
731
|
+
const version = true ? "1.0.0-dev.1" : "0.0.0";
|
|
721
732
|
return `ecloud-sdk/v${version}`;
|
|
722
733
|
}
|
|
723
734
|
var UserApiClient = class {
|
|
@@ -1305,6 +1316,20 @@ var BillingApiClient = class {
|
|
|
1305
1316
|
const endpoint = `${this.config.billingApiServerURL}/products/${productId}/subscription`;
|
|
1306
1317
|
await this.makeAuthenticatedRequest(endpoint, "DELETE", productId);
|
|
1307
1318
|
}
|
|
1319
|
+
async getPaymentMethods() {
|
|
1320
|
+
const endpoint = `${this.config.billingApiServerURL}/v1/payment-methods`;
|
|
1321
|
+
const resp = await this.makeAuthenticatedRequest(endpoint, "GET", "compute");
|
|
1322
|
+
return resp.json();
|
|
1323
|
+
}
|
|
1324
|
+
async purchaseCredits(amountCents, paymentMethodId) {
|
|
1325
|
+
const endpoint = `${this.config.billingApiServerURL}/v1/credits/purchase`;
|
|
1326
|
+
const body = { amountCents };
|
|
1327
|
+
if (paymentMethodId) {
|
|
1328
|
+
body.paymentMethodId = paymentMethodId;
|
|
1329
|
+
}
|
|
1330
|
+
const resp = await this.makeAuthenticatedRequest(endpoint, "POST", "compute", body);
|
|
1331
|
+
return resp.json();
|
|
1332
|
+
}
|
|
1308
1333
|
// ==========================================================================
|
|
1309
1334
|
// Internal Methods
|
|
1310
1335
|
// ==========================================================================
|
|
@@ -1314,10 +1339,19 @@ var BillingApiClient = class {
|
|
|
1314
1339
|
* Uses session auth if useSession is true, otherwise uses EIP-712 signature auth.
|
|
1315
1340
|
*/
|
|
1316
1341
|
async makeAuthenticatedRequest(url, method, productId, body) {
|
|
1317
|
-
if (this.
|
|
1318
|
-
|
|
1342
|
+
if (this.options.verbose) {
|
|
1343
|
+
console.debug(`[BillingAPI] ${method} ${url}`);
|
|
1344
|
+
}
|
|
1345
|
+
const resp = this.useSession ? await this.makeSessionAuthenticatedRequest(url, method, body) : await this.makeSignatureAuthenticatedRequest(url, method, productId, body);
|
|
1346
|
+
if (this.options.verbose) {
|
|
1347
|
+
const data = await resp.json();
|
|
1348
|
+
console.debug(`[BillingAPI] Response:`, JSON.stringify(data, null, 2));
|
|
1349
|
+
return {
|
|
1350
|
+
json: async () => data,
|
|
1351
|
+
text: async () => JSON.stringify(data)
|
|
1352
|
+
};
|
|
1319
1353
|
}
|
|
1320
|
-
return
|
|
1354
|
+
return resp;
|
|
1321
1355
|
}
|
|
1322
1356
|
/**
|
|
1323
1357
|
* Make a request using session-based authentication (cookies)
|