@layr-labs/ecloud-sdk 1.0.0-dev.3 → 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, 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-Bac4HjC0.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
  */
@@ -992,4 +993,4 @@ declare function addHexPrefix(value: string): Hex;
992
993
  */
993
994
  declare function stripHexPrefix(value: string): string;
994
995
 
995
- 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, 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-Bac4HjC0.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
  */
@@ -992,4 +993,4 @@ declare function addHexPrefix(value: string): Hex;
992
993
  */
993
994
  declare function stripHexPrefix(value: string): string;
994
995
 
995
- 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: {
@@ -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: {
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.3" : "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",
@@ -8379,7 +8385,7 @@ var ERC20_default = [
8379
8385
 
8380
8386
  // src/client/modules/billing/index.ts
8381
8387
  function createBillingModule(config) {
8382
- const { verbose = false, skipTelemetry = false, walletClient, publicClient, environment } = config;
8388
+ const { verbose = false, skipTelemetry = false, walletClient, publicClient, environment, privateKey } = config;
8383
8389
  if (!walletClient.account) {
8384
8390
  throw new Error("WalletClient must have an account attached");
8385
8391
  }
@@ -8388,35 +8394,69 @@ function createBillingModule(config) {
8388
8394
  const billingEnvConfig = getBillingEnvironmentConfig(getBuildType());
8389
8395
  const billingApi = new BillingApiClient(billingEnvConfig, walletClient, { verbose });
8390
8396
  const environmentConfig = getEnvironmentConfig(environment);
8391
- const usdcCreditsAddress = environmentConfig.usdcCreditsAddress;
8392
- if (!usdcCreditsAddress) {
8397
+ if (!environmentConfig.usdcCreditsAddress) {
8393
8398
  throw new Error(`USDCCredits contract address not configured for environment "${environment}"`);
8394
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
+ }
8395
8434
  const module2 = {
8396
8435
  address,
8397
- async getTopUpInfo() {
8398
- const usdcAddress = await publicClient.readContract({
8399
- address: usdcCreditsAddress,
8436
+ async getTopUpInfo(opts) {
8437
+ const { pub, creditsAddress } = resolveChainConfig(opts?.chain);
8438
+ const usdcAddress = await pub.readContract({
8439
+ address: creditsAddress,
8400
8440
  abi: USDCCredits_default,
8401
8441
  functionName: "usdc"
8402
8442
  });
8403
8443
  const [minimumPurchase, usdcBalance, currentAllowance] = await Promise.all([
8404
- publicClient.readContract({
8405
- address: usdcCreditsAddress,
8444
+ pub.readContract({
8445
+ address: creditsAddress,
8406
8446
  abi: USDCCredits_default,
8407
8447
  functionName: "minimumPurchase"
8408
8448
  }),
8409
- publicClient.readContract({
8449
+ pub.readContract({
8410
8450
  address: usdcAddress,
8411
8451
  abi: ERC20_default,
8412
8452
  functionName: "balanceOf",
8413
8453
  args: [address]
8414
8454
  }),
8415
- publicClient.readContract({
8455
+ pub.readContract({
8416
8456
  address: usdcAddress,
8417
8457
  abi: ERC20_default,
8418
8458
  functionName: "allowance",
8419
- args: [address, usdcCreditsAddress]
8459
+ args: [address, creditsAddress]
8420
8460
  })
8421
8461
  ]);
8422
8462
  return { usdcAddress, minimumPurchase, usdcBalance, currentAllowance };
@@ -8426,11 +8466,12 @@ function createBillingModule(config) {
8426
8466
  {
8427
8467
  functionName: "topUp",
8428
8468
  skipTelemetry,
8429
- properties: { amount: opts.amount.toString() }
8469
+ properties: { amount: opts.amount.toString(), chain: opts.chain || "ethereum" }
8430
8470
  },
8431
8471
  async () => {
8432
8472
  const targetAccount = opts.account ?? address;
8433
- 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 });
8434
8475
  const executions = [];
8435
8476
  if (currentAllowance < opts.amount) {
8436
8477
  executions.push({
@@ -8439,12 +8480,12 @@ function createBillingModule(config) {
8439
8480
  callData: (0, import_viem7.encodeFunctionData)({
8440
8481
  abi: ERC20_default,
8441
8482
  functionName: "approve",
8442
- args: [usdcCreditsAddress, opts.amount]
8483
+ args: [creditsAddress, opts.amount]
8443
8484
  })
8444
8485
  });
8445
8486
  }
8446
8487
  executions.push({
8447
- target: usdcCreditsAddress,
8488
+ target: creditsAddress,
8448
8489
  value: 0n,
8449
8490
  callData: (0, import_viem7.encodeFunctionData)({
8450
8491
  abi: USDCCredits_default,
@@ -8454,9 +8495,9 @@ function createBillingModule(config) {
8454
8495
  });
8455
8496
  const txHash = await executeBatch(
8456
8497
  {
8457
- walletClient,
8458
- publicClient,
8459
- environmentConfig,
8498
+ walletClient: wallet,
8499
+ publicClient: pub,
8500
+ environmentConfig: envConfig,
8460
8501
  executions,
8461
8502
  pendingMessage: "Submitting credit purchase..."
8462
8503
  },
@@ -8556,6 +8597,9 @@ function createBillingModule(config) {
8556
8597
  },
8557
8598
  async purchaseCredits(amountCents, paymentMethodId) {
8558
8599
  return billingApi.purchaseCredits(amountCents, paymentMethodId);
8600
+ },
8601
+ hasBaseSupport() {
8602
+ return !!baseUsdcCreditsAddress && !!baseRPCURL;
8559
8603
  }
8560
8604
  };
8561
8605
  return module2;
@@ -9529,6 +9573,7 @@ var JwtProvider = class {
9529
9573
  0 && (module.exports = {
9530
9574
  AttestClient,
9531
9575
  AuthRequiredError,
9576
+ BASE_SEPOLIA_CHAIN_ID,
9532
9577
  BUILD_STATUS,
9533
9578
  BadRequestError,
9534
9579
  BillingApiClient,