@huma-finance/widgets 0.0.62-beta.630 → 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.
package/dist/index.js CHANGED
@@ -9783,22 +9783,21 @@ function SolanaBorrow(_ref) {
9783
9783
  handleClose,
9784
9784
  handleSuccess
9785
9785
  } = _ref;
9786
+ const title = 'Borrow';
9786
9787
  const dispatch = useDispatch();
9787
- const {
9788
- creditConfigAccount,
9789
- loading: isLoadingBorrowerAccounts
9790
- } = useBorrowerAccounts(poolInfo.chainId, poolInfo.poolName);
9791
9788
  const {
9792
9789
  step,
9793
9790
  errorMessage
9794
9791
  } = useAppSelector(selectWidgetState);
9792
+ const {
9793
+ creditConfigAccount
9794
+ } = useBorrowerAccounts(poolInfo.chainId, poolInfo.poolName);
9795
9795
  useEffect(() => {
9796
- if (!step) {
9796
+ if (!step && creditConfigAccount) {
9797
9797
  dispatch(setStep(WIDGET_STEP.ChooseAmount));
9798
9798
  }
9799
- }, [dispatch, step]);
9800
- const title = 'Borrow';
9801
- if (isLoadingBorrowerAccounts) {
9799
+ }, [creditConfigAccount, dispatch, step]);
9800
+ if (!creditConfigAccount) {
9802
9801
  return jsx(WidgetWrapper, {
9803
9802
  isOpen: true,
9804
9803
  isLoading: true,
@@ -9956,8 +9955,8 @@ function Done(_ref) {
9956
9955
  const txData = await connection.getTransaction(solanaSignature, {
9957
9956
  maxSupportedTransactionVersion: 2
9958
9957
  });
9959
- 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;
9960
- 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;
9958
+ 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;
9959
+ 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;
9961
9960
  if (preTokenBalance && postTokenBalance) {
9962
9961
  setTokensPaid(preTokenBalance - postTokenBalance);
9963
9962
  }
@@ -9985,22 +9984,21 @@ function SolanaPayment(_ref) {
9985
9984
  handleClose,
9986
9985
  handleSuccess
9987
9986
  } = _ref;
9987
+ const title = 'Make Payment';
9988
9988
  const dispatch = useDispatch();
9989
- const {
9990
- creditStateAccount,
9991
- loading: isLoadingBorrowerAccounts
9992
- } = useBorrowerAccounts(poolInfo.chainId, poolInfo.poolName);
9993
9989
  const {
9994
9990
  step,
9995
9991
  errorMessage
9996
9992
  } = useAppSelector(selectWidgetState);
9993
+ const {
9994
+ creditStateAccount
9995
+ } = useBorrowerAccounts(poolInfo.chainId, poolInfo.poolName);
9997
9996
  useEffect(() => {
9998
- if (!step) {
9997
+ if (!step && creditStateAccount) {
9999
9998
  dispatch(setStep(WIDGET_STEP.ChooseAmount));
10000
9999
  }
10001
- }, [dispatch, step]);
10002
- const title = 'Make Payment';
10003
- if (isLoadingBorrowerAccounts) {
10000
+ }, [creditStateAccount, dispatch, step]);
10001
+ if (!creditStateAccount) {
10004
10002
  return jsx(WidgetWrapper, {
10005
10003
  isOpen: true,
10006
10004
  isLoading: true,