@layr-labs/ecloud-sdk 1.0.0-devep8 → 1.0.0

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-devep8
2
- commit=e481d7c8e23382099664490a6725e15ebe6a1f74
1
+ version=1.0.0
2
+ commit=3f8023569b781e80105d1f06cbba82a8fb7dd3e0
package/dist/billing.cjs CHANGED
@@ -332,6 +332,63 @@ var BillingApiClient = class {
332
332
  return resp.json();
333
333
  }
334
334
  // ==========================================================================
335
+ // Admin - Coupon Methods
336
+ // ==========================================================================
337
+ async createCoupon(amountCents) {
338
+ const endpoint = `${this.config.billingApiServerURL}/admin/coupons`;
339
+ const resp = await this.makeAuthenticatedRequest(endpoint, "POST", "compute", { amountCents });
340
+ return resp.json();
341
+ }
342
+ async listCoupons(opts) {
343
+ const params = new URLSearchParams();
344
+ if (opts?.offset !== void 0) params.set("offset", opts.offset.toString());
345
+ if (opts?.limit !== void 0) params.set("limit", opts.limit.toString());
346
+ if (opts?.active !== void 0) params.set("active", opts.active.toString());
347
+ if (opts?.redeemed !== void 0) params.set("redeemed", opts.redeemed.toString());
348
+ const qs = params.toString();
349
+ const endpoint = `${this.config.billingApiServerURL}/admin/coupons${qs ? `?${qs}` : ""}`;
350
+ const resp = await this.makeAuthenticatedRequest(endpoint, "GET", "compute");
351
+ return resp.json();
352
+ }
353
+ async getCoupon(id) {
354
+ const endpoint = `${this.config.billingApiServerURL}/admin/coupons/${id}`;
355
+ const resp = await this.makeAuthenticatedRequest(endpoint, "GET", "compute");
356
+ return resp.json();
357
+ }
358
+ async deactivateCoupon(id) {
359
+ const endpoint = `${this.config.billingApiServerURL}/admin/coupons/${id}/deactivate`;
360
+ await this.makeAuthenticatedRequest(endpoint, "POST", "compute");
361
+ }
362
+ async redeemCouponForUser(id, address) {
363
+ const endpoint = `${this.config.billingApiServerURL}/admin/coupons/${id}/redeem`;
364
+ await this.makeAuthenticatedRequest(endpoint, "POST", "compute", { address });
365
+ }
366
+ // ==========================================================================
367
+ // Admin - Admin Management Methods
368
+ // ==========================================================================
369
+ async addAdmin(address) {
370
+ const endpoint = `${this.config.billingApiServerURL}/admin/admins`;
371
+ const resp = await this.makeAuthenticatedRequest(endpoint, "POST", "compute", { address });
372
+ return resp.json();
373
+ }
374
+ async removeAdmin(address) {
375
+ const endpoint = `${this.config.billingApiServerURL}/admin/admins/${address}`;
376
+ await this.makeAuthenticatedRequest(endpoint, "DELETE", "compute");
377
+ }
378
+ async listAdmins() {
379
+ const endpoint = `${this.config.billingApiServerURL}/admin/admins`;
380
+ const resp = await this.makeAuthenticatedRequest(endpoint, "GET", "compute");
381
+ return resp.json();
382
+ }
383
+ // ==========================================================================
384
+ // User - Coupon Redemption
385
+ // ==========================================================================
386
+ async redeemCoupon(code) {
387
+ const endpoint = `${this.config.billingApiServerURL}/v1/coupons/redeem`;
388
+ const resp = await this.makeAuthenticatedRequest(endpoint, "POST", "compute", { code });
389
+ return resp.json();
390
+ }
391
+ // ==========================================================================
335
392
  // Internal Methods
336
393
  // ==========================================================================
337
394
  /**
@@ -483,14 +540,13 @@ var BILLING_ENVIRONMENTS = {
483
540
  billingApiServerURL: "https://billingapi.eigencloud.xyz"
484
541
  }
485
542
  };
486
- var PLATFORM_ENV_TESTNET_SEPOLIA = "testnet-sepolia";
487
- var PLATFORM_ENV_MAINNET_ETHEREUM = "mainnet-ethereum";
488
- var DEFAULT_APP_BASE_DOMAIN = "eigencloud.xyz";
489
543
  var ENVIRONMENTS = {
490
544
  "sepolia-dev": {
491
545
  name: "sepolia",
492
546
  build: "dev",
493
547
  appControllerAddress: "0xa86DC1C47cb2518327fB4f9A1627F51966c83B92",
548
+ releaseAbiVersion: "v1.5",
549
+ // AppController upgraded to v1.5.x (containerPolicy)
494
550
  permissionControllerAddress: ChainAddresses[SEPOLIA_CHAIN_ID].PermissionController,
495
551
  erc7702DelegatorAddress: CommonAddresses.ERC7702Delegator,
496
552
  kmsServerURL: "http://10.128.0.57:8080",
@@ -498,14 +554,14 @@ var ENVIRONMENTS = {
498
554
  defaultRPCURL: "https://ethereum-sepolia-rpc.publicnode.com",
499
555
  usdcCreditsAddress: "0xbdA3897c3A428763B59015C64AB766c288C97376",
500
556
  baseUsdcCreditsAddress: "0x7673a47463F80c6a3553Db9E54c8cDcd5313d0ac",
501
- baseRPCURL: "https://base-sepolia-rpc.publicnode.com",
502
- platformEnv: PLATFORM_ENV_TESTNET_SEPOLIA,
503
- appBaseDomain: DEFAULT_APP_BASE_DOMAIN
557
+ baseRPCURL: "https://base-sepolia-rpc.publicnode.com"
504
558
  },
505
559
  sepolia: {
506
560
  name: "sepolia",
507
561
  build: "prod",
508
562
  appControllerAddress: "0x0dd810a6ffba6a9820a10d97b659f07d8d23d4E2",
563
+ releaseAbiVersion: "v1.4",
564
+ // prod still on AppController v1.4.0 (3-field Release)
509
565
  permissionControllerAddress: ChainAddresses[SEPOLIA_CHAIN_ID].PermissionController,
510
566
  erc7702DelegatorAddress: CommonAddresses.ERC7702Delegator,
511
567
  kmsServerURL: "http://10.128.15.203:8080",
@@ -514,22 +570,20 @@ var ENVIRONMENTS = {
514
570
  billingRPCURL: "https://ethereum-rpc.publicnode.com",
515
571
  usdcCreditsAddress: "0xed9c88640ca9149Bd9f7ee6620074af10F2E145d",
516
572
  baseUsdcCreditsAddress: "0x7673a47463F80c6a3553Db9E54c8cDcd5313d0ac",
517
- baseRPCURL: "https://base-sepolia-rpc.publicnode.com",
518
- platformEnv: PLATFORM_ENV_TESTNET_SEPOLIA,
519
- appBaseDomain: DEFAULT_APP_BASE_DOMAIN
573
+ baseRPCURL: "https://base-sepolia-rpc.publicnode.com"
520
574
  },
521
575
  "mainnet-alpha": {
522
576
  name: "mainnet-alpha",
523
577
  build: "prod",
524
578
  appControllerAddress: "0xc38d35Fc995e75342A21CBd6D770305b142Fbe67",
579
+ releaseAbiVersion: "v1.4",
580
+ // prod still on AppController v1.4.0 (3-field Release)
525
581
  permissionControllerAddress: ChainAddresses[MAINNET_CHAIN_ID].PermissionController,
526
582
  erc7702DelegatorAddress: CommonAddresses.ERC7702Delegator,
527
583
  kmsServerURL: "http://10.128.0.2:8080",
528
584
  userApiServerURL: "https://userapi-compute.eigencloud.xyz",
529
585
  defaultRPCURL: "https://ethereum-rpc.publicnode.com",
530
- usdcCreditsAddress: "0xed9c88640ca9149Bd9f7ee6620074af10F2E145d",
531
- platformEnv: PLATFORM_ENV_MAINNET_ETHEREUM,
532
- appBaseDomain: DEFAULT_APP_BASE_DOMAIN
586
+ usdcCreditsAddress: "0xed9c88640ca9149Bd9f7ee6620074af10F2E145d"
533
587
  }
534
588
  };
535
589
  var CHAIN_ID_TO_ENVIRONMENT = {
@@ -589,7 +643,7 @@ function getBillingEnvironmentConfig(build) {
589
643
  };
590
644
  }
591
645
  function getBuildType() {
592
- const buildTimeType = true ? "dev"?.toLowerCase() : void 0;
646
+ const buildTimeType = true ? "prod"?.toLowerCase() : void 0;
593
647
  const runtimeType = process.env.BUILD_TYPE?.toLowerCase();
594
648
  const buildType = buildTimeType || runtimeType;
595
649
  if (buildType === "dev") {
@@ -2364,6 +2418,9 @@ function createBillingModule(config) {
2364
2418
  },
2365
2419
  hasBaseSupport() {
2366
2420
  return !!baseUsdcCreditsAddress && !!baseRPCURL;
2421
+ },
2422
+ async redeemCoupon(code) {
2423
+ return billingApi.redeemCoupon(code);
2367
2424
  }
2368
2425
  };
2369
2426
  return module2;