@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/dist/index.d.cts CHANGED
@@ -1,13 +1,13 @@
1
- import { C as ComputeModule } from './compute-BK4PxhNh.cjs';
2
- export { a as ComputeModuleConfig, b as CreateAppOpts, L as LogsOptions, P as PRIMARY_LANGUAGES, S as SDKCreateAppOpts, c as createApp, d as createComputeModule, e as encodeStartAppData, f as encodeStopAppData, g as encodeTerminateAppData, h as getAvailableTemplates, l as logs } from './compute-BK4PxhNh.cjs';
1
+ import { C as ComputeModule } from './compute-RhRi2H8h.cjs';
2
+ export { a as ComputeModuleConfig, b as CreateAppOpts, L as LogsOptions, P as PRIMARY_LANGUAGES, S as SDKCreateAppOpts, c as createApp, d as createComputeModule, e as encodeStartAppData, f as encodeStopAppData, g as encodeTerminateAppData, h as getAvailableTemplates, l as logs } from './compute-RhRi2H8h.cjs';
3
3
  import { BillingModule } from './billing.cjs';
4
4
  export { BillingChain, BillingModuleConfig, TopUpInfo, TopUpOpts, TopUpResult, createBillingModule } from './billing.cjs';
5
5
  import { WalletClient, PublicClient, Address, Hex } from 'viem';
6
6
  export { AttestClient, AttestClientConfig, JwtProvider } from './attest.cjs';
7
- import { V as PreparedDeploy, G as GasEstimate, E as EnvironmentConfig, H as Logger, q as DeployResult, Y as PreparedUpgrade, A as AppId } from './index-BoCE0hIh.cjs';
8
- export { a as AlreadyActiveResponse, c as AppProfile, d as AppProfileResponse, e as AppRecord, f as BillingEnvironmentConfig, g as CancelResponse, h as CancelSuccessResponse, i as ChainID, j as CheckoutCreatedResponse, k as CreateSubscriptionOptions, l as CreateSubscriptionResponse, m as CreditPurchaseResponse, n as DeployAppOpts, o as DeployOptions, p as DeployProgressCallback, r as DeployStep, s as DockerImageConfig, t as EstimateGasOptions, v as ExecuteDeployResult, x as ExecuteUpgradeResult, y as GasOpts, z as GetSubscriptionOptions, I as ImageDigestResult, L as LifecycleOpts, N as NoActiveSubscriptionResponse, P as ParsedEnvironment, J as PaymentIssueResponse, K as PaymentMethod, M as PaymentMethodsResponse, Q as PrepareDeployFromVerifiableBuildOpts, R as PrepareDeployOpts, T as PrepareUpgradeFromVerifiableBuildOpts, U as PrepareUpgradeOpts, X as PreparedDeployData, _ as PreparedUpgradeData, $ as ProductID, a0 as ProductSubscriptionResponse, a1 as Release, a3 as SequentialDeployResult, a4 as SubscribeResponse, a5 as SubscriptionLineItem, a6 as SubscriptionOpts, a7 as SubscriptionStatus, ab as UpgradeAppOpts, ac as calculateAppID, ae as estimateTransactionGas, aj as formatETH, al as getAllAppsByDeveloper, aC as getAppLatestReleaseBlockNumbers, am as getAppsByBillingAccount, ap as getBillingType, aD as getBlockTimestamps, as as logVisibility, at as noopLogger } from './index-BoCE0hIh.cjs';
9
- import { L as LogVisibility, aj as ResourceUsageMonitoring } from './helpers-Qq5W-qNn.cjs';
10
- export { A as AppInfo, d as AppMetrics, e as AppProfileInfo, ak as AppRelease, al as AppReleaseBuild, am as AppResponse, an as BASE_SEPOLIA_CHAIN_ID, B as BillingApiClient, C as ComputeApiConfig, l as CreateAppParams, ao as DeployParams, E as EstimateBatchGasOptions, G as GeneratedKey, o as LoginRequest, p as LoginResult, q as LogsParams, a as SessionError, S as SessionInfo, b as SiweMessageParams, r as SiweMessageResult, ap as UpgradeParams, U as UserApiClient, t as addHexPrefix, aq as assertValidFilePath, u as assertValidImageReference, v as assertValidPrivateKey, w as checkERC7702Delegation, x as createSiweMessage, ar as createViemClients, y as estimateBatchGas, D as extractAppNameFromImage, F as generateNewPrivateKey, H as generateNonce, I as getAvailableEnvironments, K as getBillingEnvironmentConfig, M as getBuildType, N as getChainFromID, O as getComputeApiSession, P as getEnvironmentConfig, R as isEnvironmentAvailable, T as isMainnet, V as isSessionValid, W as isSiweMessageExpired, X as isSiweMessageNotYetValid, Y as isSubscriptionActive, $ as loginToComputeApi, a2 as logoutFromComputeApi, a3 as parseSiweMessage, a4 as sanitizeString, a5 as sanitizeURL, a6 as sanitizeXURL, a7 as stripHexPrefix, a8 as validateAppID, a9 as validateAppName, aa as validateCreateAppParams, as as validateDeployParams, ab as validateDescription, at as validateFilePath, au as validateImagePath, ac as validateImageReference, ad as validateInstanceTypeSKU, ae as validateLogVisibility, af as validateLogsParams, ag as validatePrivateKeyFormat, av as validateResourceUsageMonitoring, ah as validateURL, aw as validateUpgradeParams, ai as validateXURL } from './helpers-Qq5W-qNn.cjs';
7
+ import { a0 as PreparedDeploy, H as GasEstimate, E as EnvironmentConfig, Q as Logger, u as DeployResult, a3 as PreparedUpgrade, A as AppId, n as CreateCouponResponse, P as ListCouponsResponse, J as GetCouponResponse, a as AddAdminResponse, O as ListAdminsResponse } from './index-CLhRJNai.cjs';
8
+ export { b as AdminCoupon, c as AdminUser, d as AlreadyActiveResponse, f as AppProfile, g as AppProfileResponse, h as AppRecord, i as BillingEnvironmentConfig, j as CancelResponse, k as CancelSuccessResponse, l as ChainID, m as CheckoutCreatedResponse, o as CreateSubscriptionOptions, p as CreateSubscriptionResponse, q as CreditPurchaseResponse, r as DeployAppOpts, s as DeployOptions, t as DeployProgressCallback, v as DeployStep, w as DockerImageConfig, x as EstimateGasOptions, z as ExecuteDeployResult, G as ExecuteUpgradeResult, I as GasOpts, K as GetSubscriptionOptions, L as ImageDigestResult, N as LifecycleOpts, R as NoActiveSubscriptionResponse, S as ParsedEnvironment, T as PaymentIssueResponse, U as PaymentMethod, V as PaymentMethodsResponse, X as PrepareDeployFromVerifiableBuildOpts, Y as PrepareDeployOpts, _ as PrepareUpgradeFromVerifiableBuildOpts, $ as PrepareUpgradeOpts, a2 as PreparedDeployData, a5 as PreparedUpgradeData, a6 as ProductID, a7 as ProductSubscriptionResponse, a8 as RedeemCouponResponse, a9 as Release, ab as SequentialDeployResult, ac as SubscribeResponse, ad as SubscriptionLineItem, ae as SubscriptionOpts, af as SubscriptionStatus, aj as UpgradeAppOpts, ak as calculateAppID, am as estimateTransactionGas, ar as formatETH, at as getAllAppsByDeveloper, aK as getAppLatestReleaseBlockNumbers, au as getAppsByBillingAccount, ax as getBillingType, aL as getBlockTimestamps, aA as logVisibility, aB as noopLogger } from './index-CLhRJNai.cjs';
9
+ import { L as LogVisibility, aj as ResourceUsageMonitoring } from './helpers-CqrBJ39N.cjs';
10
+ export { A as AppInfo, d as AppMetrics, e as AppProfileInfo, ak as AppRelease, al as AppReleaseBuild, am as AppResponse, an as BASE_SEPOLIA_CHAIN_ID, B as BillingApiClient, C as ComputeApiConfig, l as CreateAppParams, ao as DeployParams, E as EstimateBatchGasOptions, G as GeneratedKey, o as LoginRequest, p as LoginResult, q as LogsParams, a as SessionError, S as SessionInfo, b as SiweMessageParams, r as SiweMessageResult, ap as UpgradeParams, U as UserApiClient, t as addHexPrefix, aq as assertValidFilePath, u as assertValidImageReference, v as assertValidPrivateKey, w as checkERC7702Delegation, x as createSiweMessage, ar as createViemClients, y as estimateBatchGas, D as extractAppNameFromImage, F as generateNewPrivateKey, H as generateNonce, I as getAvailableEnvironments, K as getBillingEnvironmentConfig, M as getBuildType, N as getChainFromID, O as getComputeApiSession, P as getEnvironmentConfig, R as isEnvironmentAvailable, T as isMainnet, V as isSessionValid, W as isSiweMessageExpired, X as isSiweMessageNotYetValid, Y as isSubscriptionActive, $ as loginToComputeApi, a2 as logoutFromComputeApi, a3 as parseSiweMessage, a4 as sanitizeString, a5 as sanitizeURL, a6 as sanitizeXURL, a7 as stripHexPrefix, a8 as validateAppID, a9 as validateAppName, aa as validateCreateAppParams, as as validateDeployParams, ab as validateDescription, at as validateFilePath, au as validateImagePath, ac as validateImageReference, ad as validateInstanceTypeSKU, ae as validateLogVisibility, af as validateLogsParams, ag as validatePrivateKeyFormat, av as validateResourceUsageMonitoring, ah as validateURL, aw as validateUpgradeParams, ai as validateXURL } from './helpers-CqrBJ39N.cjs';
11
11
 
12
12
  interface SubmitBuildRequest {
13
13
  repoUrl: string;
@@ -396,6 +396,30 @@ declare function executeUpgrade(options: ExecuteUpgradeOptions): Promise<Upgrade
396
396
  */
397
397
  declare function watchUpgrade(appId: string, walletClient: WalletClient, publicClient: PublicClient, environmentConfig: EnvironmentConfig, logger?: Logger, skipTelemetry?: boolean): Promise<void>;
398
398
 
399
+ interface AdminModule {
400
+ address: Address;
401
+ createCoupon: (amountCents: number) => Promise<CreateCouponResponse>;
402
+ listCoupons: (opts?: {
403
+ offset?: number;
404
+ limit?: number;
405
+ active?: boolean;
406
+ redeemed?: boolean;
407
+ }) => Promise<ListCouponsResponse>;
408
+ getCoupon: (id: string) => Promise<GetCouponResponse>;
409
+ deactivateCoupon: (id: string) => Promise<void>;
410
+ redeemCouponForUser: (id: string, address: string) => Promise<void>;
411
+ addAdmin: (address: string) => Promise<AddAdminResponse>;
412
+ removeAdmin: (address: string) => Promise<void>;
413
+ listAdmins: () => Promise<ListAdminsResponse>;
414
+ }
415
+ interface AdminModuleConfig {
416
+ verbose?: boolean;
417
+ walletClient: WalletClient;
418
+ publicClient: PublicClient;
419
+ environment: string;
420
+ }
421
+ declare function createAdminModule(config: AdminModuleConfig): AdminModule;
422
+
399
423
  /**
400
424
  * OS Keyring Integration
401
425
  *
@@ -939,4 +963,4 @@ interface ECloudClient {
939
963
  }
940
964
  declare function createECloudClient(cfg: ClientConfig): ECloudClient;
941
965
 
942
- export { type AppEnvironment, AppId, AuthRequiredError, BUILD_STATUS, BadRequestError, BillingModule, type Build, BuildError, BuildFailedError, type BuildModule, type BuildModuleConfig, type BuildProgress, type BuildStatus, type ClientConfig, ComputeModule, ConflictError, DeployResult, type ECloudClient, ERC20 as ERC20ABI, type Environment, EnvironmentConfig, ForbiddenError, GasEstimate, type LegacyKey, type LogChunk, LogVisibility, Logger, type Metric, type MetricsContext, NoopClient, NotFoundError, PostHogClient, type PrepareDeployResult, type PrepareUpgradeResult, PreparedDeploy, PreparedUpgrade, type PrivateKeySource, ResourceUsageMonitoring, type SDKDeployOptions, type SDKUpgradeOptions, type StoredKey, type SubmitBuildRequest, type SubmitBuildResponse, type TelemetryClient, type TelemetryClientOptions, type TelemetryWrapperOptions, TimeoutError, USDCCredits as USDCCreditsABI, type VerifyProvenanceFailure, type VerifyProvenanceResult, type VerifyProvenanceSuccess, addMetric, addMetricWithDimensions, createAppEnvironment, createBuildModule, createECloudClient, createMetricsContext, createTelemetryClient, deleteLegacyPrivateKey, deletePrivateKey, emitMetrics, executeDeploy, executeUpgrade, fetchTemplateCatalog, getAddressFromPrivateKey, getCategoryDescriptions, getCurrentInstanceType, getLegacyKeys, getLegacyPrivateKey, getPostHogAPIKey, getPostHogEndpoint, getPrivateKey, getPrivateKeyWithSource, getTemplate, isNoopClient, keyExists, listStoredKeys, prepareDeploy, prepareDeployFromVerifiableBuild, prepareUpgrade, prepareUpgradeFromVerifiableBuild, requirePrivateKey, storePrivateKey, validatePrivateKey, watchDeployment, watchUpgrade, withSDKTelemetry };
966
+ export { AddAdminResponse, type AdminModule, type AdminModuleConfig, type AppEnvironment, AppId, AuthRequiredError, BUILD_STATUS, BadRequestError, BillingModule, type Build, BuildError, BuildFailedError, type BuildModule, type BuildModuleConfig, type BuildProgress, type BuildStatus, type ClientConfig, ComputeModule, ConflictError, CreateCouponResponse, DeployResult, type ECloudClient, ERC20 as ERC20ABI, type Environment, EnvironmentConfig, ForbiddenError, GasEstimate, GetCouponResponse, type LegacyKey, ListAdminsResponse, ListCouponsResponse, type LogChunk, LogVisibility, Logger, type Metric, type MetricsContext, NoopClient, NotFoundError, PostHogClient, type PrepareDeployResult, type PrepareUpgradeResult, PreparedDeploy, PreparedUpgrade, type PrivateKeySource, ResourceUsageMonitoring, type SDKDeployOptions, type SDKUpgradeOptions, type StoredKey, type SubmitBuildRequest, type SubmitBuildResponse, type TelemetryClient, type TelemetryClientOptions, type TelemetryWrapperOptions, TimeoutError, USDCCredits as USDCCreditsABI, type VerifyProvenanceFailure, type VerifyProvenanceResult, type VerifyProvenanceSuccess, addMetric, addMetricWithDimensions, createAdminModule, createAppEnvironment, createBuildModule, createECloudClient, createMetricsContext, createTelemetryClient, deleteLegacyPrivateKey, deletePrivateKey, emitMetrics, executeDeploy, executeUpgrade, fetchTemplateCatalog, getAddressFromPrivateKey, getCategoryDescriptions, getCurrentInstanceType, getLegacyKeys, getLegacyPrivateKey, getPostHogAPIKey, getPostHogEndpoint, getPrivateKey, getPrivateKeyWithSource, getTemplate, isNoopClient, keyExists, listStoredKeys, prepareDeploy, prepareDeployFromVerifiableBuild, prepareUpgrade, prepareUpgradeFromVerifiableBuild, requirePrivateKey, storePrivateKey, validatePrivateKey, watchDeployment, watchUpgrade, withSDKTelemetry };
package/dist/index.d.ts CHANGED
@@ -1,13 +1,13 @@
1
- import { C as ComputeModule } from './compute-B6SZ0VQG.js';
2
- export { a as ComputeModuleConfig, b as CreateAppOpts, L as LogsOptions, P as PRIMARY_LANGUAGES, S as SDKCreateAppOpts, c as createApp, d as createComputeModule, e as encodeStartAppData, f as encodeStopAppData, g as encodeTerminateAppData, h as getAvailableTemplates, l as logs } from './compute-B6SZ0VQG.js';
1
+ import { C as ComputeModule } from './compute-9bzsfthb.js';
2
+ export { a as ComputeModuleConfig, b as CreateAppOpts, L as LogsOptions, P as PRIMARY_LANGUAGES, S as SDKCreateAppOpts, c as createApp, d as createComputeModule, e as encodeStartAppData, f as encodeStopAppData, g as encodeTerminateAppData, h as getAvailableTemplates, l as logs } from './compute-9bzsfthb.js';
3
3
  import { BillingModule } from './billing.js';
4
4
  export { BillingChain, BillingModuleConfig, TopUpInfo, TopUpOpts, TopUpResult, createBillingModule } from './billing.js';
5
5
  import { WalletClient, PublicClient, Address, Hex } from 'viem';
6
6
  export { AttestClient, AttestClientConfig, JwtProvider } from './attest.js';
7
- import { V as PreparedDeploy, G as GasEstimate, E as EnvironmentConfig, H as Logger, q as DeployResult, Y as PreparedUpgrade, A as AppId } from './index-BoCE0hIh.js';
8
- export { a as AlreadyActiveResponse, c as AppProfile, d as AppProfileResponse, e as AppRecord, f as BillingEnvironmentConfig, g as CancelResponse, h as CancelSuccessResponse, i as ChainID, j as CheckoutCreatedResponse, k as CreateSubscriptionOptions, l as CreateSubscriptionResponse, m as CreditPurchaseResponse, n as DeployAppOpts, o as DeployOptions, p as DeployProgressCallback, r as DeployStep, s as DockerImageConfig, t as EstimateGasOptions, v as ExecuteDeployResult, x as ExecuteUpgradeResult, y as GasOpts, z as GetSubscriptionOptions, I as ImageDigestResult, L as LifecycleOpts, N as NoActiveSubscriptionResponse, P as ParsedEnvironment, J as PaymentIssueResponse, K as PaymentMethod, M as PaymentMethodsResponse, Q as PrepareDeployFromVerifiableBuildOpts, R as PrepareDeployOpts, T as PrepareUpgradeFromVerifiableBuildOpts, U as PrepareUpgradeOpts, X as PreparedDeployData, _ as PreparedUpgradeData, $ as ProductID, a0 as ProductSubscriptionResponse, a1 as Release, a3 as SequentialDeployResult, a4 as SubscribeResponse, a5 as SubscriptionLineItem, a6 as SubscriptionOpts, a7 as SubscriptionStatus, ab as UpgradeAppOpts, ac as calculateAppID, ae as estimateTransactionGas, aj as formatETH, al as getAllAppsByDeveloper, aC as getAppLatestReleaseBlockNumbers, am as getAppsByBillingAccount, ap as getBillingType, aD as getBlockTimestamps, as as logVisibility, at as noopLogger } from './index-BoCE0hIh.js';
9
- import { L as LogVisibility, aj as ResourceUsageMonitoring } from './helpers-F7CeDSVX.js';
10
- export { A as AppInfo, d as AppMetrics, e as AppProfileInfo, ak as AppRelease, al as AppReleaseBuild, am as AppResponse, an as BASE_SEPOLIA_CHAIN_ID, B as BillingApiClient, C as ComputeApiConfig, l as CreateAppParams, ao as DeployParams, E as EstimateBatchGasOptions, G as GeneratedKey, o as LoginRequest, p as LoginResult, q as LogsParams, a as SessionError, S as SessionInfo, b as SiweMessageParams, r as SiweMessageResult, ap as UpgradeParams, U as UserApiClient, t as addHexPrefix, aq as assertValidFilePath, u as assertValidImageReference, v as assertValidPrivateKey, w as checkERC7702Delegation, x as createSiweMessage, ar as createViemClients, y as estimateBatchGas, D as extractAppNameFromImage, F as generateNewPrivateKey, H as generateNonce, I as getAvailableEnvironments, K as getBillingEnvironmentConfig, M as getBuildType, N as getChainFromID, O as getComputeApiSession, P as getEnvironmentConfig, R as isEnvironmentAvailable, T as isMainnet, V as isSessionValid, W as isSiweMessageExpired, X as isSiweMessageNotYetValid, Y as isSubscriptionActive, $ as loginToComputeApi, a2 as logoutFromComputeApi, a3 as parseSiweMessage, a4 as sanitizeString, a5 as sanitizeURL, a6 as sanitizeXURL, a7 as stripHexPrefix, a8 as validateAppID, a9 as validateAppName, aa as validateCreateAppParams, as as validateDeployParams, ab as validateDescription, at as validateFilePath, au as validateImagePath, ac as validateImageReference, ad as validateInstanceTypeSKU, ae as validateLogVisibility, af as validateLogsParams, ag as validatePrivateKeyFormat, av as validateResourceUsageMonitoring, ah as validateURL, aw as validateUpgradeParams, ai as validateXURL } from './helpers-F7CeDSVX.js';
7
+ import { a0 as PreparedDeploy, H as GasEstimate, E as EnvironmentConfig, Q as Logger, u as DeployResult, a3 as PreparedUpgrade, A as AppId, n as CreateCouponResponse, P as ListCouponsResponse, J as GetCouponResponse, a as AddAdminResponse, O as ListAdminsResponse } from './index-CLhRJNai.js';
8
+ export { b as AdminCoupon, c as AdminUser, d as AlreadyActiveResponse, f as AppProfile, g as AppProfileResponse, h as AppRecord, i as BillingEnvironmentConfig, j as CancelResponse, k as CancelSuccessResponse, l as ChainID, m as CheckoutCreatedResponse, o as CreateSubscriptionOptions, p as CreateSubscriptionResponse, q as CreditPurchaseResponse, r as DeployAppOpts, s as DeployOptions, t as DeployProgressCallback, v as DeployStep, w as DockerImageConfig, x as EstimateGasOptions, z as ExecuteDeployResult, G as ExecuteUpgradeResult, I as GasOpts, K as GetSubscriptionOptions, L as ImageDigestResult, N as LifecycleOpts, R as NoActiveSubscriptionResponse, S as ParsedEnvironment, T as PaymentIssueResponse, U as PaymentMethod, V as PaymentMethodsResponse, X as PrepareDeployFromVerifiableBuildOpts, Y as PrepareDeployOpts, _ as PrepareUpgradeFromVerifiableBuildOpts, $ as PrepareUpgradeOpts, a2 as PreparedDeployData, a5 as PreparedUpgradeData, a6 as ProductID, a7 as ProductSubscriptionResponse, a8 as RedeemCouponResponse, a9 as Release, ab as SequentialDeployResult, ac as SubscribeResponse, ad as SubscriptionLineItem, ae as SubscriptionOpts, af as SubscriptionStatus, aj as UpgradeAppOpts, ak as calculateAppID, am as estimateTransactionGas, ar as formatETH, at as getAllAppsByDeveloper, aK as getAppLatestReleaseBlockNumbers, au as getAppsByBillingAccount, ax as getBillingType, aL as getBlockTimestamps, aA as logVisibility, aB as noopLogger } from './index-CLhRJNai.js';
9
+ import { L as LogVisibility, aj as ResourceUsageMonitoring } from './helpers-DEGFGA-T.js';
10
+ export { A as AppInfo, d as AppMetrics, e as AppProfileInfo, ak as AppRelease, al as AppReleaseBuild, am as AppResponse, an as BASE_SEPOLIA_CHAIN_ID, B as BillingApiClient, C as ComputeApiConfig, l as CreateAppParams, ao as DeployParams, E as EstimateBatchGasOptions, G as GeneratedKey, o as LoginRequest, p as LoginResult, q as LogsParams, a as SessionError, S as SessionInfo, b as SiweMessageParams, r as SiweMessageResult, ap as UpgradeParams, U as UserApiClient, t as addHexPrefix, aq as assertValidFilePath, u as assertValidImageReference, v as assertValidPrivateKey, w as checkERC7702Delegation, x as createSiweMessage, ar as createViemClients, y as estimateBatchGas, D as extractAppNameFromImage, F as generateNewPrivateKey, H as generateNonce, I as getAvailableEnvironments, K as getBillingEnvironmentConfig, M as getBuildType, N as getChainFromID, O as getComputeApiSession, P as getEnvironmentConfig, R as isEnvironmentAvailable, T as isMainnet, V as isSessionValid, W as isSiweMessageExpired, X as isSiweMessageNotYetValid, Y as isSubscriptionActive, $ as loginToComputeApi, a2 as logoutFromComputeApi, a3 as parseSiweMessage, a4 as sanitizeString, a5 as sanitizeURL, a6 as sanitizeXURL, a7 as stripHexPrefix, a8 as validateAppID, a9 as validateAppName, aa as validateCreateAppParams, as as validateDeployParams, ab as validateDescription, at as validateFilePath, au as validateImagePath, ac as validateImageReference, ad as validateInstanceTypeSKU, ae as validateLogVisibility, af as validateLogsParams, ag as validatePrivateKeyFormat, av as validateResourceUsageMonitoring, ah as validateURL, aw as validateUpgradeParams, ai as validateXURL } from './helpers-DEGFGA-T.js';
11
11
 
12
12
  interface SubmitBuildRequest {
13
13
  repoUrl: string;
@@ -396,6 +396,30 @@ declare function executeUpgrade(options: ExecuteUpgradeOptions): Promise<Upgrade
396
396
  */
397
397
  declare function watchUpgrade(appId: string, walletClient: WalletClient, publicClient: PublicClient, environmentConfig: EnvironmentConfig, logger?: Logger, skipTelemetry?: boolean): Promise<void>;
398
398
 
399
+ interface AdminModule {
400
+ address: Address;
401
+ createCoupon: (amountCents: number) => Promise<CreateCouponResponse>;
402
+ listCoupons: (opts?: {
403
+ offset?: number;
404
+ limit?: number;
405
+ active?: boolean;
406
+ redeemed?: boolean;
407
+ }) => Promise<ListCouponsResponse>;
408
+ getCoupon: (id: string) => Promise<GetCouponResponse>;
409
+ deactivateCoupon: (id: string) => Promise<void>;
410
+ redeemCouponForUser: (id: string, address: string) => Promise<void>;
411
+ addAdmin: (address: string) => Promise<AddAdminResponse>;
412
+ removeAdmin: (address: string) => Promise<void>;
413
+ listAdmins: () => Promise<ListAdminsResponse>;
414
+ }
415
+ interface AdminModuleConfig {
416
+ verbose?: boolean;
417
+ walletClient: WalletClient;
418
+ publicClient: PublicClient;
419
+ environment: string;
420
+ }
421
+ declare function createAdminModule(config: AdminModuleConfig): AdminModule;
422
+
399
423
  /**
400
424
  * OS Keyring Integration
401
425
  *
@@ -939,4 +963,4 @@ interface ECloudClient {
939
963
  }
940
964
  declare function createECloudClient(cfg: ClientConfig): ECloudClient;
941
965
 
942
- export { type AppEnvironment, AppId, AuthRequiredError, BUILD_STATUS, BadRequestError, BillingModule, type Build, BuildError, BuildFailedError, type BuildModule, type BuildModuleConfig, type BuildProgress, type BuildStatus, type ClientConfig, ComputeModule, ConflictError, DeployResult, type ECloudClient, ERC20 as ERC20ABI, type Environment, EnvironmentConfig, ForbiddenError, GasEstimate, type LegacyKey, type LogChunk, LogVisibility, Logger, type Metric, type MetricsContext, NoopClient, NotFoundError, PostHogClient, type PrepareDeployResult, type PrepareUpgradeResult, PreparedDeploy, PreparedUpgrade, type PrivateKeySource, ResourceUsageMonitoring, type SDKDeployOptions, type SDKUpgradeOptions, type StoredKey, type SubmitBuildRequest, type SubmitBuildResponse, type TelemetryClient, type TelemetryClientOptions, type TelemetryWrapperOptions, TimeoutError, USDCCredits as USDCCreditsABI, type VerifyProvenanceFailure, type VerifyProvenanceResult, type VerifyProvenanceSuccess, addMetric, addMetricWithDimensions, createAppEnvironment, createBuildModule, createECloudClient, createMetricsContext, createTelemetryClient, deleteLegacyPrivateKey, deletePrivateKey, emitMetrics, executeDeploy, executeUpgrade, fetchTemplateCatalog, getAddressFromPrivateKey, getCategoryDescriptions, getCurrentInstanceType, getLegacyKeys, getLegacyPrivateKey, getPostHogAPIKey, getPostHogEndpoint, getPrivateKey, getPrivateKeyWithSource, getTemplate, isNoopClient, keyExists, listStoredKeys, prepareDeploy, prepareDeployFromVerifiableBuild, prepareUpgrade, prepareUpgradeFromVerifiableBuild, requirePrivateKey, storePrivateKey, validatePrivateKey, watchDeployment, watchUpgrade, withSDKTelemetry };
966
+ export { AddAdminResponse, type AdminModule, type AdminModuleConfig, type AppEnvironment, AppId, AuthRequiredError, BUILD_STATUS, BadRequestError, BillingModule, type Build, BuildError, BuildFailedError, type BuildModule, type BuildModuleConfig, type BuildProgress, type BuildStatus, type ClientConfig, ComputeModule, ConflictError, CreateCouponResponse, DeployResult, type ECloudClient, ERC20 as ERC20ABI, type Environment, EnvironmentConfig, ForbiddenError, GasEstimate, GetCouponResponse, type LegacyKey, ListAdminsResponse, ListCouponsResponse, type LogChunk, LogVisibility, Logger, type Metric, type MetricsContext, NoopClient, NotFoundError, PostHogClient, type PrepareDeployResult, type PrepareUpgradeResult, PreparedDeploy, PreparedUpgrade, type PrivateKeySource, ResourceUsageMonitoring, type SDKDeployOptions, type SDKUpgradeOptions, type StoredKey, type SubmitBuildRequest, type SubmitBuildResponse, type TelemetryClient, type TelemetryClientOptions, type TelemetryWrapperOptions, TimeoutError, USDCCredits as USDCCreditsABI, type VerifyProvenanceFailure, type VerifyProvenanceResult, type VerifyProvenanceSuccess, addMetric, addMetricWithDimensions, createAdminModule, createAppEnvironment, createBuildModule, createECloudClient, createMetricsContext, createTelemetryClient, deleteLegacyPrivateKey, deletePrivateKey, emitMetrics, executeDeploy, executeUpgrade, fetchTemplateCatalog, getAddressFromPrivateKey, getCategoryDescriptions, getCurrentInstanceType, getLegacyKeys, getLegacyPrivateKey, getPostHogAPIKey, getPostHogEndpoint, getPrivateKey, getPrivateKeyWithSource, getTemplate, isNoopClient, keyExists, listStoredKeys, prepareDeploy, prepareDeployFromVerifiableBuild, prepareUpgrade, prepareUpgradeFromVerifiableBuild, requirePrivateKey, storePrivateKey, validatePrivateKey, watchDeployment, watchUpgrade, withSDKTelemetry };
package/dist/index.js CHANGED
@@ -4837,7 +4837,7 @@ var CanViewAppLogsPermission = "0x2fd3f2fe";
4837
4837
  var CanViewSensitiveAppInfoPermission = "0x0e67b22f";
4838
4838
  var CanUpdateAppProfilePermission = "0x036fef61";
4839
4839
  function getDefaultClientId() {
4840
- const version = true ? "1.0.0-dev.4" : "0.0.0";
4840
+ const version = true ? "1.0.0-dev.5" : "0.0.0";
4841
4841
  return `ecloud-sdk/v${version}`;
4842
4842
  }
4843
4843
  var UserApiClient = class {
@@ -6030,6 +6030,63 @@ var BillingApiClient = class {
6030
6030
  return resp.json();
6031
6031
  }
6032
6032
  // ==========================================================================
6033
+ // Admin - Coupon Methods
6034
+ // ==========================================================================
6035
+ async createCoupon(amountCents) {
6036
+ const endpoint = `${this.config.billingApiServerURL}/admin/coupons`;
6037
+ const resp = await this.makeAuthenticatedRequest(endpoint, "POST", "compute", { amountCents });
6038
+ return resp.json();
6039
+ }
6040
+ async listCoupons(opts) {
6041
+ const params = new URLSearchParams();
6042
+ if (opts?.offset !== void 0) params.set("offset", opts.offset.toString());
6043
+ if (opts?.limit !== void 0) params.set("limit", opts.limit.toString());
6044
+ if (opts?.active !== void 0) params.set("active", opts.active.toString());
6045
+ if (opts?.redeemed !== void 0) params.set("redeemed", opts.redeemed.toString());
6046
+ const qs = params.toString();
6047
+ const endpoint = `${this.config.billingApiServerURL}/admin/coupons${qs ? `?${qs}` : ""}`;
6048
+ const resp = await this.makeAuthenticatedRequest(endpoint, "GET", "compute");
6049
+ return resp.json();
6050
+ }
6051
+ async getCoupon(id) {
6052
+ const endpoint = `${this.config.billingApiServerURL}/admin/coupons/${id}`;
6053
+ const resp = await this.makeAuthenticatedRequest(endpoint, "GET", "compute");
6054
+ return resp.json();
6055
+ }
6056
+ async deactivateCoupon(id) {
6057
+ const endpoint = `${this.config.billingApiServerURL}/admin/coupons/${id}/deactivate`;
6058
+ await this.makeAuthenticatedRequest(endpoint, "POST", "compute");
6059
+ }
6060
+ async redeemCouponForUser(id, address) {
6061
+ const endpoint = `${this.config.billingApiServerURL}/admin/coupons/${id}/redeem`;
6062
+ await this.makeAuthenticatedRequest(endpoint, "POST", "compute", { address });
6063
+ }
6064
+ // ==========================================================================
6065
+ // Admin - Admin Management Methods
6066
+ // ==========================================================================
6067
+ async addAdmin(address) {
6068
+ const endpoint = `${this.config.billingApiServerURL}/admin/admins`;
6069
+ const resp = await this.makeAuthenticatedRequest(endpoint, "POST", "compute", { address });
6070
+ return resp.json();
6071
+ }
6072
+ async removeAdmin(address) {
6073
+ const endpoint = `${this.config.billingApiServerURL}/admin/admins/${address}`;
6074
+ await this.makeAuthenticatedRequest(endpoint, "DELETE", "compute");
6075
+ }
6076
+ async listAdmins() {
6077
+ const endpoint = `${this.config.billingApiServerURL}/admin/admins`;
6078
+ const resp = await this.makeAuthenticatedRequest(endpoint, "GET", "compute");
6079
+ return resp.json();
6080
+ }
6081
+ // ==========================================================================
6082
+ // User - Coupon Redemption
6083
+ // ==========================================================================
6084
+ async redeemCoupon(code) {
6085
+ const endpoint = `${this.config.billingApiServerURL}/v1/coupons/redeem`;
6086
+ const resp = await this.makeAuthenticatedRequest(endpoint, "POST", "compute", { code });
6087
+ return resp.json();
6088
+ }
6089
+ // ==========================================================================
6033
6090
  // Internal Methods
6034
6091
  // ==========================================================================
6035
6092
  /**
@@ -8450,6 +8507,9 @@ function createBillingModule(config) {
8450
8507
  },
8451
8508
  hasBaseSupport() {
8452
8509
  return !!baseUsdcCreditsAddress && !!baseRPCURL;
8510
+ },
8511
+ async redeemCoupon(code) {
8512
+ return billingApi.redeemCoupon(code);
8453
8513
  }
8454
8514
  };
8455
8515
  return module;
@@ -8885,6 +8945,44 @@ function transformVerifyResult(raw) {
8885
8945
  };
8886
8946
  }
8887
8947
 
8948
+ // src/client/modules/admin/index.ts
8949
+ function createAdminModule(config) {
8950
+ const { verbose = false, walletClient } = config;
8951
+ if (!walletClient.account) {
8952
+ throw new Error("WalletClient must have an account attached");
8953
+ }
8954
+ const address = walletClient.account.address;
8955
+ const billingEnvConfig = getBillingEnvironmentConfig(getBuildType());
8956
+ const billingApi = new BillingApiClient(billingEnvConfig, walletClient, { verbose });
8957
+ return {
8958
+ address,
8959
+ async createCoupon(amountCents) {
8960
+ return billingApi.createCoupon(amountCents);
8961
+ },
8962
+ async listCoupons(opts) {
8963
+ return billingApi.listCoupons(opts);
8964
+ },
8965
+ async getCoupon(id) {
8966
+ return billingApi.getCoupon(id);
8967
+ },
8968
+ async deactivateCoupon(id) {
8969
+ return billingApi.deactivateCoupon(id);
8970
+ },
8971
+ async redeemCouponForUser(id, userAddress) {
8972
+ return billingApi.redeemCouponForUser(id, userAddress);
8973
+ },
8974
+ async addAdmin(adminAddress) {
8975
+ return billingApi.addAdmin(adminAddress);
8976
+ },
8977
+ async removeAdmin(adminAddress) {
8978
+ return billingApi.removeAdmin(adminAddress);
8979
+ },
8980
+ async listAdmins() {
8981
+ return billingApi.listAdmins();
8982
+ }
8983
+ };
8984
+ }
8985
+
8888
8986
  // src/client/common/auth/keyring.ts
8889
8987
  import { AsyncEntry, findCredentials } from "@napi-rs/keyring";
8890
8988
  import { privateKeyToAddress } from "viem/accounts";
@@ -9448,6 +9546,7 @@ export {
9448
9546
  assertValidPrivateKey,
9449
9547
  calculateAppID,
9450
9548
  checkERC7702Delegation,
9549
+ createAdminModule,
9451
9550
  createApp,
9452
9551
  createAppEnvironment,
9453
9552
  createBillingModule,