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

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 CHANGED
@@ -594,6 +594,7 @@ To be used when re-enabling autopay and other pool actions that require allowanc
594
594
  | --- | --- | --- |
595
595
  | poolInfo | <code>SolanaPoolInfo</code> | <p>The metadata of the pool.</p> |
596
596
  | poolState | <code>SolanaPoolState</code> | <p>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.</p> |
597
+ | tranche | <code>POOL\_NTrancheTypeAME</code> | <p>The tranche type.</p> |
597
598
  | handleSuccess | <code>function</code> | <p>Optional function to notify that the lending pool supply action is successful.</p> |
598
599
 
599
600
  <a name="SolanaLendCancelRedemptionProps"></a>
@@ -9492,7 +9492,7 @@ function SolanaViewOnExplorer(_ref) {
9492
9492
  }
9493
9493
  return jsxRuntime.jsx(material.Button, {
9494
9494
  fullWidth: true,
9495
- variant: "contained",
9495
+ variant: "outlined",
9496
9496
  onClick: () => shared.openInNewTab(link),
9497
9497
  children: jsxRuntime.jsx(material.Box, {
9498
9498
  component: "span",
@@ -10041,6 +10041,7 @@ function SolanaLendAddRedemption(_ref) {
10041
10041
  let {
10042
10042
  poolInfo,
10043
10043
  poolState,
10044
+ tranche,
10044
10045
  handleClose,
10045
10046
  handleSuccess
10046
10047
  } = _ref;
@@ -10059,12 +10060,16 @@ function SolanaLendAddRedemption(_ref) {
10059
10060
  step,
10060
10061
  errorMessage
10061
10062
  } = useAppSelector(selectWidgetState);
10062
- const [selectedTranche, setSelectedTranche] = React.useState();
10063
+ const [selectedTranche, setSelectedTranche] = React.useState(tranche);
10063
10064
  React.useEffect(() => {
10064
10065
  if (!step && !isLoadingLenderAccounts && !isLoadingTokenAccounts) {
10065
10066
  var _seniorTokenAccount$a, _seniorTokenAccount$a2, _juniorTokenAccount$a, _juniorTokenAccount$a2;
10066
10067
  const seniorTrancheShares = new anchor.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);
10067
10068
  const juniorTrancheShares = new anchor.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);
10069
+ if (selectedTranche) {
10070
+ dispatch(setStep(WIDGET_STEP.ChooseAmount));
10071
+ return;
10072
+ }
10068
10073
  if (juniorTrancheShares.gtn(0) && seniorTrancheShares.lten(0)) {
10069
10074
  setSelectedTranche('junior');
10070
10075
  dispatch(setStep(WIDGET_STEP.ChooseAmount));
@@ -10079,7 +10084,7 @@ function SolanaLendAddRedemption(_ref) {
10079
10084
  dispatch(setStep(WIDGET_STEP.ChooseTranche));
10080
10085
  }
10081
10086
  }
10082
- }, [dispatch, step, isLoadingLenderAccounts, isLoadingTokenAccounts, seniorTokenAccount === null || seniorTokenAccount === void 0 ? void 0 : seniorTokenAccount.amount, juniorTokenAccount === null || juniorTokenAccount === void 0 ? void 0 : juniorTokenAccount.amount]);
10087
+ }, [dispatch, step, isLoadingLenderAccounts, isLoadingTokenAccounts, seniorTokenAccount === null || seniorTokenAccount === void 0 ? void 0 : seniorTokenAccount.amount, juniorTokenAccount === null || juniorTokenAccount === void 0 ? void 0 : juniorTokenAccount.amount, selectedTranche]);
10083
10088
  const title = 'Redemption';
10084
10089
  if (isLoadingLenderAccounts || isLoadingTokenAccounts) {
10085
10090
  return jsxRuntime.jsx(WidgetWrapper, {