@huma-finance/widgets 0.0.61-beta.551 → 0.0.61-beta.552
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
|
@@ -6121,14 +6121,24 @@ function ChooseAmount$4(_ref) {
|
|
|
6121
6121
|
const step = currentAmountBN.gt(allowance) ? WIDGET_STEP.ApproveAllowance : WIDGET_STEP.Transfer;
|
|
6122
6122
|
dispatch(setStep(step));
|
|
6123
6123
|
};
|
|
6124
|
-
const
|
|
6125
|
-
|
|
6124
|
+
const getTrancheCap = () => {
|
|
6125
|
+
if (selectedTranche === 'junior') {
|
|
6126
|
+
return juniorAvailableCapBN;
|
|
6127
|
+
}
|
|
6128
|
+
return seniorAvailableCapBN;
|
|
6129
|
+
};
|
|
6130
|
+
const getMaxAmount = () => {
|
|
6131
|
+
const trancheCap = getTrancheCap();
|
|
6126
6132
|
return balance.gt(trancheCap) ? trancheCap : balance;
|
|
6127
6133
|
};
|
|
6128
6134
|
const getInfos = () => {
|
|
6129
|
-
const
|
|
6130
|
-
const
|
|
6131
|
-
|
|
6135
|
+
const trancheCap = getTrancheCap();
|
|
6136
|
+
const currentAmountBN = ethers.ethers.utils.parseUnits(String(currentAmount), decimals);
|
|
6137
|
+
const remainingCap = trancheCap.sub(currentAmountBN);
|
|
6138
|
+
if (remainingCap.lt(0)) {
|
|
6139
|
+
return ['0 remaining capacity'];
|
|
6140
|
+
}
|
|
6141
|
+
return ["".concat(shared.formatNumber(ethers.ethers.utils.formatUnits(remainingCap, decimals)), " remaining capacity")];
|
|
6132
6142
|
};
|
|
6133
6143
|
return jsxRuntime.jsx(InputAmountModal, {
|
|
6134
6144
|
title: "Enter Amount",
|
|
@@ -6136,7 +6146,7 @@ function ChooseAmount$4(_ref) {
|
|
|
6136
6146
|
tokenSymbol: symbol,
|
|
6137
6147
|
currentAmount: currentAmount,
|
|
6138
6148
|
handleChangeAmount: handleChangeAmount,
|
|
6139
|
-
maxAmount: Number(ethers.ethers.utils.formatUnits(
|
|
6149
|
+
maxAmount: Number(ethers.ethers.utils.formatUnits(getMaxAmount(), decimals)),
|
|
6140
6150
|
maxAmountTitle: "".concat(shared.formatNumber(ethers.ethers.utils.formatUnits(balance, decimals)), " balance"),
|
|
6141
6151
|
infos: getInfos(),
|
|
6142
6152
|
handleAction: handleAction,
|