@glowlabs-org/utils 0.2.175 → 0.2.176

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-psH9YXnF.js');
3
+ var calculateFarmEfficiency = require('./calculate-farm-efficiency-z9p1HOmd.js');
4
4
  require('decimal.js');
5
5
  var viem = require('viem');
6
6
  require('ethers');
@@ -954,7 +954,9 @@ function useForwarder(signer, CHAIN_ID, publicClient, walletClient) {
954
954
  .staticCall(amount, ADDRESSES.FOUNDATION_WALLET, sendToCounterfactualWallet, message, { from: owner });
955
955
  }
956
956
  else {
957
- await forwarderContract.getFunction("forward").staticCall(tokenAddress, isAuditFees
957
+ await forwarderContract
958
+ .getFunction("forward")
959
+ .staticCall(tokenAddress, isAuditFees
958
960
  ? ADDRESSES.AUDIT_FEE_WALLET
959
961
  : ADDRESSES.FOUNDATION_WALLET, amount, sendToCounterfactualWallet, message, { from: owner });
960
962
  }
@@ -2014,6 +2016,17 @@ function useOffchainFractions(walletClient, publicClient, CHAIN_ID) {
2014
2016
  account: walletClient.account,
2015
2017
  });
2016
2018
  await waitForViemTransactionWithRetry(publicClient, approveHash);
2019
+ // Verify allowance is reflected before proceeding (RPC lag mitigation)
2020
+ const maxAllowanceChecks = 5;
2021
+ const allowanceCheckDelayMs = 500;
2022
+ for (let i = 0; i < maxAllowanceChecks; i++) {
2023
+ const updatedAllowance = await checkTokenAllowance(owner, fractionData.token);
2024
+ if (updatedAllowance >= requiredAmount)
2025
+ break;
2026
+ if (i < maxAllowanceChecks - 1) {
2027
+ await new Promise((r) => setTimeout(r, allowanceCheckDelayMs));
2028
+ }
2029
+ }
2017
2030
  }
2018
2031
  // Run a simulation first to surface any revert reason
2019
2032
  try {
@@ -5521,4 +5534,4 @@ exports.useOffchainFractions = useOffchainFractions;
5521
5534
  exports.useRewardsKernel = useRewardsKernel;
5522
5535
  exports.waitForEthersTransactionWithRetry = waitForEthersTransactionWithRetry;
5523
5536
  exports.waitForViemTransactionWithRetry = waitForViemTransactionWithRetry;
5524
- //# sourceMappingURL=calculate-farm-efficiency-psH9YXnF.js.map
5537
+ //# sourceMappingURL=calculate-farm-efficiency-z9p1HOmd.js.map