@huma-finance/widgets 0.0.62-beta.730 → 0.0.62-beta.732
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 +27 -7
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/index.js +28 -8
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
- package/src/components/SolanaTxSendModal.tsx +30 -7
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,24 +8825,44 @@ function SolanaTxSendModal(_ref) {
|
|
|
8825
8825
|
if (!connection || !tx) {
|
|
8826
8826
|
return;
|
|
8827
8827
|
}
|
|
8828
|
+
let signatureResult = '';
|
|
8828
8829
|
try {
|
|
8830
|
+
// Optimize transaction
|
|
8829
8831
|
const lockedWritableAccounts = extractWritableAccounts(tx);
|
|
8830
8832
|
const optimizedTx = await buildOptimalTransactionFromConnection(tx, lockedWritableAccounts, connection);
|
|
8831
|
-
|
|
8832
|
-
|
|
8833
|
-
|
|
8833
|
+
signatureResult = await sendTransaction(optimizedTx, connection, {
|
|
8834
|
+
preflightCommitment: 'confirmed',
|
|
8835
|
+
skipPreflight: true
|
|
8834
8836
|
});
|
|
8835
|
-
setSignature(
|
|
8836
|
-
dispatch(setSolanaSignature(
|
|
8837
|
+
setSignature(signatureResult);
|
|
8838
|
+
dispatch(setSolanaSignature(signatureResult));
|
|
8837
8839
|
await connection.confirmTransaction({
|
|
8838
8840
|
blockhash: optimizedTx.recentBlockhash,
|
|
8839
8841
|
lastValidBlockHeight: optimizedTx.lastValidBlockHeight,
|
|
8840
|
-
signature
|
|
8842
|
+
signature: signatureResult
|
|
8841
8843
|
});
|
|
8842
8844
|
handleSuccess({
|
|
8843
|
-
signature
|
|
8845
|
+
signature: signatureResult
|
|
8844
8846
|
});
|
|
8845
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
|
+
}
|
|
8846
8866
|
const err = error;
|
|
8847
8867
|
dispatch(setError({
|
|
8848
8868
|
errorMessage: (err === null || err === void 0 ? void 0 : err.message) || ''
|