@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.
@@ -1,5 +1,5 @@
1
1
  import { Address, Hex, WalletClient, PublicClient } from 'viem';
2
- import { a6 as SubscriptionOpts, a4 as SubscribeResponse, a0 as ProductSubscriptionResponse, g as CancelResponse, M as PaymentMethodsResponse, m as CreditPurchaseResponse } from './index-BbH7ZCIu.cjs';
2
+ import { a6 as SubscriptionOpts, a4 as SubscribeResponse, a0 as ProductSubscriptionResponse, g as CancelResponse, M as PaymentMethodsResponse, m as CreditPurchaseResponse } from './index-Bac4HjC0.cjs';
3
3
 
4
4
  /**
5
5
  * Main Billing namespace entry point
package/dist/billing.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Address, Hex, WalletClient, PublicClient } from 'viem';
2
- import { a6 as SubscriptionOpts, a4 as SubscribeResponse, a0 as ProductSubscriptionResponse, g as CancelResponse, M as PaymentMethodsResponse, m as CreditPurchaseResponse } from './index-BbH7ZCIu.js';
2
+ import { a6 as SubscriptionOpts, a4 as SubscribeResponse, a0 as ProductSubscriptionResponse, g as CancelResponse, M as PaymentMethodsResponse, m as CreditPurchaseResponse } from './index-Bac4HjC0.js';
3
3
 
4
4
  /**
5
5
  * Main Billing namespace entry point
package/dist/billing.js CHANGED
@@ -308,6 +308,9 @@ var BillingApiClient = class {
308
308
  async makeAuthenticatedRequest(url, method, productId, body) {
309
309
  if (this.options.verbose) {
310
310
  console.debug(`[BillingAPI] ${method} ${url}`);
311
+ if (body) {
312
+ console.debug(`[BillingAPI] Payload:`, JSON.stringify(body, null, 2));
313
+ }
311
314
  }
312
315
  const resp = this.useSession ? await this.makeSessionAuthenticatedRequest(url, method, body) : await this.makeSignatureAuthenticatedRequest(url, method, productId, body);
313
316
  if (this.options.verbose) {
@@ -485,6 +488,12 @@ var CHAIN_ID_TO_ENVIRONMENT = {
485
488
  [SEPOLIA_CHAIN_ID.toString()]: "sepolia",
486
489
  [MAINNET_CHAIN_ID.toString()]: "mainnet-alpha"
487
490
  };
491
+ function getApiUrlOverride() {
492
+ const raw = process.env.ECLOUD_API_URL;
493
+ if (!raw) return void 0;
494
+ const trimmed = raw.trim().replace(/\/+$/, "");
495
+ return trimmed.length > 0 ? trimmed : void 0;
496
+ }
488
497
  function getEnvironmentConfig(environment, chainID) {
489
498
  const env = ENVIRONMENTS[environment];
490
499
  if (!env) {
@@ -502,9 +511,11 @@ function getEnvironmentConfig(environment, chainID) {
502
511
  }
503
512
  }
504
513
  const resolvedChainID = chainID || (environment === "sepolia" || environment === "sepolia-dev" ? SEPOLIA_CHAIN_ID : MAINNET_CHAIN_ID);
514
+ const apiUrlOverride = getApiUrlOverride();
505
515
  return {
506
516
  ...env,
507
517
  chainID: BigInt(resolvedChainID),
518
+ ...apiUrlOverride ? { userApiServerURL: apiUrlOverride } : {},
508
519
  ...process.env.ECLOUD_USER_API_URL && {
509
520
  userApiServerURL: process.env.ECLOUD_USER_API_URL
510
521
  },
@@ -518,6 +529,10 @@ function getBillingEnvironmentConfig(build) {
518
529
  if (!config) {
519
530
  throw new Error(`Unknown billing environment: ${build}`);
520
531
  }
532
+ const apiUrlOverride = getApiUrlOverride();
533
+ if (apiUrlOverride) {
534
+ return { billingApiServerURL: apiUrlOverride };
535
+ }
521
536
  return {
522
537
  ...config,
523
538
  ...process.env.ECLOUD_BILLING_API_URL && {