@glowlabs-org/utils 0.2.161 → 0.2.163

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.
@@ -2922,6 +2922,15 @@ function useRewardsKernel(walletClient, publicClient, CHAIN_ID) {
2922
2922
  }
2923
2923
  // Run a simulation first to surface any revert reason
2924
2924
  try {
2925
+ console.log("Simulating claimPayout with:", {
2926
+ nonce: nonce.toString(),
2927
+ proof: proof,
2928
+ tokensAndAmounts: tokensAndAmounts,
2929
+ from: from,
2930
+ to: to,
2931
+ isGuardedToken: isGuardedToken,
2932
+ toCounterfactual: toCounterfactual,
2933
+ });
2925
2934
  await publicClient.simulateContract({
2926
2935
  address: ADDRESSES.REWARDS_KERNEL,
2927
2936
  abi: REWARDS_KERNEL_ABI,
@@ -2945,6 +2954,7 @@ function useRewardsKernel(walletClient, publicClient, CHAIN_ID) {
2945
2954
  contract: ADDRESSES.REWARDS_KERNEL,
2946
2955
  nonce: nonce.toString(),
2947
2956
  tokensAndAmounts: tokensAndAmounts,
2957
+ proof: proof,
2948
2958
  from: from,
2949
2959
  to: to,
2950
2960
  isGuardedToken: isGuardedToken,
@@ -2952,6 +2962,15 @@ function useRewardsKernel(walletClient, publicClient, CHAIN_ID) {
2952
2962
  });
2953
2963
  throw new Error(parseViemError(simulationError));
2954
2964
  }
2965
+ console.log("Executing claimPayout with:", {
2966
+ nonce: nonce.toString(),
2967
+ proof: proof,
2968
+ tokensAndAmounts: tokensAndAmounts,
2969
+ from: from,
2970
+ to: to,
2971
+ isGuardedToken: isGuardedToken,
2972
+ toCounterfactual: toCounterfactual,
2973
+ });
2955
2974
  // Execute the transaction
2956
2975
  const hash = await walletClient.writeContract({
2957
2976
  address: ADDRESSES.REWARDS_KERNEL,
@@ -2979,6 +2998,7 @@ function useRewardsKernel(walletClient, publicClient, CHAIN_ID) {
2979
2998
  contract: ADDRESSES.REWARDS_KERNEL,
2980
2999
  nonce: params.nonce.toString(),
2981
3000
  from: params.from,
3001
+ proof: params.proof,
2982
3002
  tokensAndAmounts: params.tokensAndAmounts,
2983
3003
  to: params.to,
2984
3004
  isGuardedToken: params.isGuardedToken,
@@ -5043,6 +5063,76 @@ function FarmsRouter(baseUrl) {
5043
5063
  throw new Error(parseApiError(error));
5044
5064
  }
5045
5065
  };
5066
+ const fetchFarmWeeklyRewardsBatch = async (params) => {
5067
+ try {
5068
+ sentryAddBreadcrumb({
5069
+ category: "control-api",
5070
+ message: "POST /farms/rewards-history/batch",
5071
+ level: "info",
5072
+ data: { baseUrl, farmsCount: params.farmIds?.length },
5073
+ });
5074
+ const data = await request("/farms/rewards-history/batch", {
5075
+ method: "POST",
5076
+ headers: {
5077
+ "Content-Type": "application/json",
5078
+ },
5079
+ body: JSON.stringify(params),
5080
+ });
5081
+ return data;
5082
+ }
5083
+ catch (error) {
5084
+ sentryCaptureException(error, {
5085
+ action: "fetchFarmWeeklyRewardsBatch",
5086
+ baseUrl,
5087
+ farmsCount: params.farmIds?.length,
5088
+ });
5089
+ throw new Error(parseApiError(error));
5090
+ }
5091
+ };
5092
+ const fetchWalletFarmRewardsHistory = async (walletAddress, query) => {
5093
+ try {
5094
+ if (!walletAddress) {
5095
+ throw new Error("Wallet address is required");
5096
+ }
5097
+ const params = new URLSearchParams();
5098
+ if (query?.startWeek !== undefined)
5099
+ params.set("startWeek", query.startWeek.toString());
5100
+ if (query?.endWeek !== undefined)
5101
+ params.set("endWeek", query.endWeek.toString());
5102
+ const queryString = params.toString();
5103
+ const path = `/farms/by-wallet/${encodeURIComponent(walletAddress)}/farm-rewards-history${queryString ? `?${queryString}` : ""}`;
5104
+ return await request(path);
5105
+ }
5106
+ catch (error) {
5107
+ throw new Error(parseApiError(error));
5108
+ }
5109
+ };
5110
+ const fetchWalletFarmRewardsHistoryBatch = async (params) => {
5111
+ try {
5112
+ sentryAddBreadcrumb({
5113
+ category: "control-api",
5114
+ message: "POST /farms/by-wallet/farm-rewards-history/batch",
5115
+ level: "info",
5116
+ data: { baseUrl, walletsCount: params.wallets?.length },
5117
+ });
5118
+ const data = await request("/farms/by-wallet/farm-rewards-history/batch", {
5119
+ method: "POST",
5120
+ headers: {
5121
+ "Content-Type": "application/json",
5122
+ },
5123
+ body: JSON.stringify(params),
5124
+ });
5125
+ return data;
5126
+ }
5127
+ catch (error) {
5128
+ sentryCaptureException(error, {
5129
+ action: "fetchWalletFarmRewardsHistoryBatch",
5130
+ baseUrl,
5131
+ walletsCount: params.wallets?.length,
5132
+ });
5133
+ throw new Error(parseApiError(error));
5134
+ }
5135
+ };
5046
5136
  return {
5047
5137
  fetchFarmRewardSplits,
5048
5138
  fetchSponsoredFarms,
@@ -5052,6 +5142,9 @@ function FarmsRouter(baseUrl) {
5052
5142
  estimateRewardScoresBatch,
5053
5143
  calculateMiningScoresBatch,
5054
5144
  fetchEfficiencyScores,
5145
+ fetchFarmWeeklyRewardsBatch,
5146
+ fetchWalletFarmRewardsHistory,
5147
+ fetchWalletFarmRewardsHistoryBatch,
5055
5148
  };
5056
5149
  }
5057
5150
 
@@ -5097,4 +5190,4 @@ function calculateFarmEfficiency(protocolDepositUsd6, weeklyImpactAssetsWad) {
5097
5190
  }
5098
5191
 
5099
5192
  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, useRewardsKernel as b, configureSentry as c, REGIONS as d, KICKSTARTER_STATUS as e, calculateFarmEfficiency as f, ForwarderError as g, OffchainFractionsError as h, RewardsKernelError as i, allRegions as j, usStates as k, countries as l, FORWARDER_ABI as m, OFFCHAIN_FRACTIONS_ABI as n, REWARDS_KERNEL_ABI as o, getAddresses as p, GCA_URLS as q, regionMetadata as r, parseViemError as s, parseEthersError as t, useForwarder as u, waitForEthersTransactionWithRetry as v, waitForViemTransactionWithRetry as w };
5100
- //# sourceMappingURL=calculate-farm-efficiency-DF5ehjWL.js.map
5193
+ //# sourceMappingURL=calculate-farm-efficiency-VRzMgQmC.js.map