@wagmi/core 2.0.0-alpha.1 → 2.0.0-alpha.3
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/esm/actions/connect.js +7 -12
- package/dist/esm/actions/connect.js.map +1 -1
- package/dist/esm/actions/disconnect.js +2 -0
- package/dist/esm/actions/disconnect.js.map +1 -1
- package/dist/esm/actions/getBalance.js +11 -4
- package/dist/esm/actions/getBalance.js.map +1 -1
- package/dist/esm/actions/getConnectorClient.js.map +1 -1
- package/dist/esm/actions/getConnectors.js +11 -0
- package/dist/esm/actions/getConnectors.js.map +1 -0
- package/dist/esm/actions/readContracts.js.map +1 -1
- package/dist/esm/actions/reconnect.js +1 -1
- package/dist/esm/actions/reconnect.js.map +1 -1
- package/dist/esm/actions/signTypedData.js.map +1 -1
- package/dist/esm/actions/switchAccount.js.map +1 -1
- package/dist/esm/actions/waitForTransactionReceipt.js.map +1 -1
- package/dist/esm/actions/watchAccount.js.map +1 -1
- package/dist/esm/actions/watchBlockNumber.js.map +1 -1
- package/dist/esm/actions/watchBlocks.js.map +1 -1
- package/dist/esm/actions/watchConnectors.js +9 -0
- package/dist/esm/actions/watchConnectors.js.map +1 -0
- package/dist/esm/createConfig.js +22 -12
- package/dist/esm/createConfig.js.map +1 -1
- package/dist/esm/createConnector.js.map +1 -1
- package/dist/esm/createStorage.js +2 -2
- package/dist/esm/createStorage.js.map +1 -1
- package/dist/esm/exports/actions.js +2 -0
- package/dist/esm/exports/actions.js.map +1 -1
- package/dist/esm/exports/index.js +2 -0
- package/dist/esm/exports/index.js.map +1 -1
- package/dist/esm/exports/query.js +1 -0
- package/dist/esm/exports/query.js.map +1 -1
- package/dist/esm/query/estimateGas.js.map +1 -1
- package/dist/esm/query/getBalance.js +5 -4
- package/dist/esm/query/getBalance.js.map +1 -1
- package/dist/esm/query/getTransaction.js +3 -2
- package/dist/esm/query/getTransaction.js.map +1 -1
- package/dist/esm/query/infiniteReadContracts.js +21 -0
- package/dist/esm/query/infiniteReadContracts.js.map +1 -0
- package/dist/esm/query/readContract.js +2 -2
- package/dist/esm/query/readContract.js.map +1 -1
- package/dist/esm/query/readContracts.js +2 -2
- package/dist/esm/query/readContracts.js.map +1 -1
- package/dist/esm/query/simulateContract.js +5 -1
- package/dist/esm/query/simulateContract.js.map +1 -1
- package/dist/esm/query/utils.js +12 -0
- package/dist/esm/query/utils.js.map +1 -1
- package/dist/esm/tsconfig.build.tsbuildinfo +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/types/actions/connect.d.ts +2 -2
- package/dist/types/actions/connect.d.ts.map +1 -1
- package/dist/types/actions/disconnect.d.ts +3 -4
- package/dist/types/actions/disconnect.d.ts.map +1 -1
- package/dist/types/actions/getBalance.d.ts.map +1 -1
- package/dist/types/actions/getConnectors.d.ts +5 -0
- package/dist/types/actions/getConnectors.d.ts.map +1 -0
- package/dist/types/actions/getToken.d.ts +3 -3
- package/dist/types/actions/getToken.d.ts.map +1 -1
- package/dist/types/actions/multicall.d.ts +1 -1
- package/dist/types/actions/multicall.d.ts.map +1 -1
- package/dist/types/actions/signTypedData.d.ts +2 -1
- package/dist/types/actions/signTypedData.d.ts.map +1 -1
- package/dist/types/actions/switchAccount.d.ts.map +1 -1
- package/dist/types/actions/switchChain.d.ts +2 -2
- package/dist/types/actions/switchChain.d.ts.map +1 -1
- package/dist/types/actions/waitForTransactionReceipt.d.ts.map +1 -1
- package/dist/types/actions/watchAccount.d.ts.map +1 -1
- package/dist/types/actions/watchBlocks.d.ts.map +1 -1
- package/dist/types/actions/watchConnectors.d.ts +9 -0
- package/dist/types/actions/watchConnectors.d.ts.map +1 -0
- package/dist/types/createConfig.d.ts +12 -8
- package/dist/types/createConfig.d.ts.map +1 -1
- package/dist/types/createConnector.d.ts.map +1 -1
- package/dist/types/createStorage.d.ts +1 -1
- package/dist/types/createStorage.d.ts.map +1 -1
- package/dist/types/errors/base.d.ts +7 -7
- package/dist/types/errors/base.d.ts.map +1 -1
- package/dist/types/exports/actions.d.ts +2 -0
- package/dist/types/exports/actions.d.ts.map +1 -1
- package/dist/types/exports/index.d.ts +2 -0
- package/dist/types/exports/index.d.ts.map +1 -1
- package/dist/types/exports/query.d.ts +1 -0
- package/dist/types/exports/query.d.ts.map +1 -1
- package/dist/types/query/connect.d.ts +1 -1
- package/dist/types/query/getBalance.d.ts.map +1 -1
- package/dist/types/query/getToken.d.ts +3 -3
- package/dist/types/query/getTransaction.d.ts.map +1 -1
- package/dist/types/query/infiniteReadContracts.d.ts +61 -0
- package/dist/types/query/infiniteReadContracts.d.ts.map +1 -0
- package/dist/types/query/readContract.d.ts +3 -3
- package/dist/types/query/readContract.d.ts.map +1 -1
- package/dist/types/query/readContracts.d.ts +8 -8
- package/dist/types/query/readContracts.d.ts.map +1 -1
- package/dist/types/query/signTypedData.d.ts +219 -206
- package/dist/types/query/signTypedData.d.ts.map +1 -1
- package/dist/types/query/simulateContract.d.ts +3 -3
- package/dist/types/query/simulateContract.d.ts.map +1 -1
- package/dist/types/query/switchChain.d.ts +1 -1
- package/dist/types/query/types.d.ts +14 -4
- package/dist/types/query/types.d.ts.map +1 -1
- package/dist/types/query/utils.d.ts.map +1 -1
- package/dist/types/query/waitForTransactionReceipt.d.ts +1 -1
- package/dist/types/types/utils.d.ts +0 -9
- package/dist/types/types/utils.d.ts.map +1 -1
- package/dist/types/version.d.ts +1 -1
- package/package.json +4 -4
- package/src/actions/connect.ts +9 -15
- package/src/actions/disconnect.ts +4 -3
- package/src/actions/getBalance.ts +12 -4
- package/src/actions/getBlock.ts +1 -1
- package/src/actions/getConnectorClient.ts +1 -1
- package/src/actions/getConnectors.ts +14 -0
- package/src/actions/getToken.ts +3 -3
- package/src/actions/multicall.ts +1 -1
- package/src/actions/readContracts.ts +1 -1
- package/src/actions/reconnect.ts +1 -1
- package/src/actions/signTypedData.ts +5 -7
- package/src/actions/switchAccount.ts +1 -0
- package/src/actions/switchChain.ts +2 -2
- package/src/actions/waitForTransactionReceipt.ts +3 -1
- package/src/actions/watchAccount.ts +1 -0
- package/src/actions/watchBlockNumber.ts +2 -2
- package/src/actions/watchBlocks.ts +2 -5
- package/src/actions/watchConnectors.ts +22 -0
- package/src/createConfig.ts +75 -54
- package/src/createConnector.ts +2 -10
- package/src/createStorage.ts +3 -4
- package/src/errors/base.ts +5 -5
- package/src/exports/actions.ts +11 -0
- package/src/exports/index.ts +11 -0
- package/src/exports/query.ts +9 -0
- package/src/query/estimateGas.ts +1 -1
- package/src/query/getBalance.ts +5 -13
- package/src/query/getTransaction.ts +3 -9
- package/src/query/infiniteReadContracts.ts +126 -0
- package/src/query/readContract.ts +7 -7
- package/src/query/readContracts.ts +9 -9
- package/src/query/simulateContract.ts +8 -4
- package/src/query/types.ts +64 -33
- package/src/query/utils.ts +15 -0
- package/src/query/waitForTransactionReceipt.ts +1 -1
- package/src/types/utils.ts +0 -8
- package/src/version.ts +1 -1
package/src/query/types.ts
CHANGED
|
@@ -1,6 +1,65 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type {
|
|
2
|
+
DefaultError,
|
|
3
|
+
InfiniteQueryObserverOptions,
|
|
4
|
+
MutateOptions,
|
|
5
|
+
QueryKey,
|
|
6
|
+
QueryMeta,
|
|
7
|
+
} from '@tanstack/query-core'
|
|
2
8
|
|
|
3
|
-
|
|
9
|
+
import type { Evaluate, Omit } from '../types/utils.js'
|
|
10
|
+
|
|
11
|
+
export type InfiniteQueryOptions<
|
|
12
|
+
queryFnData = unknown,
|
|
13
|
+
error = DefaultError,
|
|
14
|
+
data = queryFnData,
|
|
15
|
+
queryData = queryFnData,
|
|
16
|
+
queryKey extends QueryKey = QueryKey,
|
|
17
|
+
pageParam = unknown,
|
|
18
|
+
///
|
|
19
|
+
options extends InfiniteQueryObserverOptions<
|
|
20
|
+
queryFnData,
|
|
21
|
+
error,
|
|
22
|
+
data,
|
|
23
|
+
queryData,
|
|
24
|
+
queryKey,
|
|
25
|
+
pageParam
|
|
26
|
+
> = InfiniteQueryObserverOptions<
|
|
27
|
+
queryFnData,
|
|
28
|
+
error,
|
|
29
|
+
data,
|
|
30
|
+
queryData,
|
|
31
|
+
queryKey,
|
|
32
|
+
pageParam
|
|
33
|
+
>,
|
|
34
|
+
> = Evaluate<
|
|
35
|
+
// `queryFn` doesn't pass through `pageParam` correctly
|
|
36
|
+
Omit<options, 'queryFn'> & {
|
|
37
|
+
// TS2742: `QueryFunctionContext` not exported from `@tanstack/query-core`
|
|
38
|
+
queryFn?(context: {
|
|
39
|
+
queryKey: queryKey
|
|
40
|
+
signal: AbortSignal
|
|
41
|
+
pageParam: pageParam
|
|
42
|
+
direction: 'forward' | 'backward'
|
|
43
|
+
meta: QueryMeta | undefined
|
|
44
|
+
}): ReturnType<NonNullable<options['queryFn']>>
|
|
45
|
+
}
|
|
46
|
+
>
|
|
47
|
+
|
|
48
|
+
export type Mutate<
|
|
49
|
+
data = unknown,
|
|
50
|
+
error = unknown,
|
|
51
|
+
variables = void,
|
|
52
|
+
context = unknown,
|
|
53
|
+
> = (
|
|
54
|
+
...args: Parameters<MutateFn<data, error, Evaluate<variables>, context>>
|
|
55
|
+
) => void
|
|
56
|
+
|
|
57
|
+
export type MutateAsync<
|
|
58
|
+
data = unknown,
|
|
59
|
+
error = unknown,
|
|
60
|
+
variables = void,
|
|
61
|
+
context = unknown,
|
|
62
|
+
> = MutateFn<data, error, Evaluate<variables>, context>
|
|
4
63
|
|
|
5
64
|
type MutateFn<
|
|
6
65
|
data = unknown,
|
|
@@ -11,42 +70,14 @@ type MutateFn<
|
|
|
11
70
|
? (
|
|
12
71
|
variables?: variables,
|
|
13
72
|
options?:
|
|
14
|
-
| Evaluate<
|
|
15
|
-
import('@tanstack/query-core').MutateOptions<
|
|
16
|
-
data,
|
|
17
|
-
error,
|
|
18
|
-
variables,
|
|
19
|
-
context
|
|
20
|
-
>
|
|
21
|
-
>
|
|
73
|
+
| Evaluate<MutateOptions<data, error, variables, context>>
|
|
22
74
|
| undefined,
|
|
23
75
|
) => Promise<data>
|
|
24
76
|
: (
|
|
25
77
|
variables: variables,
|
|
26
78
|
options?:
|
|
27
|
-
| Evaluate<
|
|
28
|
-
import('@tanstack/query-core').MutateOptions<
|
|
29
|
-
data,
|
|
30
|
-
error,
|
|
31
|
-
variables,
|
|
32
|
-
context
|
|
33
|
-
>
|
|
34
|
-
>
|
|
79
|
+
| Evaluate<MutateOptions<data, error, variables, context>>
|
|
35
80
|
| undefined,
|
|
36
81
|
) => Promise<data>
|
|
37
82
|
|
|
38
|
-
export type
|
|
39
|
-
data = unknown,
|
|
40
|
-
error = unknown,
|
|
41
|
-
variables = void,
|
|
42
|
-
context = unknown,
|
|
43
|
-
> = (
|
|
44
|
-
...args: Parameters<MutateFn<data, error, Evaluate<variables>, context>>
|
|
45
|
-
) => void
|
|
46
|
-
|
|
47
|
-
export type MutateAsync<
|
|
48
|
-
data = unknown,
|
|
49
|
-
error = unknown,
|
|
50
|
-
variables = void,
|
|
51
|
-
context = unknown,
|
|
52
|
-
> = MutateFn<data, error, Evaluate<variables>, context>
|
|
83
|
+
export type ScopeKeyParameter = { scopeKey?: string | undefined }
|
package/src/query/utils.ts
CHANGED
|
@@ -45,6 +45,21 @@ export function filterQueryOptions<type extends Record<string, unknown>>(
|
|
|
45
45
|
// destructuring is super fast
|
|
46
46
|
// biome-ignore format: no formatting
|
|
47
47
|
const {
|
|
48
|
+
// import('@tanstack/query-core').QueryOptions
|
|
49
|
+
// biome-ignore lint/correctness/noUnusedVariables: remove properties
|
|
50
|
+
_defaulted, behavior, gcTime, initialData, initialDataUpdatedAt, maxPages, meta, networkMode, queryFn, queryHash, queryKey, queryKeyHashFn, retry, retryDelay, structuralSharing,
|
|
51
|
+
|
|
52
|
+
// import('@tanstack/query-core').InfiniteQueryObserverOptions
|
|
53
|
+
// biome-ignore lint/correctness/noUnusedVariables: remove properties
|
|
54
|
+
getPreviousPageParam, getNextPageParam, initialPageParam,
|
|
55
|
+
|
|
56
|
+
// import('@tanstack/react-query').UseQueryOptions
|
|
57
|
+
// biome-ignore lint/correctness/noUnusedVariables: remove properties
|
|
58
|
+
_optimisticResults, enabled, notifyOnChangeProps, placeholderData, refetchInterval, refetchIntervalInBackground, refetchOnMount, refetchOnReconnect, refetchOnWindowFocus, retryOnMount, select, staleTime, suspense, throwOnError,
|
|
59
|
+
|
|
60
|
+
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
61
|
+
// wagmi
|
|
62
|
+
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
48
63
|
// biome-ignore lint/correctness/noUnusedVariables: remove properties
|
|
49
64
|
config, connector, query,
|
|
50
65
|
...rest
|
|
@@ -23,7 +23,7 @@ export function waitForTransactionReceiptQueryOptions<
|
|
|
23
23
|
config extends Config,
|
|
24
24
|
chainId extends config['chains'][number]['id'],
|
|
25
25
|
>(
|
|
26
|
-
config:
|
|
26
|
+
config: config,
|
|
27
27
|
options: WaitForTransactionReceiptOptions<config, chainId> = {},
|
|
28
28
|
) {
|
|
29
29
|
return {
|
package/src/types/utils.ts
CHANGED
|
@@ -37,14 +37,6 @@ export type Mutable<type extends object> = {
|
|
|
37
37
|
-readonly [key in keyof type]: type[key]
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
/**
|
|
41
|
-
* Use to prevent a usage of type from being inferred in other generics.
|
|
42
|
-
|
|
43
|
-
* @see https://github.com/pelotom/type-zoo/#noinfert
|
|
44
|
-
* @see https://github.com/Microsoft/TypeScript/issues/14829#issuecomment-322267089
|
|
45
|
-
*/
|
|
46
|
-
export type NoInfer<type> = type & { [key in keyof type]: type[key] }
|
|
47
|
-
|
|
48
40
|
/** Strict version of built-in Omit type */
|
|
49
41
|
export type Omit<type, keys extends keyof type> = Pick<
|
|
50
42
|
type,
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '2.0.0-alpha.
|
|
1
|
+
export const version = '2.0.0-alpha.3'
|