@glowlabs-org/utils 0.2.150 → 0.2.152

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,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var farmsRouter = require('./farms-router-CMpG0RGM.js');
3
+ var farmsRouter = require('./farms-router-DwbBMkUd.js');
4
4
  var viem = require('viem');
5
5
  require('ethers');
6
6
 
@@ -2586,6 +2586,9 @@ function parseApiError$4(error) {
2586
2586
  // Public Factory
2587
2587
  // --------------------------------------------------------------------------
2588
2588
  function ControlRouter(baseUrl) {
2589
+ if (!baseUrl) {
2590
+ throw new Error("CONTROL API base URL is not set");
2591
+ }
2589
2592
  // ----------------------- Internal helpers --------------------------------
2590
2593
  const request = async (path, init) => {
2591
2594
  const res = await fetch(`${baseUrl}${path}`, init);
@@ -2650,6 +2653,15 @@ function ControlRouter(baseUrl) {
2650
2653
  throw new Error(parseApiError$4(error));
2651
2654
  }
2652
2655
  };
2656
+ const fetchHoldersCount = async () => {
2657
+ try {
2658
+ const data = await request(`/holders/count`);
2659
+ return data.holders;
2660
+ }
2661
+ catch (error) {
2662
+ throw new Error(parseApiError$4(error));
2663
+ }
2664
+ };
2653
2665
  // Build pagination query helper
2654
2666
  const buildPaginationQuery = (page, limit) => {
2655
2667
  const p = page ?? 1;
@@ -2713,6 +2725,19 @@ function ControlRouter(baseUrl) {
2713
2725
  throw new Error(parseApiError$4(error));
2714
2726
  }
2715
2727
  };
2728
+ const fetchFarmRewardSplits = async (farmId) => {
2729
+ try {
2730
+ if (!farmId)
2731
+ throw new Error("Farm ID is required");
2732
+ const data = await request(`/farms/${encodeURIComponent(farmId)}/reward-splits`);
2733
+ if ("error" in data)
2734
+ throw new Error(data.error);
2735
+ return data.rewardSplits ?? [];
2736
+ }
2737
+ catch (error) {
2738
+ throw new Error(parseApiError$4(error));
2739
+ }
2740
+ };
2716
2741
  // Exposed query with error parsing
2717
2742
  const getTransferDetails = async (txId) => {
2718
2743
  try {
@@ -2877,11 +2902,11 @@ function ControlRouter(baseUrl) {
2877
2902
  level: "info",
2878
2903
  data: { baseUrl, operationId },
2879
2904
  });
2880
- await request(`/operations/failed/${operationId}/retry`, {
2905
+ const response = await request(`/operations/failed/${operationId}/retry`, {
2881
2906
  method: "POST",
2882
2907
  headers: { "Content-Type": "application/json" },
2883
2908
  });
2884
- return true;
2909
+ return response;
2885
2910
  }
2886
2911
  catch (error) {
2887
2912
  sentryCaptureException(error, {
@@ -2980,6 +3005,7 @@ function ControlRouter(baseUrl) {
2980
3005
  fetchGctlPrice,
2981
3006
  fetchGlwPrice,
2982
3007
  fetchCirculatingSupply,
3008
+ fetchHoldersCount,
2983
3009
  fetchLastNonce,
2984
3010
  fetchMintedEvents,
2985
3011
  fetchStakeEvents,
@@ -2991,6 +3017,7 @@ function ControlRouter(baseUrl) {
2991
3017
  fetchWalletRegionCommittedBalance,
2992
3018
  fetchTransferDetails: getTransferDetails,
2993
3019
  fetchGlwRegionRewards,
3020
+ fetchFarmRewardSplits,
2994
3021
  fetchMigrationAmount,
2995
3022
  // Mutations
2996
3023
  stakeGctl,
@@ -3795,6 +3822,14 @@ function RegionRouter(baseUrl) {
3795
3822
  throw new Error(parseApiError$3(error));
3796
3823
  }
3797
3824
  };
3825
+ const fetchRecentActivity = async () => {
3826
+ try {
3827
+ return await request(`/regions/active/recent-activity`);
3828
+ }
3829
+ catch (error) {
3830
+ throw new Error(parseApiError$3(error));
3831
+ }
3832
+ };
3798
3833
  const applyInstallerCertification = async (payload) => {
3799
3834
  try {
3800
3835
  return await request(`/regions/installers/apply`, {
@@ -3855,6 +3890,7 @@ function RegionRouter(baseUrl) {
3855
3890
  fetchRegionByIdOrSlug,
3856
3891
  fetchRegionSolarFarms,
3857
3892
  fetchActiveSummary,
3893
+ fetchRecentActivity,
3858
3894
  getRegionByCode,
3859
3895
  applyInstallerCertification,
3860
3896
  // Cached data & flags
@@ -4264,4 +4300,4 @@ exports.useForwarder = useForwarder;
4264
4300
  exports.useOffchainFractions = useOffchainFractions;
4265
4301
  exports.waitForEthersTransactionWithRetry = waitForEthersTransactionWithRetry;
4266
4302
  exports.waitForViemTransactionWithRetry = waitForViemTransactionWithRetry;
4267
- //# sourceMappingURL=farms-router-CMpG0RGM.js.map
4303
+ //# sourceMappingURL=farms-router-DwbBMkUd.js.map