wagmi 3.1.4 → 3.2.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/exports/tempo.js +9 -0
- package/dist/esm/exports/tempo.js.map +1 -0
- package/dist/esm/tempo/Hooks/amm.js +534 -0
- package/dist/esm/tempo/Hooks/amm.js.map +1 -0
- package/dist/esm/tempo/Hooks/dex.js +944 -0
- package/dist/esm/tempo/Hooks/dex.js.map +1 -0
- package/dist/esm/tempo/Hooks/faucet.js +76 -0
- package/dist/esm/tempo/Hooks/faucet.js.map +1 -0
- package/dist/esm/tempo/Hooks/fee.js +155 -0
- package/dist/esm/tempo/Hooks/fee.js.map +1 -0
- package/dist/esm/tempo/Hooks/index.js +11 -0
- package/dist/esm/tempo/Hooks/index.js.map +1 -0
- package/dist/esm/tempo/Hooks/nonce.js +165 -0
- package/dist/esm/tempo/Hooks/nonce.js.map +1 -0
- package/dist/esm/tempo/Hooks/policy.js +545 -0
- package/dist/esm/tempo/Hooks/policy.js.map +1 -0
- package/dist/esm/tempo/Hooks/reward.js +385 -0
- package/dist/esm/tempo/Hooks/reward.js.map +1 -0
- package/dist/esm/tempo/Hooks/token.js +1730 -0
- package/dist/esm/tempo/Hooks/token.js.map +1 -0
- package/dist/esm/tsconfig.build.tsbuildinfo +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/types/exports/tempo.d.ts +4 -0
- package/dist/types/exports/tempo.d.ts.map +1 -0
- package/dist/types/tempo/Hooks/amm.d.ts +410 -0
- package/dist/types/tempo/Hooks/amm.d.ts.map +1 -0
- package/dist/types/tempo/Hooks/dex.d.ts +773 -0
- package/dist/types/tempo/Hooks/dex.d.ts.map +1 -0
- package/dist/types/tempo/Hooks/faucet.d.ts +70 -0
- package/dist/types/tempo/Hooks/faucet.d.ts.map +1 -0
- package/dist/types/tempo/Hooks/fee.d.ts +123 -0
- package/dist/types/tempo/Hooks/fee.d.ts.map +1 -0
- package/dist/types/tempo/Hooks/index.d.ts +10 -0
- package/dist/types/tempo/Hooks/index.d.ts.map +1 -0
- package/dist/types/tempo/Hooks/nonce.d.ts +115 -0
- package/dist/types/tempo/Hooks/nonce.d.ts.map +1 -0
- package/dist/types/tempo/Hooks/policy.d.ts +422 -0
- package/dist/types/tempo/Hooks/policy.d.ts.map +1 -0
- package/dist/types/tempo/Hooks/reward.d.ts +304 -0
- package/dist/types/tempo/Hooks/reward.d.ts.map +1 -0
- package/dist/types/tempo/Hooks/token.d.ts +1387 -0
- package/dist/types/tempo/Hooks/token.d.ts.map +1 -0
- package/dist/types/version.d.ts +1 -1
- package/package.json +12 -4
- package/src/exports/tempo.ts +17 -0
- package/src/tempo/Hooks/amm.ts +835 -0
- package/src/tempo/Hooks/dex.ts +1597 -0
- package/src/tempo/Hooks/faucet.ts +142 -0
- package/src/tempo/Hooks/fee.ts +264 -0
- package/src/tempo/Hooks/index.ts +10 -0
- package/src/tempo/Hooks/nonce.ts +248 -0
- package/src/tempo/Hooks/policy.ts +907 -0
- package/src/tempo/Hooks/reward.ts +668 -0
- package/src/tempo/Hooks/token.ts +2979 -0
- package/src/version.ts +1 -1
- package/tempo/package.json +5 -0
|
@@ -0,0 +1,2979 @@
|
|
|
1
|
+
import type { UseMutationResult } from '@tanstack/react-query'
|
|
2
|
+
import type { Config, ResolvedRegister } from '@wagmi/core'
|
|
3
|
+
import type { ExactPartial, UnionCompute } from '@wagmi/core/internal'
|
|
4
|
+
import { Actions } from '@wagmi/core/tempo'
|
|
5
|
+
import { useEffect } from 'react'
|
|
6
|
+
|
|
7
|
+
import { useChainId } from '../../hooks/useChainId.js'
|
|
8
|
+
import { useConfig } from '../../hooks/useConfig.js'
|
|
9
|
+
import type { ConfigParameter, QueryParameter } from '../../types/properties.js'
|
|
10
|
+
import {
|
|
11
|
+
type UseMutationParameters,
|
|
12
|
+
type UseQueryReturnType,
|
|
13
|
+
useMutation,
|
|
14
|
+
useQuery,
|
|
15
|
+
} from '../../utils/query.js'
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Hook for approving a spender to transfer TIP20 tokens.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```tsx
|
|
22
|
+
* import { Hooks } from 'wagmi/tempo'
|
|
23
|
+
*
|
|
24
|
+
* function App() {
|
|
25
|
+
* const { mutate, isPending } = Hooks.token.useApprove()
|
|
26
|
+
*
|
|
27
|
+
* return (
|
|
28
|
+
* <button
|
|
29
|
+
* onClick={() => mutate({ spender: '0x...', amount: 100n })}
|
|
30
|
+
* disabled={isPending}
|
|
31
|
+
* >
|
|
32
|
+
* Approve
|
|
33
|
+
* </button>
|
|
34
|
+
* )
|
|
35
|
+
* }
|
|
36
|
+
* ```
|
|
37
|
+
*
|
|
38
|
+
* @param parameters - Parameters.
|
|
39
|
+
* @returns Mutation result.
|
|
40
|
+
*/
|
|
41
|
+
export function useApprove<
|
|
42
|
+
config extends Config = ResolvedRegister['config'],
|
|
43
|
+
context = unknown,
|
|
44
|
+
>(
|
|
45
|
+
parameters: useApprove.Parameters<config, context> = {},
|
|
46
|
+
): useApprove.ReturnType<config, context> {
|
|
47
|
+
const { mutation } = parameters
|
|
48
|
+
const config = useConfig(parameters)
|
|
49
|
+
return useMutation({
|
|
50
|
+
...mutation,
|
|
51
|
+
async mutationFn(variables) {
|
|
52
|
+
return Actions.token.approve(config, variables as never)
|
|
53
|
+
},
|
|
54
|
+
mutationKey: ['approve'],
|
|
55
|
+
}) as never
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export declare namespace useApprove {
|
|
59
|
+
type Parameters<
|
|
60
|
+
config extends Config = Config,
|
|
61
|
+
context = unknown,
|
|
62
|
+
> = ConfigParameter<config> & {
|
|
63
|
+
mutation?:
|
|
64
|
+
| UseMutationParameters<
|
|
65
|
+
Actions.token.approve.ReturnValue,
|
|
66
|
+
Actions.token.approve.ErrorType,
|
|
67
|
+
Actions.token.approve.Parameters<config>,
|
|
68
|
+
context
|
|
69
|
+
>
|
|
70
|
+
| undefined
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
type ReturnType<
|
|
74
|
+
config extends Config = Config,
|
|
75
|
+
context = unknown,
|
|
76
|
+
> = UseMutationResult<
|
|
77
|
+
Actions.token.approve.ReturnValue,
|
|
78
|
+
Actions.token.approve.ErrorType,
|
|
79
|
+
Actions.token.approve.Parameters<config>,
|
|
80
|
+
context
|
|
81
|
+
>
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Hook for approving a spender to transfer TIP20 tokens.
|
|
86
|
+
*
|
|
87
|
+
* Note: This is a synchronous hook that waits for the transaction
|
|
88
|
+
* to be included on a block before returning a response.
|
|
89
|
+
*
|
|
90
|
+
* @example
|
|
91
|
+
* ```tsx
|
|
92
|
+
* import { Hooks } from 'wagmi/tempo'
|
|
93
|
+
*
|
|
94
|
+
* function App() {
|
|
95
|
+
* const { mutate, isPending } = Hooks.token.useApproveSync()
|
|
96
|
+
*
|
|
97
|
+
* return (
|
|
98
|
+
* <button
|
|
99
|
+
* onClick={() => mutate({ spender: '0x...', amount: 100n })}
|
|
100
|
+
* disabled={isPending}
|
|
101
|
+
* >
|
|
102
|
+
* Approve
|
|
103
|
+
* </button>
|
|
104
|
+
* )
|
|
105
|
+
* }
|
|
106
|
+
* ```
|
|
107
|
+
*
|
|
108
|
+
* @param parameters - Parameters.
|
|
109
|
+
* @returns Mutation result.
|
|
110
|
+
*/
|
|
111
|
+
export function useApproveSync<
|
|
112
|
+
config extends Config = ResolvedRegister['config'],
|
|
113
|
+
context = unknown,
|
|
114
|
+
>(
|
|
115
|
+
parameters: useApproveSync.Parameters<config, context> = {},
|
|
116
|
+
): useApproveSync.ReturnType<config, context> {
|
|
117
|
+
const { mutation } = parameters
|
|
118
|
+
const config = useConfig(parameters)
|
|
119
|
+
return useMutation({
|
|
120
|
+
...mutation,
|
|
121
|
+
async mutationFn(variables) {
|
|
122
|
+
return Actions.token.approveSync(config, variables as never)
|
|
123
|
+
},
|
|
124
|
+
mutationKey: ['approveSync'],
|
|
125
|
+
}) as never
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export declare namespace useApproveSync {
|
|
129
|
+
type Parameters<
|
|
130
|
+
config extends Config = Config,
|
|
131
|
+
context = unknown,
|
|
132
|
+
> = ConfigParameter<config> & {
|
|
133
|
+
mutation?:
|
|
134
|
+
| UseMutationParameters<
|
|
135
|
+
Actions.token.approveSync.ReturnValue,
|
|
136
|
+
Actions.token.approveSync.ErrorType,
|
|
137
|
+
Actions.token.approveSync.Parameters<config>,
|
|
138
|
+
context
|
|
139
|
+
>
|
|
140
|
+
| undefined
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
type ReturnType<
|
|
144
|
+
config extends Config = Config,
|
|
145
|
+
context = unknown,
|
|
146
|
+
> = UseMutationResult<
|
|
147
|
+
Actions.token.approveSync.ReturnValue,
|
|
148
|
+
Actions.token.approveSync.ErrorType,
|
|
149
|
+
Actions.token.approveSync.Parameters<config>,
|
|
150
|
+
context
|
|
151
|
+
>
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Hook for burning TIP20 tokens from the caller's balance.
|
|
156
|
+
*
|
|
157
|
+
* @example
|
|
158
|
+
* ```tsx
|
|
159
|
+
* import { Hooks } from 'wagmi/tempo'
|
|
160
|
+
*
|
|
161
|
+
* function App() {
|
|
162
|
+
* const { mutate, isPending } = Hooks.token.useBurn()
|
|
163
|
+
*
|
|
164
|
+
* return (
|
|
165
|
+
* <button
|
|
166
|
+
* onClick={() => mutate({ amount: 100n, token: '0x...' })}
|
|
167
|
+
* disabled={isPending}
|
|
168
|
+
* >
|
|
169
|
+
* Burn
|
|
170
|
+
* </button>
|
|
171
|
+
* )
|
|
172
|
+
* }
|
|
173
|
+
* ```
|
|
174
|
+
*
|
|
175
|
+
* @param parameters - Parameters.
|
|
176
|
+
* @returns Mutation result.
|
|
177
|
+
*/
|
|
178
|
+
export function useBurn<
|
|
179
|
+
config extends Config = ResolvedRegister['config'],
|
|
180
|
+
context = unknown,
|
|
181
|
+
>(
|
|
182
|
+
parameters: useBurn.Parameters<config, context> = {},
|
|
183
|
+
): useBurn.ReturnType<config, context> {
|
|
184
|
+
const { mutation } = parameters
|
|
185
|
+
const config = useConfig(parameters)
|
|
186
|
+
return useMutation({
|
|
187
|
+
...mutation,
|
|
188
|
+
async mutationFn(variables) {
|
|
189
|
+
return Actions.token.burn(config, variables as never)
|
|
190
|
+
},
|
|
191
|
+
mutationKey: ['burn'],
|
|
192
|
+
}) as never
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
export declare namespace useBurn {
|
|
196
|
+
type Parameters<
|
|
197
|
+
config extends Config = Config,
|
|
198
|
+
context = unknown,
|
|
199
|
+
> = ConfigParameter<config> & {
|
|
200
|
+
mutation?:
|
|
201
|
+
| UseMutationParameters<
|
|
202
|
+
Actions.token.burn.ReturnValue,
|
|
203
|
+
Actions.token.burn.ErrorType,
|
|
204
|
+
Actions.token.burn.Parameters<config>,
|
|
205
|
+
context
|
|
206
|
+
>
|
|
207
|
+
| undefined
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
type ReturnType<
|
|
211
|
+
config extends Config = Config,
|
|
212
|
+
context = unknown,
|
|
213
|
+
> = UseMutationResult<
|
|
214
|
+
Actions.token.burn.ReturnValue,
|
|
215
|
+
Actions.token.burn.ErrorType,
|
|
216
|
+
Actions.token.burn.Parameters<config>,
|
|
217
|
+
context
|
|
218
|
+
>
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* Hook for burning TIP20 tokens from the caller's balance.
|
|
223
|
+
*
|
|
224
|
+
* Note: This is a synchronous hook that waits for the transaction
|
|
225
|
+
* to be included on a block before returning a response.
|
|
226
|
+
*
|
|
227
|
+
* @example
|
|
228
|
+
* ```tsx
|
|
229
|
+
* import { Hooks } from 'wagmi/tempo'
|
|
230
|
+
*
|
|
231
|
+
* function App() {
|
|
232
|
+
* const { mutate, isPending } = Hooks.token.useBurnSync()
|
|
233
|
+
*
|
|
234
|
+
* return (
|
|
235
|
+
* <button
|
|
236
|
+
* onClick={() => mutate({ amount: 100n, token: '0x...' })}
|
|
237
|
+
* disabled={isPending}
|
|
238
|
+
* >
|
|
239
|
+
* Burn
|
|
240
|
+
* </button>
|
|
241
|
+
* )
|
|
242
|
+
* }
|
|
243
|
+
* ```
|
|
244
|
+
*
|
|
245
|
+
* @param parameters - Parameters.
|
|
246
|
+
* @returns Mutation result.
|
|
247
|
+
*/
|
|
248
|
+
export function useBurnSync<
|
|
249
|
+
config extends Config = ResolvedRegister['config'],
|
|
250
|
+
context = unknown,
|
|
251
|
+
>(
|
|
252
|
+
parameters: useBurnSync.Parameters<config, context> = {},
|
|
253
|
+
): useBurnSync.ReturnType<config, context> {
|
|
254
|
+
const { mutation } = parameters
|
|
255
|
+
const config = useConfig(parameters)
|
|
256
|
+
return useMutation({
|
|
257
|
+
...mutation,
|
|
258
|
+
async mutationFn(variables) {
|
|
259
|
+
return Actions.token.burnSync(config, variables as never)
|
|
260
|
+
},
|
|
261
|
+
mutationKey: ['burnSync'],
|
|
262
|
+
}) as never
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
export declare namespace useBurnSync {
|
|
266
|
+
type Parameters<
|
|
267
|
+
config extends Config = Config,
|
|
268
|
+
context = unknown,
|
|
269
|
+
> = ConfigParameter<config> & {
|
|
270
|
+
mutation?:
|
|
271
|
+
| UseMutationParameters<
|
|
272
|
+
Actions.token.burnSync.ReturnValue,
|
|
273
|
+
Actions.token.burnSync.ErrorType,
|
|
274
|
+
Actions.token.burnSync.Parameters<config>,
|
|
275
|
+
context
|
|
276
|
+
>
|
|
277
|
+
| undefined
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
type ReturnType<
|
|
281
|
+
config extends Config = Config,
|
|
282
|
+
context = unknown,
|
|
283
|
+
> = UseMutationResult<
|
|
284
|
+
Actions.token.burnSync.ReturnValue,
|
|
285
|
+
Actions.token.burnSync.ErrorType,
|
|
286
|
+
Actions.token.burnSync.Parameters<config>,
|
|
287
|
+
context
|
|
288
|
+
>
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
/**
|
|
292
|
+
* Hook for burning TIP20 tokens from a blocked address.
|
|
293
|
+
*
|
|
294
|
+
* @example
|
|
295
|
+
* ```tsx
|
|
296
|
+
* import { Hooks } from 'wagmi/tempo'
|
|
297
|
+
*
|
|
298
|
+
* function App() {
|
|
299
|
+
* const { mutate, isPending } = Hooks.token.useBurnBlocked()
|
|
300
|
+
*
|
|
301
|
+
* return (
|
|
302
|
+
* <button
|
|
303
|
+
* onClick={() => mutate({ from: '0x...', amount: 100n, token: '0x...' })}
|
|
304
|
+
* disabled={isPending}
|
|
305
|
+
* >
|
|
306
|
+
* Burn Blocked
|
|
307
|
+
* </button>
|
|
308
|
+
* )
|
|
309
|
+
* }
|
|
310
|
+
* ```
|
|
311
|
+
*
|
|
312
|
+
* @param parameters - Parameters.
|
|
313
|
+
* @returns Mutation result.
|
|
314
|
+
*/
|
|
315
|
+
export function useBurnBlocked<
|
|
316
|
+
config extends Config = ResolvedRegister['config'],
|
|
317
|
+
context = unknown,
|
|
318
|
+
>(
|
|
319
|
+
parameters: useBurnBlocked.Parameters<config, context> = {},
|
|
320
|
+
): useBurnBlocked.ReturnType<config, context> {
|
|
321
|
+
const { mutation } = parameters
|
|
322
|
+
const config = useConfig(parameters)
|
|
323
|
+
return useMutation({
|
|
324
|
+
...mutation,
|
|
325
|
+
async mutationFn(variables) {
|
|
326
|
+
return Actions.token.burnBlocked(config, variables as never)
|
|
327
|
+
},
|
|
328
|
+
mutationKey: ['burnBlocked'],
|
|
329
|
+
}) as never
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
export declare namespace useBurnBlocked {
|
|
333
|
+
type Parameters<
|
|
334
|
+
config extends Config = Config,
|
|
335
|
+
context = unknown,
|
|
336
|
+
> = ConfigParameter<config> & {
|
|
337
|
+
mutation?:
|
|
338
|
+
| UseMutationParameters<
|
|
339
|
+
Actions.token.burnBlocked.ReturnValue,
|
|
340
|
+
Actions.token.burnBlocked.ErrorType,
|
|
341
|
+
Actions.token.burnBlocked.Parameters<config>,
|
|
342
|
+
context
|
|
343
|
+
>
|
|
344
|
+
| undefined
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
type ReturnType<
|
|
348
|
+
config extends Config = Config,
|
|
349
|
+
context = unknown,
|
|
350
|
+
> = UseMutationResult<
|
|
351
|
+
Actions.token.burnBlocked.ReturnValue,
|
|
352
|
+
Actions.token.burnBlocked.ErrorType,
|
|
353
|
+
Actions.token.burnBlocked.Parameters<config>,
|
|
354
|
+
context
|
|
355
|
+
>
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
/**
|
|
359
|
+
* Hook for burning TIP20 tokens from a blocked address.
|
|
360
|
+
*
|
|
361
|
+
* Note: This is a synchronous hook that waits for the transaction
|
|
362
|
+
* to be included on a block before returning a response.
|
|
363
|
+
*
|
|
364
|
+
* @example
|
|
365
|
+
* ```tsx
|
|
366
|
+
* import { Hooks } from 'wagmi/tempo'
|
|
367
|
+
*
|
|
368
|
+
* function App() {
|
|
369
|
+
* const { mutate, isPending } = Hooks.token.useBurnBlockedSync()
|
|
370
|
+
*
|
|
371
|
+
* return (
|
|
372
|
+
* <button
|
|
373
|
+
* onClick={() => mutate({ from: '0x...', amount: 100n, token: '0x...' })}
|
|
374
|
+
* disabled={isPending}
|
|
375
|
+
* >
|
|
376
|
+
* Burn Blocked
|
|
377
|
+
* </button>
|
|
378
|
+
* )
|
|
379
|
+
* }
|
|
380
|
+
* ```
|
|
381
|
+
*
|
|
382
|
+
* @param parameters - Parameters.
|
|
383
|
+
* @returns Mutation result.
|
|
384
|
+
*/
|
|
385
|
+
export function useBurnBlockedSync<
|
|
386
|
+
config extends Config = ResolvedRegister['config'],
|
|
387
|
+
context = unknown,
|
|
388
|
+
>(
|
|
389
|
+
parameters: useBurnBlockedSync.Parameters<config, context> = {},
|
|
390
|
+
): useBurnBlockedSync.ReturnType<config, context> {
|
|
391
|
+
const { mutation } = parameters
|
|
392
|
+
const config = useConfig(parameters)
|
|
393
|
+
return useMutation({
|
|
394
|
+
...mutation,
|
|
395
|
+
async mutationFn(variables) {
|
|
396
|
+
return Actions.token.burnBlockedSync(config, variables as never)
|
|
397
|
+
},
|
|
398
|
+
mutationKey: ['burnBlockedSync'],
|
|
399
|
+
}) as never
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
export declare namespace useBurnBlockedSync {
|
|
403
|
+
type Parameters<
|
|
404
|
+
config extends Config = Config,
|
|
405
|
+
context = unknown,
|
|
406
|
+
> = ConfigParameter<config> & {
|
|
407
|
+
mutation?:
|
|
408
|
+
| UseMutationParameters<
|
|
409
|
+
Actions.token.burnBlockedSync.ReturnValue,
|
|
410
|
+
Actions.token.burnBlockedSync.ErrorType,
|
|
411
|
+
Actions.token.burnBlockedSync.Parameters<config>,
|
|
412
|
+
context
|
|
413
|
+
>
|
|
414
|
+
| undefined
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
type ReturnType<
|
|
418
|
+
config extends Config = Config,
|
|
419
|
+
context = unknown,
|
|
420
|
+
> = UseMutationResult<
|
|
421
|
+
Actions.token.burnBlockedSync.ReturnValue,
|
|
422
|
+
Actions.token.burnBlockedSync.ErrorType,
|
|
423
|
+
Actions.token.burnBlockedSync.Parameters<config>,
|
|
424
|
+
context
|
|
425
|
+
>
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
/**
|
|
429
|
+
* Hook for changing the transfer policy ID for a TIP20 token.
|
|
430
|
+
*
|
|
431
|
+
* @example
|
|
432
|
+
* ```tsx
|
|
433
|
+
* import { Hooks } from 'wagmi/tempo'
|
|
434
|
+
*
|
|
435
|
+
* function App() {
|
|
436
|
+
* const { mutate, isPending } = Hooks.token.useChangeTransferPolicy()
|
|
437
|
+
*
|
|
438
|
+
* return (
|
|
439
|
+
* <button
|
|
440
|
+
* onClick={() => mutate({ token: '0x...', policyId: 1n })}
|
|
441
|
+
* disabled={isPending}
|
|
442
|
+
* >
|
|
443
|
+
* Change Policy
|
|
444
|
+
* </button>
|
|
445
|
+
* )
|
|
446
|
+
* }
|
|
447
|
+
* ```
|
|
448
|
+
*
|
|
449
|
+
* @param parameters - Parameters.
|
|
450
|
+
* @returns Mutation result.
|
|
451
|
+
*/
|
|
452
|
+
export function useChangeTransferPolicy<
|
|
453
|
+
config extends Config = ResolvedRegister['config'],
|
|
454
|
+
context = unknown,
|
|
455
|
+
>(
|
|
456
|
+
parameters: useChangeTransferPolicy.Parameters<config, context> = {},
|
|
457
|
+
): useChangeTransferPolicy.ReturnType<config, context> {
|
|
458
|
+
const { mutation } = parameters
|
|
459
|
+
const config = useConfig(parameters)
|
|
460
|
+
return useMutation({
|
|
461
|
+
...mutation,
|
|
462
|
+
async mutationFn(variables) {
|
|
463
|
+
return Actions.token.changeTransferPolicy(config, variables as never)
|
|
464
|
+
},
|
|
465
|
+
mutationKey: ['changeTransferPolicy'],
|
|
466
|
+
}) as never
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
export declare namespace useChangeTransferPolicy {
|
|
470
|
+
type Parameters<
|
|
471
|
+
config extends Config = Config,
|
|
472
|
+
context = unknown,
|
|
473
|
+
> = ConfigParameter<config> & {
|
|
474
|
+
mutation?:
|
|
475
|
+
| UseMutationParameters<
|
|
476
|
+
Actions.token.changeTransferPolicy.ReturnValue,
|
|
477
|
+
Actions.token.changeTransferPolicy.ErrorType,
|
|
478
|
+
Actions.token.changeTransferPolicy.Parameters<config>,
|
|
479
|
+
context
|
|
480
|
+
>
|
|
481
|
+
| undefined
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
type ReturnType<
|
|
485
|
+
config extends Config = Config,
|
|
486
|
+
context = unknown,
|
|
487
|
+
> = UseMutationResult<
|
|
488
|
+
Actions.token.changeTransferPolicy.ReturnValue,
|
|
489
|
+
Actions.token.changeTransferPolicy.ErrorType,
|
|
490
|
+
Actions.token.changeTransferPolicy.Parameters<config>,
|
|
491
|
+
context
|
|
492
|
+
>
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
/**
|
|
496
|
+
* Hook for changing the transfer policy ID for a TIP20 token.
|
|
497
|
+
*
|
|
498
|
+
* Note: This is a synchronous hook that waits for the transaction
|
|
499
|
+
* to be included on a block before returning a response.
|
|
500
|
+
*
|
|
501
|
+
* @example
|
|
502
|
+
* ```tsx
|
|
503
|
+
* import { Hooks } from 'wagmi/tempo'
|
|
504
|
+
*
|
|
505
|
+
* function App() {
|
|
506
|
+
* const { mutate, isPending } = Hooks.token.useChangeTransferPolicySync()
|
|
507
|
+
*
|
|
508
|
+
* return (
|
|
509
|
+
* <button
|
|
510
|
+
* onClick={() => mutate({ token: '0x...', policyId: 1n })}
|
|
511
|
+
* disabled={isPending}
|
|
512
|
+
* >
|
|
513
|
+
* Change Policy
|
|
514
|
+
* </button>
|
|
515
|
+
* )
|
|
516
|
+
* }
|
|
517
|
+
* ```
|
|
518
|
+
*
|
|
519
|
+
* @param parameters - Parameters.
|
|
520
|
+
* @returns Mutation result.
|
|
521
|
+
*/
|
|
522
|
+
export function useChangeTransferPolicySync<
|
|
523
|
+
config extends Config = ResolvedRegister['config'],
|
|
524
|
+
context = unknown,
|
|
525
|
+
>(
|
|
526
|
+
parameters: useChangeTransferPolicySync.Parameters<config, context> = {},
|
|
527
|
+
): useChangeTransferPolicySync.ReturnType<config, context> {
|
|
528
|
+
const { mutation } = parameters
|
|
529
|
+
const config = useConfig(parameters)
|
|
530
|
+
return useMutation({
|
|
531
|
+
...mutation,
|
|
532
|
+
async mutationFn(variables) {
|
|
533
|
+
return Actions.token.changeTransferPolicySync(config, variables as never)
|
|
534
|
+
},
|
|
535
|
+
mutationKey: ['changeTransferPolicySync'],
|
|
536
|
+
}) as never
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
export declare namespace useChangeTransferPolicySync {
|
|
540
|
+
type Parameters<
|
|
541
|
+
config extends Config = Config,
|
|
542
|
+
context = unknown,
|
|
543
|
+
> = ConfigParameter<config> & {
|
|
544
|
+
mutation?:
|
|
545
|
+
| UseMutationParameters<
|
|
546
|
+
Actions.token.changeTransferPolicySync.ReturnValue,
|
|
547
|
+
Actions.token.changeTransferPolicySync.ErrorType,
|
|
548
|
+
Actions.token.changeTransferPolicySync.Parameters<config>,
|
|
549
|
+
context
|
|
550
|
+
>
|
|
551
|
+
| undefined
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
type ReturnType<
|
|
555
|
+
config extends Config = Config,
|
|
556
|
+
context = unknown,
|
|
557
|
+
> = UseMutationResult<
|
|
558
|
+
Actions.token.changeTransferPolicySync.ReturnValue,
|
|
559
|
+
Actions.token.changeTransferPolicySync.ErrorType,
|
|
560
|
+
Actions.token.changeTransferPolicySync.Parameters<config>,
|
|
561
|
+
context
|
|
562
|
+
>
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
/**
|
|
566
|
+
* Hook for creating a new TIP20 token.
|
|
567
|
+
*
|
|
568
|
+
* @example
|
|
569
|
+
* ```tsx
|
|
570
|
+
* import { Hooks } from 'wagmi/tempo'
|
|
571
|
+
*
|
|
572
|
+
* function App() {
|
|
573
|
+
* const { mutate, isPending } = Hooks.token.useCreate()
|
|
574
|
+
*
|
|
575
|
+
* return (
|
|
576
|
+
* <button
|
|
577
|
+
* onClick={() => mutate({ name: 'My Token', symbol: 'MTK', currency: 'USD' })}
|
|
578
|
+
* disabled={isPending}
|
|
579
|
+
* >
|
|
580
|
+
* Create Token
|
|
581
|
+
* </button>
|
|
582
|
+
* )
|
|
583
|
+
* }
|
|
584
|
+
* ```
|
|
585
|
+
*
|
|
586
|
+
* @param parameters - Parameters.
|
|
587
|
+
* @returns Mutation result.
|
|
588
|
+
*/
|
|
589
|
+
export function useCreate<
|
|
590
|
+
config extends Config = ResolvedRegister['config'],
|
|
591
|
+
context = unknown,
|
|
592
|
+
>(
|
|
593
|
+
parameters: useCreate.Parameters<config, context> = {},
|
|
594
|
+
): useCreate.ReturnType<config, context> {
|
|
595
|
+
const { mutation } = parameters
|
|
596
|
+
const config = useConfig(parameters)
|
|
597
|
+
return useMutation({
|
|
598
|
+
...mutation,
|
|
599
|
+
async mutationFn(variables) {
|
|
600
|
+
return Actions.token.create(config, variables as never)
|
|
601
|
+
},
|
|
602
|
+
mutationKey: ['create'],
|
|
603
|
+
}) as never
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
export declare namespace useCreate {
|
|
607
|
+
type Parameters<
|
|
608
|
+
config extends Config = Config,
|
|
609
|
+
context = unknown,
|
|
610
|
+
> = ConfigParameter<config> & {
|
|
611
|
+
mutation?:
|
|
612
|
+
| UseMutationParameters<
|
|
613
|
+
Actions.token.create.ReturnValue,
|
|
614
|
+
Actions.token.create.ErrorType,
|
|
615
|
+
Actions.token.create.Parameters<config>,
|
|
616
|
+
context
|
|
617
|
+
>
|
|
618
|
+
| undefined
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
type ReturnType<
|
|
622
|
+
config extends Config = Config,
|
|
623
|
+
context = unknown,
|
|
624
|
+
> = UseMutationResult<
|
|
625
|
+
Actions.token.create.ReturnValue,
|
|
626
|
+
Actions.token.create.ErrorType,
|
|
627
|
+
Actions.token.create.Parameters<config>,
|
|
628
|
+
context
|
|
629
|
+
>
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
/**
|
|
633
|
+
* Hook for creating a new TIP20 token.
|
|
634
|
+
*
|
|
635
|
+
* Note: This is a synchronous hook that waits for the transaction
|
|
636
|
+
* to be included on a block before returning a response.
|
|
637
|
+
*
|
|
638
|
+
* @example
|
|
639
|
+
* ```tsx
|
|
640
|
+
* import { Hooks } from 'wagmi/tempo'
|
|
641
|
+
*
|
|
642
|
+
* function App() {
|
|
643
|
+
* const { mutate, isPending } = Hooks.token.useCreateSync()
|
|
644
|
+
*
|
|
645
|
+
* return (
|
|
646
|
+
* <button
|
|
647
|
+
* onClick={() => mutate({ name: 'My Token', symbol: 'MTK', currency: 'USD' })}
|
|
648
|
+
* disabled={isPending}
|
|
649
|
+
* >
|
|
650
|
+
* Create Token
|
|
651
|
+
* </button>
|
|
652
|
+
* )
|
|
653
|
+
* }
|
|
654
|
+
* ```
|
|
655
|
+
*
|
|
656
|
+
* @param parameters - Parameters.
|
|
657
|
+
* @returns Mutation result.
|
|
658
|
+
*/
|
|
659
|
+
export function useCreateSync<
|
|
660
|
+
config extends Config = ResolvedRegister['config'],
|
|
661
|
+
context = unknown,
|
|
662
|
+
>(
|
|
663
|
+
parameters: useCreateSync.Parameters<config, context> = {},
|
|
664
|
+
): useCreateSync.ReturnType<config, context> {
|
|
665
|
+
const { mutation } = parameters
|
|
666
|
+
const config = useConfig(parameters)
|
|
667
|
+
return useMutation({
|
|
668
|
+
...mutation,
|
|
669
|
+
async mutationFn(variables) {
|
|
670
|
+
return Actions.token.createSync(config, variables as never)
|
|
671
|
+
},
|
|
672
|
+
mutationKey: ['createSync'],
|
|
673
|
+
}) as never
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
export declare namespace useCreateSync {
|
|
677
|
+
type Parameters<
|
|
678
|
+
config extends Config = Config,
|
|
679
|
+
context = unknown,
|
|
680
|
+
> = ConfigParameter<config> & {
|
|
681
|
+
mutation?:
|
|
682
|
+
| UseMutationParameters<
|
|
683
|
+
Actions.token.createSync.ReturnValue,
|
|
684
|
+
Actions.token.createSync.ErrorType,
|
|
685
|
+
Actions.token.createSync.Parameters<config>,
|
|
686
|
+
context
|
|
687
|
+
>
|
|
688
|
+
| undefined
|
|
689
|
+
}
|
|
690
|
+
|
|
691
|
+
type ReturnType<
|
|
692
|
+
config extends Config = Config,
|
|
693
|
+
context = unknown,
|
|
694
|
+
> = UseMutationResult<
|
|
695
|
+
Actions.token.createSync.ReturnValue,
|
|
696
|
+
Actions.token.createSync.ErrorType,
|
|
697
|
+
Actions.token.createSync.Parameters<config>,
|
|
698
|
+
context
|
|
699
|
+
>
|
|
700
|
+
}
|
|
701
|
+
|
|
702
|
+
/**
|
|
703
|
+
* Hook for updating the quote token for a TIP20 token.
|
|
704
|
+
*
|
|
705
|
+
* @example
|
|
706
|
+
* ```tsx
|
|
707
|
+
* import { Hooks } from 'wagmi/tempo'
|
|
708
|
+
*
|
|
709
|
+
* function App() {
|
|
710
|
+
* const { mutate, isPending } = Hooks.token.useUpdateQuoteToken()
|
|
711
|
+
*
|
|
712
|
+
* return (
|
|
713
|
+
* <button
|
|
714
|
+
* onClick={() => mutate({ token: '0x...' })}
|
|
715
|
+
* disabled={isPending}
|
|
716
|
+
* >
|
|
717
|
+
* Update Quote Token
|
|
718
|
+
* </button>
|
|
719
|
+
* )
|
|
720
|
+
* }
|
|
721
|
+
* ```
|
|
722
|
+
*
|
|
723
|
+
* @param parameters - Parameters.
|
|
724
|
+
* @returns Mutation result.
|
|
725
|
+
*/
|
|
726
|
+
export function useUpdateQuoteToken<
|
|
727
|
+
config extends Config = ResolvedRegister['config'],
|
|
728
|
+
context = unknown,
|
|
729
|
+
>(
|
|
730
|
+
parameters: useUpdateQuoteToken.Parameters<config, context> = {},
|
|
731
|
+
): useUpdateQuoteToken.ReturnType<config, context> {
|
|
732
|
+
const { mutation } = parameters
|
|
733
|
+
const config = useConfig(parameters)
|
|
734
|
+
return useMutation({
|
|
735
|
+
...mutation,
|
|
736
|
+
async mutationFn(variables) {
|
|
737
|
+
return Actions.token.updateQuoteToken(config, variables as never)
|
|
738
|
+
},
|
|
739
|
+
mutationKey: ['updateQuoteToken'],
|
|
740
|
+
}) as never
|
|
741
|
+
}
|
|
742
|
+
|
|
743
|
+
export declare namespace useUpdateQuoteToken {
|
|
744
|
+
type Parameters<
|
|
745
|
+
config extends Config = Config,
|
|
746
|
+
context = unknown,
|
|
747
|
+
> = ConfigParameter<config> & {
|
|
748
|
+
mutation?:
|
|
749
|
+
| UseMutationParameters<
|
|
750
|
+
Actions.token.updateQuoteToken.ReturnValue,
|
|
751
|
+
Actions.token.updateQuoteToken.ErrorType,
|
|
752
|
+
Actions.token.updateQuoteToken.Parameters<config>,
|
|
753
|
+
context
|
|
754
|
+
>
|
|
755
|
+
| undefined
|
|
756
|
+
}
|
|
757
|
+
|
|
758
|
+
type ReturnType<
|
|
759
|
+
config extends Config = Config,
|
|
760
|
+
context = unknown,
|
|
761
|
+
> = UseMutationResult<
|
|
762
|
+
Actions.token.updateQuoteToken.ReturnValue,
|
|
763
|
+
Actions.token.updateQuoteToken.ErrorType,
|
|
764
|
+
Actions.token.updateQuoteToken.Parameters<config>,
|
|
765
|
+
context
|
|
766
|
+
>
|
|
767
|
+
}
|
|
768
|
+
|
|
769
|
+
/**
|
|
770
|
+
* Hook for updating the quote token for a TIP20 token.
|
|
771
|
+
*
|
|
772
|
+
* Note: This is a synchronous hook that waits for the transaction
|
|
773
|
+
* to be included on a block before returning a response.
|
|
774
|
+
*
|
|
775
|
+
* @example
|
|
776
|
+
* ```tsx
|
|
777
|
+
* import { Hooks } from 'wagmi/tempo'
|
|
778
|
+
*
|
|
779
|
+
* function App() {
|
|
780
|
+
* const { mutate, isPending } = Hooks.token.useUpdateQuoteTokenSync()
|
|
781
|
+
*
|
|
782
|
+
* return (
|
|
783
|
+
* <button
|
|
784
|
+
* onClick={() => mutate({ token: '0x...' })}
|
|
785
|
+
* disabled={isPending}
|
|
786
|
+
* >
|
|
787
|
+
* Update Quote Token
|
|
788
|
+
* </button>
|
|
789
|
+
* )
|
|
790
|
+
* }
|
|
791
|
+
* ```
|
|
792
|
+
*
|
|
793
|
+
* @param parameters - Parameters.
|
|
794
|
+
* @returns Mutation result.
|
|
795
|
+
*/
|
|
796
|
+
export function useUpdateQuoteTokenSync<
|
|
797
|
+
config extends Config = ResolvedRegister['config'],
|
|
798
|
+
context = unknown,
|
|
799
|
+
>(
|
|
800
|
+
parameters: useUpdateQuoteTokenSync.Parameters<config, context> = {},
|
|
801
|
+
): useUpdateQuoteTokenSync.ReturnType<config, context> {
|
|
802
|
+
const { mutation } = parameters
|
|
803
|
+
const config = useConfig(parameters)
|
|
804
|
+
return useMutation({
|
|
805
|
+
...mutation,
|
|
806
|
+
async mutationFn(variables) {
|
|
807
|
+
return Actions.token.updateQuoteTokenSync(config, variables as never)
|
|
808
|
+
},
|
|
809
|
+
mutationKey: ['updateQuoteTokenSync'],
|
|
810
|
+
}) as never
|
|
811
|
+
}
|
|
812
|
+
|
|
813
|
+
export declare namespace useUpdateQuoteTokenSync {
|
|
814
|
+
type Parameters<
|
|
815
|
+
config extends Config = Config,
|
|
816
|
+
context = unknown,
|
|
817
|
+
> = ConfigParameter<config> & {
|
|
818
|
+
mutation?:
|
|
819
|
+
| UseMutationParameters<
|
|
820
|
+
Actions.token.updateQuoteTokenSync.ReturnValue,
|
|
821
|
+
Actions.token.updateQuoteTokenSync.ErrorType,
|
|
822
|
+
Actions.token.updateQuoteTokenSync.Parameters<config>,
|
|
823
|
+
context
|
|
824
|
+
>
|
|
825
|
+
| undefined
|
|
826
|
+
}
|
|
827
|
+
|
|
828
|
+
type ReturnType<
|
|
829
|
+
config extends Config = Config,
|
|
830
|
+
context = unknown,
|
|
831
|
+
> = UseMutationResult<
|
|
832
|
+
Actions.token.updateQuoteTokenSync.ReturnValue,
|
|
833
|
+
Actions.token.updateQuoteTokenSync.ErrorType,
|
|
834
|
+
Actions.token.updateQuoteTokenSync.Parameters<config>,
|
|
835
|
+
context
|
|
836
|
+
>
|
|
837
|
+
}
|
|
838
|
+
|
|
839
|
+
/**
|
|
840
|
+
* Hook for getting TIP20 token allowance.
|
|
841
|
+
*
|
|
842
|
+
* @example
|
|
843
|
+
* ```tsx
|
|
844
|
+
* import { Hooks } from 'wagmi/tempo'
|
|
845
|
+
*
|
|
846
|
+
* function App() {
|
|
847
|
+
* const { data, isLoading } = Hooks.token.useGetAllowance({
|
|
848
|
+
* account: '0x...',
|
|
849
|
+
* spender: '0x...',
|
|
850
|
+
* })
|
|
851
|
+
*
|
|
852
|
+
* if (isLoading) return <div>Loading...</div>
|
|
853
|
+
* return <div>Allowance: {data?.toString()}</div>
|
|
854
|
+
* }
|
|
855
|
+
* ```
|
|
856
|
+
*
|
|
857
|
+
* @param parameters - Parameters.
|
|
858
|
+
* @returns Query result with token allowance.
|
|
859
|
+
*/
|
|
860
|
+
export function useGetAllowance<
|
|
861
|
+
config extends Config = ResolvedRegister['config'],
|
|
862
|
+
selectData = Actions.token.getAllowance.ReturnValue,
|
|
863
|
+
>(
|
|
864
|
+
parameters: useGetAllowance.Parameters<config, selectData> = {},
|
|
865
|
+
): useGetAllowance.ReturnValue<selectData> {
|
|
866
|
+
const config = useConfig(parameters)
|
|
867
|
+
const chainId = useChainId({ config })
|
|
868
|
+
const options = Actions.token.getAllowance.queryOptions(config, {
|
|
869
|
+
...parameters,
|
|
870
|
+
chainId: parameters.chainId ?? chainId,
|
|
871
|
+
} as never)
|
|
872
|
+
return useQuery(options) as never
|
|
873
|
+
}
|
|
874
|
+
|
|
875
|
+
export declare namespace useGetAllowance {
|
|
876
|
+
export type Parameters<
|
|
877
|
+
config extends Config = ResolvedRegister['config'],
|
|
878
|
+
selectData = Actions.token.getAllowance.ReturnValue,
|
|
879
|
+
> = ConfigParameter<config> &
|
|
880
|
+
QueryParameter<
|
|
881
|
+
Actions.token.getAllowance.ReturnValue,
|
|
882
|
+
Actions.token.getAllowance.ErrorType,
|
|
883
|
+
selectData,
|
|
884
|
+
Actions.token.getAllowance.QueryKey<config>
|
|
885
|
+
> &
|
|
886
|
+
ExactPartial<
|
|
887
|
+
Omit<
|
|
888
|
+
Actions.token.getAllowance.queryOptions.Parameters<config, selectData>,
|
|
889
|
+
'query'
|
|
890
|
+
>
|
|
891
|
+
>
|
|
892
|
+
|
|
893
|
+
export type ReturnValue<selectData = Actions.token.getAllowance.ReturnValue> =
|
|
894
|
+
UseQueryReturnType<selectData, Error>
|
|
895
|
+
}
|
|
896
|
+
|
|
897
|
+
/**
|
|
898
|
+
* Hook for getting TIP20 token balance for an address.
|
|
899
|
+
*
|
|
900
|
+
* @example
|
|
901
|
+
* ```tsx
|
|
902
|
+
* import { Hooks } from 'wagmi/tempo'
|
|
903
|
+
*
|
|
904
|
+
* function App() {
|
|
905
|
+
* const { data, isLoading } = Hooks.token.useGetBalance({
|
|
906
|
+
* account: '0x...',
|
|
907
|
+
* })
|
|
908
|
+
*
|
|
909
|
+
* if (isLoading) return <div>Loading...</div>
|
|
910
|
+
* return <div>Balance: {data?.toString()}</div>
|
|
911
|
+
* }
|
|
912
|
+
* ```
|
|
913
|
+
*
|
|
914
|
+
* @param parameters - Parameters.
|
|
915
|
+
* @returns Query result with token balance.
|
|
916
|
+
*/
|
|
917
|
+
export function useGetBalance<
|
|
918
|
+
config extends Config = ResolvedRegister['config'],
|
|
919
|
+
selectData = Actions.token.getBalance.ReturnValue,
|
|
920
|
+
>(
|
|
921
|
+
parameters: useGetBalance.Parameters<config, selectData> = {},
|
|
922
|
+
): useGetBalance.ReturnValue<selectData> {
|
|
923
|
+
const config = useConfig(parameters)
|
|
924
|
+
const chainId = useChainId({ config })
|
|
925
|
+
const options = Actions.token.getBalance.queryOptions(config, {
|
|
926
|
+
...parameters,
|
|
927
|
+
chainId: parameters.chainId ?? chainId,
|
|
928
|
+
} as never)
|
|
929
|
+
return useQuery(options) as never
|
|
930
|
+
}
|
|
931
|
+
|
|
932
|
+
export declare namespace useGetBalance {
|
|
933
|
+
export type Parameters<
|
|
934
|
+
config extends Config = ResolvedRegister['config'],
|
|
935
|
+
selectData = Actions.token.getBalance.ReturnValue,
|
|
936
|
+
> = ConfigParameter<config> &
|
|
937
|
+
QueryParameter<
|
|
938
|
+
Actions.token.getBalance.ReturnValue,
|
|
939
|
+
Actions.token.getBalance.ErrorType,
|
|
940
|
+
selectData,
|
|
941
|
+
Actions.token.getBalance.QueryKey<config>
|
|
942
|
+
> &
|
|
943
|
+
ExactPartial<
|
|
944
|
+
Omit<
|
|
945
|
+
Actions.token.getBalance.queryOptions.Parameters<config, selectData>,
|
|
946
|
+
'query'
|
|
947
|
+
>
|
|
948
|
+
>
|
|
949
|
+
|
|
950
|
+
export type ReturnValue<selectData = Actions.token.getBalance.ReturnValue> =
|
|
951
|
+
UseQueryReturnType<selectData, Error>
|
|
952
|
+
}
|
|
953
|
+
|
|
954
|
+
/**
|
|
955
|
+
* Hook for getting TIP20 token metadata.
|
|
956
|
+
*
|
|
957
|
+
* @example
|
|
958
|
+
* ```tsx
|
|
959
|
+
* import { Hooks } from 'wagmi/tempo'
|
|
960
|
+
*
|
|
961
|
+
* function App() {
|
|
962
|
+
* const { data, isLoading } = Hooks.token.useGetMetadata({
|
|
963
|
+
* token: '0x...',
|
|
964
|
+
* })
|
|
965
|
+
*
|
|
966
|
+
* if (isLoading) return <div>Loading...</div>
|
|
967
|
+
* return <div>{data?.name} ({data?.symbol})</div>
|
|
968
|
+
* }
|
|
969
|
+
* ```
|
|
970
|
+
*
|
|
971
|
+
* @param parameters - Parameters.
|
|
972
|
+
* @returns Query result with token metadata.
|
|
973
|
+
*/
|
|
974
|
+
export function useGetMetadata<
|
|
975
|
+
config extends Config = ResolvedRegister['config'],
|
|
976
|
+
selectData = Actions.token.getMetadata.ReturnValue,
|
|
977
|
+
>(
|
|
978
|
+
parameters: useGetMetadata.Parameters<config, selectData> = {},
|
|
979
|
+
): useGetMetadata.ReturnValue<selectData> {
|
|
980
|
+
const config = useConfig(parameters)
|
|
981
|
+
const chainId = useChainId({ config })
|
|
982
|
+
const options = Actions.token.getMetadata.queryOptions(config, {
|
|
983
|
+
...parameters,
|
|
984
|
+
chainId: parameters.chainId ?? chainId,
|
|
985
|
+
} as never)
|
|
986
|
+
return useQuery(options) as never
|
|
987
|
+
}
|
|
988
|
+
|
|
989
|
+
export declare namespace useGetMetadata {
|
|
990
|
+
export type Parameters<
|
|
991
|
+
config extends Config = ResolvedRegister['config'],
|
|
992
|
+
selectData = Actions.token.getMetadata.ReturnValue,
|
|
993
|
+
> = ConfigParameter<config> &
|
|
994
|
+
QueryParameter<
|
|
995
|
+
Actions.token.getMetadata.ReturnValue,
|
|
996
|
+
Actions.token.getMetadata.ErrorType,
|
|
997
|
+
selectData,
|
|
998
|
+
Actions.token.getMetadata.QueryKey<config>
|
|
999
|
+
> &
|
|
1000
|
+
ExactPartial<
|
|
1001
|
+
Omit<
|
|
1002
|
+
Actions.token.getMetadata.queryOptions.Parameters<config, selectData>,
|
|
1003
|
+
'query'
|
|
1004
|
+
>
|
|
1005
|
+
>
|
|
1006
|
+
|
|
1007
|
+
export type ReturnValue<selectData = Actions.token.getMetadata.ReturnValue> =
|
|
1008
|
+
UseQueryReturnType<selectData, Error>
|
|
1009
|
+
}
|
|
1010
|
+
|
|
1011
|
+
/**
|
|
1012
|
+
* Hook for getting the admin role for a specific role in a TIP20 token.
|
|
1013
|
+
*
|
|
1014
|
+
* @example
|
|
1015
|
+
* ```tsx
|
|
1016
|
+
* import { Hooks } from 'wagmi/tempo'
|
|
1017
|
+
*
|
|
1018
|
+
* function App() {
|
|
1019
|
+
* const { data, isLoading } = Hooks.token.useGetRoleAdmin({
|
|
1020
|
+
* role: 'issuer',
|
|
1021
|
+
* token: '0x...',
|
|
1022
|
+
* })
|
|
1023
|
+
*
|
|
1024
|
+
* if (isLoading) return <div>Loading...</div>
|
|
1025
|
+
* return <div>Admin Role: {data}</div>
|
|
1026
|
+
* }
|
|
1027
|
+
* ```
|
|
1028
|
+
*
|
|
1029
|
+
* @param parameters - Parameters.
|
|
1030
|
+
* @returns Query result with admin role hash.
|
|
1031
|
+
*/
|
|
1032
|
+
export function useGetRoleAdmin<
|
|
1033
|
+
config extends Config = ResolvedRegister['config'],
|
|
1034
|
+
selectData = Actions.token.getRoleAdmin.ReturnValue,
|
|
1035
|
+
>(
|
|
1036
|
+
parameters: useGetRoleAdmin.Parameters<config, selectData>,
|
|
1037
|
+
): useGetRoleAdmin.ReturnValue<selectData> {
|
|
1038
|
+
const config = useConfig(parameters)
|
|
1039
|
+
const chainId = useChainId({ config })
|
|
1040
|
+
const options = Actions.token.getRoleAdmin.queryOptions(config, {
|
|
1041
|
+
...parameters,
|
|
1042
|
+
chainId: parameters.chainId ?? chainId,
|
|
1043
|
+
} as never)
|
|
1044
|
+
return useQuery(options) as never
|
|
1045
|
+
}
|
|
1046
|
+
|
|
1047
|
+
export declare namespace useGetRoleAdmin {
|
|
1048
|
+
export type Parameters<
|
|
1049
|
+
config extends Config = ResolvedRegister['config'],
|
|
1050
|
+
selectData = Actions.token.getRoleAdmin.ReturnValue,
|
|
1051
|
+
> = ConfigParameter<config> &
|
|
1052
|
+
QueryParameter<
|
|
1053
|
+
Actions.token.getRoleAdmin.ReturnValue,
|
|
1054
|
+
Actions.token.getRoleAdmin.ErrorType,
|
|
1055
|
+
selectData,
|
|
1056
|
+
Actions.token.getRoleAdmin.QueryKey<config>
|
|
1057
|
+
> &
|
|
1058
|
+
ExactPartial<
|
|
1059
|
+
Omit<
|
|
1060
|
+
Actions.token.getRoleAdmin.queryOptions.Parameters<config, selectData>,
|
|
1061
|
+
'query'
|
|
1062
|
+
>
|
|
1063
|
+
>
|
|
1064
|
+
|
|
1065
|
+
export type ReturnValue<selectData = Actions.token.getRoleAdmin.ReturnValue> =
|
|
1066
|
+
UseQueryReturnType<selectData, Error>
|
|
1067
|
+
}
|
|
1068
|
+
|
|
1069
|
+
/**
|
|
1070
|
+
* Hook for granting roles for a TIP20 token.
|
|
1071
|
+
*
|
|
1072
|
+
* @example
|
|
1073
|
+
* ```tsx
|
|
1074
|
+
* import { Hooks } from 'wagmi/tempo'
|
|
1075
|
+
*
|
|
1076
|
+
* function App() {
|
|
1077
|
+
* const { mutate, isPending } = Hooks.token.useGrantRoles()
|
|
1078
|
+
*
|
|
1079
|
+
* return (
|
|
1080
|
+
* <button
|
|
1081
|
+
* onClick={() => mutate({ token: '0x...', to: '0x...', roles: ['issuer'] })}
|
|
1082
|
+
* disabled={isPending}
|
|
1083
|
+
* >
|
|
1084
|
+
* Grant Roles
|
|
1085
|
+
* </button>
|
|
1086
|
+
* )
|
|
1087
|
+
* }
|
|
1088
|
+
* ```
|
|
1089
|
+
*
|
|
1090
|
+
* @param parameters - Parameters.
|
|
1091
|
+
* @returns Mutation result.
|
|
1092
|
+
*/
|
|
1093
|
+
export function useGrantRoles<
|
|
1094
|
+
config extends Config = ResolvedRegister['config'],
|
|
1095
|
+
context = unknown,
|
|
1096
|
+
>(
|
|
1097
|
+
parameters: useGrantRoles.Parameters<config, context> = {},
|
|
1098
|
+
): useGrantRoles.ReturnType<config, context> {
|
|
1099
|
+
const { mutation } = parameters
|
|
1100
|
+
const config = useConfig(parameters)
|
|
1101
|
+
return useMutation({
|
|
1102
|
+
...mutation,
|
|
1103
|
+
async mutationFn(variables) {
|
|
1104
|
+
return Actions.token.grantRoles(config, variables as never)
|
|
1105
|
+
},
|
|
1106
|
+
mutationKey: ['grantRoles'],
|
|
1107
|
+
}) as never
|
|
1108
|
+
}
|
|
1109
|
+
|
|
1110
|
+
export declare namespace useGrantRoles {
|
|
1111
|
+
type Parameters<
|
|
1112
|
+
config extends Config = Config,
|
|
1113
|
+
context = unknown,
|
|
1114
|
+
> = ConfigParameter<config> & {
|
|
1115
|
+
mutation?:
|
|
1116
|
+
| UseMutationParameters<
|
|
1117
|
+
Actions.token.grantRoles.ReturnValue,
|
|
1118
|
+
Actions.token.grantRoles.ErrorType,
|
|
1119
|
+
Actions.token.grantRoles.Parameters<config>,
|
|
1120
|
+
context
|
|
1121
|
+
>
|
|
1122
|
+
| undefined
|
|
1123
|
+
}
|
|
1124
|
+
|
|
1125
|
+
type ReturnType<
|
|
1126
|
+
config extends Config = Config,
|
|
1127
|
+
context = unknown,
|
|
1128
|
+
> = UseMutationResult<
|
|
1129
|
+
Actions.token.grantRoles.ReturnValue,
|
|
1130
|
+
Actions.token.grantRoles.ErrorType,
|
|
1131
|
+
Actions.token.grantRoles.Parameters<config>,
|
|
1132
|
+
context
|
|
1133
|
+
>
|
|
1134
|
+
}
|
|
1135
|
+
|
|
1136
|
+
/**
|
|
1137
|
+
* Hook for granting roles for a TIP20 token.
|
|
1138
|
+
*
|
|
1139
|
+
* Note: This is a synchronous hook that waits for the transaction
|
|
1140
|
+
* to be included on a block before returning a response.
|
|
1141
|
+
*
|
|
1142
|
+
* @example
|
|
1143
|
+
* ```tsx
|
|
1144
|
+
* import { Hooks } from 'wagmi/tempo'
|
|
1145
|
+
*
|
|
1146
|
+
* function App() {
|
|
1147
|
+
* const { mutate, isPending } = Hooks.token.useGrantRolesSync()
|
|
1148
|
+
*
|
|
1149
|
+
* return (
|
|
1150
|
+
* <button
|
|
1151
|
+
* onClick={() => mutate({ token: '0x...', to: '0x...', roles: ['issuer'] })}
|
|
1152
|
+
* disabled={isPending}
|
|
1153
|
+
* >
|
|
1154
|
+
* Grant Roles
|
|
1155
|
+
* </button>
|
|
1156
|
+
* )
|
|
1157
|
+
* }
|
|
1158
|
+
* ```
|
|
1159
|
+
*
|
|
1160
|
+
* @param parameters - Parameters.
|
|
1161
|
+
* @returns Mutation result.
|
|
1162
|
+
*/
|
|
1163
|
+
export function useGrantRolesSync<
|
|
1164
|
+
config extends Config = ResolvedRegister['config'],
|
|
1165
|
+
context = unknown,
|
|
1166
|
+
>(
|
|
1167
|
+
parameters: useGrantRolesSync.Parameters<config, context> = {},
|
|
1168
|
+
): useGrantRolesSync.ReturnType<config, context> {
|
|
1169
|
+
const { mutation } = parameters
|
|
1170
|
+
const config = useConfig(parameters)
|
|
1171
|
+
return useMutation({
|
|
1172
|
+
...mutation,
|
|
1173
|
+
async mutationFn(variables) {
|
|
1174
|
+
return Actions.token.grantRolesSync(config, variables as never)
|
|
1175
|
+
},
|
|
1176
|
+
mutationKey: ['grantRolesSync'],
|
|
1177
|
+
}) as never
|
|
1178
|
+
}
|
|
1179
|
+
|
|
1180
|
+
export declare namespace useGrantRolesSync {
|
|
1181
|
+
type Parameters<
|
|
1182
|
+
config extends Config = Config,
|
|
1183
|
+
context = unknown,
|
|
1184
|
+
> = ConfigParameter<config> & {
|
|
1185
|
+
mutation?:
|
|
1186
|
+
| UseMutationParameters<
|
|
1187
|
+
Actions.token.grantRolesSync.ReturnValue,
|
|
1188
|
+
Actions.token.grantRolesSync.ErrorType,
|
|
1189
|
+
Actions.token.grantRolesSync.Parameters<config>,
|
|
1190
|
+
context
|
|
1191
|
+
>
|
|
1192
|
+
| undefined
|
|
1193
|
+
}
|
|
1194
|
+
|
|
1195
|
+
type ReturnType<
|
|
1196
|
+
config extends Config = Config,
|
|
1197
|
+
context = unknown,
|
|
1198
|
+
> = UseMutationResult<
|
|
1199
|
+
Actions.token.grantRolesSync.ReturnValue,
|
|
1200
|
+
Actions.token.grantRolesSync.ErrorType,
|
|
1201
|
+
Actions.token.grantRolesSync.Parameters<config>,
|
|
1202
|
+
context
|
|
1203
|
+
>
|
|
1204
|
+
}
|
|
1205
|
+
|
|
1206
|
+
/**
|
|
1207
|
+
* Hook for checking if an account has a specific role for a TIP20 token.
|
|
1208
|
+
*
|
|
1209
|
+
* @example
|
|
1210
|
+
* ```tsx
|
|
1211
|
+
* import { Hooks } from 'wagmi/tempo'
|
|
1212
|
+
*
|
|
1213
|
+
* function App() {
|
|
1214
|
+
* const { data, isLoading } = Hooks.token.useHasRole({
|
|
1215
|
+
* account: '0x...',
|
|
1216
|
+
* role: 'issuer',
|
|
1217
|
+
* token: '0x...',
|
|
1218
|
+
* })
|
|
1219
|
+
*
|
|
1220
|
+
* if (isLoading) return <div>Loading...</div>
|
|
1221
|
+
* return <div>Has Role: {data ? 'Yes' : 'No'}</div>
|
|
1222
|
+
* }
|
|
1223
|
+
* ```
|
|
1224
|
+
*
|
|
1225
|
+
* @param parameters - Parameters.
|
|
1226
|
+
* @returns Query result with boolean indicating if account has role.
|
|
1227
|
+
*/
|
|
1228
|
+
export function useHasRole<
|
|
1229
|
+
config extends Config = ResolvedRegister['config'],
|
|
1230
|
+
selectData = Actions.token.hasRole.ReturnValue,
|
|
1231
|
+
>(
|
|
1232
|
+
parameters: useHasRole.Parameters<config, selectData>,
|
|
1233
|
+
): useHasRole.ReturnValue<selectData> {
|
|
1234
|
+
const config = useConfig(parameters)
|
|
1235
|
+
const chainId = useChainId({ config })
|
|
1236
|
+
const options = Actions.token.hasRole.queryOptions(config, {
|
|
1237
|
+
...parameters,
|
|
1238
|
+
chainId: parameters.chainId ?? chainId,
|
|
1239
|
+
} as never)
|
|
1240
|
+
return useQuery(options) as never
|
|
1241
|
+
}
|
|
1242
|
+
|
|
1243
|
+
export declare namespace useHasRole {
|
|
1244
|
+
export type Parameters<
|
|
1245
|
+
config extends Config = ResolvedRegister['config'],
|
|
1246
|
+
selectData = Actions.token.hasRole.ReturnValue,
|
|
1247
|
+
> = ConfigParameter<config> &
|
|
1248
|
+
QueryParameter<
|
|
1249
|
+
Actions.token.hasRole.ReturnValue,
|
|
1250
|
+
Actions.token.hasRole.ErrorType,
|
|
1251
|
+
selectData,
|
|
1252
|
+
Actions.token.hasRole.QueryKey<config>
|
|
1253
|
+
> &
|
|
1254
|
+
ExactPartial<
|
|
1255
|
+
Omit<
|
|
1256
|
+
Actions.token.hasRole.queryOptions.Parameters<config, selectData>,
|
|
1257
|
+
'query'
|
|
1258
|
+
>
|
|
1259
|
+
>
|
|
1260
|
+
|
|
1261
|
+
export type ReturnValue<selectData = Actions.token.hasRole.ReturnValue> =
|
|
1262
|
+
UseQueryReturnType<selectData, Error>
|
|
1263
|
+
}
|
|
1264
|
+
|
|
1265
|
+
/**
|
|
1266
|
+
* Hook for minting TIP20 tokens to an address.
|
|
1267
|
+
*
|
|
1268
|
+
* @example
|
|
1269
|
+
* ```tsx
|
|
1270
|
+
* import { Hooks } from 'wagmi/tempo'
|
|
1271
|
+
*
|
|
1272
|
+
* function App() {
|
|
1273
|
+
* const { mutate, isPending } = Hooks.token.useMint()
|
|
1274
|
+
*
|
|
1275
|
+
* return (
|
|
1276
|
+
* <button
|
|
1277
|
+
* onClick={() => mutate({ to: '0x...', amount: 100n, token: '0x...' })}
|
|
1278
|
+
* disabled={isPending}
|
|
1279
|
+
* >
|
|
1280
|
+
* Mint
|
|
1281
|
+
* </button>
|
|
1282
|
+
* )
|
|
1283
|
+
* }
|
|
1284
|
+
* ```
|
|
1285
|
+
*
|
|
1286
|
+
* @param parameters - Parameters.
|
|
1287
|
+
* @returns Mutation result.
|
|
1288
|
+
*/
|
|
1289
|
+
export function useMint<
|
|
1290
|
+
config extends Config = ResolvedRegister['config'],
|
|
1291
|
+
context = unknown,
|
|
1292
|
+
>(
|
|
1293
|
+
parameters: useMint.Parameters<config, context> = {},
|
|
1294
|
+
): useMint.ReturnType<config, context> {
|
|
1295
|
+
const { mutation } = parameters
|
|
1296
|
+
const config = useConfig(parameters)
|
|
1297
|
+
return useMutation({
|
|
1298
|
+
...mutation,
|
|
1299
|
+
async mutationFn(variables) {
|
|
1300
|
+
return Actions.token.mint(config, variables as never)
|
|
1301
|
+
},
|
|
1302
|
+
mutationKey: ['mint'],
|
|
1303
|
+
}) as never
|
|
1304
|
+
}
|
|
1305
|
+
|
|
1306
|
+
export declare namespace useMint {
|
|
1307
|
+
type Parameters<
|
|
1308
|
+
config extends Config = Config,
|
|
1309
|
+
context = unknown,
|
|
1310
|
+
> = ConfigParameter<config> & {
|
|
1311
|
+
mutation?:
|
|
1312
|
+
| UseMutationParameters<
|
|
1313
|
+
Actions.token.mint.ReturnValue,
|
|
1314
|
+
Actions.token.mint.ErrorType,
|
|
1315
|
+
Actions.token.mint.Parameters<config>,
|
|
1316
|
+
context
|
|
1317
|
+
>
|
|
1318
|
+
| undefined
|
|
1319
|
+
}
|
|
1320
|
+
|
|
1321
|
+
type ReturnType<
|
|
1322
|
+
config extends Config = Config,
|
|
1323
|
+
context = unknown,
|
|
1324
|
+
> = UseMutationResult<
|
|
1325
|
+
Actions.token.mint.ReturnValue,
|
|
1326
|
+
Actions.token.mint.ErrorType,
|
|
1327
|
+
Actions.token.mint.Parameters<config>,
|
|
1328
|
+
context
|
|
1329
|
+
>
|
|
1330
|
+
}
|
|
1331
|
+
|
|
1332
|
+
/**
|
|
1333
|
+
* Hook for minting TIP20 tokens to an address.
|
|
1334
|
+
*
|
|
1335
|
+
* Note: This is a synchronous hook that waits for the transaction
|
|
1336
|
+
* to be included on a block before returning a response.
|
|
1337
|
+
*
|
|
1338
|
+
* @example
|
|
1339
|
+
* ```tsx
|
|
1340
|
+
* import { Hooks } from 'wagmi/tempo'
|
|
1341
|
+
*
|
|
1342
|
+
* function App() {
|
|
1343
|
+
* const { mutate, isPending } = Hooks.token.useMintSync()
|
|
1344
|
+
*
|
|
1345
|
+
* return (
|
|
1346
|
+
* <button
|
|
1347
|
+
* onClick={() => mutate({ to: '0x...', amount: 100n, token: '0x...' })}
|
|
1348
|
+
* disabled={isPending}
|
|
1349
|
+
* >
|
|
1350
|
+
* Mint
|
|
1351
|
+
* </button>
|
|
1352
|
+
* )
|
|
1353
|
+
* }
|
|
1354
|
+
* ```
|
|
1355
|
+
*
|
|
1356
|
+
* @param parameters - Parameters.
|
|
1357
|
+
* @returns Mutation result.
|
|
1358
|
+
*/
|
|
1359
|
+
export function useMintSync<
|
|
1360
|
+
config extends Config = ResolvedRegister['config'],
|
|
1361
|
+
context = unknown,
|
|
1362
|
+
>(
|
|
1363
|
+
parameters: useMintSync.Parameters<config, context> = {},
|
|
1364
|
+
): useMintSync.ReturnType<config, context> {
|
|
1365
|
+
const { mutation } = parameters
|
|
1366
|
+
const config = useConfig(parameters)
|
|
1367
|
+
return useMutation({
|
|
1368
|
+
...mutation,
|
|
1369
|
+
async mutationFn(variables) {
|
|
1370
|
+
return Actions.token.mintSync(config, variables as never)
|
|
1371
|
+
},
|
|
1372
|
+
mutationKey: ['mintSync'],
|
|
1373
|
+
}) as never
|
|
1374
|
+
}
|
|
1375
|
+
|
|
1376
|
+
export declare namespace useMintSync {
|
|
1377
|
+
type Parameters<
|
|
1378
|
+
config extends Config = Config,
|
|
1379
|
+
context = unknown,
|
|
1380
|
+
> = ConfigParameter<config> & {
|
|
1381
|
+
mutation?:
|
|
1382
|
+
| UseMutationParameters<
|
|
1383
|
+
Actions.token.mintSync.ReturnValue,
|
|
1384
|
+
Actions.token.mintSync.ErrorType,
|
|
1385
|
+
Actions.token.mintSync.Parameters<config>,
|
|
1386
|
+
context
|
|
1387
|
+
>
|
|
1388
|
+
| undefined
|
|
1389
|
+
}
|
|
1390
|
+
|
|
1391
|
+
type ReturnType<
|
|
1392
|
+
config extends Config = Config,
|
|
1393
|
+
context = unknown,
|
|
1394
|
+
> = UseMutationResult<
|
|
1395
|
+
Actions.token.mintSync.ReturnValue,
|
|
1396
|
+
Actions.token.mintSync.ErrorType,
|
|
1397
|
+
Actions.token.mintSync.Parameters<config>,
|
|
1398
|
+
context
|
|
1399
|
+
>
|
|
1400
|
+
}
|
|
1401
|
+
|
|
1402
|
+
/**
|
|
1403
|
+
* Hook for pausing a TIP20 token.
|
|
1404
|
+
*
|
|
1405
|
+
* @example
|
|
1406
|
+
* ```tsx
|
|
1407
|
+
* import { Hooks } from 'wagmi/tempo'
|
|
1408
|
+
*
|
|
1409
|
+
* function App() {
|
|
1410
|
+
* const { mutate, isPending } = Hooks.token.usePause()
|
|
1411
|
+
*
|
|
1412
|
+
* return (
|
|
1413
|
+
* <button
|
|
1414
|
+
* onClick={() => mutate({ token: '0x...' })}
|
|
1415
|
+
* disabled={isPending}
|
|
1416
|
+
* >
|
|
1417
|
+
* Pause
|
|
1418
|
+
* </button>
|
|
1419
|
+
* )
|
|
1420
|
+
* }
|
|
1421
|
+
* ```
|
|
1422
|
+
*
|
|
1423
|
+
* @param parameters - Parameters.
|
|
1424
|
+
* @returns Mutation result.
|
|
1425
|
+
*/
|
|
1426
|
+
export function usePause<
|
|
1427
|
+
config extends Config = ResolvedRegister['config'],
|
|
1428
|
+
context = unknown,
|
|
1429
|
+
>(
|
|
1430
|
+
parameters: usePause.Parameters<config, context> = {},
|
|
1431
|
+
): usePause.ReturnType<config, context> {
|
|
1432
|
+
const { mutation } = parameters
|
|
1433
|
+
const config = useConfig(parameters)
|
|
1434
|
+
return useMutation({
|
|
1435
|
+
...mutation,
|
|
1436
|
+
async mutationFn(variables) {
|
|
1437
|
+
return Actions.token.pause(config, variables as never)
|
|
1438
|
+
},
|
|
1439
|
+
mutationKey: ['pause'],
|
|
1440
|
+
}) as never
|
|
1441
|
+
}
|
|
1442
|
+
|
|
1443
|
+
export declare namespace usePause {
|
|
1444
|
+
type Parameters<
|
|
1445
|
+
config extends Config = Config,
|
|
1446
|
+
context = unknown,
|
|
1447
|
+
> = ConfigParameter<config> & {
|
|
1448
|
+
mutation?:
|
|
1449
|
+
| UseMutationParameters<
|
|
1450
|
+
Actions.token.pause.ReturnValue,
|
|
1451
|
+
Actions.token.pause.ErrorType,
|
|
1452
|
+
Actions.token.pause.Parameters<config>,
|
|
1453
|
+
context
|
|
1454
|
+
>
|
|
1455
|
+
| undefined
|
|
1456
|
+
}
|
|
1457
|
+
|
|
1458
|
+
type ReturnType<
|
|
1459
|
+
config extends Config = Config,
|
|
1460
|
+
context = unknown,
|
|
1461
|
+
> = UseMutationResult<
|
|
1462
|
+
Actions.token.pause.ReturnValue,
|
|
1463
|
+
Actions.token.pause.ErrorType,
|
|
1464
|
+
Actions.token.pause.Parameters<config>,
|
|
1465
|
+
context
|
|
1466
|
+
>
|
|
1467
|
+
}
|
|
1468
|
+
|
|
1469
|
+
/**
|
|
1470
|
+
* Hook for pausing a TIP20 token.
|
|
1471
|
+
*
|
|
1472
|
+
* Note: This is a synchronous hook that waits for the transaction
|
|
1473
|
+
* to be included on a block before returning a response.
|
|
1474
|
+
*
|
|
1475
|
+
* @example
|
|
1476
|
+
* ```tsx
|
|
1477
|
+
* import { Hooks } from 'wagmi/tempo'
|
|
1478
|
+
*
|
|
1479
|
+
* function App() {
|
|
1480
|
+
* const { mutate, isPending } = Hooks.token.usePauseSync()
|
|
1481
|
+
*
|
|
1482
|
+
* return (
|
|
1483
|
+
* <button
|
|
1484
|
+
* onClick={() => mutate({ token: '0x...' })}
|
|
1485
|
+
* disabled={isPending}
|
|
1486
|
+
* >
|
|
1487
|
+
* Pause
|
|
1488
|
+
* </button>
|
|
1489
|
+
* )
|
|
1490
|
+
* }
|
|
1491
|
+
* ```
|
|
1492
|
+
*
|
|
1493
|
+
* @param parameters - Parameters.
|
|
1494
|
+
* @returns Mutation result.
|
|
1495
|
+
*/
|
|
1496
|
+
export function usePauseSync<
|
|
1497
|
+
config extends Config = ResolvedRegister['config'],
|
|
1498
|
+
context = unknown,
|
|
1499
|
+
>(
|
|
1500
|
+
parameters: usePauseSync.Parameters<config, context> = {},
|
|
1501
|
+
): usePauseSync.ReturnType<config, context> {
|
|
1502
|
+
const { mutation } = parameters
|
|
1503
|
+
const config = useConfig(parameters)
|
|
1504
|
+
return useMutation({
|
|
1505
|
+
...mutation,
|
|
1506
|
+
async mutationFn(variables) {
|
|
1507
|
+
return Actions.token.pauseSync(config, variables as never)
|
|
1508
|
+
},
|
|
1509
|
+
mutationKey: ['pauseSync'],
|
|
1510
|
+
}) as never
|
|
1511
|
+
}
|
|
1512
|
+
|
|
1513
|
+
export declare namespace usePauseSync {
|
|
1514
|
+
type Parameters<
|
|
1515
|
+
config extends Config = Config,
|
|
1516
|
+
context = unknown,
|
|
1517
|
+
> = ConfigParameter<config> & {
|
|
1518
|
+
mutation?:
|
|
1519
|
+
| UseMutationParameters<
|
|
1520
|
+
Actions.token.pauseSync.ReturnValue,
|
|
1521
|
+
Actions.token.pauseSync.ErrorType,
|
|
1522
|
+
Actions.token.pauseSync.Parameters<config>,
|
|
1523
|
+
context
|
|
1524
|
+
>
|
|
1525
|
+
| undefined
|
|
1526
|
+
}
|
|
1527
|
+
|
|
1528
|
+
type ReturnType<
|
|
1529
|
+
config extends Config = Config,
|
|
1530
|
+
context = unknown,
|
|
1531
|
+
> = UseMutationResult<
|
|
1532
|
+
Actions.token.pauseSync.ReturnValue,
|
|
1533
|
+
Actions.token.pauseSync.ErrorType,
|
|
1534
|
+
Actions.token.pauseSync.Parameters<config>,
|
|
1535
|
+
context
|
|
1536
|
+
>
|
|
1537
|
+
}
|
|
1538
|
+
|
|
1539
|
+
/**
|
|
1540
|
+
* Hook for renouncing roles for a TIP20 token.
|
|
1541
|
+
*
|
|
1542
|
+
* @example
|
|
1543
|
+
* ```tsx
|
|
1544
|
+
* import { Hooks } from 'wagmi/tempo'
|
|
1545
|
+
*
|
|
1546
|
+
* function App() {
|
|
1547
|
+
* const { mutate, isPending } = Hooks.token.useRenounceRoles()
|
|
1548
|
+
*
|
|
1549
|
+
* return (
|
|
1550
|
+
* <button
|
|
1551
|
+
* onClick={() => mutate({ token: '0x...', roles: ['issuer'] })}
|
|
1552
|
+
* disabled={isPending}
|
|
1553
|
+
* >
|
|
1554
|
+
* Renounce Roles
|
|
1555
|
+
* </button>
|
|
1556
|
+
* )
|
|
1557
|
+
* }
|
|
1558
|
+
* ```
|
|
1559
|
+
*
|
|
1560
|
+
* @param parameters - Parameters.
|
|
1561
|
+
* @returns Mutation result.
|
|
1562
|
+
*/
|
|
1563
|
+
export function useRenounceRoles<
|
|
1564
|
+
config extends Config = ResolvedRegister['config'],
|
|
1565
|
+
context = unknown,
|
|
1566
|
+
>(
|
|
1567
|
+
parameters: useRenounceRoles.Parameters<config, context> = {},
|
|
1568
|
+
): useRenounceRoles.ReturnType<config, context> {
|
|
1569
|
+
const { mutation } = parameters
|
|
1570
|
+
const config = useConfig(parameters)
|
|
1571
|
+
return useMutation({
|
|
1572
|
+
...mutation,
|
|
1573
|
+
async mutationFn(variables) {
|
|
1574
|
+
return Actions.token.renounceRoles(config, variables as never)
|
|
1575
|
+
},
|
|
1576
|
+
mutationKey: ['renounceRoles'],
|
|
1577
|
+
}) as never
|
|
1578
|
+
}
|
|
1579
|
+
|
|
1580
|
+
export declare namespace useRenounceRoles {
|
|
1581
|
+
type Parameters<
|
|
1582
|
+
config extends Config = Config,
|
|
1583
|
+
context = unknown,
|
|
1584
|
+
> = ConfigParameter<config> & {
|
|
1585
|
+
mutation?:
|
|
1586
|
+
| UseMutationParameters<
|
|
1587
|
+
Actions.token.renounceRoles.ReturnValue,
|
|
1588
|
+
Actions.token.renounceRoles.ErrorType,
|
|
1589
|
+
Actions.token.renounceRoles.Parameters<config>,
|
|
1590
|
+
context
|
|
1591
|
+
>
|
|
1592
|
+
| undefined
|
|
1593
|
+
}
|
|
1594
|
+
|
|
1595
|
+
type ReturnType<
|
|
1596
|
+
config extends Config = Config,
|
|
1597
|
+
context = unknown,
|
|
1598
|
+
> = UseMutationResult<
|
|
1599
|
+
Actions.token.renounceRoles.ReturnValue,
|
|
1600
|
+
Actions.token.renounceRoles.ErrorType,
|
|
1601
|
+
Actions.token.renounceRoles.Parameters<config>,
|
|
1602
|
+
context
|
|
1603
|
+
>
|
|
1604
|
+
}
|
|
1605
|
+
|
|
1606
|
+
/**
|
|
1607
|
+
* Hook for renouncing roles for a TIP20 token.
|
|
1608
|
+
*
|
|
1609
|
+
* Note: This is a synchronous hook that waits for the transaction
|
|
1610
|
+
* to be included on a block before returning a response.
|
|
1611
|
+
*
|
|
1612
|
+
* @example
|
|
1613
|
+
* ```tsx
|
|
1614
|
+
* import { Hooks } from 'wagmi/tempo'
|
|
1615
|
+
*
|
|
1616
|
+
* function App() {
|
|
1617
|
+
* const { mutate, isPending } = Hooks.token.useRenounceRolesSync()
|
|
1618
|
+
*
|
|
1619
|
+
* return (
|
|
1620
|
+
* <button
|
|
1621
|
+
* onClick={() => mutate({ token: '0x...', roles: ['issuer'] })}
|
|
1622
|
+
* disabled={isPending}
|
|
1623
|
+
* >
|
|
1624
|
+
* Renounce Roles
|
|
1625
|
+
* </button>
|
|
1626
|
+
* )
|
|
1627
|
+
* }
|
|
1628
|
+
* ```
|
|
1629
|
+
*
|
|
1630
|
+
* @param parameters - Parameters.
|
|
1631
|
+
* @returns Mutation result.
|
|
1632
|
+
*/
|
|
1633
|
+
export function useRenounceRolesSync<
|
|
1634
|
+
config extends Config = ResolvedRegister['config'],
|
|
1635
|
+
context = unknown,
|
|
1636
|
+
>(
|
|
1637
|
+
parameters: useRenounceRolesSync.Parameters<config, context> = {},
|
|
1638
|
+
): useRenounceRolesSync.ReturnType<config, context> {
|
|
1639
|
+
const { mutation } = parameters
|
|
1640
|
+
const config = useConfig(parameters)
|
|
1641
|
+
return useMutation({
|
|
1642
|
+
...mutation,
|
|
1643
|
+
async mutationFn(variables) {
|
|
1644
|
+
return Actions.token.renounceRolesSync(config, variables as never)
|
|
1645
|
+
},
|
|
1646
|
+
mutationKey: ['renounceRolesSync'],
|
|
1647
|
+
}) as never
|
|
1648
|
+
}
|
|
1649
|
+
|
|
1650
|
+
export declare namespace useRenounceRolesSync {
|
|
1651
|
+
type Parameters<
|
|
1652
|
+
config extends Config = Config,
|
|
1653
|
+
context = unknown,
|
|
1654
|
+
> = ConfigParameter<config> & {
|
|
1655
|
+
mutation?:
|
|
1656
|
+
| UseMutationParameters<
|
|
1657
|
+
Actions.token.renounceRolesSync.ReturnValue,
|
|
1658
|
+
Actions.token.renounceRolesSync.ErrorType,
|
|
1659
|
+
Actions.token.renounceRolesSync.Parameters<config>,
|
|
1660
|
+
context
|
|
1661
|
+
>
|
|
1662
|
+
| undefined
|
|
1663
|
+
}
|
|
1664
|
+
|
|
1665
|
+
type ReturnType<
|
|
1666
|
+
config extends Config = Config,
|
|
1667
|
+
context = unknown,
|
|
1668
|
+
> = UseMutationResult<
|
|
1669
|
+
Actions.token.renounceRolesSync.ReturnValue,
|
|
1670
|
+
Actions.token.renounceRolesSync.ErrorType,
|
|
1671
|
+
Actions.token.renounceRolesSync.Parameters<config>,
|
|
1672
|
+
context
|
|
1673
|
+
>
|
|
1674
|
+
}
|
|
1675
|
+
|
|
1676
|
+
/**
|
|
1677
|
+
* Hook for revoking roles for a TIP20 token.
|
|
1678
|
+
*
|
|
1679
|
+
* @example
|
|
1680
|
+
* ```tsx
|
|
1681
|
+
* import { Hooks } from 'wagmi/tempo'
|
|
1682
|
+
*
|
|
1683
|
+
* function App() {
|
|
1684
|
+
* const { mutate, isPending } = Hooks.token.useRevokeRoles()
|
|
1685
|
+
*
|
|
1686
|
+
* return (
|
|
1687
|
+
* <button
|
|
1688
|
+
* onClick={() => mutate({ token: '0x...', from: '0x...', roles: ['issuer'] })}
|
|
1689
|
+
* disabled={isPending}
|
|
1690
|
+
* >
|
|
1691
|
+
* Revoke Roles
|
|
1692
|
+
* </button>
|
|
1693
|
+
* )
|
|
1694
|
+
* }
|
|
1695
|
+
* ```
|
|
1696
|
+
*
|
|
1697
|
+
* @param parameters - Parameters.
|
|
1698
|
+
* @returns Mutation result.
|
|
1699
|
+
*/
|
|
1700
|
+
export function useRevokeRoles<
|
|
1701
|
+
config extends Config = ResolvedRegister['config'],
|
|
1702
|
+
context = unknown,
|
|
1703
|
+
>(
|
|
1704
|
+
parameters: useRevokeRoles.Parameters<config, context> = {},
|
|
1705
|
+
): useRevokeRoles.ReturnType<config, context> {
|
|
1706
|
+
const { mutation } = parameters
|
|
1707
|
+
const config = useConfig(parameters)
|
|
1708
|
+
return useMutation({
|
|
1709
|
+
...mutation,
|
|
1710
|
+
async mutationFn(variables) {
|
|
1711
|
+
return Actions.token.revokeRoles(config, variables as never)
|
|
1712
|
+
},
|
|
1713
|
+
mutationKey: ['revokeRoles'],
|
|
1714
|
+
}) as never
|
|
1715
|
+
}
|
|
1716
|
+
|
|
1717
|
+
export declare namespace useRevokeRoles {
|
|
1718
|
+
type Parameters<
|
|
1719
|
+
config extends Config = Config,
|
|
1720
|
+
context = unknown,
|
|
1721
|
+
> = ConfigParameter<config> & {
|
|
1722
|
+
mutation?:
|
|
1723
|
+
| UseMutationParameters<
|
|
1724
|
+
Actions.token.revokeRoles.ReturnValue,
|
|
1725
|
+
Actions.token.revokeRoles.ErrorType,
|
|
1726
|
+
Actions.token.revokeRoles.Parameters<config>,
|
|
1727
|
+
context
|
|
1728
|
+
>
|
|
1729
|
+
| undefined
|
|
1730
|
+
}
|
|
1731
|
+
|
|
1732
|
+
type ReturnType<
|
|
1733
|
+
config extends Config = Config,
|
|
1734
|
+
context = unknown,
|
|
1735
|
+
> = UseMutationResult<
|
|
1736
|
+
Actions.token.revokeRoles.ReturnValue,
|
|
1737
|
+
Actions.token.revokeRoles.ErrorType,
|
|
1738
|
+
Actions.token.revokeRoles.Parameters<config>,
|
|
1739
|
+
context
|
|
1740
|
+
>
|
|
1741
|
+
}
|
|
1742
|
+
|
|
1743
|
+
/**
|
|
1744
|
+
* Hook for revoking roles for a TIP20 token.
|
|
1745
|
+
*
|
|
1746
|
+
* Note: This is a synchronous hook that waits for the transaction
|
|
1747
|
+
* to be included on a block before returning a response.
|
|
1748
|
+
*
|
|
1749
|
+
* @example
|
|
1750
|
+
* ```tsx
|
|
1751
|
+
* import { Hooks } from 'wagmi/tempo'
|
|
1752
|
+
*
|
|
1753
|
+
* function App() {
|
|
1754
|
+
* const { mutate, isPending } = Hooks.token.useRevokeRolesSync()
|
|
1755
|
+
*
|
|
1756
|
+
* return (
|
|
1757
|
+
* <button
|
|
1758
|
+
* onClick={() => mutate({ token: '0x...', from: '0x...', roles: ['issuer'] })}
|
|
1759
|
+
* disabled={isPending}
|
|
1760
|
+
* >
|
|
1761
|
+
* Revoke Roles
|
|
1762
|
+
* </button>
|
|
1763
|
+
* )
|
|
1764
|
+
* }
|
|
1765
|
+
* ```
|
|
1766
|
+
*
|
|
1767
|
+
* @param parameters - Parameters.
|
|
1768
|
+
* @returns Mutation result.
|
|
1769
|
+
*/
|
|
1770
|
+
export function useRevokeRolesSync<
|
|
1771
|
+
config extends Config = ResolvedRegister['config'],
|
|
1772
|
+
context = unknown,
|
|
1773
|
+
>(
|
|
1774
|
+
parameters: useRevokeRolesSync.Parameters<config, context> = {},
|
|
1775
|
+
): useRevokeRolesSync.ReturnType<config, context> {
|
|
1776
|
+
const { mutation } = parameters
|
|
1777
|
+
const config = useConfig(parameters)
|
|
1778
|
+
return useMutation({
|
|
1779
|
+
...mutation,
|
|
1780
|
+
async mutationFn(variables) {
|
|
1781
|
+
return Actions.token.revokeRolesSync(config, variables as never)
|
|
1782
|
+
},
|
|
1783
|
+
mutationKey: ['revokeRolesSync'],
|
|
1784
|
+
}) as never
|
|
1785
|
+
}
|
|
1786
|
+
|
|
1787
|
+
export declare namespace useRevokeRolesSync {
|
|
1788
|
+
type Parameters<
|
|
1789
|
+
config extends Config = Config,
|
|
1790
|
+
context = unknown,
|
|
1791
|
+
> = ConfigParameter<config> & {
|
|
1792
|
+
mutation?:
|
|
1793
|
+
| UseMutationParameters<
|
|
1794
|
+
Actions.token.revokeRolesSync.ReturnValue,
|
|
1795
|
+
Actions.token.revokeRolesSync.ErrorType,
|
|
1796
|
+
Actions.token.revokeRolesSync.Parameters<config>,
|
|
1797
|
+
context
|
|
1798
|
+
>
|
|
1799
|
+
| undefined
|
|
1800
|
+
}
|
|
1801
|
+
|
|
1802
|
+
type ReturnType<
|
|
1803
|
+
config extends Config = Config,
|
|
1804
|
+
context = unknown,
|
|
1805
|
+
> = UseMutationResult<
|
|
1806
|
+
Actions.token.revokeRolesSync.ReturnValue,
|
|
1807
|
+
Actions.token.revokeRolesSync.ErrorType,
|
|
1808
|
+
Actions.token.revokeRolesSync.Parameters<config>,
|
|
1809
|
+
context
|
|
1810
|
+
>
|
|
1811
|
+
}
|
|
1812
|
+
|
|
1813
|
+
/**
|
|
1814
|
+
* Hook for setting the admin role for a specific role in a TIP20 token.
|
|
1815
|
+
*
|
|
1816
|
+
* @example
|
|
1817
|
+
* ```tsx
|
|
1818
|
+
* import { Hooks } from 'wagmi/tempo'
|
|
1819
|
+
*
|
|
1820
|
+
* function App() {
|
|
1821
|
+
* const { mutate, isPending } = Hooks.token.useSetRoleAdmin()
|
|
1822
|
+
*
|
|
1823
|
+
* return (
|
|
1824
|
+
* <button
|
|
1825
|
+
* onClick={() => mutate({ token: '0x...', role: 'issuer', adminRole: 'pause' })}
|
|
1826
|
+
* disabled={isPending}
|
|
1827
|
+
* >
|
|
1828
|
+
* Set Role Admin
|
|
1829
|
+
* </button>
|
|
1830
|
+
* )
|
|
1831
|
+
* }
|
|
1832
|
+
* ```
|
|
1833
|
+
*
|
|
1834
|
+
* @param parameters - Parameters.
|
|
1835
|
+
* @returns Mutation result.
|
|
1836
|
+
*/
|
|
1837
|
+
export function useSetRoleAdmin<
|
|
1838
|
+
config extends Config = ResolvedRegister['config'],
|
|
1839
|
+
context = unknown,
|
|
1840
|
+
>(
|
|
1841
|
+
parameters: useSetRoleAdmin.Parameters<config, context> = {},
|
|
1842
|
+
): useSetRoleAdmin.ReturnType<config, context> {
|
|
1843
|
+
const { mutation } = parameters
|
|
1844
|
+
const config = useConfig(parameters)
|
|
1845
|
+
return useMutation({
|
|
1846
|
+
...mutation,
|
|
1847
|
+
async mutationFn(variables) {
|
|
1848
|
+
return Actions.token.setRoleAdmin(config, variables as never)
|
|
1849
|
+
},
|
|
1850
|
+
mutationKey: ['setRoleAdmin'],
|
|
1851
|
+
}) as never
|
|
1852
|
+
}
|
|
1853
|
+
|
|
1854
|
+
export declare namespace useSetRoleAdmin {
|
|
1855
|
+
type Parameters<
|
|
1856
|
+
config extends Config = Config,
|
|
1857
|
+
context = unknown,
|
|
1858
|
+
> = ConfigParameter<config> & {
|
|
1859
|
+
mutation?:
|
|
1860
|
+
| UseMutationParameters<
|
|
1861
|
+
Actions.token.setRoleAdmin.ReturnValue,
|
|
1862
|
+
Actions.token.setRoleAdmin.ErrorType,
|
|
1863
|
+
Actions.token.setRoleAdmin.Parameters<config>,
|
|
1864
|
+
context
|
|
1865
|
+
>
|
|
1866
|
+
| undefined
|
|
1867
|
+
}
|
|
1868
|
+
|
|
1869
|
+
type ReturnType<
|
|
1870
|
+
config extends Config = Config,
|
|
1871
|
+
context = unknown,
|
|
1872
|
+
> = UseMutationResult<
|
|
1873
|
+
Actions.token.setRoleAdmin.ReturnValue,
|
|
1874
|
+
Actions.token.setRoleAdmin.ErrorType,
|
|
1875
|
+
Actions.token.setRoleAdmin.Parameters<config>,
|
|
1876
|
+
context
|
|
1877
|
+
>
|
|
1878
|
+
}
|
|
1879
|
+
|
|
1880
|
+
/**
|
|
1881
|
+
* Hook for setting the admin role for a specific role in a TIP20 token.
|
|
1882
|
+
*
|
|
1883
|
+
* Note: This is a synchronous hook that waits for the transaction
|
|
1884
|
+
* to be included on a block before returning a response.
|
|
1885
|
+
*
|
|
1886
|
+
* @example
|
|
1887
|
+
* ```tsx
|
|
1888
|
+
* import { Hooks } from 'wagmi/tempo'
|
|
1889
|
+
*
|
|
1890
|
+
* function App() {
|
|
1891
|
+
* const { mutate, isPending } = Hooks.token.useSetRoleAdminSync()
|
|
1892
|
+
*
|
|
1893
|
+
* return (
|
|
1894
|
+
* <button
|
|
1895
|
+
* onClick={() => mutate({ token: '0x...', role: 'issuer', adminRole: 'pause' })}
|
|
1896
|
+
* disabled={isPending}
|
|
1897
|
+
* >
|
|
1898
|
+
* Set Role Admin
|
|
1899
|
+
* </button>
|
|
1900
|
+
* )
|
|
1901
|
+
* }
|
|
1902
|
+
* ```
|
|
1903
|
+
*
|
|
1904
|
+
* @param parameters - Parameters.
|
|
1905
|
+
* @returns Mutation result.
|
|
1906
|
+
*/
|
|
1907
|
+
export function useSetRoleAdminSync<
|
|
1908
|
+
config extends Config = ResolvedRegister['config'],
|
|
1909
|
+
context = unknown,
|
|
1910
|
+
>(
|
|
1911
|
+
parameters: useSetRoleAdminSync.Parameters<config, context> = {},
|
|
1912
|
+
): useSetRoleAdminSync.ReturnType<config, context> {
|
|
1913
|
+
const { mutation } = parameters
|
|
1914
|
+
const config = useConfig(parameters)
|
|
1915
|
+
return useMutation({
|
|
1916
|
+
...mutation,
|
|
1917
|
+
async mutationFn(variables) {
|
|
1918
|
+
return Actions.token.setRoleAdminSync(config, variables as never)
|
|
1919
|
+
},
|
|
1920
|
+
mutationKey: ['setRoleAdminSync'],
|
|
1921
|
+
}) as never
|
|
1922
|
+
}
|
|
1923
|
+
|
|
1924
|
+
export declare namespace useSetRoleAdminSync {
|
|
1925
|
+
type Parameters<
|
|
1926
|
+
config extends Config = Config,
|
|
1927
|
+
context = unknown,
|
|
1928
|
+
> = ConfigParameter<config> & {
|
|
1929
|
+
mutation?:
|
|
1930
|
+
| UseMutationParameters<
|
|
1931
|
+
Actions.token.setRoleAdminSync.ReturnValue,
|
|
1932
|
+
Actions.token.setRoleAdminSync.ErrorType,
|
|
1933
|
+
Actions.token.setRoleAdminSync.Parameters<config>,
|
|
1934
|
+
context
|
|
1935
|
+
>
|
|
1936
|
+
| undefined
|
|
1937
|
+
}
|
|
1938
|
+
|
|
1939
|
+
type ReturnType<
|
|
1940
|
+
config extends Config = Config,
|
|
1941
|
+
context = unknown,
|
|
1942
|
+
> = UseMutationResult<
|
|
1943
|
+
Actions.token.setRoleAdminSync.ReturnValue,
|
|
1944
|
+
Actions.token.setRoleAdminSync.ErrorType,
|
|
1945
|
+
Actions.token.setRoleAdminSync.Parameters<config>,
|
|
1946
|
+
context
|
|
1947
|
+
>
|
|
1948
|
+
}
|
|
1949
|
+
|
|
1950
|
+
/**
|
|
1951
|
+
* Hook for setting the supply cap for a TIP20 token.
|
|
1952
|
+
*
|
|
1953
|
+
* @example
|
|
1954
|
+
* ```tsx
|
|
1955
|
+
* import { Hooks } from 'wagmi/tempo'
|
|
1956
|
+
*
|
|
1957
|
+
* function App() {
|
|
1958
|
+
* const { mutate, isPending } = Hooks.token.useSetSupplyCap()
|
|
1959
|
+
*
|
|
1960
|
+
* return (
|
|
1961
|
+
* <button
|
|
1962
|
+
* onClick={() => mutate({ token: '0x...', supplyCap: 1000000n })}
|
|
1963
|
+
* disabled={isPending}
|
|
1964
|
+
* >
|
|
1965
|
+
* Set Supply Cap
|
|
1966
|
+
* </button>
|
|
1967
|
+
* )
|
|
1968
|
+
* }
|
|
1969
|
+
* ```
|
|
1970
|
+
*
|
|
1971
|
+
* @param parameters - Parameters.
|
|
1972
|
+
* @returns Mutation result.
|
|
1973
|
+
*/
|
|
1974
|
+
export function useSetSupplyCap<
|
|
1975
|
+
config extends Config = ResolvedRegister['config'],
|
|
1976
|
+
context = unknown,
|
|
1977
|
+
>(
|
|
1978
|
+
parameters: useSetSupplyCap.Parameters<config, context> = {},
|
|
1979
|
+
): useSetSupplyCap.ReturnType<config, context> {
|
|
1980
|
+
const { mutation } = parameters
|
|
1981
|
+
const config = useConfig(parameters)
|
|
1982
|
+
return useMutation({
|
|
1983
|
+
...mutation,
|
|
1984
|
+
async mutationFn(variables) {
|
|
1985
|
+
return Actions.token.setSupplyCap(config, variables as never)
|
|
1986
|
+
},
|
|
1987
|
+
mutationKey: ['setSupplyCap'],
|
|
1988
|
+
}) as never
|
|
1989
|
+
}
|
|
1990
|
+
|
|
1991
|
+
export declare namespace useSetSupplyCap {
|
|
1992
|
+
type Parameters<
|
|
1993
|
+
config extends Config = Config,
|
|
1994
|
+
context = unknown,
|
|
1995
|
+
> = ConfigParameter<config> & {
|
|
1996
|
+
mutation?:
|
|
1997
|
+
| UseMutationParameters<
|
|
1998
|
+
Actions.token.setSupplyCap.ReturnValue,
|
|
1999
|
+
Actions.token.setSupplyCap.ErrorType,
|
|
2000
|
+
Actions.token.setSupplyCap.Parameters<config>,
|
|
2001
|
+
context
|
|
2002
|
+
>
|
|
2003
|
+
| undefined
|
|
2004
|
+
}
|
|
2005
|
+
|
|
2006
|
+
type ReturnType<
|
|
2007
|
+
config extends Config = Config,
|
|
2008
|
+
context = unknown,
|
|
2009
|
+
> = UseMutationResult<
|
|
2010
|
+
Actions.token.setSupplyCap.ReturnValue,
|
|
2011
|
+
Actions.token.setSupplyCap.ErrorType,
|
|
2012
|
+
Actions.token.setSupplyCap.Parameters<config>,
|
|
2013
|
+
context
|
|
2014
|
+
>
|
|
2015
|
+
}
|
|
2016
|
+
|
|
2017
|
+
/**
|
|
2018
|
+
* Hook for setting the supply cap for a TIP20 token.
|
|
2019
|
+
*
|
|
2020
|
+
* Note: This is a synchronous hook that waits for the transaction
|
|
2021
|
+
* to be included on a block before returning a response.
|
|
2022
|
+
*
|
|
2023
|
+
* @example
|
|
2024
|
+
* ```tsx
|
|
2025
|
+
* import { Hooks } from 'wagmi/tempo'
|
|
2026
|
+
*
|
|
2027
|
+
* function App() {
|
|
2028
|
+
* const { mutate, isPending } = Hooks.token.useSetSupplyCapSync()
|
|
2029
|
+
*
|
|
2030
|
+
* return (
|
|
2031
|
+
* <button
|
|
2032
|
+
* onClick={() => mutate({ token: '0x...', supplyCap: 1000000n })}
|
|
2033
|
+
* disabled={isPending}
|
|
2034
|
+
* >
|
|
2035
|
+
* Set Supply Cap
|
|
2036
|
+
* </button>
|
|
2037
|
+
* )
|
|
2038
|
+
* }
|
|
2039
|
+
* ```
|
|
2040
|
+
*
|
|
2041
|
+
* @param parameters - Parameters.
|
|
2042
|
+
* @returns Mutation result.
|
|
2043
|
+
*/
|
|
2044
|
+
export function useSetSupplyCapSync<
|
|
2045
|
+
config extends Config = ResolvedRegister['config'],
|
|
2046
|
+
context = unknown,
|
|
2047
|
+
>(
|
|
2048
|
+
parameters: useSetSupplyCapSync.Parameters<config, context> = {},
|
|
2049
|
+
): useSetSupplyCapSync.ReturnType<config, context> {
|
|
2050
|
+
const { mutation } = parameters
|
|
2051
|
+
const config = useConfig(parameters)
|
|
2052
|
+
return useMutation({
|
|
2053
|
+
...mutation,
|
|
2054
|
+
async mutationFn(variables) {
|
|
2055
|
+
return Actions.token.setSupplyCapSync(config, variables as never)
|
|
2056
|
+
},
|
|
2057
|
+
mutationKey: ['setSupplyCapSync'],
|
|
2058
|
+
}) as never
|
|
2059
|
+
}
|
|
2060
|
+
|
|
2061
|
+
export declare namespace useSetSupplyCapSync {
|
|
2062
|
+
type Parameters<
|
|
2063
|
+
config extends Config = Config,
|
|
2064
|
+
context = unknown,
|
|
2065
|
+
> = ConfigParameter<config> & {
|
|
2066
|
+
mutation?:
|
|
2067
|
+
| UseMutationParameters<
|
|
2068
|
+
Actions.token.setSupplyCapSync.ReturnValue,
|
|
2069
|
+
Actions.token.setSupplyCapSync.ErrorType,
|
|
2070
|
+
Actions.token.setSupplyCapSync.Parameters<config>,
|
|
2071
|
+
context
|
|
2072
|
+
>
|
|
2073
|
+
| undefined
|
|
2074
|
+
}
|
|
2075
|
+
|
|
2076
|
+
type ReturnType<
|
|
2077
|
+
config extends Config = Config,
|
|
2078
|
+
context = unknown,
|
|
2079
|
+
> = UseMutationResult<
|
|
2080
|
+
Actions.token.setSupplyCapSync.ReturnValue,
|
|
2081
|
+
Actions.token.setSupplyCapSync.ErrorType,
|
|
2082
|
+
Actions.token.setSupplyCapSync.Parameters<config>,
|
|
2083
|
+
context
|
|
2084
|
+
>
|
|
2085
|
+
}
|
|
2086
|
+
|
|
2087
|
+
/**
|
|
2088
|
+
* Hook for transferring TIP20 tokens to another address.
|
|
2089
|
+
*
|
|
2090
|
+
* @example
|
|
2091
|
+
* ```tsx
|
|
2092
|
+
* import { Hooks } from 'wagmi/tempo'
|
|
2093
|
+
*
|
|
2094
|
+
* function App() {
|
|
2095
|
+
* const { mutate, isPending } = Hooks.token.useTransfer()
|
|
2096
|
+
*
|
|
2097
|
+
* return (
|
|
2098
|
+
* <button
|
|
2099
|
+
* onClick={() => mutate({ to: '0x...', amount: 100n })}
|
|
2100
|
+
* disabled={isPending}
|
|
2101
|
+
* >
|
|
2102
|
+
* Transfer
|
|
2103
|
+
* </button>
|
|
2104
|
+
* )
|
|
2105
|
+
* }
|
|
2106
|
+
* ```
|
|
2107
|
+
*
|
|
2108
|
+
* @param parameters - Parameters.
|
|
2109
|
+
* @returns Mutation result.
|
|
2110
|
+
*/
|
|
2111
|
+
export function useTransfer<
|
|
2112
|
+
config extends Config = ResolvedRegister['config'],
|
|
2113
|
+
context = unknown,
|
|
2114
|
+
>(
|
|
2115
|
+
parameters: useTransfer.Parameters<config, context> = {},
|
|
2116
|
+
): useTransfer.ReturnType<config, context> {
|
|
2117
|
+
const { mutation } = parameters
|
|
2118
|
+
const config = useConfig(parameters)
|
|
2119
|
+
return useMutation({
|
|
2120
|
+
...mutation,
|
|
2121
|
+
async mutationFn(variables) {
|
|
2122
|
+
return Actions.token.transfer(config, variables as never)
|
|
2123
|
+
},
|
|
2124
|
+
mutationKey: ['transfer'],
|
|
2125
|
+
}) as never
|
|
2126
|
+
}
|
|
2127
|
+
|
|
2128
|
+
export declare namespace useTransfer {
|
|
2129
|
+
type Parameters<
|
|
2130
|
+
config extends Config = Config,
|
|
2131
|
+
context = unknown,
|
|
2132
|
+
> = ConfigParameter<config> & {
|
|
2133
|
+
mutation?:
|
|
2134
|
+
| UseMutationParameters<
|
|
2135
|
+
Actions.token.transfer.ReturnValue,
|
|
2136
|
+
Actions.token.transfer.ErrorType,
|
|
2137
|
+
Actions.token.transfer.Parameters<config>,
|
|
2138
|
+
context
|
|
2139
|
+
>
|
|
2140
|
+
| undefined
|
|
2141
|
+
}
|
|
2142
|
+
|
|
2143
|
+
type ReturnType<
|
|
2144
|
+
config extends Config = Config,
|
|
2145
|
+
context = unknown,
|
|
2146
|
+
> = UseMutationResult<
|
|
2147
|
+
Actions.token.transfer.ReturnValue,
|
|
2148
|
+
Actions.token.transfer.ErrorType,
|
|
2149
|
+
Actions.token.transfer.Parameters<config>,
|
|
2150
|
+
context
|
|
2151
|
+
>
|
|
2152
|
+
}
|
|
2153
|
+
|
|
2154
|
+
/**
|
|
2155
|
+
* Hook for transferring TIP20 tokens to another address.
|
|
2156
|
+
*
|
|
2157
|
+
* Note: This is a synchronous hook that waits for the transaction
|
|
2158
|
+
* to be included on a block before returning a response.
|
|
2159
|
+
*
|
|
2160
|
+
* @example
|
|
2161
|
+
* ```tsx
|
|
2162
|
+
* import { Hooks } from 'wagmi/tempo'
|
|
2163
|
+
*
|
|
2164
|
+
* function App() {
|
|
2165
|
+
* const { mutate, isPending } = Hooks.token.useTransferSync()
|
|
2166
|
+
*
|
|
2167
|
+
* return (
|
|
2168
|
+
* <button
|
|
2169
|
+
* onClick={() => mutate({ to: '0x...', amount: 100n })}
|
|
2170
|
+
* disabled={isPending}
|
|
2171
|
+
* >
|
|
2172
|
+
* Transfer
|
|
2173
|
+
* </button>
|
|
2174
|
+
* )
|
|
2175
|
+
* }
|
|
2176
|
+
* ```
|
|
2177
|
+
*
|
|
2178
|
+
* @param parameters - Parameters.
|
|
2179
|
+
* @returns Mutation result.
|
|
2180
|
+
*/
|
|
2181
|
+
export function useTransferSync<
|
|
2182
|
+
config extends Config = ResolvedRegister['config'],
|
|
2183
|
+
context = unknown,
|
|
2184
|
+
>(
|
|
2185
|
+
parameters: useTransferSync.Parameters<config, context> = {},
|
|
2186
|
+
): useTransferSync.ReturnType<config, context> {
|
|
2187
|
+
const { mutation } = parameters
|
|
2188
|
+
const config = useConfig(parameters)
|
|
2189
|
+
return useMutation({
|
|
2190
|
+
...mutation,
|
|
2191
|
+
async mutationFn(variables) {
|
|
2192
|
+
return Actions.token.transferSync(config, variables as never)
|
|
2193
|
+
},
|
|
2194
|
+
mutationKey: ['transferSync'],
|
|
2195
|
+
}) as never
|
|
2196
|
+
}
|
|
2197
|
+
|
|
2198
|
+
export declare namespace useTransferSync {
|
|
2199
|
+
type Parameters<
|
|
2200
|
+
config extends Config = Config,
|
|
2201
|
+
context = unknown,
|
|
2202
|
+
> = ConfigParameter<config> & {
|
|
2203
|
+
mutation?:
|
|
2204
|
+
| UseMutationParameters<
|
|
2205
|
+
Actions.token.transferSync.ReturnValue,
|
|
2206
|
+
Actions.token.transferSync.ErrorType,
|
|
2207
|
+
Actions.token.transferSync.Parameters<config>,
|
|
2208
|
+
context
|
|
2209
|
+
>
|
|
2210
|
+
| undefined
|
|
2211
|
+
}
|
|
2212
|
+
|
|
2213
|
+
type ReturnType<
|
|
2214
|
+
config extends Config = Config,
|
|
2215
|
+
context = unknown,
|
|
2216
|
+
> = UseMutationResult<
|
|
2217
|
+
Actions.token.transferSync.ReturnValue,
|
|
2218
|
+
Actions.token.transferSync.ErrorType,
|
|
2219
|
+
Actions.token.transferSync.Parameters<config>,
|
|
2220
|
+
context
|
|
2221
|
+
>
|
|
2222
|
+
}
|
|
2223
|
+
|
|
2224
|
+
/**
|
|
2225
|
+
* Hook for unpausing a TIP20 token.
|
|
2226
|
+
*
|
|
2227
|
+
* @example
|
|
2228
|
+
* ```tsx
|
|
2229
|
+
* import { Hooks } from 'wagmi/tempo'
|
|
2230
|
+
*
|
|
2231
|
+
* function App() {
|
|
2232
|
+
* const { mutate, isPending } = Hooks.token.useUnpause()
|
|
2233
|
+
*
|
|
2234
|
+
* return (
|
|
2235
|
+
* <button
|
|
2236
|
+
* onClick={() => mutate({ token: '0x...' })}
|
|
2237
|
+
* disabled={isPending}
|
|
2238
|
+
* >
|
|
2239
|
+
* Unpause
|
|
2240
|
+
* </button>
|
|
2241
|
+
* )
|
|
2242
|
+
* }
|
|
2243
|
+
* ```
|
|
2244
|
+
*
|
|
2245
|
+
* @param parameters - Parameters.
|
|
2246
|
+
* @returns Mutation result.
|
|
2247
|
+
*/
|
|
2248
|
+
export function useUnpause<
|
|
2249
|
+
config extends Config = ResolvedRegister['config'],
|
|
2250
|
+
context = unknown,
|
|
2251
|
+
>(
|
|
2252
|
+
parameters: useUnpause.Parameters<config, context> = {},
|
|
2253
|
+
): useUnpause.ReturnType<config, context> {
|
|
2254
|
+
const { mutation } = parameters
|
|
2255
|
+
const config = useConfig(parameters)
|
|
2256
|
+
return useMutation({
|
|
2257
|
+
...mutation,
|
|
2258
|
+
async mutationFn(variables) {
|
|
2259
|
+
return Actions.token.unpause(config, variables as never)
|
|
2260
|
+
},
|
|
2261
|
+
mutationKey: ['unpause'],
|
|
2262
|
+
}) as never
|
|
2263
|
+
}
|
|
2264
|
+
|
|
2265
|
+
export declare namespace useUnpause {
|
|
2266
|
+
type Parameters<
|
|
2267
|
+
config extends Config = Config,
|
|
2268
|
+
context = unknown,
|
|
2269
|
+
> = ConfigParameter<config> & {
|
|
2270
|
+
mutation?:
|
|
2271
|
+
| UseMutationParameters<
|
|
2272
|
+
Actions.token.unpause.ReturnValue,
|
|
2273
|
+
Actions.token.unpause.ErrorType,
|
|
2274
|
+
Actions.token.unpause.Parameters<config>,
|
|
2275
|
+
context
|
|
2276
|
+
>
|
|
2277
|
+
| undefined
|
|
2278
|
+
}
|
|
2279
|
+
|
|
2280
|
+
type ReturnType<
|
|
2281
|
+
config extends Config = Config,
|
|
2282
|
+
context = unknown,
|
|
2283
|
+
> = UseMutationResult<
|
|
2284
|
+
Actions.token.unpause.ReturnValue,
|
|
2285
|
+
Actions.token.unpause.ErrorType,
|
|
2286
|
+
Actions.token.unpause.Parameters<config>,
|
|
2287
|
+
context
|
|
2288
|
+
>
|
|
2289
|
+
}
|
|
2290
|
+
|
|
2291
|
+
/**
|
|
2292
|
+
* Hook for unpausing a TIP20 token.
|
|
2293
|
+
*
|
|
2294
|
+
* Note: This is a synchronous hook that waits for the transaction
|
|
2295
|
+
* to be included on a block before returning a response.
|
|
2296
|
+
*
|
|
2297
|
+
* @example
|
|
2298
|
+
* ```tsx
|
|
2299
|
+
* import { Hooks } from 'wagmi/tempo'
|
|
2300
|
+
*
|
|
2301
|
+
* function App() {
|
|
2302
|
+
* const { mutate, isPending } = Hooks.token.useUnpauseSync()
|
|
2303
|
+
*
|
|
2304
|
+
* return (
|
|
2305
|
+
* <button
|
|
2306
|
+
* onClick={() => mutate({ token: '0x...' })}
|
|
2307
|
+
* disabled={isPending}
|
|
2308
|
+
* >
|
|
2309
|
+
* Unpause
|
|
2310
|
+
* </button>
|
|
2311
|
+
* )
|
|
2312
|
+
* }
|
|
2313
|
+
* ```
|
|
2314
|
+
*
|
|
2315
|
+
* @param parameters - Parameters.
|
|
2316
|
+
* @returns Mutation result.
|
|
2317
|
+
*/
|
|
2318
|
+
export function useUnpauseSync<
|
|
2319
|
+
config extends Config = ResolvedRegister['config'],
|
|
2320
|
+
context = unknown,
|
|
2321
|
+
>(
|
|
2322
|
+
parameters: useUnpauseSync.Parameters<config, context> = {},
|
|
2323
|
+
): useUnpauseSync.ReturnType<config, context> {
|
|
2324
|
+
const { mutation } = parameters
|
|
2325
|
+
const config = useConfig(parameters)
|
|
2326
|
+
return useMutation({
|
|
2327
|
+
...mutation,
|
|
2328
|
+
async mutationFn(variables) {
|
|
2329
|
+
return Actions.token.unpauseSync(config, variables as never)
|
|
2330
|
+
},
|
|
2331
|
+
mutationKey: ['unpauseSync'],
|
|
2332
|
+
}) as never
|
|
2333
|
+
}
|
|
2334
|
+
|
|
2335
|
+
export declare namespace useUnpauseSync {
|
|
2336
|
+
type Parameters<
|
|
2337
|
+
config extends Config = Config,
|
|
2338
|
+
context = unknown,
|
|
2339
|
+
> = ConfigParameter<config> & {
|
|
2340
|
+
mutation?:
|
|
2341
|
+
| UseMutationParameters<
|
|
2342
|
+
Actions.token.unpauseSync.ReturnValue,
|
|
2343
|
+
Actions.token.unpauseSync.ErrorType,
|
|
2344
|
+
Actions.token.unpauseSync.Parameters<config>,
|
|
2345
|
+
context
|
|
2346
|
+
>
|
|
2347
|
+
| undefined
|
|
2348
|
+
}
|
|
2349
|
+
|
|
2350
|
+
type ReturnType<
|
|
2351
|
+
config extends Config = Config,
|
|
2352
|
+
context = unknown,
|
|
2353
|
+
> = UseMutationResult<
|
|
2354
|
+
Actions.token.unpauseSync.ReturnValue,
|
|
2355
|
+
Actions.token.unpauseSync.ErrorType,
|
|
2356
|
+
Actions.token.unpauseSync.Parameters<config>,
|
|
2357
|
+
context
|
|
2358
|
+
>
|
|
2359
|
+
}
|
|
2360
|
+
|
|
2361
|
+
/**
|
|
2362
|
+
* Hook for preparing the quote token update for a TIP20 token.
|
|
2363
|
+
*
|
|
2364
|
+
* @example
|
|
2365
|
+
* ```tsx
|
|
2366
|
+
* import { Hooks } from 'wagmi/tempo'
|
|
2367
|
+
*
|
|
2368
|
+
* function App() {
|
|
2369
|
+
* const { mutate, isPending } = Hooks.token.usePrepareUpdateQuoteToken()
|
|
2370
|
+
*
|
|
2371
|
+
* return (
|
|
2372
|
+
* <button
|
|
2373
|
+
* onClick={() => mutate({ token: '0x...', quoteToken: '0x...' })}
|
|
2374
|
+
* disabled={isPending}
|
|
2375
|
+
* >
|
|
2376
|
+
* Prepare Update Quote Token
|
|
2377
|
+
* </button>
|
|
2378
|
+
* )
|
|
2379
|
+
* }
|
|
2380
|
+
* ```
|
|
2381
|
+
*
|
|
2382
|
+
* @param parameters - Parameters.
|
|
2383
|
+
* @returns Mutation result.
|
|
2384
|
+
*/
|
|
2385
|
+
export function usePrepareUpdateQuoteToken<
|
|
2386
|
+
config extends Config = ResolvedRegister['config'],
|
|
2387
|
+
context = unknown,
|
|
2388
|
+
>(
|
|
2389
|
+
parameters: usePrepareUpdateQuoteToken.Parameters<config, context> = {},
|
|
2390
|
+
): usePrepareUpdateQuoteToken.ReturnType<config, context> {
|
|
2391
|
+
const { mutation } = parameters
|
|
2392
|
+
const config = useConfig(parameters)
|
|
2393
|
+
return useMutation({
|
|
2394
|
+
...mutation,
|
|
2395
|
+
async mutationFn(variables) {
|
|
2396
|
+
return Actions.token.prepareUpdateQuoteToken(config, variables as never)
|
|
2397
|
+
},
|
|
2398
|
+
mutationKey: ['prepareUpdateQuoteToken'],
|
|
2399
|
+
}) as never
|
|
2400
|
+
}
|
|
2401
|
+
|
|
2402
|
+
export declare namespace usePrepareUpdateQuoteToken {
|
|
2403
|
+
type Parameters<
|
|
2404
|
+
config extends Config = Config,
|
|
2405
|
+
context = unknown,
|
|
2406
|
+
> = ConfigParameter<config> & {
|
|
2407
|
+
mutation?:
|
|
2408
|
+
| UseMutationParameters<
|
|
2409
|
+
Actions.token.prepareUpdateQuoteToken.ReturnValue,
|
|
2410
|
+
Actions.token.prepareUpdateQuoteToken.ErrorType,
|
|
2411
|
+
Actions.token.prepareUpdateQuoteToken.Parameters<config>,
|
|
2412
|
+
context
|
|
2413
|
+
>
|
|
2414
|
+
| undefined
|
|
2415
|
+
}
|
|
2416
|
+
|
|
2417
|
+
type ReturnType<
|
|
2418
|
+
config extends Config = Config,
|
|
2419
|
+
context = unknown,
|
|
2420
|
+
> = UseMutationResult<
|
|
2421
|
+
Actions.token.prepareUpdateQuoteToken.ReturnValue,
|
|
2422
|
+
Actions.token.prepareUpdateQuoteToken.ErrorType,
|
|
2423
|
+
Actions.token.prepareUpdateQuoteToken.Parameters<config>,
|
|
2424
|
+
context
|
|
2425
|
+
>
|
|
2426
|
+
}
|
|
2427
|
+
|
|
2428
|
+
/**
|
|
2429
|
+
* Hook for preparing the quote token update for a TIP20 token.
|
|
2430
|
+
*
|
|
2431
|
+
* Note: This is a synchronous hook that waits for the transaction
|
|
2432
|
+
* to be included on a block before returning a response.
|
|
2433
|
+
*
|
|
2434
|
+
* @example
|
|
2435
|
+
* ```tsx
|
|
2436
|
+
* import { Hooks } from 'wagmi/tempo'
|
|
2437
|
+
*
|
|
2438
|
+
* function App() {
|
|
2439
|
+
* const { mutate, isPending } = Hooks.token.usePrepareUpdateQuoteTokenSync()
|
|
2440
|
+
*
|
|
2441
|
+
* return (
|
|
2442
|
+
* <button
|
|
2443
|
+
* onClick={() => mutate({ token: '0x...', quoteToken: '0x...' })}
|
|
2444
|
+
* disabled={isPending}
|
|
2445
|
+
* >
|
|
2446
|
+
* Prepare Update Quote Token
|
|
2447
|
+
* </button>
|
|
2448
|
+
* )
|
|
2449
|
+
* }
|
|
2450
|
+
* ```
|
|
2451
|
+
*
|
|
2452
|
+
* @param parameters - Parameters.
|
|
2453
|
+
* @returns Mutation result.
|
|
2454
|
+
*/
|
|
2455
|
+
export function usePrepareUpdateQuoteTokenSync<
|
|
2456
|
+
config extends Config = ResolvedRegister['config'],
|
|
2457
|
+
context = unknown,
|
|
2458
|
+
>(
|
|
2459
|
+
parameters: usePrepareUpdateQuoteTokenSync.Parameters<config, context> = {},
|
|
2460
|
+
): usePrepareUpdateQuoteTokenSync.ReturnType<config, context> {
|
|
2461
|
+
const { mutation } = parameters
|
|
2462
|
+
const config = useConfig(parameters)
|
|
2463
|
+
return useMutation({
|
|
2464
|
+
...mutation,
|
|
2465
|
+
async mutationFn(variables) {
|
|
2466
|
+
return Actions.token.prepareUpdateQuoteTokenSync(
|
|
2467
|
+
config,
|
|
2468
|
+
variables as never,
|
|
2469
|
+
)
|
|
2470
|
+
},
|
|
2471
|
+
mutationKey: ['prepareUpdateQuoteTokenSync'],
|
|
2472
|
+
}) as never
|
|
2473
|
+
}
|
|
2474
|
+
|
|
2475
|
+
export declare namespace usePrepareUpdateQuoteTokenSync {
|
|
2476
|
+
type Parameters<
|
|
2477
|
+
config extends Config = Config,
|
|
2478
|
+
context = unknown,
|
|
2479
|
+
> = ConfigParameter<config> & {
|
|
2480
|
+
mutation?:
|
|
2481
|
+
| UseMutationParameters<
|
|
2482
|
+
Actions.token.prepareUpdateQuoteTokenSync.ReturnValue,
|
|
2483
|
+
Actions.token.prepareUpdateQuoteTokenSync.ErrorType,
|
|
2484
|
+
Actions.token.prepareUpdateQuoteTokenSync.Parameters<config>,
|
|
2485
|
+
context
|
|
2486
|
+
>
|
|
2487
|
+
| undefined
|
|
2488
|
+
}
|
|
2489
|
+
|
|
2490
|
+
type ReturnType<
|
|
2491
|
+
config extends Config = Config,
|
|
2492
|
+
context = unknown,
|
|
2493
|
+
> = UseMutationResult<
|
|
2494
|
+
Actions.token.prepareUpdateQuoteTokenSync.ReturnValue,
|
|
2495
|
+
Actions.token.prepareUpdateQuoteTokenSync.ErrorType,
|
|
2496
|
+
Actions.token.prepareUpdateQuoteTokenSync.Parameters<config>,
|
|
2497
|
+
context
|
|
2498
|
+
>
|
|
2499
|
+
}
|
|
2500
|
+
|
|
2501
|
+
/**
|
|
2502
|
+
* Hook for watching TIP20 token role admin updates.
|
|
2503
|
+
*
|
|
2504
|
+
* @example
|
|
2505
|
+
* ```tsx
|
|
2506
|
+
* import { Hooks } from 'wagmi/tempo'
|
|
2507
|
+
*
|
|
2508
|
+
* function App() {
|
|
2509
|
+
* Hooks.token.useWatchAdminRole({
|
|
2510
|
+
* onRoleAdminUpdated(args) {
|
|
2511
|
+
* console.log('Role admin updated:', args)
|
|
2512
|
+
* },
|
|
2513
|
+
* })
|
|
2514
|
+
*
|
|
2515
|
+
* return <div>Watching for role admin updates...</div>
|
|
2516
|
+
* }
|
|
2517
|
+
* ```
|
|
2518
|
+
*
|
|
2519
|
+
* @param parameters - Parameters.
|
|
2520
|
+
*/
|
|
2521
|
+
export function useWatchAdminRole<
|
|
2522
|
+
config extends Config = ResolvedRegister['config'],
|
|
2523
|
+
>(parameters: useWatchAdminRole.Parameters<config> = {}) {
|
|
2524
|
+
const { enabled = true, onRoleAdminUpdated, token, ...rest } = parameters
|
|
2525
|
+
|
|
2526
|
+
const config = useConfig({ config: parameters.config })
|
|
2527
|
+
const configChainId = useChainId({ config })
|
|
2528
|
+
const chainId = parameters.chainId ?? configChainId
|
|
2529
|
+
|
|
2530
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: rest.x is explicitly listed
|
|
2531
|
+
useEffect(() => {
|
|
2532
|
+
if (!enabled) return
|
|
2533
|
+
if (!onRoleAdminUpdated) return
|
|
2534
|
+
if (!token) return
|
|
2535
|
+
return Actions.token.watchAdminRole(config, {
|
|
2536
|
+
...rest,
|
|
2537
|
+
chainId,
|
|
2538
|
+
onRoleAdminUpdated,
|
|
2539
|
+
token,
|
|
2540
|
+
})
|
|
2541
|
+
}, [
|
|
2542
|
+
config,
|
|
2543
|
+
enabled,
|
|
2544
|
+
chainId,
|
|
2545
|
+
token,
|
|
2546
|
+
onRoleAdminUpdated,
|
|
2547
|
+
rest.fromBlock,
|
|
2548
|
+
rest.onError,
|
|
2549
|
+
rest.poll,
|
|
2550
|
+
rest.pollingInterval,
|
|
2551
|
+
])
|
|
2552
|
+
}
|
|
2553
|
+
|
|
2554
|
+
export declare namespace useWatchAdminRole {
|
|
2555
|
+
type Parameters<config extends Config = Config> = UnionCompute<
|
|
2556
|
+
ExactPartial<Actions.token.watchAdminRole.Parameters<config>> &
|
|
2557
|
+
ConfigParameter<config> & { enabled?: boolean | undefined }
|
|
2558
|
+
>
|
|
2559
|
+
}
|
|
2560
|
+
|
|
2561
|
+
/**
|
|
2562
|
+
* Hook for watching TIP20 token approval events.
|
|
2563
|
+
*
|
|
2564
|
+
* @example
|
|
2565
|
+
* ```tsx
|
|
2566
|
+
* import { Hooks } from 'wagmi/tempo'
|
|
2567
|
+
*
|
|
2568
|
+
* function App() {
|
|
2569
|
+
* Hooks.token.useWatchApprove({
|
|
2570
|
+
* onApproval(args) {
|
|
2571
|
+
* console.log('Approval:', args)
|
|
2572
|
+
* },
|
|
2573
|
+
* })
|
|
2574
|
+
*
|
|
2575
|
+
* return <div>Watching for approvals...</div>
|
|
2576
|
+
* }
|
|
2577
|
+
* ```
|
|
2578
|
+
*
|
|
2579
|
+
* @param parameters - Parameters.
|
|
2580
|
+
*/
|
|
2581
|
+
export function useWatchApprove<
|
|
2582
|
+
config extends Config = ResolvedRegister['config'],
|
|
2583
|
+
>(parameters: useWatchApprove.Parameters<config> = {}) {
|
|
2584
|
+
const { enabled = true, onApproval, token, ...rest } = parameters
|
|
2585
|
+
|
|
2586
|
+
const config = useConfig({ config: parameters.config })
|
|
2587
|
+
const configChainId = useChainId({ config })
|
|
2588
|
+
const chainId = parameters.chainId ?? configChainId
|
|
2589
|
+
|
|
2590
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: rest.x is explicitly listed
|
|
2591
|
+
useEffect(() => {
|
|
2592
|
+
if (!enabled) return
|
|
2593
|
+
if (!onApproval) return
|
|
2594
|
+
if (!token) return
|
|
2595
|
+
return Actions.token.watchApprove(config, {
|
|
2596
|
+
...rest,
|
|
2597
|
+
chainId,
|
|
2598
|
+
onApproval,
|
|
2599
|
+
token,
|
|
2600
|
+
})
|
|
2601
|
+
}, [
|
|
2602
|
+
config,
|
|
2603
|
+
enabled,
|
|
2604
|
+
chainId,
|
|
2605
|
+
token,
|
|
2606
|
+
onApproval,
|
|
2607
|
+
rest.fromBlock,
|
|
2608
|
+
rest.onError,
|
|
2609
|
+
rest.poll,
|
|
2610
|
+
rest.pollingInterval,
|
|
2611
|
+
])
|
|
2612
|
+
}
|
|
2613
|
+
|
|
2614
|
+
export declare namespace useWatchApprove {
|
|
2615
|
+
type Parameters<config extends Config = Config> = UnionCompute<
|
|
2616
|
+
ExactPartial<Actions.token.watchApprove.Parameters<config>> &
|
|
2617
|
+
ConfigParameter<config> & { enabled?: boolean | undefined }
|
|
2618
|
+
>
|
|
2619
|
+
}
|
|
2620
|
+
|
|
2621
|
+
/**
|
|
2622
|
+
* Hook for watching TIP20 token burn events.
|
|
2623
|
+
*
|
|
2624
|
+
* @example
|
|
2625
|
+
* ```tsx
|
|
2626
|
+
* import { Hooks } from 'wagmi/tempo'
|
|
2627
|
+
*
|
|
2628
|
+
* function App() {
|
|
2629
|
+
* Hooks.token.useWatchBurn({
|
|
2630
|
+
* onBurn(args) {
|
|
2631
|
+
* console.log('Burn:', args)
|
|
2632
|
+
* },
|
|
2633
|
+
* })
|
|
2634
|
+
*
|
|
2635
|
+
* return <div>Watching for burns...</div>
|
|
2636
|
+
* }
|
|
2637
|
+
* ```
|
|
2638
|
+
*
|
|
2639
|
+
* @param parameters - Parameters.
|
|
2640
|
+
*/
|
|
2641
|
+
export function useWatchBurn<
|
|
2642
|
+
config extends Config = ResolvedRegister['config'],
|
|
2643
|
+
>(parameters: useWatchBurn.Parameters<config> = {}) {
|
|
2644
|
+
const { enabled = true, onBurn, token, ...rest } = parameters
|
|
2645
|
+
|
|
2646
|
+
const config = useConfig({ config: parameters.config })
|
|
2647
|
+
const configChainId = useChainId({ config })
|
|
2648
|
+
const chainId = parameters.chainId ?? configChainId
|
|
2649
|
+
|
|
2650
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: rest.x is explicitly listed
|
|
2651
|
+
useEffect(() => {
|
|
2652
|
+
if (!enabled) return
|
|
2653
|
+
if (!onBurn) return
|
|
2654
|
+
if (!token) return
|
|
2655
|
+
return Actions.token.watchBurn(config, {
|
|
2656
|
+
...rest,
|
|
2657
|
+
chainId,
|
|
2658
|
+
onBurn,
|
|
2659
|
+
token,
|
|
2660
|
+
})
|
|
2661
|
+
}, [
|
|
2662
|
+
config,
|
|
2663
|
+
enabled,
|
|
2664
|
+
chainId,
|
|
2665
|
+
token,
|
|
2666
|
+
onBurn,
|
|
2667
|
+
rest.fromBlock,
|
|
2668
|
+
rest.onError,
|
|
2669
|
+
rest.poll,
|
|
2670
|
+
rest.pollingInterval,
|
|
2671
|
+
])
|
|
2672
|
+
}
|
|
2673
|
+
|
|
2674
|
+
export declare namespace useWatchBurn {
|
|
2675
|
+
type Parameters<config extends Config = Config> = UnionCompute<
|
|
2676
|
+
ExactPartial<Actions.token.watchBurn.Parameters<config>> &
|
|
2677
|
+
ConfigParameter<config> & { enabled?: boolean | undefined }
|
|
2678
|
+
>
|
|
2679
|
+
}
|
|
2680
|
+
|
|
2681
|
+
/**
|
|
2682
|
+
* Hook for watching new TIP20 tokens created.
|
|
2683
|
+
*
|
|
2684
|
+
* @example
|
|
2685
|
+
* ```tsx
|
|
2686
|
+
* import { Hooks } from 'wagmi/tempo'
|
|
2687
|
+
*
|
|
2688
|
+
* function App() {
|
|
2689
|
+
* Hooks.token.useWatchCreate({
|
|
2690
|
+
* onTokenCreated(args) {
|
|
2691
|
+
* console.log('Token created:', args)
|
|
2692
|
+
* },
|
|
2693
|
+
* })
|
|
2694
|
+
*
|
|
2695
|
+
* return <div>Watching for token creations...</div>
|
|
2696
|
+
* }
|
|
2697
|
+
* ```
|
|
2698
|
+
*
|
|
2699
|
+
* @param parameters - Parameters.
|
|
2700
|
+
*/
|
|
2701
|
+
export function useWatchCreate<
|
|
2702
|
+
config extends Config = ResolvedRegister['config'],
|
|
2703
|
+
>(parameters: useWatchCreate.Parameters<config> = {}) {
|
|
2704
|
+
const { enabled = true, onTokenCreated, ...rest } = parameters
|
|
2705
|
+
|
|
2706
|
+
const config = useConfig({ config: parameters.config })
|
|
2707
|
+
const configChainId = useChainId({ config })
|
|
2708
|
+
const chainId = parameters.chainId ?? configChainId
|
|
2709
|
+
|
|
2710
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: rest.x is explicitly listed
|
|
2711
|
+
useEffect(() => {
|
|
2712
|
+
if (!enabled) return
|
|
2713
|
+
if (!onTokenCreated) return
|
|
2714
|
+
return Actions.token.watchCreate(config, {
|
|
2715
|
+
...rest,
|
|
2716
|
+
chainId,
|
|
2717
|
+
onTokenCreated,
|
|
2718
|
+
})
|
|
2719
|
+
}, [
|
|
2720
|
+
config,
|
|
2721
|
+
enabled,
|
|
2722
|
+
chainId,
|
|
2723
|
+
onTokenCreated,
|
|
2724
|
+
rest.fromBlock,
|
|
2725
|
+
rest.onError,
|
|
2726
|
+
rest.poll,
|
|
2727
|
+
rest.pollingInterval,
|
|
2728
|
+
])
|
|
2729
|
+
}
|
|
2730
|
+
|
|
2731
|
+
export declare namespace useWatchCreate {
|
|
2732
|
+
type Parameters<config extends Config = Config> = UnionCompute<
|
|
2733
|
+
ExactPartial<Actions.token.watchCreate.Parameters<config>> &
|
|
2734
|
+
ConfigParameter<config> & { enabled?: boolean | undefined }
|
|
2735
|
+
>
|
|
2736
|
+
}
|
|
2737
|
+
|
|
2738
|
+
/**
|
|
2739
|
+
* Hook for watching TIP20 token mint events.
|
|
2740
|
+
*
|
|
2741
|
+
* @example
|
|
2742
|
+
* ```tsx
|
|
2743
|
+
* import { Hooks } from 'wagmi/tempo'
|
|
2744
|
+
*
|
|
2745
|
+
* function App() {
|
|
2746
|
+
* Hooks.token.useWatchMint({
|
|
2747
|
+
* onMint(args) {
|
|
2748
|
+
* console.log('Mint:', args)
|
|
2749
|
+
* },
|
|
2750
|
+
* })
|
|
2751
|
+
*
|
|
2752
|
+
* return <div>Watching for mints...</div>
|
|
2753
|
+
* }
|
|
2754
|
+
* ```
|
|
2755
|
+
*
|
|
2756
|
+
* @param parameters - Parameters.
|
|
2757
|
+
*/
|
|
2758
|
+
export function useWatchMint<
|
|
2759
|
+
config extends Config = ResolvedRegister['config'],
|
|
2760
|
+
>(parameters: useWatchMint.Parameters<config> = {}) {
|
|
2761
|
+
const { enabled = true, onMint, token, ...rest } = parameters
|
|
2762
|
+
|
|
2763
|
+
const config = useConfig({ config: parameters.config })
|
|
2764
|
+
const configChainId = useChainId({ config })
|
|
2765
|
+
const chainId = parameters.chainId ?? configChainId
|
|
2766
|
+
|
|
2767
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: rest.x is explicitly listed
|
|
2768
|
+
useEffect(() => {
|
|
2769
|
+
if (!enabled) return
|
|
2770
|
+
if (!onMint) return
|
|
2771
|
+
if (!token) return
|
|
2772
|
+
return Actions.token.watchMint(config, {
|
|
2773
|
+
...rest,
|
|
2774
|
+
chainId,
|
|
2775
|
+
onMint,
|
|
2776
|
+
token,
|
|
2777
|
+
})
|
|
2778
|
+
}, [
|
|
2779
|
+
config,
|
|
2780
|
+
enabled,
|
|
2781
|
+
chainId,
|
|
2782
|
+
token,
|
|
2783
|
+
onMint,
|
|
2784
|
+
rest.fromBlock,
|
|
2785
|
+
rest.onError,
|
|
2786
|
+
rest.poll,
|
|
2787
|
+
rest.pollingInterval,
|
|
2788
|
+
])
|
|
2789
|
+
}
|
|
2790
|
+
|
|
2791
|
+
export declare namespace useWatchMint {
|
|
2792
|
+
type Parameters<config extends Config = Config> = UnionCompute<
|
|
2793
|
+
ExactPartial<Actions.token.watchMint.Parameters<config>> &
|
|
2794
|
+
ConfigParameter<config> & { enabled?: boolean | undefined }
|
|
2795
|
+
>
|
|
2796
|
+
}
|
|
2797
|
+
|
|
2798
|
+
/**
|
|
2799
|
+
* Hook for watching TIP20 token role membership updates.
|
|
2800
|
+
*
|
|
2801
|
+
* @example
|
|
2802
|
+
* ```tsx
|
|
2803
|
+
* import { Hooks } from 'wagmi/tempo'
|
|
2804
|
+
*
|
|
2805
|
+
* function App() {
|
|
2806
|
+
* Hooks.token.useWatchRole({
|
|
2807
|
+
* onRoleUpdated(args) {
|
|
2808
|
+
* console.log('Role updated:', args)
|
|
2809
|
+
* },
|
|
2810
|
+
* })
|
|
2811
|
+
*
|
|
2812
|
+
* return <div>Watching for role updates...</div>
|
|
2813
|
+
* }
|
|
2814
|
+
* ```
|
|
2815
|
+
*
|
|
2816
|
+
* @param parameters - Parameters.
|
|
2817
|
+
*/
|
|
2818
|
+
export function useWatchRole<
|
|
2819
|
+
config extends Config = ResolvedRegister['config'],
|
|
2820
|
+
>(parameters: useWatchRole.Parameters<config> = {}) {
|
|
2821
|
+
const { enabled = true, onRoleUpdated, token, ...rest } = parameters
|
|
2822
|
+
|
|
2823
|
+
const config = useConfig({ config: parameters.config })
|
|
2824
|
+
const configChainId = useChainId({ config })
|
|
2825
|
+
const chainId = parameters.chainId ?? configChainId
|
|
2826
|
+
|
|
2827
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: rest.x is explicitly listed
|
|
2828
|
+
useEffect(() => {
|
|
2829
|
+
if (!enabled) return
|
|
2830
|
+
if (!onRoleUpdated) return
|
|
2831
|
+
if (!token) return
|
|
2832
|
+
return Actions.token.watchRole(config, {
|
|
2833
|
+
...rest,
|
|
2834
|
+
chainId,
|
|
2835
|
+
onRoleUpdated,
|
|
2836
|
+
token,
|
|
2837
|
+
})
|
|
2838
|
+
}, [
|
|
2839
|
+
config,
|
|
2840
|
+
enabled,
|
|
2841
|
+
chainId,
|
|
2842
|
+
token,
|
|
2843
|
+
onRoleUpdated,
|
|
2844
|
+
rest.fromBlock,
|
|
2845
|
+
rest.onError,
|
|
2846
|
+
rest.poll,
|
|
2847
|
+
rest.pollingInterval,
|
|
2848
|
+
])
|
|
2849
|
+
}
|
|
2850
|
+
|
|
2851
|
+
export declare namespace useWatchRole {
|
|
2852
|
+
type Parameters<config extends Config = Config> = UnionCompute<
|
|
2853
|
+
ExactPartial<Actions.token.watchRole.Parameters<config>> &
|
|
2854
|
+
ConfigParameter<config> & { enabled?: boolean | undefined }
|
|
2855
|
+
>
|
|
2856
|
+
}
|
|
2857
|
+
|
|
2858
|
+
/**
|
|
2859
|
+
* Hook for watching TIP20 token transfer events.
|
|
2860
|
+
*
|
|
2861
|
+
* @example
|
|
2862
|
+
* ```tsx
|
|
2863
|
+
* import { Hooks } from 'wagmi/tempo'
|
|
2864
|
+
*
|
|
2865
|
+
* function App() {
|
|
2866
|
+
* Hooks.token.useWatchTransfer({
|
|
2867
|
+
* onTransfer(args) {
|
|
2868
|
+
* console.log('Transfer:', args)
|
|
2869
|
+
* },
|
|
2870
|
+
* })
|
|
2871
|
+
*
|
|
2872
|
+
* return <div>Watching for transfers...</div>
|
|
2873
|
+
* }
|
|
2874
|
+
* ```
|
|
2875
|
+
*
|
|
2876
|
+
* @param parameters - Parameters.
|
|
2877
|
+
*/
|
|
2878
|
+
export function useWatchTransfer<
|
|
2879
|
+
config extends Config = ResolvedRegister['config'],
|
|
2880
|
+
>(parameters: useWatchTransfer.Parameters<config> = {}) {
|
|
2881
|
+
const { enabled = true, onTransfer, token, ...rest } = parameters
|
|
2882
|
+
|
|
2883
|
+
const config = useConfig({ config: parameters.config })
|
|
2884
|
+
const configChainId = useChainId({ config })
|
|
2885
|
+
const chainId = parameters.chainId ?? configChainId
|
|
2886
|
+
|
|
2887
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: rest.x is explicitly listed
|
|
2888
|
+
useEffect(() => {
|
|
2889
|
+
if (!enabled) return
|
|
2890
|
+
if (!onTransfer) return
|
|
2891
|
+
if (!token) return
|
|
2892
|
+
return Actions.token.watchTransfer(config, {
|
|
2893
|
+
...rest,
|
|
2894
|
+
chainId,
|
|
2895
|
+
onTransfer,
|
|
2896
|
+
token,
|
|
2897
|
+
})
|
|
2898
|
+
}, [
|
|
2899
|
+
config,
|
|
2900
|
+
enabled,
|
|
2901
|
+
chainId,
|
|
2902
|
+
token,
|
|
2903
|
+
onTransfer,
|
|
2904
|
+
rest.fromBlock,
|
|
2905
|
+
rest.onError,
|
|
2906
|
+
rest.poll,
|
|
2907
|
+
rest.pollingInterval,
|
|
2908
|
+
])
|
|
2909
|
+
}
|
|
2910
|
+
|
|
2911
|
+
export declare namespace useWatchTransfer {
|
|
2912
|
+
type Parameters<config extends Config = Config> = UnionCompute<
|
|
2913
|
+
ExactPartial<Actions.token.watchTransfer.Parameters<config>> &
|
|
2914
|
+
ConfigParameter<config> & { enabled?: boolean | undefined }
|
|
2915
|
+
>
|
|
2916
|
+
}
|
|
2917
|
+
|
|
2918
|
+
/**
|
|
2919
|
+
* Hook for watching TIP20 token quote token update events.
|
|
2920
|
+
*
|
|
2921
|
+
* @example
|
|
2922
|
+
* ```tsx
|
|
2923
|
+
* import { Hooks } from 'wagmi/tempo'
|
|
2924
|
+
*
|
|
2925
|
+
* function App() {
|
|
2926
|
+
* Hooks.token.useWatchUpdateQuoteToken({
|
|
2927
|
+
* onUpdateQuoteToken(args) {
|
|
2928
|
+
* if (args.completed)
|
|
2929
|
+
* console.log('quote token update completed:', args.newQuoteToken)
|
|
2930
|
+
* else
|
|
2931
|
+
* console.log('quote token update proposed:', args.newQuoteToken)
|
|
2932
|
+
* },
|
|
2933
|
+
* })
|
|
2934
|
+
*
|
|
2935
|
+
* return <div>Watching for quote token updates...</div>
|
|
2936
|
+
* }
|
|
2937
|
+
* ```
|
|
2938
|
+
*
|
|
2939
|
+
* @param parameters - Parameters.
|
|
2940
|
+
*/
|
|
2941
|
+
export function useWatchUpdateQuoteToken<
|
|
2942
|
+
config extends Config = ResolvedRegister['config'],
|
|
2943
|
+
>(parameters: useWatchUpdateQuoteToken.Parameters<config> = {}) {
|
|
2944
|
+
const { enabled = true, onUpdateQuoteToken, token, ...rest } = parameters
|
|
2945
|
+
|
|
2946
|
+
const config = useConfig({ config: parameters.config })
|
|
2947
|
+
const configChainId = useChainId({ config })
|
|
2948
|
+
const chainId = parameters.chainId ?? configChainId
|
|
2949
|
+
|
|
2950
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: rest.x is explicitly listed
|
|
2951
|
+
useEffect(() => {
|
|
2952
|
+
if (!enabled) return
|
|
2953
|
+
if (!onUpdateQuoteToken) return
|
|
2954
|
+
if (!token) return
|
|
2955
|
+
return Actions.token.watchUpdateQuoteToken(config, {
|
|
2956
|
+
...rest,
|
|
2957
|
+
chainId,
|
|
2958
|
+
onUpdateQuoteToken,
|
|
2959
|
+
token,
|
|
2960
|
+
})
|
|
2961
|
+
}, [
|
|
2962
|
+
config,
|
|
2963
|
+
enabled,
|
|
2964
|
+
chainId,
|
|
2965
|
+
token,
|
|
2966
|
+
onUpdateQuoteToken,
|
|
2967
|
+
rest.fromBlock,
|
|
2968
|
+
rest.onError,
|
|
2969
|
+
rest.poll,
|
|
2970
|
+
rest.pollingInterval,
|
|
2971
|
+
])
|
|
2972
|
+
}
|
|
2973
|
+
|
|
2974
|
+
export declare namespace useWatchUpdateQuoteToken {
|
|
2975
|
+
type Parameters<config extends Config = Config> = UnionCompute<
|
|
2976
|
+
ExactPartial<Actions.token.watchUpdateQuoteToken.Parameters<config>> &
|
|
2977
|
+
ConfigParameter<config> & { enabled?: boolean | undefined }
|
|
2978
|
+
>
|
|
2979
|
+
}
|