@glowlabs-org/utils 0.2.151 → 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.
package/dist/cjs/index.js CHANGED
@@ -15,7 +15,7 @@ var viem = require('viem');
15
15
  var merkletreejs = require('merkletreejs');
16
16
  var ethers = require('ethers');
17
17
  var Decimal = require('decimal.js');
18
- var farmsRouter = require('./farms-router-DWSaZD1T.js');
18
+ var farmsRouter = require('./farms-router-DwbBMkUd.js');
19
19
 
20
20
  const GENESIS_TIMESTAMP = 1700352000;
21
21
 
@@ -1,4 +1,4 @@
1
- import type { RegionWithMetadata, ActivationConfig, ActivationEvent, RegionDetails, SponsoredFarm, ActiveRegionsSummaryResponse, InstallerApplicationPayload, InstallerApplicationResponse } from "../types";
1
+ import type { RegionWithMetadata, ActivationConfig, ActivationEvent, RegionDetails, SponsoredFarm, ActiveRegionsSummaryResponse, RecentRegionActivityResponse, InstallerApplicationPayload, InstallerApplicationResponse } from "../types";
2
2
  export declare function RegionRouter(baseUrl: string): {
3
3
  readonly fetchRegions: (params?: {
4
4
  isActive?: boolean;
@@ -8,6 +8,7 @@ export declare function RegionRouter(baseUrl: string): {
8
8
  readonly fetchRegionByIdOrSlug: (idOrSlug: string) => Promise<RegionDetails>;
9
9
  readonly fetchRegionSolarFarms: (regionId: number) => Promise<SponsoredFarm[]>;
10
10
  readonly fetchActiveSummary: () => Promise<ActiveRegionsSummaryResponse>;
11
+ readonly fetchRecentActivity: () => Promise<RecentRegionActivityResponse>;
11
12
  readonly getRegionByCode: (code: string) => RegionWithMetadata | null;
12
13
  readonly applyInstallerCertification: (payload: InstallerApplicationPayload) => Promise<InstallerApplicationResponse>;
13
14
  readonly regions: RegionWithMetadata[];
@@ -311,14 +311,17 @@ export interface RegionDetails extends RegionWithMetadata {
311
311
  carbonCreditsIssued: number;
312
312
  carbonCreditsPerWeek: number;
313
313
  }
314
- export interface ActiveRegionSnapshot {
314
+ export interface ActiveRegionDataPoint {
315
315
  epoch: number;
316
- totals: {
317
- gctlStaked: string;
318
- pendingUnstake: string;
319
- pendingRestakeOut: string;
320
- pendingRestakeIn: string;
321
- };
316
+ timestamp: number;
317
+ gctlStaked: string;
318
+ pendingUnstake: string;
319
+ pendingRestakeOut: string;
320
+ pendingRestakeIn: string;
321
+ netPending: string;
322
+ eventCount: number;
323
+ firstEventTimestamp?: number;
324
+ lastEventTimestamp?: number;
322
325
  }
323
326
  export interface ActiveRegionSummary {
324
327
  id: number;
@@ -326,20 +329,47 @@ export interface ActiveRegionSummary {
326
329
  code: string;
327
330
  slug: string;
328
331
  isUs: boolean;
329
- gctlStaked: string;
332
+ currentGctlStaked: string;
330
333
  glwRewardPerWeek: string;
331
334
  rewardShare: string;
332
- pendingUnstake: string;
333
- pendingRestakeOut: string;
334
- pendingRestakeIn: string;
335
- snapshots: ActiveRegionSnapshot[];
335
+ data: ActiveRegionDataPoint[];
336
336
  }
337
337
  export interface ActiveRegionsSummaryResponse {
338
+ metadata: {
339
+ epochs: number[];
340
+ epochTimestamps: {
341
+ [epoch: string]: number;
342
+ };
343
+ currentEpoch: number;
344
+ };
338
345
  total: {
339
346
  totalGctlStaked: string;
340
347
  totalGlwRewards: string;
341
348
  };
342
349
  regions: ActiveRegionSummary[];
350
+ aggregate: {
351
+ epochs: number[];
352
+ timestamps: number[];
353
+ totalGctlStaked: string[];
354
+ totalPendingUnstake: string[];
355
+ totalNetPending: string[];
356
+ };
357
+ }
358
+ export interface RegionActivityPeriod {
359
+ stakes: number;
360
+ unstakes: number;
361
+ restakes: number;
362
+ immediateUnstakes: number;
363
+ netChange: string;
364
+ }
365
+ export interface RegionActivity {
366
+ regionId: number;
367
+ regionName: string;
368
+ last24h: RegionActivityPeriod;
369
+ last7d: RegionActivityPeriod;
370
+ }
371
+ export interface RecentRegionActivityResponse {
372
+ activity: RegionActivity[];
343
373
  }
344
374
  export interface InstallerApplicationPayload {
345
375
  wallet: string;
@@ -1,5 +1,5 @@
1
- import { T as TRANSFER_TYPES } from './farms-router-Cpy_o4_u.js';
2
- export { C as ControlRouter, D as DECIMALS_BY_TOKEN, j as FORWARDER_ABI, F as FarmsRouter, e as ForwarderError, m as GCA_URLS, G as GLOW_WEIGHT_DECIMAL_PRECISION, H as HUB_URL, d as KICKSTARTER_STATUS, K as KickstarterRouter, M as MAX_WEIGHT, k as OFFCHAIN_FRACTIONS_ABI, O as OFF_CHAIN_PAYMENT_CURRENCIES, f as OffchainFractionsError, P as PAYMENT_CURRENCIES, b as REGIONS, R as RegionRouter, S as STAKING_DIRECTIONS, U as USDG_WEIGHT_DECIMAL_PRECISION, W as WalletsRouter, g as allRegions, c as configureSentry, i as countries, l as getAddresses, n as parseEthersError, p as parseViemError, r as regionMetadata, h as usStates, u as useForwarder, a as useOffchainFractions, o as waitForEthersTransactionWithRetry, w as waitForViemTransactionWithRetry } from './farms-router-Cpy_o4_u.js';
1
+ import { T as TRANSFER_TYPES } from './farms-router-C0g4hf2Z.js';
2
+ export { C as ControlRouter, D as DECIMALS_BY_TOKEN, j as FORWARDER_ABI, F as FarmsRouter, e as ForwarderError, m as GCA_URLS, G as GLOW_WEIGHT_DECIMAL_PRECISION, H as HUB_URL, d as KICKSTARTER_STATUS, K as KickstarterRouter, M as MAX_WEIGHT, k as OFFCHAIN_FRACTIONS_ABI, O as OFF_CHAIN_PAYMENT_CURRENCIES, f as OffchainFractionsError, P as PAYMENT_CURRENCIES, b as REGIONS, R as RegionRouter, S as STAKING_DIRECTIONS, U as USDG_WEIGHT_DECIMAL_PRECISION, W as WalletsRouter, g as allRegions, c as configureSentry, i as countries, l as getAddresses, n as parseEthersError, p as parseViemError, r as regionMetadata, h as usStates, u as useForwarder, a as useOffchainFractions, o as waitForEthersTransactionWithRetry, w as waitForViemTransactionWithRetry } from './farms-router-C0g4hf2Z.js';
3
3
  import { verifyTypedData, checksumAddress } from 'viem';
4
4
  import 'ethers';
5
5
 
@@ -3820,6 +3820,14 @@ function RegionRouter(baseUrl) {
3820
3820
  throw new Error(parseApiError$3(error));
3821
3821
  }
3822
3822
  };
3823
+ const fetchRecentActivity = async () => {
3824
+ try {
3825
+ return await request(`/regions/active/recent-activity`);
3826
+ }
3827
+ catch (error) {
3828
+ throw new Error(parseApiError$3(error));
3829
+ }
3830
+ };
3823
3831
  const applyInstallerCertification = async (payload) => {
3824
3832
  try {
3825
3833
  return await request(`/regions/installers/apply`, {
@@ -3880,6 +3888,7 @@ function RegionRouter(baseUrl) {
3880
3888
  fetchRegionByIdOrSlug,
3881
3889
  fetchRegionSolarFarms,
3882
3890
  fetchActiveSummary,
3891
+ fetchRecentActivity,
3883
3892
  getRegionByCode,
3884
3893
  applyInstallerCertification,
3885
3894
  // Cached data & flags
@@ -4262,4 +4271,4 @@ function FarmsRouter(baseUrl) {
4262
4271
  }
4263
4272
 
4264
4273
  export { ControlRouter as C, DECIMALS_BY_TOKEN as D, FarmsRouter as F, GLOW_WEIGHT_DECIMAL_PRECISION as G, HUB_URL as H, KickstarterRouter as K, MAX_WEIGHT as M, OFF_CHAIN_PAYMENT_CURRENCIES as O, PAYMENT_CURRENCIES as P, RegionRouter as R, STAKING_DIRECTIONS as S, TRANSFER_TYPES as T, USDG_WEIGHT_DECIMAL_PRECISION as U, WalletsRouter as W, useOffchainFractions as a, REGIONS as b, configureSentry as c, KICKSTARTER_STATUS as d, ForwarderError as e, OffchainFractionsError as f, allRegions as g, usStates as h, countries as i, FORWARDER_ABI as j, OFFCHAIN_FRACTIONS_ABI as k, getAddresses as l, GCA_URLS as m, parseEthersError as n, waitForEthersTransactionWithRetry as o, parseViemError as p, regionMetadata as r, useForwarder as u, waitForViemTransactionWithRetry as w };
4265
- //# sourceMappingURL=farms-router-Cpy_o4_u.js.map
4274
+ //# sourceMappingURL=farms-router-C0g4hf2Z.js.map