@huma-finance/widgets 0.0.61-beta.561 → 0.0.61-beta.565
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 +1 -0
- package/dist/cjs/index.cjs +13 -3
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +12 -3
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
- package/src/components/Lend/addRedemptionV2/2-ChooseAmount.tsx +7 -8
- package/src/components/Lend/addRedemptionV2/index.tsx +19 -1
package/API.md
CHANGED
|
@@ -479,6 +479,7 @@ To be used when re-enabling autopay and other pool actions that require allowanc
|
|
|
479
479
|
| Name | Type | Description |
|
|
480
480
|
| --- | --- | --- |
|
|
481
481
|
| poolName | <code>POOL\_NAME</code> | <p>The name of the pool.</p> |
|
|
482
|
+
| tranche | <code>POOL\_NTrancheTypeAME</code> | <p>The tranche type.</p> |
|
|
482
483
|
| handleClose | <code>function</code> | <p>Function to notify to close the widget modal when user clicks the 'x' close button.</p> |
|
|
483
484
|
| handleSuccess | <code>function</code> | <p>Optional function to notify that the lending pool withdraw action is successful.</p> |
|
|
484
485
|
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -24,6 +24,7 @@ var ArrowDropUpIcon = require('@mui/icons-material/ArrowDropUp');
|
|
|
24
24
|
var notifiFrontendClient = require('@notifi-network/notifi-frontend-client');
|
|
25
25
|
var reactNumberFormat = require('react-number-format');
|
|
26
26
|
var ArrowForwardIosIcon = require('@mui/icons-material/ArrowForwardIos');
|
|
27
|
+
var dayjs = require('dayjs');
|
|
27
28
|
var Persona = require('persona');
|
|
28
29
|
var moment = require('moment');
|
|
29
30
|
var sdk = require('@huma-finance/sdk');
|
|
@@ -64,6 +65,7 @@ var CloseIcon__default = /*#__PURE__*/_interopDefaultLegacy(CloseIcon);
|
|
|
64
65
|
var ArrowDropDownIcon__default = /*#__PURE__*/_interopDefaultLegacy(ArrowDropDownIcon);
|
|
65
66
|
var ArrowDropUpIcon__default = /*#__PURE__*/_interopDefaultLegacy(ArrowDropUpIcon);
|
|
66
67
|
var ArrowForwardIosIcon__default = /*#__PURE__*/_interopDefaultLegacy(ArrowForwardIosIcon);
|
|
68
|
+
var dayjs__default = /*#__PURE__*/_interopDefaultLegacy(dayjs);
|
|
67
69
|
var Persona__default = /*#__PURE__*/_interopDefaultLegacy(Persona);
|
|
68
70
|
var moment__default = /*#__PURE__*/_interopDefaultLegacy(moment);
|
|
69
71
|
var Table__default = /*#__PURE__*/_interopDefaultLegacy(Table);
|
|
@@ -4554,11 +4556,13 @@ function ChooseAmount$6(_ref) {
|
|
|
4554
4556
|
React.useEffect(() => {
|
|
4555
4557
|
if (depositRecord && lpConfig && nextEpochStartTime) {
|
|
4556
4558
|
const SECONDS_IN_A_DAY = 24 * 60 * 60;
|
|
4557
|
-
|
|
4559
|
+
const lockupEndTime = depositRecord.lastDepositTime.toNumber() + lpConfig.withdrawalLockoutPeriodInDays * SECONDS_IN_A_DAY;
|
|
4560
|
+
if (nextEpochStartTime < lockupEndTime) {
|
|
4561
|
+
const lockupEndTimeDayjs = dayjs__default["default"].unix(lockupEndTime).date(1);
|
|
4558
4562
|
dispatch(setStep(WIDGET_STEP.Error));
|
|
4559
4563
|
dispatch(setError({
|
|
4560
4564
|
errorReason: 'Redemption too soon',
|
|
4561
|
-
errorMessage: "Your last deposit was on ".concat(shared.timestampToLL(depositRecord.lastDepositTime.toNumber()), ".
|
|
4565
|
+
errorMessage: "Your last deposit was on ".concat(shared.timestampToLL(depositRecord.lastDepositTime.toNumber()), ". You can redeem on ").concat(shared.timestampToLL(lockupEndTimeDayjs.unix()), ".")
|
|
4562
4566
|
}));
|
|
4563
4567
|
}
|
|
4564
4568
|
}
|
|
@@ -4643,6 +4647,7 @@ function Done$2(_ref) {
|
|
|
4643
4647
|
function AddRedemptionV2(_ref) {
|
|
4644
4648
|
let {
|
|
4645
4649
|
poolName: poolNameStr,
|
|
4650
|
+
tranche,
|
|
4646
4651
|
handleClose,
|
|
4647
4652
|
handleSuccess
|
|
4648
4653
|
} = _ref;
|
|
@@ -4687,6 +4692,11 @@ function AddRedemptionV2(_ref) {
|
|
|
4687
4692
|
}, [account, poolName, provider]);
|
|
4688
4693
|
React.useEffect(() => {
|
|
4689
4694
|
if (!step && trancheInfoFetched) {
|
|
4695
|
+
if (tranche) {
|
|
4696
|
+
setTrancheInfo(tranche === 'junior' ? juniorTrancheInfo : seniorTrancheInfo);
|
|
4697
|
+
dispatch(setStep(WIDGET_STEP.ChooseAmount));
|
|
4698
|
+
return;
|
|
4699
|
+
}
|
|
4690
4700
|
if (juniorTrancheInfo.assets.gt(0) && seniorTrancheInfo.assets.lte(0)) {
|
|
4691
4701
|
setTrancheInfo(juniorTrancheInfo);
|
|
4692
4702
|
dispatch(setStep(WIDGET_STEP.ChooseAmount));
|
|
@@ -4701,7 +4711,7 @@ function AddRedemptionV2(_ref) {
|
|
|
4701
4711
|
dispatch(setStep(WIDGET_STEP.ChooseTranche));
|
|
4702
4712
|
}
|
|
4703
4713
|
}
|
|
4704
|
-
}, [dispatch, juniorTrancheInfo, seniorTrancheInfo, step, trancheInfoFetched]);
|
|
4714
|
+
}, [dispatch, juniorTrancheInfo, seniorTrancheInfo, step, tranche, trancheInfoFetched]);
|
|
4705
4715
|
const handleRedeemSuccess = React.useCallback(blockNumber => {
|
|
4706
4716
|
if (handleSuccess) {
|
|
4707
4717
|
handleSuccess(blockNumber);
|