@huma-finance/widgets 0.0.51-beta.227 → 0.0.51-beta.231

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
@@ -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,10 +4901,10 @@ 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
- }), step === WIDGET_STEP.ChooseAmount && jsx(ChooseAmount$1, {
4907
+ }), step === WIDGET_STEP.ChooseAmount && lenderPosition && poolBalance && jsx(ChooseAmount$1, {
4906
4908
  poolInfo: poolInfo,
4907
4909
  lenderPosition: lenderPosition,
4908
4910
  poolBalance: poolBalance