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

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/billing.js CHANGED
@@ -462,6 +462,12 @@ var CHAIN_ID_TO_ENVIRONMENT = {
462
462
  [SEPOLIA_CHAIN_ID.toString()]: "sepolia",
463
463
  [MAINNET_CHAIN_ID.toString()]: "mainnet-alpha"
464
464
  };
465
+ function getApiUrlOverride() {
466
+ const raw = process.env.ECLOUD_API_URL;
467
+ if (!raw) return void 0;
468
+ const trimmed = raw.trim().replace(/\/+$/, "");
469
+ return trimmed.length > 0 ? trimmed : void 0;
470
+ }
465
471
  function getEnvironmentConfig(environment, chainID) {
466
472
  const env = ENVIRONMENTS[environment];
467
473
  if (!env) {
@@ -479,9 +485,11 @@ function getEnvironmentConfig(environment, chainID) {
479
485
  }
480
486
  }
481
487
  const resolvedChainID = chainID || (environment === "sepolia" || environment === "sepolia-dev" ? SEPOLIA_CHAIN_ID : MAINNET_CHAIN_ID);
488
+ const apiUrlOverride = getApiUrlOverride();
482
489
  return {
483
490
  ...env,
484
- chainID: BigInt(resolvedChainID)
491
+ chainID: BigInt(resolvedChainID),
492
+ ...apiUrlOverride ? { userApiServerURL: apiUrlOverride } : {}
485
493
  };
486
494
  }
487
495
  function getBillingEnvironmentConfig(build) {
@@ -489,10 +497,14 @@ function getBillingEnvironmentConfig(build) {
489
497
  if (!config) {
490
498
  throw new Error(`Unknown billing environment: ${build}`);
491
499
  }
500
+ const apiUrlOverride = getApiUrlOverride();
501
+ if (apiUrlOverride) {
502
+ return { billingApiServerURL: apiUrlOverride };
503
+ }
492
504
  return config;
493
505
  }
494
506
  function getBuildType() {
495
- const buildTimeType = true ? "prod"?.toLowerCase() : void 0;
507
+ const buildTimeType = true ? "dev"?.toLowerCase() : void 0;
496
508
  const runtimeType = process.env.BUILD_TYPE?.toLowerCase();
497
509
  const buildType = buildTimeType || runtimeType;
498
510
  if (buildType === "dev") {