@vechain/vechain-kit 2.0.0-rc.6 → 2.0.0-rc.8

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.cjs CHANGED
@@ -4825,7 +4825,7 @@ var AddressDisplay = ({
4825
4825
 
4826
4826
  // package.json
4827
4827
  var package_default = {
4828
- version: "2.0.0-rc.6"};
4828
+ version: "2.0.0-rc.8"};
4829
4829
  var VersionFooter = ({ ...props }) => {
4830
4830
  const { darkMode: isDark } = useVeChainKitConfig();
4831
4831
  return /* @__PURE__ */ jsxRuntime.jsxs(
@@ -17855,10 +17855,18 @@ var getAllEventLogs = async ({
17855
17855
  };
17856
17856
 
17857
17857
  // src/hooks/thor/transactions/transactionUtils.ts
17858
- var estimateTxGas = async (thor, clauses, caller) => {
17859
- const response = await thor.transactions.estimateGas(clauses, caller);
17858
+ var estimateTxGas = async (thor, clauses, caller, options) => {
17859
+ const response = await thor.transactions.estimateGas(
17860
+ clauses,
17861
+ caller,
17862
+ options
17863
+ );
17860
17864
  if (response.reverted) throw new Error("Failed to estimate gas");
17861
- return response.totalGas;
17865
+ let totalGas = response?.totalGas ?? 0;
17866
+ if (!totalGas || Number.isNaN(totalGas)) {
17867
+ totalGas = 0;
17868
+ }
17869
+ return Math.ceil(totalGas);
17862
17870
  };
17863
17871
  var useSendTransaction = ({
17864
17872
  signerAccountAddress,
@@ -17866,7 +17874,8 @@ var useSendTransaction = ({
17866
17874
  onTxConfirmed,
17867
17875
  onTxFailedOrCancelled,
17868
17876
  suggestedMaxGas,
17869
- privyUIOptions
17877
+ privyUIOptions,
17878
+ gasPadding
17870
17879
  }) => {
17871
17880
  const thor = dappKitReact.useThor();
17872
17881
  const { signer } = dappKitReact.useWallet();
@@ -17893,7 +17902,12 @@ var useSendTransaction = ({
17893
17902
  estimatedGas = await estimateTxGas(
17894
17903
  thor,
17895
17904
  [..._clauses],
17896
- signerAccountAddress
17905
+ signerAccountAddress,
17906
+ {
17907
+ revision: "next",
17908
+ ...gasPadding ? { gasPadding } : {}
17909
+ //If gasPadding is provided, use it, otherwise it will apply only revision
17910
+ }
17897
17911
  );
17898
17912
  } catch (e) {
17899
17913
  console.error("Gas estimation failed", e);
@@ -18156,7 +18170,8 @@ var useBuildTransaction = ({
18156
18170
  invalidateCache = true,
18157
18171
  onSuccess,
18158
18172
  onFailure,
18159
- suggestedMaxGas
18173
+ suggestedMaxGas,
18174
+ gasPadding
18160
18175
  }) => {
18161
18176
  const { account } = useWallet();
18162
18177
  const queryClient = reactQuery.useQueryClient();
@@ -18177,7 +18192,8 @@ var useBuildTransaction = ({
18177
18192
  signerAccountAddress: account?.address,
18178
18193
  onTxConfirmed: handleOnSuccess,
18179
18194
  suggestedMaxGas,
18180
- onTxFailedOrCancelled: onFailure
18195
+ onTxFailedOrCancelled: onFailure,
18196
+ gasPadding
18181
18197
  });
18182
18198
  const sendTransaction = React10.useCallback(
18183
18199
  async (props) => {