@huma-finance/widgets 0.0.62-beta.733 → 0.0.62

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.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, 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';
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, sleep, 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
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';
@@ -8825,26 +8825,44 @@ function SolanaTxSendModal(_ref) {
8825
8825
  if (!connection || !tx) {
8826
8826
  return;
8827
8827
  }
8828
+ let signatureResult = '';
8828
8829
  try {
8829
8830
  // Optimize transaction
8830
8831
  const lockedWritableAccounts = extractWritableAccounts(tx);
8831
8832
  const optimizedTx = await buildOptimalTransactionFromConnection(tx, lockedWritableAccounts, connection);
8832
- const signature = await sendTransaction(optimizedTx, connection, {
8833
- maxRetries: 5,
8833
+ signatureResult = await sendTransaction(optimizedTx, connection, {
8834
8834
  preflightCommitment: 'confirmed',
8835
8835
  skipPreflight: true
8836
8836
  });
8837
- setSignature(signature);
8838
- dispatch(setSolanaSignature(signature));
8837
+ setSignature(signatureResult);
8838
+ dispatch(setSolanaSignature(signatureResult));
8839
8839
  await connection.confirmTransaction({
8840
8840
  blockhash: optimizedTx.recentBlockhash,
8841
8841
  lastValidBlockHeight: optimizedTx.lastValidBlockHeight,
8842
- signature
8842
+ signature: signatureResult
8843
8843
  });
8844
8844
  handleSuccess({
8845
- signature
8845
+ signature: signatureResult
8846
8846
  });
8847
8847
  } catch (error) {
8848
+ let signatureStatusRetries = 0;
8849
+ while (signatureStatusRetries < 5) {
8850
+ var _result$value, _result$value2;
8851
+ // Attempt to load the signature status using transaction history
8852
+ // eslint-disable-next-line no-await-in-loop
8853
+ await sleep(1000);
8854
+ // eslint-disable-next-line no-await-in-loop
8855
+ const result = await connection.getSignatureStatus(signatureResult, {
8856
+ searchTransactionHistory: true
8857
+ });
8858
+ if ((result === null || result === void 0 || (_result$value = result.value) === null || _result$value === void 0 ? void 0 : _result$value.confirmationStatus) === 'finalized' || (result === null || result === void 0 || (_result$value2 = result.value) === null || _result$value2 === void 0 ? void 0 : _result$value2.confirmationStatus) === 'confirmed') {
8859
+ handleSuccess({
8860
+ signature: signatureResult
8861
+ });
8862
+ return;
8863
+ }
8864
+ signatureStatusRetries += 1;
8865
+ }
8848
8866
  const err = error;
8849
8867
  dispatch(setError({
8850
8868
  errorMessage: (err === null || err === void 0 ? void 0 : err.message) || ''