@wagmi/core 2.0.0-alpha.4 → 2.0.0-alpha.5
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/getAccount.js +5 -0
- package/dist/esm/actions/getAccount.js.map +1 -1
- package/dist/esm/actions/watchBlockNumber.js +1 -3
- package/dist/esm/actions/watchBlockNumber.js.map +1 -1
- package/dist/esm/actions/watchBlocks.js +1 -3
- package/dist/esm/actions/watchBlocks.js.map +1 -1
- package/dist/esm/actions/watchContractEvent.js +1 -3
- package/dist/esm/actions/watchContractEvent.js.map +1 -1
- package/dist/esm/actions/watchPendingTransactions.js +1 -3
- package/dist/esm/actions/watchPendingTransactions.js.map +1 -1
- package/dist/esm/actions/writeContract.js.map +1 -1
- package/dist/esm/connectors/injected.js +20 -5
- package/dist/esm/connectors/injected.js.map +1 -1
- package/dist/esm/connectors/mock.js +129 -0
- package/dist/esm/connectors/mock.js.map +1 -0
- package/dist/esm/createConfig.js +1 -1
- package/dist/esm/createConfig.js.map +1 -1
- package/dist/esm/exports/actions.js +33 -11
- package/dist/esm/exports/actions.js.map +1 -1
- package/dist/esm/exports/index.js +31 -11
- package/dist/esm/exports/index.js.map +1 -1
- package/dist/esm/exports/internal.js +4 -0
- package/dist/esm/exports/internal.js.map +1 -1
- package/dist/esm/tsconfig.build.tsbuildinfo +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/types/actions/getAccount.d.ts +5 -1
- package/dist/types/actions/getAccount.d.ts.map +1 -1
- package/dist/types/actions/watchBlockNumber.d.ts.map +1 -1
- package/dist/types/actions/watchBlocks.d.ts.map +1 -1
- package/dist/types/actions/watchContractEvent.d.ts.map +1 -1
- package/dist/types/actions/watchPendingTransactions.d.ts.map +1 -1
- package/dist/types/actions/writeContract.d.ts +3 -3
- package/dist/types/actions/writeContract.d.ts.map +1 -1
- package/dist/types/connectors/injected.d.ts +1 -0
- package/dist/types/connectors/injected.d.ts.map +1 -1
- package/dist/types/connectors/mock.d.ts +17 -0
- package/dist/types/connectors/mock.d.ts.map +1 -0
- package/dist/types/createConfig.d.ts +1 -1
- package/dist/types/createConfig.d.ts.map +1 -1
- package/dist/types/exports/actions.d.ts +33 -11
- package/dist/types/exports/actions.d.ts.map +1 -1
- package/dist/types/exports/index.d.ts +31 -11
- package/dist/types/exports/index.d.ts.map +1 -1
- package/dist/types/exports/internal.d.ts +2 -0
- package/dist/types/exports/internal.d.ts.map +1 -1
- package/dist/types/query/writeContract.d.ts +51 -1
- package/dist/types/query/writeContract.d.ts.map +1 -1
- package/dist/types/version.d.ts +1 -1
- package/package.json +2 -2
- package/src/actions/getAccount.ts +10 -1
- package/src/actions/watchBlockNumber.ts +1 -3
- package/src/actions/watchBlocks.ts +1 -3
- package/src/actions/watchContractEvent.ts +1 -3
- package/src/actions/watchPendingTransactions.ts +1 -3
- package/src/actions/writeContract.ts +20 -24
- package/src/connectors/injected.ts +23 -6
- package/src/connectors/mock.ts +174 -0
- package/src/createConfig.ts +2 -3
- package/src/exports/actions.ts +40 -7
- package/src/exports/index.ts +22 -5
- package/src/exports/internal.ts +13 -0
- package/src/version.ts +1 -1
|
@@ -66,9 +66,7 @@ export function watchBlockNumber<
|
|
|
66
66
|
if (syncConnectedChain && !parameters.chainId)
|
|
67
67
|
unsubscribe = config.subscribe(
|
|
68
68
|
({ chainId }) => chainId,
|
|
69
|
-
async (chainId) =>
|
|
70
|
-
return listener(chainId)
|
|
71
|
-
},
|
|
69
|
+
async (chainId) => listener(chainId),
|
|
72
70
|
)
|
|
73
71
|
|
|
74
72
|
return () => {
|
|
@@ -75,9 +75,7 @@ export function watchBlocks<
|
|
|
75
75
|
if (syncConnectedChain && !parameters.chainId)
|
|
76
76
|
unsubscribe = config.subscribe(
|
|
77
77
|
({ chainId }) => chainId,
|
|
78
|
-
async (chainId) =>
|
|
79
|
-
return listener(chainId)
|
|
80
|
-
},
|
|
78
|
+
async (chainId) => listener(chainId),
|
|
81
79
|
)
|
|
82
80
|
|
|
83
81
|
return () => {
|
|
@@ -86,9 +86,7 @@ export function watchContractEvent<
|
|
|
86
86
|
if (syncConnectedChain && !parameters.chainId)
|
|
87
87
|
unsubscribe = config.subscribe(
|
|
88
88
|
({ chainId }) => chainId,
|
|
89
|
-
async (chainId) =>
|
|
90
|
-
return listener(chainId)
|
|
91
|
-
},
|
|
89
|
+
async (chainId) => listener(chainId),
|
|
92
90
|
)
|
|
93
91
|
|
|
94
92
|
return () => {
|
|
@@ -67,9 +67,7 @@ export function watchPendingTransactions<
|
|
|
67
67
|
if (syncConnectedChain && !parameters.chainId)
|
|
68
68
|
unsubscribe = config.subscribe(
|
|
69
69
|
({ chainId }) => chainId,
|
|
70
|
-
async (chainId) =>
|
|
71
|
-
return listener(chainId)
|
|
72
|
-
},
|
|
70
|
+
async (chainId) => listener(chainId),
|
|
73
71
|
)
|
|
74
72
|
|
|
75
73
|
return () => {
|
|
@@ -15,7 +15,7 @@ import type {
|
|
|
15
15
|
ChainIdParameter,
|
|
16
16
|
ConnectorParameter,
|
|
17
17
|
} from '../types/properties.js'
|
|
18
|
-
import type { Evaluate, UnionOmit } from '../types/utils.js'
|
|
18
|
+
import type { Evaluate, UnionEvaluate, UnionOmit } from '../types/utils.js'
|
|
19
19
|
import { assertActiveChain } from '../utils/assertActiveChain.js'
|
|
20
20
|
import { getConnectorClient } from './getConnectorClient.js'
|
|
21
21
|
import {
|
|
@@ -39,22 +39,24 @@ export type WriteContractParameters<
|
|
|
39
39
|
///
|
|
40
40
|
allFunctionNames = ContractFunctionName<abi, 'nonpayable' | 'payable'>,
|
|
41
41
|
chains extends readonly Chain[] = SelectChains<config, chainId>,
|
|
42
|
-
> =
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
42
|
+
> = UnionEvaluate<
|
|
43
|
+
{
|
|
44
|
+
[key in keyof chains]: UnionOmit<
|
|
45
|
+
viem_WriteContractParameters<
|
|
46
|
+
abi,
|
|
47
|
+
functionName,
|
|
48
|
+
args,
|
|
49
|
+
chains[key],
|
|
50
|
+
Account,
|
|
51
|
+
chains[key],
|
|
52
|
+
allFunctionNames
|
|
53
|
+
>,
|
|
54
|
+
'chain'
|
|
55
|
+
>
|
|
56
|
+
}[number] &
|
|
57
|
+
Evaluate<ChainIdParameter<config, chainId>> &
|
|
58
|
+
ConnectorParameter & { __mode?: 'prepared' }
|
|
59
|
+
>
|
|
58
60
|
|
|
59
61
|
export type WriteContractReturnType = viem_WriteContractReturnType
|
|
60
62
|
|
|
@@ -91,13 +93,7 @@ export async function writeContract<
|
|
|
91
93
|
} else {
|
|
92
94
|
const { request: simulateRequest } = await simulateContract(
|
|
93
95
|
config,
|
|
94
|
-
rest as
|
|
95
|
-
abi,
|
|
96
|
-
functionName,
|
|
97
|
-
args,
|
|
98
|
-
config,
|
|
99
|
-
chainId
|
|
100
|
-
>,
|
|
96
|
+
rest as SimulateContractParameters,
|
|
101
97
|
)
|
|
102
98
|
request = simulateRequest
|
|
103
99
|
}
|
|
@@ -122,7 +122,9 @@ export function injected(parameters: InjectedParameters = {}) {
|
|
|
122
122
|
type Properties = {
|
|
123
123
|
onConnect(connectInfo: ProviderConnectInfo): void
|
|
124
124
|
}
|
|
125
|
-
type StorageItem = {
|
|
125
|
+
type StorageItem = {
|
|
126
|
+
[_ in 'injected.connected' | `${string}.disconnected`]: true
|
|
127
|
+
}
|
|
126
128
|
|
|
127
129
|
return createConnector<Provider, Properties, StorageItem>((config) => ({
|
|
128
130
|
get icon() {
|
|
@@ -137,9 +139,8 @@ export function injected(parameters: InjectedParameters = {}) {
|
|
|
137
139
|
async setup() {
|
|
138
140
|
const provider = await this.getProvider()
|
|
139
141
|
// Only start listening for events if `target` is set, otherwise `injected()` will also receive events
|
|
140
|
-
if (provider && parameters.target)
|
|
142
|
+
if (provider && parameters.target)
|
|
141
143
|
provider.on('connect', this.onConnect.bind(this))
|
|
142
|
-
}
|
|
143
144
|
},
|
|
144
145
|
async connect({ chainId, isReconnecting } = {}) {
|
|
145
146
|
const provider = await this.getProvider()
|
|
@@ -190,9 +191,13 @@ export function injected(parameters: InjectedParameters = {}) {
|
|
|
190
191
|
currentChainId = chain?.id ?? currentChainId
|
|
191
192
|
}
|
|
192
193
|
|
|
193
|
-
|
|
194
|
-
|
|
194
|
+
if (shimDisconnect) {
|
|
195
|
+
// Remove disconnected shim if it exists
|
|
195
196
|
await config.storage?.removeItem(`${this.id}.disconnected`)
|
|
197
|
+
// Add connected shim if no target exists
|
|
198
|
+
if (!parameters.target)
|
|
199
|
+
await config.storage?.setItem('injected.connected', true)
|
|
200
|
+
}
|
|
196
201
|
|
|
197
202
|
return { accounts, chainId: currentChainId }
|
|
198
203
|
} catch (err) {
|
|
@@ -217,8 +222,11 @@ export function injected(parameters: InjectedParameters = {}) {
|
|
|
217
222
|
provider.on('connect', this.onConnect.bind(this))
|
|
218
223
|
|
|
219
224
|
// Add shim signalling connector is disconnected
|
|
220
|
-
if (shimDisconnect)
|
|
225
|
+
if (shimDisconnect) {
|
|
221
226
|
await config.storage?.setItem(`${this.id}.disconnected`, true)
|
|
227
|
+
if (!parameters.target)
|
|
228
|
+
await config.storage?.removeItem('injected.connected')
|
|
229
|
+
}
|
|
222
230
|
},
|
|
223
231
|
async getAccounts() {
|
|
224
232
|
const provider = await this.getProvider()
|
|
@@ -249,6 +257,15 @@ export function injected(parameters: InjectedParameters = {}) {
|
|
|
249
257
|
(await config.storage?.getItem(`${this.id}.disconnected`))
|
|
250
258
|
if (isDisconnected) return false
|
|
251
259
|
|
|
260
|
+
// Don't allow injected connector to connect if no target is set and it hasn't already connected
|
|
261
|
+
// (e.g. flag in storage is not set). This prevents a targetless injected connector from connecting
|
|
262
|
+
// automatically whenever there is a targeted connector configured.
|
|
263
|
+
if (!parameters.target) {
|
|
264
|
+
const connected = await config.storage?.getItem('injected.connected')
|
|
265
|
+
console.log({ connected })
|
|
266
|
+
if (!connected) return false
|
|
267
|
+
}
|
|
268
|
+
|
|
252
269
|
const provider = await this.getProvider()
|
|
253
270
|
if (!provider) {
|
|
254
271
|
if (
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import {
|
|
2
|
+
type Address,
|
|
3
|
+
type EIP1193RequestFn,
|
|
4
|
+
type Hex,
|
|
5
|
+
RpcRequestError,
|
|
6
|
+
SwitchChainError,
|
|
7
|
+
type Transport,
|
|
8
|
+
UserRejectedRequestError,
|
|
9
|
+
type WalletRpcSchema,
|
|
10
|
+
custom,
|
|
11
|
+
fromHex,
|
|
12
|
+
getAddress,
|
|
13
|
+
numberToHex,
|
|
14
|
+
} from 'viem'
|
|
15
|
+
import { rpc } from 'viem/utils'
|
|
16
|
+
|
|
17
|
+
import {
|
|
18
|
+
ChainNotConfiguredError,
|
|
19
|
+
ConnectorNotConnectedError,
|
|
20
|
+
} from '../errors/config.js'
|
|
21
|
+
import { normalizeChainId } from '../utils/normalizeChainId.js'
|
|
22
|
+
import { createConnector } from './createConnector.js'
|
|
23
|
+
|
|
24
|
+
export type MockParameters = {
|
|
25
|
+
accounts: readonly [Address, ...Address[]]
|
|
26
|
+
features?:
|
|
27
|
+
| {
|
|
28
|
+
connectError?: boolean | Error | undefined
|
|
29
|
+
switchChainError?: boolean | Error | undefined
|
|
30
|
+
signMessageError?: boolean | Error | undefined
|
|
31
|
+
signTypedDataError?: boolean | Error | undefined
|
|
32
|
+
reconnect?: boolean | undefined
|
|
33
|
+
}
|
|
34
|
+
| undefined
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export function mock(parameters: MockParameters) {
|
|
38
|
+
const features = parameters.features ?? {}
|
|
39
|
+
|
|
40
|
+
type Provider = ReturnType<
|
|
41
|
+
Transport<'custom', {}, EIP1193RequestFn<WalletRpcSchema>>
|
|
42
|
+
>
|
|
43
|
+
let connected = false
|
|
44
|
+
let connectedChainId: number
|
|
45
|
+
|
|
46
|
+
return createConnector<Provider>((config) => ({
|
|
47
|
+
id: 'mock',
|
|
48
|
+
name: 'Mock Connector',
|
|
49
|
+
async setup() {
|
|
50
|
+
connectedChainId = config.chains[0].id
|
|
51
|
+
},
|
|
52
|
+
async connect({ chainId } = {}) {
|
|
53
|
+
if (features.connectError) {
|
|
54
|
+
if (typeof features.connectError === 'boolean')
|
|
55
|
+
throw new UserRejectedRequestError(new Error('Failed to connect.'))
|
|
56
|
+
throw features.connectError
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const provider = await this.getProvider()
|
|
60
|
+
const accounts = await provider.request({
|
|
61
|
+
method: 'eth_requestAccounts',
|
|
62
|
+
})
|
|
63
|
+
|
|
64
|
+
let currentChainId = await this.getChainId()
|
|
65
|
+
if (chainId && currentChainId !== chainId) {
|
|
66
|
+
const chain = await this.switchChain!({ chainId })
|
|
67
|
+
currentChainId = chain.id
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
connected = true
|
|
71
|
+
|
|
72
|
+
return { accounts, chainId: currentChainId }
|
|
73
|
+
},
|
|
74
|
+
async disconnect() {
|
|
75
|
+
connected = false
|
|
76
|
+
},
|
|
77
|
+
async getAccounts() {
|
|
78
|
+
if (!connected) throw new ConnectorNotConnectedError()
|
|
79
|
+
const provider = await this.getProvider()
|
|
80
|
+
const accounts = await provider.request({ method: 'eth_accounts' })
|
|
81
|
+
return accounts.map(getAddress)
|
|
82
|
+
},
|
|
83
|
+
async getChainId() {
|
|
84
|
+
const provider = await this.getProvider()
|
|
85
|
+
const hexChainId = await provider.request({ method: 'eth_chainId' })
|
|
86
|
+
return fromHex(hexChainId, 'number')
|
|
87
|
+
},
|
|
88
|
+
async isAuthorized() {
|
|
89
|
+
if (!features.reconnect) return false
|
|
90
|
+
if (!connected) return false
|
|
91
|
+
const accounts = await this.getAccounts()
|
|
92
|
+
return !!accounts.length
|
|
93
|
+
},
|
|
94
|
+
async switchChain({ chainId }) {
|
|
95
|
+
const provider = await this.getProvider()
|
|
96
|
+
const chain = config.chains.find((x) => x.id === chainId)
|
|
97
|
+
if (!chain) throw new SwitchChainError(new ChainNotConfiguredError())
|
|
98
|
+
|
|
99
|
+
await provider.request({
|
|
100
|
+
method: 'wallet_switchEthereumChain',
|
|
101
|
+
params: [{ chainId: numberToHex(chainId) }],
|
|
102
|
+
})
|
|
103
|
+
return chain
|
|
104
|
+
},
|
|
105
|
+
onAccountsChanged(accounts) {
|
|
106
|
+
if (accounts.length === 0) this.onDisconnect()
|
|
107
|
+
else config.emitter.emit('change', { accounts: accounts.map(getAddress) })
|
|
108
|
+
},
|
|
109
|
+
onChainChanged(chain) {
|
|
110
|
+
const chainId = normalizeChainId(chain)
|
|
111
|
+
config.emitter.emit('change', { chainId })
|
|
112
|
+
},
|
|
113
|
+
async onDisconnect(_error) {
|
|
114
|
+
config.emitter.emit('disconnect')
|
|
115
|
+
connected = false
|
|
116
|
+
},
|
|
117
|
+
async getProvider({ chainId } = {}) {
|
|
118
|
+
const chain =
|
|
119
|
+
config.chains.find((x) => x.id === chainId) ?? config.chains[0]
|
|
120
|
+
const url = chain.rpcUrls.default.http[0]!
|
|
121
|
+
|
|
122
|
+
const request: EIP1193RequestFn = async ({ method, params }) => {
|
|
123
|
+
// eth methods
|
|
124
|
+
if (method === 'eth_chainId') return numberToHex(connectedChainId)
|
|
125
|
+
if (method === 'eth_requestAccounts') return parameters.accounts
|
|
126
|
+
if (method === 'eth_signTypedData_v4')
|
|
127
|
+
if (features.signTypedDataError) {
|
|
128
|
+
if (typeof features.signTypedDataError === 'boolean')
|
|
129
|
+
throw new UserRejectedRequestError(
|
|
130
|
+
new Error('Failed to sign typed data.'),
|
|
131
|
+
)
|
|
132
|
+
throw features.signTypedDataError
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
// wallet methods
|
|
136
|
+
if (method === 'wallet_switchEthereumChain') {
|
|
137
|
+
if (features.switchChainError) {
|
|
138
|
+
if (typeof features.switchChainError === 'boolean')
|
|
139
|
+
throw new UserRejectedRequestError(
|
|
140
|
+
new Error('Failed to switch chain.'),
|
|
141
|
+
)
|
|
142
|
+
throw features.switchChainError
|
|
143
|
+
}
|
|
144
|
+
type Params = [{ chainId: Hex }]
|
|
145
|
+
connectedChainId = fromHex((params as Params)[0].chainId, 'number')
|
|
146
|
+
this.onChainChanged(connectedChainId.toString())
|
|
147
|
+
return
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
// other methods
|
|
151
|
+
if (method === 'personal_sign') {
|
|
152
|
+
if (features.signMessageError) {
|
|
153
|
+
if (typeof features.signMessageError === 'boolean')
|
|
154
|
+
throw new UserRejectedRequestError(
|
|
155
|
+
new Error('Failed to sign message.'),
|
|
156
|
+
)
|
|
157
|
+
throw features.signMessageError
|
|
158
|
+
}
|
|
159
|
+
// Change `personal_sign` to `eth_sign` and swap params
|
|
160
|
+
method = 'eth_sign'
|
|
161
|
+
type Params = [data: Hex, address: Address]
|
|
162
|
+
params = [(params as Params)[1], (params as Params)[0]]
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
const body = { method, params }
|
|
166
|
+
const { error, result } = await rpc.http(url, { body })
|
|
167
|
+
if (error) throw new RpcRequestError({ body, error, url })
|
|
168
|
+
|
|
169
|
+
return result
|
|
170
|
+
}
|
|
171
|
+
return custom({ request })({ retryCount: 0 })
|
|
172
|
+
},
|
|
173
|
+
}))
|
|
174
|
+
}
|
package/src/createConfig.ts
CHANGED
|
@@ -115,7 +115,6 @@ export function createConfig<
|
|
|
115
115
|
const chain = chains.find((x) => x.id === chainId)
|
|
116
116
|
|
|
117
117
|
// If the target chain is not configured, use the client of the current chain.
|
|
118
|
-
// TODO: should we error instead? idk. figure out later.
|
|
119
118
|
type Return = Client<Transport, Extract<chains[number], { id: chainId }>>
|
|
120
119
|
{
|
|
121
120
|
const client = clients.get(store.getState().chainId)
|
|
@@ -313,7 +312,7 @@ export function createConfig<
|
|
|
313
312
|
selector as unknown as (state: State) => any,
|
|
314
313
|
listener,
|
|
315
314
|
options
|
|
316
|
-
? { ...options, fireImmediately: options.
|
|
315
|
+
? { ...options, fireImmediately: options.emitImmediately }
|
|
317
316
|
: undefined,
|
|
318
317
|
)
|
|
319
318
|
},
|
|
@@ -359,7 +358,7 @@ export type Config<
|
|
|
359
358
|
listener: (state: state, previousState: state) => void,
|
|
360
359
|
options?:
|
|
361
360
|
| {
|
|
362
|
-
|
|
361
|
+
emitImmediately?: boolean | undefined
|
|
363
362
|
equalityFn?: ((a: state, b: state) => boolean) | undefined
|
|
364
363
|
}
|
|
365
364
|
| undefined,
|
package/src/exports/actions.ts
CHANGED
|
@@ -15,13 +15,6 @@ export {
|
|
|
15
15
|
disconnect,
|
|
16
16
|
} from '../actions/disconnect.js'
|
|
17
17
|
|
|
18
|
-
export {
|
|
19
|
-
type EstimateFeesPerGasError,
|
|
20
|
-
type EstimateFeesPerGasParameters,
|
|
21
|
-
type EstimateFeesPerGasReturnType,
|
|
22
|
-
estimateFeesPerGas,
|
|
23
|
-
} from '../actions/estimateFeesPerGas.js'
|
|
24
|
-
|
|
25
18
|
export {
|
|
26
19
|
type EstimateGasError,
|
|
27
20
|
type EstimateGasParameters,
|
|
@@ -29,6 +22,13 @@ export {
|
|
|
29
22
|
estimateGas,
|
|
30
23
|
} from '../actions/estimateGas.js'
|
|
31
24
|
|
|
25
|
+
export {
|
|
26
|
+
type EstimateFeesPerGasError,
|
|
27
|
+
type EstimateFeesPerGasParameters,
|
|
28
|
+
type EstimateFeesPerGasReturnType,
|
|
29
|
+
estimateFeesPerGas,
|
|
30
|
+
} from '../actions/estimateFeesPerGas.js'
|
|
31
|
+
|
|
32
32
|
export {
|
|
33
33
|
type GetAccountReturnType,
|
|
34
34
|
getAccount,
|
|
@@ -39,13 +39,24 @@ export {
|
|
|
39
39
|
type GetBalanceReturnType,
|
|
40
40
|
type GetBalanceError,
|
|
41
41
|
getBalance,
|
|
42
|
+
/** @deprecated use `getBalance` instead */
|
|
43
|
+
getBalance as fetchBalance,
|
|
42
44
|
} from '../actions/getBalance.js'
|
|
43
45
|
|
|
46
|
+
export {
|
|
47
|
+
type GetBlockError,
|
|
48
|
+
type GetBlockParameters,
|
|
49
|
+
type GetBlockReturnType,
|
|
50
|
+
getBlock,
|
|
51
|
+
} from '../actions/getBlock.js'
|
|
52
|
+
|
|
44
53
|
export {
|
|
45
54
|
type GetBlockNumberError,
|
|
46
55
|
type GetBlockNumberParameters,
|
|
47
56
|
type GetBlockNumberReturnType,
|
|
48
57
|
getBlockNumber,
|
|
58
|
+
/** @deprecated use `getBlockNumber` instead */
|
|
59
|
+
getBlockNumber as fetchBlockNumber,
|
|
49
60
|
} from '../actions/getBlockNumber.js'
|
|
50
61
|
|
|
51
62
|
export {
|
|
@@ -81,6 +92,8 @@ export {
|
|
|
81
92
|
type GetEnsAddressParameters,
|
|
82
93
|
type GetEnsAddressReturnType,
|
|
83
94
|
getEnsAddress,
|
|
95
|
+
/** @deprecated use `getEnsAddress` instead */
|
|
96
|
+
getEnsAddress as fetchEnsAddress,
|
|
84
97
|
} from '../actions/getEnsAddress.js'
|
|
85
98
|
|
|
86
99
|
export {
|
|
@@ -88,6 +101,8 @@ export {
|
|
|
88
101
|
type GetEnsAvatarParameters,
|
|
89
102
|
type GetEnsAvatarReturnType,
|
|
90
103
|
getEnsAvatar,
|
|
104
|
+
/** @deprecated use `getEnsAvatar` instead */
|
|
105
|
+
getEnsAvatar as fetchEnsAvatar,
|
|
91
106
|
} from '../actions/getEnsAvatar.js'
|
|
92
107
|
|
|
93
108
|
export {
|
|
@@ -95,6 +110,8 @@ export {
|
|
|
95
110
|
type GetEnsNameParameters,
|
|
96
111
|
type GetEnsNameReturnType,
|
|
97
112
|
getEnsName,
|
|
113
|
+
/** @deprecated */
|
|
114
|
+
getEnsName as fetchEnsName,
|
|
98
115
|
} from '../actions/getEnsName.js'
|
|
99
116
|
|
|
100
117
|
export {
|
|
@@ -102,6 +119,8 @@ export {
|
|
|
102
119
|
type GetEnsResolverParameters,
|
|
103
120
|
type GetEnsResolverReturnType,
|
|
104
121
|
getEnsResolver,
|
|
122
|
+
/** @deprecated use `getEnsResolver` instead */
|
|
123
|
+
getEnsResolver as fetchEnsResolver,
|
|
105
124
|
} from '../actions/getEnsResolver.js'
|
|
106
125
|
|
|
107
126
|
export {
|
|
@@ -115,6 +134,8 @@ export {
|
|
|
115
134
|
type GetTokenParameters,
|
|
116
135
|
type GetTokenReturnType,
|
|
117
136
|
getToken,
|
|
137
|
+
/** @deprecated use `getToken` instead */
|
|
138
|
+
getToken as fetchToken,
|
|
118
139
|
} from '../actions/getToken.js'
|
|
119
140
|
|
|
120
141
|
export {
|
|
@@ -122,6 +143,8 @@ export {
|
|
|
122
143
|
type GetTransactionParameters,
|
|
123
144
|
type GetTransactionReturnType,
|
|
124
145
|
getTransaction,
|
|
146
|
+
/** @deprecated use `getTransaction` instead */
|
|
147
|
+
getTransaction as fetchTransaction,
|
|
125
148
|
} from '../actions/getTransaction.js'
|
|
126
149
|
|
|
127
150
|
export {
|
|
@@ -198,6 +221,8 @@ export {
|
|
|
198
221
|
type SwitchChainParameters,
|
|
199
222
|
type SwitchChainReturnType,
|
|
200
223
|
switchChain,
|
|
224
|
+
/** @deprecated use `switchChain` instead */
|
|
225
|
+
switchChain as switchNetwork,
|
|
201
226
|
} from '../actions/switchChain.js'
|
|
202
227
|
|
|
203
228
|
export {
|
|
@@ -206,6 +231,12 @@ export {
|
|
|
206
231
|
watchAccount,
|
|
207
232
|
} from '../actions/watchAccount.js'
|
|
208
233
|
|
|
234
|
+
export {
|
|
235
|
+
type WatchBlocksParameters,
|
|
236
|
+
type WatchBlocksReturnType,
|
|
237
|
+
watchBlocks,
|
|
238
|
+
} from '../actions/watchBlocks.js'
|
|
239
|
+
|
|
209
240
|
export {
|
|
210
241
|
type WatchBlockNumberParameters,
|
|
211
242
|
type WatchBlockNumberReturnType,
|
|
@@ -259,6 +290,8 @@ export {
|
|
|
259
290
|
type WaitForTransactionReceiptParameters,
|
|
260
291
|
type WaitForTransactionReceiptReturnType,
|
|
261
292
|
waitForTransactionReceipt,
|
|
293
|
+
/** @deprecated use `waitForTransactionReceipt` instead */
|
|
294
|
+
waitForTransactionReceipt as waitForTransaction,
|
|
262
295
|
} from '../actions/waitForTransactionReceipt.js'
|
|
263
296
|
|
|
264
297
|
export {
|
package/src/exports/index.ts
CHANGED
|
@@ -50,6 +50,8 @@ export {
|
|
|
50
50
|
type GetBalanceReturnType,
|
|
51
51
|
type GetBalanceError,
|
|
52
52
|
getBalance,
|
|
53
|
+
/** @deprecated use `getBalance` instead */
|
|
54
|
+
getBalance as fetchBalance,
|
|
53
55
|
} from '../actions/getBalance.js'
|
|
54
56
|
|
|
55
57
|
export {
|
|
@@ -64,6 +66,8 @@ export {
|
|
|
64
66
|
type GetBlockNumberParameters,
|
|
65
67
|
type GetBlockNumberReturnType,
|
|
66
68
|
getBlockNumber,
|
|
69
|
+
/** @deprecated use `getBlockNumber` instead */
|
|
70
|
+
getBlockNumber as fetchBlockNumber,
|
|
67
71
|
} from '../actions/getBlockNumber.js'
|
|
68
72
|
|
|
69
73
|
export {
|
|
@@ -99,6 +103,8 @@ export {
|
|
|
99
103
|
type GetEnsAddressParameters,
|
|
100
104
|
type GetEnsAddressReturnType,
|
|
101
105
|
getEnsAddress,
|
|
106
|
+
/** @deprecated use `getEnsAddress` instead */
|
|
107
|
+
getEnsAddress as fetchEnsAddress,
|
|
102
108
|
} from '../actions/getEnsAddress.js'
|
|
103
109
|
|
|
104
110
|
export {
|
|
@@ -106,6 +112,8 @@ export {
|
|
|
106
112
|
type GetEnsAvatarParameters,
|
|
107
113
|
type GetEnsAvatarReturnType,
|
|
108
114
|
getEnsAvatar,
|
|
115
|
+
/** @deprecated use `getEnsAvatar` instead */
|
|
116
|
+
getEnsAvatar as fetchEnsAvatar,
|
|
109
117
|
} from '../actions/getEnsAvatar.js'
|
|
110
118
|
|
|
111
119
|
export {
|
|
@@ -113,6 +121,8 @@ export {
|
|
|
113
121
|
type GetEnsNameParameters,
|
|
114
122
|
type GetEnsNameReturnType,
|
|
115
123
|
getEnsName,
|
|
124
|
+
/** @deprecated */
|
|
125
|
+
getEnsName as fetchEnsName,
|
|
116
126
|
} from '../actions/getEnsName.js'
|
|
117
127
|
|
|
118
128
|
export {
|
|
@@ -120,6 +130,8 @@ export {
|
|
|
120
130
|
type GetEnsResolverParameters,
|
|
121
131
|
type GetEnsResolverReturnType,
|
|
122
132
|
getEnsResolver,
|
|
133
|
+
/** @deprecated use `getEnsResolver` instead */
|
|
134
|
+
getEnsResolver as fetchEnsResolver,
|
|
123
135
|
} from '../actions/getEnsResolver.js'
|
|
124
136
|
|
|
125
137
|
export {
|
|
@@ -133,6 +145,8 @@ export {
|
|
|
133
145
|
type GetTokenParameters,
|
|
134
146
|
type GetTokenReturnType,
|
|
135
147
|
getToken,
|
|
148
|
+
/** @deprecated use `getToken` instead */
|
|
149
|
+
getToken as fetchToken,
|
|
136
150
|
} from '../actions/getToken.js'
|
|
137
151
|
|
|
138
152
|
export {
|
|
@@ -140,6 +154,8 @@ export {
|
|
|
140
154
|
type GetTransactionParameters,
|
|
141
155
|
type GetTransactionReturnType,
|
|
142
156
|
getTransaction,
|
|
157
|
+
/** @deprecated use `getTransaction` instead */
|
|
158
|
+
getTransaction as fetchTransaction,
|
|
143
159
|
} from '../actions/getTransaction.js'
|
|
144
160
|
|
|
145
161
|
export {
|
|
@@ -216,6 +232,8 @@ export {
|
|
|
216
232
|
type SwitchChainParameters,
|
|
217
233
|
type SwitchChainReturnType,
|
|
218
234
|
switchChain,
|
|
235
|
+
/** @deprecated use `switchChain` instead */
|
|
236
|
+
switchChain as switchNetwork,
|
|
219
237
|
} from '../actions/switchChain.js'
|
|
220
238
|
|
|
221
239
|
export {
|
|
@@ -283,6 +301,8 @@ export {
|
|
|
283
301
|
type WaitForTransactionReceiptParameters,
|
|
284
302
|
type WaitForTransactionReceiptReturnType,
|
|
285
303
|
waitForTransactionReceipt,
|
|
304
|
+
/** @deprecated use `waitForTransactionReceipt` instead */
|
|
305
|
+
waitForTransactionReceipt as waitForTransaction,
|
|
286
306
|
} from '../actions/waitForTransactionReceipt.js'
|
|
287
307
|
|
|
288
308
|
export {
|
|
@@ -295,11 +315,6 @@ export {
|
|
|
295
315
|
////////////////////////////////////////////////////////////////////////////////
|
|
296
316
|
// connectors
|
|
297
317
|
|
|
298
|
-
export {
|
|
299
|
-
type InjectedParameters,
|
|
300
|
-
injected,
|
|
301
|
-
} from '../connectors/injected.js'
|
|
302
|
-
|
|
303
318
|
export {
|
|
304
319
|
type ConnectorEventMap,
|
|
305
320
|
type CreateConnectorFn,
|
|
@@ -356,6 +371,8 @@ export { type Register, type ResolvedRegister } from '../types/register.js'
|
|
|
356
371
|
////////////////////////////////////////////////////////////////////////////////
|
|
357
372
|
// Utilities
|
|
358
373
|
|
|
374
|
+
export { deepEqual } from '../utils/deepEqual.js'
|
|
375
|
+
|
|
359
376
|
export { deserialize } from '../utils/deserialize.js'
|
|
360
377
|
|
|
361
378
|
export { normalizeChainId } from '../utils/normalizeChainId.js'
|
package/src/exports/internal.ts
CHANGED
|
@@ -1,3 +1,16 @@
|
|
|
1
|
+
////////////////////////////////////////////////////////////////////////////////
|
|
2
|
+
// Connectors
|
|
3
|
+
|
|
4
|
+
export {
|
|
5
|
+
type InjectedParameters,
|
|
6
|
+
injected,
|
|
7
|
+
} from '../connectors/injected.js'
|
|
8
|
+
|
|
9
|
+
export {
|
|
10
|
+
type MockParameters,
|
|
11
|
+
mock,
|
|
12
|
+
} from '../connectors/mock.js'
|
|
13
|
+
|
|
1
14
|
////////////////////////////////////////////////////////////////////////////////
|
|
2
15
|
// Emitter
|
|
3
16
|
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '2.0.0-alpha.
|
|
1
|
+
export const version = '2.0.0-alpha.5'
|