@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.
@@ -4920,8 +4920,10 @@ function LendWithdraw(_ref) {
4920
4920
  poolBalance = _usePoolBalance2[0],
4921
4921
  refreshPoolBalance = _usePoolBalance2[1];
4922
4922
  React.useEffect(function () {
4923
- if (!step && lenderPosition && poolBalance) {
4923
+ if (!step && lenderPosition !== null && lenderPosition !== void 0 && lenderPosition.gt(0) && poolBalance !== null && poolBalance !== void 0 && poolBalance.gt(0)) {
4924
4924
  dispatch(setStep(WIDGET_STEP.CheckWithdrawable));
4925
+ } else if (!step && (lenderPosition !== null && lenderPosition !== void 0 && lenderPosition.eq(0) || poolBalance !== null && poolBalance !== void 0 && poolBalance.eq(0))) {
4926
+ dispatch(setStep(WIDGET_STEP.Error));
4925
4927
  }
4926
4928
  }, [dispatch, lenderPosition, poolBalance, step]);
4927
4929
  var handleWithdrawSuccess = React.useCallback(function (blockNumber) {
@@ -4938,10 +4940,10 @@ function LendWithdraw(_ref) {
4938
4940
  isOpen: true,
4939
4941
  handleClose: handleClose,
4940
4942
  handleSuccess: handleWithdrawSuccess,
4941
- children: [(!step || step === WIDGET_STEP.CheckWithdrawable) && jsxRuntime.jsx(CheckWithdrawable, {
4943
+ children: [step === WIDGET_STEP.CheckWithdrawable && jsxRuntime.jsx(CheckWithdrawable, {
4942
4944
  poolInfo: poolInfo,
4943
4945
  handleClose: handleClose
4944
- }), step === WIDGET_STEP.ChooseAmount && jsxRuntime.jsx(ChooseAmount$1, {
4946
+ }), step === WIDGET_STEP.ChooseAmount && lenderPosition && poolBalance && jsxRuntime.jsx(ChooseAmount$1, {
4945
4947
  poolInfo: poolInfo,
4946
4948
  lenderPosition: lenderPosition,
4947
4949
  poolBalance: poolBalance