@glowlabs-org/utils 0.2.38 → 0.2.39

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.
@@ -11,6 +11,7 @@ import type {
11
11
  ActivationEvent,
12
12
  KickstarterCreateResponse,
13
13
  RegionVcr,
14
+ SponsoredFarm,
14
15
  } from "../types";
15
16
 
16
17
  // ---------------------------------------------------------------------------
@@ -122,6 +123,19 @@ export function RegionRouter(baseUrl: string) {
122
123
  }
123
124
  };
124
125
 
126
+ const fetchRegionSolarFarms = async (
127
+ regionId: number
128
+ ): Promise<SponsoredFarm[]> => {
129
+ try {
130
+ const data = await request<{ sponsoredFarms: SponsoredFarm[] }>(
131
+ `/regions/${regionId}/solar-farms`
132
+ );
133
+ return data.sponsoredFarms ?? [];
134
+ } catch (error) {
135
+ throw new Error(parseApiError(error));
136
+ }
137
+ };
138
+
125
139
  // -------------------------------------------------------------------------
126
140
  // Mutations
127
141
  // -------------------------------------------------------------------------
@@ -249,6 +263,7 @@ export function RegionRouter(baseUrl: string) {
249
263
  fetchKickstarters,
250
264
  fetchKickstarter,
251
265
  fetchKickstartersByWallet,
266
+ fetchRegionSolarFarms,
252
267
  getRegionByCode,
253
268
  createRegion,
254
269
  createKickstarter,