@huma-finance/widgets 0.0.62-beta.726 → 0.0.62-beta.729

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.
Files changed (25) hide show
  1. package/dist/cjs/index.cjs +156 -99
  2. package/dist/cjs/index.cjs.map +1 -1
  3. package/dist/index.js +157 -100
  4. package/dist/index.js.map +1 -1
  5. package/package.json +5 -5
  6. package/src/components/Lend/components/ApproveLenderBase.tsx +103 -0
  7. package/src/components/Lend/components/PersonaEvaluation.tsx +2 -58
  8. package/src/components/Lend/solanaSupply/1-Evaluation.tsx +1 -18
  9. package/src/components/Lend/solanaSupply/2-ApproveLender.tsx +37 -0
  10. package/src/components/Lend/solanaSupply/index.tsx +18 -6
  11. package/src/components/Lend/supplyV2/2-Evaluation.tsx +1 -12
  12. package/src/components/Lend/supplyV2/3-ApproveLender.tsx +26 -0
  13. package/src/components/Lend/supplyV2/index.tsx +20 -22
  14. package/src/store/widgets.store.ts +1 -0
  15. /package/src/components/Lend/solanaSupply/{2-ChooseTranche.tsx → 3-ChooseTranche.tsx} +0 -0
  16. /package/src/components/Lend/solanaSupply/{3-ChooseAmount.tsx → 4-ChooseAmount.tsx} +0 -0
  17. /package/src/components/Lend/solanaSupply/{4-ApproveAllowance.tsx → 5-ApproveAllowance.tsx} +0 -0
  18. /package/src/components/Lend/solanaSupply/{4-Transfer.tsx → 6-Transfer.tsx} +0 -0
  19. /package/src/components/Lend/solanaSupply/{5-Success.tsx → 7-Success.tsx} +0 -0
  20. /package/src/components/Lend/solanaSupply/{6-PointsEarned.tsx → 8-PointsEarned.tsx} +0 -0
  21. /package/src/components/Lend/supplyV2/{3-ChooseAmount.tsx → 4-ChooseAmount.tsx} +0 -0
  22. /package/src/components/Lend/supplyV2/{4-ApproveAllowance.tsx → 5-ApproveAllowance.tsx} +0 -0
  23. /package/src/components/Lend/supplyV2/{5-Transfer.tsx → 6-Transfer.tsx} +0 -0
  24. /package/src/components/Lend/supplyV2/{6-Success.tsx → 7-Success.tsx} +0 -0
  25. /package/src/components/Lend/supplyV2/{7-Notifications.tsx → 8-Notifications.tsx} +0 -0
@@ -72,6 +72,7 @@ let WIDGET_STEP = /*#__PURE__*/function (WIDGET_STEP) {
72
72
  WIDGET_STEP["Evaluation"] = "Evaluation";
73
73
  WIDGET_STEP["FirstLossCover"] = "FirstLossCover";
74
74
  WIDGET_STEP["ChooseAmount"] = "ChooseAmount";
75
+ WIDGET_STEP["ApproveLender"] = "ApproveLender";
75
76
  WIDGET_STEP["Permit"] = "Permit";
76
77
  WIDGET_STEP["ApproveAllowance"] = "ApproveAllowance";
77
78
  WIDGET_STEP["MintNFT"] = "MintNFT";
@@ -5608,12 +5609,9 @@ var _templateObject$b, _templateObject2$b, _templateObject3$8;
5608
5609
  function PersonaEvaluation(_ref) {
5609
5610
  let {
5610
5611
  poolInfo,
5611
- isUniTranche,
5612
5612
  campaign,
5613
5613
  pointsTestnetExperience,
5614
5614
  chainType,
5615
- chainSpecificData,
5616
- changeTranche,
5617
5615
  handleClose
5618
5616
  } = _ref;
5619
5617
  const theme = material.useTheme();
@@ -5649,30 +5647,6 @@ function PersonaEvaluation(_ref) {
5649
5647
  };
5650
5648
  createNewWallet();
5651
5649
  }, [account, campaign, isDev, isWalletOwnershipVerified, pointsTestnetExperience]);
5652
- const approveLender = React.useCallback(async () => {
5653
- isActionOngoingRef.current = true;
5654
- setLoadingType('approveLender');
5655
- try {
5656
- await shared.IdentityServiceV2.approveLender(account, chainId, poolInfo.juniorTrancheVault, isDev, chainSpecificData);
5657
- } catch (e) {
5658
- console.error(e);
5659
- }
5660
- if (!isUniTranche) {
5661
- try {
5662
- await shared.IdentityServiceV2.approveLender(account, chainId, poolInfo.seniorTrancheVault, isDev, chainSpecificData);
5663
- } catch (e) {
5664
- console.error(e);
5665
- }
5666
- }
5667
- if (isUniTranche) {
5668
- changeTranche('junior');
5669
- dispatch(setStep(WIDGET_STEP.ChooseAmount));
5670
- } else {
5671
- dispatch(setStep(WIDGET_STEP.ChooseTranche));
5672
- }
5673
- isActionOngoingRef.current = false;
5674
- setLoadingType(undefined);
5675
- }, [account, chainId, chainSpecificData, changeTranche, dispatch, isDev, isUniTranche, poolInfo.juniorTrancheVault, poolInfo.seniorTrancheVault]);
5676
5650
  const checkVerificationStatus = React.useCallback(async () => {
5677
5651
  if (isActionOngoingRef.current || isKYCResumedRef.current) {
5678
5652
  return;
@@ -5755,7 +5729,7 @@ function PersonaEvaluation(_ref) {
5755
5729
  }
5756
5730
  case shared.IdentityVerificationStatusV2.CONSENTED_TO_SUBSCRIPTION:
5757
5731
  {
5758
- await approveLender();
5732
+ dispatch(setStep(WIDGET_STEP.ApproveLender));
5759
5733
  break;
5760
5734
  }
5761
5735
  default:
@@ -5767,7 +5741,7 @@ function PersonaEvaluation(_ref) {
5767
5741
  } finally {
5768
5742
  isActionOngoingRef.current = false;
5769
5743
  }
5770
- }, [KYCCopies, account, approveLender, chainId, isDev, setAuthError]);
5744
+ }, [KYCCopies, account, chainId, dispatch, isDev, setAuthError]);
5771
5745
  React.useEffect(() => {
5772
5746
  checkVerificationStatus();
5773
5747
  }, [checkVerificationStatus]);
@@ -6152,10 +6126,8 @@ function Evaluation$2(_ref) {
6152
6126
  var _poolInfo$KYC, _poolInfo$KYC2;
6153
6127
  let {
6154
6128
  poolInfo,
6155
- isUniTranche,
6156
6129
  campaign,
6157
6130
  pointsTestnetExperience,
6158
- changeTranche,
6159
6131
  handleClose
6160
6132
  } = _ref;
6161
6133
  if ((_poolInfo$KYC = poolInfo.KYC) !== null && _poolInfo$KYC !== void 0 && _poolInfo$KYC.Securitize) {
@@ -6168,16 +6140,86 @@ function Evaluation$2(_ref) {
6168
6140
  return jsxRuntime.jsx(PersonaEvaluation, {
6169
6141
  poolInfo: poolInfo,
6170
6142
  handleClose: handleClose,
6171
- isUniTranche: isUniTranche,
6172
6143
  pointsTestnetExperience: pointsTestnetExperience,
6173
6144
  campaign: campaign,
6174
- chainType: shared.CHAIN_TYPE.EVM,
6175
- changeTranche: changeTranche
6145
+ chainType: shared.CHAIN_TYPE.EVM
6176
6146
  });
6177
6147
  }
6178
6148
  return null;
6179
6149
  }
6180
6150
 
6151
+ /* eslint-disable no-await-in-loop */
6152
+ function ApproveLenderBase(_ref) {
6153
+ let {
6154
+ juniorTrancheVault,
6155
+ seniorTrancheVault,
6156
+ isUniTranche,
6157
+ chainType,
6158
+ chainSpecificData,
6159
+ changeTranche
6160
+ } = _ref;
6161
+ const isDev = shared.checkIsDev();
6162
+ const dispatch = useAppDispatch();
6163
+ const {
6164
+ account,
6165
+ chainId
6166
+ } = webShared.useChainInfo(isDev, chainType);
6167
+ const approveLender = React.useCallback(async trancheVault => {
6168
+ let tryAttempts = 2;
6169
+ while (tryAttempts > 0) {
6170
+ try {
6171
+ tryAttempts -= 1;
6172
+ await shared.IdentityServiceV2.approveLender(account, chainId, trancheVault, isDev, chainSpecificData);
6173
+ tryAttempts = 0;
6174
+ } catch (e) {
6175
+ if (tryAttempts === 0) {
6176
+ dispatch(setError({
6177
+ errorMessage: 'Something went wrong, please try again later.'
6178
+ }));
6179
+ } else {
6180
+ await shared.timeUtil.sleep(3000);
6181
+ console.error(e);
6182
+ }
6183
+ }
6184
+ }
6185
+ }, [account, chainId, chainSpecificData, dispatch, isDev]);
6186
+ React.useEffect(() => {
6187
+ const approveLenderAsync = async () => {
6188
+ if (account && chainId) {
6189
+ if (isUniTranche) {
6190
+ await approveLender(juniorTrancheVault);
6191
+ changeTranche('junior');
6192
+ dispatch(setStep(WIDGET_STEP.ChooseAmount));
6193
+ } else {
6194
+ await approveLender(juniorTrancheVault);
6195
+ await approveLender(seniorTrancheVault);
6196
+ dispatch(setStep(WIDGET_STEP.ChooseTranche));
6197
+ }
6198
+ }
6199
+ };
6200
+ approveLenderAsync();
6201
+ }, [account, approveLender, chainId, changeTranche, dispatch, isUniTranche, juniorTrancheVault, seniorTrancheVault]);
6202
+ return jsxRuntime.jsx(LoadingModal, {
6203
+ title: "Lender Approval",
6204
+ description: "Checking your verification status..."
6205
+ });
6206
+ }
6207
+
6208
+ function ApproveLender$1(_ref) {
6209
+ let {
6210
+ poolInfo,
6211
+ isUniTranche,
6212
+ changeTranche
6213
+ } = _ref;
6214
+ return jsxRuntime.jsx(ApproveLenderBase, {
6215
+ juniorTrancheVault: poolInfo.juniorTrancheVault,
6216
+ seniorTrancheVault: poolInfo.seniorTrancheVault,
6217
+ isUniTranche: isUniTranche,
6218
+ chainType: shared.CHAIN_TYPE.EVM,
6219
+ changeTranche: changeTranche
6220
+ });
6221
+ }
6222
+
6181
6223
  function ChooseAmount$9(_ref) {
6182
6224
  let {
6183
6225
  poolInfo,
@@ -6448,7 +6490,9 @@ function LendSupplyV2(_ref) {
6448
6490
  const lenderApproveStatusFetched = lenderApprovedSenior !== undefined && lenderApprovedJunior !== undefined;
6449
6491
  React.useEffect(() => {
6450
6492
  if (!step && poolInfo && lenderApproveStatusFetched && lpConfig) {
6451
- if (campaign && !isUniTranche && (!lenderApprovedJunior || !lenderApprovedSenior)) {
6493
+ const uniTrancheNotEvaluated = isUniTranche && !lenderApprovedJunior;
6494
+ const tranchesNotEvaluated = !isUniTranche && !lenderApprovedJunior && !lenderApprovedSenior;
6495
+ if (uniTrancheNotEvaluated || tranchesNotEvaluated) {
6452
6496
  if (poolInfo.KYC) {
6453
6497
  dispatch(setStep(WIDGET_STEP.Evaluation));
6454
6498
  } else if (poolInfo.supplyLink) {
@@ -6457,14 +6501,8 @@ function LendSupplyV2(_ref) {
6457
6501
  }
6458
6502
  return;
6459
6503
  }
6460
- if (lenderApprovedJunior && !lenderApprovedSenior) {
6461
- setSelectedTranche('junior');
6462
- dispatch(setStep(WIDGET_STEP.ChooseAmount));
6463
- return;
6464
- }
6465
- if (lenderApprovedSenior && !lenderApprovedJunior) {
6466
- setSelectedTranche('senior');
6467
- dispatch(setStep(WIDGET_STEP.ChooseAmount));
6504
+ if (!isUniTranche && (!lenderApprovedJunior || !lenderApprovedSenior)) {
6505
+ dispatch(setStep(WIDGET_STEP.ApproveLender));
6468
6506
  return;
6469
6507
  }
6470
6508
  if (lenderApprovedJunior && lenderApprovedSenior) {
@@ -6480,7 +6518,7 @@ function LendSupplyV2(_ref) {
6480
6518
  handleClose();
6481
6519
  }
6482
6520
  }
6483
- }, [dispatch, handleClose, isUniTranche, lenderApproveStatusFetched, lenderApprovedJunior, lenderApprovedSenior, lpConfig, poolInfo, campaign, step]);
6521
+ }, [dispatch, handleClose, isUniTranche, lenderApproveStatusFetched, lenderApprovedJunior, lenderApprovedSenior, lpConfig, poolInfo, step]);
6484
6522
  if (!poolInfo || !poolUnderlyingToken || !lenderApproveStatusFetched || !lpConfig || !juniorAssets || !seniorAssets) {
6485
6523
  return jsxRuntime.jsx(WidgetWrapper, {
6486
6524
  isOpen: true,
@@ -6502,10 +6540,12 @@ function LendSupplyV2(_ref) {
6502
6540
  }), step === WIDGET_STEP.Evaluation && jsxRuntime.jsx(Evaluation$2, {
6503
6541
  poolInfo: poolInfo,
6504
6542
  handleClose: handleClose,
6505
- isUniTranche: isUniTranche,
6506
- changeTranche: setSelectedTranche,
6507
6543
  pointsTestnetExperience: pointsTestnetExperience,
6508
6544
  campaign: campaign
6545
+ }), step === WIDGET_STEP.ApproveLender && jsxRuntime.jsx(ApproveLender$1, {
6546
+ poolInfo: poolInfo,
6547
+ isUniTranche: isUniTranche,
6548
+ changeTranche: setSelectedTranche
6509
6549
  }), step === WIDGET_STEP.ChooseAmount && jsxRuntime.jsx(ChooseAmount$9, {
6510
6550
  poolInfo: poolInfo,
6511
6551
  lpConfig: lpConfig,
@@ -8547,14 +8587,11 @@ function Evaluation(_ref) {
8547
8587
  var _poolInfo$KYC;
8548
8588
  let {
8549
8589
  poolInfo,
8550
- isUniTranche,
8551
8590
  pointsTestnetExperience,
8552
8591
  campaign,
8553
- changeTranche,
8554
8592
  handleClose
8555
8593
  } = _ref;
8556
8594
  if ((_poolInfo$KYC = poolInfo.KYC) !== null && _poolInfo$KYC !== void 0 && _poolInfo$KYC.Persona) {
8557
- const solanChainInfo = shared.SOLANA_CHAIN_INFO[poolInfo.chainId];
8558
8595
  return jsxRuntime.jsx(PersonaEvaluation, {
8559
8596
  poolInfo: {
8560
8597
  KYC: poolInfo.KYC,
@@ -8562,20 +8599,34 @@ function Evaluation(_ref) {
8562
8599
  seniorTrancheVault: poolInfo.seniorTrancheMint
8563
8600
  },
8564
8601
  handleClose: handleClose,
8565
- isUniTranche: isUniTranche,
8566
8602
  pointsTestnetExperience: pointsTestnetExperience,
8567
8603
  campaign: campaign,
8568
- chainSpecificData: {
8569
- huma_program_id: solanChainInfo.poolProgram,
8570
- pool_id: poolInfo.poolId
8571
- },
8572
- chainType: shared.CHAIN_TYPE.SOLANA,
8573
- changeTranche: changeTranche
8604
+ chainType: shared.CHAIN_TYPE.SOLANA
8574
8605
  });
8575
8606
  }
8576
8607
  return null;
8577
8608
  }
8578
8609
 
8610
+ function ApproveLender(_ref) {
8611
+ let {
8612
+ poolInfo,
8613
+ isUniTranche,
8614
+ changeTranche
8615
+ } = _ref;
8616
+ const solanaChainInfo = shared.SOLANA_CHAIN_INFO[poolInfo.chainId];
8617
+ return jsxRuntime.jsx(ApproveLenderBase, {
8618
+ juniorTrancheVault: poolInfo.juniorTrancheMint,
8619
+ seniorTrancheVault: poolInfo.seniorTrancheMint,
8620
+ isUniTranche: isUniTranche,
8621
+ chainType: shared.CHAIN_TYPE.SOLANA,
8622
+ chainSpecificData: {
8623
+ huma_program_id: solanaChainInfo.poolProgram,
8624
+ pool_id: poolInfo.poolId
8625
+ },
8626
+ changeTranche: changeTranche
8627
+ });
8628
+ }
8629
+
8579
8630
  var _templateObject$7, _templateObject2$7, _templateObject3$5;
8580
8631
  function ChooseTranche$3(_ref) {
8581
8632
  let {
@@ -8715,6 +8766,43 @@ function ChooseAmount$4(_ref) {
8715
8766
  });
8716
8767
  }
8717
8768
 
8769
+ var _templateObject$6, _templateObject2$6;
8770
+ function ApproveAllowance$1(_ref) {
8771
+ var _poolState$withdrawal;
8772
+ let {
8773
+ poolState
8774
+ } = _ref;
8775
+ const theme = material.useTheme();
8776
+ const dispatch = useAppDispatch();
8777
+ const handleNext = React.useCallback(() => {
8778
+ dispatch(setStep(WIDGET_STEP.Transfer));
8779
+ }, [dispatch]);
8780
+ const styles = {
8781
+ iconWrapper: material.css(_templateObject$6 || (_templateObject$6 = _taggedTemplateLiteral(["\n ", ";\n margin-top: ", ";\n & > img {\n width: 220px;\n }\n "])), theme.cssMixins.rowCentered, theme.spacing(6)),
8782
+ description: material.css(_templateObject2$6 || (_templateObject2$6 = _taggedTemplateLiteral(["\n margin-top: ", ";\n font-weight: 400;\n font-size: 16px;\n color: ", ";\n padding: ", ";\n "])), theme.spacing(4), theme.palette.text.secondary, theme.spacing(0, 1))
8783
+ };
8784
+ const {
8785
+ lockupEndTimeUnix
8786
+ } = webShared.getLenderLockupDates((_poolState$withdrawal = poolState.withdrawalLockupPeriodDays) !== null && _poolState$withdrawal !== void 0 ? _poolState$withdrawal : 0);
8787
+ return jsxRuntime.jsxs(WrapperModal, {
8788
+ title: "Auto-Redemption",
8789
+ children: [jsxRuntime.jsx(material.Box, {
8790
+ css: styles.iconWrapper,
8791
+ children: jsxRuntime.jsx("img", {
8792
+ src: AutoPaybackImg,
8793
+ alt: "auto-payback"
8794
+ })
8795
+ }), jsxRuntime.jsxs(material.Box, {
8796
+ css: styles.description,
8797
+ children: ["This transaction will also enable auto-redemption for your tranche shares by approving our automation account as a delegate. Redemption requests will be automatically submitted on", ' ', shared.timeUtil.timestampToLL(lockupEndTimeUnix), "."]
8798
+ }), jsxRuntime.jsx(BottomButton, {
8799
+ variant: "contained",
8800
+ onClick: handleNext,
8801
+ children: "SUPPLY"
8802
+ })]
8803
+ });
8804
+ }
8805
+
8718
8806
  function SolanaViewOnExplorer(_ref) {
8719
8807
  let {
8720
8808
  chainId,
@@ -8899,7 +8987,7 @@ function Transfer$6(_ref) {
8899
8987
  });
8900
8988
  }
8901
8989
 
8902
- var _templateObject$6, _templateObject2$6, _templateObject3$4, _templateObject4$1, _templateObject5$1, _templateObject6$1;
8990
+ var _templateObject$5, _templateObject2$5, _templateObject3$4, _templateObject4$1, _templateObject5$1, _templateObject6$1;
8903
8991
  function SolanaTxDoneModal(_ref) {
8904
8992
  let {
8905
8993
  content,
@@ -8912,8 +9000,8 @@ function SolanaTxDoneModal(_ref) {
8912
9000
  const theme = material.useTheme();
8913
9001
  const dispatch = useAppDispatch();
8914
9002
  const styles = {
8915
- wrapper: material.css(_templateObject$6 || (_templateObject$6 = _taggedTemplateLiteral(["\n height: 518px;\n position: relative;\n "]))),
8916
- header: material.css(_templateObject2$6 || (_templateObject2$6 = _taggedTemplateLiteral(["\n ", ";\n margin-top: ", ";\n "])), theme.cssMixins.rowHCentered, theme.spacing(-0.5)),
9003
+ wrapper: material.css(_templateObject$5 || (_templateObject$5 = _taggedTemplateLiteral(["\n height: 518px;\n position: relative;\n "]))),
9004
+ header: material.css(_templateObject2$5 || (_templateObject2$5 = _taggedTemplateLiteral(["\n ", ";\n margin-top: ", ";\n "])), theme.cssMixins.rowHCentered, theme.spacing(-0.5)),
8917
9005
  content: material.css(_templateObject3$4 || (_templateObject3$4 = _taggedTemplateLiteral(["\n ", ";\n font-weight: ", ";\n font-size: 18px;\n color: ", ";\n margin-top: ", ";\n text-align: center;\n "])), theme.cssMixins.colVCentered, subContent ? 700 : 400, theme.palette.text.secondary, theme.spacing(8)),
8918
9006
  subContent: material.css(_templateObject4$1 || (_templateObject4$1 = _taggedTemplateLiteral(["\n ", ";\n font-weight: 400;\n font-size: 18px;\n color: ", ";\n margin-top: ", ";\n text-align: center;\n "])), theme.cssMixins.colVCentered, theme.palette.text.primary, theme.spacing(2)),
8919
9007
  check: material.css(_templateObject5$1 || (_templateObject5$1 = _taggedTemplateLiteral(["\n width: 100%;\n ", ";\n margin-top: ", ";\n "])), theme.cssMixins.rowHCentered, theme.spacing(10)),
@@ -9005,43 +9093,6 @@ function Success$2(_ref) {
9005
9093
  });
9006
9094
  }
9007
9095
 
9008
- var _templateObject$5, _templateObject2$5;
9009
- function ApproveAllowance$1(_ref) {
9010
- var _poolState$withdrawal;
9011
- let {
9012
- poolState
9013
- } = _ref;
9014
- const theme = material.useTheme();
9015
- const dispatch = useAppDispatch();
9016
- const handleNext = React.useCallback(() => {
9017
- dispatch(setStep(WIDGET_STEP.Transfer));
9018
- }, [dispatch]);
9019
- const styles = {
9020
- iconWrapper: material.css(_templateObject$5 || (_templateObject$5 = _taggedTemplateLiteral(["\n ", ";\n margin-top: ", ";\n & > img {\n width: 220px;\n }\n "])), theme.cssMixins.rowCentered, theme.spacing(6)),
9021
- description: material.css(_templateObject2$5 || (_templateObject2$5 = _taggedTemplateLiteral(["\n margin-top: ", ";\n font-weight: 400;\n font-size: 16px;\n color: ", ";\n padding: ", ";\n "])), theme.spacing(4), theme.palette.text.secondary, theme.spacing(0, 1))
9022
- };
9023
- const {
9024
- lockupEndTimeUnix
9025
- } = webShared.getLenderLockupDates((_poolState$withdrawal = poolState.withdrawalLockupPeriodDays) !== null && _poolState$withdrawal !== void 0 ? _poolState$withdrawal : 0);
9026
- return jsxRuntime.jsxs(WrapperModal, {
9027
- title: "Auto-Redemption",
9028
- children: [jsxRuntime.jsx(material.Box, {
9029
- css: styles.iconWrapper,
9030
- children: jsxRuntime.jsx("img", {
9031
- src: AutoPaybackImg,
9032
- alt: "auto-payback"
9033
- })
9034
- }), jsxRuntime.jsxs(material.Box, {
9035
- css: styles.description,
9036
- children: ["This transaction will also enable auto-redemption for your tranche shares by approving our automation account as a delegate. Redemption requests will be automatically submitted on", ' ', shared.timeUtil.timestampToLL(lockupEndTimeUnix), "."]
9037
- }), jsxRuntime.jsx(BottomButton, {
9038
- variant: "contained",
9039
- onClick: handleNext,
9040
- children: "SUPPLY"
9041
- })]
9042
- });
9043
- }
9044
-
9045
9096
  function SolanaLendSupply(_ref) {
9046
9097
  let {
9047
9098
  poolInfo,
@@ -9071,6 +9122,10 @@ function SolanaLendSupply(_ref) {
9071
9122
  dispatch(setStep(WIDGET_STEP.Evaluation));
9072
9123
  return;
9073
9124
  }
9125
+ if (!isUniTranche && (!juniorLenderApproved || !seniorLenderApproved)) {
9126
+ dispatch(setStep(WIDGET_STEP.ApproveLender));
9127
+ return;
9128
+ }
9074
9129
  if (juniorLenderApproved && !seniorLenderApproved) {
9075
9130
  setSelectedTranche('junior');
9076
9131
  dispatch(setStep(WIDGET_STEP.ChooseAmount));
@@ -9085,7 +9140,7 @@ function SolanaLendSupply(_ref) {
9085
9140
  dispatch(setStep(WIDGET_STEP.ChooseTranche));
9086
9141
  }
9087
9142
  }
9088
- }, [dispatch, handleClose, poolInfo, step, isLoadingLenderAccounts, juniorLenderApproved, seniorLenderApproved, isLoadingTokenAccount]);
9143
+ }, [dispatch, handleClose, poolInfo, step, isLoadingLenderAccounts, juniorLenderApproved, seniorLenderApproved, isLoadingTokenAccount, isUniTranche]);
9089
9144
  if (isLoadingLenderAccounts || isLoadingTokenAccount) {
9090
9145
  return jsxRuntime.jsx(WidgetWrapper, {
9091
9146
  isOpen: true,
@@ -9102,10 +9157,12 @@ function SolanaLendSupply(_ref) {
9102
9157
  handleSuccess: handleSuccess,
9103
9158
  children: [step === WIDGET_STEP.Evaluation && jsxRuntime.jsx(Evaluation, {
9104
9159
  poolInfo: poolInfo,
9105
- isUniTranche: !!isUniTranche,
9106
9160
  pointsTestnetExperience: pointsTestnetExperience,
9107
9161
  campaign: poolState.campaign,
9108
- handleClose: handleClose,
9162
+ handleClose: handleClose
9163
+ }), step === WIDGET_STEP.ApproveLender && jsxRuntime.jsx(ApproveLender, {
9164
+ poolInfo: poolInfo,
9165
+ isUniTranche: !!isUniTranche,
9109
9166
  changeTranche: setSelectedTranche
9110
9167
  }), step === WIDGET_STEP.ChooseTranche && jsxRuntime.jsx(ChooseTranche$3, {
9111
9168
  poolUnderlyingToken: poolInfo.underlyingMint,