@huma-finance/widgets 0.0.51-beta.225 → 0.0.51-beta.229

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.51-beta.225+183e157",
3
+ "version": "0.0.51-beta.229+ca63449",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -30,8 +30,8 @@
30
30
  "@ethersproject/experimental": "^5.7.0",
31
31
  "@ethersproject/providers": "^5.6.0",
32
32
  "@ethersproject/units": "^5.6.0",
33
- "@huma-finance/sdk": "^0.0.51-beta.225+183e157",
34
- "@huma-finance/shared": "^0.0.51-beta.225+183e157",
33
+ "@huma-finance/sdk": "^0.0.50",
34
+ "@huma-finance/shared": "^0.0.50",
35
35
  "@mui/icons-material": "^5.3.0",
36
36
  "@mui/material": "^5.0.6",
37
37
  "@mui/styles": "^5.0.2",
@@ -192,5 +192,5 @@
192
192
  "optionalDependencies": {
193
193
  "encoding": "^0.1.13"
194
194
  },
195
- "gitHead": "183e157b85825c42f2dc40025014ea1770fe6449"
195
+ "gitHead": "ca63449ec2719b4d17e38c4b8ad65b4ee8514481"
196
196
  }
@@ -6,6 +6,7 @@ import {
6
6
  useCLPoolAllowance,
7
7
  } from '@huma-finance/shared'
8
8
  import React, { useCallback, useEffect, useState } from 'react'
9
+ import { BigNumber } from 'ethers'
9
10
 
10
11
  import { useAppDispatch } from '../../../hooks/useRedux'
11
12
  import { setPaymentAmount, setStep } from '../../../store/widgets.reducers'
@@ -43,8 +44,8 @@ export function ChooseAmount({
43
44
  )
44
45
 
45
46
  const handleAction = useCallback(() => {
46
- const payAmount = upScale(currentAmount, decimals)
47
- const step = toBigNumber(payAmount).gt(allowance)
47
+ const payAmount = upScale<BigNumber>(toBigNumber(currentAmount), decimals)
48
+ const step = payAmount.gt(allowance)
48
49
  ? WIDGET_STEP.ApproveAllowance
49
50
  : WIDGET_STEP.Transfer
50
51
  dispatch(setStep(step))
@@ -1,6 +1,7 @@
1
1
  import { useWeb3React } from '@web3-react/core'
2
2
  import { PoolInfoType, toBigNumber, upScale } from '@huma-finance/shared'
3
3
  import React, { useCallback } from 'react'
4
+ import { BigNumber } from 'ethers'
4
5
 
5
6
  import { useAppDispatch, useAppSelector } from '../../../hooks/useRedux'
6
7
  import { selectWidgetState } from '../../../store/widgets.selectors'
@@ -17,7 +18,10 @@ export function Transfer({ poolInfo }: Props): React.ReactElement {
17
18
  const { account } = useWeb3React()
18
19
  const { paymentAmount } = useAppSelector(selectWidgetState)
19
20
  const { decimals } = poolInfo.poolUnderlyingToken
20
- const paymentBigNumber = toBigNumber(upScale(paymentAmount!, decimals))
21
+ const paymentBigNumber = upScale<BigNumber>(
22
+ toBigNumber(paymentAmount!),
23
+ decimals,
24
+ )
21
25
 
22
26
  const handleSuccess = useCallback(() => {
23
27
  dispatch(setStep(WIDGET_STEP.Done))
@@ -84,11 +84,11 @@ export function LendWithdraw({
84
84
  {(!step || step === WIDGET_STEP.CheckWithdrawable) && (
85
85
  <CheckWithdrawable poolInfo={poolInfo} handleClose={handleClose} />
86
86
  )}
87
- {step === WIDGET_STEP.ChooseAmount && (
87
+ {step === WIDGET_STEP.ChooseAmount && lenderPosition && poolBalance && (
88
88
  <ChooseAmount
89
89
  poolInfo={poolInfo}
90
- lenderPosition={lenderPosition!}
91
- poolBalance={poolBalance!}
90
+ lenderPosition={lenderPosition}
91
+ poolBalance={poolBalance}
92
92
  />
93
93
  )}
94
94
  {step === WIDGET_STEP.Transfer && <Transfer poolInfo={poolInfo} />}