wagmi 0.9.2 → 0.9.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.
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "type": "module",
3
3
  "main": "../dist/actions.js"
4
- }
4
+ }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "type": "module",
3
3
  "main": "../dist/chains.js"
4
- }
4
+ }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "type": "module",
3
3
  "main": "../../dist/connectors/coinbaseWallet.js"
4
- }
4
+ }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "type": "module",
3
3
  "main": "../../dist/connectors/injected.js"
4
- }
4
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "type": "module",
3
+ "main": "../../dist/connectors/ledger.js"
4
+ }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "type": "module",
3
3
  "main": "../../dist/connectors/metaMask.js"
4
- }
4
+ }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "type": "module",
3
3
  "main": "../../dist/connectors/mock.js"
4
- }
4
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "type": "module",
3
+ "main": "../dist/connectors/index.js"
4
+ }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "type": "module",
3
3
  "main": "../../dist/connectors/walletConnect.js"
4
- }
4
+ }
package/dist/chains.d.ts CHANGED
@@ -1 +1 @@
1
- export { Chain, arbitrum, arbitrumGoerli, avalanche, avalancheFuji, bsc, bscTestnet, fantom, fantomTestnet, foundry, goerli, hardhat, localhost, mainnet, optimism, optimismGoerli, polygon, polygonMumbai, sepolia } from '@wagmi/core/chains';
1
+ export { Chain, arbitrum, arbitrumGoerli, avalanche, avalancheFuji, bsc, bscTestnet, fantom, fantomTestnet, foundry, goerli, hardhat, localhost, mainnet, optimism, optimismGoerli, polygon, polygonMumbai, sepolia, taraxa, taraxaTestnet } from '@wagmi/core/chains';
package/dist/chains.js CHANGED
@@ -17,7 +17,9 @@ import {
17
17
  optimismGoerli,
18
18
  polygon,
19
19
  polygonMumbai,
20
- sepolia
20
+ sepolia,
21
+ taraxa,
22
+ taraxaTestnet
21
23
  } from "@wagmi/core/chains";
22
24
  export {
23
25
  arbitrum,
@@ -37,5 +39,7 @@ export {
37
39
  optimismGoerli,
38
40
  polygon,
39
41
  polygonMumbai,
40
- sepolia
42
+ sepolia,
43
+ taraxa,
44
+ taraxaTestnet
41
45
  };
@@ -0,0 +1 @@
1
+ export { Connector, ConnectorData, ConnectorEvents } from '@wagmi/core/connectors';
@@ -0,0 +1,5 @@
1
+ // src/connectors/index.ts
2
+ import { Connector } from "@wagmi/core/connectors";
3
+ export {
4
+ Connector
5
+ };
@@ -0,0 +1 @@
1
+ export { LedgerConnector } from '@wagmi/core/connectors/ledger';
@@ -0,0 +1,5 @@
1
+ // src/connectors/ledger.ts
2
+ import { LedgerConnector } from "@wagmi/core/connectors/ledger";
3
+ export {
4
+ LedgerConnector
5
+ };
package/dist/index.d.ts CHANGED
@@ -9,7 +9,6 @@ import { Address, TypedData, TypedDataToPrimitiveTypes, TypedDataDomain, Resolve
9
9
  export { Address } from 'abitype';
10
10
  import { BigNumber } from 'ethers';
11
11
  import { Optional, IsNever, Or, NotEqual, Event, ContractsConfig } from '@wagmi/core/internal';
12
- import * as _wagmi_chains from '@wagmi/chains';
13
12
  import * as _ethersproject_providers from '@ethersproject/providers';
14
13
 
15
14
  type CreateClientConfig<TProvider extends Provider = Provider, TWebSocketProvider extends WebSocketProvider = WebSocketProvider> = ClientConfig<TProvider, TWebSocketProvider> & {
@@ -141,7 +140,7 @@ declare function useConnect({ chainId, connector, onError, onMutate, onSettled,
141
140
  readonly isSuccess: boolean;
142
141
  readonly pendingConnector: _wagmi_core.Connector<any, any, any> | undefined;
143
142
  readonly reset: () => void;
144
- readonly status: "success" | "error" | "loading" | "idle";
143
+ readonly status: "error" | "success" | "loading" | "idle";
145
144
  readonly variables: ConnectArgs | undefined;
146
145
  };
147
146
 
@@ -167,7 +166,7 @@ declare function useDisconnect({ onError, onMutate, onSettled, onSuccess, }?: Us
167
166
  readonly isLoading: boolean;
168
167
  readonly isSuccess: boolean;
169
168
  readonly reset: () => void;
170
- readonly status: "success" | "error" | "loading" | "idle";
169
+ readonly status: "error" | "success" | "loading" | "idle";
171
170
  };
172
171
 
173
172
  declare function useNetwork(): _wagmi_core.GetNetworkResult;
@@ -187,7 +186,7 @@ declare function useSignMessage({ message, onError, onMutate, onSettled, onSucce
187
186
  reset: () => void;
188
187
  signMessage: (args?: SignMessageArgs) => void;
189
188
  signMessageAsync: (args?: SignMessageArgs) => Promise<`0x${string}`>;
190
- status: "success" | "error" | "loading" | "idle";
189
+ status: "error" | "success" | "loading" | "idle";
191
190
  variables: SignMessageArgs | undefined;
192
191
  };
193
192
 
@@ -203,7 +202,7 @@ declare function useSignTypedData<TTypedData extends TypedData>({ domain, types,
203
202
  reset: () => void;
204
203
  signTypedData: <TTypedDataMutate extends TypedData = TTypedData>(args?: UseSignTypedDataArgs<TTypedDataMutate> | undefined) => void;
205
204
  signTypedDataAsync: <TTypedDataMutate_1 extends TypedData = TTypedData>(args?: UseSignTypedDataArgs<TTypedDataMutate_1> | undefined) => Promise<string>;
206
- status: "success" | "error" | "loading" | "idle";
205
+ status: "error" | "success" | "loading" | "idle";
207
206
  variables: SignTypedDataArgs<TTypedData> | undefined;
208
207
  };
209
208
 
@@ -212,8 +211,8 @@ type UseSwitchNetworkConfig = MutationConfig<SwitchNetworkResult, Error, SwitchN
212
211
  throwForSwitchChainNotSupported?: boolean;
213
212
  };
214
213
  declare function useSwitchNetwork({ chainId, throwForSwitchChainNotSupported, onError, onMutate, onSettled, onSuccess, }?: UseSwitchNetworkArgs & UseSwitchNetworkConfig): {
215
- readonly chains: _wagmi_chains.Chain[];
216
- readonly data: _wagmi_chains.Chain | undefined;
214
+ readonly chains: _wagmi_core.Chain[];
215
+ readonly data: _wagmi_core.Chain | undefined;
217
216
  readonly error: Error | null;
218
217
  readonly isError: boolean;
219
218
  readonly isIdle: boolean;
@@ -221,9 +220,9 @@ declare function useSwitchNetwork({ chainId, throwForSwitchChainNotSupported, on
221
220
  readonly isSuccess: boolean;
222
221
  readonly pendingChainId: number | undefined;
223
222
  readonly reset: () => void;
224
- readonly status: "success" | "error" | "loading" | "idle";
223
+ readonly status: "error" | "success" | "loading" | "idle";
225
224
  readonly switchNetwork: ((chainId_?: SwitchNetworkArgs['chainId']) => void) | undefined;
226
- readonly switchNetworkAsync: ((chainId_?: SwitchNetworkArgs['chainId']) => Promise<_wagmi_chains.Chain>) | undefined;
225
+ readonly switchNetworkAsync: ((chainId_?: SwitchNetworkArgs['chainId']) => Promise<_wagmi_core.Chain>) | undefined;
227
226
  readonly variables: SwitchNetworkArgs | undefined;
228
227
  };
229
228
 
@@ -368,7 +367,7 @@ declare function useContractWrite<TAbi extends Abi | readonly unknown[], TFuncti
368
367
  isLoading: boolean;
369
368
  isSuccess: boolean;
370
369
  reset: () => void;
371
- status: "success" | "error" | "loading" | "idle";
370
+ status: "error" | "success" | "loading" | "idle";
372
371
  variables: UseContractWriteArgs<Abi, string> | undefined;
373
372
  write: ((overrideConfig?: UseContractWriteMutationArgs<typeof mode, TAbi, TFunctionName>) => void) | undefined;
374
373
  writeAsync: ((overrideConfig?: UseContractWriteMutationArgs<typeof mode, TAbi, TFunctionName>) => Promise<_wagmi_core.SendTransactionResult>) | undefined;
@@ -398,7 +397,7 @@ type UsePrepareContractWriteConfig<TAbi = Abi, TFunctionName extends string = st
398
397
  */
399
398
  declare function usePrepareContractWrite<TAbi extends Abi | readonly unknown[], TFunctionName extends string>({ address, abi, functionName, chainId, args, overrides, cacheTime, enabled, scopeKey, staleTime, suspense, onError, onSettled, onSuccess, }?: UsePrepareContractWriteConfig<TAbi, TFunctionName>): Pick<_tanstack_react_query.QueryObserverResult<PrepareWriteContractResult<TAbi, TFunctionName>, Error>, "data" | "error" | "isError" | "isLoading" | "isSuccess" | "isFetched" | "isFetchedAfterMount" | "isFetching" | "isRefetching" | "refetch" | "fetchStatus"> & {
400
399
  isIdle: boolean;
401
- status: "success" | "error" | "loading" | "idle";
400
+ status: "error" | "success" | "loading" | "idle";
402
401
  internal: Pick<_tanstack_react_query.QueryObserverResult<unknown, unknown>, "isLoadingError" | "isRefetchError" | "dataUpdatedAt" | "errorUpdatedAt" | "failureCount" | "isPaused" | "isPlaceholderData" | "isPreviousData" | "isStale" | "remove">;
403
402
  } & {
404
403
  config: PrepareWriteContractResult<TAbi, TFunctionName>;
@@ -468,7 +467,7 @@ type UsePrepareSendTransactionConfig = Partial<PrepareSendTransactionArgs> & Que
468
467
  declare function usePrepareSendTransaction({ chainId, request, cacheTime, enabled, scopeKey, staleTime, // 24 hours
469
468
  suspense, onError, onSettled, onSuccess, }?: UsePrepareSendTransactionConfig): Pick<_tanstack_react_query.QueryObserverResult<PrepareSendTransactionResult, Error>, "data" | "error" | "isError" | "isLoading" | "isSuccess" | "isFetched" | "isFetchedAfterMount" | "isFetching" | "isRefetching" | "refetch" | "fetchStatus"> & {
470
469
  isIdle: boolean;
471
- status: "success" | "error" | "loading" | "idle";
470
+ status: "error" | "success" | "loading" | "idle";
472
471
  internal: Pick<_tanstack_react_query.QueryObserverResult<unknown, unknown>, "isLoadingError" | "isRefetchError" | "dataUpdatedAt" | "errorUpdatedAt" | "failureCount" | "isPaused" | "isPlaceholderData" | "isPreviousData" | "isStale" | "remove">;
473
472
  } & {
474
473
  config: PrepareSendTransactionResult;
@@ -534,7 +533,7 @@ declare function useSendTransaction<Args extends UseSendTransactionArgs = UseSen
534
533
  reset: () => void;
535
534
  sendTransaction: MutateFnReturnValue<Args, SendTransactionFn>;
536
535
  sendTransactionAsync: MutateFnReturnValue<Args, SendTransactionAsyncFn>;
537
- status: "success" | "error" | "loading" | "idle";
536
+ status: "error" | "success" | "loading" | "idle";
538
537
  variables: SendTransactionArgs | undefined;
539
538
  };
540
539
 
package/dist/index.js CHANGED
@@ -375,6 +375,8 @@ function useBlockNumber({
375
375
  const webSocketProvider = useWebSocketProvider({ chainId });
376
376
  const queryClient = useQueryClient2();
377
377
  React4.useEffect(() => {
378
+ if (!enabled)
379
+ return;
378
380
  if (!watch && !onBlock)
379
381
  return;
380
382
  const listener = debounce((blockNumber) => {
@@ -395,7 +397,8 @@ function useBlockNumber({
395
397
  provider,
396
398
  queryClient,
397
399
  watch,
398
- webSocketProvider
400
+ webSocketProvider,
401
+ enabled
399
402
  ]);
400
403
  return useQuery(queryKey({ scopeKey, chainId }), queryFn, {
401
404
  cacheTime,
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.9.2",
5
+ "version": "0.9.4",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "https://github.com/wagmi-dev/wagmi.git",
@@ -40,6 +40,10 @@
40
40
  "types": "./dist/chains.d.ts",
41
41
  "default": "./dist/chains.js"
42
42
  },
43
+ "./connectors": {
44
+ "types": "./dist/connectors/index.d.ts",
45
+ "default": "./dist/connectors/index.js"
46
+ },
43
47
  "./connectors/coinbaseWallet": {
44
48
  "types": "./dist/connectors/coinbaseWallet.d.ts",
45
49
  "default": "./dist/connectors/coinbaseWallet.js"
@@ -48,6 +52,10 @@
48
52
  "types": "./dist/connectors/injected.d.ts",
49
53
  "default": "./dist/connectors/injected.js"
50
54
  },
55
+ "./connectors/ledger": {
56
+ "types": "./dist/connectors/ledger.d.ts",
57
+ "default": "./dist/connectors/ledger.js"
58
+ },
51
59
  "./connectors/metaMask": {
52
60
  "types": "./dist/connectors/metaMask.d.ts",
53
61
  "default": "./dist/connectors/metaMask.js"
@@ -98,7 +106,7 @@
98
106
  "@walletconnect/ethereum-provider": "^1.8.0",
99
107
  "abitype": "^0.2.5",
100
108
  "use-sync-external-store": "^1.2.0",
101
- "@wagmi/core": "0.8.2"
109
+ "@wagmi/core": "0.8.4"
102
110
  },
103
111
  "devDependencies": {
104
112
  "@testing-library/react": "^13.3.0",
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "type": "module",
3
3
  "main": "../../dist/providers/alchemy.js"
4
- }
4
+ }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "type": "module",
3
3
  "main": "../../dist/providers/infura.js"
4
- }
4
+ }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "type": "module",
3
3
  "main": "../../dist/providers/jsonRpc.js"
4
- }
4
+ }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "type": "module",
3
3
  "main": "../../dist/providers/public.js"
4
- }
4
+ }