@wagmi/core 2.15.1 → 2.16.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.
Files changed (38) hide show
  1. package/dist/esm/actions/connect.js +2 -1
  2. package/dist/esm/actions/connect.js.map +1 -1
  3. package/dist/esm/actions/getConnectors.js.map +1 -1
  4. package/dist/esm/actions/watchConnectors.js.map +1 -1
  5. package/dist/esm/connectors/createConnector.js.map +1 -1
  6. package/dist/esm/connectors/mock.js.map +1 -1
  7. package/dist/esm/createConfig.js +1 -1
  8. package/dist/esm/createConfig.js.map +1 -1
  9. package/dist/esm/errors/config.js +1 -1
  10. package/dist/esm/errors/config.js.map +1 -1
  11. package/dist/esm/query/connect.js.map +1 -1
  12. package/dist/esm/tsconfig.build.tsbuildinfo +1 -1
  13. package/dist/esm/version.js +1 -1
  14. package/dist/types/actions/connect.d.ts +4 -4
  15. package/dist/types/actions/connect.d.ts.map +1 -1
  16. package/dist/types/actions/getConnectors.d.ts +3 -3
  17. package/dist/types/actions/getConnectors.d.ts.map +1 -1
  18. package/dist/types/actions/watchConnectors.d.ts +3 -3
  19. package/dist/types/actions/watchConnectors.d.ts.map +1 -1
  20. package/dist/types/connectors/createConnector.d.ts +1 -1
  21. package/dist/types/connectors/createConnector.d.ts.map +1 -1
  22. package/dist/types/connectors/mock.d.ts +10 -1
  23. package/dist/types/connectors/mock.d.ts.map +1 -1
  24. package/dist/types/createConfig.d.ts +7 -7
  25. package/dist/types/createConfig.d.ts.map +1 -1
  26. package/dist/types/query/connect.d.ts +8 -9
  27. package/dist/types/query/connect.d.ts.map +1 -1
  28. package/dist/types/version.d.ts +1 -1
  29. package/package.json +1 -1
  30. package/src/actions/connect.ts +30 -6
  31. package/src/actions/getConnectors.ts +5 -2
  32. package/src/actions/watchConnectors.ts +6 -6
  33. package/src/connectors/createConnector.ts +7 -1
  34. package/src/connectors/mock.ts +11 -1
  35. package/src/createConfig.ts +48 -37
  36. package/src/errors/config.ts +1 -1
  37. package/src/query/connect.ts +45 -20
  38. package/src/version.ts +1 -1
@@ -1,4 +1,4 @@
1
- import type { MutationOptions } from '@tanstack/query-core'
1
+ import type { MutateOptions, MutationOptions } from '@tanstack/query-core'
2
2
 
3
3
  import {
4
4
  type ConnectErrorType,
@@ -6,9 +6,10 @@ import {
6
6
  type ConnectReturnType,
7
7
  connect,
8
8
  } from '../actions/connect.js'
9
- import type { Config } from '../createConfig.js'
9
+ import type { Config, Connector } from '../createConfig.js'
10
10
 
11
- import type { Mutate, MutateAsync } from './types.js'
11
+ import type { CreateConnectorFn } from '../connectors/createConnector.js'
12
+ import type { Compute } from '../types/utils.js'
12
13
 
13
14
  export function connectMutationOptions<config extends Config>(config: config) {
14
15
  return {
@@ -19,27 +20,51 @@ export function connectMutationOptions<config extends Config>(config: config) {
19
20
  } as const satisfies MutationOptions<
20
21
  ConnectData<config>,
21
22
  ConnectErrorType,
22
- ConnectVariables<config>
23
+ ConnectVariables<config, Connector | CreateConnectorFn>
23
24
  >
24
25
  }
25
26
 
26
27
  export type ConnectData<config extends Config> = ConnectReturnType<config>
27
28
 
28
- export type ConnectVariables<config extends Config> = ConnectParameters<config>
29
+ export type ConnectVariables<
30
+ config extends Config,
31
+ connector extends Connector | CreateConnectorFn,
32
+ > = ConnectParameters<config, connector>
29
33
 
30
- export type ConnectMutate<config extends Config, context = unknown> = Mutate<
31
- ConnectData<config>,
32
- ConnectErrorType,
33
- ConnectVariables<config>,
34
- context
35
- >
34
+ export type ConnectMutate<config extends Config, context = unknown> = <
35
+ connector extends
36
+ | config['connectors'][number]
37
+ | Connector
38
+ | CreateConnectorFn,
39
+ >(
40
+ variables: ConnectVariables<config, connector>,
41
+ options?:
42
+ | Compute<
43
+ MutateOptions<
44
+ ConnectData<config>,
45
+ ConnectErrorType,
46
+ Compute<ConnectVariables<config, connector>>,
47
+ context
48
+ >
49
+ >
50
+ | undefined,
51
+ ) => void
36
52
 
37
- export type ConnectMutateAsync<
38
- config extends Config,
39
- context = unknown,
40
- > = MutateAsync<
41
- ConnectData<config>,
42
- ConnectErrorType,
43
- ConnectVariables<config>,
44
- context
45
- >
53
+ export type ConnectMutateAsync<config extends Config, context = unknown> = <
54
+ connector extends
55
+ | config['connectors'][number]
56
+ | Connector
57
+ | CreateConnectorFn,
58
+ >(
59
+ variables: ConnectVariables<config, connector>,
60
+ options?:
61
+ | Compute<
62
+ MutateOptions<
63
+ ConnectData<config>,
64
+ ConnectErrorType,
65
+ Compute<ConnectVariables<config, connector>>,
66
+ context
67
+ >
68
+ >
69
+ | undefined,
70
+ ) => Promise<ConnectData<config>>
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const version = '2.15.1'
1
+ export const version = '2.16.0'