@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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@huma-finance/widgets",
3
- "version": "0.0.62-beta.631+5e2c988",
3
+ "version": "0.0.62-beta.632+7821904",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -29,9 +29,9 @@
29
29
  "@ethersproject/experimental": "^5.7.0",
30
30
  "@ethersproject/providers": "^5.6.0",
31
31
  "@ethersproject/units": "^5.6.0",
32
- "@huma-finance/sdk": "^0.0.62-beta.631+5e2c988",
33
- "@huma-finance/shared": "^0.0.62-beta.631+5e2c988",
34
- "@huma-finance/web-shared": "^0.0.62-beta.631+5e2c988",
32
+ "@huma-finance/sdk": "^0.0.62-beta.632+7821904",
33
+ "@huma-finance/shared": "^0.0.62-beta.632+7821904",
34
+ "@huma-finance/web-shared": "^0.0.62-beta.632+7821904",
35
35
  "@mui/icons-material": "^5.3.0",
36
36
  "@mui/material": "^5.0.6",
37
37
  "@mui/styles": "^5.0.2",
@@ -207,5 +207,5 @@
207
207
  "optionalDependencies": {
208
208
  "encoding": "^0.1.13"
209
209
  },
210
- "gitHead": "5e2c98866579b41a5f89c603211b4ec11d9a78da"
210
+ "gitHead": "7821904f16b9e15eede83b80acf1432f4554550c"
211
211
  }
@@ -33,18 +33,21 @@ export function SolanaBorrow({
33
33
  handleClose,
34
34
  handleSuccess,
35
35
  }: SolanaBorrowProps): React.ReactElement | null {
36
+ const title = 'Borrow'
36
37
  const dispatch = useDispatch()
37
- const { creditConfigAccount, loading: isLoadingBorrowerAccounts } =
38
- useBorrowerAccounts(poolInfo.chainId, poolInfo.poolName)
39
38
  const { step, errorMessage } = useAppSelector(selectWidgetState)
39
+ const { creditConfigAccount } = useBorrowerAccounts(
40
+ poolInfo.chainId,
41
+ poolInfo.poolName,
42
+ )
43
+
40
44
  useEffect(() => {
41
- if (!step) {
45
+ if (!step && creditConfigAccount) {
42
46
  dispatch(setStep(WIDGET_STEP.ChooseAmount))
43
47
  }
44
- }, [dispatch, step])
48
+ }, [creditConfigAccount, dispatch, step])
45
49
 
46
- const title = 'Borrow'
47
- if (isLoadingBorrowerAccounts) {
50
+ if (!creditConfigAccount) {
48
51
  return (
49
52
  <WidgetWrapper
50
53
  isOpen
@@ -28,9 +28,10 @@ export function Done({ poolInfo, handleAction }: Props): React.ReactElement {
28
28
  })
29
29
 
30
30
  const preTokenBalance =
31
- txData?.meta?.preTokenBalances?.[1]?.uiTokenAmount?.uiAmount
31
+ txData?.meta?.preTokenBalances?.[0]?.uiTokenAmount?.uiAmount
32
32
  const postTokenBalance =
33
- txData?.meta?.postTokenBalances?.[1]?.uiTokenAmount?.uiAmount
33
+ txData?.meta?.postTokenBalances?.[0]?.uiTokenAmount?.uiAmount
34
+
34
35
  if (preTokenBalance && postTokenBalance) {
35
36
  setTokensPaid(preTokenBalance - postTokenBalance)
36
37
  }
@@ -30,18 +30,21 @@ export function SolanaPayment({
30
30
  handleClose,
31
31
  handleSuccess,
32
32
  }: SolanaPaymentProps): React.ReactElement | null {
33
+ const title = 'Make Payment'
33
34
  const dispatch = useDispatch()
34
- const { creditStateAccount, loading: isLoadingBorrowerAccounts } =
35
- useBorrowerAccounts(poolInfo.chainId, poolInfo.poolName)
36
35
  const { step, errorMessage } = useAppSelector(selectWidgetState)
36
+ const { creditStateAccount } = useBorrowerAccounts(
37
+ poolInfo.chainId,
38
+ poolInfo.poolName,
39
+ )
40
+
37
41
  useEffect(() => {
38
- if (!step) {
42
+ if (!step && creditStateAccount) {
39
43
  dispatch(setStep(WIDGET_STEP.ChooseAmount))
40
44
  }
41
- }, [dispatch, step])
45
+ }, [creditStateAccount, dispatch, step])
42
46
 
43
- const title = 'Make Payment'
44
- if (isLoadingBorrowerAccounts) {
47
+ if (!creditStateAccount) {
45
48
  return (
46
49
  <WidgetWrapper
47
50
  isOpen