@layr-labs/ecloud-sdk 1.0.0-dev.3 → 1.0.0-devep1
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 +6 -49
- package/dist/billing.cjs.map +1 -1
- package/dist/billing.d.cts +1 -3
- package/dist/billing.d.ts +1 -3
- package/dist/billing.js +6 -49
- package/dist/billing.js.map +1 -1
- package/dist/browser.cjs +6 -43
- 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 +6 -43
- package/dist/browser.js.map +1 -1
- package/dist/{compute-yAqGf5hM.d.cts → compute-Ckyn8ils.d.cts} +1 -1
- package/dist/{compute-BbgMH6Ef.d.ts → compute-Cnw6rwSB.d.ts} +1 -1
- package/dist/compute.cjs +325 -59
- 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 +325 -59
- package/dist/compute.js.map +1 -1
- package/dist/{helpers-GWlLS3gz.d.ts → helpers-DZL2bg9p.d.cts} +1 -5
- package/dist/{helpers-CnlJ5yPE.d.cts → helpers-Dj2ME5rp.d.ts} +1 -5
- package/dist/{index-Bac4HjC0.d.cts → index-U2vKBrry.d.cts} +1 -17
- package/dist/{index-Bac4HjC0.d.ts → index-U2vKBrry.d.ts} +1 -17
- package/dist/index.cjs +330 -101
- 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 +330 -101
- package/dist/index.js.map +1 -1
- package/package.json +5 -4
- package/tools/ecloud-drain-watcher-linux-amd64 +0 -0
- package/tools/tls-keygen-linux-amd64 +0 -0
package/VERSION
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
version=1.0.0-
|
|
2
|
-
commit=
|
|
1
|
+
version=1.0.0-devep1
|
|
2
|
+
commit=b210c1e7e17be9d0847834901bd986b0a3742456
|
package/dist/billing.cjs
CHANGED
|
@@ -317,20 +317,6 @@ var BillingApiClient = class {
|
|
|
317
317
|
const endpoint = `${this.config.billingApiServerURL}/products/${productId}/subscription`;
|
|
318
318
|
await this.makeAuthenticatedRequest(endpoint, "DELETE", productId);
|
|
319
319
|
}
|
|
320
|
-
async getPaymentMethods() {
|
|
321
|
-
const endpoint = `${this.config.billingApiServerURL}/v1/payment-methods`;
|
|
322
|
-
const resp = await this.makeAuthenticatedRequest(endpoint, "GET", "compute");
|
|
323
|
-
return resp.json();
|
|
324
|
-
}
|
|
325
|
-
async purchaseCredits(amountCents, paymentMethodId) {
|
|
326
|
-
const endpoint = `${this.config.billingApiServerURL}/v1/credits/purchase`;
|
|
327
|
-
const body = { amountCents };
|
|
328
|
-
if (paymentMethodId) {
|
|
329
|
-
body.paymentMethodId = paymentMethodId;
|
|
330
|
-
}
|
|
331
|
-
const resp = await this.makeAuthenticatedRequest(endpoint, "POST", "compute", body);
|
|
332
|
-
return resp.json();
|
|
333
|
-
}
|
|
334
320
|
// ==========================================================================
|
|
335
321
|
// Internal Methods
|
|
336
322
|
// ==========================================================================
|
|
@@ -340,22 +326,10 @@ var BillingApiClient = class {
|
|
|
340
326
|
* Uses session auth if useSession is true, otherwise uses EIP-712 signature auth.
|
|
341
327
|
*/
|
|
342
328
|
async makeAuthenticatedRequest(url, method, productId, body) {
|
|
343
|
-
if (this.
|
|
344
|
-
|
|
345
|
-
if (body) {
|
|
346
|
-
console.debug(`[BillingAPI] Payload:`, JSON.stringify(body, null, 2));
|
|
347
|
-
}
|
|
348
|
-
}
|
|
349
|
-
const resp = this.useSession ? await this.makeSessionAuthenticatedRequest(url, method, body) : await this.makeSignatureAuthenticatedRequest(url, method, productId, body);
|
|
350
|
-
if (this.options.verbose) {
|
|
351
|
-
const data = await resp.json();
|
|
352
|
-
console.debug(`[BillingAPI] Response:`, JSON.stringify(data, null, 2));
|
|
353
|
-
return {
|
|
354
|
-
json: async () => data,
|
|
355
|
-
text: async () => JSON.stringify(data)
|
|
356
|
-
};
|
|
329
|
+
if (this.useSession) {
|
|
330
|
+
return this.makeSessionAuthenticatedRequest(url, method, body);
|
|
357
331
|
}
|
|
358
|
-
return
|
|
332
|
+
return this.makeSignatureAuthenticatedRequest(url, method, productId, body);
|
|
359
333
|
}
|
|
360
334
|
/**
|
|
361
335
|
* Make a request using session-based authentication (cookies)
|
|
@@ -549,13 +523,7 @@ function getEnvironmentConfig(environment, chainID) {
|
|
|
549
523
|
return {
|
|
550
524
|
...env,
|
|
551
525
|
chainID: BigInt(resolvedChainID),
|
|
552
|
-
...apiUrlOverride ? { userApiServerURL: apiUrlOverride } : {}
|
|
553
|
-
...process.env.ECLOUD_USER_API_URL && {
|
|
554
|
-
userApiServerURL: process.env.ECLOUD_USER_API_URL
|
|
555
|
-
},
|
|
556
|
-
...process.env.ECLOUD_RPC_URL && {
|
|
557
|
-
defaultRPCURL: process.env.ECLOUD_RPC_URL
|
|
558
|
-
}
|
|
526
|
+
...apiUrlOverride ? { userApiServerURL: apiUrlOverride } : {}
|
|
559
527
|
};
|
|
560
528
|
}
|
|
561
529
|
function getBillingEnvironmentConfig(build) {
|
|
@@ -567,12 +535,7 @@ function getBillingEnvironmentConfig(build) {
|
|
|
567
535
|
if (apiUrlOverride) {
|
|
568
536
|
return { billingApiServerURL: apiUrlOverride };
|
|
569
537
|
}
|
|
570
|
-
return
|
|
571
|
-
...config,
|
|
572
|
-
...process.env.ECLOUD_BILLING_API_URL && {
|
|
573
|
-
billingApiServerURL: process.env.ECLOUD_BILLING_API_URL
|
|
574
|
-
}
|
|
575
|
-
};
|
|
538
|
+
return config;
|
|
576
539
|
}
|
|
577
540
|
function getBuildType() {
|
|
578
541
|
const buildTimeType = true ? "dev"?.toLowerCase() : void 0;
|
|
@@ -2115,7 +2078,7 @@ function createBillingModule(config) {
|
|
|
2115
2078
|
const address = walletClient.account.address;
|
|
2116
2079
|
const logger = getLogger(verbose);
|
|
2117
2080
|
const billingEnvConfig = getBillingEnvironmentConfig(getBuildType());
|
|
2118
|
-
const billingApi = new BillingApiClient(billingEnvConfig, walletClient
|
|
2081
|
+
const billingApi = new BillingApiClient(billingEnvConfig, walletClient);
|
|
2119
2082
|
const environmentConfig = getEnvironmentConfig(environment);
|
|
2120
2083
|
const usdcCreditsAddress = environmentConfig.usdcCreditsAddress;
|
|
2121
2084
|
if (!usdcCreditsAddress) {
|
|
@@ -2279,12 +2242,6 @@ function createBillingModule(config) {
|
|
|
2279
2242
|
};
|
|
2280
2243
|
}
|
|
2281
2244
|
);
|
|
2282
|
-
},
|
|
2283
|
-
async getPaymentMethods() {
|
|
2284
|
-
return billingApi.getPaymentMethods();
|
|
2285
|
-
},
|
|
2286
|
-
async purchaseCredits(amountCents, paymentMethodId) {
|
|
2287
|
-
return billingApi.purchaseCredits(amountCents, paymentMethodId);
|
|
2288
2245
|
}
|
|
2289
2246
|
};
|
|
2290
2247
|
return module2;
|