@huma-finance/widgets 0.0.51-beta.229 → 0.0.51-beta.233

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.
package/dist/index.js CHANGED
@@ -4807,7 +4807,7 @@ function Transfer$1(_ref) {
4807
4807
  var decimals = poolInfo.poolUnderlyingToken.decimals;
4808
4808
  var _useAppSelector = useAppSelector(selectWidgetState),
4809
4809
  withdrawAmount = _useAppSelector.withdrawAmount;
4810
- var withdrawBigNumber = toBigNumber(upScale(withdrawAmount, decimals));
4810
+ var withdrawBigNumber = upScale(toBigNumber(withdrawAmount), decimals);
4811
4811
  var handleSuccess = useCallback(function () {
4812
4812
  dispatch(setStep(WIDGET_STEP.Done));
4813
4813
  }, [dispatch]);
@@ -4881,8 +4881,10 @@ function LendWithdraw(_ref) {
4881
4881
  poolBalance = _usePoolBalance2[0],
4882
4882
  refreshPoolBalance = _usePoolBalance2[1];
4883
4883
  useEffect(function () {
4884
- if (!step && lenderPosition && poolBalance) {
4884
+ if (!step && lenderPosition !== null && lenderPosition !== void 0 && lenderPosition.gt(0) && poolBalance !== null && poolBalance !== void 0 && poolBalance.gt(0)) {
4885
4885
  dispatch(setStep(WIDGET_STEP.CheckWithdrawable));
4886
+ } else if (!step && (lenderPosition !== null && lenderPosition !== void 0 && lenderPosition.eq(0) || poolBalance !== null && poolBalance !== void 0 && poolBalance.eq(0))) {
4887
+ dispatch(setStep(WIDGET_STEP.Error));
4886
4888
  }
4887
4889
  }, [dispatch, lenderPosition, poolBalance, step]);
4888
4890
  var handleWithdrawSuccess = useCallback(function (blockNumber) {
@@ -4899,7 +4901,7 @@ function LendWithdraw(_ref) {
4899
4901
  isOpen: true,
4900
4902
  handleClose: handleClose,
4901
4903
  handleSuccess: handleWithdrawSuccess,
4902
- children: [(!step || step === WIDGET_STEP.CheckWithdrawable) && jsx(CheckWithdrawable, {
4904
+ children: [step === WIDGET_STEP.CheckWithdrawable && jsx(CheckWithdrawable, {
4903
4905
  poolInfo: poolInfo,
4904
4906
  handleClose: handleClose
4905
4907
  }), step === WIDGET_STEP.ChooseAmount && lenderPosition && poolBalance && jsx(ChooseAmount$1, {