wagmi 0.9.6 → 0.10.0
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/actions.d.ts +1 -1
- package/dist/actions.js +2 -0
- package/dist/index.d.ts +12 -2
- package/dist/index.js +30 -7
- package/package.json +2 -2
package/dist/actions.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { ConnectArgs, ConnectResult, FetchBalanceArgs, FetchBalanceResult, FetchBlockNumberArgs, FetchBlockNumberResult, FetchEnsAddressArgs, FetchEnsAddressResult, FetchEnsAvatarArgs, FetchEnsAvatarResult, FetchEnsNameArgs, FetchEnsNameResult, FetchEnsResolverArgs, FetchEnsResolverResult, FetchFeeDataArgs, FetchFeeDataResult, FetchSignerResult, FetchTokenArgs, FetchTokenResult, FetchTransactionArgs, FetchTransactionResult, GetAccountResult, GetContractArgs, GetContractResult, GetNetworkResult, GetProviderArgs, GetProviderResult, GetWebSocketProviderArgs, GetWebSocketProviderResult, MulticallConfig, MulticallResult, ReadContractConfig, ReadContractResult, ReadContractsConfig, ReadContractsResult, SendTransactionArgs, SendTransactionPreparedRequest, SendTransactionResult, SendTransactionUnpreparedRequest, SignMessageArgs, SignMessageResult, SignTypedDataArgs, SignTypedDataResult, SwitchNetworkArgs, SwitchNetworkResult, WaitForTransactionArgs, WaitForTransactionResult, WatchAccountCallback, WatchBlockNumberArgs, WatchBlockNumberCallback, WatchMulticallCallback, WatchMulticallConfig, WatchNetworkCallback, WatchProviderCallback, WatchReadContractCallback, WatchReadContractConfig, WatchReadContractsCallback, WatchReadContractsConfig, WatchSignerCallback, WatchWebSocketProviderCallback, WriteContractArgs, WriteContractPreparedArgs, WriteContractResult, WriteContractUnpreparedArgs, connect, disconnect, fetchBalance, fetchBlockNumber, fetchEnsAddress, fetchEnsAvatar, fetchEnsName, fetchEnsResolver, fetchFeeData, fetchSigner, fetchToken, fetchTransaction, getAccount, getContract, getNetwork, getProvider, getWebSocketProvider, multicall, prepareSendTransaction, prepareWriteContract, readContract, readContracts, sendTransaction, signMessage, signTypedData, switchNetwork, waitForTransaction, watchAccount, watchBlockNumber, watchContractEvent, watchMulticall, watchNetwork, watchProvider, watchReadContract, watchReadContracts, watchSigner, watchWebSocketProvider, writeContract } from '@wagmi/core';
|
|
1
|
+
export { ConnectArgs, ConnectResult, FetchBalanceArgs, FetchBalanceResult, FetchBlockNumberArgs, FetchBlockNumberResult, FetchEnsAddressArgs, FetchEnsAddressResult, FetchEnsAvatarArgs, FetchEnsAvatarResult, FetchEnsNameArgs, FetchEnsNameResult, FetchEnsResolverArgs, FetchEnsResolverResult, FetchFeeDataArgs, FetchFeeDataResult, FetchSignerResult, FetchTokenArgs, FetchTokenResult, FetchTransactionArgs, FetchTransactionResult, GetAccountResult, GetContractArgs, GetContractResult, GetNetworkResult, GetProviderArgs, GetProviderResult, GetWebSocketProviderArgs, GetWebSocketProviderResult, MulticallConfig, MulticallResult, ReadContractConfig, ReadContractResult, ReadContractsConfig, ReadContractsResult, SendTransactionArgs, SendTransactionPreparedRequest, SendTransactionResult, SendTransactionUnpreparedRequest, SignMessageArgs, SignMessageResult, SignTypedDataArgs, SignTypedDataResult, SwitchNetworkArgs, SwitchNetworkResult, WaitForTransactionArgs, WaitForTransactionResult, WatchAccountCallback, WatchBlockNumberArgs, WatchBlockNumberCallback, WatchMulticallCallback, WatchMulticallConfig, WatchNetworkCallback, WatchPendingTransactionsArgs, WatchPendingTransactionsCallback, WatchPendingTransactionsResult, WatchProviderCallback, WatchReadContractCallback, WatchReadContractConfig, WatchReadContractsCallback, WatchReadContractsConfig, WatchSignerCallback, WatchWebSocketProviderCallback, WriteContractArgs, WriteContractPreparedArgs, WriteContractResult, WriteContractUnpreparedArgs, connect, disconnect, fetchBalance, fetchBlockNumber, fetchEnsAddress, fetchEnsAvatar, fetchEnsName, fetchEnsResolver, fetchFeeData, fetchSigner, fetchToken, fetchTransaction, getAccount, getContract, getNetwork, getProvider, getWebSocketProvider, multicall, prepareSendTransaction, prepareWriteContract, readContract, readContracts, sendTransaction, signMessage, signTypedData, switchNetwork, waitForTransaction, watchAccount, watchBlockNumber, watchContractEvent, watchMulticall, watchNetwork, watchPendingTransactions, watchProvider, watchReadContract, watchReadContracts, watchSigner, watchWebSocketProvider, writeContract } from '@wagmi/core';
|
package/dist/actions.js
CHANGED
|
@@ -32,6 +32,7 @@ import {
|
|
|
32
32
|
watchContractEvent,
|
|
33
33
|
watchMulticall,
|
|
34
34
|
watchNetwork,
|
|
35
|
+
watchPendingTransactions,
|
|
35
36
|
watchProvider,
|
|
36
37
|
watchReadContract,
|
|
37
38
|
watchReadContracts,
|
|
@@ -72,6 +73,7 @@ export {
|
|
|
72
73
|
watchContractEvent,
|
|
73
74
|
watchMulticall,
|
|
74
75
|
watchNetwork,
|
|
76
|
+
watchPendingTransactions,
|
|
75
77
|
watchProvider,
|
|
76
78
|
watchReadContract,
|
|
77
79
|
watchReadContracts,
|
package/dist/index.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export { AddChainError, Chain, ChainDoesNotSupportMulticallError, ChainMismatchE
|
|
|
7
7
|
import * as React from 'react';
|
|
8
8
|
import { Address, TypedData, TypedDataToPrimitiveTypes, TypedDataDomain, ResolvedConfig, Abi, ExtractAbiEventNames, ExtractAbiEvent, AbiEvent, Narrow, AbiParametersToPrimitiveTypes } from 'abitype';
|
|
9
9
|
export { Address } from 'abitype';
|
|
10
|
-
import { BigNumber } from 'ethers';
|
|
10
|
+
import { BigNumber, Transaction } from 'ethers';
|
|
11
11
|
import { Optional, IsNever, Or, NotEqual, Event, ContractsConfig } from '@wagmi/core/internal';
|
|
12
12
|
import * as _ethersproject_providers from '@ethersproject/providers';
|
|
13
13
|
|
|
@@ -556,4 +556,14 @@ type UseWaitForTransactionArgs = Partial<WaitForTransactionArgs>;
|
|
|
556
556
|
type UseWaitForTransactionConfig = QueryConfig<WaitForTransactionResult, Error>;
|
|
557
557
|
declare function useWaitForTransaction({ chainId: chainId_, confirmations, hash, timeout, cacheTime, enabled, scopeKey, staleTime, suspense, onError, onSpeedUp, onSettled, onSuccess, }?: UseWaitForTransactionArgs & UseWaitForTransactionConfig): UseQueryResult<_ethersproject_providers.TransactionReceipt, Error>;
|
|
558
558
|
|
|
559
|
-
|
|
559
|
+
type UseWatchPendingTransactionsConfig = {
|
|
560
|
+
/** The chain ID to listen on. */
|
|
561
|
+
chainId?: number;
|
|
562
|
+
/** Subscribe to changes */
|
|
563
|
+
enabled?: boolean;
|
|
564
|
+
/** Function fires when a pending transaction enters the mempool. */
|
|
565
|
+
listener: (transaction: Transaction) => void;
|
|
566
|
+
};
|
|
567
|
+
declare function useWatchPendingTransactions({ chainId: chainId_, enabled, listener, }: UseWatchPendingTransactionsConfig): void;
|
|
568
|
+
|
|
569
|
+
export { Client, Context, CreateClientConfig, WagmiConfig, WagmiConfigProps, createClient, paginatedIndexesConfig, useAccount, useBalance, useBlockNumber, useClient, useConnect, useContract, useContractEvent, useContractInfiniteReads, useContractRead, useContractReads, useContractWrite, useDisconnect, useEnsAddress, useEnsAvatar, useEnsName, useEnsResolver, useFeeData, useInfiniteQuery, useMutation, useNetwork, usePrepareContractWrite, usePrepareSendTransaction, useProvider, useQuery, useQueryClient, useSendTransaction, useSignMessage, useSignTypedData, useSigner, useSwitchNetwork, useToken, useTransaction, useWaitForTransaction, useWatchPendingTransactions, useWebSocketProvider };
|
package/dist/index.js
CHANGED
|
@@ -747,7 +747,7 @@ function useNetwork() {
|
|
|
747
747
|
}
|
|
748
748
|
|
|
749
749
|
// src/hooks/accounts/useSigner.ts
|
|
750
|
-
import { fetchSigner
|
|
750
|
+
import { fetchSigner } from "@wagmi/core";
|
|
751
751
|
import * as React10 from "react";
|
|
752
752
|
function queryKey4({ chainId }) {
|
|
753
753
|
return [{ entity: "signer", chainId, persist: false }];
|
|
@@ -764,9 +764,11 @@ function useSigner({
|
|
|
764
764
|
onSettled,
|
|
765
765
|
onSuccess
|
|
766
766
|
} = {}) {
|
|
767
|
+
const { connector } = useAccount();
|
|
767
768
|
const chainId = useChainId({ chainId: chainId_ });
|
|
768
769
|
const signerQuery = useQuery(queryKey4({ chainId }), queryFn4, {
|
|
769
770
|
cacheTime: 0,
|
|
771
|
+
enabled: Boolean(connector),
|
|
770
772
|
staleTime: Infinity,
|
|
771
773
|
suspense,
|
|
772
774
|
onError,
|
|
@@ -775,12 +777,11 @@ function useSigner({
|
|
|
775
777
|
});
|
|
776
778
|
const queryClient = useQueryClient2();
|
|
777
779
|
React10.useEffect(() => {
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
}, [queryClient, chainId]);
|
|
780
|
+
if (connector)
|
|
781
|
+
signerQuery.refetch();
|
|
782
|
+
else
|
|
783
|
+
queryClient.removeQueries(queryKey4({ chainId }));
|
|
784
|
+
}, [connector]);
|
|
784
785
|
return signerQuery;
|
|
785
786
|
}
|
|
786
787
|
|
|
@@ -2144,6 +2145,27 @@ function useWaitForTransaction({
|
|
|
2144
2145
|
);
|
|
2145
2146
|
}
|
|
2146
2147
|
|
|
2148
|
+
// src/hooks/transactions/useWatchPendingTransactions.ts
|
|
2149
|
+
import * as React21 from "react";
|
|
2150
|
+
function useWatchPendingTransactions({
|
|
2151
|
+
chainId: chainId_,
|
|
2152
|
+
enabled = true,
|
|
2153
|
+
listener
|
|
2154
|
+
}) {
|
|
2155
|
+
const chainId = useChainId({ chainId: chainId_ });
|
|
2156
|
+
const provider = useProvider({ chainId });
|
|
2157
|
+
const webSocketProvider = useWebSocketProvider({ chainId });
|
|
2158
|
+
React21.useEffect(() => {
|
|
2159
|
+
if (!enabled)
|
|
2160
|
+
return;
|
|
2161
|
+
const provider_ = webSocketProvider ?? provider;
|
|
2162
|
+
provider_.on("pending", listener);
|
|
2163
|
+
return () => {
|
|
2164
|
+
provider_.off("pending", listener);
|
|
2165
|
+
};
|
|
2166
|
+
}, [enabled, listener, provider, webSocketProvider]);
|
|
2167
|
+
}
|
|
2168
|
+
|
|
2147
2169
|
// src/index.ts
|
|
2148
2170
|
import {
|
|
2149
2171
|
AddChainError,
|
|
@@ -2243,5 +2265,6 @@ export {
|
|
|
2243
2265
|
useToken,
|
|
2244
2266
|
useTransaction,
|
|
2245
2267
|
useWaitForTransaction,
|
|
2268
|
+
useWatchPendingTransactions,
|
|
2246
2269
|
useWebSocketProvider
|
|
2247
2270
|
};
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "wagmi",
|
|
3
3
|
"description": "React Hooks for Ethereum",
|
|
4
4
|
"license": "MIT",
|
|
5
|
-
"version": "0.
|
|
5
|
+
"version": "0.10.0",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
8
|
"url": "https://github.com/wagmi-dev/wagmi.git",
|
|
@@ -106,7 +106,7 @@
|
|
|
106
106
|
"@walletconnect/ethereum-provider": "^1.8.0",
|
|
107
107
|
"abitype": "^0.2.5",
|
|
108
108
|
"use-sync-external-store": "^1.2.0",
|
|
109
|
-
"@wagmi/core": "0.8.
|
|
109
|
+
"@wagmi/core": "0.8.7"
|
|
110
110
|
},
|
|
111
111
|
"devDependencies": {
|
|
112
112
|
"@testing-library/react": "^13.3.0",
|