@glowlabs-org/utils 0.2.126 → 0.2.127
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/browser.js +1 -1
- package/dist/cjs/{farms-router-B_q2w0RQ.js → farms-router-CLc5BeFa.js} +19 -1
- package/dist/cjs/farms-router-CLc5BeFa.js.map +1 -0
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/lib/control-api/farms-router.d.ts +6 -1
- package/dist/cjs/lib/types/index.d.ts +8 -0
- package/dist/esm/browser.js +2 -2
- package/dist/esm/{farms-router-ljNiP3uJ.js → farms-router-Be9jmsz3.js} +19 -1
- package/dist/esm/farms-router-Be9jmsz3.js.map +1 -0
- package/dist/esm/index.js +2 -2
- package/dist/esm/lib/control-api/farms-router.d.ts +6 -1
- package/dist/esm/lib/types/index.d.ts +8 -0
- package/package.json +1 -1
- package/src/lib/control-api/farms-router.ts +32 -0
- package/src/lib/types/index.ts +11 -0
- package/dist/cjs/farms-router-B_q2w0RQ.js.map +0 -1
- package/dist/esm/farms-router-ljNiP3uJ.js.map +0 -1
|
@@ -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>;
|
|
@@ -483,4 +483,12 @@ export interface WalletFarmsWithRewardsResponse {
|
|
|
483
483
|
farms: FarmWithRewards[];
|
|
484
484
|
totalFarms: number;
|
|
485
485
|
}
|
|
486
|
+
export interface FarmRewardSplitsResponse {
|
|
487
|
+
farmId: string;
|
|
488
|
+
rewardSplits: FarmRewardSplit[];
|
|
489
|
+
totalSplits: number;
|
|
490
|
+
}
|
|
491
|
+
export interface FarmRewardSplitsErrorResponse {
|
|
492
|
+
error: string;
|
|
493
|
+
}
|
|
486
494
|
export type { MintedEvent as ControlMintedEvent };
|
package/dist/esm/browser.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { T as TRANSFER_TYPES } from './farms-router-
|
|
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-
|
|
1
|
+
import { T as TRANSFER_TYPES } from './farms-router-Be9jmsz3.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-Be9jmsz3.js';
|
|
3
3
|
import { verifyTypedData, getAddress } from 'viem';
|
|
4
4
|
import 'ethers';
|
|
5
5
|
|
|
@@ -3560,6 +3560,23 @@ function FarmsRouter(baseUrl) {
|
|
|
3560
3560
|
}
|
|
3561
3561
|
return (await res.json());
|
|
3562
3562
|
};
|
|
3563
|
+
const fetchFarmRewardSplits = async (farmId) => {
|
|
3564
|
+
try {
|
|
3565
|
+
if (!farmId) {
|
|
3566
|
+
throw new Error("Farm ID is required");
|
|
3567
|
+
}
|
|
3568
|
+
const data = await request(`/farms/${encodeURIComponent(farmId)}/reward-splits`);
|
|
3569
|
+
// Check if it's an error response
|
|
3570
|
+
if ("error" in data) {
|
|
3571
|
+
throw new Error(data.error);
|
|
3572
|
+
}
|
|
3573
|
+
// At this point, TypeScript knows it's FarmRewardSplitsResponse
|
|
3574
|
+
return data.rewardSplits ?? [];
|
|
3575
|
+
}
|
|
3576
|
+
catch (error) {
|
|
3577
|
+
throw new Error(parseApiError(error));
|
|
3578
|
+
}
|
|
3579
|
+
};
|
|
3563
3580
|
const fetchSponsoredFarms = async (sponsorWallet) => {
|
|
3564
3581
|
try {
|
|
3565
3582
|
const query = sponsorWallet
|
|
@@ -3621,6 +3638,7 @@ function FarmsRouter(baseUrl) {
|
|
|
3621
3638
|
}
|
|
3622
3639
|
};
|
|
3623
3640
|
return {
|
|
3641
|
+
fetchFarmRewardSplits,
|
|
3624
3642
|
fetchSponsoredFarms,
|
|
3625
3643
|
fetchWalletFarmsWithRewards,
|
|
3626
3644
|
estimateRewardScore,
|
|
@@ -3629,4 +3647,4 @@ function FarmsRouter(baseUrl) {
|
|
|
3629
3647
|
}
|
|
3630
3648
|
|
|
3631
3649
|
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-
|
|
3650
|
+
//# sourceMappingURL=farms-router-Be9jmsz3.js.map
|