@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.
@@ -1,4 +1,4 @@
1
- import { E as EnvironmentConfig, a7 as SubscriptionStatus, f as BillingEnvironmentConfig, $ as ProductID, k as CreateSubscriptionOptions, l as CreateSubscriptionResponse, z as GetSubscriptionOptions, a0 as ProductSubscriptionResponse, M as PaymentMethodsResponse, m as CreditPurchaseResponse, G as GasEstimate, H as Logger } from './index-BoCE0hIh.cjs';
1
+ import { E as EnvironmentConfig, af as SubscriptionStatus, i as BillingEnvironmentConfig, a6 as ProductID, o as CreateSubscriptionOptions, p as CreateSubscriptionResponse, K as GetSubscriptionOptions, a7 as ProductSubscriptionResponse, V as PaymentMethodsResponse, q as CreditPurchaseResponse, n as CreateCouponResponse, P as ListCouponsResponse, J as GetCouponResponse, a as AddAdminResponse, O as ListAdminsResponse, a8 as RedeemCouponResponse, H as GasEstimate, Q as Logger } from './index-CLhRJNai.cjs';
2
2
  import { Address, Hex, WalletClient, PublicClient, SignAuthorizationReturnType, Chain } from 'viem';
3
3
 
4
4
  /**
@@ -801,6 +801,20 @@ declare class BillingApiClient {
801
801
  cancelSubscription(productId?: ProductID): Promise<void>;
802
802
  getPaymentMethods(): Promise<PaymentMethodsResponse>;
803
803
  purchaseCredits(amountCents: number, paymentMethodId?: string): Promise<CreditPurchaseResponse>;
804
+ createCoupon(amountCents: number): Promise<CreateCouponResponse>;
805
+ listCoupons(opts?: {
806
+ offset?: number;
807
+ limit?: number;
808
+ active?: boolean;
809
+ redeemed?: boolean;
810
+ }): Promise<ListCouponsResponse>;
811
+ getCoupon(id: string): Promise<GetCouponResponse>;
812
+ deactivateCoupon(id: string): Promise<void>;
813
+ redeemCouponForUser(id: string, address: string): Promise<void>;
814
+ addAdmin(address: string): Promise<AddAdminResponse>;
815
+ removeAdmin(address: string): Promise<void>;
816
+ listAdmins(): Promise<ListAdminsResponse>;
817
+ redeemCoupon(code: string): Promise<RedeemCouponResponse>;
804
818
  /**
805
819
  * Make an authenticated request to the billing API
806
820
  *
@@ -1,4 +1,4 @@
1
- import { E as EnvironmentConfig, a7 as SubscriptionStatus, f as BillingEnvironmentConfig, $ as ProductID, k as CreateSubscriptionOptions, l as CreateSubscriptionResponse, z as GetSubscriptionOptions, a0 as ProductSubscriptionResponse, M as PaymentMethodsResponse, m as CreditPurchaseResponse, G as GasEstimate, H as Logger } from './index-BoCE0hIh.js';
1
+ import { E as EnvironmentConfig, af as SubscriptionStatus, i as BillingEnvironmentConfig, a6 as ProductID, o as CreateSubscriptionOptions, p as CreateSubscriptionResponse, K as GetSubscriptionOptions, a7 as ProductSubscriptionResponse, V as PaymentMethodsResponse, q as CreditPurchaseResponse, n as CreateCouponResponse, P as ListCouponsResponse, J as GetCouponResponse, a as AddAdminResponse, O as ListAdminsResponse, a8 as RedeemCouponResponse, H as GasEstimate, Q as Logger } from './index-CLhRJNai.js';
2
2
  import { Address, Hex, WalletClient, PublicClient, SignAuthorizationReturnType, Chain } from 'viem';
3
3
 
4
4
  /**
@@ -801,6 +801,20 @@ declare class BillingApiClient {
801
801
  cancelSubscription(productId?: ProductID): Promise<void>;
802
802
  getPaymentMethods(): Promise<PaymentMethodsResponse>;
803
803
  purchaseCredits(amountCents: number, paymentMethodId?: string): Promise<CreditPurchaseResponse>;
804
+ createCoupon(amountCents: number): Promise<CreateCouponResponse>;
805
+ listCoupons(opts?: {
806
+ offset?: number;
807
+ limit?: number;
808
+ active?: boolean;
809
+ redeemed?: boolean;
810
+ }): Promise<ListCouponsResponse>;
811
+ getCoupon(id: string): Promise<GetCouponResponse>;
812
+ deactivateCoupon(id: string): Promise<void>;
813
+ redeemCouponForUser(id: string, address: string): Promise<void>;
814
+ addAdmin(address: string): Promise<AddAdminResponse>;
815
+ removeAdmin(address: string): Promise<void>;
816
+ listAdmins(): Promise<ListAdminsResponse>;
817
+ redeemCoupon(code: string): Promise<RedeemCouponResponse>;
804
818
  /**
805
819
  * Make an authenticated request to the billing API
806
820
  *
@@ -793,5 +793,38 @@ interface SequentialDeployResult {
793
793
  setPublicLogs?: Hex;
794
794
  };
795
795
  }
796
+ interface AdminCoupon {
797
+ id: string;
798
+ amountCents: number;
799
+ active: boolean;
800
+ redeemedBy: string;
801
+ redeemedAt: string | null;
802
+ createdBy: string;
803
+ createdAt: string;
804
+ }
805
+ interface CreateCouponResponse {
806
+ coupon: AdminCoupon;
807
+ }
808
+ interface ListCouponsResponse {
809
+ coupons: AdminCoupon[];
810
+ total: number;
811
+ }
812
+ interface GetCouponResponse {
813
+ coupon: AdminCoupon;
814
+ }
815
+ interface AdminUser {
816
+ id: string;
817
+ address: string;
818
+ createdAt: string;
819
+ }
820
+ interface AddAdminResponse {
821
+ admin: AdminUser;
822
+ }
823
+ interface ListAdminsResponse {
824
+ admins: AdminUser[];
825
+ }
826
+ interface RedeemCouponResponse {
827
+ amountCents: number;
828
+ }
796
829
 
797
- export { type ProductID as $, type AppId as A, type BatchedDeployResult as B, type CalculateAppIDOptions as C, type DeployAppOptions as D, type EnvironmentConfig as E, type IsDelegatedOptions as F, type GasEstimate as G, type Logger as H, type ImageDigestResult as I, type PaymentIssueResponse as J, type PaymentMethod as K, type LifecycleOpts as L, type PaymentMethodsResponse as M, type NoActiveSubscriptionResponse as N, type PrepareDeployBatchOptions as O, type ParsedEnvironment as P, type PrepareDeployFromVerifiableBuildOpts as Q, type PrepareDeployOpts as R, type PrepareUpgradeBatchOptions as S, type PrepareUpgradeFromVerifiableBuildOpts as T, type PrepareUpgradeOpts as U, type PreparedDeploy as V, type PreparedDeployBatch as W, type PreparedDeployData as X, type PreparedUpgrade as Y, type PreparedUpgradeBatch as Z, type PreparedUpgradeData as _, type AlreadyActiveResponse as a, type ProductSubscriptionResponse as a0, type Release as a1, type SendTransactionOptions as a2, type SequentialDeployResult as a3, type SubscribeResponse as a4, type SubscriptionLineItem as a5, type SubscriptionOpts as a6, type SubscriptionStatus as a7, type SuspendOptions as a8, type UndelegateOptions as a9, undelegate as aA, upgradeApp as aB, getAppLatestReleaseBlockNumbers as aC, getBlockTimestamps as aD, type UpgradeAppOptions as aa, type UpgradeAppOpts as ab, calculateAppID as ac, deployApp as ad, estimateTransactionGas as ae, executeDeployBatch as af, executeDeployBatched as ag, executeDeploySequential as ah, executeUpgradeBatch as ai, formatETH as aj, getActiveAppCount as ak, getAllAppsByDeveloper as al, getAppsByBillingAccount as am, getAppsByCreator as an, getAppsByDeveloper as ao, getBillingType as ap, getMaxActiveAppsPerUser as aq, isDelegated as ar, type logVisibility as as, noopLogger as at, prepareDeployBatch as au, prepareUpgradeBatch as av, sendAndWaitForTransaction as aw, supportsEIP5792 as ax, supportsEIP7702 as ay, suspend as az, type AppConfig as b, type AppProfile as c, type AppProfileResponse as d, type AppRecord as e, type BillingEnvironmentConfig as f, type CancelResponse as g, type CancelSuccessResponse as h, type ChainID as i, type CheckoutCreatedResponse as j, type CreateSubscriptionOptions as k, type CreateSubscriptionResponse as l, type CreditPurchaseResponse as m, type DeployAppOpts as n, type DeployOptions as o, type DeployProgressCallback as p, type DeployResult as q, type DeployStep as r, type DockerImageConfig as s, type EstimateGasOptions as t, type ExecuteDeployBatchedOptions as u, type ExecuteDeployResult as v, type ExecuteDeploySequentialOptions as w, type ExecuteUpgradeResult as x, type GasOpts as y, type GetSubscriptionOptions as z };
830
+ export { type PrepareUpgradeOpts as $, type AppId as A, type BatchedDeployResult as B, type CalculateAppIDOptions as C, type DeployAppOptions as D, type EnvironmentConfig as E, type ExecuteDeploySequentialOptions as F, type ExecuteUpgradeResult as G, type GasEstimate as H, type GasOpts as I, type GetCouponResponse as J, type GetSubscriptionOptions as K, type ImageDigestResult as L, type IsDelegatedOptions as M, type LifecycleOpts as N, type ListAdminsResponse as O, type ListCouponsResponse as P, type Logger as Q, type NoActiveSubscriptionResponse as R, type ParsedEnvironment as S, type PaymentIssueResponse as T, type PaymentMethod as U, type PaymentMethodsResponse as V, type PrepareDeployBatchOptions as W, type PrepareDeployFromVerifiableBuildOpts as X, type PrepareDeployOpts as Y, type PrepareUpgradeBatchOptions as Z, type PrepareUpgradeFromVerifiableBuildOpts as _, type AddAdminResponse as a, type PreparedDeploy as a0, type PreparedDeployBatch as a1, type PreparedDeployData as a2, type PreparedUpgrade as a3, type PreparedUpgradeBatch as a4, type PreparedUpgradeData as a5, type ProductID as a6, type ProductSubscriptionResponse as a7, type RedeemCouponResponse as a8, type Release as a9, type logVisibility as aA, noopLogger as aB, prepareDeployBatch as aC, prepareUpgradeBatch as aD, sendAndWaitForTransaction as aE, supportsEIP5792 as aF, supportsEIP7702 as aG, suspend as aH, undelegate as aI, upgradeApp as aJ, getAppLatestReleaseBlockNumbers as aK, getBlockTimestamps as aL, type SendTransactionOptions as aa, type SequentialDeployResult as ab, type SubscribeResponse as ac, type SubscriptionLineItem as ad, type SubscriptionOpts as ae, type SubscriptionStatus as af, type SuspendOptions as ag, type UndelegateOptions as ah, type UpgradeAppOptions as ai, type UpgradeAppOpts as aj, calculateAppID as ak, deployApp as al, estimateTransactionGas as am, executeDeployBatch as an, executeDeployBatched as ao, executeDeploySequential as ap, executeUpgradeBatch as aq, formatETH as ar, getActiveAppCount as as, getAllAppsByDeveloper as at, getAppsByBillingAccount as au, getAppsByCreator as av, getAppsByDeveloper as aw, getBillingType as ax, getMaxActiveAppsPerUser as ay, isDelegated as az, type AdminCoupon as b, type AdminUser as c, type AlreadyActiveResponse as d, type AppConfig as e, type AppProfile as f, type AppProfileResponse as g, type AppRecord as h, type BillingEnvironmentConfig as i, type CancelResponse as j, type CancelSuccessResponse as k, type ChainID as l, type CheckoutCreatedResponse as m, type CreateCouponResponse as n, type CreateSubscriptionOptions as o, type CreateSubscriptionResponse as p, type CreditPurchaseResponse as q, type DeployAppOpts as r, type DeployOptions as s, type DeployProgressCallback as t, type DeployResult as u, type DeployStep as v, type DockerImageConfig as w, type EstimateGasOptions as x, type ExecuteDeployBatchedOptions as y, type ExecuteDeployResult as z };
@@ -793,5 +793,38 @@ interface SequentialDeployResult {
793
793
  setPublicLogs?: Hex;
794
794
  };
795
795
  }
796
+ interface AdminCoupon {
797
+ id: string;
798
+ amountCents: number;
799
+ active: boolean;
800
+ redeemedBy: string;
801
+ redeemedAt: string | null;
802
+ createdBy: string;
803
+ createdAt: string;
804
+ }
805
+ interface CreateCouponResponse {
806
+ coupon: AdminCoupon;
807
+ }
808
+ interface ListCouponsResponse {
809
+ coupons: AdminCoupon[];
810
+ total: number;
811
+ }
812
+ interface GetCouponResponse {
813
+ coupon: AdminCoupon;
814
+ }
815
+ interface AdminUser {
816
+ id: string;
817
+ address: string;
818
+ createdAt: string;
819
+ }
820
+ interface AddAdminResponse {
821
+ admin: AdminUser;
822
+ }
823
+ interface ListAdminsResponse {
824
+ admins: AdminUser[];
825
+ }
826
+ interface RedeemCouponResponse {
827
+ amountCents: number;
828
+ }
796
829
 
797
- export { type ProductID as $, type AppId as A, type BatchedDeployResult as B, type CalculateAppIDOptions as C, type DeployAppOptions as D, type EnvironmentConfig as E, type IsDelegatedOptions as F, type GasEstimate as G, type Logger as H, type ImageDigestResult as I, type PaymentIssueResponse as J, type PaymentMethod as K, type LifecycleOpts as L, type PaymentMethodsResponse as M, type NoActiveSubscriptionResponse as N, type PrepareDeployBatchOptions as O, type ParsedEnvironment as P, type PrepareDeployFromVerifiableBuildOpts as Q, type PrepareDeployOpts as R, type PrepareUpgradeBatchOptions as S, type PrepareUpgradeFromVerifiableBuildOpts as T, type PrepareUpgradeOpts as U, type PreparedDeploy as V, type PreparedDeployBatch as W, type PreparedDeployData as X, type PreparedUpgrade as Y, type PreparedUpgradeBatch as Z, type PreparedUpgradeData as _, type AlreadyActiveResponse as a, type ProductSubscriptionResponse as a0, type Release as a1, type SendTransactionOptions as a2, type SequentialDeployResult as a3, type SubscribeResponse as a4, type SubscriptionLineItem as a5, type SubscriptionOpts as a6, type SubscriptionStatus as a7, type SuspendOptions as a8, type UndelegateOptions as a9, undelegate as aA, upgradeApp as aB, getAppLatestReleaseBlockNumbers as aC, getBlockTimestamps as aD, type UpgradeAppOptions as aa, type UpgradeAppOpts as ab, calculateAppID as ac, deployApp as ad, estimateTransactionGas as ae, executeDeployBatch as af, executeDeployBatched as ag, executeDeploySequential as ah, executeUpgradeBatch as ai, formatETH as aj, getActiveAppCount as ak, getAllAppsByDeveloper as al, getAppsByBillingAccount as am, getAppsByCreator as an, getAppsByDeveloper as ao, getBillingType as ap, getMaxActiveAppsPerUser as aq, isDelegated as ar, type logVisibility as as, noopLogger as at, prepareDeployBatch as au, prepareUpgradeBatch as av, sendAndWaitForTransaction as aw, supportsEIP5792 as ax, supportsEIP7702 as ay, suspend as az, type AppConfig as b, type AppProfile as c, type AppProfileResponse as d, type AppRecord as e, type BillingEnvironmentConfig as f, type CancelResponse as g, type CancelSuccessResponse as h, type ChainID as i, type CheckoutCreatedResponse as j, type CreateSubscriptionOptions as k, type CreateSubscriptionResponse as l, type CreditPurchaseResponse as m, type DeployAppOpts as n, type DeployOptions as o, type DeployProgressCallback as p, type DeployResult as q, type DeployStep as r, type DockerImageConfig as s, type EstimateGasOptions as t, type ExecuteDeployBatchedOptions as u, type ExecuteDeployResult as v, type ExecuteDeploySequentialOptions as w, type ExecuteUpgradeResult as x, type GasOpts as y, type GetSubscriptionOptions as z };
830
+ export { type PrepareUpgradeOpts as $, type AppId as A, type BatchedDeployResult as B, type CalculateAppIDOptions as C, type DeployAppOptions as D, type EnvironmentConfig as E, type ExecuteDeploySequentialOptions as F, type ExecuteUpgradeResult as G, type GasEstimate as H, type GasOpts as I, type GetCouponResponse as J, type GetSubscriptionOptions as K, type ImageDigestResult as L, type IsDelegatedOptions as M, type LifecycleOpts as N, type ListAdminsResponse as O, type ListCouponsResponse as P, type Logger as Q, type NoActiveSubscriptionResponse as R, type ParsedEnvironment as S, type PaymentIssueResponse as T, type PaymentMethod as U, type PaymentMethodsResponse as V, type PrepareDeployBatchOptions as W, type PrepareDeployFromVerifiableBuildOpts as X, type PrepareDeployOpts as Y, type PrepareUpgradeBatchOptions as Z, type PrepareUpgradeFromVerifiableBuildOpts as _, type AddAdminResponse as a, type PreparedDeploy as a0, type PreparedDeployBatch as a1, type PreparedDeployData as a2, type PreparedUpgrade as a3, type PreparedUpgradeBatch as a4, type PreparedUpgradeData as a5, type ProductID as a6, type ProductSubscriptionResponse as a7, type RedeemCouponResponse as a8, type Release as a9, type logVisibility as aA, noopLogger as aB, prepareDeployBatch as aC, prepareUpgradeBatch as aD, sendAndWaitForTransaction as aE, supportsEIP5792 as aF, supportsEIP7702 as aG, suspend as aH, undelegate as aI, upgradeApp as aJ, getAppLatestReleaseBlockNumbers as aK, getBlockTimestamps as aL, type SendTransactionOptions as aa, type SequentialDeployResult as ab, type SubscribeResponse as ac, type SubscriptionLineItem as ad, type SubscriptionOpts as ae, type SubscriptionStatus as af, type SuspendOptions as ag, type UndelegateOptions as ah, type UpgradeAppOptions as ai, type UpgradeAppOpts as aj, calculateAppID as ak, deployApp as al, estimateTransactionGas as am, executeDeployBatch as an, executeDeployBatched as ao, executeDeploySequential as ap, executeUpgradeBatch as aq, formatETH as ar, getActiveAppCount as as, getAllAppsByDeveloper as at, getAppsByBillingAccount as au, getAppsByCreator as av, getAppsByDeveloper as aw, getBillingType as ax, getMaxActiveAppsPerUser as ay, isDelegated as az, type AdminCoupon as b, type AdminUser as c, type AlreadyActiveResponse as d, type AppConfig as e, type AppProfile as f, type AppProfileResponse as g, type AppRecord as h, type BillingEnvironmentConfig as i, type CancelResponse as j, type CancelSuccessResponse as k, type ChainID as l, type CheckoutCreatedResponse as m, type CreateCouponResponse as n, type CreateSubscriptionOptions as o, type CreateSubscriptionResponse as p, type CreditPurchaseResponse as q, type DeployAppOpts as r, type DeployOptions as s, type DeployProgressCallback as t, type DeployResult as u, type DeployStep as v, type DockerImageConfig as w, type EstimateGasOptions as x, type ExecuteDeployBatchedOptions as y, type ExecuteDeployResult as z };
package/dist/index.cjs CHANGED
@@ -190,6 +190,7 @@ __export(index_exports, {
190
190
  assertValidPrivateKey: () => assertValidPrivateKey,
191
191
  calculateAppID: () => calculateAppID,
192
192
  checkERC7702Delegation: () => checkERC7702Delegation,
193
+ createAdminModule: () => createAdminModule,
193
194
  createApp: () => createApp,
194
195
  createAppEnvironment: () => createAppEnvironment,
195
196
  createBillingModule: () => createBillingModule,
@@ -4987,7 +4988,7 @@ var CanViewAppLogsPermission = "0x2fd3f2fe";
4987
4988
  var CanViewSensitiveAppInfoPermission = "0x0e67b22f";
4988
4989
  var CanUpdateAppProfilePermission = "0x036fef61";
4989
4990
  function getDefaultClientId() {
4990
- const version = true ? "1.0.0-dev.4" : "0.0.0";
4991
+ const version = true ? "1.0.0-dev.5" : "0.0.0";
4991
4992
  return `ecloud-sdk/v${version}`;
4992
4993
  }
4993
4994
  var UserApiClient = class {
@@ -6180,6 +6181,63 @@ var BillingApiClient = class {
6180
6181
  return resp.json();
6181
6182
  }
6182
6183
  // ==========================================================================
6184
+ // Admin - Coupon Methods
6185
+ // ==========================================================================
6186
+ async createCoupon(amountCents) {
6187
+ const endpoint = `${this.config.billingApiServerURL}/admin/coupons`;
6188
+ const resp = await this.makeAuthenticatedRequest(endpoint, "POST", "compute", { amountCents });
6189
+ return resp.json();
6190
+ }
6191
+ async listCoupons(opts) {
6192
+ const params = new URLSearchParams();
6193
+ if (opts?.offset !== void 0) params.set("offset", opts.offset.toString());
6194
+ if (opts?.limit !== void 0) params.set("limit", opts.limit.toString());
6195
+ if (opts?.active !== void 0) params.set("active", opts.active.toString());
6196
+ if (opts?.redeemed !== void 0) params.set("redeemed", opts.redeemed.toString());
6197
+ const qs = params.toString();
6198
+ const endpoint = `${this.config.billingApiServerURL}/admin/coupons${qs ? `?${qs}` : ""}`;
6199
+ const resp = await this.makeAuthenticatedRequest(endpoint, "GET", "compute");
6200
+ return resp.json();
6201
+ }
6202
+ async getCoupon(id) {
6203
+ const endpoint = `${this.config.billingApiServerURL}/admin/coupons/${id}`;
6204
+ const resp = await this.makeAuthenticatedRequest(endpoint, "GET", "compute");
6205
+ return resp.json();
6206
+ }
6207
+ async deactivateCoupon(id) {
6208
+ const endpoint = `${this.config.billingApiServerURL}/admin/coupons/${id}/deactivate`;
6209
+ await this.makeAuthenticatedRequest(endpoint, "POST", "compute");
6210
+ }
6211
+ async redeemCouponForUser(id, address) {
6212
+ const endpoint = `${this.config.billingApiServerURL}/admin/coupons/${id}/redeem`;
6213
+ await this.makeAuthenticatedRequest(endpoint, "POST", "compute", { address });
6214
+ }
6215
+ // ==========================================================================
6216
+ // Admin - Admin Management Methods
6217
+ // ==========================================================================
6218
+ async addAdmin(address) {
6219
+ const endpoint = `${this.config.billingApiServerURL}/admin/admins`;
6220
+ const resp = await this.makeAuthenticatedRequest(endpoint, "POST", "compute", { address });
6221
+ return resp.json();
6222
+ }
6223
+ async removeAdmin(address) {
6224
+ const endpoint = `${this.config.billingApiServerURL}/admin/admins/${address}`;
6225
+ await this.makeAuthenticatedRequest(endpoint, "DELETE", "compute");
6226
+ }
6227
+ async listAdmins() {
6228
+ const endpoint = `${this.config.billingApiServerURL}/admin/admins`;
6229
+ const resp = await this.makeAuthenticatedRequest(endpoint, "GET", "compute");
6230
+ return resp.json();
6231
+ }
6232
+ // ==========================================================================
6233
+ // User - Coupon Redemption
6234
+ // ==========================================================================
6235
+ async redeemCoupon(code) {
6236
+ const endpoint = `${this.config.billingApiServerURL}/v1/coupons/redeem`;
6237
+ const resp = await this.makeAuthenticatedRequest(endpoint, "POST", "compute", { code });
6238
+ return resp.json();
6239
+ }
6240
+ // ==========================================================================
6183
6241
  // Internal Methods
6184
6242
  // ==========================================================================
6185
6243
  /**
@@ -8600,6 +8658,9 @@ function createBillingModule(config) {
8600
8658
  },
8601
8659
  hasBaseSupport() {
8602
8660
  return !!baseUsdcCreditsAddress && !!baseRPCURL;
8661
+ },
8662
+ async redeemCoupon(code) {
8663
+ return billingApi.redeemCoupon(code);
8603
8664
  }
8604
8665
  };
8605
8666
  return module2;
@@ -9035,6 +9096,44 @@ function transformVerifyResult(raw) {
9035
9096
  };
9036
9097
  }
9037
9098
 
9099
+ // src/client/modules/admin/index.ts
9100
+ function createAdminModule(config) {
9101
+ const { verbose = false, walletClient } = config;
9102
+ if (!walletClient.account) {
9103
+ throw new Error("WalletClient must have an account attached");
9104
+ }
9105
+ const address = walletClient.account.address;
9106
+ const billingEnvConfig = getBillingEnvironmentConfig(getBuildType());
9107
+ const billingApi = new BillingApiClient(billingEnvConfig, walletClient, { verbose });
9108
+ return {
9109
+ address,
9110
+ async createCoupon(amountCents) {
9111
+ return billingApi.createCoupon(amountCents);
9112
+ },
9113
+ async listCoupons(opts) {
9114
+ return billingApi.listCoupons(opts);
9115
+ },
9116
+ async getCoupon(id) {
9117
+ return billingApi.getCoupon(id);
9118
+ },
9119
+ async deactivateCoupon(id) {
9120
+ return billingApi.deactivateCoupon(id);
9121
+ },
9122
+ async redeemCouponForUser(id, userAddress) {
9123
+ return billingApi.redeemCouponForUser(id, userAddress);
9124
+ },
9125
+ async addAdmin(adminAddress) {
9126
+ return billingApi.addAdmin(adminAddress);
9127
+ },
9128
+ async removeAdmin(adminAddress) {
9129
+ return billingApi.removeAdmin(adminAddress);
9130
+ },
9131
+ async listAdmins() {
9132
+ return billingApi.listAdmins();
9133
+ }
9134
+ };
9135
+ }
9136
+
9038
9137
  // src/client/common/auth/keyring.ts
9039
9138
  var import_keyring = require("@napi-rs/keyring");
9040
9139
  var import_accounts2 = require("viem/accounts");
@@ -9599,6 +9698,7 @@ var JwtProvider = class {
9599
9698
  assertValidPrivateKey,
9600
9699
  calculateAppID,
9601
9700
  checkERC7702Delegation,
9701
+ createAdminModule,
9602
9702
  createApp,
9603
9703
  createAppEnvironment,
9604
9704
  createBillingModule,