@huma-finance/widgets 0.0.72-beta.883 → 0.0.72-beta.886
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 +23 -12
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/index.js +24 -13
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
- package/src/components/Lend/components/ApproveLenderBase.tsx +30 -23
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import { useTheme, css, Box, Typography, Tooltip, Button, Dialog, Slider, Input,
|
|
|
3
3
|
import { useAtom, Provider as Provider$1 } from 'jotai';
|
|
4
4
|
import React, { useCallback, useState, useEffect, useMemo, useRef, useContext } from 'react';
|
|
5
5
|
import { useSelector, useDispatch, Provider } from 'react-redux';
|
|
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, SolanaTokenUtils, getSolanaExplorerUrl, sleep, getSentinelAddress, getTokenAccounts, getCreditAccounts, FirstLossCoverIndex, combineStyles, timestampToLL, getTrancheAssetsAndShares, IdentityServiceV2, IdentityVerificationStatusV2, CHAIN_TYPE, SOLANA_CHAIN_INFO, getSolanaNetworkType, CampaignService, convertToShares, formatMoneyFixed, formatNumberFixed, tokenDecimalUtils, STELLAR_CHAINS_INFO, getStellarExplorerUrl, IdentityService, CHAINS, configUtil, KYC_PROVIDER, getEvmNetworkType, formatAmount, getTrancheVaultContractV2, getTrancheRedemptionStatusV2, getPoolContractV2, ChainEnum, getBlockchainConfigFromChain, CURRENCY_CODE, SuperfluidPoolProcessor_ABI, PoolMap } from '@huma-finance/shared';
|
|
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, SolanaTokenUtils, getSolanaExplorerUrl, sleep, getSentinelAddress, getTokenAccounts, getCreditAccounts, FirstLossCoverIndex, combineStyles, timestampToLL, getTrancheAssetsAndShares, IdentityServiceV2, IdentityVerificationStatusV2, CHAIN_TYPE, COMMON_ERROR_MESSAGE, SOLANA_TRANSACTION_EXPIRED_BLOCKHEIGHT_EXCEEDED_ERROR, SOLANA_CHAIN_INFO, getSolanaNetworkType, CampaignService, convertToShares, formatMoneyFixed, formatNumberFixed, tokenDecimalUtils, STELLAR_CHAINS_INFO, getStellarExplorerUrl, IdentityService, CHAINS, configUtil, KYC_PROVIDER, getEvmNetworkType, formatAmount, getTrancheVaultContractV2, getTrancheRedemptionStatusV2, getPoolContractV2, ChainEnum, getBlockchainConfigFromChain, CURRENCY_CODE, SuperfluidPoolProcessor_ABI, PoolMap } from '@huma-finance/shared';
|
|
7
7
|
import { useWeb3React } from '@web3-react/core';
|
|
8
8
|
import ErrorOutlineIcon from '@mui/icons-material/ErrorOutline';
|
|
9
9
|
import { txAtom, useMQ, sendTxAtom, usePoolUnderlyingTokenContract, useMount, usePoolInfo, useAccountStats, usePoolInfoV2, usePoolUnderlyingTokenInfoV2, usePoolSafeAllowanceV2, useAuthErrorHandling, useCLFeeManager, useCLPoolAllowance, usePoolContract, useCreditContractV2, useCreditStatsV2, useHumaProgram, useBorrowerAccounts, useFirstLossCoverContractV2, useFirstLossCoverRequirementV2, useFirstLossCoverAllowanceV2, useFeeManager, useInvoiceNFTContract, useRFPoolAllowance, useLenderDepositRecordV2, useLPConfigV2, useNextEpochStartTimeV2, useTrancheVaultContractV2, useCancellableRedemptionInfoV2, useTrancheMintAccounts, useTrancheTokenAccounts, useLenderAccounts, notEnabledAutoRedeem, getLenderLockupDates, useChainInfo, useTokenAccount, StellarConnectionContext, getClientCommonParams, useStellarLender, useStellarTokenBalance, useParamsSearch, usePoolAllowance, useLenderApproved, useLenderPosition, useWithdrawlLockoutInSeconds, usePoolUnderlyingTokenBalance, usePoolUnderlyingTokenBalanceV2, useLenderApprovedV2, useTrancheVaultAssetsV2, useLastDepositTime, usePoolBalance, useReceivableInfoV2, useReceivableContractV2, useERC2612Permit, useMultiSendContract, useFactoring } from '@huma-finance/web-shared';
|
|
@@ -6509,27 +6509,38 @@ function ApproveLenderBase(_ref) {
|
|
|
6509
6509
|
tryAttempts = 0;
|
|
6510
6510
|
} catch (e) {
|
|
6511
6511
|
if (tryAttempts === 0) {
|
|
6512
|
-
|
|
6513
|
-
errorMessage: 'Something went wrong, please try again later.'
|
|
6514
|
-
}));
|
|
6512
|
+
throw e;
|
|
6515
6513
|
} else {
|
|
6516
6514
|
await timeUtil.sleep(3000);
|
|
6517
6515
|
console.error(e);
|
|
6518
6516
|
}
|
|
6519
6517
|
}
|
|
6520
6518
|
}
|
|
6521
|
-
}, [account, chainId, chainSpecificData,
|
|
6519
|
+
}, [account, chainId, chainSpecificData, documentHash, isDev, networkType]);
|
|
6522
6520
|
useEffect(() => {
|
|
6523
6521
|
const approveLenderAsync = async () => {
|
|
6524
6522
|
if (account && chainId) {
|
|
6525
|
-
|
|
6526
|
-
|
|
6527
|
-
|
|
6528
|
-
|
|
6529
|
-
|
|
6530
|
-
|
|
6531
|
-
|
|
6532
|
-
|
|
6523
|
+
try {
|
|
6524
|
+
if (isUniTranche) {
|
|
6525
|
+
await approveLender(juniorTrancheVault);
|
|
6526
|
+
changeTranche('junior');
|
|
6527
|
+
dispatch(setStep(WIDGET_STEP.ChooseAmount));
|
|
6528
|
+
} else {
|
|
6529
|
+
await approveLender(juniorTrancheVault);
|
|
6530
|
+
await approveLender(seniorTrancheVault);
|
|
6531
|
+
dispatch(setStep(WIDGET_STEP.ChooseTranche));
|
|
6532
|
+
}
|
|
6533
|
+
} catch (e) {
|
|
6534
|
+
var _e$message;
|
|
6535
|
+
console.error(e);
|
|
6536
|
+
// @ts-ignore
|
|
6537
|
+
let errorMessage = (_e$message = e.message) !== null && _e$message !== void 0 ? _e$message : COMMON_ERROR_MESSAGE;
|
|
6538
|
+
if (errorMessage.indexOf(SOLANA_TRANSACTION_EXPIRED_BLOCKHEIGHT_EXCEEDED_ERROR) >= 0) {
|
|
6539
|
+
errorMessage = "Transaction failed due to blockchain congestion. Please try again.";
|
|
6540
|
+
}
|
|
6541
|
+
dispatch(setError({
|
|
6542
|
+
errorMessage
|
|
6543
|
+
}));
|
|
6533
6544
|
}
|
|
6534
6545
|
}
|
|
6535
6546
|
};
|