@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.
- package/dist/cjs/index.cjs +156 -99
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/index.js +157 -100
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
- package/src/components/Lend/components/ApproveLenderBase.tsx +103 -0
- package/src/components/Lend/components/PersonaEvaluation.tsx +2 -58
- package/src/components/Lend/solanaSupply/1-Evaluation.tsx +1 -18
- package/src/components/Lend/solanaSupply/2-ApproveLender.tsx +37 -0
- package/src/components/Lend/solanaSupply/index.tsx +18 -6
- package/src/components/Lend/supplyV2/2-Evaluation.tsx +1 -12
- package/src/components/Lend/supplyV2/3-ApproveLender.tsx +26 -0
- package/src/components/Lend/supplyV2/index.tsx +20 -22
- package/src/store/widgets.store.ts +1 -0
- /package/src/components/Lend/solanaSupply/{2-ChooseTranche.tsx → 3-ChooseTranche.tsx} +0 -0
- /package/src/components/Lend/solanaSupply/{3-ChooseAmount.tsx → 4-ChooseAmount.tsx} +0 -0
- /package/src/components/Lend/solanaSupply/{4-ApproveAllowance.tsx → 5-ApproveAllowance.tsx} +0 -0
- /package/src/components/Lend/solanaSupply/{4-Transfer.tsx → 6-Transfer.tsx} +0 -0
- /package/src/components/Lend/solanaSupply/{5-Success.tsx → 7-Success.tsx} +0 -0
- /package/src/components/Lend/solanaSupply/{6-PointsEarned.tsx → 8-PointsEarned.tsx} +0 -0
- /package/src/components/Lend/supplyV2/{3-ChooseAmount.tsx → 4-ChooseAmount.tsx} +0 -0
- /package/src/components/Lend/supplyV2/{4-ApproveAllowance.tsx → 5-ApproveAllowance.tsx} +0 -0
- /package/src/components/Lend/supplyV2/{5-Transfer.tsx → 6-Transfer.tsx} +0 -0
- /package/src/components/Lend/supplyV2/{6-Success.tsx → 7-Success.tsx} +0 -0
- /package/src/components/Lend/supplyV2/{7-Notifications.tsx → 8-Notifications.tsx} +0 -0
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import { useSelector, useDispatch, Provider } from 'react-redux';
|
|
|
6
6
|
import { supportedChainId, isTxFailed, getExplorerUrl, openInNewTab, TxStateType, decodeLogs, ERC20_ABI, downScale, formatMoney, POOL_NAME, POOL_TYPE, getERC20Contract, checkIsDev, EAService, EARejectionError, EARejectMessage, EARejectReason, timeUtil, formatNumber, doesChainSupportNotifi, CreditState, isEmpty, CreditStateV2, upScale, toBigNumber, TRANSFER_ABI, FirstLossCoverIndex, combineStyles, timestampToLL, getTrancheAssetsAndShares, IdentityService, CHAINS, configUtil, IdentityServiceV2, IdentityVerificationStatusV2, CampaignService, CAMPAIGN_REFERENCE_CODE, KYC_PROVIDER, CHAIN_TYPE, formatAmount, getTrancheVaultContractV2, getTrancheRedemptionStatusV2, getPoolContractV2, CURRENCY_CODE, SuperfluidPoolProcessor_ABI, PoolMap, SOLANA_CHAIN_INFO, SolanaTokenUtils, getSolanaExplorerUrl, getTokenAccounts, convertToShares, getSentinelAddress, getCreditAccounts, ChainEnum, getBlockchainConfigFromChain, tokenDecimalUtils, STELLAR_CHAINS_INFO, getStellarExplorerUrl } from '@huma-finance/shared';
|
|
7
7
|
import { useWeb3React } from '@web3-react/core';
|
|
8
8
|
import ErrorOutlineIcon from '@mui/icons-material/ErrorOutline';
|
|
9
|
-
import { txAtom, useMQ, sendTxAtom, usePoolUnderlyingTokenContract, useMount, usePoolInfo, useAccountStats, usePoolInfoV2, usePoolUnderlyingTokenInfoV2, usePoolSafeAllowanceV2, useAuthErrorHandling, useCLFeeManager, useCLPoolAllowance, usePoolContract, useCreditContractV2, useCreditStatsV2, useFirstLossCoverContractV2, useFirstLossCoverRequirementV2, useFirstLossCoverAllowanceV2, useFeeManager, useInvoiceNFTContract, useRFPoolAllowance, useLenderDepositRecordV2, useLPConfigV2, useNextEpochStartTimeV2, useTrancheVaultContractV2, useCancellableRedemptionInfoV2, useParamsSearch, usePoolAllowance, useLenderApproved, useLenderPosition, useWithdrawlLockoutInSeconds, usePoolUnderlyingTokenBalance, useChainInfo, usePoolUnderlyingTokenBalanceV2, useLenderApprovedV2, useTrancheVaultAssetsV2, useLastDepositTime, usePoolBalance, useReceivableInfoV2, useReceivableContractV2, useERC2612Permit, useMultiSendContract, useFactoring, useLenderAccounts, useTrancheTokenAccounts, useHumaProgram,
|
|
9
|
+
import { txAtom, useMQ, sendTxAtom, usePoolUnderlyingTokenContract, useMount, usePoolInfo, useAccountStats, usePoolInfoV2, usePoolUnderlyingTokenInfoV2, usePoolSafeAllowanceV2, useAuthErrorHandling, useCLFeeManager, useCLPoolAllowance, usePoolContract, useCreditContractV2, useCreditStatsV2, useFirstLossCoverContractV2, useFirstLossCoverRequirementV2, useFirstLossCoverAllowanceV2, useFeeManager, useInvoiceNFTContract, useRFPoolAllowance, useLenderDepositRecordV2, useLPConfigV2, useNextEpochStartTimeV2, useTrancheVaultContractV2, useCancellableRedemptionInfoV2, useParamsSearch, usePoolAllowance, useLenderApproved, useLenderPosition, useWithdrawlLockoutInSeconds, usePoolUnderlyingTokenBalance, useChainInfo, usePoolUnderlyingTokenBalanceV2, useLenderApprovedV2, useTrancheVaultAssetsV2, useLastDepositTime, usePoolBalance, useReceivableInfoV2, useReceivableContractV2, useERC2612Permit, useMultiSendContract, useFactoring, getLenderLockupDates, useLenderAccounts, useTrancheTokenAccounts, useHumaProgram, useTokenAccount, useTrancheMintAccounts, useBorrowerAccounts, StellarConnectionContext, getClientCommonParams, useStellarLender, useStellarTokenBalance, notEnabledAutoRedeem } from '@huma-finance/web-shared';
|
|
10
10
|
import { useResetAtom } from 'jotai/utils';
|
|
11
11
|
import { createSlice, configureStore } from '@reduxjs/toolkit';
|
|
12
12
|
import { jsxs, jsx, Fragment } from '@emotion/react/jsx-runtime';
|
|
@@ -55,6 +55,7 @@ let WIDGET_STEP = /*#__PURE__*/function (WIDGET_STEP) {
|
|
|
55
55
|
WIDGET_STEP["Evaluation"] = "Evaluation";
|
|
56
56
|
WIDGET_STEP["FirstLossCover"] = "FirstLossCover";
|
|
57
57
|
WIDGET_STEP["ChooseAmount"] = "ChooseAmount";
|
|
58
|
+
WIDGET_STEP["ApproveLender"] = "ApproveLender";
|
|
58
59
|
WIDGET_STEP["Permit"] = "Permit";
|
|
59
60
|
WIDGET_STEP["ApproveAllowance"] = "ApproveAllowance";
|
|
60
61
|
WIDGET_STEP["MintNFT"] = "MintNFT";
|
|
@@ -5591,12 +5592,9 @@ var _templateObject$b, _templateObject2$b, _templateObject3$8;
|
|
|
5591
5592
|
function PersonaEvaluation(_ref) {
|
|
5592
5593
|
let {
|
|
5593
5594
|
poolInfo,
|
|
5594
|
-
isUniTranche,
|
|
5595
5595
|
campaign,
|
|
5596
5596
|
pointsTestnetExperience,
|
|
5597
5597
|
chainType,
|
|
5598
|
-
chainSpecificData,
|
|
5599
|
-
changeTranche,
|
|
5600
5598
|
handleClose
|
|
5601
5599
|
} = _ref;
|
|
5602
5600
|
const theme = useTheme();
|
|
@@ -5632,30 +5630,6 @@ function PersonaEvaluation(_ref) {
|
|
|
5632
5630
|
};
|
|
5633
5631
|
createNewWallet();
|
|
5634
5632
|
}, [account, campaign, isDev, isWalletOwnershipVerified, pointsTestnetExperience]);
|
|
5635
|
-
const approveLender = useCallback(async () => {
|
|
5636
|
-
isActionOngoingRef.current = true;
|
|
5637
|
-
setLoadingType('approveLender');
|
|
5638
|
-
try {
|
|
5639
|
-
await IdentityServiceV2.approveLender(account, chainId, poolInfo.juniorTrancheVault, isDev, chainSpecificData);
|
|
5640
|
-
} catch (e) {
|
|
5641
|
-
console.error(e);
|
|
5642
|
-
}
|
|
5643
|
-
if (!isUniTranche) {
|
|
5644
|
-
try {
|
|
5645
|
-
await IdentityServiceV2.approveLender(account, chainId, poolInfo.seniorTrancheVault, isDev, chainSpecificData);
|
|
5646
|
-
} catch (e) {
|
|
5647
|
-
console.error(e);
|
|
5648
|
-
}
|
|
5649
|
-
}
|
|
5650
|
-
if (isUniTranche) {
|
|
5651
|
-
changeTranche('junior');
|
|
5652
|
-
dispatch(setStep(WIDGET_STEP.ChooseAmount));
|
|
5653
|
-
} else {
|
|
5654
|
-
dispatch(setStep(WIDGET_STEP.ChooseTranche));
|
|
5655
|
-
}
|
|
5656
|
-
isActionOngoingRef.current = false;
|
|
5657
|
-
setLoadingType(undefined);
|
|
5658
|
-
}, [account, chainId, chainSpecificData, changeTranche, dispatch, isDev, isUniTranche, poolInfo.juniorTrancheVault, poolInfo.seniorTrancheVault]);
|
|
5659
5633
|
const checkVerificationStatus = useCallback(async () => {
|
|
5660
5634
|
if (isActionOngoingRef.current || isKYCResumedRef.current) {
|
|
5661
5635
|
return;
|
|
@@ -5738,7 +5712,7 @@ function PersonaEvaluation(_ref) {
|
|
|
5738
5712
|
}
|
|
5739
5713
|
case IdentityVerificationStatusV2.CONSENTED_TO_SUBSCRIPTION:
|
|
5740
5714
|
{
|
|
5741
|
-
|
|
5715
|
+
dispatch(setStep(WIDGET_STEP.ApproveLender));
|
|
5742
5716
|
break;
|
|
5743
5717
|
}
|
|
5744
5718
|
default:
|
|
@@ -5750,7 +5724,7 @@ function PersonaEvaluation(_ref) {
|
|
|
5750
5724
|
} finally {
|
|
5751
5725
|
isActionOngoingRef.current = false;
|
|
5752
5726
|
}
|
|
5753
|
-
}, [KYCCopies, account,
|
|
5727
|
+
}, [KYCCopies, account, chainId, dispatch, isDev, setAuthError]);
|
|
5754
5728
|
useEffect(() => {
|
|
5755
5729
|
checkVerificationStatus();
|
|
5756
5730
|
}, [checkVerificationStatus]);
|
|
@@ -6135,10 +6109,8 @@ function Evaluation$2(_ref) {
|
|
|
6135
6109
|
var _poolInfo$KYC, _poolInfo$KYC2;
|
|
6136
6110
|
let {
|
|
6137
6111
|
poolInfo,
|
|
6138
|
-
isUniTranche,
|
|
6139
6112
|
campaign,
|
|
6140
6113
|
pointsTestnetExperience,
|
|
6141
|
-
changeTranche,
|
|
6142
6114
|
handleClose
|
|
6143
6115
|
} = _ref;
|
|
6144
6116
|
if ((_poolInfo$KYC = poolInfo.KYC) !== null && _poolInfo$KYC !== void 0 && _poolInfo$KYC.Securitize) {
|
|
@@ -6151,16 +6123,86 @@ function Evaluation$2(_ref) {
|
|
|
6151
6123
|
return jsx(PersonaEvaluation, {
|
|
6152
6124
|
poolInfo: poolInfo,
|
|
6153
6125
|
handleClose: handleClose,
|
|
6154
|
-
isUniTranche: isUniTranche,
|
|
6155
6126
|
pointsTestnetExperience: pointsTestnetExperience,
|
|
6156
6127
|
campaign: campaign,
|
|
6157
|
-
chainType: CHAIN_TYPE.EVM
|
|
6158
|
-
changeTranche: changeTranche
|
|
6128
|
+
chainType: CHAIN_TYPE.EVM
|
|
6159
6129
|
});
|
|
6160
6130
|
}
|
|
6161
6131
|
return null;
|
|
6162
6132
|
}
|
|
6163
6133
|
|
|
6134
|
+
/* eslint-disable no-await-in-loop */
|
|
6135
|
+
function ApproveLenderBase(_ref) {
|
|
6136
|
+
let {
|
|
6137
|
+
juniorTrancheVault,
|
|
6138
|
+
seniorTrancheVault,
|
|
6139
|
+
isUniTranche,
|
|
6140
|
+
chainType,
|
|
6141
|
+
chainSpecificData,
|
|
6142
|
+
changeTranche
|
|
6143
|
+
} = _ref;
|
|
6144
|
+
const isDev = checkIsDev();
|
|
6145
|
+
const dispatch = useAppDispatch();
|
|
6146
|
+
const {
|
|
6147
|
+
account,
|
|
6148
|
+
chainId
|
|
6149
|
+
} = useChainInfo(isDev, chainType);
|
|
6150
|
+
const approveLender = useCallback(async trancheVault => {
|
|
6151
|
+
let tryAttempts = 2;
|
|
6152
|
+
while (tryAttempts > 0) {
|
|
6153
|
+
try {
|
|
6154
|
+
tryAttempts -= 1;
|
|
6155
|
+
await IdentityServiceV2.approveLender(account, chainId, trancheVault, isDev, chainSpecificData);
|
|
6156
|
+
tryAttempts = 0;
|
|
6157
|
+
} catch (e) {
|
|
6158
|
+
if (tryAttempts === 0) {
|
|
6159
|
+
dispatch(setError({
|
|
6160
|
+
errorMessage: 'Something went wrong, please try again later.'
|
|
6161
|
+
}));
|
|
6162
|
+
} else {
|
|
6163
|
+
await timeUtil.sleep(3000);
|
|
6164
|
+
console.error(e);
|
|
6165
|
+
}
|
|
6166
|
+
}
|
|
6167
|
+
}
|
|
6168
|
+
}, [account, chainId, chainSpecificData, dispatch, isDev]);
|
|
6169
|
+
useEffect(() => {
|
|
6170
|
+
const approveLenderAsync = async () => {
|
|
6171
|
+
if (account && chainId) {
|
|
6172
|
+
if (isUniTranche) {
|
|
6173
|
+
await approveLender(juniorTrancheVault);
|
|
6174
|
+
changeTranche('junior');
|
|
6175
|
+
dispatch(setStep(WIDGET_STEP.ChooseAmount));
|
|
6176
|
+
} else {
|
|
6177
|
+
await approveLender(juniorTrancheVault);
|
|
6178
|
+
await approveLender(seniorTrancheVault);
|
|
6179
|
+
dispatch(setStep(WIDGET_STEP.ChooseTranche));
|
|
6180
|
+
}
|
|
6181
|
+
}
|
|
6182
|
+
};
|
|
6183
|
+
approveLenderAsync();
|
|
6184
|
+
}, [account, approveLender, chainId, changeTranche, dispatch, isUniTranche, juniorTrancheVault, seniorTrancheVault]);
|
|
6185
|
+
return jsx(LoadingModal, {
|
|
6186
|
+
title: "Lender Approval",
|
|
6187
|
+
description: "Checking your verification status..."
|
|
6188
|
+
});
|
|
6189
|
+
}
|
|
6190
|
+
|
|
6191
|
+
function ApproveLender$1(_ref) {
|
|
6192
|
+
let {
|
|
6193
|
+
poolInfo,
|
|
6194
|
+
isUniTranche,
|
|
6195
|
+
changeTranche
|
|
6196
|
+
} = _ref;
|
|
6197
|
+
return jsx(ApproveLenderBase, {
|
|
6198
|
+
juniorTrancheVault: poolInfo.juniorTrancheVault,
|
|
6199
|
+
seniorTrancheVault: poolInfo.seniorTrancheVault,
|
|
6200
|
+
isUniTranche: isUniTranche,
|
|
6201
|
+
chainType: CHAIN_TYPE.EVM,
|
|
6202
|
+
changeTranche: changeTranche
|
|
6203
|
+
});
|
|
6204
|
+
}
|
|
6205
|
+
|
|
6164
6206
|
function ChooseAmount$9(_ref) {
|
|
6165
6207
|
let {
|
|
6166
6208
|
poolInfo,
|
|
@@ -6431,7 +6473,9 @@ function LendSupplyV2(_ref) {
|
|
|
6431
6473
|
const lenderApproveStatusFetched = lenderApprovedSenior !== undefined && lenderApprovedJunior !== undefined;
|
|
6432
6474
|
useEffect(() => {
|
|
6433
6475
|
if (!step && poolInfo && lenderApproveStatusFetched && lpConfig) {
|
|
6434
|
-
|
|
6476
|
+
const uniTrancheNotEvaluated = isUniTranche && !lenderApprovedJunior;
|
|
6477
|
+
const tranchesNotEvaluated = !isUniTranche && !lenderApprovedJunior && !lenderApprovedSenior;
|
|
6478
|
+
if (uniTrancheNotEvaluated || tranchesNotEvaluated) {
|
|
6435
6479
|
if (poolInfo.KYC) {
|
|
6436
6480
|
dispatch(setStep(WIDGET_STEP.Evaluation));
|
|
6437
6481
|
} else if (poolInfo.supplyLink) {
|
|
@@ -6440,14 +6484,8 @@ function LendSupplyV2(_ref) {
|
|
|
6440
6484
|
}
|
|
6441
6485
|
return;
|
|
6442
6486
|
}
|
|
6443
|
-
if (
|
|
6444
|
-
|
|
6445
|
-
dispatch(setStep(WIDGET_STEP.ChooseAmount));
|
|
6446
|
-
return;
|
|
6447
|
-
}
|
|
6448
|
-
if (lenderApprovedSenior && !lenderApprovedJunior) {
|
|
6449
|
-
setSelectedTranche('senior');
|
|
6450
|
-
dispatch(setStep(WIDGET_STEP.ChooseAmount));
|
|
6487
|
+
if (!isUniTranche && (!lenderApprovedJunior || !lenderApprovedSenior)) {
|
|
6488
|
+
dispatch(setStep(WIDGET_STEP.ApproveLender));
|
|
6451
6489
|
return;
|
|
6452
6490
|
}
|
|
6453
6491
|
if (lenderApprovedJunior && lenderApprovedSenior) {
|
|
@@ -6463,7 +6501,7 @@ function LendSupplyV2(_ref) {
|
|
|
6463
6501
|
handleClose();
|
|
6464
6502
|
}
|
|
6465
6503
|
}
|
|
6466
|
-
}, [dispatch, handleClose, isUniTranche, lenderApproveStatusFetched, lenderApprovedJunior, lenderApprovedSenior, lpConfig, poolInfo,
|
|
6504
|
+
}, [dispatch, handleClose, isUniTranche, lenderApproveStatusFetched, lenderApprovedJunior, lenderApprovedSenior, lpConfig, poolInfo, step]);
|
|
6467
6505
|
if (!poolInfo || !poolUnderlyingToken || !lenderApproveStatusFetched || !lpConfig || !juniorAssets || !seniorAssets) {
|
|
6468
6506
|
return jsx(WidgetWrapper, {
|
|
6469
6507
|
isOpen: true,
|
|
@@ -6485,10 +6523,12 @@ function LendSupplyV2(_ref) {
|
|
|
6485
6523
|
}), step === WIDGET_STEP.Evaluation && jsx(Evaluation$2, {
|
|
6486
6524
|
poolInfo: poolInfo,
|
|
6487
6525
|
handleClose: handleClose,
|
|
6488
|
-
isUniTranche: isUniTranche,
|
|
6489
|
-
changeTranche: setSelectedTranche,
|
|
6490
6526
|
pointsTestnetExperience: pointsTestnetExperience,
|
|
6491
6527
|
campaign: campaign
|
|
6528
|
+
}), step === WIDGET_STEP.ApproveLender && jsx(ApproveLender$1, {
|
|
6529
|
+
poolInfo: poolInfo,
|
|
6530
|
+
isUniTranche: isUniTranche,
|
|
6531
|
+
changeTranche: setSelectedTranche
|
|
6492
6532
|
}), step === WIDGET_STEP.ChooseAmount && jsx(ChooseAmount$9, {
|
|
6493
6533
|
poolInfo: poolInfo,
|
|
6494
6534
|
lpConfig: lpConfig,
|
|
@@ -8530,14 +8570,11 @@ function Evaluation(_ref) {
|
|
|
8530
8570
|
var _poolInfo$KYC;
|
|
8531
8571
|
let {
|
|
8532
8572
|
poolInfo,
|
|
8533
|
-
isUniTranche,
|
|
8534
8573
|
pointsTestnetExperience,
|
|
8535
8574
|
campaign,
|
|
8536
|
-
changeTranche,
|
|
8537
8575
|
handleClose
|
|
8538
8576
|
} = _ref;
|
|
8539
8577
|
if ((_poolInfo$KYC = poolInfo.KYC) !== null && _poolInfo$KYC !== void 0 && _poolInfo$KYC.Persona) {
|
|
8540
|
-
const solanChainInfo = SOLANA_CHAIN_INFO[poolInfo.chainId];
|
|
8541
8578
|
return jsx(PersonaEvaluation, {
|
|
8542
8579
|
poolInfo: {
|
|
8543
8580
|
KYC: poolInfo.KYC,
|
|
@@ -8545,20 +8582,34 @@ function Evaluation(_ref) {
|
|
|
8545
8582
|
seniorTrancheVault: poolInfo.seniorTrancheMint
|
|
8546
8583
|
},
|
|
8547
8584
|
handleClose: handleClose,
|
|
8548
|
-
isUniTranche: isUniTranche,
|
|
8549
8585
|
pointsTestnetExperience: pointsTestnetExperience,
|
|
8550
8586
|
campaign: campaign,
|
|
8551
|
-
|
|
8552
|
-
huma_program_id: solanChainInfo.poolProgram,
|
|
8553
|
-
pool_id: poolInfo.poolId
|
|
8554
|
-
},
|
|
8555
|
-
chainType: CHAIN_TYPE.SOLANA,
|
|
8556
|
-
changeTranche: changeTranche
|
|
8587
|
+
chainType: CHAIN_TYPE.SOLANA
|
|
8557
8588
|
});
|
|
8558
8589
|
}
|
|
8559
8590
|
return null;
|
|
8560
8591
|
}
|
|
8561
8592
|
|
|
8593
|
+
function ApproveLender(_ref) {
|
|
8594
|
+
let {
|
|
8595
|
+
poolInfo,
|
|
8596
|
+
isUniTranche,
|
|
8597
|
+
changeTranche
|
|
8598
|
+
} = _ref;
|
|
8599
|
+
const solanaChainInfo = SOLANA_CHAIN_INFO[poolInfo.chainId];
|
|
8600
|
+
return jsx(ApproveLenderBase, {
|
|
8601
|
+
juniorTrancheVault: poolInfo.juniorTrancheMint,
|
|
8602
|
+
seniorTrancheVault: poolInfo.seniorTrancheMint,
|
|
8603
|
+
isUniTranche: isUniTranche,
|
|
8604
|
+
chainType: CHAIN_TYPE.SOLANA,
|
|
8605
|
+
chainSpecificData: {
|
|
8606
|
+
huma_program_id: solanaChainInfo.poolProgram,
|
|
8607
|
+
pool_id: poolInfo.poolId
|
|
8608
|
+
},
|
|
8609
|
+
changeTranche: changeTranche
|
|
8610
|
+
});
|
|
8611
|
+
}
|
|
8612
|
+
|
|
8562
8613
|
var _templateObject$7, _templateObject2$7, _templateObject3$5;
|
|
8563
8614
|
function ChooseTranche$3(_ref) {
|
|
8564
8615
|
let {
|
|
@@ -8698,6 +8749,43 @@ function ChooseAmount$4(_ref) {
|
|
|
8698
8749
|
});
|
|
8699
8750
|
}
|
|
8700
8751
|
|
|
8752
|
+
var _templateObject$6, _templateObject2$6;
|
|
8753
|
+
function ApproveAllowance$1(_ref) {
|
|
8754
|
+
var _poolState$withdrawal;
|
|
8755
|
+
let {
|
|
8756
|
+
poolState
|
|
8757
|
+
} = _ref;
|
|
8758
|
+
const theme = useTheme();
|
|
8759
|
+
const dispatch = useAppDispatch();
|
|
8760
|
+
const handleNext = useCallback(() => {
|
|
8761
|
+
dispatch(setStep(WIDGET_STEP.Transfer));
|
|
8762
|
+
}, [dispatch]);
|
|
8763
|
+
const styles = {
|
|
8764
|
+
iconWrapper: css(_templateObject$6 || (_templateObject$6 = _taggedTemplateLiteral(["\n ", ";\n margin-top: ", ";\n & > img {\n width: 220px;\n }\n "])), theme.cssMixins.rowCentered, theme.spacing(6)),
|
|
8765
|
+
description: 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))
|
|
8766
|
+
};
|
|
8767
|
+
const {
|
|
8768
|
+
lockupEndTimeUnix
|
|
8769
|
+
} = getLenderLockupDates((_poolState$withdrawal = poolState.withdrawalLockupPeriodDays) !== null && _poolState$withdrawal !== void 0 ? _poolState$withdrawal : 0);
|
|
8770
|
+
return jsxs(WrapperModal, {
|
|
8771
|
+
title: "Auto-Redemption",
|
|
8772
|
+
children: [jsx(Box, {
|
|
8773
|
+
css: styles.iconWrapper,
|
|
8774
|
+
children: jsx("img", {
|
|
8775
|
+
src: AutoPaybackImg,
|
|
8776
|
+
alt: "auto-payback"
|
|
8777
|
+
})
|
|
8778
|
+
}), jsxs(Box, {
|
|
8779
|
+
css: styles.description,
|
|
8780
|
+
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", ' ', timeUtil.timestampToLL(lockupEndTimeUnix), "."]
|
|
8781
|
+
}), jsx(BottomButton, {
|
|
8782
|
+
variant: "contained",
|
|
8783
|
+
onClick: handleNext,
|
|
8784
|
+
children: "SUPPLY"
|
|
8785
|
+
})]
|
|
8786
|
+
});
|
|
8787
|
+
}
|
|
8788
|
+
|
|
8701
8789
|
function SolanaViewOnExplorer(_ref) {
|
|
8702
8790
|
let {
|
|
8703
8791
|
chainId,
|
|
@@ -8882,7 +8970,7 @@ function Transfer$6(_ref) {
|
|
|
8882
8970
|
});
|
|
8883
8971
|
}
|
|
8884
8972
|
|
|
8885
|
-
var _templateObject$
|
|
8973
|
+
var _templateObject$5, _templateObject2$5, _templateObject3$4, _templateObject4$1, _templateObject5$1, _templateObject6$1;
|
|
8886
8974
|
function SolanaTxDoneModal(_ref) {
|
|
8887
8975
|
let {
|
|
8888
8976
|
content,
|
|
@@ -8895,8 +8983,8 @@ function SolanaTxDoneModal(_ref) {
|
|
|
8895
8983
|
const theme = useTheme();
|
|
8896
8984
|
const dispatch = useAppDispatch();
|
|
8897
8985
|
const styles = {
|
|
8898
|
-
wrapper: css(_templateObject$
|
|
8899
|
-
header: css(_templateObject2$
|
|
8986
|
+
wrapper: css(_templateObject$5 || (_templateObject$5 = _taggedTemplateLiteral(["\n height: 518px;\n position: relative;\n "]))),
|
|
8987
|
+
header: css(_templateObject2$5 || (_templateObject2$5 = _taggedTemplateLiteral(["\n ", ";\n margin-top: ", ";\n "])), theme.cssMixins.rowHCentered, theme.spacing(-0.5)),
|
|
8900
8988
|
content: 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)),
|
|
8901
8989
|
subContent: 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)),
|
|
8902
8990
|
check: css(_templateObject5$1 || (_templateObject5$1 = _taggedTemplateLiteral(["\n width: 100%;\n ", ";\n margin-top: ", ";\n "])), theme.cssMixins.rowHCentered, theme.spacing(10)),
|
|
@@ -8988,43 +9076,6 @@ function Success$2(_ref) {
|
|
|
8988
9076
|
});
|
|
8989
9077
|
}
|
|
8990
9078
|
|
|
8991
|
-
var _templateObject$5, _templateObject2$5;
|
|
8992
|
-
function ApproveAllowance$1(_ref) {
|
|
8993
|
-
var _poolState$withdrawal;
|
|
8994
|
-
let {
|
|
8995
|
-
poolState
|
|
8996
|
-
} = _ref;
|
|
8997
|
-
const theme = useTheme();
|
|
8998
|
-
const dispatch = useAppDispatch();
|
|
8999
|
-
const handleNext = useCallback(() => {
|
|
9000
|
-
dispatch(setStep(WIDGET_STEP.Transfer));
|
|
9001
|
-
}, [dispatch]);
|
|
9002
|
-
const styles = {
|
|
9003
|
-
iconWrapper: css(_templateObject$5 || (_templateObject$5 = _taggedTemplateLiteral(["\n ", ";\n margin-top: ", ";\n & > img {\n width: 220px;\n }\n "])), theme.cssMixins.rowCentered, theme.spacing(6)),
|
|
9004
|
-
description: 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))
|
|
9005
|
-
};
|
|
9006
|
-
const {
|
|
9007
|
-
lockupEndTimeUnix
|
|
9008
|
-
} = getLenderLockupDates((_poolState$withdrawal = poolState.withdrawalLockupPeriodDays) !== null && _poolState$withdrawal !== void 0 ? _poolState$withdrawal : 0);
|
|
9009
|
-
return jsxs(WrapperModal, {
|
|
9010
|
-
title: "Auto-Redemption",
|
|
9011
|
-
children: [jsx(Box, {
|
|
9012
|
-
css: styles.iconWrapper,
|
|
9013
|
-
children: jsx("img", {
|
|
9014
|
-
src: AutoPaybackImg,
|
|
9015
|
-
alt: "auto-payback"
|
|
9016
|
-
})
|
|
9017
|
-
}), jsxs(Box, {
|
|
9018
|
-
css: styles.description,
|
|
9019
|
-
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", ' ', timeUtil.timestampToLL(lockupEndTimeUnix), "."]
|
|
9020
|
-
}), jsx(BottomButton, {
|
|
9021
|
-
variant: "contained",
|
|
9022
|
-
onClick: handleNext,
|
|
9023
|
-
children: "SUPPLY"
|
|
9024
|
-
})]
|
|
9025
|
-
});
|
|
9026
|
-
}
|
|
9027
|
-
|
|
9028
9079
|
function SolanaLendSupply(_ref) {
|
|
9029
9080
|
let {
|
|
9030
9081
|
poolInfo,
|
|
@@ -9054,6 +9105,10 @@ function SolanaLendSupply(_ref) {
|
|
|
9054
9105
|
dispatch(setStep(WIDGET_STEP.Evaluation));
|
|
9055
9106
|
return;
|
|
9056
9107
|
}
|
|
9108
|
+
if (!isUniTranche && (!juniorLenderApproved || !seniorLenderApproved)) {
|
|
9109
|
+
dispatch(setStep(WIDGET_STEP.ApproveLender));
|
|
9110
|
+
return;
|
|
9111
|
+
}
|
|
9057
9112
|
if (juniorLenderApproved && !seniorLenderApproved) {
|
|
9058
9113
|
setSelectedTranche('junior');
|
|
9059
9114
|
dispatch(setStep(WIDGET_STEP.ChooseAmount));
|
|
@@ -9068,7 +9123,7 @@ function SolanaLendSupply(_ref) {
|
|
|
9068
9123
|
dispatch(setStep(WIDGET_STEP.ChooseTranche));
|
|
9069
9124
|
}
|
|
9070
9125
|
}
|
|
9071
|
-
}, [dispatch, handleClose, poolInfo, step, isLoadingLenderAccounts, juniorLenderApproved, seniorLenderApproved, isLoadingTokenAccount]);
|
|
9126
|
+
}, [dispatch, handleClose, poolInfo, step, isLoadingLenderAccounts, juniorLenderApproved, seniorLenderApproved, isLoadingTokenAccount, isUniTranche]);
|
|
9072
9127
|
if (isLoadingLenderAccounts || isLoadingTokenAccount) {
|
|
9073
9128
|
return jsx(WidgetWrapper, {
|
|
9074
9129
|
isOpen: true,
|
|
@@ -9085,10 +9140,12 @@ function SolanaLendSupply(_ref) {
|
|
|
9085
9140
|
handleSuccess: handleSuccess,
|
|
9086
9141
|
children: [step === WIDGET_STEP.Evaluation && jsx(Evaluation, {
|
|
9087
9142
|
poolInfo: poolInfo,
|
|
9088
|
-
isUniTranche: !!isUniTranche,
|
|
9089
9143
|
pointsTestnetExperience: pointsTestnetExperience,
|
|
9090
9144
|
campaign: poolState.campaign,
|
|
9091
|
-
handleClose: handleClose
|
|
9145
|
+
handleClose: handleClose
|
|
9146
|
+
}), step === WIDGET_STEP.ApproveLender && jsx(ApproveLender, {
|
|
9147
|
+
poolInfo: poolInfo,
|
|
9148
|
+
isUniTranche: !!isUniTranche,
|
|
9092
9149
|
changeTranche: setSelectedTranche
|
|
9093
9150
|
}), step === WIDGET_STEP.ChooseTranche && jsx(ChooseTranche$3, {
|
|
9094
9151
|
poolUnderlyingToken: poolInfo.underlyingMint,
|