@wagmi/core 1.0.3 → 1.0.4
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.
|
@@ -2685,7 +2685,7 @@ async function prepareSendTransaction({
|
|
|
2685
2685
|
account,
|
|
2686
2686
|
chainId,
|
|
2687
2687
|
data,
|
|
2688
|
-
gas,
|
|
2688
|
+
gas: gas_,
|
|
2689
2689
|
gasPrice,
|
|
2690
2690
|
maxFeePerGas,
|
|
2691
2691
|
maxPriorityFeePerGas,
|
|
@@ -2694,6 +2694,7 @@ async function prepareSendTransaction({
|
|
|
2694
2694
|
value,
|
|
2695
2695
|
walletClient: walletClient_
|
|
2696
2696
|
}) {
|
|
2697
|
+
const publicClient = getPublicClient({ chainId });
|
|
2697
2698
|
const walletClient = walletClient_ ?? await getWalletClient({ chainId });
|
|
2698
2699
|
if (!walletClient)
|
|
2699
2700
|
throw new ConnectorNotFoundError();
|
|
@@ -2702,6 +2703,18 @@ async function prepareSendTransaction({
|
|
|
2702
2703
|
const to = (to_ && !isAddress(to_) ? await fetchEnsAddress({ name: to_ }) : to_) || void 0;
|
|
2703
2704
|
if (to && !isAddress(to))
|
|
2704
2705
|
throw new Error("Invalid address");
|
|
2706
|
+
const gas = typeof gas_ === "undefined" ? await publicClient.estimateGas({
|
|
2707
|
+
accessList,
|
|
2708
|
+
account: walletClient.account,
|
|
2709
|
+
data,
|
|
2710
|
+
gas: gas_ ?? void 0,
|
|
2711
|
+
gasPrice,
|
|
2712
|
+
maxFeePerGas,
|
|
2713
|
+
maxPriorityFeePerGas,
|
|
2714
|
+
nonce,
|
|
2715
|
+
to,
|
|
2716
|
+
value
|
|
2717
|
+
}) : gas_ || void 0;
|
|
2705
2718
|
return {
|
|
2706
2719
|
accessList,
|
|
2707
2720
|
account,
|
|
@@ -2759,7 +2772,7 @@ async function sendTransaction({
|
|
|
2759
2772
|
account,
|
|
2760
2773
|
chainId,
|
|
2761
2774
|
data,
|
|
2762
|
-
gas,
|
|
2775
|
+
gas: gas || null,
|
|
2763
2776
|
gasPrice,
|
|
2764
2777
|
maxFeePerGas,
|
|
2765
2778
|
maxPriorityFeePerGas,
|
package/dist/index.d.ts
CHANGED
|
@@ -513,9 +513,10 @@ type SendTransactionResult = {
|
|
|
513
513
|
*/
|
|
514
514
|
declare function sendTransaction({ accessList, account, chainId, data, gas, gasPrice, maxFeePerGas, maxPriorityFeePerGas, mode, nonce, to, value, }: SendTransactionArgs): Promise<SendTransactionResult>;
|
|
515
515
|
|
|
516
|
-
type PrepareSendTransactionArgs<TWalletClient extends WalletClient = WalletClient> = Omit<SendTransactionParameters<Chain$1, Account>, 'chain' | 'to'> & {
|
|
516
|
+
type PrepareSendTransactionArgs<TWalletClient extends WalletClient = WalletClient> = Omit<SendTransactionParameters<Chain$1, Account>, 'chain' | 'gas' | 'to'> & {
|
|
517
517
|
/** Chain ID used to validate if the walletClient is connected to the target chain */
|
|
518
518
|
chainId?: number;
|
|
519
|
+
gas?: bigint | null;
|
|
519
520
|
to?: string;
|
|
520
521
|
walletClient?: TWalletClient | null;
|
|
521
522
|
};
|
|
@@ -539,7 +540,7 @@ type PrepareSendTransactionResult = Omit<SendTransactionArgs, 'mode' | 'to'> & {
|
|
|
539
540
|
* })
|
|
540
541
|
* const result = await sendTransaction(config)
|
|
541
542
|
*/
|
|
542
|
-
declare function prepareSendTransaction({ accessList, account, chainId, data, gas, gasPrice, maxFeePerGas, maxPriorityFeePerGas, nonce, to: to_, value, walletClient: walletClient_, }: PrepareSendTransactionArgs): Promise<PrepareSendTransactionResult>;
|
|
543
|
+
declare function prepareSendTransaction({ accessList, account, chainId, data, gas: gas_, gasPrice, maxFeePerGas, maxPriorityFeePerGas, nonce, to: to_, value, walletClient: walletClient_, }: PrepareSendTransactionArgs): Promise<PrepareSendTransactionResult>;
|
|
543
544
|
|
|
544
545
|
type WaitForTransactionArgs = {
|
|
545
546
|
/** Chain id to use for Public Client. */
|
package/dist/index.js
CHANGED
package/dist/internal/index.js
CHANGED
package/dist/internal/test.js
CHANGED