@ape.swap/bonds-sdk 4.6.3-test.0 → 4.6.4

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.
Files changed (2) hide show
  1. package/dist/main.js +4 -6
  2. package/package.json +1 -1
package/dist/main.js CHANGED
@@ -63713,19 +63713,18 @@ const getTokenAllowance = (currency, spender, account, chainId) => __awaiter$9(v
63713
63713
  const useApproval = (amount, currency, spender, account, chainId) => {
63714
63714
  const apiUrl = useURLByEnvironment('apiV2');
63715
63715
  const [confirmingTxOnWallet, setConfirmingTxOnWallet] = useState(false);
63716
- const [txHash, setTxHash] = useState('');
63717
63716
  const { data: allowance, refetch } = useAllowance(currency, spender, account, chainId);
63718
- const { writeContractAsync } = useWriteContract();
63717
+ const { writeContractAsync, data: txHash, reset } = useWriteContract();
63719
63718
  const { isLoading: isConfirming, isSuccess: isConfirmed } = useMonitorTx(txHash, chainId);
63720
63719
  const { addToastError } = usePopups();
63721
63720
  const confirmingTxOnChain = isConfirming && !isConfirmed;
63722
63721
  useEffect(() => {
63723
63722
  if (txHash && isConfirmed) {
63724
63723
  setTimeout(() => {
63725
- setTxHash('');
63726
63724
  refetch();
63727
63725
  console.log('refetch allowance');
63728
- }, 1000);
63726
+ reset();
63727
+ }, 1500);
63729
63728
  }
63730
63729
  /* eslint-disable react-hooks/exhaustive-deps */
63731
63730
  }, [txHash, confirmingTxOnChain, isConfirmed]);
@@ -63751,8 +63750,7 @@ const useApproval = (amount, currency, spender, account, chainId) => {
63751
63750
  });
63752
63751
  setConfirmingTxOnWallet(false);
63753
63752
  // Adding a delay as I suspect RPCs need to catch up as the txs are indexed onchain too fast
63754
- yield new Promise((resolve) => setTimeout(resolve, 1000));
63755
- setTxHash(hash);
63753
+ yield new Promise((resolve) => setTimeout(resolve, 1500));
63756
63754
  return hash;
63757
63755
  }
63758
63756
  catch (error) {
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "Ape Bond SDK",
4
4
  "author": "Ape Bond",
5
5
  "license": "MIT",
6
- "version": "4.6.3-test.0",
6
+ "version": "4.6.4",
7
7
  "module": "dist/main.js",
8
8
  "type": "module",
9
9
  "types": "dist/main.d.ts",