@layr-labs/ecloud-sdk 1.0.0-dev.3 → 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-yAqGf5hM.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-yAqGf5hM.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
- export { BillingModuleConfig, createBillingModule } from './billing.cjs';
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-Bac4HjC0.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-Bac4HjC0.cjs';
9
- import { L as LogVisibility, aj as ResourceUsageMonitoring } from './helpers-CnlJ5yPE.cjs';
10
- export { A as AppInfo, d as AppMetrics, e as AppProfileInfo, ak as AppRelease, al as AppReleaseBuild, am as AppResponse, B as BillingApiClient, C as ComputeApiConfig, l as CreateAppParams, an 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, ao as UpgradeParams, U as UserApiClient, t as addHexPrefix, ap as assertValidFilePath, u as assertValidImageReference, v as assertValidPrivateKey, w as checkERC7702Delegation, x as createSiweMessage, aq 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, ar as validateDeployParams, ab as validateDescription, as as validateFilePath, at as validateImagePath, ac as validateImageReference, ad as validateInstanceTypeSKU, ae as validateLogVisibility, af as validateLogsParams, ag as validatePrivateKeyFormat, au as validateResourceUsageMonitoring, ah as validateURL, av as validateUpgradeParams, ai as validateXURL } from './helpers-CnlJ5yPE.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-BbgMH6Ef.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-BbgMH6Ef.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
- export { BillingModuleConfig, createBillingModule } from './billing.js';
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-Bac4HjC0.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-Bac4HjC0.js';
9
- import { L as LogVisibility, aj as ResourceUsageMonitoring } from './helpers-GWlLS3gz.js';
10
- export { A as AppInfo, d as AppMetrics, e as AppProfileInfo, ak as AppRelease, al as AppReleaseBuild, am as AppResponse, B as BillingApiClient, C as ComputeApiConfig, l as CreateAppParams, an 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, ao as UpgradeParams, U as UserApiClient, t as addHexPrefix, ap as assertValidFilePath, u as assertValidImageReference, v as assertValidPrivateKey, w as checkERC7702Delegation, x as createSiweMessage, aq 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, ar as validateDeployParams, ab as validateDescription, as as validateFilePath, at as validateImagePath, ac as validateImageReference, ad as validateInstanceTypeSKU, ae as validateLogVisibility, af as validateLogsParams, ag as validatePrivateKeyFormat, au as validateResourceUsageMonitoring, ah as validateURL, av as validateUpgradeParams, ai as validateXURL } from './helpers-GWlLS3gz.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
@@ -143,8 +143,8 @@ import * as child_process from "child_process";
143
143
  import { promisify } from "util";
144
144
 
145
145
  // src/client/common/constants.ts
146
- import { sepolia, mainnet } from "viem/chains";
147
- var SUPPORTED_CHAINS = [mainnet, sepolia];
146
+ import { sepolia, mainnet, baseSepolia } from "viem/chains";
147
+ var SUPPORTED_CHAINS = [mainnet, sepolia, baseSepolia];
148
148
  var DOCKER_PLATFORM = "linux/amd64";
149
149
  var REGISTRY_PROPAGATION_WAIT_SECONDS = 3;
150
150
  var LAYERED_DOCKERFILE_NAME = "Dockerfile.eigencompute";
@@ -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.3" : "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 {
@@ -5596,6 +5596,7 @@ function validateLogsParams(params) {
5596
5596
  // src/client/common/config/environment.ts
5597
5597
  var SEPOLIA_CHAIN_ID = 11155111;
5598
5598
  var MAINNET_CHAIN_ID = 1;
5599
+ var BASE_SEPOLIA_CHAIN_ID = 84532;
5599
5600
  var CommonAddresses = {
5600
5601
  ERC7702Delegator: "0x63c0c19a282a1b52b07dd5a65b58948a07dae32b"
5601
5602
  };
@@ -5625,7 +5626,9 @@ var ENVIRONMENTS = {
5625
5626
  kmsServerURL: "http://10.128.0.57:8080",
5626
5627
  userApiServerURL: "https://userapi-compute-sepolia-dev.eigencloud.xyz",
5627
5628
  defaultRPCURL: "https://ethereum-sepolia-rpc.publicnode.com",
5628
- usdcCreditsAddress: "0xbdA3897c3A428763B59015C64AB766c288C97376"
5629
+ usdcCreditsAddress: "0xbdA3897c3A428763B59015C64AB766c288C97376",
5630
+ baseUsdcCreditsAddress: "0x7673a47463F80c6a3553Db9E54c8cDcd5313d0ac",
5631
+ baseRPCURL: "https://base-sepolia-rpc.publicnode.com"
5629
5632
  },
5630
5633
  sepolia: {
5631
5634
  name: "sepolia",
@@ -5637,7 +5640,9 @@ var ENVIRONMENTS = {
5637
5640
  userApiServerURL: "https://userapi-compute-sepolia-prod.eigencloud.xyz",
5638
5641
  defaultRPCURL: "https://ethereum-sepolia-rpc.publicnode.com",
5639
5642
  billingRPCURL: "https://ethereum-rpc.publicnode.com",
5640
- usdcCreditsAddress: "0xed9c88640ca9149Bd9f7ee6620074af10F2E145d"
5643
+ usdcCreditsAddress: "0xed9c88640ca9149Bd9f7ee6620074af10F2E145d",
5644
+ baseUsdcCreditsAddress: "0x7673a47463F80c6a3553Db9E54c8cDcd5313d0ac",
5645
+ baseRPCURL: "https://base-sepolia-rpc.publicnode.com"
5641
5646
  },
5642
5647
  "mainnet-alpha": {
5643
5648
  name: "mainnet-alpha",
@@ -6025,6 +6030,63 @@ var BillingApiClient = class {
6025
6030
  return resp.json();
6026
6031
  }
6027
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
+ // ==========================================================================
6028
6090
  // Internal Methods
6029
6091
  // ==========================================================================
6030
6092
  /**
@@ -8230,7 +8292,7 @@ var ERC20_default = [
8230
8292
 
8231
8293
  // src/client/modules/billing/index.ts
8232
8294
  function createBillingModule(config) {
8233
- const { verbose = false, skipTelemetry = false, walletClient, publicClient, environment } = config;
8295
+ const { verbose = false, skipTelemetry = false, walletClient, publicClient, environment, privateKey } = config;
8234
8296
  if (!walletClient.account) {
8235
8297
  throw new Error("WalletClient must have an account attached");
8236
8298
  }
@@ -8239,35 +8301,69 @@ function createBillingModule(config) {
8239
8301
  const billingEnvConfig = getBillingEnvironmentConfig(getBuildType());
8240
8302
  const billingApi = new BillingApiClient(billingEnvConfig, walletClient, { verbose });
8241
8303
  const environmentConfig = getEnvironmentConfig(environment);
8242
- const usdcCreditsAddress = environmentConfig.usdcCreditsAddress;
8243
- if (!usdcCreditsAddress) {
8304
+ if (!environmentConfig.usdcCreditsAddress) {
8244
8305
  throw new Error(`USDCCredits contract address not configured for environment "${environment}"`);
8245
8306
  }
8307
+ const usdcCreditsAddress = environmentConfig.usdcCreditsAddress;
8308
+ const baseUsdcCreditsAddress = environmentConfig.baseUsdcCreditsAddress;
8309
+ const baseRPCURL = environmentConfig.baseRPCURL;
8310
+ function resolveChainConfig(chain) {
8311
+ if (chain === "base") {
8312
+ if (!baseUsdcCreditsAddress || !baseRPCURL) {
8313
+ throw new Error(`Base chain not configured for environment "${environment}"`);
8314
+ }
8315
+ if (!privateKey) {
8316
+ throw new Error("Private key required for Base chain transactions");
8317
+ }
8318
+ const baseClients = createClients({
8319
+ privateKey,
8320
+ rpcUrl: baseRPCURL,
8321
+ chainId: BigInt(BASE_SEPOLIA_CHAIN_ID)
8322
+ });
8323
+ return {
8324
+ pub: baseClients.publicClient,
8325
+ wallet: baseClients.walletClient,
8326
+ creditsAddress: baseUsdcCreditsAddress,
8327
+ envConfig: {
8328
+ ...environmentConfig,
8329
+ chainID: BigInt(BASE_SEPOLIA_CHAIN_ID),
8330
+ defaultRPCURL: baseRPCURL
8331
+ }
8332
+ };
8333
+ }
8334
+ return {
8335
+ pub: publicClient,
8336
+ wallet: walletClient,
8337
+ creditsAddress: usdcCreditsAddress,
8338
+ envConfig: environmentConfig
8339
+ };
8340
+ }
8246
8341
  const module = {
8247
8342
  address,
8248
- async getTopUpInfo() {
8249
- const usdcAddress = await publicClient.readContract({
8250
- address: usdcCreditsAddress,
8343
+ async getTopUpInfo(opts) {
8344
+ const { pub, creditsAddress } = resolveChainConfig(opts?.chain);
8345
+ const usdcAddress = await pub.readContract({
8346
+ address: creditsAddress,
8251
8347
  abi: USDCCredits_default,
8252
8348
  functionName: "usdc"
8253
8349
  });
8254
8350
  const [minimumPurchase, usdcBalance, currentAllowance] = await Promise.all([
8255
- publicClient.readContract({
8256
- address: usdcCreditsAddress,
8351
+ pub.readContract({
8352
+ address: creditsAddress,
8257
8353
  abi: USDCCredits_default,
8258
8354
  functionName: "minimumPurchase"
8259
8355
  }),
8260
- publicClient.readContract({
8356
+ pub.readContract({
8261
8357
  address: usdcAddress,
8262
8358
  abi: ERC20_default,
8263
8359
  functionName: "balanceOf",
8264
8360
  args: [address]
8265
8361
  }),
8266
- publicClient.readContract({
8362
+ pub.readContract({
8267
8363
  address: usdcAddress,
8268
8364
  abi: ERC20_default,
8269
8365
  functionName: "allowance",
8270
- args: [address, usdcCreditsAddress]
8366
+ args: [address, creditsAddress]
8271
8367
  })
8272
8368
  ]);
8273
8369
  return { usdcAddress, minimumPurchase, usdcBalance, currentAllowance };
@@ -8277,11 +8373,12 @@ function createBillingModule(config) {
8277
8373
  {
8278
8374
  functionName: "topUp",
8279
8375
  skipTelemetry,
8280
- properties: { amount: opts.amount.toString() }
8376
+ properties: { amount: opts.amount.toString(), chain: opts.chain || "ethereum" }
8281
8377
  },
8282
8378
  async () => {
8283
8379
  const targetAccount = opts.account ?? address;
8284
- const { usdcAddress, currentAllowance } = await module.getTopUpInfo();
8380
+ const { pub, wallet, creditsAddress, envConfig } = resolveChainConfig(opts.chain);
8381
+ const { usdcAddress, currentAllowance } = await module.getTopUpInfo({ chain: opts.chain });
8285
8382
  const executions = [];
8286
8383
  if (currentAllowance < opts.amount) {
8287
8384
  executions.push({
@@ -8290,12 +8387,12 @@ function createBillingModule(config) {
8290
8387
  callData: encodeFunctionData4({
8291
8388
  abi: ERC20_default,
8292
8389
  functionName: "approve",
8293
- args: [usdcCreditsAddress, opts.amount]
8390
+ args: [creditsAddress, opts.amount]
8294
8391
  })
8295
8392
  });
8296
8393
  }
8297
8394
  executions.push({
8298
- target: usdcCreditsAddress,
8395
+ target: creditsAddress,
8299
8396
  value: 0n,
8300
8397
  callData: encodeFunctionData4({
8301
8398
  abi: USDCCredits_default,
@@ -8305,9 +8402,9 @@ function createBillingModule(config) {
8305
8402
  });
8306
8403
  const txHash = await executeBatch(
8307
8404
  {
8308
- walletClient,
8309
- publicClient,
8310
- environmentConfig,
8405
+ walletClient: wallet,
8406
+ publicClient: pub,
8407
+ environmentConfig: envConfig,
8311
8408
  executions,
8312
8409
  pendingMessage: "Submitting credit purchase..."
8313
8410
  },
@@ -8407,6 +8504,12 @@ function createBillingModule(config) {
8407
8504
  },
8408
8505
  async purchaseCredits(amountCents, paymentMethodId) {
8409
8506
  return billingApi.purchaseCredits(amountCents, paymentMethodId);
8507
+ },
8508
+ hasBaseSupport() {
8509
+ return !!baseUsdcCreditsAddress && !!baseRPCURL;
8510
+ },
8511
+ async redeemCoupon(code) {
8512
+ return billingApi.redeemCoupon(code);
8410
8513
  }
8411
8514
  };
8412
8515
  return module;
@@ -8842,6 +8945,44 @@ function transformVerifyResult(raw) {
8842
8945
  };
8843
8946
  }
8844
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
+
8845
8986
  // src/client/common/auth/keyring.ts
8846
8987
  import { AsyncEntry, findCredentials } from "@napi-rs/keyring";
8847
8988
  import { privateKeyToAddress } from "viem/accounts";
@@ -9379,6 +9520,7 @@ var JwtProvider = class {
9379
9520
  export {
9380
9521
  AttestClient,
9381
9522
  AuthRequiredError,
9523
+ BASE_SEPOLIA_CHAIN_ID,
9382
9524
  BUILD_STATUS,
9383
9525
  BadRequestError,
9384
9526
  BillingApiClient,
@@ -9404,6 +9546,7 @@ export {
9404
9546
  assertValidPrivateKey,
9405
9547
  calculateAppID,
9406
9548
  checkERC7702Delegation,
9549
+ createAdminModule,
9407
9550
  createApp,
9408
9551
  createAppEnvironment,
9409
9552
  createBillingModule,