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

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.3
2
- commit=6bdd35bcdef2b55443165112b1eb91ff4cc06e27
1
+ version=1.0.0-devep1
2
+ commit=b210c1e7e17be9d0847834901bd986b0a3742456
package/dist/billing.cjs CHANGED
@@ -317,20 +317,6 @@ var BillingApiClient = class {
317
317
  const endpoint = `${this.config.billingApiServerURL}/products/${productId}/subscription`;
318
318
  await this.makeAuthenticatedRequest(endpoint, "DELETE", productId);
319
319
  }
320
- async getPaymentMethods() {
321
- const endpoint = `${this.config.billingApiServerURL}/v1/payment-methods`;
322
- const resp = await this.makeAuthenticatedRequest(endpoint, "GET", "compute");
323
- return resp.json();
324
- }
325
- async purchaseCredits(amountCents, paymentMethodId) {
326
- const endpoint = `${this.config.billingApiServerURL}/v1/credits/purchase`;
327
- const body = { amountCents };
328
- if (paymentMethodId) {
329
- body.paymentMethodId = paymentMethodId;
330
- }
331
- const resp = await this.makeAuthenticatedRequest(endpoint, "POST", "compute", body);
332
- return resp.json();
333
- }
334
320
  // ==========================================================================
335
321
  // Internal Methods
336
322
  // ==========================================================================
@@ -340,22 +326,10 @@ var BillingApiClient = class {
340
326
  * Uses session auth if useSession is true, otherwise uses EIP-712 signature auth.
341
327
  */
342
328
  async makeAuthenticatedRequest(url, method, productId, body) {
343
- if (this.options.verbose) {
344
- console.debug(`[BillingAPI] ${method} ${url}`);
345
- if (body) {
346
- console.debug(`[BillingAPI] Payload:`, JSON.stringify(body, null, 2));
347
- }
348
- }
349
- const resp = this.useSession ? await this.makeSessionAuthenticatedRequest(url, method, body) : await this.makeSignatureAuthenticatedRequest(url, method, productId, body);
350
- if (this.options.verbose) {
351
- const data = await resp.json();
352
- console.debug(`[BillingAPI] Response:`, JSON.stringify(data, null, 2));
353
- return {
354
- json: async () => data,
355
- text: async () => JSON.stringify(data)
356
- };
329
+ if (this.useSession) {
330
+ return this.makeSessionAuthenticatedRequest(url, method, body);
357
331
  }
358
- return resp;
332
+ return this.makeSignatureAuthenticatedRequest(url, method, productId, body);
359
333
  }
360
334
  /**
361
335
  * Make a request using session-based authentication (cookies)
@@ -549,13 +523,7 @@ function getEnvironmentConfig(environment, chainID) {
549
523
  return {
550
524
  ...env,
551
525
  chainID: BigInt(resolvedChainID),
552
- ...apiUrlOverride ? { userApiServerURL: apiUrlOverride } : {},
553
- ...process.env.ECLOUD_USER_API_URL && {
554
- userApiServerURL: process.env.ECLOUD_USER_API_URL
555
- },
556
- ...process.env.ECLOUD_RPC_URL && {
557
- defaultRPCURL: process.env.ECLOUD_RPC_URL
558
- }
526
+ ...apiUrlOverride ? { userApiServerURL: apiUrlOverride } : {}
559
527
  };
560
528
  }
561
529
  function getBillingEnvironmentConfig(build) {
@@ -567,12 +535,7 @@ function getBillingEnvironmentConfig(build) {
567
535
  if (apiUrlOverride) {
568
536
  return { billingApiServerURL: apiUrlOverride };
569
537
  }
570
- return {
571
- ...config,
572
- ...process.env.ECLOUD_BILLING_API_URL && {
573
- billingApiServerURL: process.env.ECLOUD_BILLING_API_URL
574
- }
575
- };
538
+ return config;
576
539
  }
577
540
  function getBuildType() {
578
541
  const buildTimeType = true ? "dev"?.toLowerCase() : void 0;
@@ -2115,7 +2078,7 @@ function createBillingModule(config) {
2115
2078
  const address = walletClient.account.address;
2116
2079
  const logger = getLogger(verbose);
2117
2080
  const billingEnvConfig = getBillingEnvironmentConfig(getBuildType());
2118
- const billingApi = new BillingApiClient(billingEnvConfig, walletClient, { verbose });
2081
+ const billingApi = new BillingApiClient(billingEnvConfig, walletClient);
2119
2082
  const environmentConfig = getEnvironmentConfig(environment);
2120
2083
  const usdcCreditsAddress = environmentConfig.usdcCreditsAddress;
2121
2084
  if (!usdcCreditsAddress) {
@@ -2279,12 +2242,6 @@ function createBillingModule(config) {
2279
2242
  };
2280
2243
  }
2281
2244
  );
2282
- },
2283
- async getPaymentMethods() {
2284
- return billingApi.getPaymentMethods();
2285
- },
2286
- async purchaseCredits(amountCents, paymentMethodId) {
2287
- return billingApi.purchaseCredits(amountCents, paymentMethodId);
2288
2245
  }
2289
2246
  };
2290
2247
  return module2;