@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,4 +1,4 @@
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-BbH7ZCIu.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-Bac4HjC0.cjs';
2
2
  import { Address, Hex, WalletClient, PublicClient, SignAuthorizationReturnType, Chain } from 'viem';
3
3
 
4
4
  /**
@@ -1,4 +1,4 @@
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-BbH7ZCIu.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-Bac4HjC0.js';
2
2
  import { Address, Hex, WalletClient, PublicClient, SignAuthorizationReturnType, Chain } from 'viem';
3
3
 
4
4
  /**
@@ -752,6 +752,8 @@ interface SubscriptionOpts {
752
752
  interface PaymentMethod {
753
753
  id: string;
754
754
  stripePaymentMethodId: string;
755
+ brand: string;
756
+ last4: string;
755
757
  createdAt: string;
756
758
  }
757
759
  interface PaymentMethodsResponse {
@@ -752,6 +752,8 @@ interface SubscriptionOpts {
752
752
  interface PaymentMethod {
753
753
  id: string;
754
754
  stripePaymentMethodId: string;
755
+ brand: string;
756
+ last4: string;
755
757
  createdAt: string;
756
758
  }
757
759
  interface PaymentMethodsResponse {
package/dist/index.cjs CHANGED
@@ -4986,7 +4986,7 @@ var CanViewAppLogsPermission = "0x2fd3f2fe";
4986
4986
  var CanViewSensitiveAppInfoPermission = "0x0e67b22f";
4987
4987
  var CanUpdateAppProfilePermission = "0x036fef61";
4988
4988
  function getDefaultClientId() {
4989
- const version = true ? "1.0.0-dev.1" : "0.0.0";
4989
+ const version = true ? "1.0.0-dev.3" : "0.0.0";
4990
4990
  return `ecloud-sdk/v${version}`;
4991
4991
  }
4992
4992
  var UserApiClient = class {
@@ -5804,6 +5804,12 @@ var CHAIN_ID_TO_ENVIRONMENT = {
5804
5804
  [SEPOLIA_CHAIN_ID.toString()]: "sepolia",
5805
5805
  [MAINNET_CHAIN_ID.toString()]: "mainnet-alpha"
5806
5806
  };
5807
+ function getApiUrlOverride() {
5808
+ const raw = process.env.ECLOUD_API_URL;
5809
+ if (!raw) return void 0;
5810
+ const trimmed = raw.trim().replace(/\/+$/, "");
5811
+ return trimmed.length > 0 ? trimmed : void 0;
5812
+ }
5807
5813
  function getEnvironmentConfig(environment, chainID) {
5808
5814
  const env = ENVIRONMENTS[environment];
5809
5815
  if (!env) {
@@ -5821,9 +5827,11 @@ function getEnvironmentConfig(environment, chainID) {
5821
5827
  }
5822
5828
  }
5823
5829
  const resolvedChainID = chainID || (environment === "sepolia" || environment === "sepolia-dev" ? SEPOLIA_CHAIN_ID : MAINNET_CHAIN_ID);
5830
+ const apiUrlOverride = getApiUrlOverride();
5824
5831
  return {
5825
5832
  ...env,
5826
5833
  chainID: BigInt(resolvedChainID),
5834
+ ...apiUrlOverride ? { userApiServerURL: apiUrlOverride } : {},
5827
5835
  ...process.env.ECLOUD_USER_API_URL && {
5828
5836
  userApiServerURL: process.env.ECLOUD_USER_API_URL
5829
5837
  },
@@ -5837,6 +5845,10 @@ function getBillingEnvironmentConfig(build) {
5837
5845
  if (!config) {
5838
5846
  throw new Error(`Unknown billing environment: ${build}`);
5839
5847
  }
5848
+ const apiUrlOverride = getApiUrlOverride();
5849
+ if (apiUrlOverride) {
5850
+ return { billingApiServerURL: apiUrlOverride };
5851
+ }
5840
5852
  return {
5841
5853
  ...config,
5842
5854
  ...process.env.ECLOUD_BILLING_API_URL && {
@@ -6172,6 +6184,9 @@ var BillingApiClient = class {
6172
6184
  async makeAuthenticatedRequest(url, method, productId, body) {
6173
6185
  if (this.options.verbose) {
6174
6186
  console.debug(`[BillingAPI] ${method} ${url}`);
6187
+ if (body) {
6188
+ console.debug(`[BillingAPI] Payload:`, JSON.stringify(body, null, 2));
6189
+ }
6175
6190
  }
6176
6191
  const resp = this.useSession ? await this.makeSessionAuthenticatedRequest(url, method, body) : await this.makeSignatureAuthenticatedRequest(url, method, productId, body);
6177
6192
  if (this.options.verbose) {