@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.
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var calculateFarmEfficiency = require('./calculate-farm-efficiency-DgUyd3Go.js');
3
+ var calculateFarmEfficiency = require('./calculate-farm-efficiency-DIL_hKMo.js');
4
4
  require('decimal.js');
5
5
  var viem = require('viem');
6
6
  require('ethers');
@@ -2924,6 +2924,15 @@ function useRewardsKernel(walletClient, publicClient, CHAIN_ID) {
2924
2924
  }
2925
2925
  // Run a simulation first to surface any revert reason
2926
2926
  try {
2927
+ console.log("Simulating claimPayout with:", {
2928
+ nonce: nonce.toString(),
2929
+ proof: proof,
2930
+ tokensAndAmounts: tokensAndAmounts,
2931
+ from: from,
2932
+ to: to,
2933
+ isGuardedToken: isGuardedToken,
2934
+ toCounterfactual: toCounterfactual,
2935
+ });
2927
2936
  await publicClient.simulateContract({
2928
2937
  address: ADDRESSES.REWARDS_KERNEL,
2929
2938
  abi: REWARDS_KERNEL_ABI,
@@ -2947,6 +2956,7 @@ function useRewardsKernel(walletClient, publicClient, CHAIN_ID) {
2947
2956
  contract: ADDRESSES.REWARDS_KERNEL,
2948
2957
  nonce: nonce.toString(),
2949
2958
  tokensAndAmounts: tokensAndAmounts,
2959
+ proof: proof,
2950
2960
  from: from,
2951
2961
  to: to,
2952
2962
  isGuardedToken: isGuardedToken,
@@ -2954,6 +2964,15 @@ function useRewardsKernel(walletClient, publicClient, CHAIN_ID) {
2954
2964
  });
2955
2965
  throw new Error(parseViemError(simulationError));
2956
2966
  }
2967
+ console.log("Executing claimPayout with:", {
2968
+ nonce: nonce.toString(),
2969
+ proof: proof,
2970
+ tokensAndAmounts: tokensAndAmounts,
2971
+ from: from,
2972
+ to: to,
2973
+ isGuardedToken: isGuardedToken,
2974
+ toCounterfactual: toCounterfactual,
2975
+ });
2957
2976
  // Execute the transaction
2958
2977
  const hash = await walletClient.writeContract({
2959
2978
  address: ADDRESSES.REWARDS_KERNEL,
@@ -2981,6 +3000,7 @@ function useRewardsKernel(walletClient, publicClient, CHAIN_ID) {
2981
3000
  contract: ADDRESSES.REWARDS_KERNEL,
2982
3001
  nonce: params.nonce.toString(),
2983
3002
  from: params.from,
3003
+ proof: params.proof,
2984
3004
  tokensAndAmounts: params.tokensAndAmounts,
2985
3005
  to: params.to,
2986
3006
  isGuardedToken: params.isGuardedToken,
@@ -5045,6 +5065,76 @@ function FarmsRouter(baseUrl) {
5045
5065
  throw new Error(parseApiError(error));
5046
5066
  }
5047
5067
  };
5068
+ const fetchFarmWeeklyRewardsBatch = async (params) => {
5069
+ try {
5070
+ sentryAddBreadcrumb({
5071
+ category: "control-api",
5072
+ message: "POST /farms/rewards-history/batch",
5073
+ level: "info",
5074
+ data: { baseUrl, farmsCount: params.farmIds?.length },
5075
+ });
5076
+ const data = await request("/farms/rewards-history/batch", {
5077
+ method: "POST",
5078
+ headers: {
5079
+ "Content-Type": "application/json",
5080
+ },
5081
+ body: JSON.stringify(params),
5082
+ });
5083
+ return data;
5084
+ }
5085
+ catch (error) {
5086
+ sentryCaptureException(error, {
5087
+ action: "fetchFarmWeeklyRewardsBatch",
5088
+ baseUrl,
5089
+ farmsCount: params.farmIds?.length,
5090
+ });
5091
+ throw new Error(parseApiError(error));
5092
+ }
5093
+ };
5094
+ const fetchWalletFarmRewardsHistory = async (walletAddress, query) => {
5095
+ try {
5096
+ if (!walletAddress) {
5097
+ throw new Error("Wallet address is required");
5098
+ }
5099
+ const params = new URLSearchParams();
5100
+ if (query?.startWeek !== undefined)
5101
+ params.set("startWeek", query.startWeek.toString());
5102
+ if (query?.endWeek !== undefined)
5103
+ params.set("endWeek", query.endWeek.toString());
5104
+ const queryString = params.toString();
5105
+ const path = `/farms/by-wallet/${encodeURIComponent(walletAddress)}/farm-rewards-history${queryString ? `?${queryString}` : ""}`;
5106
+ return await request(path);
5107
+ }
5108
+ catch (error) {
5109
+ throw new Error(parseApiError(error));
5110
+ }
5111
+ };
5112
+ const fetchWalletFarmRewardsHistoryBatch = async (params) => {
5113
+ try {
5114
+ sentryAddBreadcrumb({
5115
+ category: "control-api",
5116
+ message: "POST /farms/by-wallet/farm-rewards-history/batch",
5117
+ level: "info",
5118
+ data: { baseUrl, walletsCount: params.wallets?.length },
5119
+ });
5120
+ const data = await request("/farms/by-wallet/farm-rewards-history/batch", {
5121
+ method: "POST",
5122
+ headers: {
5123
+ "Content-Type": "application/json",
5124
+ },
5125
+ body: JSON.stringify(params),
5126
+ });
5127
+ return data;
5128
+ }
5129
+ catch (error) {
5130
+ sentryCaptureException(error, {
5131
+ action: "fetchWalletFarmRewardsHistoryBatch",
5132
+ baseUrl,
5133
+ walletsCount: params.wallets?.length,
5134
+ });
5135
+ throw new Error(parseApiError(error));
5136
+ }
5137
+ };
5048
5138
  return {
5049
5139
  fetchFarmRewardSplits,
5050
5140
  fetchSponsoredFarms,
@@ -5054,6 +5144,9 @@ function FarmsRouter(baseUrl) {
5054
5144
  estimateRewardScoresBatch,
5055
5145
  calculateMiningScoresBatch,
5056
5146
  fetchEfficiencyScores,
5147
+ fetchFarmWeeklyRewardsBatch,
5148
+ fetchWalletFarmRewardsHistory,
5149
+ fetchWalletFarmRewardsHistoryBatch,
5057
5150
  };
5058
5151
  }
5059
5152
 
@@ -5129,4 +5222,4 @@ exports.useOffchainFractions = useOffchainFractions;
5129
5222
  exports.useRewardsKernel = useRewardsKernel;
5130
5223
  exports.waitForEthersTransactionWithRetry = waitForEthersTransactionWithRetry;
5131
5224
  exports.waitForViemTransactionWithRetry = waitForViemTransactionWithRetry;
5132
- //# sourceMappingURL=calculate-farm-efficiency-DgUyd3Go.js.map
5225
+ //# sourceMappingURL=calculate-farm-efficiency-DIL_hKMo.js.map