@layr-labs/ecloud-sdk 1.0.0-dev.4 → 1.0.0-dev.6
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/dist/billing.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Address, Hex, WalletClient, PublicClient } from 'viem';
|
|
2
|
-
import {
|
|
2
|
+
import { ae as SubscriptionOpts, ac as SubscribeResponse, a7 as ProductSubscriptionResponse, j as CancelResponse, V as PaymentMethodsResponse, q as CreditPurchaseResponse, a8 as RedeemCouponResponse } from './index-CLhRJNai.cjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Main Billing namespace entry point
|
|
@@ -42,6 +42,7 @@ interface BillingModule {
|
|
|
42
42
|
purchaseCredits: (amountCents: number, paymentMethodId?: string) => Promise<CreditPurchaseResponse>;
|
|
43
43
|
/** Check if Base chain is configured for this environment */
|
|
44
44
|
hasBaseSupport: () => boolean;
|
|
45
|
+
redeemCoupon: (code: string) => Promise<RedeemCouponResponse>;
|
|
45
46
|
}
|
|
46
47
|
interface BillingModuleConfig {
|
|
47
48
|
verbose?: boolean;
|
package/dist/billing.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Address, Hex, WalletClient, PublicClient } from 'viem';
|
|
2
|
-
import {
|
|
2
|
+
import { ae as SubscriptionOpts, ac as SubscribeResponse, a7 as ProductSubscriptionResponse, j as CancelResponse, V as PaymentMethodsResponse, q as CreditPurchaseResponse, a8 as RedeemCouponResponse } from './index-CLhRJNai.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Main Billing namespace entry point
|
|
@@ -42,6 +42,7 @@ interface BillingModule {
|
|
|
42
42
|
purchaseCredits: (amountCents: number, paymentMethodId?: string) => Promise<CreditPurchaseResponse>;
|
|
43
43
|
/** Check if Base chain is configured for this environment */
|
|
44
44
|
hasBaseSupport: () => boolean;
|
|
45
|
+
redeemCoupon: (code: string) => Promise<RedeemCouponResponse>;
|
|
45
46
|
}
|
|
46
47
|
interface BillingModuleConfig {
|
|
47
48
|
verbose?: boolean;
|
package/dist/billing.js
CHANGED
|
@@ -298,6 +298,63 @@ var BillingApiClient = class {
|
|
|
298
298
|
return resp.json();
|
|
299
299
|
}
|
|
300
300
|
// ==========================================================================
|
|
301
|
+
// Admin - Coupon Methods
|
|
302
|
+
// ==========================================================================
|
|
303
|
+
async createCoupon(amountCents) {
|
|
304
|
+
const endpoint = `${this.config.billingApiServerURL}/admin/coupons`;
|
|
305
|
+
const resp = await this.makeAuthenticatedRequest(endpoint, "POST", "compute", { amountCents });
|
|
306
|
+
return resp.json();
|
|
307
|
+
}
|
|
308
|
+
async listCoupons(opts) {
|
|
309
|
+
const params = new URLSearchParams();
|
|
310
|
+
if (opts?.offset !== void 0) params.set("offset", opts.offset.toString());
|
|
311
|
+
if (opts?.limit !== void 0) params.set("limit", opts.limit.toString());
|
|
312
|
+
if (opts?.active !== void 0) params.set("active", opts.active.toString());
|
|
313
|
+
if (opts?.redeemed !== void 0) params.set("redeemed", opts.redeemed.toString());
|
|
314
|
+
const qs = params.toString();
|
|
315
|
+
const endpoint = `${this.config.billingApiServerURL}/admin/coupons${qs ? `?${qs}` : ""}`;
|
|
316
|
+
const resp = await this.makeAuthenticatedRequest(endpoint, "GET", "compute");
|
|
317
|
+
return resp.json();
|
|
318
|
+
}
|
|
319
|
+
async getCoupon(id) {
|
|
320
|
+
const endpoint = `${this.config.billingApiServerURL}/admin/coupons/${id}`;
|
|
321
|
+
const resp = await this.makeAuthenticatedRequest(endpoint, "GET", "compute");
|
|
322
|
+
return resp.json();
|
|
323
|
+
}
|
|
324
|
+
async deactivateCoupon(id) {
|
|
325
|
+
const endpoint = `${this.config.billingApiServerURL}/admin/coupons/${id}/deactivate`;
|
|
326
|
+
await this.makeAuthenticatedRequest(endpoint, "POST", "compute");
|
|
327
|
+
}
|
|
328
|
+
async redeemCouponForUser(id, address) {
|
|
329
|
+
const endpoint = `${this.config.billingApiServerURL}/admin/coupons/${id}/redeem`;
|
|
330
|
+
await this.makeAuthenticatedRequest(endpoint, "POST", "compute", { address });
|
|
331
|
+
}
|
|
332
|
+
// ==========================================================================
|
|
333
|
+
// Admin - Admin Management Methods
|
|
334
|
+
// ==========================================================================
|
|
335
|
+
async addAdmin(address) {
|
|
336
|
+
const endpoint = `${this.config.billingApiServerURL}/admin/admins`;
|
|
337
|
+
const resp = await this.makeAuthenticatedRequest(endpoint, "POST", "compute", { address });
|
|
338
|
+
return resp.json();
|
|
339
|
+
}
|
|
340
|
+
async removeAdmin(address) {
|
|
341
|
+
const endpoint = `${this.config.billingApiServerURL}/admin/admins/${address}`;
|
|
342
|
+
await this.makeAuthenticatedRequest(endpoint, "DELETE", "compute");
|
|
343
|
+
}
|
|
344
|
+
async listAdmins() {
|
|
345
|
+
const endpoint = `${this.config.billingApiServerURL}/admin/admins`;
|
|
346
|
+
const resp = await this.makeAuthenticatedRequest(endpoint, "GET", "compute");
|
|
347
|
+
return resp.json();
|
|
348
|
+
}
|
|
349
|
+
// ==========================================================================
|
|
350
|
+
// User - Coupon Redemption
|
|
351
|
+
// ==========================================================================
|
|
352
|
+
async redeemCoupon(code) {
|
|
353
|
+
const endpoint = `${this.config.billingApiServerURL}/v1/coupons/redeem`;
|
|
354
|
+
const resp = await this.makeAuthenticatedRequest(endpoint, "POST", "compute", { code });
|
|
355
|
+
return resp.json();
|
|
356
|
+
}
|
|
357
|
+
// ==========================================================================
|
|
301
358
|
// Internal Methods
|
|
302
359
|
// ==========================================================================
|
|
303
360
|
/**
|
|
@@ -2321,6 +2378,9 @@ function createBillingModule(config) {
|
|
|
2321
2378
|
},
|
|
2322
2379
|
hasBaseSupport() {
|
|
2323
2380
|
return !!baseUsdcCreditsAddress && !!baseRPCURL;
|
|
2381
|
+
},
|
|
2382
|
+
async redeemCoupon(code) {
|
|
2383
|
+
return billingApi.redeemCoupon(code);
|
|
2324
2384
|
}
|
|
2325
2385
|
};
|
|
2326
2386
|
return module;
|