@huma-finance/widgets 0.0.61-beta.546 → 0.0.61-beta.548
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/dist/cjs/index.cjs +61 -82
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/index.js +61 -82
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
- package/src/components/CreditLine/paymentV2/1-ChooseAmount.tsx +0 -5
- package/src/components/Lend/supplyV2/8-PointsEarned.tsx +86 -74
- package/src/components/Lend/supplyV2/components/PersonaEvaluation.tsx +1 -1
- package/src/components/ViewOnExplorer.tsx +4 -3
package/dist/cjs/index.cjs
CHANGED
|
@@ -1814,8 +1814,8 @@ function ViewOnExplorer(_ref) {
|
|
|
1814
1814
|
if (!link) {
|
|
1815
1815
|
return null;
|
|
1816
1816
|
}
|
|
1817
|
-
return jsxRuntime.jsx(
|
|
1818
|
-
variant: "
|
|
1817
|
+
return jsxRuntime.jsx(BottomButton, {
|
|
1818
|
+
variant: "contained",
|
|
1819
1819
|
onClick: () => shared.openInNewTab(link),
|
|
1820
1820
|
children: jsxRuntime.jsx(material.Box, {
|
|
1821
1821
|
component: "span",
|
|
@@ -3646,10 +3646,6 @@ function ChooseAmount$9(_ref) {
|
|
|
3646
3646
|
} = webShared.usePoolSafeAllowanceV2(poolInfo.poolName, account, provider);
|
|
3647
3647
|
const totalDueAmount = Number(ethers.ethers.utils.formatUnits(totalDueAmountBN, decimals));
|
|
3648
3648
|
const payoffAmount = Number(ethers.ethers.utils.formatUnits(payoffAmountBN, decimals));
|
|
3649
|
-
console.log('totalDueAmountBN', totalDueAmountBN.toString());
|
|
3650
|
-
console.log('payoffAmountBN', payoffAmountBN.toString());
|
|
3651
|
-
console.log('payoffAmount', payoffAmount);
|
|
3652
|
-
console.log('currentAmount', currentAmount);
|
|
3653
3649
|
React.useEffect(() => {
|
|
3654
3650
|
setCurrentAmount(totalDueAmount);
|
|
3655
3651
|
}, [totalDueAmount]);
|
|
@@ -5534,7 +5530,7 @@ const LoadingCopiesByType$1 = {
|
|
|
5534
5530
|
description: "Checking your verification status..."
|
|
5535
5531
|
},
|
|
5536
5532
|
startKYC: {
|
|
5537
|
-
description: "Starting KYC..."
|
|
5533
|
+
description: "Starting KYC/KYB..."
|
|
5538
5534
|
},
|
|
5539
5535
|
approveLender: {
|
|
5540
5536
|
description: "Approving as lender..."
|
|
@@ -6291,8 +6287,8 @@ var STATE = /*#__PURE__*/function (STATE) {
|
|
|
6291
6287
|
STATE["SignIn"] = "SignIn";
|
|
6292
6288
|
STATE["Congrats"] = "Congrats";
|
|
6293
6289
|
return STATE;
|
|
6294
|
-
}(STATE || {});
|
|
6295
|
-
|
|
6290
|
+
}(STATE || {});
|
|
6291
|
+
const ERROR_MESSAGE = 'Failed to update wallet points. Be assured that your points will be added later.';
|
|
6296
6292
|
function PointsEarned(_ref) {
|
|
6297
6293
|
let {
|
|
6298
6294
|
transactionHash,
|
|
@@ -6303,6 +6299,7 @@ function PointsEarned(_ref) {
|
|
|
6303
6299
|
const theme = material.useTheme();
|
|
6304
6300
|
const isDev = shared.checkIsDev();
|
|
6305
6301
|
const dispatch = reactRedux.useDispatch();
|
|
6302
|
+
const reset = utils.useResetAtom(webShared.txAtom);
|
|
6306
6303
|
const {
|
|
6307
6304
|
account,
|
|
6308
6305
|
chainId
|
|
@@ -6311,84 +6308,66 @@ function PointsEarned(_ref) {
|
|
|
6311
6308
|
const hasPointsAccumulated = !shared.isEmpty(pointsAccumulated) && pointsAccumulated > 0;
|
|
6312
6309
|
const lockupMonths = Math.round(lpConfig.withdrawalLockoutPeriodInDays / 30);
|
|
6313
6310
|
const monthText = lockupMonths > 1 ? "".concat(lockupMonths, " months") : "".concat(lockupMonths, " month");
|
|
6314
|
-
|
|
6315
|
-
|
|
6316
|
-
|
|
6317
|
-
|
|
6318
|
-
|
|
6319
|
-
|
|
6320
|
-
|
|
6321
|
-
// const [walletOwnership, setWalletOwnership] = useState<boolean | undefined>()
|
|
6311
|
+
const {
|
|
6312
|
+
errorType,
|
|
6313
|
+
setError: setAuthError,
|
|
6314
|
+
isWalletOwnershipVerified,
|
|
6315
|
+
isWalletOwnershipVerificationRequired
|
|
6316
|
+
} = webShared.useAuthErrorHandling(isDev);
|
|
6317
|
+
const [walletOwnership, setWalletOwnership] = React.useState();
|
|
6322
6318
|
const [state, setState] = React.useState(STATE.Loading);
|
|
6323
|
-
|
|
6324
|
-
|
|
6325
|
-
|
|
6326
|
-
|
|
6327
|
-
|
|
6328
|
-
|
|
6329
|
-
|
|
6330
|
-
|
|
6331
|
-
|
|
6332
|
-
|
|
6333
|
-
|
|
6334
|
-
|
|
6335
|
-
|
|
6336
|
-
|
|
6337
|
-
|
|
6338
|
-
|
|
6339
|
-
|
|
6340
|
-
|
|
6341
|
-
|
|
6342
|
-
|
|
6343
|
-
|
|
6344
|
-
|
|
6345
|
-
|
|
6346
|
-
|
|
6347
|
-
|
|
6348
|
-
|
|
6349
|
-
|
|
6350
|
-
|
|
6351
|
-
|
|
6352
|
-
|
|
6353
|
-
|
|
6354
|
-
|
|
6355
|
-
|
|
6356
|
-
// setError({
|
|
6357
|
-
// errorMessage: 'User has rejected the transaction.',
|
|
6358
|
-
// }),
|
|
6359
|
-
// )
|
|
6360
|
-
// } else if (errorType === 'Other') {
|
|
6361
|
-
// dispatch(
|
|
6362
|
-
// setError({
|
|
6363
|
-
// errorMessage: ERROR_MESSAGE,
|
|
6364
|
-
// }),
|
|
6365
|
-
// )
|
|
6366
|
-
// }
|
|
6367
|
-
// }, [dispatch, errorType])
|
|
6368
|
-
|
|
6319
|
+
React.useEffect(() => {
|
|
6320
|
+
if (isWalletOwnershipVerificationRequired) {
|
|
6321
|
+
setState(STATE.Loading);
|
|
6322
|
+
}
|
|
6323
|
+
}, [isWalletOwnershipVerificationRequired]);
|
|
6324
|
+
React.useEffect(() => {
|
|
6325
|
+
if (isWalletOwnershipVerified) {
|
|
6326
|
+
setWalletOwnership(true);
|
|
6327
|
+
}
|
|
6328
|
+
}, [isWalletOwnershipVerified]);
|
|
6329
|
+
React.useEffect(() => {
|
|
6330
|
+
const checkWalletOwnership = async () => {
|
|
6331
|
+
const ownership = await shared.CampaignService.checkWalletOwnership(account, isDev, pointsTestnetExperience);
|
|
6332
|
+
setWalletOwnership(ownership);
|
|
6333
|
+
if (!ownership) {
|
|
6334
|
+
setAuthError('WalletNotSignInException');
|
|
6335
|
+
}
|
|
6336
|
+
};
|
|
6337
|
+
checkWalletOwnership();
|
|
6338
|
+
}, [account, isDev, pointsTestnetExperience, setAuthError]);
|
|
6339
|
+
React.useEffect(() => {
|
|
6340
|
+
if (errorType === 'NotSignedIn') {
|
|
6341
|
+
setState(STATE.SignIn);
|
|
6342
|
+
} else if (errorType === 'UserRejected') {
|
|
6343
|
+
dispatch(setError({
|
|
6344
|
+
errorMessage: 'User has rejected the transaction.'
|
|
6345
|
+
}));
|
|
6346
|
+
} else if (errorType === 'Other') {
|
|
6347
|
+
dispatch(setError({
|
|
6348
|
+
errorMessage: ERROR_MESSAGE
|
|
6349
|
+
}));
|
|
6350
|
+
}
|
|
6351
|
+
}, [dispatch, errorType]);
|
|
6369
6352
|
React.useEffect(() => {
|
|
6370
6353
|
const updateWalletPoints = async () => {
|
|
6371
|
-
|
|
6372
|
-
|
|
6373
|
-
|
|
6374
|
-
|
|
6375
|
-
|
|
6376
|
-
|
|
6377
|
-
|
|
6378
|
-
|
|
6379
|
-
// )
|
|
6380
|
-
// setPointsAccumulated(result.pointsAccumulated)
|
|
6381
|
-
setPointsAccumulated(5000);
|
|
6382
|
-
setState(STATE.Congrats);
|
|
6383
|
-
} catch (error) {
|
|
6384
|
-
console.error('Failed to update wallet points', error);
|
|
6354
|
+
if (walletOwnership) {
|
|
6355
|
+
try {
|
|
6356
|
+
const result = await shared.CampaignService.updateWalletPoints(account, transactionHash, chainId, isDev, pointsTestnetExperience);
|
|
6357
|
+
setPointsAccumulated(result.pointsAccumulated);
|
|
6358
|
+
setState(STATE.Congrats);
|
|
6359
|
+
} catch (error) {
|
|
6360
|
+
console.error('Failed to update wallet points', error);
|
|
6361
|
+
}
|
|
6385
6362
|
}
|
|
6386
|
-
// }
|
|
6387
6363
|
};
|
|
6388
6364
|
updateWalletPoints();
|
|
6389
|
-
}, [account, chainId, dispatch, isDev, pointsTestnetExperience, transactionHash
|
|
6390
|
-
|
|
6391
|
-
|
|
6365
|
+
}, [account, chainId, dispatch, isDev, pointsTestnetExperience, transactionHash, walletOwnership]);
|
|
6366
|
+
const handleCloseModal = React.useCallback(() => {
|
|
6367
|
+
reset();
|
|
6368
|
+
dispatch(resetState());
|
|
6369
|
+
handleAction();
|
|
6370
|
+
}, [dispatch, handleAction, reset]);
|
|
6392
6371
|
const styles = {
|
|
6393
6372
|
wrapper: material.css(_templateObject$8 || (_templateObject$8 = _taggedTemplateLiteral(["\n height: 518px;\n position: relative;\n "]))),
|
|
6394
6373
|
congrats: material.css(_templateObject2$6 || (_templateObject2$6 = _taggedTemplateLiteral(["\n margin: ", ";\n "])), theme.spacing(-4, -4.5, 0, -4.5)),
|
|
@@ -6436,7 +6415,7 @@ function PointsEarned(_ref) {
|
|
|
6436
6415
|
}), " for", ' ', monthText, " straight. Plus, If you keep your investment till after", ' ', monthText, ", you\u2019ll gain extra points daily."]
|
|
6437
6416
|
}), jsxRuntime.jsx(BottomButton, {
|
|
6438
6417
|
variant: "contained",
|
|
6439
|
-
onClick:
|
|
6418
|
+
onClick: handleCloseModal,
|
|
6440
6419
|
children: "GREAT"
|
|
6441
6420
|
})]
|
|
6442
6421
|
});
|