@huma-finance/widgets 0.0.62-beta.621 → 0.0.62-beta.624

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/index.d.ts CHANGED
@@ -284,11 +284,13 @@ interface SolanaLendSupplyProps {
284
284
  * @typedef {Object} SolanaLendAddRedemptionProps
285
285
  * @property {SolanaPoolInfo} poolInfo The metadata of the pool.
286
286
  * @property {SolanaPoolState} poolState The current state config of the pool. * @property {function():void} handleClose Function to notify to close the widget modal when user clicks the 'x' close button.
287
+ * @property {POOL_NTrancheTypeAME} tranche The tranche type.
287
288
  * @property {function():void|undefined} handleSuccess Optional function to notify that the lending pool supply action is successful.
288
289
  */
289
290
  interface SolanaLendAddRedemptionProps {
290
291
  poolInfo: SolanaPoolInfo;
291
292
  poolState: SolanaPoolState;
293
+ tranche?: TrancheType;
292
294
  handleClose: () => void;
293
295
  handleSuccess?: () => void;
294
296
  }
package/dist/index.js CHANGED
@@ -9451,7 +9451,7 @@ function SolanaViewOnExplorer(_ref) {
9451
9451
  }
9452
9452
  return jsx(Button, {
9453
9453
  fullWidth: true,
9454
- variant: "contained",
9454
+ variant: "outlined",
9455
9455
  onClick: () => openInNewTab(link),
9456
9456
  children: jsx(Box, {
9457
9457
  component: "span",
@@ -10000,6 +10000,7 @@ function SolanaLendAddRedemption(_ref) {
10000
10000
  let {
10001
10001
  poolInfo,
10002
10002
  poolState,
10003
+ tranche,
10003
10004
  handleClose,
10004
10005
  handleSuccess
10005
10006
  } = _ref;
@@ -10018,12 +10019,16 @@ function SolanaLendAddRedemption(_ref) {
10018
10019
  step,
10019
10020
  errorMessage
10020
10021
  } = useAppSelector(selectWidgetState);
10021
- const [selectedTranche, setSelectedTranche] = useState();
10022
+ const [selectedTranche, setSelectedTranche] = useState(tranche);
10022
10023
  useEffect(() => {
10023
10024
  if (!step && !isLoadingLenderAccounts && !isLoadingTokenAccounts) {
10024
10025
  var _seniorTokenAccount$a, _seniorTokenAccount$a2, _juniorTokenAccount$a, _juniorTokenAccount$a2;
10025
10026
  const seniorTrancheShares = new BN((_seniorTokenAccount$a = seniorTokenAccount === null || seniorTokenAccount === void 0 || (_seniorTokenAccount$a2 = seniorTokenAccount.amount) === null || _seniorTokenAccount$a2 === void 0 ? void 0 : _seniorTokenAccount$a2.toString()) !== null && _seniorTokenAccount$a !== void 0 ? _seniorTokenAccount$a : 0);
10026
10027
  const juniorTrancheShares = new BN((_juniorTokenAccount$a = juniorTokenAccount === null || juniorTokenAccount === void 0 || (_juniorTokenAccount$a2 = juniorTokenAccount.amount) === null || _juniorTokenAccount$a2 === void 0 ? void 0 : _juniorTokenAccount$a2.toString()) !== null && _juniorTokenAccount$a !== void 0 ? _juniorTokenAccount$a : 0);
10028
+ if (selectedTranche) {
10029
+ dispatch(setStep(WIDGET_STEP.ChooseAmount));
10030
+ return;
10031
+ }
10027
10032
  if (juniorTrancheShares.gtn(0) && seniorTrancheShares.lten(0)) {
10028
10033
  setSelectedTranche('junior');
10029
10034
  dispatch(setStep(WIDGET_STEP.ChooseAmount));
@@ -10038,7 +10043,7 @@ function SolanaLendAddRedemption(_ref) {
10038
10043
  dispatch(setStep(WIDGET_STEP.ChooseTranche));
10039
10044
  }
10040
10045
  }
10041
- }, [dispatch, step, isLoadingLenderAccounts, isLoadingTokenAccounts, seniorTokenAccount === null || seniorTokenAccount === void 0 ? void 0 : seniorTokenAccount.amount, juniorTokenAccount === null || juniorTokenAccount === void 0 ? void 0 : juniorTokenAccount.amount]);
10046
+ }, [dispatch, step, isLoadingLenderAccounts, isLoadingTokenAccounts, seniorTokenAccount === null || seniorTokenAccount === void 0 ? void 0 : seniorTokenAccount.amount, juniorTokenAccount === null || juniorTokenAccount === void 0 ? void 0 : juniorTokenAccount.amount, selectedTranche]);
10042
10047
  const title = 'Redemption';
10043
10048
  if (isLoadingLenderAccounts || isLoadingTokenAccounts) {
10044
10049
  return jsx(WidgetWrapper, {