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.
Files changed (56) hide show
  1. package/dist/esm/exports/tempo.js +9 -0
  2. package/dist/esm/exports/tempo.js.map +1 -0
  3. package/dist/esm/tempo/Hooks/amm.js +534 -0
  4. package/dist/esm/tempo/Hooks/amm.js.map +1 -0
  5. package/dist/esm/tempo/Hooks/dex.js +944 -0
  6. package/dist/esm/tempo/Hooks/dex.js.map +1 -0
  7. package/dist/esm/tempo/Hooks/faucet.js +76 -0
  8. package/dist/esm/tempo/Hooks/faucet.js.map +1 -0
  9. package/dist/esm/tempo/Hooks/fee.js +155 -0
  10. package/dist/esm/tempo/Hooks/fee.js.map +1 -0
  11. package/dist/esm/tempo/Hooks/index.js +11 -0
  12. package/dist/esm/tempo/Hooks/index.js.map +1 -0
  13. package/dist/esm/tempo/Hooks/nonce.js +165 -0
  14. package/dist/esm/tempo/Hooks/nonce.js.map +1 -0
  15. package/dist/esm/tempo/Hooks/policy.js +545 -0
  16. package/dist/esm/tempo/Hooks/policy.js.map +1 -0
  17. package/dist/esm/tempo/Hooks/reward.js +385 -0
  18. package/dist/esm/tempo/Hooks/reward.js.map +1 -0
  19. package/dist/esm/tempo/Hooks/token.js +1730 -0
  20. package/dist/esm/tempo/Hooks/token.js.map +1 -0
  21. package/dist/esm/tsconfig.build.tsbuildinfo +1 -1
  22. package/dist/esm/version.js +1 -1
  23. package/dist/types/exports/tempo.d.ts +4 -0
  24. package/dist/types/exports/tempo.d.ts.map +1 -0
  25. package/dist/types/tempo/Hooks/amm.d.ts +410 -0
  26. package/dist/types/tempo/Hooks/amm.d.ts.map +1 -0
  27. package/dist/types/tempo/Hooks/dex.d.ts +773 -0
  28. package/dist/types/tempo/Hooks/dex.d.ts.map +1 -0
  29. package/dist/types/tempo/Hooks/faucet.d.ts +70 -0
  30. package/dist/types/tempo/Hooks/faucet.d.ts.map +1 -0
  31. package/dist/types/tempo/Hooks/fee.d.ts +123 -0
  32. package/dist/types/tempo/Hooks/fee.d.ts.map +1 -0
  33. package/dist/types/tempo/Hooks/index.d.ts +10 -0
  34. package/dist/types/tempo/Hooks/index.d.ts.map +1 -0
  35. package/dist/types/tempo/Hooks/nonce.d.ts +115 -0
  36. package/dist/types/tempo/Hooks/nonce.d.ts.map +1 -0
  37. package/dist/types/tempo/Hooks/policy.d.ts +422 -0
  38. package/dist/types/tempo/Hooks/policy.d.ts.map +1 -0
  39. package/dist/types/tempo/Hooks/reward.d.ts +304 -0
  40. package/dist/types/tempo/Hooks/reward.d.ts.map +1 -0
  41. package/dist/types/tempo/Hooks/token.d.ts +1387 -0
  42. package/dist/types/tempo/Hooks/token.d.ts.map +1 -0
  43. package/dist/types/version.d.ts +1 -1
  44. package/package.json +12 -4
  45. package/src/exports/tempo.ts +17 -0
  46. package/src/tempo/Hooks/amm.ts +835 -0
  47. package/src/tempo/Hooks/dex.ts +1597 -0
  48. package/src/tempo/Hooks/faucet.ts +142 -0
  49. package/src/tempo/Hooks/fee.ts +264 -0
  50. package/src/tempo/Hooks/index.ts +10 -0
  51. package/src/tempo/Hooks/nonce.ts +248 -0
  52. package/src/tempo/Hooks/policy.ts +907 -0
  53. package/src/tempo/Hooks/reward.ts +668 -0
  54. package/src/tempo/Hooks/token.ts +2979 -0
  55. package/src/version.ts +1 -1
  56. package/tempo/package.json +5 -0
@@ -0,0 +1,1597 @@
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 buying a specific amount of tokens.
19
+ *
20
+ * @example
21
+ * ```tsx
22
+ * import { Hooks } from 'wagmi/tempo'
23
+ *
24
+ * function App() {
25
+ * const { mutate, isPending } = Hooks.dex.useBuy()
26
+ *
27
+ * return (
28
+ * <button
29
+ * onClick={() => mutate({
30
+ * tokenIn: '0x20c...11',
31
+ * tokenOut: '0x20c...20',
32
+ * amountOut: parseUnits('100', 6),
33
+ * maxAmountIn: parseUnits('105', 6),
34
+ * })}
35
+ * disabled={isPending}
36
+ * >
37
+ * Buy Tokens
38
+ * </button>
39
+ * )
40
+ * }
41
+ * ```
42
+ *
43
+ * @param parameters - Parameters.
44
+ * @returns Mutation result.
45
+ */
46
+ export function useBuy<
47
+ config extends Config = ResolvedRegister['config'],
48
+ context = unknown,
49
+ >(
50
+ parameters: useBuy.Parameters<config, context> = {},
51
+ ): useBuy.ReturnType<config, context> {
52
+ const { mutation } = parameters
53
+ const config = useConfig(parameters)
54
+ return useMutation({
55
+ ...mutation,
56
+ async mutationFn(variables) {
57
+ return Actions.dex.buy(config, variables as never)
58
+ },
59
+ mutationKey: ['buy'],
60
+ }) as never
61
+ }
62
+
63
+ export declare namespace useBuy {
64
+ type Parameters<
65
+ config extends Config = Config,
66
+ context = unknown,
67
+ > = ConfigParameter<config> & {
68
+ mutation?:
69
+ | UseMutationParameters<
70
+ Actions.dex.buy.ReturnValue,
71
+ Actions.dex.buy.ErrorType,
72
+ Actions.dex.buy.Parameters<config>,
73
+ context
74
+ >
75
+ | undefined
76
+ }
77
+
78
+ type ReturnType<
79
+ config extends Config = Config,
80
+ context = unknown,
81
+ > = UseMutationResult<
82
+ Actions.dex.buy.ReturnValue,
83
+ Actions.dex.buy.ErrorType,
84
+ Actions.dex.buy.Parameters<config>,
85
+ context
86
+ >
87
+ }
88
+
89
+ /**
90
+ * Hook for buying a specific amount of tokens.
91
+ *
92
+ * Note: This is a synchronous hook that waits for the transaction
93
+ * to be included on a block before returning a response.
94
+ *
95
+ * @example
96
+ * ```tsx
97
+ * import { Hooks } from 'wagmi/tempo'
98
+ *
99
+ * function App() {
100
+ * const { mutate, isPending } = Hooks.dex.useBuySync()
101
+ *
102
+ * return (
103
+ * <button
104
+ * onClick={() => mutate({
105
+ * tokenIn: '0x20c...11',
106
+ * tokenOut: '0x20c...20',
107
+ * amountOut: parseUnits('100', 6),
108
+ * maxAmountIn: parseUnits('105', 6),
109
+ * })}
110
+ * disabled={isPending}
111
+ * >
112
+ * Buy Tokens
113
+ * </button>
114
+ * )
115
+ * }
116
+ * ```
117
+ *
118
+ * @param parameters - Parameters.
119
+ * @returns Mutation result.
120
+ */
121
+ export function useBuySync<
122
+ config extends Config = ResolvedRegister['config'],
123
+ context = unknown,
124
+ >(
125
+ parameters: useBuySync.Parameters<config, context> = {},
126
+ ): useBuySync.ReturnType<config, context> {
127
+ const { mutation } = parameters
128
+ const config = useConfig(parameters)
129
+ return useMutation({
130
+ ...mutation,
131
+ async mutationFn(variables) {
132
+ return Actions.dex.buySync(config, variables as never)
133
+ },
134
+ mutationKey: ['buySync'],
135
+ }) as never
136
+ }
137
+
138
+ export declare namespace useBuySync {
139
+ type Parameters<
140
+ config extends Config = Config,
141
+ context = unknown,
142
+ > = ConfigParameter<config> & {
143
+ mutation?:
144
+ | UseMutationParameters<
145
+ Actions.dex.buySync.ReturnValue,
146
+ Actions.dex.buySync.ErrorType,
147
+ Actions.dex.buySync.Parameters<config>,
148
+ context
149
+ >
150
+ | undefined
151
+ }
152
+
153
+ type ReturnType<
154
+ config extends Config = Config,
155
+ context = unknown,
156
+ > = UseMutationResult<
157
+ Actions.dex.buySync.ReturnValue,
158
+ Actions.dex.buySync.ErrorType,
159
+ Actions.dex.buySync.Parameters<config>,
160
+ context
161
+ >
162
+ }
163
+
164
+ /**
165
+ * Hook for canceling an order from the orderbook.
166
+ *
167
+ * @example
168
+ * ```tsx
169
+ * import { Hooks } from 'wagmi/tempo'
170
+ *
171
+ * function App() {
172
+ * const { mutate, isPending } = Hooks.dex.useCancel()
173
+ *
174
+ * return (
175
+ * <button
176
+ * onClick={() => mutate({ orderId: 123n })}
177
+ * disabled={isPending}
178
+ * >
179
+ * Cancel Order
180
+ * </button>
181
+ * )
182
+ * }
183
+ * ```
184
+ *
185
+ * @param parameters - Parameters.
186
+ * @returns Mutation result.
187
+ */
188
+ export function useCancel<
189
+ config extends Config = ResolvedRegister['config'],
190
+ context = unknown,
191
+ >(
192
+ parameters: useCancel.Parameters<config, context> = {},
193
+ ): useCancel.ReturnType<config, context> {
194
+ const { mutation } = parameters
195
+ const config = useConfig(parameters)
196
+ return useMutation({
197
+ ...mutation,
198
+ async mutationFn(variables) {
199
+ return Actions.dex.cancel(config, variables as never)
200
+ },
201
+ mutationKey: ['cancel'],
202
+ }) as never
203
+ }
204
+
205
+ export declare namespace useCancel {
206
+ type Parameters<
207
+ config extends Config = Config,
208
+ context = unknown,
209
+ > = ConfigParameter<config> & {
210
+ mutation?:
211
+ | UseMutationParameters<
212
+ Actions.dex.cancel.ReturnValue,
213
+ Actions.dex.cancel.ErrorType,
214
+ Actions.dex.cancel.Parameters<config>,
215
+ context
216
+ >
217
+ | undefined
218
+ }
219
+
220
+ type ReturnType<
221
+ config extends Config = Config,
222
+ context = unknown,
223
+ > = UseMutationResult<
224
+ Actions.dex.cancel.ReturnValue,
225
+ Actions.dex.cancel.ErrorType,
226
+ Actions.dex.cancel.Parameters<config>,
227
+ context
228
+ >
229
+ }
230
+
231
+ /**
232
+ * Hook for canceling an order from the orderbook.
233
+ *
234
+ * Note: This is a synchronous hook that waits for the transaction
235
+ * to be included on a block before returning a response.
236
+ *
237
+ * @example
238
+ * ```tsx
239
+ * import { Hooks } from 'wagmi/tempo'
240
+ *
241
+ * function App() {
242
+ * const { mutate, isPending } = Hooks.dex.useCancelSync()
243
+ *
244
+ * return (
245
+ * <button
246
+ * onClick={() => mutate({ orderId: 123n })}
247
+ * disabled={isPending}
248
+ * >
249
+ * Cancel Order
250
+ * </button>
251
+ * )
252
+ * }
253
+ * ```
254
+ *
255
+ * @param parameters - Parameters.
256
+ * @returns Mutation result.
257
+ */
258
+ export function useCancelSync<
259
+ config extends Config = ResolvedRegister['config'],
260
+ context = unknown,
261
+ >(
262
+ parameters: useCancelSync.Parameters<config, context> = {},
263
+ ): useCancelSync.ReturnType<config, context> {
264
+ const { mutation } = parameters
265
+ const config = useConfig(parameters)
266
+ return useMutation({
267
+ ...mutation,
268
+ async mutationFn(variables) {
269
+ return Actions.dex.cancelSync(config, variables as never)
270
+ },
271
+ mutationKey: ['cancelSync'],
272
+ }) as never
273
+ }
274
+
275
+ export declare namespace useCancelSync {
276
+ type Parameters<
277
+ config extends Config = Config,
278
+ context = unknown,
279
+ > = ConfigParameter<config> & {
280
+ mutation?:
281
+ | UseMutationParameters<
282
+ Actions.dex.cancelSync.ReturnValue,
283
+ Actions.dex.cancelSync.ErrorType,
284
+ Actions.dex.cancelSync.Parameters<config>,
285
+ context
286
+ >
287
+ | undefined
288
+ }
289
+
290
+ type ReturnType<
291
+ config extends Config = Config,
292
+ context = unknown,
293
+ > = UseMutationResult<
294
+ Actions.dex.cancelSync.ReturnValue,
295
+ Actions.dex.cancelSync.ErrorType,
296
+ Actions.dex.cancelSync.Parameters<config>,
297
+ context
298
+ >
299
+ }
300
+
301
+ /**
302
+ * Hook for creating a new trading pair on the DEX.
303
+ *
304
+ * @example
305
+ * ```tsx
306
+ * import { Hooks } from 'wagmi/tempo'
307
+ *
308
+ * function App() {
309
+ * const { mutate, isPending } = Hooks.dex.useCreatePair()
310
+ *
311
+ * return (
312
+ * <button
313
+ * onClick={() => mutate({ base: '0x20c...11' })}
314
+ * disabled={isPending}
315
+ * >
316
+ * Create Pair
317
+ * </button>
318
+ * )
319
+ * }
320
+ * ```
321
+ *
322
+ * @param parameters - Parameters.
323
+ * @returns Mutation result.
324
+ */
325
+ export function useCreatePair<
326
+ config extends Config = ResolvedRegister['config'],
327
+ context = unknown,
328
+ >(
329
+ parameters: useCreatePair.Parameters<config, context> = {},
330
+ ): useCreatePair.ReturnType<config, context> {
331
+ const { mutation } = parameters
332
+ const config = useConfig(parameters)
333
+ return useMutation({
334
+ ...mutation,
335
+ async mutationFn(variables) {
336
+ return Actions.dex.createPair(config, variables as never)
337
+ },
338
+ mutationKey: ['createPair'],
339
+ }) as never
340
+ }
341
+
342
+ export declare namespace useCreatePair {
343
+ type Parameters<
344
+ config extends Config = Config,
345
+ context = unknown,
346
+ > = ConfigParameter<config> & {
347
+ mutation?:
348
+ | UseMutationParameters<
349
+ Actions.dex.createPair.ReturnValue,
350
+ Actions.dex.createPair.ErrorType,
351
+ Actions.dex.createPair.Parameters<config>,
352
+ context
353
+ >
354
+ | undefined
355
+ }
356
+
357
+ type ReturnType<
358
+ config extends Config = Config,
359
+ context = unknown,
360
+ > = UseMutationResult<
361
+ Actions.dex.createPair.ReturnValue,
362
+ Actions.dex.createPair.ErrorType,
363
+ Actions.dex.createPair.Parameters<config>,
364
+ context
365
+ >
366
+ }
367
+
368
+ /**
369
+ * Hook for creating a new trading pair on the DEX.
370
+ *
371
+ * Note: This is a synchronous hook that waits for the transaction
372
+ * to be included on a block before returning a response.
373
+ *
374
+ * @example
375
+ * ```tsx
376
+ * import { Hooks } from 'wagmi/tempo'
377
+ *
378
+ * function App() {
379
+ * const { mutate, isPending } = Hooks.dex.useCreatePairSync()
380
+ *
381
+ * return (
382
+ * <button
383
+ * onClick={() => mutate({ base: '0x20c...11' })}
384
+ * disabled={isPending}
385
+ * >
386
+ * Create Pair
387
+ * </button>
388
+ * )
389
+ * }
390
+ * ```
391
+ *
392
+ * @param parameters - Parameters.
393
+ * @returns Mutation result.
394
+ */
395
+ export function useCreatePairSync<
396
+ config extends Config = ResolvedRegister['config'],
397
+ context = unknown,
398
+ >(
399
+ parameters: useCreatePairSync.Parameters<config, context> = {},
400
+ ): useCreatePairSync.ReturnType<config, context> {
401
+ const { mutation } = parameters
402
+ const config = useConfig(parameters)
403
+ return useMutation({
404
+ ...mutation,
405
+ async mutationFn(variables) {
406
+ return Actions.dex.createPairSync(config, variables as never)
407
+ },
408
+ mutationKey: ['createPairSync'],
409
+ }) as never
410
+ }
411
+
412
+ export declare namespace useCreatePairSync {
413
+ type Parameters<
414
+ config extends Config = Config,
415
+ context = unknown,
416
+ > = ConfigParameter<config> & {
417
+ mutation?:
418
+ | UseMutationParameters<
419
+ Actions.dex.createPairSync.ReturnValue,
420
+ Actions.dex.createPairSync.ErrorType,
421
+ Actions.dex.createPairSync.Parameters<config>,
422
+ context
423
+ >
424
+ | undefined
425
+ }
426
+
427
+ type ReturnType<
428
+ config extends Config = Config,
429
+ context = unknown,
430
+ > = UseMutationResult<
431
+ Actions.dex.createPairSync.ReturnValue,
432
+ Actions.dex.createPairSync.ErrorType,
433
+ Actions.dex.createPairSync.Parameters<config>,
434
+ context
435
+ >
436
+ }
437
+
438
+ /**
439
+ * Hook for getting a user's token balance on the DEX.
440
+ *
441
+ * @example
442
+ * ```tsx
443
+ * import { Hooks } from 'wagmi/tempo'
444
+ *
445
+ * function App() {
446
+ * const { data, isLoading } = Hooks.dex.useBalance({
447
+ * account: '0x...',
448
+ * token: '0x20c...11',
449
+ * })
450
+ *
451
+ * if (isLoading) return <div>Loading...</div>
452
+ * return <div>Balance: {data}</div>
453
+ * }
454
+ * ```
455
+ *
456
+ * @param parameters - Parameters.
457
+ * @returns Query result with the user's token balance on the DEX.
458
+ */
459
+ export function useBalance<
460
+ config extends Config = ResolvedRegister['config'],
461
+ selectData = Actions.dex.getBalance.ReturnValue,
462
+ >(
463
+ parameters: useBalance.Parameters<config, selectData>,
464
+ ): useBalance.ReturnValue<selectData> {
465
+ const config = useConfig(parameters)
466
+ const chainId = useChainId({ config })
467
+ const options = Actions.dex.getBalance.queryOptions(config, {
468
+ ...parameters,
469
+ chainId: parameters.chainId ?? chainId,
470
+ } as never)
471
+ return useQuery(options) as never
472
+ }
473
+
474
+ export declare namespace useBalance {
475
+ export type Parameters<
476
+ config extends Config = ResolvedRegister['config'],
477
+ selectData = Actions.dex.getBalance.ReturnValue,
478
+ > = ConfigParameter<config> &
479
+ QueryParameter<
480
+ Actions.dex.getBalance.ReturnValue,
481
+ Actions.dex.getBalance.ErrorType,
482
+ selectData,
483
+ Actions.dex.getBalance.QueryKey<config>
484
+ > &
485
+ Omit<
486
+ Actions.dex.getBalance.queryOptions.Parameters<config, selectData>,
487
+ 'query'
488
+ >
489
+
490
+ export type ReturnValue<selectData = Actions.dex.getBalance.ReturnValue> =
491
+ UseQueryReturnType<selectData, Error>
492
+ }
493
+
494
+ /**
495
+ * Hook for getting the quote for buying a specific amount of tokens.
496
+ *
497
+ * @example
498
+ * ```tsx
499
+ * import { Hooks } from 'wagmi/tempo'
500
+ *
501
+ * function App() {
502
+ * const { data, isLoading } = Hooks.dex.useBuyQuote({
503
+ * amountOut: parseUnits('100', 6),
504
+ * tokenIn: '0x20c...11',
505
+ * tokenOut: '0x20c...20',
506
+ * })
507
+ *
508
+ * if (isLoading) return <div>Loading...</div>
509
+ * return <div>Required Input: {data}</div>
510
+ * }
511
+ * ```
512
+ *
513
+ * @param parameters - Parameters.
514
+ * @returns Query result with the amount of tokenIn needed.
515
+ */
516
+ export function useBuyQuote<
517
+ config extends Config = ResolvedRegister['config'],
518
+ selectData = Actions.dex.getBuyQuote.ReturnValue,
519
+ >(
520
+ parameters: useBuyQuote.Parameters<config, selectData>,
521
+ ): useBuyQuote.ReturnValue<selectData> {
522
+ const config = useConfig(parameters)
523
+ const chainId = useChainId({ config })
524
+ const options = Actions.dex.getBuyQuote.queryOptions(config, {
525
+ ...parameters,
526
+ chainId: parameters.chainId ?? chainId,
527
+ } as never)
528
+ return useQuery(options) as never
529
+ }
530
+
531
+ export declare namespace useBuyQuote {
532
+ export type Parameters<
533
+ config extends Config = ResolvedRegister['config'],
534
+ selectData = Actions.dex.getBuyQuote.ReturnValue,
535
+ > = ConfigParameter<config> &
536
+ QueryParameter<
537
+ Actions.dex.getBuyQuote.ReturnValue,
538
+ Actions.dex.getBuyQuote.ErrorType,
539
+ selectData,
540
+ Actions.dex.getBuyQuote.QueryKey<config>
541
+ > &
542
+ Omit<
543
+ Actions.dex.getBuyQuote.queryOptions.Parameters<config, selectData>,
544
+ 'query'
545
+ >
546
+
547
+ export type ReturnValue<selectData = Actions.dex.getBuyQuote.ReturnValue> =
548
+ UseQueryReturnType<selectData, Error>
549
+ }
550
+
551
+ /**
552
+ * Hook for getting an order's details from the orderbook.
553
+ *
554
+ * @example
555
+ * ```tsx
556
+ * import { Hooks } from 'wagmi/tempo'
557
+ *
558
+ * function App() {
559
+ * const { data, isLoading } = Hooks.dex.useOrder({
560
+ * orderId: 123n,
561
+ * })
562
+ *
563
+ * if (isLoading) return <div>Loading...</div>
564
+ * return <div>Order: {JSON.stringify(data)}</div>
565
+ * }
566
+ * ```
567
+ *
568
+ * @param parameters - Parameters.
569
+ * @returns Query result with the order details.
570
+ */
571
+ export function useOrder<
572
+ config extends Config = ResolvedRegister['config'],
573
+ selectData = Actions.dex.getOrder.ReturnValue,
574
+ >(
575
+ parameters: useOrder.Parameters<config, selectData>,
576
+ ): useOrder.ReturnValue<selectData> {
577
+ const config = useConfig(parameters)
578
+ const chainId = useChainId({ config })
579
+ const options = Actions.dex.getOrder.queryOptions(config, {
580
+ ...parameters,
581
+ chainId: parameters.chainId ?? chainId,
582
+ } as never)
583
+ return useQuery(options) as never
584
+ }
585
+
586
+ export declare namespace useOrder {
587
+ export type Parameters<
588
+ config extends Config = ResolvedRegister['config'],
589
+ selectData = Actions.dex.getOrder.ReturnValue,
590
+ > = ConfigParameter<config> &
591
+ QueryParameter<
592
+ Actions.dex.getOrder.ReturnValue,
593
+ Actions.dex.getOrder.ErrorType,
594
+ selectData,
595
+ Actions.dex.getOrder.QueryKey<config>
596
+ > &
597
+ Omit<
598
+ Actions.dex.getOrder.queryOptions.Parameters<config, selectData>,
599
+ 'query'
600
+ >
601
+
602
+ export type ReturnValue<selectData = Actions.dex.getOrder.ReturnValue> =
603
+ UseQueryReturnType<selectData, Error>
604
+ }
605
+
606
+ /**
607
+ * Hook for getting orderbook information for a trading pair.
608
+ *
609
+ * @example
610
+ * ```tsx
611
+ * import { Hooks } from 'wagmi/tempo'
612
+ *
613
+ * function App() {
614
+ * const { data, isLoading } = Hooks.dex.useOrderbook({
615
+ * base: '0x20c...11',
616
+ * quote: '0x20c...20',
617
+ * })
618
+ *
619
+ * if (isLoading) return <div>Loading...</div>
620
+ * return <div>Orderbook: {JSON.stringify(data)}</div>
621
+ * }
622
+ * ```
623
+ *
624
+ * @param parameters - Parameters.
625
+ * @returns Query result with the orderbook information.
626
+ */
627
+ export function useOrderbook<
628
+ config extends Config = ResolvedRegister['config'],
629
+ selectData = Actions.dex.getOrderbook.ReturnValue,
630
+ >(
631
+ parameters: useOrderbook.Parameters<config, selectData>,
632
+ ): useOrderbook.ReturnValue<selectData> {
633
+ const config = useConfig(parameters)
634
+ const chainId = useChainId({ config })
635
+ const options = Actions.dex.getOrderbook.queryOptions(config, {
636
+ ...parameters,
637
+ chainId: parameters.chainId ?? chainId,
638
+ } as never)
639
+ return useQuery(options) as never
640
+ }
641
+
642
+ export declare namespace useOrderbook {
643
+ export type Parameters<
644
+ config extends Config = ResolvedRegister['config'],
645
+ selectData = Actions.dex.getOrderbook.ReturnValue,
646
+ > = ConfigParameter<config> &
647
+ QueryParameter<
648
+ Actions.dex.getOrderbook.ReturnValue,
649
+ Actions.dex.getOrderbook.ErrorType,
650
+ selectData,
651
+ Actions.dex.getOrderbook.QueryKey<config>
652
+ > &
653
+ Omit<
654
+ Actions.dex.getOrderbook.queryOptions.Parameters<config, selectData>,
655
+ 'query'
656
+ >
657
+
658
+ export type ReturnValue<selectData = Actions.dex.getOrderbook.ReturnValue> =
659
+ UseQueryReturnType<selectData, Error>
660
+ }
661
+
662
+ /**
663
+ * Hook for getting the tick level information at a specific tick.
664
+ *
665
+ * @example
666
+ * ```tsx
667
+ * import { Hooks } from 'wagmi/tempo'
668
+ * import { Tick } from 'viem/tempo'
669
+ *
670
+ * function App() {
671
+ * const { data, isLoading } = Hooks.dex.useTickLevel({
672
+ * base: '0x20c...11',
673
+ * tick: Tick.fromPrice('1.001'),
674
+ * isBid: true,
675
+ * })
676
+ *
677
+ * if (isLoading) return <div>Loading...</div>
678
+ * return <div>Tick Level: {JSON.stringify(data)}</div>
679
+ * }
680
+ * ```
681
+ *
682
+ * @param parameters - Parameters.
683
+ * @returns Query result with the tick level information.
684
+ */
685
+ export function useTickLevel<
686
+ config extends Config = ResolvedRegister['config'],
687
+ selectData = Actions.dex.getTickLevel.ReturnValue,
688
+ >(
689
+ parameters: useTickLevel.Parameters<config, selectData>,
690
+ ): useTickLevel.ReturnValue<selectData> {
691
+ const config = useConfig(parameters)
692
+ const chainId = useChainId({ config })
693
+ const options = Actions.dex.getTickLevel.queryOptions(config, {
694
+ ...parameters,
695
+ chainId: parameters.chainId ?? chainId,
696
+ } as never)
697
+ return useQuery(options) as never
698
+ }
699
+
700
+ export declare namespace useTickLevel {
701
+ export type Parameters<
702
+ config extends Config = ResolvedRegister['config'],
703
+ selectData = Actions.dex.getTickLevel.ReturnValue,
704
+ > = ConfigParameter<config> &
705
+ QueryParameter<
706
+ Actions.dex.getTickLevel.ReturnValue,
707
+ Actions.dex.getTickLevel.ErrorType,
708
+ selectData,
709
+ Actions.dex.getTickLevel.QueryKey<config>
710
+ > &
711
+ Omit<
712
+ Actions.dex.getTickLevel.queryOptions.Parameters<config, selectData>,
713
+ 'query'
714
+ >
715
+
716
+ export type ReturnValue<selectData = Actions.dex.getTickLevel.ReturnValue> =
717
+ UseQueryReturnType<selectData, Error>
718
+ }
719
+
720
+ /**
721
+ * Hook for getting the quote for selling a specific amount of tokens.
722
+ *
723
+ * @example
724
+ * ```tsx
725
+ * import { Hooks } from 'wagmi/tempo'
726
+ *
727
+ * function App() {
728
+ * const { data, isLoading } = Hooks.dex.useSellQuote({
729
+ * amountIn: parseUnits('100', 6),
730
+ * tokenIn: '0x20c...11',
731
+ * tokenOut: '0x20c...20',
732
+ * })
733
+ *
734
+ * if (isLoading) return <div>Loading...</div>
735
+ * return <div>Expected Output: {data}</div>
736
+ * }
737
+ * ```
738
+ *
739
+ * @param parameters - Parameters.
740
+ * @returns Query result with the amount of tokenOut received.
741
+ */
742
+ export function useSellQuote<
743
+ config extends Config = ResolvedRegister['config'],
744
+ selectData = Actions.dex.getSellQuote.ReturnValue,
745
+ >(
746
+ parameters: useSellQuote.Parameters<config, selectData>,
747
+ ): useSellQuote.ReturnValue<selectData> {
748
+ const config = useConfig(parameters)
749
+ const chainId = useChainId({ config })
750
+ const options = Actions.dex.getSellQuote.queryOptions(config, {
751
+ ...parameters,
752
+ chainId: parameters.chainId ?? chainId,
753
+ } as never)
754
+ return useQuery(options) as never
755
+ }
756
+
757
+ export declare namespace useSellQuote {
758
+ export type Parameters<
759
+ config extends Config = ResolvedRegister['config'],
760
+ selectData = Actions.dex.getSellQuote.ReturnValue,
761
+ > = ConfigParameter<config> &
762
+ QueryParameter<
763
+ Actions.dex.getSellQuote.ReturnValue,
764
+ Actions.dex.getSellQuote.ErrorType,
765
+ selectData,
766
+ Actions.dex.getSellQuote.QueryKey<config>
767
+ > &
768
+ Omit<
769
+ Actions.dex.getSellQuote.queryOptions.Parameters<config, selectData>,
770
+ 'query'
771
+ >
772
+
773
+ export type ReturnValue<selectData = Actions.dex.getSellQuote.ReturnValue> =
774
+ UseQueryReturnType<selectData, Error>
775
+ }
776
+
777
+ /**
778
+ * Hook for placing a limit order on the orderbook.
779
+ *
780
+ * @example
781
+ * ```tsx
782
+ * import { Hooks } from 'wagmi/tempo'
783
+ *
784
+ * function App() {
785
+ * const { mutate, isPending } = Hooks.dex.usePlace()
786
+ *
787
+ * return (
788
+ * <button
789
+ * onClick={() => mutate({
790
+ * amount: parseUnits('100', 6),
791
+ * tick: Tick.fromPrice('0.99'),
792
+ * token: '0x20c...11',
793
+ * type: 'buy',
794
+ * })}
795
+ * disabled={isPending}
796
+ * >
797
+ * Place Order
798
+ * </button>
799
+ * )
800
+ * }
801
+ * ```
802
+ *
803
+ * @param parameters - Parameters.
804
+ * @returns Mutation result.
805
+ */
806
+ export function usePlace<
807
+ config extends Config = ResolvedRegister['config'],
808
+ context = unknown,
809
+ >(
810
+ parameters: usePlace.Parameters<config, context> = {},
811
+ ): usePlace.ReturnType<config, context> {
812
+ const { mutation } = parameters
813
+ const config = useConfig(parameters)
814
+ return useMutation({
815
+ ...mutation,
816
+ async mutationFn(variables) {
817
+ return Actions.dex.place(config, variables as never)
818
+ },
819
+ mutationKey: ['place'],
820
+ }) as never
821
+ }
822
+
823
+ export declare namespace usePlace {
824
+ type Parameters<
825
+ config extends Config = Config,
826
+ context = unknown,
827
+ > = ConfigParameter<config> & {
828
+ mutation?:
829
+ | UseMutationParameters<
830
+ Actions.dex.place.ReturnValue,
831
+ Actions.dex.place.ErrorType,
832
+ Actions.dex.place.Parameters<config>,
833
+ context
834
+ >
835
+ | undefined
836
+ }
837
+
838
+ type ReturnType<
839
+ config extends Config = Config,
840
+ context = unknown,
841
+ > = UseMutationResult<
842
+ Actions.dex.place.ReturnValue,
843
+ Actions.dex.place.ErrorType,
844
+ Actions.dex.place.Parameters<config>,
845
+ context
846
+ >
847
+ }
848
+
849
+ /**
850
+ * Hook for placing a flip order that automatically flips when filled.
851
+ *
852
+ * @example
853
+ * ```tsx
854
+ * import { Hooks } from 'wagmi/tempo'
855
+ *
856
+ * function App() {
857
+ * const { mutate, isPending } = Hooks.dex.usePlaceFlip()
858
+ *
859
+ * return (
860
+ * <button
861
+ * onClick={() => mutate({
862
+ * amount: parseUnits('100', 6),
863
+ * flipTick: Tick.fromPrice('1.01'),
864
+ * tick: Tick.fromPrice('0.99'),
865
+ * token: '0x20c...11',
866
+ * type: 'buy',
867
+ * })}
868
+ * disabled={isPending}
869
+ * >
870
+ * Place Flip Order
871
+ * </button>
872
+ * )
873
+ * }
874
+ * ```
875
+ *
876
+ * @param parameters - Parameters.
877
+ * @returns Mutation result.
878
+ */
879
+ export function usePlaceFlip<
880
+ config extends Config = ResolvedRegister['config'],
881
+ context = unknown,
882
+ >(
883
+ parameters: usePlaceFlip.Parameters<config, context> = {},
884
+ ): usePlaceFlip.ReturnType<config, context> {
885
+ const { mutation } = parameters
886
+ const config = useConfig(parameters)
887
+ return useMutation({
888
+ ...mutation,
889
+ async mutationFn(variables) {
890
+ return Actions.dex.placeFlip(config, variables as never)
891
+ },
892
+ mutationKey: ['placeFlip'],
893
+ }) as never
894
+ }
895
+
896
+ export declare namespace usePlaceFlip {
897
+ type Parameters<
898
+ config extends Config = Config,
899
+ context = unknown,
900
+ > = ConfigParameter<config> & {
901
+ mutation?:
902
+ | UseMutationParameters<
903
+ Actions.dex.placeFlip.ReturnValue,
904
+ Actions.dex.placeFlip.ErrorType,
905
+ Actions.dex.placeFlip.Parameters<config>,
906
+ context
907
+ >
908
+ | undefined
909
+ }
910
+
911
+ type ReturnType<
912
+ config extends Config = Config,
913
+ context = unknown,
914
+ > = UseMutationResult<
915
+ Actions.dex.placeFlip.ReturnValue,
916
+ Actions.dex.placeFlip.ErrorType,
917
+ Actions.dex.placeFlip.Parameters<config>,
918
+ context
919
+ >
920
+ }
921
+
922
+ /**
923
+ * Hook for placing a flip order that automatically flips when filled.
924
+ *
925
+ * Note: This is a synchronous hook that waits for the transaction
926
+ * to be included on a block before returning a response.
927
+ *
928
+ * @example
929
+ * ```tsx
930
+ * import { Hooks } from 'wagmi/tempo'
931
+ *
932
+ * function App() {
933
+ * const { mutate, isPending } = Hooks.dex.usePlaceFlipSync()
934
+ *
935
+ * return (
936
+ * <button
937
+ * onClick={() => mutate({
938
+ * amount: parseUnits('100', 6),
939
+ * flipTick: Tick.fromPrice('1.01'),
940
+ * tick: Tick.fromPrice('0.99'),
941
+ * token: '0x20c...11',
942
+ * type: 'buy',
943
+ * })}
944
+ * disabled={isPending}
945
+ * >
946
+ * Place Flip Order
947
+ * </button>
948
+ * )
949
+ * }
950
+ * ```
951
+ *
952
+ * @param parameters - Parameters.
953
+ * @returns Mutation result.
954
+ */
955
+ export function usePlaceFlipSync<
956
+ config extends Config = ResolvedRegister['config'],
957
+ context = unknown,
958
+ >(
959
+ parameters: usePlaceFlipSync.Parameters<config, context> = {},
960
+ ): usePlaceFlipSync.ReturnType<config, context> {
961
+ const { mutation } = parameters
962
+ const config = useConfig(parameters)
963
+ return useMutation({
964
+ ...mutation,
965
+ async mutationFn(variables) {
966
+ return Actions.dex.placeFlipSync(config, variables as never)
967
+ },
968
+ mutationKey: ['placeFlipSync'],
969
+ }) as never
970
+ }
971
+
972
+ export declare namespace usePlaceFlipSync {
973
+ type Parameters<
974
+ config extends Config = Config,
975
+ context = unknown,
976
+ > = ConfigParameter<config> & {
977
+ mutation?:
978
+ | UseMutationParameters<
979
+ Actions.dex.placeFlipSync.ReturnValue,
980
+ Actions.dex.placeFlipSync.ErrorType,
981
+ Actions.dex.placeFlipSync.Parameters<config>,
982
+ context
983
+ >
984
+ | undefined
985
+ }
986
+
987
+ type ReturnType<
988
+ config extends Config = Config,
989
+ context = unknown,
990
+ > = UseMutationResult<
991
+ Actions.dex.placeFlipSync.ReturnValue,
992
+ Actions.dex.placeFlipSync.ErrorType,
993
+ Actions.dex.placeFlipSync.Parameters<config>,
994
+ context
995
+ >
996
+ }
997
+
998
+ /**
999
+ * Hook for placing a limit order on the orderbook.
1000
+ *
1001
+ * Note: This is a synchronous hook that waits for the transaction
1002
+ * to be included on a block before returning a response.
1003
+ *
1004
+ * @example
1005
+ * ```tsx
1006
+ * import { Hooks } from 'wagmi/tempo'
1007
+ *
1008
+ * function App() {
1009
+ * const { mutate, isPending } = Hooks.dex.usePlaceSync()
1010
+ *
1011
+ * return (
1012
+ * <button
1013
+ * onClick={() => mutate({
1014
+ * amount: parseUnits('100', 6),
1015
+ * tick: Tick.fromPrice('0.99'),
1016
+ * token: '0x20c...11',
1017
+ * type: 'buy',
1018
+ * })}
1019
+ * disabled={isPending}
1020
+ * >
1021
+ * Place Order
1022
+ * </button>
1023
+ * )
1024
+ * }
1025
+ * ```
1026
+ *
1027
+ * @param parameters - Parameters.
1028
+ * @returns Mutation result.
1029
+ */
1030
+ export function usePlaceSync<
1031
+ config extends Config = ResolvedRegister['config'],
1032
+ context = unknown,
1033
+ >(
1034
+ parameters: usePlaceSync.Parameters<config, context> = {},
1035
+ ): usePlaceSync.ReturnType<config, context> {
1036
+ const { mutation } = parameters
1037
+ const config = useConfig(parameters)
1038
+ return useMutation({
1039
+ ...mutation,
1040
+ async mutationFn(variables) {
1041
+ return Actions.dex.placeSync(config, variables as never)
1042
+ },
1043
+ mutationKey: ['placeSync'],
1044
+ }) as never
1045
+ }
1046
+
1047
+ export declare namespace usePlaceSync {
1048
+ type Parameters<
1049
+ config extends Config = Config,
1050
+ context = unknown,
1051
+ > = ConfigParameter<config> & {
1052
+ mutation?:
1053
+ | UseMutationParameters<
1054
+ Actions.dex.placeSync.ReturnValue,
1055
+ Actions.dex.placeSync.ErrorType,
1056
+ Actions.dex.placeSync.Parameters<config>,
1057
+ context
1058
+ >
1059
+ | undefined
1060
+ }
1061
+
1062
+ type ReturnType<
1063
+ config extends Config = Config,
1064
+ context = unknown,
1065
+ > = UseMutationResult<
1066
+ Actions.dex.placeSync.ReturnValue,
1067
+ Actions.dex.placeSync.ErrorType,
1068
+ Actions.dex.placeSync.Parameters<config>,
1069
+ context
1070
+ >
1071
+ }
1072
+
1073
+ /**
1074
+ * Hook for selling a specific amount of tokens.
1075
+ *
1076
+ * @example
1077
+ * ```tsx
1078
+ * import { Hooks } from 'wagmi/tempo'
1079
+ *
1080
+ * function App() {
1081
+ * const { mutate, isPending } = Hooks.dex.useSell()
1082
+ *
1083
+ * return (
1084
+ * <button
1085
+ * onClick={() => mutate({
1086
+ * amountIn: parseUnits('100', 6),
1087
+ * minAmountOut: parseUnits('95', 6),
1088
+ * tokenIn: '0x20c...11',
1089
+ * tokenOut: '0x20c...20',
1090
+ * })}
1091
+ * disabled={isPending}
1092
+ * >
1093
+ * Sell Tokens
1094
+ * </button>
1095
+ * )
1096
+ * }
1097
+ * ```
1098
+ *
1099
+ * @param parameters - Parameters.
1100
+ * @returns Mutation result.
1101
+ */
1102
+ export function useSell<
1103
+ config extends Config = ResolvedRegister['config'],
1104
+ context = unknown,
1105
+ >(
1106
+ parameters: useSell.Parameters<config, context> = {},
1107
+ ): useSell.ReturnType<config, context> {
1108
+ const { mutation } = parameters
1109
+ const config = useConfig(parameters)
1110
+ return useMutation({
1111
+ ...mutation,
1112
+ async mutationFn(variables) {
1113
+ return Actions.dex.sell(config, variables as never)
1114
+ },
1115
+ mutationKey: ['sell'],
1116
+ }) as never
1117
+ }
1118
+
1119
+ export declare namespace useSell {
1120
+ type Parameters<
1121
+ config extends Config = Config,
1122
+ context = unknown,
1123
+ > = ConfigParameter<config> & {
1124
+ mutation?:
1125
+ | UseMutationParameters<
1126
+ Actions.dex.sell.ReturnValue,
1127
+ Actions.dex.sell.ErrorType,
1128
+ Actions.dex.sell.Parameters<config>,
1129
+ context
1130
+ >
1131
+ | undefined
1132
+ }
1133
+
1134
+ type ReturnType<
1135
+ config extends Config = Config,
1136
+ context = unknown,
1137
+ > = UseMutationResult<
1138
+ Actions.dex.sell.ReturnValue,
1139
+ Actions.dex.sell.ErrorType,
1140
+ Actions.dex.sell.Parameters<config>,
1141
+ context
1142
+ >
1143
+ }
1144
+
1145
+ /**
1146
+ * Hook for selling a specific amount of tokens.
1147
+ *
1148
+ * Note: This is a synchronous hook that waits for the transaction
1149
+ * to be included on a block before returning a response.
1150
+ *
1151
+ * @example
1152
+ * ```tsx
1153
+ * import { Hooks } from 'wagmi/tempo'
1154
+ *
1155
+ * function App() {
1156
+ * const { mutate, isPending } = Hooks.dex.useSellSync()
1157
+ *
1158
+ * return (
1159
+ * <button
1160
+ * onClick={() => mutate({
1161
+ * amountIn: parseUnits('100', 6),
1162
+ * minAmountOut: parseUnits('95', 6),
1163
+ * tokenIn: '0x20c...11',
1164
+ * tokenOut: '0x20c...20',
1165
+ * })}
1166
+ * disabled={isPending}
1167
+ * >
1168
+ * Sell Tokens
1169
+ * </button>
1170
+ * )
1171
+ * }
1172
+ * ```
1173
+ *
1174
+ * @param parameters - Parameters.
1175
+ * @returns Mutation result.
1176
+ */
1177
+ export function useSellSync<
1178
+ config extends Config = ResolvedRegister['config'],
1179
+ context = unknown,
1180
+ >(
1181
+ parameters: useSellSync.Parameters<config, context> = {},
1182
+ ): useSellSync.ReturnType<config, context> {
1183
+ const { mutation } = parameters
1184
+ const config = useConfig(parameters)
1185
+ return useMutation({
1186
+ ...mutation,
1187
+ async mutationFn(variables) {
1188
+ return Actions.dex.sellSync(config, variables as never)
1189
+ },
1190
+ mutationKey: ['sellSync'],
1191
+ }) as never
1192
+ }
1193
+
1194
+ export declare namespace useSellSync {
1195
+ type Parameters<
1196
+ config extends Config = Config,
1197
+ context = unknown,
1198
+ > = ConfigParameter<config> & {
1199
+ mutation?:
1200
+ | UseMutationParameters<
1201
+ Actions.dex.sellSync.ReturnValue,
1202
+ Actions.dex.sellSync.ErrorType,
1203
+ Actions.dex.sellSync.Parameters<config>,
1204
+ context
1205
+ >
1206
+ | undefined
1207
+ }
1208
+
1209
+ type ReturnType<
1210
+ config extends Config = Config,
1211
+ context = unknown,
1212
+ > = UseMutationResult<
1213
+ Actions.dex.sellSync.ReturnValue,
1214
+ Actions.dex.sellSync.ErrorType,
1215
+ Actions.dex.sellSync.Parameters<config>,
1216
+ context
1217
+ >
1218
+ }
1219
+
1220
+ /**
1221
+ * Hook for withdrawing tokens from the DEX to the caller's wallet.
1222
+ *
1223
+ * @example
1224
+ * ```tsx
1225
+ * import { Hooks } from 'wagmi/tempo'
1226
+ *
1227
+ * function App() {
1228
+ * const { mutate, isPending } = Hooks.dex.useWithdraw()
1229
+ *
1230
+ * return (
1231
+ * <button
1232
+ * onClick={() => mutate({
1233
+ * amount: 100n,
1234
+ * token: '0x20c...11',
1235
+ * })}
1236
+ * disabled={isPending}
1237
+ * >
1238
+ * Withdraw
1239
+ * </button>
1240
+ * )
1241
+ * }
1242
+ * ```
1243
+ *
1244
+ * @param parameters - Parameters.
1245
+ * @returns Mutation result.
1246
+ */
1247
+ export function useWithdraw<
1248
+ config extends Config = ResolvedRegister['config'],
1249
+ context = unknown,
1250
+ >(
1251
+ parameters: useWithdraw.Parameters<config, context> = {},
1252
+ ): useWithdraw.ReturnType<config, context> {
1253
+ const { mutation } = parameters
1254
+ const config = useConfig(parameters)
1255
+ return useMutation({
1256
+ ...mutation,
1257
+ async mutationFn(variables) {
1258
+ return Actions.dex.withdraw(config, variables as never)
1259
+ },
1260
+ mutationKey: ['withdraw'],
1261
+ }) as never
1262
+ }
1263
+
1264
+ export declare namespace useWithdraw {
1265
+ type Parameters<
1266
+ config extends Config = Config,
1267
+ context = unknown,
1268
+ > = ConfigParameter<config> & {
1269
+ mutation?:
1270
+ | UseMutationParameters<
1271
+ Actions.dex.withdraw.ReturnValue,
1272
+ Actions.dex.withdraw.ErrorType,
1273
+ Actions.dex.withdraw.Parameters<config>,
1274
+ context
1275
+ >
1276
+ | undefined
1277
+ }
1278
+
1279
+ type ReturnType<
1280
+ config extends Config = Config,
1281
+ context = unknown,
1282
+ > = UseMutationResult<
1283
+ Actions.dex.withdraw.ReturnValue,
1284
+ Actions.dex.withdraw.ErrorType,
1285
+ Actions.dex.withdraw.Parameters<config>,
1286
+ context
1287
+ >
1288
+ }
1289
+
1290
+ /**
1291
+ * Hook for withdrawing tokens from the DEX to the caller's wallet.
1292
+ *
1293
+ * Note: This is a synchronous hook that waits for the transaction
1294
+ * to be included on a block before returning a response.
1295
+ *
1296
+ * @example
1297
+ * ```tsx
1298
+ * import { Hooks } from 'wagmi/tempo'
1299
+ *
1300
+ * function App() {
1301
+ * const { mutate, isPending } = Hooks.dex.useWithdrawSync()
1302
+ *
1303
+ * return (
1304
+ * <button
1305
+ * onClick={() => mutate({
1306
+ * amount: 100n,
1307
+ * token: '0x20c...11',
1308
+ * })}
1309
+ * disabled={isPending}
1310
+ * >
1311
+ * Withdraw
1312
+ * </button>
1313
+ * )
1314
+ * }
1315
+ * ```
1316
+ *
1317
+ * @param parameters - Parameters.
1318
+ * @returns Mutation result.
1319
+ */
1320
+ export function useWithdrawSync<
1321
+ config extends Config = ResolvedRegister['config'],
1322
+ context = unknown,
1323
+ >(
1324
+ parameters: useWithdrawSync.Parameters<config, context> = {},
1325
+ ): useWithdrawSync.ReturnType<config, context> {
1326
+ const { mutation } = parameters
1327
+ const config = useConfig(parameters)
1328
+ return useMutation({
1329
+ ...mutation,
1330
+ async mutationFn(variables) {
1331
+ return Actions.dex.withdrawSync(config, variables as never)
1332
+ },
1333
+ mutationKey: ['withdrawSync'],
1334
+ }) as never
1335
+ }
1336
+
1337
+ export declare namespace useWithdrawSync {
1338
+ type Parameters<
1339
+ config extends Config = Config,
1340
+ context = unknown,
1341
+ > = ConfigParameter<config> & {
1342
+ mutation?:
1343
+ | UseMutationParameters<
1344
+ Actions.dex.withdrawSync.ReturnValue,
1345
+ Actions.dex.withdrawSync.ErrorType,
1346
+ Actions.dex.withdrawSync.Parameters<config>,
1347
+ context
1348
+ >
1349
+ | undefined
1350
+ }
1351
+
1352
+ type ReturnType<
1353
+ config extends Config = Config,
1354
+ context = unknown,
1355
+ > = UseMutationResult<
1356
+ Actions.dex.withdrawSync.ReturnValue,
1357
+ Actions.dex.withdrawSync.ErrorType,
1358
+ Actions.dex.withdrawSync.Parameters<config>,
1359
+ context
1360
+ >
1361
+ }
1362
+
1363
+ /**
1364
+ * Hook for watching flip order placement events on the DEX.
1365
+ *
1366
+ * @example
1367
+ * ```tsx
1368
+ * import { Hooks } from 'wagmi/tempo'
1369
+ *
1370
+ * function App() {
1371
+ * Hooks.dex.useWatchFlipOrderPlaced({
1372
+ * onFlipOrderPlaced(args) {
1373
+ * console.log('Flip order placed:', args)
1374
+ * },
1375
+ * })
1376
+ *
1377
+ * return <div>Watching for flip order placements...</div>
1378
+ * }
1379
+ * ```
1380
+ *
1381
+ * @param parameters - Parameters.
1382
+ */
1383
+ export function useWatchFlipOrderPlaced<
1384
+ config extends Config = ResolvedRegister['config'],
1385
+ >(parameters: useWatchFlipOrderPlaced.Parameters<config> = {}) {
1386
+ const { enabled = true, onFlipOrderPlaced, ...rest } = parameters
1387
+
1388
+ const config = useConfig({ config: parameters.config })
1389
+ const configChainId = useChainId({ config })
1390
+ const chainId = parameters.chainId ?? configChainId
1391
+
1392
+ // biome-ignore lint/correctness/useExhaustiveDependencies: rest.x is explicitly listed
1393
+ useEffect(() => {
1394
+ if (!enabled) return
1395
+ if (!onFlipOrderPlaced) return
1396
+ return Actions.dex.watchFlipOrderPlaced(config, {
1397
+ ...rest,
1398
+ chainId,
1399
+ onFlipOrderPlaced,
1400
+ })
1401
+ }, [
1402
+ config,
1403
+ enabled,
1404
+ chainId,
1405
+ onFlipOrderPlaced,
1406
+ rest.fromBlock,
1407
+ rest.maker,
1408
+ rest.onError,
1409
+ rest.poll,
1410
+ rest.pollingInterval,
1411
+ rest.token,
1412
+ ])
1413
+ }
1414
+
1415
+ export declare namespace useWatchFlipOrderPlaced {
1416
+ type Parameters<config extends Config = Config> = UnionCompute<
1417
+ ExactPartial<Actions.dex.watchFlipOrderPlaced.Parameters<config>> &
1418
+ ConfigParameter<config> & { enabled?: boolean | undefined }
1419
+ >
1420
+ }
1421
+
1422
+ /**
1423
+ * Hook for watching order cancellation events on the DEX.
1424
+ *
1425
+ * @example
1426
+ * ```tsx
1427
+ * import { Hooks } from 'wagmi/tempo'
1428
+ *
1429
+ * function App() {
1430
+ * Hooks.dex.useWatchOrderCancelled({
1431
+ * onOrderCancelled(args) {
1432
+ * console.log('Order cancelled:', args)
1433
+ * },
1434
+ * })
1435
+ *
1436
+ * return <div>Watching for order cancellations...</div>
1437
+ * }
1438
+ * ```
1439
+ *
1440
+ * @param parameters - Parameters.
1441
+ */
1442
+ export function useWatchOrderCancelled<
1443
+ config extends Config = ResolvedRegister['config'],
1444
+ >(parameters: useWatchOrderCancelled.Parameters<config> = {}) {
1445
+ const { enabled = true, onOrderCancelled, ...rest } = parameters
1446
+
1447
+ const config = useConfig({ config: parameters.config })
1448
+ const configChainId = useChainId({ config })
1449
+ const chainId = parameters.chainId ?? configChainId
1450
+
1451
+ // biome-ignore lint/correctness/useExhaustiveDependencies: rest.x is explicitly listed
1452
+ useEffect(() => {
1453
+ if (!enabled) return
1454
+ if (!onOrderCancelled) return
1455
+ return Actions.dex.watchOrderCancelled(config, {
1456
+ ...rest,
1457
+ chainId,
1458
+ onOrderCancelled,
1459
+ })
1460
+ }, [
1461
+ config,
1462
+ enabled,
1463
+ chainId,
1464
+ onOrderCancelled,
1465
+ rest.fromBlock,
1466
+ rest.onError,
1467
+ rest.orderId,
1468
+ rest.poll,
1469
+ rest.pollingInterval,
1470
+ ])
1471
+ }
1472
+
1473
+ export declare namespace useWatchOrderCancelled {
1474
+ type Parameters<config extends Config = Config> = UnionCompute<
1475
+ ExactPartial<Actions.dex.watchOrderCancelled.Parameters<config>> &
1476
+ ConfigParameter<config> & { enabled?: boolean | undefined }
1477
+ >
1478
+ }
1479
+
1480
+ /**
1481
+ * Hook for watching order filled events on the DEX.
1482
+ *
1483
+ * @example
1484
+ * ```tsx
1485
+ * import { Hooks } from 'wagmi/tempo'
1486
+ *
1487
+ * function App() {
1488
+ * Hooks.dex.useWatchOrderFilled({
1489
+ * onOrderFilled(args) {
1490
+ * console.log('Order filled:', args)
1491
+ * },
1492
+ * })
1493
+ *
1494
+ * return <div>Watching for order fills...</div>
1495
+ * }
1496
+ * ```
1497
+ *
1498
+ * @param parameters - Parameters.
1499
+ */
1500
+ export function useWatchOrderFilled<
1501
+ config extends Config = ResolvedRegister['config'],
1502
+ >(parameters: useWatchOrderFilled.Parameters<config> = {}) {
1503
+ const { enabled = true, onOrderFilled, ...rest } = parameters
1504
+
1505
+ const config = useConfig({ config: parameters.config })
1506
+ const configChainId = useChainId({ config })
1507
+ const chainId = parameters.chainId ?? configChainId
1508
+
1509
+ // biome-ignore lint/correctness/useExhaustiveDependencies: rest.x is explicitly listed
1510
+ useEffect(() => {
1511
+ if (!enabled) return
1512
+ if (!onOrderFilled) return
1513
+ return Actions.dex.watchOrderFilled(config, {
1514
+ ...rest,
1515
+ chainId,
1516
+ onOrderFilled,
1517
+ })
1518
+ }, [
1519
+ config,
1520
+ enabled,
1521
+ chainId,
1522
+ onOrderFilled,
1523
+ rest.fromBlock,
1524
+ rest.maker,
1525
+ rest.onError,
1526
+ rest.orderId,
1527
+ rest.poll,
1528
+ rest.pollingInterval,
1529
+ rest.taker,
1530
+ ])
1531
+ }
1532
+
1533
+ export declare namespace useWatchOrderFilled {
1534
+ type Parameters<config extends Config = Config> = UnionCompute<
1535
+ ExactPartial<Actions.dex.watchOrderFilled.Parameters<config>> &
1536
+ ConfigParameter<config> & { enabled?: boolean | undefined }
1537
+ >
1538
+ }
1539
+
1540
+ /**
1541
+ * Hook for watching order placement events on the DEX.
1542
+ *
1543
+ * @example
1544
+ * ```tsx
1545
+ * import { Hooks } from 'wagmi/tempo'
1546
+ *
1547
+ * function App() {
1548
+ * Hooks.dex.useWatchOrderPlaced({
1549
+ * onOrderPlaced(args) {
1550
+ * console.log('Order placed:', args)
1551
+ * },
1552
+ * })
1553
+ *
1554
+ * return <div>Watching for order placements...</div>
1555
+ * }
1556
+ * ```
1557
+ *
1558
+ * @param parameters - Parameters.
1559
+ */
1560
+ export function useWatchOrderPlaced<
1561
+ config extends Config = ResolvedRegister['config'],
1562
+ >(parameters: useWatchOrderPlaced.Parameters<config> = {}) {
1563
+ const { enabled = true, onOrderPlaced, ...rest } = parameters
1564
+
1565
+ const config = useConfig({ config: parameters.config })
1566
+ const configChainId = useChainId({ config })
1567
+ const chainId = parameters.chainId ?? configChainId
1568
+
1569
+ // biome-ignore lint/correctness/useExhaustiveDependencies: rest.x is explicitly listed
1570
+ useEffect(() => {
1571
+ if (!enabled) return
1572
+ if (!onOrderPlaced) return
1573
+ return Actions.dex.watchOrderPlaced(config, {
1574
+ ...rest,
1575
+ chainId,
1576
+ onOrderPlaced,
1577
+ })
1578
+ }, [
1579
+ config,
1580
+ enabled,
1581
+ chainId,
1582
+ onOrderPlaced,
1583
+ rest.fromBlock,
1584
+ rest.maker,
1585
+ rest.onError,
1586
+ rest.poll,
1587
+ rest.pollingInterval,
1588
+ rest.token,
1589
+ ])
1590
+ }
1591
+
1592
+ export declare namespace useWatchOrderPlaced {
1593
+ type Parameters<config extends Config = Config> = UnionCompute<
1594
+ ExactPartial<Actions.dex.watchOrderPlaced.Parameters<config>> &
1595
+ ConfigParameter<config> & { enabled?: boolean | undefined }
1596
+ >
1597
+ }