@huma-finance/widgets 0.0.62-beta.631 → 0.0.62-beta.632

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.
@@ -9800,22 +9800,21 @@ function SolanaBorrow(_ref) {
9800
9800
  handleClose,
9801
9801
  handleSuccess
9802
9802
  } = _ref;
9803
+ const title = 'Borrow';
9803
9804
  const dispatch = reactRedux.useDispatch();
9804
- const {
9805
- creditConfigAccount,
9806
- loading: isLoadingBorrowerAccounts
9807
- } = webShared.useBorrowerAccounts(poolInfo.chainId, poolInfo.poolName);
9808
9805
  const {
9809
9806
  step,
9810
9807
  errorMessage
9811
9808
  } = useAppSelector(selectWidgetState);
9809
+ const {
9810
+ creditConfigAccount
9811
+ } = webShared.useBorrowerAccounts(poolInfo.chainId, poolInfo.poolName);
9812
9812
  React.useEffect(() => {
9813
- if (!step) {
9813
+ if (!step && creditConfigAccount) {
9814
9814
  dispatch(setStep(WIDGET_STEP.ChooseAmount));
9815
9815
  }
9816
- }, [dispatch, step]);
9817
- const title = 'Borrow';
9818
- if (isLoadingBorrowerAccounts) {
9816
+ }, [creditConfigAccount, dispatch, step]);
9817
+ if (!creditConfigAccount) {
9819
9818
  return jsxRuntime.jsx(WidgetWrapper, {
9820
9819
  isOpen: true,
9821
9820
  isLoading: true,
@@ -9973,8 +9972,8 @@ function Done(_ref) {
9973
9972
  const txData = await connection.getTransaction(solanaSignature, {
9974
9973
  maxSupportedTransactionVersion: 2
9975
9974
  });
9976
- const preTokenBalance = txData === null || txData === void 0 || (_txData$meta = txData.meta) === null || _txData$meta === void 0 || (_txData$meta = _txData$meta.preTokenBalances) === null || _txData$meta === void 0 || (_txData$meta = _txData$meta[1]) === null || _txData$meta === void 0 || (_txData$meta = _txData$meta.uiTokenAmount) === null || _txData$meta === void 0 ? void 0 : _txData$meta.uiAmount;
9977
- const postTokenBalance = txData === null || txData === void 0 || (_txData$meta2 = txData.meta) === null || _txData$meta2 === void 0 || (_txData$meta2 = _txData$meta2.postTokenBalances) === null || _txData$meta2 === void 0 || (_txData$meta2 = _txData$meta2[1]) === null || _txData$meta2 === void 0 || (_txData$meta2 = _txData$meta2.uiTokenAmount) === null || _txData$meta2 === void 0 ? void 0 : _txData$meta2.uiAmount;
9975
+ const preTokenBalance = txData === null || txData === void 0 || (_txData$meta = txData.meta) === null || _txData$meta === void 0 || (_txData$meta = _txData$meta.preTokenBalances) === null || _txData$meta === void 0 || (_txData$meta = _txData$meta[0]) === null || _txData$meta === void 0 || (_txData$meta = _txData$meta.uiTokenAmount) === null || _txData$meta === void 0 ? void 0 : _txData$meta.uiAmount;
9976
+ const postTokenBalance = txData === null || txData === void 0 || (_txData$meta2 = txData.meta) === null || _txData$meta2 === void 0 || (_txData$meta2 = _txData$meta2.postTokenBalances) === null || _txData$meta2 === void 0 || (_txData$meta2 = _txData$meta2[0]) === null || _txData$meta2 === void 0 || (_txData$meta2 = _txData$meta2.uiTokenAmount) === null || _txData$meta2 === void 0 ? void 0 : _txData$meta2.uiAmount;
9978
9977
  if (preTokenBalance && postTokenBalance) {
9979
9978
  setTokensPaid(preTokenBalance - postTokenBalance);
9980
9979
  }
@@ -10002,22 +10001,21 @@ function SolanaPayment(_ref) {
10002
10001
  handleClose,
10003
10002
  handleSuccess
10004
10003
  } = _ref;
10004
+ const title = 'Make Payment';
10005
10005
  const dispatch = reactRedux.useDispatch();
10006
- const {
10007
- creditStateAccount,
10008
- loading: isLoadingBorrowerAccounts
10009
- } = webShared.useBorrowerAccounts(poolInfo.chainId, poolInfo.poolName);
10010
10006
  const {
10011
10007
  step,
10012
10008
  errorMessage
10013
10009
  } = useAppSelector(selectWidgetState);
10010
+ const {
10011
+ creditStateAccount
10012
+ } = webShared.useBorrowerAccounts(poolInfo.chainId, poolInfo.poolName);
10014
10013
  React.useEffect(() => {
10015
- if (!step) {
10014
+ if (!step && creditStateAccount) {
10016
10015
  dispatch(setStep(WIDGET_STEP.ChooseAmount));
10017
10016
  }
10018
- }, [dispatch, step]);
10019
- const title = 'Make Payment';
10020
- if (isLoadingBorrowerAccounts) {
10017
+ }, [creditStateAccount, dispatch, step]);
10018
+ if (!creditStateAccount) {
10021
10019
  return jsxRuntime.jsx(WidgetWrapper, {
10022
10020
  isOpen: true,
10023
10021
  isLoading: true,