@huma-finance/widgets 0.0.48-beta.296 → 0.0.48-beta.298
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/API.md +69 -22
- package/dist/cjs/index.cjs +2105 -2188
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/index.d.ts +45 -14
- package/dist/index.js +2105 -2189
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
- package/src/components/CreditLine/borrowV2/3-Transfer.tsx +1 -1
- package/src/components/CreditLine/paymentV2/1-ChooseAmount.tsx +5 -0
- package/src/components/InputAmountModal.tsx +32 -5
- package/src/components/Lend/{withdrawV2 → addRedemptionV2}/1-ChooseTranche.tsx +25 -30
- package/src/components/Lend/addRedemptionV2/2-ChooseAmount.tsx +62 -0
- package/src/components/Lend/{redeemV2 → addRedemptionV2}/3-Transfer.tsx +7 -12
- package/src/components/Lend/addRedemptionV2/4-Done.tsx +20 -0
- package/src/components/Lend/addRedemptionV2/index.tsx +172 -0
- package/src/components/Lend/cancelRedemptionV2 /1-Transfer.tsx +51 -0
- package/src/components/Lend/cancelRedemptionV2 /2-Done.tsx +29 -0
- package/src/components/Lend/cancelRedemptionV2 /index.tsx +120 -0
- package/src/components/Lend/supplyV2/1-ChooseTranche.tsx +23 -21
- package/src/components/Lend/supplyV2/3-ChooseAmount.tsx +20 -30
- package/src/components/Lend/supplyV2/4-ApproveAllowance.tsx +2 -15
- package/src/components/Lend/supplyV2/5-Transfer.tsx +14 -58
- package/src/components/Lend/supplyV2/6-Success.tsx +5 -2
- package/src/components/Lend/supplyV2/index.tsx +31 -59
- package/src/components/Lend/withdrawV2/1-ConfirmTransfer.tsx +135 -0
- package/src/components/Lend/withdrawV2/2-Transfer.tsx +50 -0
- package/src/components/Lend/withdrawV2/index.tsx +89 -130
- package/src/index.tsx +44 -15
- package/src/components/Lend/redeemV2/1-ChooseAction.tsx +0 -237
- package/src/components/Lend/redeemV2/2-ChooseAmount.tsx +0 -101
- package/src/components/Lend/redeemV2/4-Done.tsx +0 -33
- package/src/components/Lend/redeemV2/index.tsx +0 -207
- package/src/components/Lend/withdrawV2/2-ChooseAmount.tsx +0 -88
- package/src/components/Lend/withdrawV2/3-Transfer.tsx +0 -110
- /package/src/components/Lend/withdrawV2/{4-Done.tsx → 3-Done.tsx} +0 -0
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import {
|
|
2
|
+
PoolInfoV2,
|
|
3
|
+
TrancheRedemptionStatus,
|
|
4
|
+
TrancheType,
|
|
5
|
+
UnderlyingTokenInfo,
|
|
6
|
+
formatAmount,
|
|
7
|
+
getTrancheVaultContractV2,
|
|
8
|
+
} from '@huma-finance/shared'
|
|
9
|
+
import { Box, Divider, css, useTheme } from '@mui/material'
|
|
10
|
+
import React, { useEffect, useState } from 'react'
|
|
11
|
+
import { useDispatch } from 'react-redux'
|
|
12
|
+
|
|
13
|
+
import { useWeb3React } from '@web3-react/core'
|
|
14
|
+
import { setStep } from '../../../store/widgets.reducers'
|
|
15
|
+
import { WIDGET_STEP } from '../../../store/widgets.store'
|
|
16
|
+
import { BottomButton } from '../../BottomButton'
|
|
17
|
+
import { WrapperModal } from '../../WrapperModal'
|
|
18
|
+
|
|
19
|
+
type Props = {
|
|
20
|
+
poolInfo: PoolInfoV2
|
|
21
|
+
tranche: TrancheType
|
|
22
|
+
poolUnderlyingToken: UnderlyingTokenInfo
|
|
23
|
+
redemptionStatus: TrancheRedemptionStatus
|
|
24
|
+
poolIsClosed: boolean
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function ConfirmTransfer({
|
|
28
|
+
poolInfo,
|
|
29
|
+
tranche,
|
|
30
|
+
poolUnderlyingToken,
|
|
31
|
+
redemptionStatus,
|
|
32
|
+
poolIsClosed,
|
|
33
|
+
}: Props): React.ReactElement {
|
|
34
|
+
const theme = useTheme()
|
|
35
|
+
const dispatch = useDispatch()
|
|
36
|
+
const { provider } = useWeb3React()
|
|
37
|
+
const { symbol, decimals } = poolUnderlyingToken
|
|
38
|
+
const { lenderRedemptionRecords, cancellableRedemptionShares } =
|
|
39
|
+
redemptionStatus
|
|
40
|
+
const { numSharesRequested } = lenderRedemptionRecords
|
|
41
|
+
const sharesProcessed = formatAmount(
|
|
42
|
+
numSharesRequested.sub(cancellableRedemptionShares),
|
|
43
|
+
decimals,
|
|
44
|
+
)
|
|
45
|
+
const withdrawableAmount = formatAmount(
|
|
46
|
+
redemptionStatus.withdrawableAssets,
|
|
47
|
+
decimals,
|
|
48
|
+
)
|
|
49
|
+
const [sharePrice, setSharePrice] = useState(0)
|
|
50
|
+
|
|
51
|
+
useEffect(() => {
|
|
52
|
+
const fetchData = async () => {
|
|
53
|
+
const vaultContract = await getTrancheVaultContractV2(
|
|
54
|
+
poolInfo.poolName,
|
|
55
|
+
tranche,
|
|
56
|
+
provider,
|
|
57
|
+
)
|
|
58
|
+
if (vaultContract) {
|
|
59
|
+
const shares = await vaultContract.convertToShares(
|
|
60
|
+
redemptionStatus.withdrawableAssets,
|
|
61
|
+
)
|
|
62
|
+
setSharePrice(
|
|
63
|
+
redemptionStatus.withdrawableAssets.toNumber() / shares.toNumber(),
|
|
64
|
+
)
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
fetchData()
|
|
68
|
+
}, [
|
|
69
|
+
poolInfo.poolName,
|
|
70
|
+
provider,
|
|
71
|
+
redemptionStatus.withdrawableAssets,
|
|
72
|
+
tranche,
|
|
73
|
+
])
|
|
74
|
+
|
|
75
|
+
const goToWithdraw = () => {
|
|
76
|
+
dispatch(setStep(WIDGET_STEP.Transfer))
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const styles = {
|
|
80
|
+
itemWrapper: css`
|
|
81
|
+
margin-top: ${theme.spacing(9)};
|
|
82
|
+
color: ${theme.palette.text.primary};
|
|
83
|
+
font-family: 'Uni-Neue-Regular';
|
|
84
|
+
font-size: 16px;
|
|
85
|
+
line-height: 175%;
|
|
86
|
+
letter-spacing: 0.15px;
|
|
87
|
+
`,
|
|
88
|
+
item: css`
|
|
89
|
+
display: flex;
|
|
90
|
+
justify-content: space-between;
|
|
91
|
+
align-items: center;
|
|
92
|
+
margin-bottom: ${theme.spacing(3)};
|
|
93
|
+
`,
|
|
94
|
+
itemValue: css`
|
|
95
|
+
font-size: 20px;
|
|
96
|
+
font-family: 'Uni-Neue-Bold';
|
|
97
|
+
`,
|
|
98
|
+
divider: css`
|
|
99
|
+
border-color: #eae6f0;
|
|
100
|
+
margin-bottom: ${theme.spacing(3)};
|
|
101
|
+
`,
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
return (
|
|
105
|
+
<WrapperModal
|
|
106
|
+
title={`Withdraw ${symbol}`}
|
|
107
|
+
subTitle='Withdraw all the available amount'
|
|
108
|
+
>
|
|
109
|
+
<Box css={styles.itemWrapper}>
|
|
110
|
+
{!poolIsClosed && (
|
|
111
|
+
<Box css={styles.item}>
|
|
112
|
+
<Box>Shares processed</Box>
|
|
113
|
+
<Box css={styles.itemValue}>{sharesProcessed}</Box>
|
|
114
|
+
</Box>
|
|
115
|
+
)}
|
|
116
|
+
<Box css={styles.item}>
|
|
117
|
+
<Box>Price Per Share</Box>
|
|
118
|
+
<Box css={styles.itemValue}>
|
|
119
|
+
{sharePrice.toFixed(1)} {symbol}
|
|
120
|
+
</Box>
|
|
121
|
+
</Box>
|
|
122
|
+
<Divider css={styles.divider} orientation='horizontal' />
|
|
123
|
+
<Box css={styles.item}>
|
|
124
|
+
<Box fontWeight={700}>Available to withdraw</Box>
|
|
125
|
+
<Box css={styles.itemValue}>
|
|
126
|
+
{withdrawableAmount} {symbol}
|
|
127
|
+
</Box>
|
|
128
|
+
</Box>
|
|
129
|
+
</Box>
|
|
130
|
+
<BottomButton variant='contained' onClick={goToWithdraw}>
|
|
131
|
+
WITHDRAW
|
|
132
|
+
</BottomButton>
|
|
133
|
+
</WrapperModal>
|
|
134
|
+
)
|
|
135
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import {
|
|
2
|
+
PoolInfoV2,
|
|
3
|
+
TrancheType,
|
|
4
|
+
useTrancheVaultContractV2,
|
|
5
|
+
} from '@huma-finance/shared'
|
|
6
|
+
import { useWeb3React } from '@web3-react/core'
|
|
7
|
+
import React, { useCallback } from 'react'
|
|
8
|
+
|
|
9
|
+
import { useAppDispatch } from '../../../hooks/useRedux'
|
|
10
|
+
import { setStep } from '../../../store/widgets.reducers'
|
|
11
|
+
import { WIDGET_STEP } from '../../../store/widgets.store'
|
|
12
|
+
import { TxSendModalV2 } from '../../TxSendModalV2'
|
|
13
|
+
|
|
14
|
+
type Props = {
|
|
15
|
+
poolInfo: PoolInfoV2
|
|
16
|
+
tranche: TrancheType
|
|
17
|
+
poolIsClosed: boolean
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function Transfer({
|
|
21
|
+
poolInfo,
|
|
22
|
+
tranche,
|
|
23
|
+
poolIsClosed,
|
|
24
|
+
}: Props): React.ReactElement | null {
|
|
25
|
+
const dispatch = useAppDispatch()
|
|
26
|
+
const { account, provider } = useWeb3React()
|
|
27
|
+
const trancheVaultContract = useTrancheVaultContractV2(
|
|
28
|
+
poolInfo.poolName,
|
|
29
|
+
tranche,
|
|
30
|
+
provider,
|
|
31
|
+
account,
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
const handleSuccess = useCallback(() => {
|
|
35
|
+
dispatch(setStep(WIDGET_STEP.Done))
|
|
36
|
+
}, [dispatch])
|
|
37
|
+
|
|
38
|
+
if (!trancheVaultContract || !account) {
|
|
39
|
+
return null
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return (
|
|
43
|
+
<TxSendModalV2
|
|
44
|
+
contract={trancheVaultContract}
|
|
45
|
+
method={poolIsClosed ? 'withdrawAfterPoolClosure' : 'disburse'}
|
|
46
|
+
params={[]}
|
|
47
|
+
handleSuccess={handleSuccess}
|
|
48
|
+
/>
|
|
49
|
+
)
|
|
50
|
+
}
|
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
formatBNFixed,
|
|
2
|
+
getPoolContractV2,
|
|
3
|
+
getTrancheRedemptionStatusV2,
|
|
5
4
|
POOL_NAME,
|
|
6
|
-
|
|
5
|
+
TrancheRedemptionStatus,
|
|
6
|
+
TrancheType,
|
|
7
7
|
usePoolInfoV2,
|
|
8
|
-
usePoolIsReadyForFlcWithdrawalV2,
|
|
9
8
|
usePoolUnderlyingTokenInfoV2,
|
|
10
|
-
useTrancheWithdrawableAssetsV2,
|
|
11
9
|
} from '@huma-finance/shared'
|
|
12
10
|
import { useWeb3React } from '@web3-react/core'
|
|
13
|
-
import { BigNumber } from 'ethers'
|
|
14
11
|
import React, { useCallback, useEffect, useState } from 'react'
|
|
15
12
|
import { useDispatch } from 'react-redux'
|
|
16
13
|
|
|
@@ -20,33 +17,28 @@ import { selectWidgetState } from '../../../store/widgets.selectors'
|
|
|
20
17
|
import { WIDGET_STEP } from '../../../store/widgets.store'
|
|
21
18
|
import { ErrorModal } from '../../ErrorModal'
|
|
22
19
|
import { WidgetWrapper } from '../../WidgetWrapper'
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import { Done } from './4-Done'
|
|
27
|
-
|
|
28
|
-
export type WithdrawType = {
|
|
29
|
-
label: string
|
|
30
|
-
value: string
|
|
31
|
-
type: 'tranche' | 'firstLossCover'
|
|
32
|
-
withdrawableAmount: BigNumber
|
|
33
|
-
}
|
|
20
|
+
import { ConfirmTransfer } from './1-ConfirmTransfer'
|
|
21
|
+
import { Transfer } from './2-Transfer'
|
|
22
|
+
import { Done } from './3-Done'
|
|
34
23
|
|
|
35
24
|
/**
|
|
36
25
|
* Lend pool withdraw props
|
|
37
26
|
* @typedef {Object} LendWithdrawPropsV2
|
|
38
27
|
* @property {POOL_NAME} poolName The name of the pool.
|
|
28
|
+
* @property {TrancheType} trancheType The type of the tranche.
|
|
39
29
|
* @property {function():void} handleClose Function to notify to close the widget modal when user clicks the 'x' close button.
|
|
40
30
|
* @property {function((number|undefined)):void|undefined} handleSuccess Optional function to notify that the lending pool withdraw action is successful.
|
|
41
31
|
*/
|
|
42
32
|
export type LendWithdrawPropsV2 = {
|
|
43
33
|
poolName: keyof typeof POOL_NAME
|
|
34
|
+
trancheType: TrancheType
|
|
44
35
|
handleClose: () => void
|
|
45
36
|
handleSuccess?: (blockNumber?: number) => void
|
|
46
37
|
}
|
|
47
38
|
|
|
48
39
|
export function LendWithdrawV2({
|
|
49
40
|
poolName: poolNameStr,
|
|
41
|
+
trancheType,
|
|
50
42
|
handleClose,
|
|
51
43
|
handleSuccess,
|
|
52
44
|
}: LendWithdrawPropsV2): React.ReactElement | null {
|
|
@@ -55,159 +47,126 @@ export function LendWithdrawV2({
|
|
|
55
47
|
const poolName = POOL_NAME[poolNameStr]
|
|
56
48
|
const poolInfo = usePoolInfoV2(poolName, chainId)
|
|
57
49
|
const { step, errorMessage } = useAppSelector(selectWidgetState)
|
|
58
|
-
const [withdrawTypes, setWithdrawTypes] = useState<WithdrawType[]>([])
|
|
59
|
-
const [selectedWithdrawType, setSelectedWithdrawType] =
|
|
60
|
-
useState<WithdrawType>()
|
|
61
|
-
|
|
62
|
-
const [seniorWithdrawableAmount, refreshSeniorWithdrawableAmount] =
|
|
63
|
-
useTrancheWithdrawableAssetsV2(poolName, 'senior', account, provider)
|
|
64
|
-
const [juniorWithdrawableAmount, refreshJuniorWithdrawableAmount] =
|
|
65
|
-
useTrancheWithdrawableAssetsV2(poolName, 'junior', account, provider)
|
|
66
|
-
const isReadyForFlcWithdrawal = usePoolIsReadyForFlcWithdrawalV2(
|
|
67
|
-
poolName,
|
|
68
|
-
provider,
|
|
69
|
-
)
|
|
70
|
-
const [flcStats, refreshFlcStats] = useFirstLossCoverStatsV2(
|
|
71
|
-
poolName,
|
|
72
|
-
account,
|
|
73
|
-
provider,
|
|
74
|
-
)
|
|
75
|
-
|
|
76
50
|
const poolUnderlyingToken = usePoolUnderlyingTokenInfoV2(poolName, provider)
|
|
77
|
-
const
|
|
51
|
+
const title = poolUnderlyingToken
|
|
52
|
+
? `Withdraw ${poolUnderlyingToken.symbol}`
|
|
53
|
+
: 'Withdraw'
|
|
78
54
|
|
|
79
|
-
const
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
!flcStats
|
|
55
|
+
const [redemptionStatus, setRedemptionStatus] = React.useState<
|
|
56
|
+
TrancheRedemptionStatus | undefined
|
|
57
|
+
>()
|
|
58
|
+
const [poolIsClosed, setPoolIsClosed] = useState<boolean | undefined>(
|
|
59
|
+
undefined,
|
|
60
|
+
)
|
|
86
61
|
|
|
87
62
|
useEffect(() => {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
type: 'tranche',
|
|
98
|
-
withdrawableAmount: seniorWithdrawableAmount,
|
|
99
|
-
})
|
|
63
|
+
const fetchData = async () => {
|
|
64
|
+
if (account && provider) {
|
|
65
|
+
const result = await getTrancheRedemptionStatusV2(
|
|
66
|
+
poolName,
|
|
67
|
+
trancheType,
|
|
68
|
+
account,
|
|
69
|
+
provider,
|
|
70
|
+
)
|
|
71
|
+
setRedemptionStatus(result)
|
|
100
72
|
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
.forEach((flc) => {
|
|
116
|
-
items.push({
|
|
117
|
-
label: `Withdraw ${symbol} from ${capitalizeFirstLetter(
|
|
118
|
-
FirstLossCoverIndex[flc.firstLossCoverIndex],
|
|
119
|
-
)} First Loss Cover`,
|
|
120
|
-
value: String(flc.firstLossCoverIndex),
|
|
121
|
-
type: 'firstLossCover',
|
|
122
|
-
withdrawableAmount: flc.totalAssets,
|
|
123
|
-
})
|
|
124
|
-
})
|
|
73
|
+
}
|
|
74
|
+
fetchData()
|
|
75
|
+
}, [account, poolName, provider, trancheType])
|
|
76
|
+
|
|
77
|
+
useEffect(() => {
|
|
78
|
+
const fetchData = async () => {
|
|
79
|
+
if (account && provider) {
|
|
80
|
+
const result = await getTrancheRedemptionStatusV2(
|
|
81
|
+
poolName,
|
|
82
|
+
trancheType,
|
|
83
|
+
account,
|
|
84
|
+
provider,
|
|
85
|
+
)
|
|
86
|
+
setRedemptionStatus(result)
|
|
125
87
|
}
|
|
88
|
+
}
|
|
89
|
+
fetchData()
|
|
90
|
+
}, [account, poolName, provider, trancheType])
|
|
126
91
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
const
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
} else if (items.length > 1) {
|
|
136
|
-
dispatch(setStep(WIDGET_STEP.ChooseTranche))
|
|
92
|
+
useEffect(() => {
|
|
93
|
+
const fetchData = async () => {
|
|
94
|
+
if (account && provider) {
|
|
95
|
+
const poolContract = await getPoolContractV2(poolName, provider)
|
|
96
|
+
if (poolContract) {
|
|
97
|
+
const poolIsClosed = await poolContract.isPoolClosed()
|
|
98
|
+
setPoolIsClosed(poolIsClosed)
|
|
99
|
+
}
|
|
137
100
|
}
|
|
138
101
|
}
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
step,
|
|
148
|
-
symbol,
|
|
149
|
-
])
|
|
102
|
+
fetchData()
|
|
103
|
+
}, [account, poolName, provider])
|
|
104
|
+
|
|
105
|
+
useEffect(() => {
|
|
106
|
+
if (!step) {
|
|
107
|
+
dispatch(setStep(WIDGET_STEP.ConfirmTransfer))
|
|
108
|
+
}
|
|
109
|
+
}, [dispatch, step])
|
|
150
110
|
|
|
151
111
|
const handleWithdrawSuccess = useCallback(
|
|
152
112
|
(blockNumber: number) => {
|
|
153
|
-
refreshSeniorWithdrawableAmount()
|
|
154
|
-
refreshJuniorWithdrawableAmount()
|
|
155
|
-
refreshFlcStats()
|
|
156
113
|
if (handleSuccess) {
|
|
157
114
|
handleSuccess(blockNumber)
|
|
158
115
|
}
|
|
159
116
|
},
|
|
160
|
-
[
|
|
161
|
-
handleSuccess,
|
|
162
|
-
refreshFlcStats,
|
|
163
|
-
refreshJuniorWithdrawableAmount,
|
|
164
|
-
refreshSeniorWithdrawableAmount,
|
|
165
|
-
],
|
|
117
|
+
[handleSuccess],
|
|
166
118
|
)
|
|
167
119
|
|
|
168
|
-
if (
|
|
169
|
-
|
|
120
|
+
if (
|
|
121
|
+
!poolInfo ||
|
|
122
|
+
!poolUnderlyingToken ||
|
|
123
|
+
!redemptionStatus ||
|
|
124
|
+
poolIsClosed === undefined
|
|
125
|
+
) {
|
|
126
|
+
return (
|
|
127
|
+
<WidgetWrapper
|
|
128
|
+
isOpen
|
|
129
|
+
isLoading
|
|
130
|
+
loadingTitle={title}
|
|
131
|
+
handleClose={handleClose}
|
|
132
|
+
handleSuccess={handleSuccess}
|
|
133
|
+
/>
|
|
134
|
+
)
|
|
170
135
|
}
|
|
171
136
|
|
|
172
137
|
return (
|
|
173
138
|
<WidgetWrapper
|
|
174
139
|
isOpen
|
|
175
|
-
loadingTitle=
|
|
140
|
+
loadingTitle={title}
|
|
176
141
|
handleClose={handleClose}
|
|
177
142
|
handleSuccess={handleWithdrawSuccess}
|
|
178
143
|
>
|
|
179
|
-
{step === WIDGET_STEP.
|
|
180
|
-
<
|
|
181
|
-
poolUnderlyingToken={poolUnderlyingToken}
|
|
182
|
-
selectedWithdrawType={selectedWithdrawType}
|
|
183
|
-
withdrawTypes={withdrawTypes}
|
|
184
|
-
changeWithdrawType={setSelectedWithdrawType}
|
|
185
|
-
/>
|
|
186
|
-
)}
|
|
187
|
-
{step === WIDGET_STEP.ChooseAmount && selectedWithdrawType && (
|
|
188
|
-
<ChooseAmount
|
|
144
|
+
{step === WIDGET_STEP.ConfirmTransfer && (
|
|
145
|
+
<ConfirmTransfer
|
|
189
146
|
poolInfo={poolInfo}
|
|
147
|
+
tranche={trancheType}
|
|
148
|
+
redemptionStatus={redemptionStatus}
|
|
190
149
|
poolUnderlyingToken={poolUnderlyingToken}
|
|
191
|
-
|
|
150
|
+
poolIsClosed={poolIsClosed}
|
|
192
151
|
/>
|
|
193
152
|
)}
|
|
194
|
-
{step === WIDGET_STEP.Transfer &&
|
|
153
|
+
{step === WIDGET_STEP.Transfer && (
|
|
195
154
|
<Transfer
|
|
196
155
|
poolInfo={poolInfo}
|
|
197
|
-
|
|
198
|
-
|
|
156
|
+
tranche={trancheType}
|
|
157
|
+
poolIsClosed={poolIsClosed}
|
|
199
158
|
/>
|
|
200
159
|
)}
|
|
201
|
-
{step === WIDGET_STEP.Done &&
|
|
160
|
+
{step === WIDGET_STEP.Done && (
|
|
202
161
|
<Done
|
|
203
162
|
poolUnderlyingToken={poolUnderlyingToken}
|
|
204
|
-
withdrawAmount={
|
|
163
|
+
withdrawAmount={redemptionStatus.withdrawableAssets}
|
|
205
164
|
handleAction={handleClose}
|
|
206
165
|
/>
|
|
207
166
|
)}
|
|
208
167
|
{step === WIDGET_STEP.Error && (
|
|
209
168
|
<ErrorModal
|
|
210
|
-
title=
|
|
169
|
+
title={title}
|
|
211
170
|
errorReason='Sorry there was an error'
|
|
212
171
|
errorMessage={errorMessage}
|
|
213
172
|
handleOk={handleClose}
|
package/src/index.tsx
CHANGED
|
@@ -48,7 +48,14 @@ import {
|
|
|
48
48
|
InvoiceFactoringPayment,
|
|
49
49
|
InvoiceFactoringPaymentProps,
|
|
50
50
|
} from './components/InvoiceFactoring/payment'
|
|
51
|
-
import {
|
|
51
|
+
import {
|
|
52
|
+
AddRedemptionPropsV2,
|
|
53
|
+
AddRedemptionV2,
|
|
54
|
+
} from './components/Lend/addRedemptionV2'
|
|
55
|
+
import {
|
|
56
|
+
CancelRedemptionPropsV2,
|
|
57
|
+
CancelRedemptionV2,
|
|
58
|
+
} from './components/Lend/cancelRedemptionV2 '
|
|
52
59
|
import { LendSupply, LendSupplyProps } from './components/Lend/supply'
|
|
53
60
|
import { LendSupplyPropsV2, LendSupplyV2 } from './components/Lend/supplyV2'
|
|
54
61
|
import { LendWithdraw, LendWithdrawProps } from './components/Lend/withdraw'
|
|
@@ -60,14 +67,14 @@ import {
|
|
|
60
67
|
ReceivableBackedCreditLineBorrowPropsV2,
|
|
61
68
|
ReceivableBackedCreditLineBorrowV2,
|
|
62
69
|
} from './components/ReceivableBackedCreditLine/borrow'
|
|
63
|
-
import { SuperfluidFactoring } from './components/SuperfluidFactoring'
|
|
64
|
-
import { store } from './store'
|
|
65
|
-
import { themeHuma } from './theme'
|
|
66
|
-
import { WCProps } from './utilTypes'
|
|
67
70
|
import {
|
|
68
71
|
ReceivableBackedCreditLinePaymentPropsV2,
|
|
69
72
|
ReceivableBackedCreditLinePaymentV2,
|
|
70
73
|
} from './components/ReceivableBackedCreditLine/payment'
|
|
74
|
+
import { SuperfluidFactoring } from './components/SuperfluidFactoring'
|
|
75
|
+
import { store } from './store'
|
|
76
|
+
import { themeHuma } from './theme'
|
|
77
|
+
import { WCProps } from './utilTypes'
|
|
71
78
|
|
|
72
79
|
/**
|
|
73
80
|
* Mapping of your JSON-RPC connections indexed by chainId
|
|
@@ -350,7 +357,7 @@ export function LendWithdrawWidget(props: LendWithdrawWidgetProps) {
|
|
|
350
357
|
|
|
351
358
|
/**
|
|
352
359
|
* Lend pool supply widget props V2
|
|
353
|
-
* @typedef {Object}
|
|
360
|
+
* @typedef {Object} LendWithdrawWidgetPropsV2
|
|
354
361
|
* @property {LendWithdrawPropsV2} LendSupplyPropsV2 - Lend pool supply props V2.
|
|
355
362
|
* @property {WidgetProps} WidgetProps - Widget general props.
|
|
356
363
|
*/
|
|
@@ -371,23 +378,45 @@ export function LendWithdrawWidgetV2(props: LendWithdrawWidgetPropsV2) {
|
|
|
371
378
|
}
|
|
372
379
|
|
|
373
380
|
/**
|
|
374
|
-
* Lend pool
|
|
375
|
-
* @typedef {Object}
|
|
376
|
-
* @property {
|
|
381
|
+
* Lend pool add redemption widget props V2
|
|
382
|
+
* @typedef {Object} AddRedemptionWidgetPropsV2
|
|
383
|
+
* @property {AddRedemptionWidgetPropsV2} AddRedemptionWidgetPropsV2 - Lend pool add redemption props V2.
|
|
384
|
+
* @property {WidgetProps} WidgetProps - Widget general props.
|
|
385
|
+
*/
|
|
386
|
+
type AddRedemptionWidgetPropsV2 = AddRedemptionPropsV2 & WidgetProps
|
|
387
|
+
|
|
388
|
+
/**
|
|
389
|
+
* Add redemption widget V2
|
|
390
|
+
*
|
|
391
|
+
* @param {AddRedemptionWidgetPropsV2} props - The lend pool add redemption widget props V2.
|
|
392
|
+
* @returns Lend pool add redemption widget component V2
|
|
393
|
+
*/
|
|
394
|
+
export function AddRedemptionWidgetV2(props: AddRedemptionWidgetPropsV2) {
|
|
395
|
+
return (
|
|
396
|
+
<Widget {...props}>
|
|
397
|
+
<AddRedemptionV2 {...props} />
|
|
398
|
+
</Widget>
|
|
399
|
+
)
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
/**
|
|
403
|
+
* Lend pool cancel redemption widget props V2
|
|
404
|
+
* @typedef {Object} CancelRedemptionWidgetPropsV2
|
|
405
|
+
* @property {CancelRedemptionWidgetPropsV2} CancelRedemptionWidgetPropsV2 - Lend pool cancel redemption props V2.
|
|
377
406
|
* @property {WidgetProps} WidgetProps - Widget general props.
|
|
378
407
|
*/
|
|
379
|
-
type
|
|
408
|
+
type CancelRedemptionWidgetPropsV2 = CancelRedemptionPropsV2 & WidgetProps
|
|
380
409
|
|
|
381
410
|
/**
|
|
382
|
-
*
|
|
411
|
+
* Cancel redemption widget V2
|
|
383
412
|
*
|
|
384
|
-
* @param {
|
|
385
|
-
* @returns Lend pool
|
|
413
|
+
* @param {CancelRedemptionWidgetPropsV2} props - The lend pool cancel redemption widget props V2.
|
|
414
|
+
* @returns Lend pool cancel redemption widget component V2
|
|
386
415
|
*/
|
|
387
|
-
export function
|
|
416
|
+
export function CancelRedemptionWidgetV2(props: CancelRedemptionWidgetPropsV2) {
|
|
388
417
|
return (
|
|
389
418
|
<Widget {...props}>
|
|
390
|
-
<
|
|
419
|
+
<CancelRedemptionV2 {...props} />
|
|
391
420
|
</Widget>
|
|
392
421
|
)
|
|
393
422
|
}
|