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

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
@@ -23,7 +23,7 @@ import { NumericFormat } from 'react-number-format';
23
23
  import ArrowForwardIosIcon from '@mui/icons-material/ArrowForwardIos';
24
24
  import dayjs from 'dayjs';
25
25
  import Persona from 'persona';
26
- import { drawdownWithReceivable, HumaContext, HumaReceivableFactory, makePaymentWithReceivable, makePrincipalPaymentAndDrawdownWithReceivable } from '@huma-finance/sdk';
26
+ import { drawdownWithReceivable, HumaContext, HumaReceivableFactory, makePaymentWithReceivable, makePrincipalPaymentAndDrawdownWithReceivable, extractWritableAccounts, buildOptimalTransactionFromConnection } from '@huma-finance/sdk';
27
27
  import moment from 'moment';
28
28
  import { getAddress } from '@ethersproject/address';
29
29
  import { BN } from '@coral-xyz/anchor';
@@ -8826,13 +8826,17 @@ function SolanaTxSendModal(_ref) {
8826
8826
  return;
8827
8827
  }
8828
8828
  try {
8829
- const latestBlockHash = await connection.getLatestBlockhash();
8830
- const signature = await sendTransaction(tx, connection);
8829
+ const lockedWritableAccounts = extractWritableAccounts(tx);
8830
+ const optimizedTx = await buildOptimalTransactionFromConnection(tx, lockedWritableAccounts, connection);
8831
+ const signature = await sendTransaction(optimizedTx, connection, {
8832
+ maxRetries: 5,
8833
+ preflightCommitment: 'confirmed'
8834
+ });
8831
8835
  setSignature(signature);
8832
8836
  dispatch(setSolanaSignature(signature));
8833
8837
  await connection.confirmTransaction({
8834
- blockhash: latestBlockHash.blockhash,
8835
- lastValidBlockHeight: latestBlockHash.lastValidBlockHeight,
8838
+ blockhash: optimizedTx.recentBlockhash,
8839
+ lastValidBlockHeight: optimizedTx.lastValidBlockHeight,
8836
8840
  signature
8837
8841
  });
8838
8842
  handleSuccess({