@huma-finance/widgets 0.0.72-beta.883 → 0.0.72-beta.886

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.
@@ -6526,27 +6526,38 @@ function ApproveLenderBase(_ref) {
6526
6526
  tryAttempts = 0;
6527
6527
  } catch (e) {
6528
6528
  if (tryAttempts === 0) {
6529
- dispatch(setError({
6530
- errorMessage: 'Something went wrong, please try again later.'
6531
- }));
6529
+ throw e;
6532
6530
  } else {
6533
6531
  await shared.timeUtil.sleep(3000);
6534
6532
  console.error(e);
6535
6533
  }
6536
6534
  }
6537
6535
  }
6538
- }, [account, chainId, chainSpecificData, dispatch, documentHash, isDev, networkType]);
6536
+ }, [account, chainId, chainSpecificData, documentHash, isDev, networkType]);
6539
6537
  React.useEffect(() => {
6540
6538
  const approveLenderAsync = async () => {
6541
6539
  if (account && chainId) {
6542
- if (isUniTranche) {
6543
- await approveLender(juniorTrancheVault);
6544
- changeTranche('junior');
6545
- dispatch(setStep(WIDGET_STEP.ChooseAmount));
6546
- } else {
6547
- await approveLender(juniorTrancheVault);
6548
- await approveLender(seniorTrancheVault);
6549
- dispatch(setStep(WIDGET_STEP.ChooseTranche));
6540
+ try {
6541
+ if (isUniTranche) {
6542
+ await approveLender(juniorTrancheVault);
6543
+ changeTranche('junior');
6544
+ dispatch(setStep(WIDGET_STEP.ChooseAmount));
6545
+ } else {
6546
+ await approveLender(juniorTrancheVault);
6547
+ await approveLender(seniorTrancheVault);
6548
+ dispatch(setStep(WIDGET_STEP.ChooseTranche));
6549
+ }
6550
+ } catch (e) {
6551
+ var _e$message;
6552
+ console.error(e);
6553
+ // @ts-ignore
6554
+ let errorMessage = (_e$message = e.message) !== null && _e$message !== void 0 ? _e$message : shared.COMMON_ERROR_MESSAGE;
6555
+ if (errorMessage.indexOf(shared.SOLANA_TRANSACTION_EXPIRED_BLOCKHEIGHT_EXCEEDED_ERROR) >= 0) {
6556
+ errorMessage = "Transaction failed due to blockchain congestion. Please try again.";
6557
+ }
6558
+ dispatch(setError({
6559
+ errorMessage
6560
+ }));
6550
6561
  }
6551
6562
  }
6552
6563
  };