@huma-finance/widgets 0.0.80 → 0.0.81-beta.1108
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 +0 -11
- package/dist/index.js +60790 -64401
- package/dist/src/components/Lend/solanaSupply/6-Transfer.d.ts +2 -3
- package/dist/src/components/Lend/solanaSupply/7-Success.d.ts +1 -4
- package/dist/src/components/Lend/solanaSupply/index.d.ts +1 -7
- package/dist/src/components/Lend/stellarSupply/index.d.ts +0 -4
- package/dist/src/components/Lend/supply/1-Evaluation.d.ts +8 -0
- package/dist/src/components/Lend/supplyV2/6-Transfer.d.ts +2 -5
- package/dist/src/components/Lend/supplyV2/7-Success.d.ts +1 -3
- package/dist/src/components/Lend/supplyV2/8-Notifications.d.ts +1 -3
- package/dist/src/components/Lend/supplyV2/index.d.ts +1 -9
- package/dist/src/hooks/useEA.d.ts +0 -2
- package/dist/src/store/widgets.reducers.d.ts +1 -2
- package/dist/src/store/widgets.store.d.ts +0 -4
- package/package.json +6 -6
- package/src/components/CreditLine/borrow/1-Evaluation.tsx +1 -11
- package/src/components/InvoiceFactoring/borrow/1-Evaluation.tsx +1 -10
- package/src/components/Lend/solanaSupply/6-Transfer.tsx +4 -34
- package/src/components/Lend/solanaSupply/7-Success.tsx +2 -16
- package/src/components/Lend/solanaSupply/index.tsx +1 -66
- package/src/components/Lend/stellarSupply/index.tsx +0 -5
- package/src/components/Lend/supply/{1-Evaluation/EvaluationEA.tsx → 1-Evaluation.tsx} +9 -9
- package/src/components/Lend/supply/index.tsx +0 -1
- package/src/components/Lend/supplyV2/6-Transfer.tsx +7 -35
- package/src/components/Lend/supplyV2/7-Success.tsx +2 -18
- package/src/components/Lend/supplyV2/8-Notifications.tsx +3 -26
- package/src/components/Lend/supplyV2/index.tsx +15 -72
- package/src/components/SolanaTxSendModal.tsx +1 -1
- package/src/components/StreamFactoring/borrow/1-Evaluation.tsx +1 -10
- package/src/hooks/useEA.ts +4 -22
- package/src/store/widgets.reducers.ts +0 -7
- package/src/store/widgets.store.ts +0 -4
- package/vite.config.ts +1 -1
- package/dist/src/components/Lend/components/ApproveLenderBase.d.ts +0 -14
- package/dist/src/components/Lend/components/PersonaEvaluation.d.ts +0 -17
- package/dist/src/components/Lend/components/SecuritizeEvaluation.d.ts +0 -8
- package/dist/src/components/Lend/solanaSupply/1-Evaluation.d.ts +0 -12
- package/dist/src/components/Lend/solanaSupply/2-ApproveLender.d.ts +0 -10
- package/dist/src/components/Lend/solanaSupply/8-PointsEarned.d.ts +0 -11
- package/dist/src/components/Lend/supply/1-Evaluation/EvaluationEA.d.ts +0 -8
- package/dist/src/components/Lend/supply/1-Evaluation/EvaluationKYC.d.ts +0 -8
- package/dist/src/components/Lend/supply/1-Evaluation/index.d.ts +0 -9
- package/dist/src/components/Lend/supplyV2/2-Evaluation.d.ts +0 -12
- package/dist/src/components/Lend/supplyV2/3-ApproveLender.d.ts +0 -10
- package/dist/src/components/PointsEarned.d.ts +0 -10
- package/dist/src/components/SignIn.d.ts +0 -6
- package/dist/src/cosmos/CreditLineBorrow.fixture.d.ts +0 -2
- package/dist/src/cosmos/CreditLinePayment.fixture.d.ts +0 -2
- package/dist/src/cosmos/InvoiceFactoringBorrow.fixture.d.ts +0 -2
- package/dist/src/cosmos/InvoiceFactoringPayment.fixture.d.ts +0 -2
- package/dist/src/cosmos/LendSupply.fixture.d.ts +0 -2
- package/dist/src/cosmos/LendWithdraw.fixture.d.ts +0 -2
- package/dist/src/cosmos/SDKTesting.fixture.d.ts +0 -2
- package/dist/src/cosmos/SuperfluidFactoringBorrow.fixture.d.ts +0 -2
- package/dist/src/cosmos/WalletWrapper.d.ts +0 -3
- package/dist/src/cosmos/utils/index.d.ts +0 -18
- package/src/components/Lend/components/ApproveLenderBase.tsx +0 -128
- package/src/components/Lend/components/PersonaEvaluation.tsx +0 -371
- package/src/components/Lend/components/SecuritizeEvaluation.tsx +0 -343
- package/src/components/Lend/solanaSupply/1-Evaluation.tsx +0 -43
- package/src/components/Lend/solanaSupply/2-ApproveLender.tsx +0 -45
- package/src/components/Lend/solanaSupply/8-PointsEarned.tsx +0 -189
- package/src/components/Lend/supply/1-Evaluation/EvaluationKYC.tsx +0 -369
- package/src/components/Lend/supply/1-Evaluation/index.tsx +0 -31
- package/src/components/Lend/supplyV2/2-Evaluation.tsx +0 -47
- package/src/components/Lend/supplyV2/3-ApproveLender.tsx +0 -35
- package/src/components/PointsEarned.tsx +0 -135
- package/src/components/SignIn.tsx +0 -53
|
@@ -1,17 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
NETWORK_TYPE,
|
|
4
|
-
PoolInfoV2,
|
|
5
|
-
TrancheType,
|
|
6
|
-
} from '@huma-finance/shared'
|
|
7
|
-
import { checkIsDev, useTrancheVaultContractV2 } from '@huma-finance/web-shared'
|
|
1
|
+
import { PoolInfoV2, TrancheType } from '@huma-finance/shared'
|
|
2
|
+
import { useTrancheVaultContractV2 } from '@huma-finance/web-shared'
|
|
8
3
|
import { useWeb3React } from '@web3-react/core'
|
|
9
4
|
import { ethers } from 'ethers'
|
|
10
5
|
import React, { useCallback } from 'react'
|
|
11
6
|
|
|
12
|
-
import { Campaign } from '.'
|
|
13
7
|
import { useAppDispatch, useAppSelector } from '../../../hooks/useRedux'
|
|
14
|
-
import {
|
|
8
|
+
import { setStep } from '../../../store/widgets.reducers'
|
|
15
9
|
import { selectWidgetState } from '../../../store/widgets.selectors'
|
|
16
10
|
import { WIDGET_STEP } from '../../../store/widgets.store'
|
|
17
11
|
import { TxSendModalV2 } from '../../TxSendModalV2'
|
|
@@ -19,19 +13,14 @@ import { TxSendModalV2 } from '../../TxSendModalV2'
|
|
|
19
13
|
type Props = {
|
|
20
14
|
poolInfo: PoolInfoV2
|
|
21
15
|
trancheType: TrancheType
|
|
22
|
-
networkType: NETWORK_TYPE
|
|
23
|
-
campaign?: Campaign
|
|
24
16
|
}
|
|
25
17
|
|
|
26
18
|
export function Transfer({
|
|
27
19
|
poolInfo,
|
|
28
20
|
trancheType,
|
|
29
|
-
networkType,
|
|
30
|
-
campaign,
|
|
31
21
|
}: Props): React.ReactElement | null {
|
|
32
|
-
const isDev = checkIsDev()
|
|
33
22
|
const dispatch = useAppDispatch()
|
|
34
|
-
const { account,
|
|
23
|
+
const { account, provider } = useWeb3React()
|
|
35
24
|
const { supplyAmount } = useAppSelector(selectWidgetState)
|
|
36
25
|
const { decimals } = poolInfo.poolUnderlyingToken
|
|
37
26
|
const supplyBigNumber = ethers.utils.parseUnits(
|
|
@@ -45,26 +34,9 @@ export function Transfer({
|
|
|
45
34
|
account,
|
|
46
35
|
)
|
|
47
36
|
|
|
48
|
-
const handleSuccess = useCallback(
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
try {
|
|
52
|
-
const result = await CampaignService.updateHumaAccountPoints(
|
|
53
|
-
account!,
|
|
54
|
-
options.txHash,
|
|
55
|
-
chainId!,
|
|
56
|
-
networkType,
|
|
57
|
-
isDev,
|
|
58
|
-
)
|
|
59
|
-
dispatch(setPointsAccumulated(result.pointsAccumulated))
|
|
60
|
-
} catch (error) {
|
|
61
|
-
console.error('Failed to update wallet rewards', error)
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
dispatch(setStep(WIDGET_STEP.Done))
|
|
65
|
-
},
|
|
66
|
-
[account, campaign, chainId, dispatch, isDev, networkType],
|
|
67
|
-
)
|
|
37
|
+
const handleSuccess = useCallback(() => {
|
|
38
|
+
dispatch(setStep(WIDGET_STEP.Done))
|
|
39
|
+
}, [dispatch])
|
|
68
40
|
|
|
69
41
|
if (!trancheVaultContract || !account) {
|
|
70
42
|
return null
|
|
@@ -13,7 +13,6 @@ import React, { useCallback, useEffect, useState } from 'react'
|
|
|
13
13
|
import { useDispatch } from 'react-redux'
|
|
14
14
|
|
|
15
15
|
import dayjs from 'dayjs'
|
|
16
|
-
import { Campaign } from '.'
|
|
17
16
|
import {
|
|
18
17
|
useDoesChainSupportNotifi,
|
|
19
18
|
useIsFirstTimeNotifiUser,
|
|
@@ -25,14 +24,12 @@ import { TxDoneModal } from '../../TxDoneModal'
|
|
|
25
24
|
type Props = {
|
|
26
25
|
poolInfo: PoolInfoV2
|
|
27
26
|
lpConfig: { withdrawalLockoutPeriodInDays: number }
|
|
28
|
-
campaign?: Campaign
|
|
29
27
|
handleAction: () => void
|
|
30
28
|
}
|
|
31
29
|
|
|
32
30
|
export function Success({
|
|
33
31
|
poolInfo,
|
|
34
32
|
lpConfig,
|
|
35
|
-
campaign,
|
|
36
33
|
handleAction,
|
|
37
34
|
}: Props): React.ReactElement {
|
|
38
35
|
const dispatch = useDispatch()
|
|
@@ -64,18 +61,10 @@ export function Success({
|
|
|
64
61
|
const handleUserAction = useCallback(() => {
|
|
65
62
|
if (isFirstTimeNotifiUser && notifiChainSupported) {
|
|
66
63
|
dispatch(setStep(WIDGET_STEP.Notifications))
|
|
67
|
-
} else if (campaign) {
|
|
68
|
-
dispatch(setStep(WIDGET_STEP.PointsEarned))
|
|
69
64
|
} else {
|
|
70
65
|
handleAction()
|
|
71
66
|
}
|
|
72
|
-
}, [
|
|
73
|
-
campaign,
|
|
74
|
-
dispatch,
|
|
75
|
-
handleAction,
|
|
76
|
-
isFirstTimeNotifiUser,
|
|
77
|
-
notifiChainSupported,
|
|
78
|
-
])
|
|
67
|
+
}, [dispatch, handleAction, isFirstTimeNotifiUser, notifiChainSupported])
|
|
79
68
|
|
|
80
69
|
const content = [
|
|
81
70
|
`You successfully supplied ${formatMoney(supplyAmount)} ${symbol}.`,
|
|
@@ -95,12 +84,7 @@ export function Success({
|
|
|
95
84
|
]
|
|
96
85
|
}
|
|
97
86
|
|
|
98
|
-
const getButtonText = () =>
|
|
99
|
-
if (hasNextStep) {
|
|
100
|
-
return "WHAT'S NEXT"
|
|
101
|
-
}
|
|
102
|
-
return campaign ? 'VIEW REWARDS' : undefined
|
|
103
|
-
}
|
|
87
|
+
const getButtonText = () => (hasNextStep ? "WHAT'S NEXT" : undefined)
|
|
104
88
|
|
|
105
89
|
return (
|
|
106
90
|
<TxDoneModal
|
|
@@ -1,34 +1,11 @@
|
|
|
1
|
-
import React
|
|
2
|
-
import { useDispatch } from 'react-redux'
|
|
1
|
+
import React from 'react'
|
|
3
2
|
|
|
4
|
-
import { Campaign } from '.'
|
|
5
3
|
import { NotifiSubscriptionModal } from '../../Notifi/NotifiSubscriptionModal'
|
|
6
|
-
import { setStep } from '../../../store/widgets.reducers'
|
|
7
|
-
import { WIDGET_STEP } from '../../../store/widgets.store'
|
|
8
4
|
|
|
9
5
|
type Props = {
|
|
10
|
-
campaign?: Campaign
|
|
11
6
|
handleAction: () => void
|
|
12
7
|
}
|
|
13
8
|
|
|
14
|
-
export function Notifications({
|
|
15
|
-
|
|
16
|
-
handleAction,
|
|
17
|
-
}: Props): React.ReactElement {
|
|
18
|
-
const dispatch = useDispatch()
|
|
19
|
-
|
|
20
|
-
const handleUserAction = useCallback(() => {
|
|
21
|
-
if (campaign) {
|
|
22
|
-
dispatch(setStep(WIDGET_STEP.PointsEarned))
|
|
23
|
-
} else {
|
|
24
|
-
handleAction()
|
|
25
|
-
}
|
|
26
|
-
}, [campaign, dispatch, handleAction])
|
|
27
|
-
|
|
28
|
-
return (
|
|
29
|
-
<NotifiSubscriptionModal
|
|
30
|
-
successText={campaign ? 'VIEW POINTS' : undefined}
|
|
31
|
-
handleSuccess={handleUserAction}
|
|
32
|
-
/>
|
|
33
|
-
)
|
|
9
|
+
export function Notifications({ handleAction }: Props): React.ReactElement {
|
|
10
|
+
return <NotifiSubscriptionModal handleSuccess={handleAction} />
|
|
34
11
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CloseModalOptions,
|
|
3
|
-
getEvmNetworkType,
|
|
4
3
|
openInNewTab,
|
|
5
4
|
POOL_NAME,
|
|
6
5
|
TrancheType,
|
|
@@ -19,43 +18,29 @@ import { setStep } from '../../../store/widgets.reducers'
|
|
|
19
18
|
import { selectWidgetState } from '../../../store/widgets.selectors'
|
|
20
19
|
import { WIDGET_STEP } from '../../../store/widgets.store'
|
|
21
20
|
import { ErrorModal } from '../../ErrorModal'
|
|
22
|
-
import { PointsEarned } from '../../PointsEarned'
|
|
23
21
|
import { WidgetWrapper } from '../../WidgetWrapper'
|
|
24
22
|
import { ChooseTranche } from './1-ChooseTranche'
|
|
25
|
-
import { Evaluation } from './2-Evaluation'
|
|
26
|
-
import { ApproveLender } from './3-ApproveLender'
|
|
27
23
|
import { ChooseAmount } from './4-ChooseAmount'
|
|
28
24
|
import { ApproveAllowance } from './5-ApproveAllowance'
|
|
29
25
|
import { Transfer } from './6-Transfer'
|
|
30
26
|
import { Success } from './7-Success'
|
|
31
27
|
import { Notifications } from './8-Notifications'
|
|
32
28
|
|
|
33
|
-
export interface Campaign {
|
|
34
|
-
id: string
|
|
35
|
-
campaignGroupId: string
|
|
36
|
-
}
|
|
37
|
-
|
|
38
29
|
/**
|
|
39
30
|
* Lend pool supply props
|
|
40
31
|
* @typedef {Object} LendSupplyPropsV2
|
|
41
32
|
* @property {POOL_NAME} poolName The name of the pool.
|
|
42
|
-
* @property {Campaign} campaign The campaign info.
|
|
43
|
-
* @param {string} documentHash The subscription file hash.
|
|
44
33
|
* @property {function((CloseModalOptions|undefined)):void} handleClose Function to notify to close the widget modal when user clicks the 'x' close button.
|
|
45
34
|
* @property {function((number|undefined)):void|undefined} handleSuccess Optional function to notify that the lending pool supply action is successful.
|
|
46
35
|
*/
|
|
47
36
|
export interface LendSupplyPropsV2 {
|
|
48
37
|
poolName: keyof typeof POOL_NAME
|
|
49
|
-
campaign?: Campaign
|
|
50
|
-
documentHash?: string
|
|
51
38
|
handleClose: (options?: CloseModalOptions) => void
|
|
52
39
|
handleSuccess?: (blockNumber?: number) => void
|
|
53
40
|
}
|
|
54
41
|
|
|
55
42
|
export function LendSupplyV2({
|
|
56
43
|
poolName: poolNameStr,
|
|
57
|
-
campaign,
|
|
58
|
-
documentHash,
|
|
59
44
|
handleClose,
|
|
60
45
|
handleSuccess,
|
|
61
46
|
}: LendSupplyPropsV2): React.ReactElement | null {
|
|
@@ -88,39 +73,28 @@ export function LendSupplyV2({
|
|
|
88
73
|
|
|
89
74
|
useEffect(() => {
|
|
90
75
|
if (!step && poolInfo && lenderApproveStatusFetched && lpConfig) {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
if (poolInfo.KYC) {
|
|
97
|
-
dispatch(setStep(WIDGET_STEP.Evaluation))
|
|
98
|
-
} else if (poolInfo.supplyLink) {
|
|
99
|
-
openInNewTab(poolInfo.supplyLink)
|
|
100
|
-
handleClose()
|
|
76
|
+
if (isUniTranche) {
|
|
77
|
+
if (lenderApprovedJunior) {
|
|
78
|
+
setSelectedTranche('junior')
|
|
79
|
+
dispatch(setStep(WIDGET_STEP.ChooseAmount))
|
|
80
|
+
return
|
|
101
81
|
}
|
|
102
|
-
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
if (!isUniTranche && (!lenderApprovedJunior || !lenderApprovedSenior)) {
|
|
106
|
-
dispatch(setStep(WIDGET_STEP.ApproveLender))
|
|
107
|
-
return
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
if (lenderApprovedJunior && lenderApprovedSenior) {
|
|
82
|
+
} else if (lenderApprovedJunior && lenderApprovedSenior) {
|
|
111
83
|
dispatch(setStep(WIDGET_STEP.ChooseTranche))
|
|
112
84
|
return
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
85
|
+
} else if (lenderApprovedJunior || lenderApprovedSenior) {
|
|
86
|
+
// Tranches are approved independently on chain, so only offer the
|
|
87
|
+
// choice when both are approved. Otherwise go straight to the one
|
|
88
|
+
// that is, or the Transfer would revert on the vault's auth check.
|
|
89
|
+
setSelectedTranche(lenderApprovedJunior ? 'junior' : 'senior')
|
|
90
|
+
dispatch(setStep(WIDGET_STEP.ChooseAmount))
|
|
117
91
|
return
|
|
118
92
|
}
|
|
119
93
|
|
|
120
94
|
if (poolInfo.supplyLink) {
|
|
121
95
|
openInNewTab(poolInfo.supplyLink)
|
|
122
|
-
handleClose()
|
|
123
96
|
}
|
|
97
|
+
handleClose()
|
|
124
98
|
}
|
|
125
99
|
}, [
|
|
126
100
|
dispatch,
|
|
@@ -167,23 +141,6 @@ export function LendSupplyV2({
|
|
|
167
141
|
changeTranche={setSelectedTranche}
|
|
168
142
|
/>
|
|
169
143
|
)}
|
|
170
|
-
{step === WIDGET_STEP.Evaluation && (
|
|
171
|
-
<Evaluation
|
|
172
|
-
poolInfo={poolInfo}
|
|
173
|
-
handleClose={handleClose}
|
|
174
|
-
campaign={campaign}
|
|
175
|
-
networkType={getEvmNetworkType(poolInfo.chainId)}
|
|
176
|
-
documentHash={documentHash}
|
|
177
|
-
/>
|
|
178
|
-
)}
|
|
179
|
-
{step === WIDGET_STEP.ApproveLender && (
|
|
180
|
-
<ApproveLender
|
|
181
|
-
poolInfo={poolInfo}
|
|
182
|
-
isUniTranche={isUniTranche}
|
|
183
|
-
documentHash={documentHash}
|
|
184
|
-
changeTranche={setSelectedTranche}
|
|
185
|
-
/>
|
|
186
|
-
)}
|
|
187
144
|
{step === WIDGET_STEP.ChooseAmount && (
|
|
188
145
|
<ChooseAmount
|
|
189
146
|
poolInfo={poolInfo}
|
|
@@ -198,31 +155,17 @@ export function LendSupplyV2({
|
|
|
198
155
|
<ApproveAllowance poolInfo={poolInfo} />
|
|
199
156
|
)}
|
|
200
157
|
{step === WIDGET_STEP.Transfer && selectedTranche && (
|
|
201
|
-
<Transfer
|
|
202
|
-
poolInfo={poolInfo}
|
|
203
|
-
trancheType={selectedTranche}
|
|
204
|
-
campaign={campaign}
|
|
205
|
-
networkType={getEvmNetworkType(poolInfo.chainId)}
|
|
206
|
-
/>
|
|
158
|
+
<Transfer poolInfo={poolInfo} trancheType={selectedTranche} />
|
|
207
159
|
)}
|
|
208
160
|
{step === WIDGET_STEP.Done && (
|
|
209
161
|
<Success
|
|
210
162
|
poolInfo={poolInfo}
|
|
211
163
|
lpConfig={lpConfig}
|
|
212
|
-
campaign={campaign}
|
|
213
164
|
handleAction={handleClose}
|
|
214
165
|
/>
|
|
215
166
|
)}
|
|
216
167
|
{step === WIDGET_STEP.Notifications && (
|
|
217
|
-
<Notifications
|
|
218
|
-
)}
|
|
219
|
-
{step === WIDGET_STEP.PointsEarned && (
|
|
220
|
-
<PointsEarned
|
|
221
|
-
lpConfig={{
|
|
222
|
-
withdrawalLockupPeriodDays: lpConfig.withdrawalLockoutPeriodInDays,
|
|
223
|
-
}}
|
|
224
|
-
handleAction={handleClose}
|
|
225
|
-
/>
|
|
168
|
+
<Notifications handleAction={handleClose} />
|
|
226
169
|
)}
|
|
227
170
|
{step === WIDGET_STEP.Error && (
|
|
228
171
|
<ErrorModal
|
|
@@ -102,7 +102,7 @@ export function SolanaTxSendModal({
|
|
|
102
102
|
chainId,
|
|
103
103
|
publicKey,
|
|
104
104
|
useHighPriority ? 'High' : undefined,
|
|
105
|
-
import.meta.env.
|
|
105
|
+
import.meta.env.VITE_RPC_URL,
|
|
106
106
|
)
|
|
107
107
|
loggingHelper.logAction('SigningTransaction', {
|
|
108
108
|
priorityFee: fee,
|
|
@@ -6,7 +6,6 @@ import React, { useEffect } from 'react'
|
|
|
6
6
|
import useEA from '../../../hooks/useEA'
|
|
7
7
|
import { WIDGET_STEP } from '../../../store/widgets.store'
|
|
8
8
|
import { LoadingModal } from '../../LoadingModal'
|
|
9
|
-
import { SignIn } from '../../SignIn'
|
|
10
9
|
|
|
11
10
|
type Props = {
|
|
12
11
|
poolInfo: PoolInfoType
|
|
@@ -19,11 +18,7 @@ export function Evaluation({
|
|
|
19
18
|
payerAddress,
|
|
20
19
|
superToken,
|
|
21
20
|
}: Props): React.ReactElement {
|
|
22
|
-
const {
|
|
23
|
-
checkingEA,
|
|
24
|
-
isWalletOwnershipVerificationRequired,
|
|
25
|
-
isWalletOwnershipVerified,
|
|
26
|
-
} = useEA()
|
|
21
|
+
const { checkingEA } = useEA()
|
|
27
22
|
const { account } = useWeb3React()
|
|
28
23
|
|
|
29
24
|
useEffect(() => {
|
|
@@ -50,12 +45,8 @@ export function Evaluation({
|
|
|
50
45
|
poolInfo.assetAddress,
|
|
51
46
|
poolInfo.pool,
|
|
52
47
|
superToken,
|
|
53
|
-
isWalletOwnershipVerified,
|
|
54
48
|
])
|
|
55
49
|
|
|
56
|
-
if (isWalletOwnershipVerificationRequired) {
|
|
57
|
-
return <SignIn />
|
|
58
|
-
}
|
|
59
50
|
return (
|
|
60
51
|
<LoadingModal
|
|
61
52
|
title='Checking Stream'
|
package/src/hooks/useEA.ts
CHANGED
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
EARejectReason,
|
|
6
6
|
EAService,
|
|
7
7
|
} from '@huma-finance/shared'
|
|
8
|
-
import {
|
|
8
|
+
import { checkIsDev } from '@huma-finance/web-shared'
|
|
9
9
|
import { useWeb3React } from '@web3-react/core'
|
|
10
10
|
import { useCallback } from 'react'
|
|
11
11
|
|
|
@@ -16,11 +16,6 @@ import { useAppDispatch } from './useRedux'
|
|
|
16
16
|
const useEA = () => {
|
|
17
17
|
const dispatch = useAppDispatch()
|
|
18
18
|
const { chainId } = useWeb3React()
|
|
19
|
-
const {
|
|
20
|
-
isWalletOwnershipVerificationRequired,
|
|
21
|
-
isWalletOwnershipVerified,
|
|
22
|
-
setAuthError,
|
|
23
|
-
} = useAuthErrorHandling(checkIsDev())
|
|
24
19
|
|
|
25
20
|
const checkingEA = useCallback(
|
|
26
21
|
async (payload: EAPayload, nextStep: WIDGET_STEP) => {
|
|
@@ -37,27 +32,14 @@ const useEA = () => {
|
|
|
37
32
|
}),
|
|
38
33
|
)
|
|
39
34
|
} else {
|
|
40
|
-
|
|
41
|
-
setAuthError(e)
|
|
42
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
43
|
-
} catch (e: any) {
|
|
44
|
-
dispatch(
|
|
45
|
-
setError({
|
|
46
|
-
errorMessage: e.message,
|
|
47
|
-
}),
|
|
48
|
-
)
|
|
49
|
-
}
|
|
35
|
+
dispatch(setError({ errorMessage: e.message }))
|
|
50
36
|
}
|
|
51
37
|
}
|
|
52
38
|
},
|
|
53
|
-
[chainId, dispatch
|
|
39
|
+
[chainId, dispatch],
|
|
54
40
|
)
|
|
55
41
|
|
|
56
|
-
return {
|
|
57
|
-
checkingEA,
|
|
58
|
-
isWalletOwnershipVerificationRequired,
|
|
59
|
-
isWalletOwnershipVerified,
|
|
60
|
-
}
|
|
42
|
+
return { checkingEA }
|
|
61
43
|
}
|
|
62
44
|
|
|
63
45
|
export default useEA
|
|
@@ -112,12 +112,6 @@ export const widgetSlice = createSlice({
|
|
|
112
112
|
setTxHash: (state, { payload }: PayloadAction<string>) => {
|
|
113
113
|
state.txHash = payload
|
|
114
114
|
},
|
|
115
|
-
setPointsAccumulated: (
|
|
116
|
-
state,
|
|
117
|
-
{ payload }: PayloadAction<number | undefined>,
|
|
118
|
-
) => {
|
|
119
|
-
state.pointsAccumulated = payload
|
|
120
|
-
},
|
|
121
115
|
setLoggingContext: (state, { payload }: PayloadAction<LoggingContext>) => {
|
|
122
116
|
state.loggingContext = payload
|
|
123
117
|
},
|
|
@@ -151,7 +145,6 @@ export const {
|
|
|
151
145
|
setRedeemShares,
|
|
152
146
|
setSolanaSignature,
|
|
153
147
|
setTxHash,
|
|
154
|
-
setPointsAccumulated,
|
|
155
148
|
setLoggingContext,
|
|
156
149
|
} = widgetSlice.actions
|
|
157
150
|
|
|
@@ -7,13 +7,11 @@ export enum WIDGET_TYPE {
|
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
export enum WIDGET_STEP {
|
|
10
|
-
SignIn = 'SignIn',
|
|
11
10
|
ChooseTranche = 'ChooseTranche',
|
|
12
11
|
ChoosePaymentType = 'ChoosePaymentType',
|
|
13
12
|
Evaluation = 'Evaluation',
|
|
14
13
|
FirstLossCover = 'FirstLossCover',
|
|
15
14
|
ChooseAmount = 'ChooseAmount',
|
|
16
|
-
ApproveLender = 'ApproveLender',
|
|
17
15
|
Permit = 'Permit',
|
|
18
16
|
ApproveAllowance = 'ApproveAllowance',
|
|
19
17
|
MintNFT = 'MintNFT',
|
|
@@ -25,7 +23,6 @@ export enum WIDGET_STEP {
|
|
|
25
23
|
Transfer = 'Transfer',
|
|
26
24
|
CheckWithdrawable = 'CheckWithdrawable',
|
|
27
25
|
Notifications = 'Notifications',
|
|
28
|
-
PointsEarned = 'PointsEarned',
|
|
29
26
|
Done = 'Done',
|
|
30
27
|
Error = 'Error',
|
|
31
28
|
}
|
|
@@ -64,7 +61,6 @@ export type WidgetState = {
|
|
|
64
61
|
stream?: WidgetStream
|
|
65
62
|
multisend?: MultisendPayload
|
|
66
63
|
solanaSignature?: string
|
|
67
|
-
pointsAccumulated?: number
|
|
68
64
|
txHash?: string
|
|
69
65
|
loggingContext?: LoggingContext
|
|
70
66
|
}
|
package/vite.config.ts
CHANGED
|
@@ -26,7 +26,7 @@ export default defineConfig({
|
|
|
26
26
|
},
|
|
27
27
|
},
|
|
28
28
|
},
|
|
29
|
-
plugins: [svgr(), nodePolyfills(), dts()],
|
|
29
|
+
plugins: [svgr(), nodePolyfills(), dts({ exclude: ['src/cosmos/**'] })],
|
|
30
30
|
// These aliases are required; otherwise contexts aren't shared properly
|
|
31
31
|
// between the monorepo packages: https://github.com/vitejs/vite/discussions/13410
|
|
32
32
|
resolve: {
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { CHAIN_TYPE, NETWORK_TYPE, TrancheType } from '../../../../../huma-shared/src';
|
|
2
|
-
import { default as React } from 'react';
|
|
3
|
-
type Props = {
|
|
4
|
-
juniorTrancheVault: string;
|
|
5
|
-
seniorTrancheVault: string;
|
|
6
|
-
chainType: CHAIN_TYPE;
|
|
7
|
-
networkType: NETWORK_TYPE;
|
|
8
|
-
isUniTranche: boolean;
|
|
9
|
-
documentHash?: string;
|
|
10
|
-
chainSpecificData?: Record<string, unknown>;
|
|
11
|
-
changeTranche: (tranche: TrancheType) => void;
|
|
12
|
-
};
|
|
13
|
-
export declare function ApproveLenderBase({ juniorTrancheVault, seniorTrancheVault, isUniTranche, chainType, networkType, chainSpecificData, documentHash, changeTranche, }: Props): React.ReactElement | null;
|
|
14
|
-
export {};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { CHAIN_TYPE, CloseModalOptions, KYCType, NETWORK_TYPE } from '../../../../../huma-shared/src';
|
|
2
|
-
import { default as React } from 'react';
|
|
3
|
-
import { Campaign } from '../supplyV2';
|
|
4
|
-
type Props = {
|
|
5
|
-
poolInfo: {
|
|
6
|
-
KYC?: KYCType;
|
|
7
|
-
juniorTrancheVault: string;
|
|
8
|
-
seniorTrancheVault: string;
|
|
9
|
-
};
|
|
10
|
-
networkType: NETWORK_TYPE;
|
|
11
|
-
chainType: CHAIN_TYPE;
|
|
12
|
-
documentHash: string;
|
|
13
|
-
campaign?: Campaign;
|
|
14
|
-
handleClose: (options?: CloseModalOptions) => void;
|
|
15
|
-
};
|
|
16
|
-
export declare function PersonaEvaluation({ poolInfo, campaign, networkType, chainType, documentHash, handleClose, }: Props): React.ReactElement | null;
|
|
17
|
-
export {};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { PoolInfoV2 } from '../../../../../huma-shared/src';
|
|
2
|
-
import { default as React } from 'react';
|
|
3
|
-
type Props = {
|
|
4
|
-
poolInfo: PoolInfoV2;
|
|
5
|
-
handleClose: () => void;
|
|
6
|
-
};
|
|
7
|
-
export declare function SecuritizeEvaluation({ poolInfo, handleClose, }: Props): React.ReactElement | null;
|
|
8
|
-
export {};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { NETWORK_TYPE, SolanaPoolInfo } from '../../../../../huma-shared/src';
|
|
2
|
-
import { default as React } from 'react';
|
|
3
|
-
import { Campaign } from '../supplyV2';
|
|
4
|
-
type Props = {
|
|
5
|
-
poolInfo: SolanaPoolInfo;
|
|
6
|
-
networkType: NETWORK_TYPE;
|
|
7
|
-
campaign?: Campaign;
|
|
8
|
-
documentHash: string;
|
|
9
|
-
handleClose: () => void;
|
|
10
|
-
};
|
|
11
|
-
export declare function Evaluation({ poolInfo, networkType, campaign, documentHash, handleClose, }: Props): React.ReactElement | null;
|
|
12
|
-
export {};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { SolanaPoolInfo, TrancheType } from '../../../../../huma-shared/src';
|
|
2
|
-
import { default as React } from 'react';
|
|
3
|
-
type Props = {
|
|
4
|
-
poolInfo: SolanaPoolInfo;
|
|
5
|
-
isUniTranche: boolean;
|
|
6
|
-
documentHash: string;
|
|
7
|
-
changeTranche: (tranche: TrancheType) => void;
|
|
8
|
-
};
|
|
9
|
-
export declare function ApproveLender({ poolInfo, isUniTranche, documentHash, changeTranche, }: Props): React.ReactElement | null;
|
|
10
|
-
export {};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { CloseModalOptions, NETWORK_TYPE } from '../../../../../huma-shared/src';
|
|
2
|
-
import { SolanaPoolState } from '../../../../../huma-web-shared/src';
|
|
3
|
-
import { default as React } from 'react';
|
|
4
|
-
type Props = {
|
|
5
|
-
transactionHash: string;
|
|
6
|
-
poolState: SolanaPoolState;
|
|
7
|
-
networkType: NETWORK_TYPE;
|
|
8
|
-
handleAction: (options?: CloseModalOptions) => void;
|
|
9
|
-
};
|
|
10
|
-
export declare function PointsEarned({ transactionHash, poolState, networkType, handleAction, }: Props): React.ReactElement;
|
|
11
|
-
export {};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { PoolInfoType } from '../../../../../../huma-shared/src';
|
|
2
|
-
import { default as React } from 'react';
|
|
3
|
-
type Props = {
|
|
4
|
-
poolInfo: PoolInfoType;
|
|
5
|
-
handleApproveSuccess: () => void;
|
|
6
|
-
};
|
|
7
|
-
export declare function EvaluationEA({ poolInfo, handleApproveSuccess, }: Props): React.ReactElement | null;
|
|
8
|
-
export {};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { PoolInfoType } from '../../../../../../huma-shared/src';
|
|
2
|
-
import { default as React } from 'react';
|
|
3
|
-
type Props = {
|
|
4
|
-
poolInfo: PoolInfoType;
|
|
5
|
-
handleClose: () => void;
|
|
6
|
-
};
|
|
7
|
-
export declare function EvaluationKYC({ poolInfo, handleClose, }: Props): React.ReactElement | null;
|
|
8
|
-
export {};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { PoolInfoType } from '../../../../../../huma-shared/src';
|
|
2
|
-
import { default as React } from 'react';
|
|
3
|
-
type Props = {
|
|
4
|
-
poolInfo: PoolInfoType;
|
|
5
|
-
handleClose: () => void;
|
|
6
|
-
handleApproveSuccess: () => void;
|
|
7
|
-
};
|
|
8
|
-
export declare function Evaluation({ poolInfo, handleClose, handleApproveSuccess, }: Props): React.ReactElement | null;
|
|
9
|
-
export {};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { CloseModalOptions, NETWORK_TYPE, PoolInfoV2 } from '../../../../../huma-shared/src';
|
|
2
|
-
import { default as React } from 'react';
|
|
3
|
-
import { Campaign } from '.';
|
|
4
|
-
type Props = {
|
|
5
|
-
poolInfo: PoolInfoV2;
|
|
6
|
-
networkType: NETWORK_TYPE;
|
|
7
|
-
campaign?: Campaign;
|
|
8
|
-
documentHash?: string;
|
|
9
|
-
handleClose: (options?: CloseModalOptions) => void;
|
|
10
|
-
};
|
|
11
|
-
export declare function Evaluation({ poolInfo, networkType, campaign, documentHash, handleClose, }: Props): React.ReactElement | null;
|
|
12
|
-
export {};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { PoolInfoV2, TrancheType } from '../../../../../huma-shared/src';
|
|
2
|
-
import { default as React } from 'react';
|
|
3
|
-
type Props = {
|
|
4
|
-
poolInfo: PoolInfoV2;
|
|
5
|
-
isUniTranche: boolean;
|
|
6
|
-
documentHash?: string;
|
|
7
|
-
changeTranche: (tranche: TrancheType) => void;
|
|
8
|
-
};
|
|
9
|
-
export declare function ApproveLender({ poolInfo, isUniTranche, documentHash, changeTranche, }: Props): React.ReactElement;
|
|
10
|
-
export {};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { CloseModalOptions } from '../../../huma-shared/src';
|
|
2
|
-
import { default as React } from 'react';
|
|
3
|
-
type Props = {
|
|
4
|
-
lpConfig: {
|
|
5
|
-
withdrawalLockupPeriodDays?: number;
|
|
6
|
-
};
|
|
7
|
-
handleAction: (options?: CloseModalOptions) => void;
|
|
8
|
-
};
|
|
9
|
-
export declare function PointsEarned({ lpConfig, handleAction, }: Props): React.ReactElement;
|
|
10
|
-
export {};
|