@glowlabs-org/utils 0.2.126 → 0.2.128

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.
@@ -5,6 +5,10 @@
5
5
  *
6
6
  * ## Endpoints
7
7
  *
8
+ * ### GET `/farms/:farmId/reward-splits`
9
+ * Returns the current reward splits for a specific farm based on its farmId.
10
+ * The splits show how GLW and deposit rewards are distributed among wallet addresses.
11
+ *
8
12
  * ### GET `/farms/sponsored`
9
13
  * Returns all sponsored farms, optionally filtered by sponsor wallet.
10
14
  *
@@ -20,8 +24,9 @@
20
24
  * Calculates reward scores for multiple potential marketplace farms.
21
25
  * Each farm is calculated independently as if joining the protocol by itself.
22
26
  */
23
- import type { SponsoredFarm, EstimateRewardScoreParams, RewardScoreResponse, EstimateRewardScoresBatchParams, EstimateRewardScoresBatchResponse, FarmWithRewards } from "../types";
27
+ import type { SponsoredFarm, EstimateRewardScoreParams, RewardScoreResponse, EstimateRewardScoresBatchParams, EstimateRewardScoresBatchResponse, FarmWithRewards, FarmRewardSplit } from "../types";
24
28
  export declare function FarmsRouter(baseUrl: string): {
29
+ readonly fetchFarmRewardSplits: (farmId: string) => Promise<FarmRewardSplit[]>;
25
30
  readonly fetchSponsoredFarms: (sponsorWallet?: string) => Promise<SponsoredFarm[]>;
26
31
  readonly fetchWalletFarmsWithRewards: (walletAddress: string) => Promise<FarmWithRewards[]>;
27
32
  readonly estimateRewardScore: (params: EstimateRewardScoreParams) => Promise<RewardScoreResponse>;
@@ -1,7 +1,8 @@
1
1
  export declare enum STAKING_DIRECTIONS {
2
2
  STAKE = "stake",
3
3
  UNSTAKE = "unstake",
4
- RESTAKE = "restake"
4
+ RESTAKE = "restake",
5
+ IMMEDIATE_UNSTAKE = "immediate_unstake"
5
6
  }
6
7
  export type StakingDirection = (typeof STAKING_DIRECTIONS)[keyof typeof STAKING_DIRECTIONS];
7
8
  export declare enum REGIONS {
@@ -483,4 +484,12 @@ export interface WalletFarmsWithRewardsResponse {
483
484
  farms: FarmWithRewards[];
484
485
  totalFarms: number;
485
486
  }
487
+ export interface FarmRewardSplitsResponse {
488
+ farmId: string;
489
+ rewardSplits: FarmRewardSplit[];
490
+ totalSplits: number;
491
+ }
492
+ export interface FarmRewardSplitsErrorResponse {
493
+ error: string;
494
+ }
486
495
  export type { MintedEvent as ControlMintedEvent };
@@ -1,5 +1,5 @@
1
- import { T as TRANSFER_TYPES } from './farms-router-ljNiP3uJ.js';
2
- export { C as ControlRouter, D as DECIMALS_BY_TOKEN, i as FORWARDER_ABI, F as FarmsRouter, d as ForwarderError, l as GCA_URLS, G as GLOW_WEIGHT_DECIMAL_PRECISION, H as HUB_URL, c as KICKSTARTER_STATUS, K as KickstarterRouter, M as MAX_WEIGHT, j as OFFCHAIN_FRACTIONS_ABI, O as OFF_CHAIN_PAYMENT_CURRENCIES, e 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, f as allRegions, h as countries, k as getAddresses, r as regionMetadata, g as usStates, u as useForwarder, a as useOffchainFractions } from './farms-router-ljNiP3uJ.js';
1
+ import { T as TRANSFER_TYPES } from './farms-router-CXLLMwfG.js';
2
+ export { C as ControlRouter, D as DECIMALS_BY_TOKEN, i as FORWARDER_ABI, F as FarmsRouter, d as ForwarderError, l as GCA_URLS, G as GLOW_WEIGHT_DECIMAL_PRECISION, H as HUB_URL, c as KICKSTARTER_STATUS, K as KickstarterRouter, M as MAX_WEIGHT, j as OFFCHAIN_FRACTIONS_ABI, O as OFF_CHAIN_PAYMENT_CURRENCIES, e 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, f as allRegions, h as countries, k as getAddresses, r as regionMetadata, g as usStates, u as useForwarder, a as useOffchainFractions } from './farms-router-CXLLMwfG.js';
3
3
  import { verifyTypedData, getAddress } from 'viem';
4
4
  import 'ethers';
5
5
 
@@ -25,6 +25,7 @@ var STAKING_DIRECTIONS;
25
25
  STAKING_DIRECTIONS["STAKE"] = "stake";
26
26
  STAKING_DIRECTIONS["UNSTAKE"] = "unstake";
27
27
  STAKING_DIRECTIONS["RESTAKE"] = "restake";
28
+ STAKING_DIRECTIONS["IMMEDIATE_UNSTAKE"] = "immediate_unstake";
28
29
  })(STAKING_DIRECTIONS || (STAKING_DIRECTIONS = {}));
29
30
  var REGIONS;
30
31
  (function (REGIONS) {
@@ -3560,6 +3561,23 @@ function FarmsRouter(baseUrl) {
3560
3561
  }
3561
3562
  return (await res.json());
3562
3563
  };
3564
+ const fetchFarmRewardSplits = async (farmId) => {
3565
+ try {
3566
+ if (!farmId) {
3567
+ throw new Error("Farm ID is required");
3568
+ }
3569
+ const data = await request(`/farms/${encodeURIComponent(farmId)}/reward-splits`);
3570
+ // Check if it's an error response
3571
+ if ("error" in data) {
3572
+ throw new Error(data.error);
3573
+ }
3574
+ // At this point, TypeScript knows it's FarmRewardSplitsResponse
3575
+ return data.rewardSplits ?? [];
3576
+ }
3577
+ catch (error) {
3578
+ throw new Error(parseApiError(error));
3579
+ }
3580
+ };
3563
3581
  const fetchSponsoredFarms = async (sponsorWallet) => {
3564
3582
  try {
3565
3583
  const query = sponsorWallet
@@ -3621,6 +3639,7 @@ function FarmsRouter(baseUrl) {
3621
3639
  }
3622
3640
  };
3623
3641
  return {
3642
+ fetchFarmRewardSplits,
3624
3643
  fetchSponsoredFarms,
3625
3644
  fetchWalletFarmsWithRewards,
3626
3645
  estimateRewardScore,
@@ -3629,4 +3648,4 @@ function FarmsRouter(baseUrl) {
3629
3648
  }
3630
3649
 
3631
3650
  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, KICKSTARTER_STATUS as c, ForwarderError as d, OffchainFractionsError as e, allRegions as f, usStates as g, countries as h, FORWARDER_ABI as i, OFFCHAIN_FRACTIONS_ABI as j, getAddresses as k, GCA_URLS as l, regionMetadata as r, useForwarder as u };
3632
- //# sourceMappingURL=farms-router-ljNiP3uJ.js.map
3651
+ //# sourceMappingURL=farms-router-CXLLMwfG.js.map