@layr-labs/ecloud-sdk 1.0.0-dev.2 → 1.0.0-dev.4

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,10 +1,11 @@
1
- import { E as EnvironmentConfig, a4 as SubscriptionStatus, f as BillingEnvironmentConfig, Y as ProductID, k as CreateSubscriptionOptions, l as CreateSubscriptionResponse, y as GetSubscriptionOptions, Z as ProductSubscriptionResponse, G as GasEstimate, F as Logger } from './index-U2vKBrry.cjs';
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';
2
2
  import { Address, Hex, WalletClient, PublicClient, SignAuthorizationReturnType, Chain } from 'viem';
3
3
 
4
4
  /**
5
5
  * Environment configuration for different networks
6
6
  */
7
7
 
8
+ declare const BASE_SEPOLIA_CHAIN_ID = 84532;
8
9
  /**
9
10
  * Get environment configuration
10
11
  */
@@ -733,6 +734,8 @@ interface BillingApiClientOptions {
733
734
  * When false (default), uses EIP-712 typed data signatures for each request.
734
735
  */
735
736
  useSession?: boolean;
737
+ /** Log request/response details to stderr */
738
+ verbose?: boolean;
736
739
  }
737
740
  /**
738
741
  * BillingAPI Client for managing product subscriptions.
@@ -796,6 +799,8 @@ declare class BillingApiClient {
796
799
  createSubscription(productId?: ProductID, options?: CreateSubscriptionOptions): Promise<CreateSubscriptionResponse>;
797
800
  getSubscription(productId?: ProductID, options?: GetSubscriptionOptions): Promise<ProductSubscriptionResponse>;
798
801
  cancelSubscription(productId?: ProductID): Promise<void>;
802
+ getPaymentMethods(): Promise<PaymentMethodsResponse>;
803
+ purchaseCredits(amountCents: number, paymentMethodId?: string): Promise<CreditPurchaseResponse>;
799
804
  /**
800
805
  * Make an authenticated request to the billing API
801
806
  *
@@ -988,4 +993,4 @@ declare function addHexPrefix(value: string): Hex;
988
993
  */
989
994
  declare function stripHexPrefix(value: string): string;
990
995
 
991
- export { loginToComputeApi as $, type AppInfo as A, BillingApiClient as B, type ComputeApiConfig as C, extractAppNameFromImage as D, type EstimateBatchGasOptions as E, generateNewPrivateKey as F, type GeneratedKey as G, generateNonce as H, getAvailableEnvironments as I, getBillingApiSession as J, getBillingEnvironmentConfig as K, type LogVisibility as L, getBuildType as M, getChainFromID as N, getComputeApiSession as O, getEnvironmentConfig as P, isBillingSessionValid as Q, isEnvironmentAvailable as R, type SessionInfo as S, isMainnet as T, UserApiClient as U, isSessionValid as V, isSiweMessageExpired as W, isSiweMessageNotYetValid as X, isSubscriptionActive as Y, loginToBillingApi as Z, loginToBothApis as _, SessionError as a, logoutFromBillingApi as a0, logoutFromBothApis as a1, logoutFromComputeApi as a2, parseSiweMessage as a3, sanitizeString as a4, sanitizeURL as a5, sanitizeXURL as a6, stripHexPrefix as a7, validateAppID as a8, validateAppName as a9, validateCreateAppParams as aa, validateDescription as ab, validateImageReference as ac, validateInstanceTypeSKU as ad, validateLogVisibility as ae, validateLogsParams as af, validatePrivateKeyFormat as ag, validateURL as ah, validateXURL as ai, type ResourceUsageMonitoring as aj, type AppRelease as ak, type AppReleaseBuild as al, type AppResponse as am, type DeployParams as an, type UpgradeParams as ao, assertValidFilePath as ap, createClients as aq, validateDeployParams as ar, validateFilePath as as, validateImagePath as at, validateResourceUsageMonitoring as au, validateUpgradeParams as av, type SiweMessageParams as b, type AppInfoResponse as c, type AppMetrics as d, type AppProfileInfo as e, type BillingApiClientOptions as f, type BillingApiConfig as g, type BillingLoginRequest as h, type BillingLoginResult as i, BillingSessionError as j, type BillingSessionInfo as k, type CreateAppParams as l, type ExecuteBatchOptions as m, type Execution as n, type LoginRequest as o, type LoginResult as p, type LogsParams as q, type SiweMessageResult as r, type UserApiClientOptions as s, addHexPrefix as t, assertValidImageReference as u, assertValidPrivateKey as v, checkERC7702Delegation as w, createSiweMessage as x, estimateBatchGas as y, executeBatch as z };
996
+ export { loginToComputeApi as $, type AppInfo as A, BillingApiClient as B, type ComputeApiConfig as C, extractAppNameFromImage as D, type EstimateBatchGasOptions as E, generateNewPrivateKey as F, type GeneratedKey as G, generateNonce as H, getAvailableEnvironments as I, getBillingApiSession as J, getBillingEnvironmentConfig as K, type LogVisibility as L, getBuildType as M, getChainFromID as N, getComputeApiSession as O, getEnvironmentConfig as P, isBillingSessionValid as Q, isEnvironmentAvailable as R, type SessionInfo as S, isMainnet as T, UserApiClient as U, isSessionValid as V, isSiweMessageExpired as W, isSiweMessageNotYetValid as X, isSubscriptionActive as Y, loginToBillingApi as Z, loginToBothApis as _, SessionError as a, logoutFromBillingApi as a0, logoutFromBothApis as a1, logoutFromComputeApi as a2, parseSiweMessage as a3, sanitizeString as a4, sanitizeURL as a5, sanitizeXURL as a6, stripHexPrefix as a7, validateAppID as a8, validateAppName as a9, validateCreateAppParams as aa, validateDescription as ab, validateImageReference as ac, validateInstanceTypeSKU as ad, validateLogVisibility as ae, validateLogsParams as af, validatePrivateKeyFormat as ag, validateURL as ah, validateXURL as ai, type ResourceUsageMonitoring as aj, type AppRelease as ak, type AppReleaseBuild as al, type AppResponse as am, BASE_SEPOLIA_CHAIN_ID as an, type DeployParams as ao, type UpgradeParams as ap, assertValidFilePath as aq, createClients as ar, validateDeployParams as as, validateFilePath as at, validateImagePath as au, validateResourceUsageMonitoring as av, validateUpgradeParams as aw, type SiweMessageParams as b, type AppInfoResponse as c, type AppMetrics as d, type AppProfileInfo as e, type BillingApiClientOptions as f, type BillingApiConfig as g, type BillingLoginRequest as h, type BillingLoginResult as i, BillingSessionError as j, type BillingSessionInfo as k, type CreateAppParams as l, type ExecuteBatchOptions as m, type Execution as n, type LoginRequest as o, type LoginResult as p, type LogsParams as q, type SiweMessageResult as r, type UserApiClientOptions as s, addHexPrefix as t, assertValidImageReference as u, assertValidPrivateKey as v, checkERC7702Delegation as w, createSiweMessage as x, estimateBatchGas as y, executeBatch as z };
@@ -1,10 +1,11 @@
1
- import { E as EnvironmentConfig, a4 as SubscriptionStatus, f as BillingEnvironmentConfig, Y as ProductID, k as CreateSubscriptionOptions, l as CreateSubscriptionResponse, y as GetSubscriptionOptions, Z as ProductSubscriptionResponse, G as GasEstimate, F as Logger } from './index-U2vKBrry.js';
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';
2
2
  import { Address, Hex, WalletClient, PublicClient, SignAuthorizationReturnType, Chain } from 'viem';
3
3
 
4
4
  /**
5
5
  * Environment configuration for different networks
6
6
  */
7
7
 
8
+ declare const BASE_SEPOLIA_CHAIN_ID = 84532;
8
9
  /**
9
10
  * Get environment configuration
10
11
  */
@@ -733,6 +734,8 @@ interface BillingApiClientOptions {
733
734
  * When false (default), uses EIP-712 typed data signatures for each request.
734
735
  */
735
736
  useSession?: boolean;
737
+ /** Log request/response details to stderr */
738
+ verbose?: boolean;
736
739
  }
737
740
  /**
738
741
  * BillingAPI Client for managing product subscriptions.
@@ -796,6 +799,8 @@ declare class BillingApiClient {
796
799
  createSubscription(productId?: ProductID, options?: CreateSubscriptionOptions): Promise<CreateSubscriptionResponse>;
797
800
  getSubscription(productId?: ProductID, options?: GetSubscriptionOptions): Promise<ProductSubscriptionResponse>;
798
801
  cancelSubscription(productId?: ProductID): Promise<void>;
802
+ getPaymentMethods(): Promise<PaymentMethodsResponse>;
803
+ purchaseCredits(amountCents: number, paymentMethodId?: string): Promise<CreditPurchaseResponse>;
799
804
  /**
800
805
  * Make an authenticated request to the billing API
801
806
  *
@@ -988,4 +993,4 @@ declare function addHexPrefix(value: string): Hex;
988
993
  */
989
994
  declare function stripHexPrefix(value: string): string;
990
995
 
991
- export { loginToComputeApi as $, type AppInfo as A, BillingApiClient as B, type ComputeApiConfig as C, extractAppNameFromImage as D, type EstimateBatchGasOptions as E, generateNewPrivateKey as F, type GeneratedKey as G, generateNonce as H, getAvailableEnvironments as I, getBillingApiSession as J, getBillingEnvironmentConfig as K, type LogVisibility as L, getBuildType as M, getChainFromID as N, getComputeApiSession as O, getEnvironmentConfig as P, isBillingSessionValid as Q, isEnvironmentAvailable as R, type SessionInfo as S, isMainnet as T, UserApiClient as U, isSessionValid as V, isSiweMessageExpired as W, isSiweMessageNotYetValid as X, isSubscriptionActive as Y, loginToBillingApi as Z, loginToBothApis as _, SessionError as a, logoutFromBillingApi as a0, logoutFromBothApis as a1, logoutFromComputeApi as a2, parseSiweMessage as a3, sanitizeString as a4, sanitizeURL as a5, sanitizeXURL as a6, stripHexPrefix as a7, validateAppID as a8, validateAppName as a9, validateCreateAppParams as aa, validateDescription as ab, validateImageReference as ac, validateInstanceTypeSKU as ad, validateLogVisibility as ae, validateLogsParams as af, validatePrivateKeyFormat as ag, validateURL as ah, validateXURL as ai, type ResourceUsageMonitoring as aj, type AppRelease as ak, type AppReleaseBuild as al, type AppResponse as am, type DeployParams as an, type UpgradeParams as ao, assertValidFilePath as ap, createClients as aq, validateDeployParams as ar, validateFilePath as as, validateImagePath as at, validateResourceUsageMonitoring as au, validateUpgradeParams as av, type SiweMessageParams as b, type AppInfoResponse as c, type AppMetrics as d, type AppProfileInfo as e, type BillingApiClientOptions as f, type BillingApiConfig as g, type BillingLoginRequest as h, type BillingLoginResult as i, BillingSessionError as j, type BillingSessionInfo as k, type CreateAppParams as l, type ExecuteBatchOptions as m, type Execution as n, type LoginRequest as o, type LoginResult as p, type LogsParams as q, type SiweMessageResult as r, type UserApiClientOptions as s, addHexPrefix as t, assertValidImageReference as u, assertValidPrivateKey as v, checkERC7702Delegation as w, createSiweMessage as x, estimateBatchGas as y, executeBatch as z };
996
+ export { loginToComputeApi as $, type AppInfo as A, BillingApiClient as B, type ComputeApiConfig as C, extractAppNameFromImage as D, type EstimateBatchGasOptions as E, generateNewPrivateKey as F, type GeneratedKey as G, generateNonce as H, getAvailableEnvironments as I, getBillingApiSession as J, getBillingEnvironmentConfig as K, type LogVisibility as L, getBuildType as M, getChainFromID as N, getComputeApiSession as O, getEnvironmentConfig as P, isBillingSessionValid as Q, isEnvironmentAvailable as R, type SessionInfo as S, isMainnet as T, UserApiClient as U, isSessionValid as V, isSiweMessageExpired as W, isSiweMessageNotYetValid as X, isSubscriptionActive as Y, loginToBillingApi as Z, loginToBothApis as _, SessionError as a, logoutFromBillingApi as a0, logoutFromBothApis as a1, logoutFromComputeApi as a2, parseSiweMessage as a3, sanitizeString as a4, sanitizeURL as a5, sanitizeXURL as a6, stripHexPrefix as a7, validateAppID as a8, validateAppName as a9, validateCreateAppParams as aa, validateDescription as ab, validateImageReference as ac, validateInstanceTypeSKU as ad, validateLogVisibility as ae, validateLogsParams as af, validatePrivateKeyFormat as ag, validateURL as ah, validateXURL as ai, type ResourceUsageMonitoring as aj, type AppRelease as ak, type AppReleaseBuild as al, type AppResponse as am, BASE_SEPOLIA_CHAIN_ID as an, type DeployParams as ao, type UpgradeParams as ap, assertValidFilePath as aq, createClients as ar, validateDeployParams as as, validateFilePath as at, validateImagePath as au, validateResourceUsageMonitoring as av, validateUpgradeParams as aw, type SiweMessageParams as b, type AppInfoResponse as c, type AppMetrics as d, type AppProfileInfo as e, type BillingApiClientOptions as f, type BillingApiConfig as g, type BillingLoginRequest as h, type BillingLoginResult as i, BillingSessionError as j, type BillingSessionInfo as k, type CreateAppParams as l, type ExecuteBatchOptions as m, type Execution as n, type LoginRequest as o, type LoginResult as p, type LogsParams as q, type SiweMessageResult as r, type UserApiClientOptions as s, addHexPrefix as t, assertValidImageReference as u, assertValidPrivateKey as v, checkERC7702Delegation as w, createSiweMessage as x, estimateBatchGas as y, executeBatch as z };
@@ -616,6 +616,8 @@ interface EnvironmentConfig {
616
616
  defaultRPCURL: string;
617
617
  billingRPCURL?: string;
618
618
  usdcCreditsAddress?: Address;
619
+ baseUsdcCreditsAddress?: Address;
620
+ baseRPCURL?: string;
619
621
  }
620
622
  interface Release {
621
623
  rmsRelease: {
@@ -749,6 +751,22 @@ interface SubscriptionOpts {
749
751
  /** URL to redirect to if checkout is canceled */
750
752
  cancelUrl?: string;
751
753
  }
754
+ interface PaymentMethod {
755
+ id: string;
756
+ stripePaymentMethodId: string;
757
+ brand: string;
758
+ last4: string;
759
+ createdAt: string;
760
+ }
761
+ interface PaymentMethodsResponse {
762
+ paymentMethods: PaymentMethod[];
763
+ }
764
+ interface CreditPurchaseResponse {
765
+ purchaseId?: string;
766
+ checkoutSessionId?: string;
767
+ checkoutUrl?: string;
768
+ amountCents: string;
769
+ }
752
770
  interface BillingEnvironmentConfig {
753
771
  billingApiServerURL: string;
754
772
  }
@@ -776,4 +794,4 @@ interface SequentialDeployResult {
776
794
  };
777
795
  }
778
796
 
779
- export { type SendTransactionOptions as $, type AppId as A, type BatchedDeployResult as B, type CalculateAppIDOptions as C, type DeployAppOptions as D, type EnvironmentConfig as E, type Logger as F, type GasEstimate as G, type PaymentIssueResponse as H, type ImageDigestResult as I, type PrepareDeployBatchOptions as J, type PrepareDeployFromVerifiableBuildOpts as K, type LifecycleOpts as L, type PrepareDeployOpts as M, type NoActiveSubscriptionResponse as N, type PrepareUpgradeBatchOptions as O, type ParsedEnvironment as P, type PrepareUpgradeFromVerifiableBuildOpts as Q, type PrepareUpgradeOpts as R, type PreparedDeploy as S, type PreparedDeployBatch as T, type PreparedDeployData as U, type PreparedUpgrade as V, type PreparedUpgradeBatch as W, type PreparedUpgradeData as X, type ProductID as Y, type ProductSubscriptionResponse as Z, type Release as _, type AlreadyActiveResponse as a, type SequentialDeployResult as a0, type SubscribeResponse as a1, type SubscriptionLineItem as a2, type SubscriptionOpts as a3, type SubscriptionStatus as a4, type SuspendOptions as a5, type UndelegateOptions as a6, type UpgradeAppOptions as a7, type UpgradeAppOpts as a8, calculateAppID as a9, getBlockTimestamps as aA, deployApp as aa, estimateTransactionGas as ab, executeDeployBatch as ac, executeDeployBatched as ad, executeDeploySequential as ae, executeUpgradeBatch as af, formatETH as ag, getActiveAppCount as ah, getAllAppsByDeveloper as ai, getAppsByBillingAccount as aj, getAppsByCreator as ak, getAppsByDeveloper as al, getBillingType as am, getMaxActiveAppsPerUser as an, isDelegated as ao, type logVisibility as ap, noopLogger as aq, prepareDeployBatch as ar, prepareUpgradeBatch as as, sendAndWaitForTransaction as at, supportsEIP5792 as au, supportsEIP7702 as av, suspend as aw, undelegate as ax, upgradeApp as ay, getAppLatestReleaseBlockNumbers 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 DeployAppOpts as m, type DeployOptions as n, type DeployProgressCallback as o, type DeployResult as p, type DeployStep as q, type DockerImageConfig as r, type EstimateGasOptions as s, type ExecuteDeployBatchedOptions as t, type ExecuteDeployResult as u, type ExecuteDeploySequentialOptions as v, type ExecuteUpgradeResult as w, type GasOpts as x, type GetSubscriptionOptions as y, type IsDelegatedOptions as z };
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 };
@@ -616,6 +616,8 @@ interface EnvironmentConfig {
616
616
  defaultRPCURL: string;
617
617
  billingRPCURL?: string;
618
618
  usdcCreditsAddress?: Address;
619
+ baseUsdcCreditsAddress?: Address;
620
+ baseRPCURL?: string;
619
621
  }
620
622
  interface Release {
621
623
  rmsRelease: {
@@ -749,6 +751,22 @@ interface SubscriptionOpts {
749
751
  /** URL to redirect to if checkout is canceled */
750
752
  cancelUrl?: string;
751
753
  }
754
+ interface PaymentMethod {
755
+ id: string;
756
+ stripePaymentMethodId: string;
757
+ brand: string;
758
+ last4: string;
759
+ createdAt: string;
760
+ }
761
+ interface PaymentMethodsResponse {
762
+ paymentMethods: PaymentMethod[];
763
+ }
764
+ interface CreditPurchaseResponse {
765
+ purchaseId?: string;
766
+ checkoutSessionId?: string;
767
+ checkoutUrl?: string;
768
+ amountCents: string;
769
+ }
752
770
  interface BillingEnvironmentConfig {
753
771
  billingApiServerURL: string;
754
772
  }
@@ -776,4 +794,4 @@ interface SequentialDeployResult {
776
794
  };
777
795
  }
778
796
 
779
- export { type SendTransactionOptions as $, type AppId as A, type BatchedDeployResult as B, type CalculateAppIDOptions as C, type DeployAppOptions as D, type EnvironmentConfig as E, type Logger as F, type GasEstimate as G, type PaymentIssueResponse as H, type ImageDigestResult as I, type PrepareDeployBatchOptions as J, type PrepareDeployFromVerifiableBuildOpts as K, type LifecycleOpts as L, type PrepareDeployOpts as M, type NoActiveSubscriptionResponse as N, type PrepareUpgradeBatchOptions as O, type ParsedEnvironment as P, type PrepareUpgradeFromVerifiableBuildOpts as Q, type PrepareUpgradeOpts as R, type PreparedDeploy as S, type PreparedDeployBatch as T, type PreparedDeployData as U, type PreparedUpgrade as V, type PreparedUpgradeBatch as W, type PreparedUpgradeData as X, type ProductID as Y, type ProductSubscriptionResponse as Z, type Release as _, type AlreadyActiveResponse as a, type SequentialDeployResult as a0, type SubscribeResponse as a1, type SubscriptionLineItem as a2, type SubscriptionOpts as a3, type SubscriptionStatus as a4, type SuspendOptions as a5, type UndelegateOptions as a6, type UpgradeAppOptions as a7, type UpgradeAppOpts as a8, calculateAppID as a9, getBlockTimestamps as aA, deployApp as aa, estimateTransactionGas as ab, executeDeployBatch as ac, executeDeployBatched as ad, executeDeploySequential as ae, executeUpgradeBatch as af, formatETH as ag, getActiveAppCount as ah, getAllAppsByDeveloper as ai, getAppsByBillingAccount as aj, getAppsByCreator as ak, getAppsByDeveloper as al, getBillingType as am, getMaxActiveAppsPerUser as an, isDelegated as ao, type logVisibility as ap, noopLogger as aq, prepareDeployBatch as ar, prepareUpgradeBatch as as, sendAndWaitForTransaction as at, supportsEIP5792 as au, supportsEIP7702 as av, suspend as aw, undelegate as ax, upgradeApp as ay, getAppLatestReleaseBlockNumbers 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 DeployAppOpts as m, type DeployOptions as n, type DeployProgressCallback as o, type DeployResult as p, type DeployStep as q, type DockerImageConfig as r, type EstimateGasOptions as s, type ExecuteDeployBatchedOptions as t, type ExecuteDeployResult as u, type ExecuteDeploySequentialOptions as v, type ExecuteUpgradeResult as w, type GasOpts as x, type GetSubscriptionOptions as y, type IsDelegatedOptions as z };
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 };
package/dist/index.cjs CHANGED
@@ -164,6 +164,7 @@ var index_exports = {};
164
164
  __export(index_exports, {
165
165
  AttestClient: () => AttestClient,
166
166
  AuthRequiredError: () => AuthRequiredError,
167
+ BASE_SEPOLIA_CHAIN_ID: () => BASE_SEPOLIA_CHAIN_ID,
167
168
  BUILD_STATUS: () => BUILD_STATUS,
168
169
  BadRequestError: () => BadRequestError,
169
170
  BillingApiClient: () => BillingApiClient,
@@ -292,7 +293,7 @@ var import_util = require("util");
292
293
 
293
294
  // src/client/common/constants.ts
294
295
  var import_chains = require("viem/chains");
295
- var SUPPORTED_CHAINS = [import_chains.mainnet, import_chains.sepolia];
296
+ var SUPPORTED_CHAINS = [import_chains.mainnet, import_chains.sepolia, import_chains.baseSepolia];
296
297
  var DOCKER_PLATFORM = "linux/amd64";
297
298
  var REGISTRY_PROPAGATION_WAIT_SECONDS = 3;
298
299
  var LAYERED_DOCKERFILE_NAME = "Dockerfile.eigencompute";
@@ -4986,7 +4987,7 @@ var CanViewAppLogsPermission = "0x2fd3f2fe";
4986
4987
  var CanViewSensitiveAppInfoPermission = "0x0e67b22f";
4987
4988
  var CanUpdateAppProfilePermission = "0x036fef61";
4988
4989
  function getDefaultClientId() {
4989
- const version = true ? "1.0.0-dev.2" : "0.0.0";
4990
+ const version = true ? "1.0.0-dev.4" : "0.0.0";
4990
4991
  return `ecloud-sdk/v${version}`;
4991
4992
  }
4992
4993
  var UserApiClient = class {
@@ -5745,6 +5746,7 @@ function validateLogsParams(params) {
5745
5746
  // src/client/common/config/environment.ts
5746
5747
  var SEPOLIA_CHAIN_ID = 11155111;
5747
5748
  var MAINNET_CHAIN_ID = 1;
5749
+ var BASE_SEPOLIA_CHAIN_ID = 84532;
5748
5750
  var CommonAddresses = {
5749
5751
  ERC7702Delegator: "0x63c0c19a282a1b52b07dd5a65b58948a07dae32b"
5750
5752
  };
@@ -5774,7 +5776,9 @@ var ENVIRONMENTS = {
5774
5776
  kmsServerURL: "http://10.128.0.57:8080",
5775
5777
  userApiServerURL: "https://userapi-compute-sepolia-dev.eigencloud.xyz",
5776
5778
  defaultRPCURL: "https://ethereum-sepolia-rpc.publicnode.com",
5777
- usdcCreditsAddress: "0xbdA3897c3A428763B59015C64AB766c288C97376"
5779
+ usdcCreditsAddress: "0xbdA3897c3A428763B59015C64AB766c288C97376",
5780
+ baseUsdcCreditsAddress: "0x7673a47463F80c6a3553Db9E54c8cDcd5313d0ac",
5781
+ baseRPCURL: "https://base-sepolia-rpc.publicnode.com"
5778
5782
  },
5779
5783
  sepolia: {
5780
5784
  name: "sepolia",
@@ -5786,7 +5790,9 @@ var ENVIRONMENTS = {
5786
5790
  userApiServerURL: "https://userapi-compute-sepolia-prod.eigencloud.xyz",
5787
5791
  defaultRPCURL: "https://ethereum-sepolia-rpc.publicnode.com",
5788
5792
  billingRPCURL: "https://ethereum-rpc.publicnode.com",
5789
- usdcCreditsAddress: "0xed9c88640ca9149Bd9f7ee6620074af10F2E145d"
5793
+ usdcCreditsAddress: "0xed9c88640ca9149Bd9f7ee6620074af10F2E145d",
5794
+ baseUsdcCreditsAddress: "0x7673a47463F80c6a3553Db9E54c8cDcd5313d0ac",
5795
+ baseRPCURL: "https://base-sepolia-rpc.publicnode.com"
5790
5796
  },
5791
5797
  "mainnet-alpha": {
5792
5798
  name: "mainnet-alpha",
@@ -5831,7 +5837,13 @@ function getEnvironmentConfig(environment, chainID) {
5831
5837
  return {
5832
5838
  ...env,
5833
5839
  chainID: BigInt(resolvedChainID),
5834
- ...apiUrlOverride ? { userApiServerURL: apiUrlOverride } : {}
5840
+ ...apiUrlOverride ? { userApiServerURL: apiUrlOverride } : {},
5841
+ ...process.env.ECLOUD_USER_API_URL && {
5842
+ userApiServerURL: process.env.ECLOUD_USER_API_URL
5843
+ },
5844
+ ...process.env.ECLOUD_RPC_URL && {
5845
+ defaultRPCURL: process.env.ECLOUD_RPC_URL
5846
+ }
5835
5847
  };
5836
5848
  }
5837
5849
  function getBillingEnvironmentConfig(build) {
@@ -5843,7 +5855,12 @@ function getBillingEnvironmentConfig(build) {
5843
5855
  if (apiUrlOverride) {
5844
5856
  return { billingApiServerURL: apiUrlOverride };
5845
5857
  }
5846
- return config;
5858
+ return {
5859
+ ...config,
5860
+ ...process.env.ECLOUD_BILLING_API_URL && {
5861
+ billingApiServerURL: process.env.ECLOUD_BILLING_API_URL
5862
+ }
5863
+ };
5847
5864
  }
5848
5865
  function getBuildType() {
5849
5866
  const buildTimeType = true ? "dev"?.toLowerCase() : void 0;
@@ -6148,6 +6165,20 @@ var BillingApiClient = class {
6148
6165
  const endpoint = `${this.config.billingApiServerURL}/products/${productId}/subscription`;
6149
6166
  await this.makeAuthenticatedRequest(endpoint, "DELETE", productId);
6150
6167
  }
6168
+ async getPaymentMethods() {
6169
+ const endpoint = `${this.config.billingApiServerURL}/v1/payment-methods`;
6170
+ const resp = await this.makeAuthenticatedRequest(endpoint, "GET", "compute");
6171
+ return resp.json();
6172
+ }
6173
+ async purchaseCredits(amountCents, paymentMethodId) {
6174
+ const endpoint = `${this.config.billingApiServerURL}/v1/credits/purchase`;
6175
+ const body = { amountCents };
6176
+ if (paymentMethodId) {
6177
+ body.paymentMethodId = paymentMethodId;
6178
+ }
6179
+ const resp = await this.makeAuthenticatedRequest(endpoint, "POST", "compute", body);
6180
+ return resp.json();
6181
+ }
6151
6182
  // ==========================================================================
6152
6183
  // Internal Methods
6153
6184
  // ==========================================================================
@@ -6157,10 +6188,22 @@ var BillingApiClient = class {
6157
6188
  * Uses session auth if useSession is true, otherwise uses EIP-712 signature auth.
6158
6189
  */
6159
6190
  async makeAuthenticatedRequest(url, method, productId, body) {
6160
- if (this.useSession) {
6161
- return this.makeSessionAuthenticatedRequest(url, method, body);
6191
+ if (this.options.verbose) {
6192
+ console.debug(`[BillingAPI] ${method} ${url}`);
6193
+ if (body) {
6194
+ console.debug(`[BillingAPI] Payload:`, JSON.stringify(body, null, 2));
6195
+ }
6196
+ }
6197
+ const resp = this.useSession ? await this.makeSessionAuthenticatedRequest(url, method, body) : await this.makeSignatureAuthenticatedRequest(url, method, productId, body);
6198
+ if (this.options.verbose) {
6199
+ const data = await resp.json();
6200
+ console.debug(`[BillingAPI] Response:`, JSON.stringify(data, null, 2));
6201
+ return {
6202
+ json: async () => data,
6203
+ text: async () => JSON.stringify(data)
6204
+ };
6162
6205
  }
6163
- return this.makeSignatureAuthenticatedRequest(url, method, productId, body);
6206
+ return resp;
6164
6207
  }
6165
6208
  /**
6166
6209
  * Make a request using session-based authentication (cookies)
@@ -8342,44 +8385,78 @@ var ERC20_default = [
8342
8385
 
8343
8386
  // src/client/modules/billing/index.ts
8344
8387
  function createBillingModule(config) {
8345
- const { verbose = false, skipTelemetry = false, walletClient, publicClient, environment } = config;
8388
+ const { verbose = false, skipTelemetry = false, walletClient, publicClient, environment, privateKey } = config;
8346
8389
  if (!walletClient.account) {
8347
8390
  throw new Error("WalletClient must have an account attached");
8348
8391
  }
8349
8392
  const address = walletClient.account.address;
8350
8393
  const logger = getLogger(verbose);
8351
8394
  const billingEnvConfig = getBillingEnvironmentConfig(getBuildType());
8352
- const billingApi = new BillingApiClient(billingEnvConfig, walletClient);
8395
+ const billingApi = new BillingApiClient(billingEnvConfig, walletClient, { verbose });
8353
8396
  const environmentConfig = getEnvironmentConfig(environment);
8354
- const usdcCreditsAddress = environmentConfig.usdcCreditsAddress;
8355
- if (!usdcCreditsAddress) {
8397
+ if (!environmentConfig.usdcCreditsAddress) {
8356
8398
  throw new Error(`USDCCredits contract address not configured for environment "${environment}"`);
8357
8399
  }
8400
+ const usdcCreditsAddress = environmentConfig.usdcCreditsAddress;
8401
+ const baseUsdcCreditsAddress = environmentConfig.baseUsdcCreditsAddress;
8402
+ const baseRPCURL = environmentConfig.baseRPCURL;
8403
+ function resolveChainConfig(chain) {
8404
+ if (chain === "base") {
8405
+ if (!baseUsdcCreditsAddress || !baseRPCURL) {
8406
+ throw new Error(`Base chain not configured for environment "${environment}"`);
8407
+ }
8408
+ if (!privateKey) {
8409
+ throw new Error("Private key required for Base chain transactions");
8410
+ }
8411
+ const baseClients = createClients({
8412
+ privateKey,
8413
+ rpcUrl: baseRPCURL,
8414
+ chainId: BigInt(BASE_SEPOLIA_CHAIN_ID)
8415
+ });
8416
+ return {
8417
+ pub: baseClients.publicClient,
8418
+ wallet: baseClients.walletClient,
8419
+ creditsAddress: baseUsdcCreditsAddress,
8420
+ envConfig: {
8421
+ ...environmentConfig,
8422
+ chainID: BigInt(BASE_SEPOLIA_CHAIN_ID),
8423
+ defaultRPCURL: baseRPCURL
8424
+ }
8425
+ };
8426
+ }
8427
+ return {
8428
+ pub: publicClient,
8429
+ wallet: walletClient,
8430
+ creditsAddress: usdcCreditsAddress,
8431
+ envConfig: environmentConfig
8432
+ };
8433
+ }
8358
8434
  const module2 = {
8359
8435
  address,
8360
- async getTopUpInfo() {
8361
- const usdcAddress = await publicClient.readContract({
8362
- address: usdcCreditsAddress,
8436
+ async getTopUpInfo(opts) {
8437
+ const { pub, creditsAddress } = resolveChainConfig(opts?.chain);
8438
+ const usdcAddress = await pub.readContract({
8439
+ address: creditsAddress,
8363
8440
  abi: USDCCredits_default,
8364
8441
  functionName: "usdc"
8365
8442
  });
8366
8443
  const [minimumPurchase, usdcBalance, currentAllowance] = await Promise.all([
8367
- publicClient.readContract({
8368
- address: usdcCreditsAddress,
8444
+ pub.readContract({
8445
+ address: creditsAddress,
8369
8446
  abi: USDCCredits_default,
8370
8447
  functionName: "minimumPurchase"
8371
8448
  }),
8372
- publicClient.readContract({
8449
+ pub.readContract({
8373
8450
  address: usdcAddress,
8374
8451
  abi: ERC20_default,
8375
8452
  functionName: "balanceOf",
8376
8453
  args: [address]
8377
8454
  }),
8378
- publicClient.readContract({
8455
+ pub.readContract({
8379
8456
  address: usdcAddress,
8380
8457
  abi: ERC20_default,
8381
8458
  functionName: "allowance",
8382
- args: [address, usdcCreditsAddress]
8459
+ args: [address, creditsAddress]
8383
8460
  })
8384
8461
  ]);
8385
8462
  return { usdcAddress, minimumPurchase, usdcBalance, currentAllowance };
@@ -8389,11 +8466,12 @@ function createBillingModule(config) {
8389
8466
  {
8390
8467
  functionName: "topUp",
8391
8468
  skipTelemetry,
8392
- properties: { amount: opts.amount.toString() }
8469
+ properties: { amount: opts.amount.toString(), chain: opts.chain || "ethereum" }
8393
8470
  },
8394
8471
  async () => {
8395
8472
  const targetAccount = opts.account ?? address;
8396
- const { usdcAddress, currentAllowance } = await module2.getTopUpInfo();
8473
+ const { pub, wallet, creditsAddress, envConfig } = resolveChainConfig(opts.chain);
8474
+ const { usdcAddress, currentAllowance } = await module2.getTopUpInfo({ chain: opts.chain });
8397
8475
  const executions = [];
8398
8476
  if (currentAllowance < opts.amount) {
8399
8477
  executions.push({
@@ -8402,12 +8480,12 @@ function createBillingModule(config) {
8402
8480
  callData: (0, import_viem7.encodeFunctionData)({
8403
8481
  abi: ERC20_default,
8404
8482
  functionName: "approve",
8405
- args: [usdcCreditsAddress, opts.amount]
8483
+ args: [creditsAddress, opts.amount]
8406
8484
  })
8407
8485
  });
8408
8486
  }
8409
8487
  executions.push({
8410
- target: usdcCreditsAddress,
8488
+ target: creditsAddress,
8411
8489
  value: 0n,
8412
8490
  callData: (0, import_viem7.encodeFunctionData)({
8413
8491
  abi: USDCCredits_default,
@@ -8417,9 +8495,9 @@ function createBillingModule(config) {
8417
8495
  });
8418
8496
  const txHash = await executeBatch(
8419
8497
  {
8420
- walletClient,
8421
- publicClient,
8422
- environmentConfig,
8498
+ walletClient: wallet,
8499
+ publicClient: pub,
8500
+ environmentConfig: envConfig,
8423
8501
  executions,
8424
8502
  pendingMessage: "Submitting credit purchase..."
8425
8503
  },
@@ -8513,6 +8591,15 @@ function createBillingModule(config) {
8513
8591
  };
8514
8592
  }
8515
8593
  );
8594
+ },
8595
+ async getPaymentMethods() {
8596
+ return billingApi.getPaymentMethods();
8597
+ },
8598
+ async purchaseCredits(amountCents, paymentMethodId) {
8599
+ return billingApi.purchaseCredits(amountCents, paymentMethodId);
8600
+ },
8601
+ hasBaseSupport() {
8602
+ return !!baseUsdcCreditsAddress && !!baseRPCURL;
8516
8603
  }
8517
8604
  };
8518
8605
  return module2;
@@ -9486,6 +9573,7 @@ var JwtProvider = class {
9486
9573
  0 && (module.exports = {
9487
9574
  AttestClient,
9488
9575
  AuthRequiredError,
9576
+ BASE_SEPOLIA_CHAIN_ID,
9489
9577
  BUILD_STATUS,
9490
9578
  BadRequestError,
9491
9579
  BillingApiClient,