@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.
- package/dist/esm/actions/codegen/createWriteContract.js.map +1 -1
- package/dist/esm/actions/estimateFeesPerGas.js +1 -12
- package/dist/esm/actions/estimateFeesPerGas.js.map +1 -1
- package/dist/esm/actions/getBalance.js +1 -76
- package/dist/esm/actions/getBalance.js.map +1 -1
- package/dist/esm/actions/getChains.js.map +1 -1
- package/dist/esm/actions/{getAccount.js → getConnection.js} +3 -3
- package/dist/esm/actions/getConnection.js.map +1 -0
- package/dist/esm/actions/prepareTransactionRequest.js +2 -2
- package/dist/esm/actions/prepareTransactionRequest.js.map +1 -1
- package/dist/esm/actions/{switchAccount.js → switchConnection.js} +3 -3
- package/dist/esm/actions/switchConnection.js.map +1 -0
- package/dist/esm/actions/waitForTransactionReceipt.js +4 -1
- package/dist/esm/actions/waitForTransactionReceipt.js.map +1 -1
- package/dist/esm/actions/{watchAccount.js → watchConnection.js} +5 -5
- package/dist/esm/actions/watchConnection.js.map +1 -0
- package/dist/esm/actions/writeContract.js.map +1 -1
- package/dist/esm/connectors/createConnector.js.map +1 -1
- package/dist/esm/connectors/injected.js +0 -4
- package/dist/esm/connectors/injected.js.map +1 -1
- package/dist/esm/exports/actions.js +18 -33
- package/dist/esm/exports/actions.js.map +1 -1
- package/dist/esm/exports/index.js +18 -34
- package/dist/esm/exports/index.js.map +1 -1
- package/dist/esm/exports/query.js +3 -2
- package/dist/esm/exports/query.js.map +1 -1
- package/dist/esm/query/switchConnection.js +10 -0
- package/dist/esm/query/switchConnection.js.map +1 -0
- package/dist/esm/tsconfig.build.tsbuildinfo +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/esm/version.js.map +1 -1
- package/dist/types/actions/codegen/createWriteContract.d.ts +1 -4
- package/dist/types/actions/codegen/createWriteContract.d.ts.map +1 -1
- package/dist/types/actions/estimateFeesPerGas.d.ts +3 -10
- package/dist/types/actions/estimateFeesPerGas.d.ts.map +1 -1
- package/dist/types/actions/getBalance.d.ts +1 -10
- package/dist/types/actions/getBalance.d.ts.map +1 -1
- package/dist/types/actions/getChains.d.ts +1 -5
- package/dist/types/actions/getChains.d.ts.map +1 -1
- package/dist/types/actions/{getAccount.d.ts → getConnection.d.ts} +4 -4
- package/dist/types/actions/getConnection.d.ts.map +1 -0
- package/dist/types/actions/switchConnection.d.ts +15 -0
- package/dist/types/actions/switchConnection.d.ts.map +1 -0
- package/dist/types/actions/waitForTransactionReceipt.d.ts.map +1 -1
- package/dist/types/actions/watchConnection.d.ts +9 -0
- package/dist/types/actions/watchConnection.d.ts.map +1 -0
- package/dist/types/actions/writeContract.d.ts +1 -4
- package/dist/types/actions/writeContract.d.ts.map +1 -1
- package/dist/types/connectors/createConnector.d.ts +0 -2
- package/dist/types/connectors/createConnector.d.ts.map +1 -1
- package/dist/types/connectors/injected.d.ts.map +1 -1
- package/dist/types/exports/actions.d.ts +30 -33
- package/dist/types/exports/actions.d.ts.map +1 -1
- package/dist/types/exports/index.d.ts +30 -34
- package/dist/types/exports/index.d.ts.map +1 -1
- package/dist/types/exports/query.d.ts +11 -2
- package/dist/types/exports/query.d.ts.map +1 -1
- package/dist/types/query/estimateFeesPerGas.d.ts +0 -3
- package/dist/types/query/estimateFeesPerGas.d.ts.map +1 -1
- package/dist/types/query/getBalance.d.ts +0 -6
- package/dist/types/query/getBalance.d.ts.map +1 -1
- package/dist/types/query/infiniteReadContracts.d.ts +3 -3
- package/dist/types/query/switchConnection.d.ts +15 -0
- package/dist/types/query/switchConnection.d.ts.map +1 -0
- package/dist/types/query/verifyMessage.d.ts +3 -3
- package/dist/types/query/writeContract.d.ts +1 -3
- package/dist/types/query/writeContract.d.ts.map +1 -1
- package/dist/types/version.d.ts +1 -1
- package/dist/types/version.d.ts.map +1 -1
- package/package.json +2 -10
- package/src/actions/codegen/createWriteContract.ts +1 -4
- package/src/actions/estimateFeesPerGas.ts +4 -33
- package/src/actions/getBalance.ts +2 -109
- package/src/actions/getChains.ts +2 -4
- package/src/actions/{getAccount.ts → getConnection.ts} +5 -5
- package/src/actions/prepareTransactionRequest.ts +2 -2
- package/src/actions/{switchAccount.ts → switchConnection.ts} +7 -7
- package/src/actions/waitForTransactionReceipt.ts +4 -1
- package/src/actions/watchConnection.ts +33 -0
- package/src/actions/writeContract.ts +1 -4
- package/src/connectors/createConnector.ts +0 -2
- package/src/connectors/injected.ts +0 -4
- package/src/exports/actions.ts +48 -44
- package/src/exports/index.ts +50 -46
- package/src/exports/query.ts +30 -16
- package/src/query/switchConnection.ts +52 -0
- package/src/version.ts +1 -1
- package/dist/esm/actions/getAccount.js.map +0 -1
- package/dist/esm/actions/getToken.js +0 -102
- package/dist/esm/actions/getToken.js.map +0 -1
- package/dist/esm/actions/switchAccount.js.map +0 -1
- package/dist/esm/actions/watchAccount.js.map +0 -1
- package/dist/esm/experimental/actions/writeContracts.js +0 -18
- package/dist/esm/experimental/actions/writeContracts.js.map +0 -1
- package/dist/esm/experimental/query/writeContracts.js +0 -10
- package/dist/esm/experimental/query/writeContracts.js.map +0 -1
- package/dist/esm/exports/experimental.js +0 -50
- package/dist/esm/exports/experimental.js.map +0 -1
- package/dist/esm/query/getToken.js +0 -17
- package/dist/esm/query/getToken.js.map +0 -1
- package/dist/esm/query/switchAccount.js +0 -10
- package/dist/esm/query/switchAccount.js.map +0 -1
- package/dist/esm/types/unit.js +0 -2
- package/dist/esm/types/unit.js.map +0 -1
- package/dist/esm/utils/getUnit.js +0 -9
- package/dist/esm/utils/getUnit.js.map +0 -1
- package/dist/esm/utils/normalizeChainId.js +0 -11
- package/dist/esm/utils/normalizeChainId.js.map +0 -1
- package/dist/types/actions/getAccount.d.ts.map +0 -1
- package/dist/types/actions/getToken.d.ts +0 -24
- package/dist/types/actions/getToken.d.ts.map +0 -1
- package/dist/types/actions/switchAccount.d.ts +0 -15
- package/dist/types/actions/switchAccount.d.ts.map +0 -1
- package/dist/types/actions/watchAccount.d.ts +0 -9
- package/dist/types/actions/watchAccount.d.ts.map +0 -1
- package/dist/types/experimental/actions/writeContracts.d.ts +0 -16
- package/dist/types/experimental/actions/writeContracts.d.ts.map +0 -1
- package/dist/types/experimental/query/writeContracts.d.ts +0 -13
- package/dist/types/experimental/query/writeContracts.d.ts.map +0 -1
- package/dist/types/exports/experimental.d.ts +0 -127
- package/dist/types/exports/experimental.d.ts.map +0 -1
- package/dist/types/query/getToken.d.ts +0 -35
- package/dist/types/query/getToken.d.ts.map +0 -1
- package/dist/types/query/switchAccount.d.ts +0 -15
- package/dist/types/query/switchAccount.d.ts.map +0 -1
- package/dist/types/types/unit.d.ts +0 -2
- package/dist/types/types/unit.d.ts.map +0 -1
- package/dist/types/utils/getUnit.d.ts +0 -3
- package/dist/types/utils/getUnit.d.ts.map +0 -1
- package/dist/types/utils/normalizeChainId.d.ts +0 -3
- package/dist/types/utils/normalizeChainId.d.ts.map +0 -1
- package/experimental/package.json +0 -5
- package/src/actions/getToken.ts +0 -141
- package/src/actions/watchAccount.ts +0 -33
- package/src/experimental/actions/writeContracts.ts +0 -79
- package/src/experimental/query/writeContracts.ts +0 -70
- package/src/exports/experimental.ts +0 -153
- package/src/query/getToken.ts +0 -49
- package/src/query/switchAccount.ts +0 -52
- package/src/types/unit.ts +0 -1
- package/src/utils/getUnit.ts +0 -9
- package/src/utils/normalizeChainId.ts +0 -13
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
////////////////////////////////////////////////////////////////////////////////
|
|
2
|
-
// Actions
|
|
3
|
-
////////////////////////////////////////////////////////////////////////////////
|
|
4
|
-
|
|
5
|
-
// biome-ignore lint/performance/noBarrelFile: entrypoint module
|
|
6
|
-
export {
|
|
7
|
-
/** @deprecated This is no longer experimental – use `import type { GetCallsStatusErrorType } from '@wagmi/core'` instead. */
|
|
8
|
-
type GetCallsStatusErrorType,
|
|
9
|
-
/** @deprecated This is no longer experimental – use `import type { GetCallsStatusParameters } from '@wagmi/core'` instead. */
|
|
10
|
-
type GetCallsStatusParameters,
|
|
11
|
-
/** @deprecated This is no longer experimental – use `import type { GetCallsStatusReturnType } from '@wagmi/core'` instead. */
|
|
12
|
-
type GetCallsStatusReturnType,
|
|
13
|
-
/** @deprecated This is no longer experimental – use `import { getCallsStatus } from '@wagmi/core'` instead. */
|
|
14
|
-
getCallsStatus,
|
|
15
|
-
} from '../actions/getCallsStatus.js'
|
|
16
|
-
|
|
17
|
-
export {
|
|
18
|
-
/** @deprecated This is no longer experimental – use `import type { GetCapabilitiesErrorType } from '@wagmi/core'` instead. */
|
|
19
|
-
type GetCapabilitiesErrorType,
|
|
20
|
-
/** @deprecated This is no longer experimental – use `import type { GetCapabilitiesParameters } from '@wagmi/core'` instead. */
|
|
21
|
-
type GetCapabilitiesParameters,
|
|
22
|
-
/** @deprecated This is no longer experimental – use `import type { GetCapabilitiesReturnType } from '@wagmi/core'` instead. */
|
|
23
|
-
type GetCapabilitiesReturnType,
|
|
24
|
-
/** @deprecated This is no longer experimental – use `import { getCapabilities } from '@wagmi/core'` instead. */
|
|
25
|
-
getCapabilities,
|
|
26
|
-
} from '../actions/getCapabilities.js'
|
|
27
|
-
|
|
28
|
-
export {
|
|
29
|
-
/** @deprecated This is no longer experimental – use `import type { SendCallsErrorType } from '@wagmi/core'` instead. */
|
|
30
|
-
type SendCallsErrorType,
|
|
31
|
-
/** @deprecated This is no longer experimental – use `import type { SendCallsParameters } from '@wagmi/core'` instead. */
|
|
32
|
-
type SendCallsParameters,
|
|
33
|
-
/** @deprecated This is no longer experimental – use `import type { SendCallsReturnType } from '@wagmi/core'` instead. */
|
|
34
|
-
type SendCallsReturnType,
|
|
35
|
-
/** @deprecated This is no longer experimental – use `import { sendCalls } from '@wagmi/core'` instead. */
|
|
36
|
-
sendCalls,
|
|
37
|
-
} from '../actions/sendCalls.js'
|
|
38
|
-
|
|
39
|
-
export {
|
|
40
|
-
/** @deprecated This is no longer experimental – use `import type { ShowCallsStatusErrorType } from '@wagmi/core'` instead. */
|
|
41
|
-
type ShowCallsStatusErrorType,
|
|
42
|
-
/** @deprecated This is no longer experimental – use `import type { ShowCallsStatusParameters } from '@wagmi/core'` instead. */
|
|
43
|
-
type ShowCallsStatusParameters,
|
|
44
|
-
/** @deprecated This is no longer experimental – use `import type { ShowCallsStatusReturnType } from '@wagmi/core'` instead. */
|
|
45
|
-
type ShowCallsStatusReturnType,
|
|
46
|
-
/** @deprecated This is no longer experimental – use `import { showCallsStatus } from '@wagmi/core'` instead. */
|
|
47
|
-
showCallsStatus,
|
|
48
|
-
} from '../actions/showCallsStatus.js'
|
|
49
|
-
|
|
50
|
-
export {
|
|
51
|
-
/** @deprecated This is no longer experimental – use `import type { WaitForCallsStatusErrorType } from '@wagmi/core'` instead. */
|
|
52
|
-
type WaitForCallsStatusErrorType,
|
|
53
|
-
/** @deprecated This is no longer experimental – use `import type { WaitForCallsStatusParameters } from '@wagmi/core'` instead. */
|
|
54
|
-
type WaitForCallsStatusParameters,
|
|
55
|
-
/** @deprecated This is no longer experimental – use `import type { WaitForCallsStatusReturnType } from '@wagmi/core'` instead. */
|
|
56
|
-
type WaitForCallsStatusReturnType,
|
|
57
|
-
/** @deprecated This is no longer experimental – use `import { waitForCallsStatus } from '@wagmi/core'` instead. */
|
|
58
|
-
waitForCallsStatus,
|
|
59
|
-
} from '../actions/waitForCallsStatus.js'
|
|
60
|
-
|
|
61
|
-
export {
|
|
62
|
-
/** @deprecated Use `SendCallsErrorType` instead. */
|
|
63
|
-
type WriteContractsErrorType,
|
|
64
|
-
/** @deprecated Use `SendCallsParameters` instead. */
|
|
65
|
-
type WriteContractsParameters,
|
|
66
|
-
/** @deprecated Use `SendCallsReturnType` instead. */
|
|
67
|
-
type WriteContractsReturnType,
|
|
68
|
-
/** @deprecated Use `sendCalls` instead. */
|
|
69
|
-
writeContracts,
|
|
70
|
-
} from '../experimental/actions/writeContracts.js'
|
|
71
|
-
|
|
72
|
-
////////////////////////////////////////////////////////////////////////////////
|
|
73
|
-
// Tanstack Query
|
|
74
|
-
////////////////////////////////////////////////////////////////////////////////
|
|
75
|
-
|
|
76
|
-
export {
|
|
77
|
-
/** @deprecated Use `SendCallsData` instead. */
|
|
78
|
-
type WriteContractsData,
|
|
79
|
-
/** @deprecated Use `SendCallsMutate` instead. */
|
|
80
|
-
type WriteContractsMutate,
|
|
81
|
-
/** @deprecated Use `SendCallsMutateAsync` instead. */
|
|
82
|
-
type WriteContractsMutateAsync,
|
|
83
|
-
/** @deprecated Use `SendCallsVariables` instead. */
|
|
84
|
-
type WriteContractsVariables,
|
|
85
|
-
/** @deprecated Use `sendCallsMutationOptions` instead. */
|
|
86
|
-
writeContractsMutationOptions,
|
|
87
|
-
} from '../experimental/query/writeContracts.js'
|
|
88
|
-
export {
|
|
89
|
-
/** @deprecated This is no longer experimental – use `import type { GetCallsStatusData } from '@wagmi/core/query'` instead. */
|
|
90
|
-
type GetCallsStatusData,
|
|
91
|
-
/** @deprecated This is no longer experimental – use `import type { GetCallsStatusOptions } from '@wagmi/core/query'` instead. */
|
|
92
|
-
type GetCallsStatusOptions,
|
|
93
|
-
/** @deprecated This is no longer experimental – use `import type { GetCallsStatusQueryFnData } from '@wagmi/core/query'` instead. */
|
|
94
|
-
type GetCallsStatusQueryFnData,
|
|
95
|
-
/** @deprecated This is no longer experimental – use `import type { GetCallsStatusQueryKey } from '@wagmi/core/query'` instead. */
|
|
96
|
-
type GetCallsStatusQueryKey,
|
|
97
|
-
/** @deprecated This is no longer experimental – use `import { getCallsStatusQueryKey } from '@wagmi/core/query'` instead. */
|
|
98
|
-
getCallsStatusQueryKey,
|
|
99
|
-
/** @deprecated This is no longer experimental – use `import { getCallsStatusQueryOptions } from '@wagmi/core/query'` instead. */
|
|
100
|
-
getCallsStatusQueryOptions,
|
|
101
|
-
} from '../query/getCallsStatus.js'
|
|
102
|
-
export {
|
|
103
|
-
/** @deprecated This is no longer experimental – use `import type { GetCapabilitiesData } from '@wagmi/core/query'` instead. */
|
|
104
|
-
type GetCapabilitiesData,
|
|
105
|
-
/** @deprecated This is no longer experimental – use `import type { GetCapabilitiesOptions } from '@wagmi/core/query'` instead. */
|
|
106
|
-
type GetCapabilitiesOptions,
|
|
107
|
-
/** @deprecated This is no longer experimental – use `import type { GetCapabilitiesQueryFnData } from '@wagmi/core/query'` instead. */
|
|
108
|
-
type GetCapabilitiesQueryFnData,
|
|
109
|
-
/** @deprecated This is no longer experimental – use `import type { GetCapabilitiesQueryKey } from '@wagmi/core/query'` instead. */
|
|
110
|
-
type GetCapabilitiesQueryKey,
|
|
111
|
-
/** @deprecated This is no longer experimental – use `import { getCapabilitiesQueryKey } from '@wagmi/core/query'` instead. */
|
|
112
|
-
getCapabilitiesQueryKey,
|
|
113
|
-
/** @deprecated This is no longer experimental – use `import { getCapabilitiesQueryOptions } from '@wagmi/core/query'` instead. */
|
|
114
|
-
getCapabilitiesQueryOptions,
|
|
115
|
-
} from '../query/getCapabilities.js'
|
|
116
|
-
export {
|
|
117
|
-
/** @deprecated This is no longer experimental – use `import type { SendCallsData } from '@wagmi/core/query'` instead. */
|
|
118
|
-
type SendCallsData,
|
|
119
|
-
/** @deprecated This is no longer experimental – use `import type { SendCallsMutate } from '@wagmi/core/query'` instead. */
|
|
120
|
-
type SendCallsMutate,
|
|
121
|
-
/** @deprecated This is no longer experimental – use `import type { SendCallsMutateAsync } from '@wagmi/core/query'` instead. */
|
|
122
|
-
type SendCallsMutateAsync,
|
|
123
|
-
/** @deprecated This is no longer experimental – use `import type { SendCallsVariables } from '@wagmi/core/query'` instead. */
|
|
124
|
-
type SendCallsVariables,
|
|
125
|
-
/** @deprecated This is no longer experimental – use `import { sendCallsMutationOptions } from '@wagmi/core/query'` instead. */
|
|
126
|
-
sendCallsMutationOptions,
|
|
127
|
-
} from '../query/sendCalls.js'
|
|
128
|
-
export {
|
|
129
|
-
/** @deprecated This is no longer experimental – use `import type { ShowCallsStatusData } from '@wagmi/core/query'` instead. */
|
|
130
|
-
type ShowCallsStatusData,
|
|
131
|
-
/** @deprecated This is no longer experimental – use `import type { ShowCallsStatusMutate } from '@wagmi/core/query'` instead. */
|
|
132
|
-
type ShowCallsStatusMutate,
|
|
133
|
-
/** @deprecated This is no longer experimental – use `import type { ShowCallsStatusMutateAsync } from '@wagmi/core/query'` instead. */
|
|
134
|
-
type ShowCallsStatusMutateAsync,
|
|
135
|
-
/** @deprecated This is no longer experimental – use `import type { ShowCallsStatusVariables } from '@wagmi/core/query'` instead. */
|
|
136
|
-
type ShowCallsStatusVariables,
|
|
137
|
-
/** @deprecated This is no longer experimental – use `import { showCallsStatusMutationOptions } from '@wagmi/core/query'` instead. */
|
|
138
|
-
showCallsStatusMutationOptions,
|
|
139
|
-
} from '../query/showCallsStatus.js'
|
|
140
|
-
export {
|
|
141
|
-
/** @deprecated This is no longer experimental – use `import type { WaitForCallsStatusData } from '@wagmi/core/query'` instead. */
|
|
142
|
-
type WaitForCallsStatusData,
|
|
143
|
-
/** @deprecated This is no longer experimental – use `import type { WaitForCallsStatusOptions } from '@wagmi/core/query'` instead. */
|
|
144
|
-
type WaitForCallsStatusOptions,
|
|
145
|
-
/** @deprecated This is no longer experimental – use `import type { WaitForCallsStatusQueryFnData } from '@wagmi/core/query'` instead. */
|
|
146
|
-
type WaitForCallsStatusQueryFnData,
|
|
147
|
-
/** @deprecated This is no longer experimental – use `import type { WaitForCallsStatusQueryKey } from '@wagmi/core/query'` instead. */
|
|
148
|
-
type WaitForCallsStatusQueryKey,
|
|
149
|
-
/** @deprecated This is no longer experimental – use `import { waitForCallsStatusQueryKey } from '@wagmi/core/query'` instead. */
|
|
150
|
-
waitForCallsStatusQueryKey,
|
|
151
|
-
/** @deprecated This is no longer experimental – use `import { waitForCallsStatusQueryOptions } from '@wagmi/core/query'` instead. */
|
|
152
|
-
waitForCallsStatusQueryOptions,
|
|
153
|
-
} from '../query/waitForCallsStatus.js'
|
package/src/query/getToken.ts
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import type { QueryOptions } from '@tanstack/query-core'
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
type GetTokenErrorType,
|
|
5
|
-
type GetTokenParameters,
|
|
6
|
-
type GetTokenReturnType,
|
|
7
|
-
getToken,
|
|
8
|
-
} from '../actions/getToken.js'
|
|
9
|
-
import type { Config } from '../createConfig.js'
|
|
10
|
-
import type { ScopeKeyParameter } from '../types/properties.js'
|
|
11
|
-
import type { Compute, ExactPartial } from '../types/utils.js'
|
|
12
|
-
import { filterQueryOptions } from './utils.js'
|
|
13
|
-
|
|
14
|
-
export type GetTokenOptions<config extends Config> = Compute<
|
|
15
|
-
ExactPartial<GetTokenParameters<config>> & ScopeKeyParameter
|
|
16
|
-
>
|
|
17
|
-
|
|
18
|
-
export function getTokenQueryOptions<config extends Config>(
|
|
19
|
-
config: config,
|
|
20
|
-
options: GetTokenOptions<config> = {},
|
|
21
|
-
) {
|
|
22
|
-
return {
|
|
23
|
-
async queryFn({ queryKey }) {
|
|
24
|
-
const { address, scopeKey: _, ...parameters } = queryKey[1]
|
|
25
|
-
if (!address) throw new Error('address is required')
|
|
26
|
-
return getToken(config, { ...parameters, address })
|
|
27
|
-
},
|
|
28
|
-
queryKey: getTokenQueryKey(options),
|
|
29
|
-
} as const satisfies QueryOptions<
|
|
30
|
-
GetTokenQueryFnData,
|
|
31
|
-
GetTokenErrorType,
|
|
32
|
-
GetTokenData,
|
|
33
|
-
GetTokenQueryKey<config>
|
|
34
|
-
>
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export type GetTokenQueryFnData = GetTokenReturnType
|
|
38
|
-
|
|
39
|
-
export type GetTokenData = GetTokenQueryFnData
|
|
40
|
-
|
|
41
|
-
export function getTokenQueryKey<config extends Config>(
|
|
42
|
-
options: GetTokenOptions<config> = {},
|
|
43
|
-
) {
|
|
44
|
-
return ['token', filterQueryOptions(options)] as const
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export type GetTokenQueryKey<config extends Config> = ReturnType<
|
|
48
|
-
typeof getTokenQueryKey<config>
|
|
49
|
-
>
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import type { MutationOptions } from '@tanstack/query-core'
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
type SwitchAccountErrorType,
|
|
5
|
-
type SwitchAccountParameters,
|
|
6
|
-
type SwitchAccountReturnType,
|
|
7
|
-
switchAccount,
|
|
8
|
-
} from '../actions/switchAccount.js'
|
|
9
|
-
import type { Config } from '../createConfig.js'
|
|
10
|
-
import type { Compute } from '../types/utils.js'
|
|
11
|
-
import type { Mutate, MutateAsync } from './types.js'
|
|
12
|
-
|
|
13
|
-
export function switchAccountMutationOptions<config extends Config>(
|
|
14
|
-
config: config,
|
|
15
|
-
) {
|
|
16
|
-
return {
|
|
17
|
-
mutationFn(variables) {
|
|
18
|
-
return switchAccount(config, variables)
|
|
19
|
-
},
|
|
20
|
-
mutationKey: ['switchAccount'],
|
|
21
|
-
} as const satisfies MutationOptions<
|
|
22
|
-
SwitchAccountData<config>,
|
|
23
|
-
SwitchAccountErrorType,
|
|
24
|
-
SwitchAccountVariables
|
|
25
|
-
>
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export type SwitchAccountData<config extends Config> = Compute<
|
|
29
|
-
SwitchAccountReturnType<config>
|
|
30
|
-
>
|
|
31
|
-
|
|
32
|
-
export type SwitchAccountVariables = Compute<SwitchAccountParameters>
|
|
33
|
-
|
|
34
|
-
export type SwitchAccountMutate<
|
|
35
|
-
config extends Config,
|
|
36
|
-
context = unknown,
|
|
37
|
-
> = Mutate<
|
|
38
|
-
SwitchAccountData<config>,
|
|
39
|
-
SwitchAccountErrorType,
|
|
40
|
-
SwitchAccountVariables,
|
|
41
|
-
context
|
|
42
|
-
>
|
|
43
|
-
|
|
44
|
-
export type SwitchAccountMutateAsync<
|
|
45
|
-
config extends Config,
|
|
46
|
-
context = unknown,
|
|
47
|
-
> = MutateAsync<
|
|
48
|
-
SwitchAccountData<config>,
|
|
49
|
-
SwitchAccountErrorType,
|
|
50
|
-
SwitchAccountVariables,
|
|
51
|
-
context
|
|
52
|
-
>
|
package/src/types/unit.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type Unit = 'ether' | 'gwei' | 'wei' | number
|
package/src/utils/getUnit.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/** @deprecated use `Number` instead */
|
|
2
|
-
export function normalizeChainId(chainId: bigint | number | string | unknown) {
|
|
3
|
-
if (typeof chainId === 'string')
|
|
4
|
-
return Number.parseInt(
|
|
5
|
-
chainId,
|
|
6
|
-
chainId.trim().substring(0, 2) === '0x' ? 16 : 10,
|
|
7
|
-
)
|
|
8
|
-
if (typeof chainId === 'bigint') return Number(chainId)
|
|
9
|
-
if (typeof chainId === 'number') return chainId
|
|
10
|
-
throw new Error(
|
|
11
|
-
`Cannot normalize chainId "${chainId}" of type "${typeof chainId}"`,
|
|
12
|
-
)
|
|
13
|
-
}
|