@glowlabs-org/utils 0.2.177 → 0.2.179
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/{calculate-farm-efficiency-DQqLqk0-.js → calculate-farm-efficiency-K4OucflI.js} +28 -1
- package/dist/cjs/calculate-farm-efficiency-K4OucflI.js.map +1 -0
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/lib/control-api/farms-router.d.ts +2 -1
- package/dist/cjs/lib/types/index.d.ts +14 -0
- package/dist/esm/browser.js +2 -2
- package/dist/esm/{calculate-farm-efficiency-BjXQqtxI.js → calculate-farm-efficiency-Per18qa5.js} +28 -1
- package/dist/esm/calculate-farm-efficiency-Per18qa5.js.map +1 -0
- package/dist/esm/index.js +2 -2
- package/dist/esm/lib/control-api/farms-router.d.ts +2 -1
- package/dist/esm/lib/types/index.d.ts +14 -0
- package/package.json +1 -1
- package/src/lib/control-api/farms-router.ts +36 -0
- package/src/lib/types/index.ts +24 -4
- package/dist/cjs/calculate-farm-efficiency-DQqLqk0-.js.map +0 -1
- package/dist/esm/calculate-farm-efficiency-BjXQqtxI.js.map +0 -1
package/dist/esm/index.js
CHANGED
|
@@ -13,8 +13,8 @@ import { parseUnits, formatUnits } from 'viem';
|
|
|
13
13
|
import { MerkleTree } from 'merkletreejs';
|
|
14
14
|
import { solidityPackedKeccak256, keccak256 } from 'ethers';
|
|
15
15
|
import Decimal from 'decimal.js';
|
|
16
|
-
import { H as HUB_URL, U as USDG_WEIGHT_DECIMAL_PRECISION, G as GLOW_WEIGHT_DECIMAL_PRECISION, M as MAX_WEIGHT } from './calculate-farm-efficiency-
|
|
17
|
-
export { C as ControlRouter, F as FarmsRouter, e as KICKSTARTER_STATUS, K as KickstarterRouter, O as OFF_CHAIN_PAYMENT_CURRENCIES, P as PAYMENT_CURRENCIES, d as REGIONS, R as RegionRouter, S as STAKING_DIRECTIONS, T as TRANSFER_TYPES, W as WalletsRouter, f as calculateFarmEfficiency, c as configureSentry, u as useForwarder, a as useOffchainFractions, b as useRewardsKernel } from './calculate-farm-efficiency-
|
|
16
|
+
import { H as HUB_URL, U as USDG_WEIGHT_DECIMAL_PRECISION, G as GLOW_WEIGHT_DECIMAL_PRECISION, M as MAX_WEIGHT } from './calculate-farm-efficiency-Per18qa5.js';
|
|
17
|
+
export { C as ControlRouter, F as FarmsRouter, e as KICKSTARTER_STATUS, K as KickstarterRouter, O as OFF_CHAIN_PAYMENT_CURRENCIES, P as PAYMENT_CURRENCIES, d as REGIONS, R as RegionRouter, S as STAKING_DIRECTIONS, T as TRANSFER_TYPES, W as WalletsRouter, f as calculateFarmEfficiency, c as configureSentry, u as useForwarder, a as useOffchainFractions, b as useRewardsKernel } from './calculate-farm-efficiency-Per18qa5.js';
|
|
18
18
|
|
|
19
19
|
const GENESIS_TIMESTAMP = 1700352000;
|
|
20
20
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { SponsoredFarm, EstimateRewardScoreParams, RewardScoreResponse, EstimateRewardScoresBatchParams, EstimateRewardScoresBatchResponse, FarmWithRewards, FarmRewardSplit, MiningScoresBatchParams, MiningScoresBatchResponse, FarmWeeklyRewardsResponse, FarmWeeklyRewardsQuery, FarmEfficiencyScore, FarmWeeklyRewardsBatchQuery, FarmWeeklyRewardsBatchResponse, WalletFarmRewardsHistoryQuery, WalletFarmRewardsHistoryResponse, WalletFarmRewardsHistoryBatchQuery, WalletFarmRewardsHistoryBatchResponse } from "../types";
|
|
1
|
+
import type { SponsoredFarm, EstimateRewardScoreParams, RewardScoreResponse, EstimateRewardScoresBatchParams, EstimateRewardScoresBatchResponse, FarmWithRewards, FarmRewardSplit, MiningScoresBatchParams, MiningScoresBatchResponse, FarmWeeklyRewardsResponse, FarmWeeklyRewardsQuery, FarmEfficiencyScore, FarmWeeklyRewardsBatchQuery, FarmWeeklyRewardsBatchResponse, WalletFarmRewardsHistoryQuery, WalletFarmRewardsHistoryResponse, WalletFarmRewardsHistoryBatchQuery, WalletFarmRewardsHistoryBatchResponse, FarmImagesBatchQuery, FarmImagesBatchResponse } from "../types";
|
|
2
2
|
export declare function FarmsRouter(baseUrl: string): {
|
|
3
3
|
readonly fetchFarmRewardSplits: (farmId: string) => Promise<FarmRewardSplit[]>;
|
|
4
4
|
readonly fetchSponsoredFarms: (sponsorWallet?: string) => Promise<SponsoredFarm[]>;
|
|
@@ -11,4 +11,5 @@ export declare function FarmsRouter(baseUrl: string): {
|
|
|
11
11
|
readonly fetchFarmWeeklyRewardsBatch: (params: FarmWeeklyRewardsBatchQuery) => Promise<FarmWeeklyRewardsBatchResponse>;
|
|
12
12
|
readonly fetchWalletFarmRewardsHistory: (walletAddress: string, query?: WalletFarmRewardsHistoryQuery) => Promise<WalletFarmRewardsHistoryResponse>;
|
|
13
13
|
readonly fetchWalletFarmRewardsHistoryBatch: (params: WalletFarmRewardsHistoryBatchQuery) => Promise<WalletFarmRewardsHistoryBatchResponse>;
|
|
14
|
+
readonly fetchFarmImagesBatch: (params: FarmImagesBatchQuery) => Promise<FarmImagesBatchResponse>;
|
|
14
15
|
};
|
|
@@ -664,7 +664,11 @@ export interface UserWeeklyRewards {
|
|
|
664
664
|
protocolDepositAsset: PaymentCurrency;
|
|
665
665
|
protocolDepositRewards: string;
|
|
666
666
|
glwInflationRewards: string;
|
|
667
|
+
glwInflationRewardsFromDelegation?: string;
|
|
668
|
+
glwInflationRewardsFromMiner?: string;
|
|
667
669
|
userGlowSplitPercent: string;
|
|
670
|
+
userGlowSplitPercentFromDelegation?: string;
|
|
671
|
+
userGlowSplitPercentFromMiner?: string;
|
|
668
672
|
userDepositSplitPercent: string;
|
|
669
673
|
}
|
|
670
674
|
export interface FarmWithRewards extends SponsoredFarm {
|
|
@@ -794,4 +798,14 @@ export interface WalletFarmRewardsHistoryBatchResult {
|
|
|
794
798
|
export interface WalletFarmRewardsHistoryBatchResponse {
|
|
795
799
|
results: Record<string, WalletFarmRewardsHistoryBatchResult>;
|
|
796
800
|
}
|
|
801
|
+
export interface FarmImagesBatchQuery {
|
|
802
|
+
farmIds: string[];
|
|
803
|
+
}
|
|
804
|
+
export interface FarmImageResult {
|
|
805
|
+
name: string;
|
|
806
|
+
imageUrl: string | null;
|
|
807
|
+
}
|
|
808
|
+
export interface FarmImagesBatchResponse {
|
|
809
|
+
results: Record<string, FarmImageResult>;
|
|
810
|
+
}
|
|
797
811
|
export type { MintedEvent as ControlMintedEvent };
|
package/package.json
CHANGED
|
@@ -26,6 +26,8 @@ import type {
|
|
|
26
26
|
WalletFarmRewardsHistoryResponse,
|
|
27
27
|
WalletFarmRewardsHistoryBatchQuery,
|
|
28
28
|
WalletFarmRewardsHistoryBatchResponse,
|
|
29
|
+
FarmImagesBatchQuery,
|
|
30
|
+
FarmImagesBatchResponse,
|
|
29
31
|
} from "../types";
|
|
30
32
|
import {
|
|
31
33
|
sentryAddBreadcrumb,
|
|
@@ -355,6 +357,39 @@ export function FarmsRouter(baseUrl: string) {
|
|
|
355
357
|
}
|
|
356
358
|
};
|
|
357
359
|
|
|
360
|
+
const fetchFarmImagesBatch = async (
|
|
361
|
+
params: FarmImagesBatchQuery
|
|
362
|
+
): Promise<FarmImagesBatchResponse> => {
|
|
363
|
+
try {
|
|
364
|
+
sentryAddBreadcrumb({
|
|
365
|
+
category: "control-api",
|
|
366
|
+
message: "POST /farms/images/batch",
|
|
367
|
+
level: "info",
|
|
368
|
+
data: { baseUrl, farmsCount: params.farmIds?.length },
|
|
369
|
+
});
|
|
370
|
+
|
|
371
|
+
const data = await request<FarmImagesBatchResponse>(
|
|
372
|
+
"/farms/images/batch",
|
|
373
|
+
{
|
|
374
|
+
method: "POST",
|
|
375
|
+
headers: {
|
|
376
|
+
"Content-Type": "application/json",
|
|
377
|
+
},
|
|
378
|
+
body: JSON.stringify(params),
|
|
379
|
+
}
|
|
380
|
+
);
|
|
381
|
+
|
|
382
|
+
return data;
|
|
383
|
+
} catch (error) {
|
|
384
|
+
sentryCaptureException(error, {
|
|
385
|
+
action: "fetchFarmImagesBatch",
|
|
386
|
+
baseUrl,
|
|
387
|
+
farmsCount: params.farmIds?.length,
|
|
388
|
+
});
|
|
389
|
+
throw new Error(parseApiError(error));
|
|
390
|
+
}
|
|
391
|
+
};
|
|
392
|
+
|
|
358
393
|
return {
|
|
359
394
|
fetchFarmRewardSplits,
|
|
360
395
|
fetchSponsoredFarms,
|
|
@@ -367,5 +402,6 @@ export function FarmsRouter(baseUrl: string) {
|
|
|
367
402
|
fetchFarmWeeklyRewardsBatch,
|
|
368
403
|
fetchWalletFarmRewardsHistory,
|
|
369
404
|
fetchWalletFarmRewardsHistoryBatch,
|
|
405
|
+
fetchFarmImagesBatch,
|
|
370
406
|
} as const;
|
|
371
407
|
}
|
package/src/lib/types/index.ts
CHANGED
|
@@ -797,10 +797,14 @@ export interface MigrationAmountResponse {
|
|
|
797
797
|
// ----------------------------- Wallet Farm Rewards ---------------------------
|
|
798
798
|
export interface UserWeeklyRewards {
|
|
799
799
|
protocolDepositAsset: PaymentCurrency;
|
|
800
|
-
protocolDepositRewards: string; // User's weekly protocol deposit rewards in the farm's payment currency
|
|
801
|
-
glwInflationRewards: string; // User's weekly GLW inflation rewards (18 decimals)
|
|
802
|
-
|
|
803
|
-
|
|
800
|
+
protocolDepositRewards: string; // User's weekly protocol deposit rewards in the farm's payment currency (always from delegation)
|
|
801
|
+
glwInflationRewards: string; // User's weekly GLW inflation rewards - TOTAL (18 decimals)
|
|
802
|
+
glwInflationRewardsFromDelegation?: string; // User's weekly GLW inflation from delegation/launchpad splits (18 decimals)
|
|
803
|
+
glwInflationRewardsFromMiner?: string; // User's weekly GLW inflation from mining-center splits (18 decimals)
|
|
804
|
+
userGlowSplitPercent: string; // User's GLW split percentage - TOTAL (6 decimals)
|
|
805
|
+
userGlowSplitPercentFromDelegation?: string; // User's GLW split percentage from delegation (6 decimals)
|
|
806
|
+
userGlowSplitPercentFromMiner?: string; // User's GLW split percentage from mining (6 decimals)
|
|
807
|
+
userDepositSplitPercent: string; // User's deposit split percentage - always from delegation (6 decimals)
|
|
804
808
|
}
|
|
805
809
|
|
|
806
810
|
export interface FarmWithRewards extends SponsoredFarm {
|
|
@@ -961,6 +965,22 @@ export interface WalletFarmRewardsHistoryBatchResponse {
|
|
|
961
965
|
results: Record<string, WalletFarmRewardsHistoryBatchResult>;
|
|
962
966
|
}
|
|
963
967
|
|
|
968
|
+
// ---------------------------------------------------------------------------
|
|
969
|
+
// Farm Images Batch
|
|
970
|
+
// ---------------------------------------------------------------------------
|
|
971
|
+
export interface FarmImagesBatchQuery {
|
|
972
|
+
farmIds: string[];
|
|
973
|
+
}
|
|
974
|
+
|
|
975
|
+
export interface FarmImageResult {
|
|
976
|
+
name: string;
|
|
977
|
+
imageUrl: string | null;
|
|
978
|
+
}
|
|
979
|
+
|
|
980
|
+
export interface FarmImagesBatchResponse {
|
|
981
|
+
results: Record<string, FarmImageResult>;
|
|
982
|
+
}
|
|
983
|
+
|
|
964
984
|
// ---------------------------------------------------------------------------
|
|
965
985
|
// Barrel exports (convenience)
|
|
966
986
|
// ---------------------------------------------------------------------------
|