@huma-finance/widgets 0.0.48-beta.283 → 0.0.48-beta.285
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
CHANGED
|
@@ -5264,36 +5264,19 @@ function LendSupply(_ref) {
|
|
|
5264
5264
|
var _templateObject$a, _templateObject2$8, _templateObject3$7;
|
|
5265
5265
|
function ChooseTranche$1(_ref) {
|
|
5266
5266
|
let {
|
|
5267
|
-
poolInfo,
|
|
5268
5267
|
poolUnderlyingToken,
|
|
5269
5268
|
selectedTranche,
|
|
5270
5269
|
changeTranche
|
|
5271
5270
|
} = _ref;
|
|
5272
5271
|
const theme = material.useTheme();
|
|
5273
|
-
const {
|
|
5274
|
-
poolName
|
|
5275
|
-
} = poolInfo;
|
|
5276
5272
|
const dispatch = useAppDispatch();
|
|
5277
|
-
const {
|
|
5278
|
-
account,
|
|
5279
|
-
provider
|
|
5280
|
-
} = core.useWeb3React();
|
|
5281
|
-
const [lenderApprovedSenior] = shared.useLenderApprovedV2(poolName, 'senior', account, provider);
|
|
5282
|
-
const [lenderApprovedJunior] = shared.useLenderApprovedV2(poolName, 'junior', account, provider);
|
|
5283
|
-
const isLoading = lenderApprovedSenior === undefined || lenderApprovedJunior === undefined;
|
|
5284
5273
|
const styles = {
|
|
5285
5274
|
subTitle: material.css(_templateObject$a || (_templateObject$a = _taggedTemplateLiteral(["\n color: ", " !important;\n font-family: 'Uni-Neue-Regular';\n font-size: 16px;\n line-height: 150%;\n letter-spacing: 0.15px;\n margin-top: ", ";\n margin-left: ", ";\n "])), theme.palette.text.primary, theme.spacing(5), theme.spacing(2)),
|
|
5286
5275
|
radioGroup: material.css(_templateObject2$8 || (_templateObject2$8 = _taggedTemplateLiteral(["\n margin-left: ", ";\n margin-top: ", ";\n "])), theme.spacing(3), theme.spacing(3)),
|
|
5287
5276
|
formControl: material.css(_templateObject3$7 || (_templateObject3$7 = _taggedTemplateLiteral(["\n margin-bottom: ", ";\n\n .MuiFormControlLabel-label {\n color: ", ";\n font-family: 'Uni-Neue-Regular';\n font-size: 16px;\n line-height: 150%;\n letter-spacing: 0.15px;\n }\n "])), theme.spacing(1), theme.palette.text.primary)
|
|
5288
5277
|
};
|
|
5289
5278
|
const handleNext = () => {
|
|
5290
|
-
|
|
5291
|
-
dispatch(setStep(WIDGET_STEP.ChooseAmount));
|
|
5292
|
-
} else if (poolInfo.KYC) {
|
|
5293
|
-
dispatch(setStep(WIDGET_STEP.Evaluation));
|
|
5294
|
-
} else if (poolInfo.supplyLink) {
|
|
5295
|
-
shared.openInNewTab(poolInfo.supplyLink);
|
|
5296
|
-
}
|
|
5279
|
+
dispatch(setStep(WIDGET_STEP.ChooseAmount));
|
|
5297
5280
|
};
|
|
5298
5281
|
const items = [{
|
|
5299
5282
|
label: 'Senior',
|
|
@@ -5302,11 +5285,6 @@ function ChooseTranche$1(_ref) {
|
|
|
5302
5285
|
label: 'Junior',
|
|
5303
5286
|
value: 'junior'
|
|
5304
5287
|
}];
|
|
5305
|
-
if (isLoading) {
|
|
5306
|
-
return jsxRuntime.jsx(LoadingModal, {
|
|
5307
|
-
title: "Supply ".concat(poolUnderlyingToken.symbol)
|
|
5308
|
-
});
|
|
5309
|
-
}
|
|
5310
5288
|
return jsxRuntime.jsxs(WrapperModal, {
|
|
5311
5289
|
title: "Supply ".concat(poolUnderlyingToken.symbol),
|
|
5312
5290
|
children: [jsxRuntime.jsxs(material.FormControl, {
|
|
@@ -5794,7 +5772,8 @@ function LendSupplyV2(_ref) {
|
|
|
5794
5772
|
const poolName = shared.POOL_NAME[poolNameStr];
|
|
5795
5773
|
const {
|
|
5796
5774
|
chainId,
|
|
5797
|
-
provider
|
|
5775
|
+
provider,
|
|
5776
|
+
account
|
|
5798
5777
|
} = core.useWeb3React();
|
|
5799
5778
|
const poolInfo = shared.usePoolInfoV2(poolName, chainId);
|
|
5800
5779
|
const {
|
|
@@ -5803,12 +5782,35 @@ function LendSupplyV2(_ref) {
|
|
|
5803
5782
|
} = useAppSelector(selectWidgetState);
|
|
5804
5783
|
const [selectedTranche, setSelectedTranche] = React.useState();
|
|
5805
5784
|
const poolUnderlyingToken = shared.usePoolUnderlyingTokenInfoV2(poolName, provider);
|
|
5785
|
+
const [lenderApprovedSenior] = shared.useLenderApprovedV2(poolName, 'senior', account, provider);
|
|
5786
|
+
const [lenderApprovedJunior] = shared.useLenderApprovedV2(poolName, 'junior', account, provider);
|
|
5787
|
+
const lenderApproveStatusFetched = lenderApprovedSenior !== undefined && lenderApprovedJunior !== undefined;
|
|
5806
5788
|
React.useEffect(() => {
|
|
5807
|
-
if (!step) {
|
|
5808
|
-
|
|
5789
|
+
if (!step && poolInfo && lenderApproveStatusFetched) {
|
|
5790
|
+
if (lenderApprovedJunior && !lenderApprovedSenior) {
|
|
5791
|
+
setSelectedTranche('junior');
|
|
5792
|
+
dispatch(setStep(WIDGET_STEP.ChooseAmount));
|
|
5793
|
+
return;
|
|
5794
|
+
}
|
|
5795
|
+
if (lenderApprovedSenior && !lenderApprovedJunior) {
|
|
5796
|
+
setSelectedTranche('senior');
|
|
5797
|
+
dispatch(setStep(WIDGET_STEP.ChooseAmount));
|
|
5798
|
+
return;
|
|
5799
|
+
}
|
|
5800
|
+
if (lenderApprovedJunior && lenderApprovedSenior) {
|
|
5801
|
+
dispatch(setStep(WIDGET_STEP.ChooseTranche));
|
|
5802
|
+
return;
|
|
5803
|
+
}
|
|
5804
|
+
if (poolInfo.KYC) {
|
|
5805
|
+
dispatch(setStep(WIDGET_STEP.Evaluation));
|
|
5806
|
+
return;
|
|
5807
|
+
}
|
|
5808
|
+
if (poolInfo.supplyLink) {
|
|
5809
|
+
shared.openInNewTab(poolInfo.supplyLink);
|
|
5810
|
+
}
|
|
5809
5811
|
}
|
|
5810
|
-
}, [dispatch, step]);
|
|
5811
|
-
if (!poolInfo || !poolUnderlyingToken) {
|
|
5812
|
+
}, [dispatch, lenderApproveStatusFetched, lenderApprovedJunior, lenderApprovedSenior, poolInfo, step]);
|
|
5813
|
+
if (!poolInfo || !poolUnderlyingToken || !lenderApproveStatusFetched) {
|
|
5812
5814
|
return jsxRuntime.jsx(WidgetWrapper, {
|
|
5813
5815
|
isOpen: true,
|
|
5814
5816
|
isLoading: true,
|
|
@@ -5823,7 +5825,6 @@ function LendSupplyV2(_ref) {
|
|
|
5823
5825
|
handleClose: handleClose,
|
|
5824
5826
|
handleSuccess: handleSuccess,
|
|
5825
5827
|
children: [step === WIDGET_STEP.ChooseTranche && jsxRuntime.jsx(ChooseTranche$1, {
|
|
5826
|
-
poolInfo: poolInfo,
|
|
5827
5828
|
poolUnderlyingToken: poolUnderlyingToken,
|
|
5828
5829
|
selectedTranche: selectedTranche,
|
|
5829
5830
|
changeTranche: setSelectedTranche
|