@layr-labs/ecloud-sdk 1.0.0-dev.1 → 1.0.0-dev.3

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/VERSION CHANGED
@@ -1,2 +1,2 @@
1
- version=1.0.0-dev.1
2
- commit=2f1f9686f28371adcd7521bfd335c15cd928f61d
1
+ version=1.0.0-dev.3
2
+ commit=6bdd35bcdef2b55443165112b1eb91ff4cc06e27
package/dist/billing.cjs CHANGED
@@ -342,6 +342,9 @@ var BillingApiClient = class {
342
342
  async makeAuthenticatedRequest(url, method, productId, body) {
343
343
  if (this.options.verbose) {
344
344
  console.debug(`[BillingAPI] ${method} ${url}`);
345
+ if (body) {
346
+ console.debug(`[BillingAPI] Payload:`, JSON.stringify(body, null, 2));
347
+ }
345
348
  }
346
349
  const resp = this.useSession ? await this.makeSessionAuthenticatedRequest(url, method, body) : await this.makeSignatureAuthenticatedRequest(url, method, productId, body);
347
350
  if (this.options.verbose) {
@@ -519,6 +522,12 @@ var CHAIN_ID_TO_ENVIRONMENT = {
519
522
  [SEPOLIA_CHAIN_ID.toString()]: "sepolia",
520
523
  [MAINNET_CHAIN_ID.toString()]: "mainnet-alpha"
521
524
  };
525
+ function getApiUrlOverride() {
526
+ const raw = process.env.ECLOUD_API_URL;
527
+ if (!raw) return void 0;
528
+ const trimmed = raw.trim().replace(/\/+$/, "");
529
+ return trimmed.length > 0 ? trimmed : void 0;
530
+ }
522
531
  function getEnvironmentConfig(environment, chainID) {
523
532
  const env = ENVIRONMENTS[environment];
524
533
  if (!env) {
@@ -536,9 +545,11 @@ function getEnvironmentConfig(environment, chainID) {
536
545
  }
537
546
  }
538
547
  const resolvedChainID = chainID || (environment === "sepolia" || environment === "sepolia-dev" ? SEPOLIA_CHAIN_ID : MAINNET_CHAIN_ID);
548
+ const apiUrlOverride = getApiUrlOverride();
539
549
  return {
540
550
  ...env,
541
551
  chainID: BigInt(resolvedChainID),
552
+ ...apiUrlOverride ? { userApiServerURL: apiUrlOverride } : {},
542
553
  ...process.env.ECLOUD_USER_API_URL && {
543
554
  userApiServerURL: process.env.ECLOUD_USER_API_URL
544
555
  },
@@ -552,6 +563,10 @@ function getBillingEnvironmentConfig(build) {
552
563
  if (!config) {
553
564
  throw new Error(`Unknown billing environment: ${build}`);
554
565
  }
566
+ const apiUrlOverride = getApiUrlOverride();
567
+ if (apiUrlOverride) {
568
+ return { billingApiServerURL: apiUrlOverride };
569
+ }
555
570
  return {
556
571
  ...config,
557
572
  ...process.env.ECLOUD_BILLING_API_URL && {