@vechain/vechain-kit 2.0.0-rc.5 → 2.0.0-rc.7

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.d.cts CHANGED
@@ -2083,6 +2083,8 @@ declare const getAllEventLogs: ({ nodeUrl, thor, order, from, to, filterCriteria
2083
2083
  * @param onTxConfirmed callback to run when the tx is confirmed
2084
2084
  * @param onTxFailedOrCancelled callback to run when the tx fails or is cancelled
2085
2085
  * @param suggestedMaxGas the suggested max gas for the transaction
2086
+ * @param privyUIOptions options to pass to the Privy UI
2087
+ * @param gasPadding the gas padding to use for the transaction (Eg. 0.1 for 10%)
2086
2088
  */
2087
2089
  type UseSendTransactionProps = {
2088
2090
  signerAccountAddress?: string | null;
@@ -2095,6 +2097,7 @@ type UseSendTransactionProps = {
2095
2097
  description?: string;
2096
2098
  buttonText?: string;
2097
2099
  };
2100
+ gasPadding?: number;
2098
2101
  };
2099
2102
  /**
2100
2103
  * Return value of the {@link useSendTransaction} hook
@@ -2146,9 +2149,10 @@ type UseSendTransactionReturnValue = {
2146
2149
  * @param onTxFailedOrCancelled callback to run when the tx fails or is cancelled
2147
2150
  * @param suggestedMaxGas the suggested max gas for the transaction
2148
2151
  * @param privyUIOptions options to pass to the Privy UI
2152
+ * @param gasPadding the gas padding to use for the transaction (Eg. 0.1 for 10%)
2149
2153
  * @returns see {@link UseSendTransactionReturnValue}
2150
2154
  */
2151
- declare const useSendTransaction: ({ signerAccountAddress, clauses, onTxConfirmed, onTxFailedOrCancelled, suggestedMaxGas, privyUIOptions, }: UseSendTransactionProps) => UseSendTransactionReturnValue;
2155
+ declare const useSendTransaction: ({ signerAccountAddress, clauses, onTxConfirmed, onTxFailedOrCancelled, suggestedMaxGas, privyUIOptions, gasPadding, }: UseSendTransactionProps) => UseSendTransactionReturnValue;
2152
2156
 
2153
2157
  type useTransferERC20Props = {
2154
2158
  fromAddress: string;
package/dist/index.d.ts CHANGED
@@ -2083,6 +2083,8 @@ declare const getAllEventLogs: ({ nodeUrl, thor, order, from, to, filterCriteria
2083
2083
  * @param onTxConfirmed callback to run when the tx is confirmed
2084
2084
  * @param onTxFailedOrCancelled callback to run when the tx fails or is cancelled
2085
2085
  * @param suggestedMaxGas the suggested max gas for the transaction
2086
+ * @param privyUIOptions options to pass to the Privy UI
2087
+ * @param gasPadding the gas padding to use for the transaction (Eg. 0.1 for 10%)
2086
2088
  */
2087
2089
  type UseSendTransactionProps = {
2088
2090
  signerAccountAddress?: string | null;
@@ -2095,6 +2097,7 @@ type UseSendTransactionProps = {
2095
2097
  description?: string;
2096
2098
  buttonText?: string;
2097
2099
  };
2100
+ gasPadding?: number;
2098
2101
  };
2099
2102
  /**
2100
2103
  * Return value of the {@link useSendTransaction} hook
@@ -2146,9 +2149,10 @@ type UseSendTransactionReturnValue = {
2146
2149
  * @param onTxFailedOrCancelled callback to run when the tx fails or is cancelled
2147
2150
  * @param suggestedMaxGas the suggested max gas for the transaction
2148
2151
  * @param privyUIOptions options to pass to the Privy UI
2152
+ * @param gasPadding the gas padding to use for the transaction (Eg. 0.1 for 10%)
2149
2153
  * @returns see {@link UseSendTransactionReturnValue}
2150
2154
  */
2151
- declare const useSendTransaction: ({ signerAccountAddress, clauses, onTxConfirmed, onTxFailedOrCancelled, suggestedMaxGas, privyUIOptions, }: UseSendTransactionProps) => UseSendTransactionReturnValue;
2155
+ declare const useSendTransaction: ({ signerAccountAddress, clauses, onTxConfirmed, onTxFailedOrCancelled, suggestedMaxGas, privyUIOptions, gasPadding, }: UseSendTransactionProps) => UseSendTransactionReturnValue;
2152
2156
 
2153
2157
  type useTransferERC20Props = {
2154
2158
  fromAddress: string;
package/dist/index.js CHANGED
@@ -4818,7 +4818,7 @@ var AddressDisplay = ({
4818
4818
 
4819
4819
  // package.json
4820
4820
  var package_default = {
4821
- version: "2.0.0-rc.5"};
4821
+ version: "2.0.0-rc.7"};
4822
4822
  var VersionFooter = ({ ...props }) => {
4823
4823
  const { darkMode: isDark } = useVeChainKitConfig();
4824
4824
  return /* @__PURE__ */ jsxs(
@@ -17848,8 +17848,13 @@ var getAllEventLogs = async ({
17848
17848
  };
17849
17849
 
17850
17850
  // src/hooks/thor/transactions/transactionUtils.ts
17851
- var estimateTxGas = async (thor, clauses, caller) => {
17852
- const response = await thor.transactions.estimateGas(clauses, caller);
17851
+ var estimateTxGas = async (thor, clauses, caller, options = {
17852
+ revision: "next"
17853
+ // default revision is next
17854
+ }) => {
17855
+ const response = await thor.transactions.estimateGas(clauses, caller, {
17856
+ ...options
17857
+ });
17853
17858
  if (response.reverted) throw new Error("Failed to estimate gas");
17854
17859
  return response.totalGas;
17855
17860
  };
@@ -17859,7 +17864,8 @@ var useSendTransaction = ({
17859
17864
  onTxConfirmed,
17860
17865
  onTxFailedOrCancelled,
17861
17866
  suggestedMaxGas,
17862
- privyUIOptions
17867
+ privyUIOptions,
17868
+ gasPadding
17863
17869
  }) => {
17864
17870
  const thor = useThor();
17865
17871
  const { signer } = useWallet$1();
@@ -17886,16 +17892,21 @@ var useSendTransaction = ({
17886
17892
  estimatedGas = await estimateTxGas(
17887
17893
  thor,
17888
17894
  [..._clauses],
17889
- signerAccountAddress
17895
+ signerAccountAddress,
17896
+ {
17897
+ revision: "next",
17898
+ ...gasPadding ? { gasPadding } : {}
17899
+ //If gasPadding is provided, use it, otherwise it will apply only revision
17900
+ }
17890
17901
  );
17891
17902
  } catch (e) {
17892
17903
  console.error("Gas estimation failed", e);
17893
17904
  }
17894
17905
  const txBody = await thor.transactions.buildTransactionBody(
17895
17906
  _clauses,
17896
- estimatedGas,
17907
+ suggestedMaxGas ?? estimatedGas,
17908
+ //Provide either the suggested max gas (gas Limit) or the estimated gas
17897
17909
  {
17898
- gasLimit: suggestedMaxGas?.toString(),
17899
17910
  // TODO: kit-migration check how to pass the delegator url
17900
17911
  isDelegated: feeDelegation?.delegateAllTransactions
17901
17912
  }
@@ -19074,9 +19085,13 @@ var LegalDocumentsContext = createContext(void 0);
19074
19085
  var useLegalDocuments = () => {
19075
19086
  const context = useContext(LegalDocumentsContext);
19076
19087
  if (!context) {
19077
- throw new Error(
19078
- "useLegalDocuments must be used within LegalDocumentsProvider"
19079
- );
19088
+ return {
19089
+ hasAgreedToRequiredDocuments: true,
19090
+ agreements: [],
19091
+ walletAddress: void 0,
19092
+ documents: [],
19093
+ documentsNotAgreed: []
19094
+ };
19080
19095
  }
19081
19096
  return context;
19082
19097
  };