@wagmi/core 2.22.0 → 3.0.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 (142) hide show
  1. package/dist/esm/actions/codegen/createWriteContract.js.map +1 -1
  2. package/dist/esm/actions/estimateFeesPerGas.js +1 -12
  3. package/dist/esm/actions/estimateFeesPerGas.js.map +1 -1
  4. package/dist/esm/actions/getBalance.js +1 -76
  5. package/dist/esm/actions/getBalance.js.map +1 -1
  6. package/dist/esm/actions/getChains.js.map +1 -1
  7. package/dist/esm/actions/{getAccount.js → getConnection.js} +3 -3
  8. package/dist/esm/actions/getConnection.js.map +1 -0
  9. package/dist/esm/actions/prepareTransactionRequest.js +2 -2
  10. package/dist/esm/actions/prepareTransactionRequest.js.map +1 -1
  11. package/dist/esm/actions/{switchAccount.js → switchConnection.js} +3 -3
  12. package/dist/esm/actions/switchConnection.js.map +1 -0
  13. package/dist/esm/actions/waitForTransactionReceipt.js +4 -1
  14. package/dist/esm/actions/waitForTransactionReceipt.js.map +1 -1
  15. package/dist/esm/actions/{watchAccount.js → watchConnection.js} +5 -5
  16. package/dist/esm/actions/watchConnection.js.map +1 -0
  17. package/dist/esm/actions/writeContract.js.map +1 -1
  18. package/dist/esm/connectors/createConnector.js.map +1 -1
  19. package/dist/esm/connectors/injected.js +0 -4
  20. package/dist/esm/connectors/injected.js.map +1 -1
  21. package/dist/esm/exports/actions.js +18 -33
  22. package/dist/esm/exports/actions.js.map +1 -1
  23. package/dist/esm/exports/index.js +18 -34
  24. package/dist/esm/exports/index.js.map +1 -1
  25. package/dist/esm/exports/query.js +3 -2
  26. package/dist/esm/exports/query.js.map +1 -1
  27. package/dist/esm/query/switchConnection.js +10 -0
  28. package/dist/esm/query/switchConnection.js.map +1 -0
  29. package/dist/esm/tsconfig.build.tsbuildinfo +1 -1
  30. package/dist/esm/version.js +1 -1
  31. package/dist/esm/version.js.map +1 -1
  32. package/dist/types/actions/codegen/createWriteContract.d.ts +1 -4
  33. package/dist/types/actions/codegen/createWriteContract.d.ts.map +1 -1
  34. package/dist/types/actions/estimateFeesPerGas.d.ts +3 -10
  35. package/dist/types/actions/estimateFeesPerGas.d.ts.map +1 -1
  36. package/dist/types/actions/getBalance.d.ts +1 -10
  37. package/dist/types/actions/getBalance.d.ts.map +1 -1
  38. package/dist/types/actions/getChains.d.ts +1 -5
  39. package/dist/types/actions/getChains.d.ts.map +1 -1
  40. package/dist/types/actions/{getAccount.d.ts → getConnection.d.ts} +4 -4
  41. package/dist/types/actions/getConnection.d.ts.map +1 -0
  42. package/dist/types/actions/switchConnection.d.ts +15 -0
  43. package/dist/types/actions/switchConnection.d.ts.map +1 -0
  44. package/dist/types/actions/waitForTransactionReceipt.d.ts.map +1 -1
  45. package/dist/types/actions/watchConnection.d.ts +9 -0
  46. package/dist/types/actions/watchConnection.d.ts.map +1 -0
  47. package/dist/types/actions/writeContract.d.ts +1 -4
  48. package/dist/types/actions/writeContract.d.ts.map +1 -1
  49. package/dist/types/connectors/createConnector.d.ts +0 -2
  50. package/dist/types/connectors/createConnector.d.ts.map +1 -1
  51. package/dist/types/connectors/injected.d.ts.map +1 -1
  52. package/dist/types/exports/actions.d.ts +30 -33
  53. package/dist/types/exports/actions.d.ts.map +1 -1
  54. package/dist/types/exports/index.d.ts +30 -34
  55. package/dist/types/exports/index.d.ts.map +1 -1
  56. package/dist/types/exports/query.d.ts +11 -2
  57. package/dist/types/exports/query.d.ts.map +1 -1
  58. package/dist/types/query/estimateFeesPerGas.d.ts +0 -3
  59. package/dist/types/query/estimateFeesPerGas.d.ts.map +1 -1
  60. package/dist/types/query/getBalance.d.ts +0 -6
  61. package/dist/types/query/getBalance.d.ts.map +1 -1
  62. package/dist/types/query/infiniteReadContracts.d.ts +3 -3
  63. package/dist/types/query/switchConnection.d.ts +15 -0
  64. package/dist/types/query/switchConnection.d.ts.map +1 -0
  65. package/dist/types/query/verifyMessage.d.ts +3 -3
  66. package/dist/types/query/writeContract.d.ts +1 -3
  67. package/dist/types/query/writeContract.d.ts.map +1 -1
  68. package/dist/types/version.d.ts +1 -1
  69. package/dist/types/version.d.ts.map +1 -1
  70. package/package.json +2 -10
  71. package/src/actions/codegen/createWriteContract.ts +1 -4
  72. package/src/actions/estimateFeesPerGas.ts +4 -33
  73. package/src/actions/getBalance.ts +2 -109
  74. package/src/actions/getChains.ts +2 -4
  75. package/src/actions/{getAccount.ts → getConnection.ts} +5 -5
  76. package/src/actions/prepareTransactionRequest.ts +2 -2
  77. package/src/actions/{switchAccount.ts → switchConnection.ts} +7 -7
  78. package/src/actions/waitForTransactionReceipt.ts +4 -1
  79. package/src/actions/watchConnection.ts +33 -0
  80. package/src/actions/writeContract.ts +1 -4
  81. package/src/connectors/createConnector.ts +0 -2
  82. package/src/connectors/injected.ts +0 -4
  83. package/src/exports/actions.ts +48 -44
  84. package/src/exports/index.ts +50 -46
  85. package/src/exports/query.ts +30 -16
  86. package/src/query/switchConnection.ts +52 -0
  87. package/src/version.ts +1 -1
  88. package/dist/esm/actions/getAccount.js.map +0 -1
  89. package/dist/esm/actions/getToken.js +0 -102
  90. package/dist/esm/actions/getToken.js.map +0 -1
  91. package/dist/esm/actions/switchAccount.js.map +0 -1
  92. package/dist/esm/actions/watchAccount.js.map +0 -1
  93. package/dist/esm/experimental/actions/writeContracts.js +0 -18
  94. package/dist/esm/experimental/actions/writeContracts.js.map +0 -1
  95. package/dist/esm/experimental/query/writeContracts.js +0 -10
  96. package/dist/esm/experimental/query/writeContracts.js.map +0 -1
  97. package/dist/esm/exports/experimental.js +0 -50
  98. package/dist/esm/exports/experimental.js.map +0 -1
  99. package/dist/esm/query/getToken.js +0 -17
  100. package/dist/esm/query/getToken.js.map +0 -1
  101. package/dist/esm/query/switchAccount.js +0 -10
  102. package/dist/esm/query/switchAccount.js.map +0 -1
  103. package/dist/esm/types/unit.js +0 -2
  104. package/dist/esm/types/unit.js.map +0 -1
  105. package/dist/esm/utils/getUnit.js +0 -9
  106. package/dist/esm/utils/getUnit.js.map +0 -1
  107. package/dist/esm/utils/normalizeChainId.js +0 -11
  108. package/dist/esm/utils/normalizeChainId.js.map +0 -1
  109. package/dist/types/actions/getAccount.d.ts.map +0 -1
  110. package/dist/types/actions/getToken.d.ts +0 -24
  111. package/dist/types/actions/getToken.d.ts.map +0 -1
  112. package/dist/types/actions/switchAccount.d.ts +0 -15
  113. package/dist/types/actions/switchAccount.d.ts.map +0 -1
  114. package/dist/types/actions/watchAccount.d.ts +0 -9
  115. package/dist/types/actions/watchAccount.d.ts.map +0 -1
  116. package/dist/types/experimental/actions/writeContracts.d.ts +0 -16
  117. package/dist/types/experimental/actions/writeContracts.d.ts.map +0 -1
  118. package/dist/types/experimental/query/writeContracts.d.ts +0 -13
  119. package/dist/types/experimental/query/writeContracts.d.ts.map +0 -1
  120. package/dist/types/exports/experimental.d.ts +0 -127
  121. package/dist/types/exports/experimental.d.ts.map +0 -1
  122. package/dist/types/query/getToken.d.ts +0 -35
  123. package/dist/types/query/getToken.d.ts.map +0 -1
  124. package/dist/types/query/switchAccount.d.ts +0 -15
  125. package/dist/types/query/switchAccount.d.ts.map +0 -1
  126. package/dist/types/types/unit.d.ts +0 -2
  127. package/dist/types/types/unit.d.ts.map +0 -1
  128. package/dist/types/utils/getUnit.d.ts +0 -3
  129. package/dist/types/utils/getUnit.d.ts.map +0 -1
  130. package/dist/types/utils/normalizeChainId.d.ts +0 -3
  131. package/dist/types/utils/normalizeChainId.d.ts.map +0 -1
  132. package/experimental/package.json +0 -5
  133. package/src/actions/getToken.ts +0 -141
  134. package/src/actions/watchAccount.ts +0 -33
  135. package/src/experimental/actions/writeContracts.ts +0 -79
  136. package/src/experimental/query/writeContracts.ts +0 -70
  137. package/src/exports/experimental.ts +0 -153
  138. package/src/query/getToken.ts +0 -49
  139. package/src/query/switchAccount.ts +0 -52
  140. package/src/types/unit.ts +0 -1
  141. package/src/utils/getUnit.ts +0 -9
  142. package/src/utils/normalizeChainId.ts +0 -13
@@ -1,127 +0,0 @@
1
- export {
2
- /** @deprecated This is no longer experimental – use `import type { GetCallsStatusErrorType } from '@wagmi/core'` instead. */
3
- type GetCallsStatusErrorType,
4
- /** @deprecated This is no longer experimental – use `import type { GetCallsStatusParameters } from '@wagmi/core'` instead. */
5
- type GetCallsStatusParameters,
6
- /** @deprecated This is no longer experimental – use `import type { GetCallsStatusReturnType } from '@wagmi/core'` instead. */
7
- type GetCallsStatusReturnType,
8
- /** @deprecated This is no longer experimental – use `import { getCallsStatus } from '@wagmi/core'` instead. */
9
- getCallsStatus, } from '../actions/getCallsStatus.js';
10
- export {
11
- /** @deprecated This is no longer experimental – use `import type { GetCapabilitiesErrorType } from '@wagmi/core'` instead. */
12
- type GetCapabilitiesErrorType,
13
- /** @deprecated This is no longer experimental – use `import type { GetCapabilitiesParameters } from '@wagmi/core'` instead. */
14
- type GetCapabilitiesParameters,
15
- /** @deprecated This is no longer experimental – use `import type { GetCapabilitiesReturnType } from '@wagmi/core'` instead. */
16
- type GetCapabilitiesReturnType,
17
- /** @deprecated This is no longer experimental – use `import { getCapabilities } from '@wagmi/core'` instead. */
18
- getCapabilities, } from '../actions/getCapabilities.js';
19
- export {
20
- /** @deprecated This is no longer experimental – use `import type { SendCallsErrorType } from '@wagmi/core'` instead. */
21
- type SendCallsErrorType,
22
- /** @deprecated This is no longer experimental – use `import type { SendCallsParameters } from '@wagmi/core'` instead. */
23
- type SendCallsParameters,
24
- /** @deprecated This is no longer experimental – use `import type { SendCallsReturnType } from '@wagmi/core'` instead. */
25
- type SendCallsReturnType,
26
- /** @deprecated This is no longer experimental – use `import { sendCalls } from '@wagmi/core'` instead. */
27
- sendCalls, } from '../actions/sendCalls.js';
28
- export {
29
- /** @deprecated This is no longer experimental – use `import type { ShowCallsStatusErrorType } from '@wagmi/core'` instead. */
30
- type ShowCallsStatusErrorType,
31
- /** @deprecated This is no longer experimental – use `import type { ShowCallsStatusParameters } from '@wagmi/core'` instead. */
32
- type ShowCallsStatusParameters,
33
- /** @deprecated This is no longer experimental – use `import type { ShowCallsStatusReturnType } from '@wagmi/core'` instead. */
34
- type ShowCallsStatusReturnType,
35
- /** @deprecated This is no longer experimental – use `import { showCallsStatus } from '@wagmi/core'` instead. */
36
- showCallsStatus, } from '../actions/showCallsStatus.js';
37
- export {
38
- /** @deprecated This is no longer experimental – use `import type { WaitForCallsStatusErrorType } from '@wagmi/core'` instead. */
39
- type WaitForCallsStatusErrorType,
40
- /** @deprecated This is no longer experimental – use `import type { WaitForCallsStatusParameters } from '@wagmi/core'` instead. */
41
- type WaitForCallsStatusParameters,
42
- /** @deprecated This is no longer experimental – use `import type { WaitForCallsStatusReturnType } from '@wagmi/core'` instead. */
43
- type WaitForCallsStatusReturnType,
44
- /** @deprecated This is no longer experimental – use `import { waitForCallsStatus } from '@wagmi/core'` instead. */
45
- waitForCallsStatus, } from '../actions/waitForCallsStatus.js';
46
- export {
47
- /** @deprecated Use `SendCallsErrorType` instead. */
48
- type WriteContractsErrorType,
49
- /** @deprecated Use `SendCallsParameters` instead. */
50
- type WriteContractsParameters,
51
- /** @deprecated Use `SendCallsReturnType` instead. */
52
- type WriteContractsReturnType,
53
- /** @deprecated Use `sendCalls` instead. */
54
- writeContracts, } from '../experimental/actions/writeContracts.js';
55
- export {
56
- /** @deprecated Use `SendCallsData` instead. */
57
- type WriteContractsData,
58
- /** @deprecated Use `SendCallsMutate` instead. */
59
- type WriteContractsMutate,
60
- /** @deprecated Use `SendCallsMutateAsync` instead. */
61
- type WriteContractsMutateAsync,
62
- /** @deprecated Use `SendCallsVariables` instead. */
63
- type WriteContractsVariables,
64
- /** @deprecated Use `sendCallsMutationOptions` instead. */
65
- writeContractsMutationOptions, } from '../experimental/query/writeContracts.js';
66
- export {
67
- /** @deprecated This is no longer experimental – use `import type { GetCallsStatusData } from '@wagmi/core/query'` instead. */
68
- type GetCallsStatusData,
69
- /** @deprecated This is no longer experimental – use `import type { GetCallsStatusOptions } from '@wagmi/core/query'` instead. */
70
- type GetCallsStatusOptions,
71
- /** @deprecated This is no longer experimental – use `import type { GetCallsStatusQueryFnData } from '@wagmi/core/query'` instead. */
72
- type GetCallsStatusQueryFnData,
73
- /** @deprecated This is no longer experimental – use `import type { GetCallsStatusQueryKey } from '@wagmi/core/query'` instead. */
74
- type GetCallsStatusQueryKey,
75
- /** @deprecated This is no longer experimental – use `import { getCallsStatusQueryKey } from '@wagmi/core/query'` instead. */
76
- getCallsStatusQueryKey,
77
- /** @deprecated This is no longer experimental – use `import { getCallsStatusQueryOptions } from '@wagmi/core/query'` instead. */
78
- getCallsStatusQueryOptions, } from '../query/getCallsStatus.js';
79
- export {
80
- /** @deprecated This is no longer experimental – use `import type { GetCapabilitiesData } from '@wagmi/core/query'` instead. */
81
- type GetCapabilitiesData,
82
- /** @deprecated This is no longer experimental – use `import type { GetCapabilitiesOptions } from '@wagmi/core/query'` instead. */
83
- type GetCapabilitiesOptions,
84
- /** @deprecated This is no longer experimental – use `import type { GetCapabilitiesQueryFnData } from '@wagmi/core/query'` instead. */
85
- type GetCapabilitiesQueryFnData,
86
- /** @deprecated This is no longer experimental – use `import type { GetCapabilitiesQueryKey } from '@wagmi/core/query'` instead. */
87
- type GetCapabilitiesQueryKey,
88
- /** @deprecated This is no longer experimental – use `import { getCapabilitiesQueryKey } from '@wagmi/core/query'` instead. */
89
- getCapabilitiesQueryKey,
90
- /** @deprecated This is no longer experimental – use `import { getCapabilitiesQueryOptions } from '@wagmi/core/query'` instead. */
91
- getCapabilitiesQueryOptions, } from '../query/getCapabilities.js';
92
- export {
93
- /** @deprecated This is no longer experimental – use `import type { SendCallsData } from '@wagmi/core/query'` instead. */
94
- type SendCallsData,
95
- /** @deprecated This is no longer experimental – use `import type { SendCallsMutate } from '@wagmi/core/query'` instead. */
96
- type SendCallsMutate,
97
- /** @deprecated This is no longer experimental – use `import type { SendCallsMutateAsync } from '@wagmi/core/query'` instead. */
98
- type SendCallsMutateAsync,
99
- /** @deprecated This is no longer experimental – use `import type { SendCallsVariables } from '@wagmi/core/query'` instead. */
100
- type SendCallsVariables,
101
- /** @deprecated This is no longer experimental – use `import { sendCallsMutationOptions } from '@wagmi/core/query'` instead. */
102
- sendCallsMutationOptions, } from '../query/sendCalls.js';
103
- export {
104
- /** @deprecated This is no longer experimental – use `import type { ShowCallsStatusData } from '@wagmi/core/query'` instead. */
105
- type ShowCallsStatusData,
106
- /** @deprecated This is no longer experimental – use `import type { ShowCallsStatusMutate } from '@wagmi/core/query'` instead. */
107
- type ShowCallsStatusMutate,
108
- /** @deprecated This is no longer experimental – use `import type { ShowCallsStatusMutateAsync } from '@wagmi/core/query'` instead. */
109
- type ShowCallsStatusMutateAsync,
110
- /** @deprecated This is no longer experimental – use `import type { ShowCallsStatusVariables } from '@wagmi/core/query'` instead. */
111
- type ShowCallsStatusVariables,
112
- /** @deprecated This is no longer experimental – use `import { showCallsStatusMutationOptions } from '@wagmi/core/query'` instead. */
113
- showCallsStatusMutationOptions, } from '../query/showCallsStatus.js';
114
- export {
115
- /** @deprecated This is no longer experimental – use `import type { WaitForCallsStatusData } from '@wagmi/core/query'` instead. */
116
- type WaitForCallsStatusData,
117
- /** @deprecated This is no longer experimental – use `import type { WaitForCallsStatusOptions } from '@wagmi/core/query'` instead. */
118
- type WaitForCallsStatusOptions,
119
- /** @deprecated This is no longer experimental – use `import type { WaitForCallsStatusQueryFnData } from '@wagmi/core/query'` instead. */
120
- type WaitForCallsStatusQueryFnData,
121
- /** @deprecated This is no longer experimental – use `import type { WaitForCallsStatusQueryKey } from '@wagmi/core/query'` instead. */
122
- type WaitForCallsStatusQueryKey,
123
- /** @deprecated This is no longer experimental – use `import { waitForCallsStatusQueryKey } from '@wagmi/core/query'` instead. */
124
- waitForCallsStatusQueryKey,
125
- /** @deprecated This is no longer experimental – use `import { waitForCallsStatusQueryOptions } from '@wagmi/core/query'` instead. */
126
- waitForCallsStatusQueryOptions, } from '../query/waitForCallsStatus.js';
127
- //# sourceMappingURL=experimental.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":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-1,35 +0,0 @@
1
- import { type GetTokenParameters, type GetTokenReturnType } from '../actions/getToken.js';
2
- import type { Config } from '../createConfig.js';
3
- import type { ScopeKeyParameter } from '../types/properties.js';
4
- import type { Compute, ExactPartial } from '../types/utils.js';
5
- export type GetTokenOptions<config extends Config> = Compute<ExactPartial<GetTokenParameters<config>> & ScopeKeyParameter>;
6
- export declare function getTokenQueryOptions<config extends Config>(config: config, options?: GetTokenOptions<config>): {
7
- readonly queryFn: ({ queryKey }: {
8
- queryKey: readonly ["token", {
9
- chainId?: config["chains"][number]["id"] | (config["chains"][number]["id"] extends infer T ? T extends config["chains"][number]["id"] ? T extends config["chains"][number]["id"] ? T : undefined : never : never) | undefined;
10
- address?: `0x${string}` | undefined;
11
- formatUnits?: import("../types/unit.js").Unit | undefined;
12
- scopeKey?: string | undefined | undefined;
13
- }];
14
- signal: AbortSignal;
15
- meta: import("@tanstack/query-core").QueryMeta | undefined;
16
- pageParam?: unknown;
17
- direction?: unknown;
18
- }) => Promise<GetTokenReturnType>;
19
- readonly queryKey: readonly ["token", {
20
- chainId?: config["chains"][number]["id"] | (config["chains"][number]["id"] extends infer T ? T extends config["chains"][number]["id"] ? T extends config["chains"][number]["id"] ? T : undefined : never : never) | undefined;
21
- address?: `0x${string}` | undefined;
22
- formatUnits?: import("../types/unit.js").Unit | undefined;
23
- scopeKey?: string | undefined | undefined;
24
- }];
25
- };
26
- export type GetTokenQueryFnData = GetTokenReturnType;
27
- export type GetTokenData = GetTokenQueryFnData;
28
- export declare function getTokenQueryKey<config extends Config>(options?: GetTokenOptions<config>): readonly ["token", {
29
- chainId?: config["chains"][number]["id"] | (config["chains"][number]["id"] extends infer T ? T extends config["chains"][number]["id"] ? T extends config["chains"][number]["id"] ? T : undefined : never : never) | undefined;
30
- address?: `0x${string}` | undefined;
31
- formatUnits?: import("../types/unit.js").Unit | undefined;
32
- scopeKey?: string | undefined | undefined;
33
- }];
34
- export type GetTokenQueryKey<config extends Config> = ReturnType<typeof getTokenQueryKey<config>>;
35
- //# sourceMappingURL=getToken.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getToken.d.ts","sourceRoot":"","sources":["../../../src/query/getToken.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EAExB,MAAM,wBAAwB,CAAA;AAC/B,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAChD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAC/D,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAG9D,MAAM,MAAM,eAAe,CAAC,MAAM,SAAS,MAAM,IAAI,OAAO,CAC1D,YAAY,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAC,GAAG,iBAAiB,CAC7D,CAAA;AAED,wBAAgB,oBAAoB,CAAC,MAAM,SAAS,MAAM,EACxD,MAAM,EAAE,MAAM,EACd,OAAO,GAAE,eAAe,CAAC,MAAM,CAAM;;;;;;;;;;;;;;;;;;;EAetC;AAED,MAAM,MAAM,mBAAmB,GAAG,kBAAkB,CAAA;AAEpD,MAAM,MAAM,YAAY,GAAG,mBAAmB,CAAA;AAE9C,wBAAgB,gBAAgB,CAAC,MAAM,SAAS,MAAM,EACpD,OAAO,GAAE,eAAe,CAAC,MAAM,CAAM;;;;;GAGtC;AAED,MAAM,MAAM,gBAAgB,CAAC,MAAM,SAAS,MAAM,IAAI,UAAU,CAC9D,OAAO,gBAAgB,CAAC,MAAM,CAAC,CAChC,CAAA"}
@@ -1,15 +0,0 @@
1
- import { type SwitchAccountErrorType, type SwitchAccountParameters, type SwitchAccountReturnType } from '../actions/switchAccount.js';
2
- import type { Config } from '../createConfig.js';
3
- import type { Compute } from '../types/utils.js';
4
- import type { Mutate, MutateAsync } from './types.js';
5
- export declare function switchAccountMutationOptions<config extends Config>(config: config): {
6
- readonly mutationFn: (variables: {
7
- connector: import("../createConfig.js").Connector;
8
- }) => Promise<SwitchAccountReturnType<config>>;
9
- readonly mutationKey: readonly ["switchAccount"];
10
- };
11
- export type SwitchAccountData<config extends Config> = Compute<SwitchAccountReturnType<config>>;
12
- export type SwitchAccountVariables = Compute<SwitchAccountParameters>;
13
- export type SwitchAccountMutate<config extends Config, context = unknown> = Mutate<SwitchAccountData<config>, SwitchAccountErrorType, SwitchAccountVariables, context>;
14
- export type SwitchAccountMutateAsync<config extends Config, context = unknown> = MutateAsync<SwitchAccountData<config>, SwitchAccountErrorType, SwitchAccountVariables, context>;
15
- //# sourceMappingURL=switchAccount.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"switchAccount.d.ts","sourceRoot":"","sources":["../../../src/query/switchAccount.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,sBAAsB,EAC3B,KAAK,uBAAuB,EAC5B,KAAK,uBAAuB,EAE7B,MAAM,6BAA6B,CAAA;AACpC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAChD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAChD,OAAO,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAErD,wBAAgB,4BAA4B,CAAC,MAAM,SAAS,MAAM,EAChE,MAAM,EAAE,MAAM;;;;;EAYf;AAED,MAAM,MAAM,iBAAiB,CAAC,MAAM,SAAS,MAAM,IAAI,OAAO,CAC5D,uBAAuB,CAAC,MAAM,CAAC,CAChC,CAAA;AAED,MAAM,MAAM,sBAAsB,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAA;AAErE,MAAM,MAAM,mBAAmB,CAC7B,MAAM,SAAS,MAAM,EACrB,OAAO,GAAG,OAAO,IACf,MAAM,CACR,iBAAiB,CAAC,MAAM,CAAC,EACzB,sBAAsB,EACtB,sBAAsB,EACtB,OAAO,CACR,CAAA;AAED,MAAM,MAAM,wBAAwB,CAClC,MAAM,SAAS,MAAM,EACrB,OAAO,GAAG,OAAO,IACf,WAAW,CACb,iBAAiB,CAAC,MAAM,CAAC,EACzB,sBAAsB,EACtB,sBAAsB,EACtB,OAAO,CACR,CAAA"}
@@ -1,2 +0,0 @@
1
- export type Unit = 'ether' | 'gwei' | 'wei' | number;
2
- //# sourceMappingURL=unit.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"unit.d.ts","sourceRoot":"","sources":["../../../src/types/unit.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,IAAI,GAAG,OAAO,GAAG,MAAM,GAAG,KAAK,GAAG,MAAM,CAAA"}
@@ -1,3 +0,0 @@
1
- import type { Unit } from '../types/unit.js';
2
- export declare function getUnit(unit: Unit): number;
3
- //# sourceMappingURL=getUnit.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getUnit.d.ts","sourceRoot":"","sources":["../../../src/utils/getUnit.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAA;AAE5C,wBAAgB,OAAO,CAAC,IAAI,EAAE,IAAI,UAIjC"}
@@ -1,3 +0,0 @@
1
- /** @deprecated use `Number` instead */
2
- export declare function normalizeChainId(chainId: bigint | number | string | unknown): number;
3
- //# sourceMappingURL=normalizeChainId.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"normalizeChainId.d.ts","sourceRoot":"","sources":["../../../src/utils/normalizeChainId.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,UAW3E"}
@@ -1,5 +0,0 @@
1
- {
2
- "type": "module",
3
- "types": "../dist/types/exports/experimental.d.ts",
4
- "main": "../dist/esm/exports/experimental.js"
5
- }
@@ -1,141 +0,0 @@
1
- import type { Address, Hex } from 'viem'
2
- import {
3
- ContractFunctionExecutionError,
4
- formatUnits,
5
- hexToString,
6
- trim,
7
- } from 'viem'
8
-
9
- import type { Config } from '../createConfig.js'
10
- import type { ChainIdParameter } from '../types/properties.js'
11
- import type { Unit } from '../types/unit.js'
12
- import type { Compute } from '../types/utils.js'
13
- import { getUnit } from '../utils/getUnit.js'
14
- import { type ReadContractsErrorType, readContracts } from './readContracts.js'
15
-
16
- export type GetTokenParameters<config extends Config = Config> = Compute<
17
- ChainIdParameter<config> & {
18
- address: Address
19
- formatUnits?: Unit | undefined
20
- }
21
- >
22
-
23
- export type GetTokenReturnType = {
24
- address: Address
25
- decimals: number
26
- name: string | undefined
27
- symbol: string | undefined
28
- totalSupply: {
29
- formatted: string
30
- value: bigint
31
- }
32
- }
33
-
34
- export type GetTokenErrorType = ReadContractsErrorType
35
-
36
- /** @deprecated */
37
- export async function getToken<config extends Config>(
38
- config: config,
39
- parameters: GetTokenParameters<config>,
40
- ): Promise<GetTokenReturnType> {
41
- const { address, chainId, formatUnits: unit = 18 } = parameters
42
-
43
- function getAbi<type extends 'bytes32' | 'string'>(type: type) {
44
- return [
45
- {
46
- type: 'function',
47
- name: 'decimals',
48
- stateMutability: 'view',
49
- inputs: [],
50
- outputs: [{ type: 'uint8' }],
51
- },
52
- {
53
- type: 'function',
54
- name: 'name',
55
- stateMutability: 'view',
56
- inputs: [],
57
- outputs: [{ type }],
58
- },
59
- {
60
- type: 'function',
61
- name: 'symbol',
62
- stateMutability: 'view',
63
- inputs: [],
64
- outputs: [{ type }],
65
- },
66
- {
67
- type: 'function',
68
- name: 'totalSupply',
69
- stateMutability: 'view',
70
- inputs: [],
71
- outputs: [{ type: 'uint256' }],
72
- },
73
- ] as const
74
- }
75
-
76
- try {
77
- const abi = getAbi('string')
78
- const contractConfig = { address, abi, chainId } as const
79
- const [decimals, name, symbol, totalSupply] = await readContracts(config, {
80
- allowFailure: true,
81
- contracts: [
82
- { ...contractConfig, functionName: 'decimals' },
83
- { ...contractConfig, functionName: 'name' },
84
- { ...contractConfig, functionName: 'symbol' },
85
- { ...contractConfig, functionName: 'totalSupply' },
86
- ] as const,
87
- })
88
-
89
- // throw if `name` or `symbol` failed
90
- if (name.error instanceof ContractFunctionExecutionError) throw name.error
91
- if (symbol.error instanceof ContractFunctionExecutionError)
92
- throw symbol.error
93
-
94
- // `decimals` and `totalSupply` are required
95
- if (decimals.error) throw decimals.error
96
- if (totalSupply.error) throw totalSupply.error
97
-
98
- return {
99
- address,
100
- decimals: decimals.result,
101
- name: name.result,
102
- symbol: symbol.result,
103
- totalSupply: {
104
- formatted: formatUnits(totalSupply.result!, getUnit(unit)),
105
- value: totalSupply.result,
106
- },
107
- }
108
- } catch (error) {
109
- // In the chance that there is an error upon decoding the contract result,
110
- // it could be likely that the contract data is represented as bytes32 instead
111
- // of a string.
112
- if (error instanceof ContractFunctionExecutionError) {
113
- const abi = getAbi('bytes32')
114
- const contractConfig = { address, abi, chainId } as const
115
- const [decimals, name, symbol, totalSupply] = await readContracts(
116
- config,
117
- {
118
- allowFailure: false,
119
- contracts: [
120
- { ...contractConfig, functionName: 'decimals' },
121
- { ...contractConfig, functionName: 'name' },
122
- { ...contractConfig, functionName: 'symbol' },
123
- { ...contractConfig, functionName: 'totalSupply' },
124
- ] as const,
125
- },
126
- )
127
- return {
128
- address,
129
- decimals,
130
- name: hexToString(trim(name as Hex, { dir: 'right' })),
131
- symbol: hexToString(trim(symbol as Hex, { dir: 'right' })),
132
- totalSupply: {
133
- formatted: formatUnits(totalSupply, getUnit(unit)),
134
- value: totalSupply,
135
- },
136
- }
137
- }
138
-
139
- throw error
140
- }
141
- }
@@ -1,33 +0,0 @@
1
- import type { Config } from '../createConfig.js'
2
- import { deepEqual } from '../utils/deepEqual.js'
3
- import { type GetAccountReturnType, getAccount } from './getAccount.js'
4
-
5
- export type WatchAccountParameters<config extends Config = Config> = {
6
- onChange(
7
- account: GetAccountReturnType<config>,
8
- prevAccount: GetAccountReturnType<config>,
9
- ): void
10
- }
11
-
12
- export type WatchAccountReturnType = () => void
13
-
14
- /** https://wagmi.sh/core/api/actions/watchAccount */
15
- export function watchAccount<config extends Config>(
16
- config: config,
17
- parameters: WatchAccountParameters<config>,
18
- ): WatchAccountReturnType {
19
- const { onChange } = parameters
20
-
21
- return config.subscribe(() => getAccount(config), onChange, {
22
- equalityFn(a, b) {
23
- const { connector: aConnector, ...aRest } = a
24
- const { connector: bConnector, ...bRest } = b
25
- return (
26
- deepEqual(aRest, bRest) &&
27
- // check connector separately
28
- aConnector?.id === bConnector?.id &&
29
- aConnector?.uid === bConnector?.uid
30
- )
31
- },
32
- })
33
- }
@@ -1,79 +0,0 @@
1
- import type { Account, Chain, ContractFunctionParameters } from 'viem'
2
- import {
3
- type WriteContractsErrorType as viem_WriteContractsErrorType,
4
- type WriteContractsParameters as viem_WriteContractsParameters,
5
- type WriteContractsReturnType as viem_WriteContractsReturnType,
6
- writeContracts as viem_writeContracts,
7
- } from 'viem/experimental'
8
-
9
- import {
10
- type GetConnectorClientErrorType,
11
- getConnectorClient,
12
- } from '../../actions/getConnectorClient.js'
13
- import type { Config } from '../../createConfig.js'
14
- import type { BaseErrorType, ErrorType } from '../../errors/base.js'
15
- import type { SelectChains } from '../../types/chain.js'
16
- import type {
17
- ChainIdParameter,
18
- ConnectorParameter,
19
- } from '../../types/properties.js'
20
- import type { Compute } from '../../types/utils.js'
21
-
22
- export type WriteContractsParameters<
23
- contracts extends readonly unknown[] = readonly ContractFunctionParameters[],
24
- config extends Config = Config,
25
- chainId extends
26
- config['chains'][number]['id'] = config['chains'][number]['id'],
27
- ///
28
- chains extends readonly Chain[] = SelectChains<config, chainId>,
29
- > = {
30
- [key in keyof chains]: Compute<
31
- Omit<
32
- viem_WriteContractsParameters<
33
- contracts,
34
- chains[key],
35
- Account,
36
- chains[key]
37
- >,
38
- 'chain'
39
- > &
40
- ChainIdParameter<config, chainId> &
41
- ConnectorParameter
42
- >
43
- }[number]
44
-
45
- export type WriteContractsReturnType = viem_WriteContractsReturnType
46
-
47
- export type WriteContractsErrorType =
48
- // getConnectorClient()
49
- | GetConnectorClientErrorType
50
- // base
51
- | BaseErrorType
52
- | ErrorType
53
- // viem
54
- | viem_WriteContractsErrorType
55
-
56
- /** https://wagmi.sh/core/api/actions/writeContracts */
57
- export async function writeContracts<
58
- const contracts extends readonly unknown[],
59
- config extends Config,
60
- chainId extends config['chains'][number]['id'],
61
- >(
62
- config: config,
63
- parameters: WriteContractsParameters<contracts, config, chainId>,
64
- ): Promise<WriteContractsReturnType> {
65
- const { account, chainId, connector, ...rest } = parameters
66
-
67
- const client = await getConnectorClient(config, {
68
- account,
69
- assertChainId: false,
70
- chainId,
71
- connector,
72
- })
73
-
74
- return viem_writeContracts(client, {
75
- ...(rest as any),
76
- ...(account ? { account } : {}),
77
- chain: chainId ? { id: chainId } : undefined,
78
- })
79
- }
@@ -1,70 +0,0 @@
1
- import type { MutateOptions, MutationOptions } from '@tanstack/query-core'
2
-
3
- import type { Config } from '../../createConfig.js'
4
- import type { Compute } from '../../types/utils.js'
5
- import {
6
- type WriteContractsErrorType,
7
- type WriteContractsParameters,
8
- type WriteContractsReturnType,
9
- writeContracts,
10
- } from '../actions/writeContracts.js'
11
-
12
- export function writeContractsMutationOptions<
13
- const contracts extends readonly unknown[],
14
- config extends Config,
15
- >(config: config) {
16
- return {
17
- mutationFn(variables) {
18
- return writeContracts(config, variables as any) as any
19
- },
20
- mutationKey: ['writeContracts'],
21
- } as const satisfies MutationOptions<
22
- WriteContractsData,
23
- WriteContractsErrorType,
24
- WriteContractsVariables<contracts, config, config['chains'][number]['id']>
25
- >
26
- }
27
-
28
- export type WriteContractsData = Compute<WriteContractsReturnType>
29
-
30
- export type WriteContractsVariables<
31
- contracts extends readonly unknown[],
32
- config extends Config,
33
- chainId extends config['chains'][number]['id'],
34
- > = WriteContractsParameters<contracts, config, chainId>
35
-
36
- export type WriteContractsMutate<
37
- contracts extends readonly unknown[],
38
- config extends Config,
39
- context = unknown,
40
- > = <chainId extends config['chains'][number]['id']>(
41
- variables: WriteContractsVariables<contracts, config, chainId>,
42
- options?:
43
- | Compute<
44
- MutateOptions<
45
- WriteContractsData,
46
- WriteContractsErrorType,
47
- Compute<WriteContractsVariables<contracts, config, chainId>>,
48
- context
49
- >
50
- >
51
- | undefined,
52
- ) => void
53
-
54
- export type WriteContractsMutateAsync<
55
- contracts extends readonly unknown[],
56
- config extends Config,
57
- context = unknown,
58
- > = <chainId extends config['chains'][number]['id']>(
59
- variables: WriteContractsVariables<contracts, config, chainId>,
60
- options?:
61
- | Compute<
62
- MutateOptions<
63
- WriteContractsData,
64
- WriteContractsErrorType,
65
- Compute<WriteContractsVariables<contracts, config, chainId>>,
66
- context
67
- >
68
- >
69
- | undefined,
70
- ) => Promise<WriteContractsData>