@layr-labs/ecloud-sdk 1.0.0-dev.4 → 1.0.0-dev.5
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 +60 -0
- package/dist/billing.cjs.map +1 -1
- package/dist/billing.d.cts +2 -1
- package/dist/billing.d.ts +2 -1
- package/dist/billing.js +60 -0
- package/dist/billing.js.map +1 -1
- package/dist/browser.cjs +58 -1
- 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 +58 -1
- package/dist/browser.js.map +1 -1
- package/dist/{compute-B6SZ0VQG.d.ts → compute-9bzsfthb.d.ts} +1 -1
- package/dist/{compute-BK4PxhNh.d.cts → compute-RhRi2H8h.d.cts} +1 -1
- package/dist/compute.cjs +1 -1
- 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 +1 -1
- package/dist/compute.js.map +1 -1
- package/dist/{helpers-Qq5W-qNn.d.cts → helpers-CqrBJ39N.d.cts} +15 -1
- package/dist/{helpers-F7CeDSVX.d.ts → helpers-DEGFGA-T.d.ts} +15 -1
- package/dist/{index-BoCE0hIh.d.cts → index-CLhRJNai.d.cts} +34 -1
- package/dist/{index-BoCE0hIh.d.ts → index-CLhRJNai.d.ts} +34 -1
- package/dist/index.cjs +101 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +31 -7
- package/dist/index.d.ts +31 -7
- package/dist/index.js +100 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/VERSION
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
version=1.0.0-dev.
|
|
2
|
-
commit=
|
|
1
|
+
version=1.0.0-dev.5
|
|
2
|
+
commit=7451666189ca42c9ef358346e8998e3e35640e42
|
package/dist/billing.cjs
CHANGED
|
@@ -332,6 +332,63 @@ var BillingApiClient = class {
|
|
|
332
332
|
return resp.json();
|
|
333
333
|
}
|
|
334
334
|
// ==========================================================================
|
|
335
|
+
// Admin - Coupon Methods
|
|
336
|
+
// ==========================================================================
|
|
337
|
+
async createCoupon(amountCents) {
|
|
338
|
+
const endpoint = `${this.config.billingApiServerURL}/admin/coupons`;
|
|
339
|
+
const resp = await this.makeAuthenticatedRequest(endpoint, "POST", "compute", { amountCents });
|
|
340
|
+
return resp.json();
|
|
341
|
+
}
|
|
342
|
+
async listCoupons(opts) {
|
|
343
|
+
const params = new URLSearchParams();
|
|
344
|
+
if (opts?.offset !== void 0) params.set("offset", opts.offset.toString());
|
|
345
|
+
if (opts?.limit !== void 0) params.set("limit", opts.limit.toString());
|
|
346
|
+
if (opts?.active !== void 0) params.set("active", opts.active.toString());
|
|
347
|
+
if (opts?.redeemed !== void 0) params.set("redeemed", opts.redeemed.toString());
|
|
348
|
+
const qs = params.toString();
|
|
349
|
+
const endpoint = `${this.config.billingApiServerURL}/admin/coupons${qs ? `?${qs}` : ""}`;
|
|
350
|
+
const resp = await this.makeAuthenticatedRequest(endpoint, "GET", "compute");
|
|
351
|
+
return resp.json();
|
|
352
|
+
}
|
|
353
|
+
async getCoupon(id) {
|
|
354
|
+
const endpoint = `${this.config.billingApiServerURL}/admin/coupons/${id}`;
|
|
355
|
+
const resp = await this.makeAuthenticatedRequest(endpoint, "GET", "compute");
|
|
356
|
+
return resp.json();
|
|
357
|
+
}
|
|
358
|
+
async deactivateCoupon(id) {
|
|
359
|
+
const endpoint = `${this.config.billingApiServerURL}/admin/coupons/${id}/deactivate`;
|
|
360
|
+
await this.makeAuthenticatedRequest(endpoint, "POST", "compute");
|
|
361
|
+
}
|
|
362
|
+
async redeemCouponForUser(id, address) {
|
|
363
|
+
const endpoint = `${this.config.billingApiServerURL}/admin/coupons/${id}/redeem`;
|
|
364
|
+
await this.makeAuthenticatedRequest(endpoint, "POST", "compute", { address });
|
|
365
|
+
}
|
|
366
|
+
// ==========================================================================
|
|
367
|
+
// Admin - Admin Management Methods
|
|
368
|
+
// ==========================================================================
|
|
369
|
+
async addAdmin(address) {
|
|
370
|
+
const endpoint = `${this.config.billingApiServerURL}/admin/admins`;
|
|
371
|
+
const resp = await this.makeAuthenticatedRequest(endpoint, "POST", "compute", { address });
|
|
372
|
+
return resp.json();
|
|
373
|
+
}
|
|
374
|
+
async removeAdmin(address) {
|
|
375
|
+
const endpoint = `${this.config.billingApiServerURL}/admin/admins/${address}`;
|
|
376
|
+
await this.makeAuthenticatedRequest(endpoint, "DELETE", "compute");
|
|
377
|
+
}
|
|
378
|
+
async listAdmins() {
|
|
379
|
+
const endpoint = `${this.config.billingApiServerURL}/admin/admins`;
|
|
380
|
+
const resp = await this.makeAuthenticatedRequest(endpoint, "GET", "compute");
|
|
381
|
+
return resp.json();
|
|
382
|
+
}
|
|
383
|
+
// ==========================================================================
|
|
384
|
+
// User - Coupon Redemption
|
|
385
|
+
// ==========================================================================
|
|
386
|
+
async redeemCoupon(code) {
|
|
387
|
+
const endpoint = `${this.config.billingApiServerURL}/v1/coupons/redeem`;
|
|
388
|
+
const resp = await this.makeAuthenticatedRequest(endpoint, "POST", "compute", { code });
|
|
389
|
+
return resp.json();
|
|
390
|
+
}
|
|
391
|
+
// ==========================================================================
|
|
335
392
|
// Internal Methods
|
|
336
393
|
// ==========================================================================
|
|
337
394
|
/**
|
|
@@ -2355,6 +2412,9 @@ function createBillingModule(config) {
|
|
|
2355
2412
|
},
|
|
2356
2413
|
hasBaseSupport() {
|
|
2357
2414
|
return !!baseUsdcCreditsAddress && !!baseRPCURL;
|
|
2415
|
+
},
|
|
2416
|
+
async redeemCoupon(code) {
|
|
2417
|
+
return billingApi.redeemCoupon(code);
|
|
2358
2418
|
}
|
|
2359
2419
|
};
|
|
2360
2420
|
return module2;
|