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

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,19 @@ 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
+ // Optimize transaction
8830
+ const lockedWritableAccounts = extractWritableAccounts(tx);
8831
+ const optimizedTx = await buildOptimalTransactionFromConnection(tx, lockedWritableAccounts, connection);
8832
+ const signature = await sendTransaction(optimizedTx, connection, {
8833
+ maxRetries: 5,
8834
+ preflightCommitment: 'confirmed',
8835
+ skipPreflight: true
8836
+ });
8831
8837
  setSignature(signature);
8832
8838
  dispatch(setSolanaSignature(signature));
8833
8839
  await connection.confirmTransaction({
8834
- blockhash: latestBlockHash.blockhash,
8835
- lastValidBlockHeight: latestBlockHash.lastValidBlockHeight,
8840
+ blockhash: optimizedTx.recentBlockhash,
8841
+ lastValidBlockHeight: optimizedTx.lastValidBlockHeight,
8836
8842
  signature
8837
8843
  });
8838
8844
  handleSuccess({