@huma-finance/widgets 0.0.61-beta.551 → 0.0.61-beta.556
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.61-beta.
|
|
3
|
+
"version": "0.0.61-beta.556+c7a2574",
|
|
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.
|
|
34
|
-
"@huma-finance/shared": "^0.0.
|
|
33
|
+
"@huma-finance/sdk": "^0.0.61-beta.556+c7a2574",
|
|
34
|
+
"@huma-finance/shared": "^0.0.61-beta.556+c7a2574",
|
|
35
35
|
"@huma-finance/web-shared": "^0.0.60",
|
|
36
36
|
"@mui/icons-material": "^5.3.0",
|
|
37
37
|
"@mui/material": "^5.0.6",
|
|
@@ -195,5 +195,5 @@
|
|
|
195
195
|
"optionalDependencies": {
|
|
196
196
|
"encoding": "^0.1.13"
|
|
197
197
|
},
|
|
198
|
-
"gitHead": "
|
|
198
|
+
"gitHead": "c7a25742744e96f61ca13f3c201b066748fb17d3"
|
|
199
199
|
}
|
|
@@ -77,21 +77,34 @@ export function ChooseAmount({
|
|
|
77
77
|
dispatch(setStep(step))
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
-
const
|
|
81
|
-
|
|
82
|
-
|
|
80
|
+
const getTrancheCap = () => {
|
|
81
|
+
if (selectedTranche === 'junior') {
|
|
82
|
+
return juniorAvailableCapBN
|
|
83
|
+
}
|
|
84
|
+
return seniorAvailableCapBN
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
const getMaxAmount = () => {
|
|
88
|
+
const trancheCap = getTrancheCap()
|
|
83
89
|
return balance.gt(trancheCap) ? trancheCap : balance
|
|
84
90
|
}
|
|
85
91
|
|
|
86
92
|
const getInfos = () => {
|
|
87
|
-
const
|
|
88
|
-
const
|
|
93
|
+
const trancheCap = getTrancheCap()
|
|
94
|
+
const currentAmountBN = ethers.utils.parseUnits(
|
|
95
|
+
String(currentAmount),
|
|
96
|
+
decimals,
|
|
97
|
+
)
|
|
98
|
+
const remainingCap = trancheCap.sub(currentAmountBN)
|
|
99
|
+
|
|
100
|
+
if (remainingCap.lt(0)) {
|
|
101
|
+
return ['0 remaining capacity']
|
|
102
|
+
}
|
|
103
|
+
return [
|
|
89
104
|
`${formatNumber(
|
|
90
|
-
ethers.utils.formatUnits(
|
|
105
|
+
ethers.utils.formatUnits(remainingCap, decimals),
|
|
91
106
|
)} remaining capacity`,
|
|
92
107
|
]
|
|
93
|
-
|
|
94
|
-
return infos
|
|
95
108
|
}
|
|
96
109
|
|
|
97
110
|
return (
|
|
@@ -103,7 +116,7 @@ export function ChooseAmount({
|
|
|
103
116
|
tokenSymbol={symbol}
|
|
104
117
|
currentAmount={currentAmount}
|
|
105
118
|
handleChangeAmount={handleChangeAmount}
|
|
106
|
-
maxAmount={Number(ethers.utils.formatUnits(
|
|
119
|
+
maxAmount={Number(ethers.utils.formatUnits(getMaxAmount(), decimals))}
|
|
107
120
|
maxAmountTitle={`${formatNumber(
|
|
108
121
|
ethers.utils.formatUnits(balance, decimals),
|
|
109
122
|
)} balance`}
|
|
@@ -161,9 +161,17 @@ export function PersonaEvaluation({
|
|
|
161
161
|
case IdentityVerificationStatusV2.NOT_STARTED: {
|
|
162
162
|
const startVerificationResult =
|
|
163
163
|
await IdentityServiceV2.startVerification(account, chainId, isDev)
|
|
164
|
+
const isVerificationBypassed =
|
|
165
|
+
startVerificationResult.status ===
|
|
166
|
+
IdentityVerificationStatusV2.BYPASSED
|
|
164
167
|
setInquiryId(startVerificationResult.personaInquiryId)
|
|
165
|
-
setKYCCopy(
|
|
168
|
+
setKYCCopy(
|
|
169
|
+
isVerificationBypassed
|
|
170
|
+
? KYCCopies.verificationBypassed
|
|
171
|
+
: KYCCopies.verifyIdentity,
|
|
172
|
+
)
|
|
166
173
|
setLoadingType(undefined)
|
|
174
|
+
|
|
167
175
|
break
|
|
168
176
|
}
|
|
169
177
|
|
|
@@ -299,7 +307,7 @@ export function PersonaEvaluation({
|
|
|
299
307
|
}
|
|
300
308
|
}, [showPersonaClient])
|
|
301
309
|
|
|
302
|
-
const startKYC = async () => {
|
|
310
|
+
const startKYC = useCallback(async () => {
|
|
303
311
|
isActionOngoingRef.current = true
|
|
304
312
|
isKYCResumedRef.current = false
|
|
305
313
|
setLoadingType('startKYC')
|
|
@@ -328,7 +336,24 @@ export function PersonaEvaluation({
|
|
|
328
336
|
setLoadingType(undefined)
|
|
329
337
|
},
|
|
330
338
|
})
|
|
331
|
-
}
|
|
339
|
+
}, [checkVerificationStatus, inquiryId, sessionToken])
|
|
340
|
+
|
|
341
|
+
// Start KYC flow directly
|
|
342
|
+
useEffect(() => {
|
|
343
|
+
if (verificationStatus) {
|
|
344
|
+
switch (verificationStatus.status) {
|
|
345
|
+
case IdentityVerificationStatusV2.NOT_STARTED:
|
|
346
|
+
case IdentityVerificationStatusV2.CREATED:
|
|
347
|
+
case IdentityVerificationStatusV2.PENDING:
|
|
348
|
+
case IdentityVerificationStatusV2.EXPIRED:
|
|
349
|
+
startKYC()
|
|
350
|
+
break
|
|
351
|
+
|
|
352
|
+
default:
|
|
353
|
+
break
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
}, [startKYC, verificationStatus])
|
|
332
357
|
|
|
333
358
|
const handleAction = () => {
|
|
334
359
|
if (verificationStatus) {
|
|
@@ -346,6 +371,10 @@ export function PersonaEvaluation({
|
|
|
346
371
|
handleClose(verificationStatus.status)
|
|
347
372
|
break
|
|
348
373
|
|
|
374
|
+
case IdentityVerificationStatusV2.BYPASSED:
|
|
375
|
+
handleClose(IdentityVerificationStatusV2.APPROVED)
|
|
376
|
+
break
|
|
377
|
+
|
|
349
378
|
default:
|
|
350
379
|
break
|
|
351
380
|
}
|