wagmi 3.6.2 → 3.6.3

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.
@@ -0,0 +1,927 @@
1
+ import type { UseMutationResult } from '@tanstack/react-query'
2
+ import type { Config, ResolvedRegister } from '@wagmi/core'
3
+ import type { ConfigParameter, ExactPartial } from '@wagmi/core/internal'
4
+ import { Actions } from '@wagmi/core/tempo'
5
+ import { useChainId } from '../../hooks/useChainId.js'
6
+ import { useConfig } from '../../hooks/useConfig.js'
7
+ import {
8
+ type UseMutationParameters,
9
+ type UseQueryReturnType,
10
+ useMutation,
11
+ useQuery,
12
+ } from '../../utils/query.js'
13
+ import type { QueryParameter } from '../utils.js'
14
+
15
+ /**
16
+ * Hook for getting information about the current zone authorization token.
17
+ *
18
+ * @example
19
+ * ```tsx
20
+ * import { Hooks } from 'wagmi/tempo'
21
+ * import { zone } from 'viem/tempo/zones'
22
+ *
23
+ * const zoneChain = zone(7)
24
+ *
25
+ * function App() {
26
+ * const { data, isLoading } = Hooks.zone.useAuthorizationTokenInfo({
27
+ * chainId: zoneChain.id,
28
+ * })
29
+ *
30
+ * if (isLoading) return <div>Loading...</div>
31
+ * return <div>Expires At: {data?.expiresAt.toString()}</div>
32
+ * }
33
+ * ```
34
+ *
35
+ * @param parameters - Parameters.
36
+ * @returns Query result with the current authorization token info.
37
+ */
38
+ export function useAuthorizationTokenInfo<
39
+ config extends Config = ResolvedRegister['config'],
40
+ selectData = Actions.zone.getAuthorizationTokenInfo.ReturnValue,
41
+ >(
42
+ parameters: useAuthorizationTokenInfo.Parameters<config, selectData> = {},
43
+ ): useAuthorizationTokenInfo.ReturnValue<selectData> {
44
+ const config = useConfig(parameters)
45
+ const chainId = useChainId({ config })
46
+ const options = Actions.zone.getAuthorizationTokenInfo.queryOptions(config, {
47
+ ...parameters,
48
+ chainId: parameters.chainId ?? chainId,
49
+ } as never)
50
+ return useQuery(options) as never
51
+ }
52
+
53
+ export declare namespace useAuthorizationTokenInfo {
54
+ export type Parameters<
55
+ config extends Config = ResolvedRegister['config'],
56
+ selectData = Actions.zone.getAuthorizationTokenInfo.ReturnValue,
57
+ > = ConfigParameter<config> &
58
+ QueryParameter<
59
+ Actions.zone.getAuthorizationTokenInfo.ReturnValue,
60
+ Actions.zone.getAuthorizationTokenInfo.ErrorType,
61
+ selectData,
62
+ Actions.zone.getAuthorizationTokenInfo.QueryKey<config>
63
+ > &
64
+ ExactPartial<Actions.zone.getAuthorizationTokenInfo.Parameters<config>>
65
+
66
+ export type ReturnValue<
67
+ selectData = Actions.zone.getAuthorizationTokenInfo.ReturnValue,
68
+ > = UseQueryReturnType<selectData, Error>
69
+ }
70
+
71
+ /**
72
+ * Hook for getting deposit processing status for a Tempo block number.
73
+ *
74
+ * @example
75
+ * ```tsx
76
+ * import { Hooks } from 'wagmi/tempo'
77
+ * import { zone } from 'viem/tempo/zones'
78
+ *
79
+ * const zoneChain = zone(7)
80
+ *
81
+ * function App() {
82
+ * const { data, isLoading } = Hooks.zone.useDepositStatus({
83
+ * chainId: zoneChain.id,
84
+ * tempoBlockNumber: 42n,
85
+ * })
86
+ *
87
+ * if (isLoading) return <div>Loading...</div>
88
+ * return <div>Processed: {String(data?.processed)}</div>
89
+ * }
90
+ * ```
91
+ *
92
+ * @param parameters - Parameters.
93
+ * @returns Query result with the current deposit status.
94
+ */
95
+ export function useDepositStatus<
96
+ config extends Config = ResolvedRegister['config'],
97
+ selectData = Actions.zone.getDepositStatus.ReturnValue,
98
+ >(
99
+ parameters: useDepositStatus.Parameters<config, selectData> = {},
100
+ ): useDepositStatus.ReturnValue<selectData> {
101
+ const config = useConfig(parameters)
102
+ const chainId = useChainId({ config })
103
+ const options = Actions.zone.getDepositStatus.queryOptions(config, {
104
+ ...parameters,
105
+ chainId: parameters.chainId ?? chainId,
106
+ } as never)
107
+ return useQuery(options) as never
108
+ }
109
+
110
+ export declare namespace useDepositStatus {
111
+ export type Parameters<
112
+ config extends Config = ResolvedRegister['config'],
113
+ selectData = Actions.zone.getDepositStatus.ReturnValue,
114
+ > = ConfigParameter<config> &
115
+ QueryParameter<
116
+ Actions.zone.getDepositStatus.ReturnValue,
117
+ Actions.zone.getDepositStatus.ErrorType,
118
+ selectData,
119
+ Actions.zone.getDepositStatus.QueryKey<config>
120
+ > &
121
+ ExactPartial<Actions.zone.getDepositStatus.Parameters<config>>
122
+
123
+ export type ReturnValue<
124
+ selectData = Actions.zone.getDepositStatus.ReturnValue,
125
+ > = UseQueryReturnType<selectData, Error>
126
+ }
127
+
128
+ /**
129
+ * Hook for getting the withdrawal fee for a given gas limit.
130
+ *
131
+ * @example
132
+ * ```tsx
133
+ * import { Hooks } from 'wagmi/tempo'
134
+ * import { zone } from 'viem/tempo/zones'
135
+ *
136
+ * const zoneChain = zone(7)
137
+ *
138
+ * function App() {
139
+ * const { data, isLoading } = Hooks.zone.useWithdrawalFee({
140
+ * chainId: zoneChain.id,
141
+ * gas: 21_000n,
142
+ * })
143
+ *
144
+ * if (isLoading) return <div>Loading...</div>
145
+ * return <div>Fee: {data?.toString()}</div>
146
+ * }
147
+ * ```
148
+ *
149
+ * @param parameters - Parameters.
150
+ * @returns Query result with the withdrawal fee.
151
+ */
152
+ export function useWithdrawalFee<
153
+ config extends Config = ResolvedRegister['config'],
154
+ selectData = Actions.zone.getWithdrawalFee.ReturnValue,
155
+ >(
156
+ parameters: useWithdrawalFee.Parameters<config, selectData> = {},
157
+ ): useWithdrawalFee.ReturnValue<selectData> {
158
+ const config = useConfig(parameters)
159
+ const chainId = useChainId({ config })
160
+ const options = Actions.zone.getWithdrawalFee.queryOptions(config, {
161
+ ...parameters,
162
+ chainId: parameters.chainId ?? chainId,
163
+ } as never)
164
+ return useQuery(options) as never
165
+ }
166
+
167
+ export declare namespace useWithdrawalFee {
168
+ export type Parameters<
169
+ config extends Config = ResolvedRegister['config'],
170
+ selectData = Actions.zone.getWithdrawalFee.ReturnValue,
171
+ > = ConfigParameter<config> &
172
+ QueryParameter<
173
+ Actions.zone.getWithdrawalFee.ReturnValue,
174
+ Actions.zone.getWithdrawalFee.ErrorType,
175
+ selectData,
176
+ Actions.zone.getWithdrawalFee.QueryKey<config>
177
+ > &
178
+ ExactPartial<Actions.zone.getWithdrawalFee.Parameters<config>>
179
+
180
+ export type ReturnValue<
181
+ selectData = Actions.zone.getWithdrawalFee.ReturnValue,
182
+ > = UseQueryReturnType<selectData, Error>
183
+ }
184
+
185
+ /**
186
+ * Hook for getting the current zone metadata.
187
+ *
188
+ * @example
189
+ * ```tsx
190
+ * import { Hooks } from 'wagmi/tempo'
191
+ * import { zone } from 'viem/tempo/zones'
192
+ *
193
+ * const zoneChain = zone(7)
194
+ *
195
+ * function App() {
196
+ * const { data, isLoading } = Hooks.zone.useZoneInfo({
197
+ * chainId: zoneChain.id,
198
+ * })
199
+ *
200
+ * if (isLoading) return <div>Loading...</div>
201
+ * return <div>Zone ID: {data?.zoneId}</div>
202
+ * }
203
+ * ```
204
+ *
205
+ * @param parameters - Parameters.
206
+ * @returns Query result with the current zone metadata.
207
+ */
208
+ export function useZoneInfo<
209
+ config extends Config = ResolvedRegister['config'],
210
+ selectData = Actions.zone.getZoneInfo.ReturnValue,
211
+ >(
212
+ parameters: useZoneInfo.Parameters<config, selectData> = {},
213
+ ): useZoneInfo.ReturnValue<selectData> {
214
+ const config = useConfig(parameters)
215
+ const chainId = useChainId({ config })
216
+ const options = Actions.zone.getZoneInfo.queryOptions(config, {
217
+ ...parameters,
218
+ chainId: parameters.chainId ?? chainId,
219
+ } as never)
220
+ return useQuery(options) as never
221
+ }
222
+
223
+ export declare namespace useZoneInfo {
224
+ export type Parameters<
225
+ config extends Config = ResolvedRegister['config'],
226
+ selectData = Actions.zone.getZoneInfo.ReturnValue,
227
+ > = ConfigParameter<config> &
228
+ QueryParameter<
229
+ Actions.zone.getZoneInfo.ReturnValue,
230
+ Actions.zone.getZoneInfo.ErrorType,
231
+ selectData,
232
+ Actions.zone.getZoneInfo.QueryKey<config>
233
+ > &
234
+ ExactPartial<Actions.zone.getZoneInfo.Parameters<config>>
235
+
236
+ export type ReturnValue<selectData = Actions.zone.getZoneInfo.ReturnValue> =
237
+ UseQueryReturnType<selectData, Error>
238
+ }
239
+
240
+ /**
241
+ * Hook for signing and storing a zone authorization token.
242
+ *
243
+ * @example
244
+ * ```tsx
245
+ * import { Hooks } from 'wagmi/tempo'
246
+ * import { zone } from 'viem/tempo/zones'
247
+ *
248
+ * const zoneChain = zone(7)
249
+ *
250
+ * function App() {
251
+ * const { mutate, isPending } = Hooks.zone.useSignAuthorizationToken()
252
+ *
253
+ * return (
254
+ * <button
255
+ * onClick={() => mutate({ chainId: zoneChain.id })}
256
+ * disabled={isPending}
257
+ * >
258
+ * Sign Zone Token
259
+ * </button>
260
+ * )
261
+ * }
262
+ * ```
263
+ *
264
+ * @param parameters - Parameters.
265
+ * @returns Mutation result.
266
+ */
267
+ export function useSignAuthorizationToken<
268
+ config extends Config = ResolvedRegister['config'],
269
+ context = unknown,
270
+ >(
271
+ parameters: useSignAuthorizationToken.Parameters<config, context> = {},
272
+ ): useSignAuthorizationToken.ReturnType<config, context> {
273
+ const { mutation = {} } = parameters
274
+ const config = useConfig(parameters)
275
+ return useMutation({
276
+ ...mutation,
277
+ async mutationFn(variables) {
278
+ return Actions.zone.signAuthorizationToken(config, variables)
279
+ },
280
+ mutationKey: ['signAuthorizationToken'],
281
+ })
282
+ }
283
+
284
+ export declare namespace useSignAuthorizationToken {
285
+ type Parameters<
286
+ config extends Config = Config,
287
+ context = unknown,
288
+ > = ConfigParameter<config> & {
289
+ mutation?:
290
+ | UseMutationParameters<
291
+ Actions.zone.signAuthorizationToken.ReturnValue,
292
+ Actions.zone.signAuthorizationToken.ErrorType,
293
+ Actions.zone.signAuthorizationToken.Parameters<config>,
294
+ context
295
+ >
296
+ | undefined
297
+ }
298
+
299
+ type ReturnType<
300
+ config extends Config = Config,
301
+ context = unknown,
302
+ > = UseMutationResult<
303
+ Actions.zone.signAuthorizationToken.ReturnValue,
304
+ Actions.zone.signAuthorizationToken.ErrorType,
305
+ Actions.zone.signAuthorizationToken.Parameters<config>,
306
+ context
307
+ >
308
+ }
309
+
310
+ /**
311
+ * Hook for depositing tokens into a zone on the parent Tempo chain.
312
+ *
313
+ * @example
314
+ * ```tsx
315
+ * import { Hooks } from 'wagmi/tempo'
316
+ *
317
+ * function App() {
318
+ * const { mutate, isPending } = Hooks.zone.useDeposit()
319
+ *
320
+ * return (
321
+ * <button
322
+ * onClick={() =>
323
+ * mutate({
324
+ * amount: 1_000_000n,
325
+ * token: '0x20c0000000000000000000000000000000000001',
326
+ * zoneId: 7,
327
+ * })
328
+ * }
329
+ * disabled={isPending}
330
+ * >
331
+ * Deposit
332
+ * </button>
333
+ * )
334
+ * }
335
+ * ```
336
+ *
337
+ * @param parameters - Parameters.
338
+ * @returns Mutation result.
339
+ */
340
+ export function useDeposit<
341
+ config extends Config = ResolvedRegister['config'],
342
+ context = unknown,
343
+ >(
344
+ parameters: useDeposit.Parameters<config, context> = {},
345
+ ): useDeposit.ReturnType<config, context> {
346
+ const { mutation = {} } = parameters
347
+ const config = useConfig(parameters)
348
+ return useMutation({
349
+ ...mutation,
350
+ async mutationFn(variables) {
351
+ return Actions.zone.deposit(config, variables)
352
+ },
353
+ mutationKey: ['deposit'],
354
+ })
355
+ }
356
+
357
+ export declare namespace useDeposit {
358
+ type Parameters<
359
+ config extends Config = Config,
360
+ context = unknown,
361
+ > = ConfigParameter<config> & {
362
+ mutation?:
363
+ | UseMutationParameters<
364
+ Actions.zone.deposit.ReturnValue,
365
+ Actions.zone.deposit.ErrorType,
366
+ Actions.zone.deposit.Parameters<config>,
367
+ context
368
+ >
369
+ | undefined
370
+ }
371
+
372
+ type ReturnType<
373
+ config extends Config = Config,
374
+ context = unknown,
375
+ > = UseMutationResult<
376
+ Actions.zone.deposit.ReturnValue,
377
+ Actions.zone.deposit.ErrorType,
378
+ Actions.zone.deposit.Parameters<config>,
379
+ context
380
+ >
381
+ }
382
+
383
+ /**
384
+ * Hook for depositing tokens into a zone on the parent Tempo chain.
385
+ *
386
+ * Note: This is a synchronous hook that waits for the transaction
387
+ * to be included on a block before returning a response.
388
+ *
389
+ * @example
390
+ * ```tsx
391
+ * import { Hooks } from 'wagmi/tempo'
392
+ *
393
+ * function App() {
394
+ * const { mutate, isPending } = Hooks.zone.useDepositSync()
395
+ *
396
+ * return (
397
+ * <button
398
+ * onClick={() =>
399
+ * mutate({
400
+ * amount: 1_000_000n,
401
+ * token: '0x20c0000000000000000000000000000000000001',
402
+ * zoneId: 7,
403
+ * })
404
+ * }
405
+ * disabled={isPending}
406
+ * >
407
+ * Deposit
408
+ * </button>
409
+ * )
410
+ * }
411
+ * ```
412
+ *
413
+ * @param parameters - Parameters.
414
+ * @returns Mutation result.
415
+ */
416
+ export function useDepositSync<
417
+ config extends Config = ResolvedRegister['config'],
418
+ context = unknown,
419
+ >(
420
+ parameters: useDepositSync.Parameters<config, context> = {},
421
+ ): useDepositSync.ReturnType<config, context> {
422
+ const { mutation = {} } = parameters
423
+ const config = useConfig(parameters)
424
+ return useMutation({
425
+ ...mutation,
426
+ async mutationFn(variables) {
427
+ return Actions.zone.depositSync(config, variables)
428
+ },
429
+ mutationKey: ['depositSync'],
430
+ })
431
+ }
432
+
433
+ export declare namespace useDepositSync {
434
+ type Parameters<
435
+ config extends Config = Config,
436
+ context = unknown,
437
+ > = ConfigParameter<config> & {
438
+ mutation?:
439
+ | UseMutationParameters<
440
+ Actions.zone.depositSync.ReturnValue,
441
+ Actions.zone.depositSync.ErrorType,
442
+ Actions.zone.depositSync.Parameters<config>,
443
+ context
444
+ >
445
+ | undefined
446
+ }
447
+
448
+ type ReturnType<
449
+ config extends Config = Config,
450
+ context = unknown,
451
+ > = UseMutationResult<
452
+ Actions.zone.depositSync.ReturnValue,
453
+ Actions.zone.depositSync.ErrorType,
454
+ Actions.zone.depositSync.Parameters<config>,
455
+ context
456
+ >
457
+ }
458
+
459
+ /**
460
+ * Hook for depositing tokens into a zone on the parent Tempo chain with an
461
+ * encrypted recipient and memo.
462
+ *
463
+ * @example
464
+ * ```tsx
465
+ * import { Hooks } from 'wagmi/tempo'
466
+ *
467
+ * function App() {
468
+ * const { mutate, isPending } = Hooks.zone.useEncryptedDeposit()
469
+ *
470
+ * return (
471
+ * <button
472
+ * onClick={() =>
473
+ * mutate({
474
+ * amount: 1_000_000n,
475
+ * token: '0x20c0000000000000000000000000000000000001',
476
+ * zoneId: 7,
477
+ * })
478
+ * }
479
+ * disabled={isPending}
480
+ * >
481
+ * Encrypted Deposit
482
+ * </button>
483
+ * )
484
+ * }
485
+ * ```
486
+ *
487
+ * @param parameters - Parameters.
488
+ * @returns Mutation result.
489
+ */
490
+ export function useEncryptedDeposit<
491
+ config extends Config = ResolvedRegister['config'],
492
+ context = unknown,
493
+ >(
494
+ parameters: useEncryptedDeposit.Parameters<config, context> = {},
495
+ ): useEncryptedDeposit.ReturnType<config, context> {
496
+ const { mutation = {} } = parameters
497
+ const config = useConfig(parameters)
498
+ return useMutation({
499
+ ...mutation,
500
+ async mutationFn(variables) {
501
+ return Actions.zone.encryptedDeposit(config, variables)
502
+ },
503
+ mutationKey: ['encryptedDeposit'],
504
+ })
505
+ }
506
+
507
+ export declare namespace useEncryptedDeposit {
508
+ type Parameters<
509
+ config extends Config = Config,
510
+ context = unknown,
511
+ > = ConfigParameter<config> & {
512
+ mutation?:
513
+ | UseMutationParameters<
514
+ Actions.zone.encryptedDeposit.ReturnValue,
515
+ Actions.zone.encryptedDeposit.ErrorType,
516
+ Actions.zone.encryptedDeposit.Parameters<config>,
517
+ context
518
+ >
519
+ | undefined
520
+ }
521
+
522
+ type ReturnType<
523
+ config extends Config = Config,
524
+ context = unknown,
525
+ > = UseMutationResult<
526
+ Actions.zone.encryptedDeposit.ReturnValue,
527
+ Actions.zone.encryptedDeposit.ErrorType,
528
+ Actions.zone.encryptedDeposit.Parameters<config>,
529
+ context
530
+ >
531
+ }
532
+
533
+ /**
534
+ * Hook for depositing tokens into a zone on the parent Tempo chain with an
535
+ * encrypted recipient and memo.
536
+ *
537
+ * Note: This is a synchronous hook that waits for the transaction
538
+ * to be included on a block before returning a response.
539
+ *
540
+ * @example
541
+ * ```tsx
542
+ * import { Hooks } from 'wagmi/tempo'
543
+ *
544
+ * function App() {
545
+ * const { mutate, isPending } = Hooks.zone.useEncryptedDepositSync()
546
+ *
547
+ * return (
548
+ * <button
549
+ * onClick={() =>
550
+ * mutate({
551
+ * amount: 1_000_000n,
552
+ * token: '0x20c0000000000000000000000000000000000001',
553
+ * zoneId: 7,
554
+ * })
555
+ * }
556
+ * disabled={isPending}
557
+ * >
558
+ * Encrypted Deposit
559
+ * </button>
560
+ * )
561
+ * }
562
+ * ```
563
+ *
564
+ * @param parameters - Parameters.
565
+ * @returns Mutation result.
566
+ */
567
+ export function useEncryptedDepositSync<
568
+ config extends Config = ResolvedRegister['config'],
569
+ context = unknown,
570
+ >(
571
+ parameters: useEncryptedDepositSync.Parameters<config, context> = {},
572
+ ): useEncryptedDepositSync.ReturnType<config, context> {
573
+ const { mutation = {} } = parameters
574
+ const config = useConfig(parameters)
575
+ return useMutation({
576
+ ...mutation,
577
+ async mutationFn(variables) {
578
+ return Actions.zone.encryptedDepositSync(config, variables)
579
+ },
580
+ mutationKey: ['encryptedDepositSync'],
581
+ })
582
+ }
583
+
584
+ export declare namespace useEncryptedDepositSync {
585
+ type Parameters<
586
+ config extends Config = Config,
587
+ context = unknown,
588
+ > = ConfigParameter<config> & {
589
+ mutation?:
590
+ | UseMutationParameters<
591
+ Actions.zone.encryptedDepositSync.ReturnValue,
592
+ Actions.zone.encryptedDepositSync.ErrorType,
593
+ Actions.zone.encryptedDepositSync.Parameters<config>,
594
+ context
595
+ >
596
+ | undefined
597
+ }
598
+
599
+ type ReturnType<
600
+ config extends Config = Config,
601
+ context = unknown,
602
+ > = UseMutationResult<
603
+ Actions.zone.encryptedDepositSync.ReturnValue,
604
+ Actions.zone.encryptedDepositSync.ErrorType,
605
+ Actions.zone.encryptedDepositSync.Parameters<config>,
606
+ context
607
+ >
608
+ }
609
+
610
+ /**
611
+ * Hook for requesting a withdrawal from a zone to the parent Tempo chain.
612
+ *
613
+ * @example
614
+ * ```tsx
615
+ * import { Hooks } from 'wagmi/tempo'
616
+ * import { zone } from 'viem/tempo/zones'
617
+ *
618
+ * const zoneChain = zone(7)
619
+ *
620
+ * function App() {
621
+ * const { mutate, isPending } = Hooks.zone.useRequestWithdrawal()
622
+ *
623
+ * return (
624
+ * <button
625
+ * onClick={() =>
626
+ * mutate({
627
+ * amount: 1_000_000n,
628
+ * chainId: zoneChain.id,
629
+ * token: '0x20c0000000000000000000000000000000000001',
630
+ * })
631
+ * }
632
+ * disabled={isPending}
633
+ * >
634
+ * Request Withdrawal
635
+ * </button>
636
+ * )
637
+ * }
638
+ * ```
639
+ *
640
+ * @param parameters - Parameters.
641
+ * @returns Mutation result.
642
+ */
643
+ export function useRequestWithdrawal<
644
+ config extends Config = ResolvedRegister['config'],
645
+ context = unknown,
646
+ >(
647
+ parameters: useRequestWithdrawal.Parameters<config, context> = {},
648
+ ): useRequestWithdrawal.ReturnType<config, context> {
649
+ const { mutation = {} } = parameters
650
+ const config = useConfig(parameters)
651
+ return useMutation({
652
+ ...mutation,
653
+ async mutationFn(variables) {
654
+ return Actions.zone.requestWithdrawal(config, variables)
655
+ },
656
+ mutationKey: ['requestWithdrawal'],
657
+ })
658
+ }
659
+
660
+ export declare namespace useRequestWithdrawal {
661
+ type Parameters<
662
+ config extends Config = Config,
663
+ context = unknown,
664
+ > = ConfigParameter<config> & {
665
+ mutation?:
666
+ | UseMutationParameters<
667
+ Actions.zone.requestWithdrawal.ReturnValue,
668
+ Actions.zone.requestWithdrawal.ErrorType,
669
+ Actions.zone.requestWithdrawal.Parameters<config>,
670
+ context
671
+ >
672
+ | undefined
673
+ }
674
+
675
+ type ReturnType<
676
+ config extends Config = Config,
677
+ context = unknown,
678
+ > = UseMutationResult<
679
+ Actions.zone.requestWithdrawal.ReturnValue,
680
+ Actions.zone.requestWithdrawal.ErrorType,
681
+ Actions.zone.requestWithdrawal.Parameters<config>,
682
+ context
683
+ >
684
+ }
685
+
686
+ /**
687
+ * Hook for requesting a withdrawal from a zone to the parent Tempo chain.
688
+ *
689
+ * Note: This is a synchronous hook that waits for the transaction
690
+ * to be included on a block before returning a response.
691
+ *
692
+ * @example
693
+ * ```tsx
694
+ * import { Hooks } from 'wagmi/tempo'
695
+ * import { zone } from 'viem/tempo/zones'
696
+ *
697
+ * const zoneChain = zone(7)
698
+ *
699
+ * function App() {
700
+ * const { mutate, isPending } = Hooks.zone.useRequestWithdrawalSync()
701
+ *
702
+ * return (
703
+ * <button
704
+ * onClick={() =>
705
+ * mutate({
706
+ * amount: 1_000_000n,
707
+ * chainId: zoneChain.id,
708
+ * token: '0x20c0000000000000000000000000000000000001',
709
+ * })
710
+ * }
711
+ * disabled={isPending}
712
+ * >
713
+ * Request Withdrawal
714
+ * </button>
715
+ * )
716
+ * }
717
+ * ```
718
+ *
719
+ * @param parameters - Parameters.
720
+ * @returns Mutation result.
721
+ */
722
+ export function useRequestWithdrawalSync<
723
+ config extends Config = ResolvedRegister['config'],
724
+ context = unknown,
725
+ >(
726
+ parameters: useRequestWithdrawalSync.Parameters<config, context> = {},
727
+ ): useRequestWithdrawalSync.ReturnType<config, context> {
728
+ const { mutation = {} } = parameters
729
+ const config = useConfig(parameters)
730
+ return useMutation({
731
+ ...mutation,
732
+ async mutationFn(variables) {
733
+ return Actions.zone.requestWithdrawalSync(config, variables)
734
+ },
735
+ mutationKey: ['requestWithdrawalSync'],
736
+ })
737
+ }
738
+
739
+ export declare namespace useRequestWithdrawalSync {
740
+ type Parameters<
741
+ config extends Config = Config,
742
+ context = unknown,
743
+ > = ConfigParameter<config> & {
744
+ mutation?:
745
+ | UseMutationParameters<
746
+ Actions.zone.requestWithdrawalSync.ReturnValue,
747
+ Actions.zone.requestWithdrawalSync.ErrorType,
748
+ Actions.zone.requestWithdrawalSync.Parameters<config>,
749
+ context
750
+ >
751
+ | undefined
752
+ }
753
+
754
+ type ReturnType<
755
+ config extends Config = Config,
756
+ context = unknown,
757
+ > = UseMutationResult<
758
+ Actions.zone.requestWithdrawalSync.ReturnValue,
759
+ Actions.zone.requestWithdrawalSync.ErrorType,
760
+ Actions.zone.requestWithdrawalSync.Parameters<config>,
761
+ context
762
+ >
763
+ }
764
+
765
+ /**
766
+ * Hook for requesting a verifiable withdrawal from a zone to the parent Tempo
767
+ * chain.
768
+ *
769
+ * @example
770
+ * ```tsx
771
+ * import { Hooks } from 'wagmi/tempo'
772
+ * import { zone } from 'viem/tempo/zones'
773
+ *
774
+ * const zoneChain = zone(7)
775
+ *
776
+ * function App() {
777
+ * const { mutate, isPending } = Hooks.zone.useRequestVerifiableWithdrawal()
778
+ *
779
+ * return (
780
+ * <button
781
+ * onClick={() =>
782
+ * mutate({
783
+ * amount: 1_000_000n,
784
+ * chainId: zoneChain.id,
785
+ * revealTo:
786
+ * '0x0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798',
787
+ * token: '0x20c0000000000000000000000000000000000001',
788
+ * })
789
+ * }
790
+ * disabled={isPending}
791
+ * >
792
+ * Request Verifiable Withdrawal
793
+ * </button>
794
+ * )
795
+ * }
796
+ * ```
797
+ *
798
+ * @param parameters - Parameters.
799
+ * @returns Mutation result.
800
+ */
801
+ export function useRequestVerifiableWithdrawal<
802
+ config extends Config = ResolvedRegister['config'],
803
+ context = unknown,
804
+ >(
805
+ parameters: useRequestVerifiableWithdrawal.Parameters<config, context> = {},
806
+ ): useRequestVerifiableWithdrawal.ReturnType<config, context> {
807
+ const { mutation = {} } = parameters
808
+ const config = useConfig(parameters)
809
+ return useMutation({
810
+ ...mutation,
811
+ async mutationFn(variables) {
812
+ return Actions.zone.requestVerifiableWithdrawal(config, variables)
813
+ },
814
+ mutationKey: ['requestVerifiableWithdrawal'],
815
+ })
816
+ }
817
+
818
+ export declare namespace useRequestVerifiableWithdrawal {
819
+ type Parameters<
820
+ config extends Config = Config,
821
+ context = unknown,
822
+ > = ConfigParameter<config> & {
823
+ mutation?:
824
+ | UseMutationParameters<
825
+ Actions.zone.requestVerifiableWithdrawal.ReturnValue,
826
+ Actions.zone.requestVerifiableWithdrawal.ErrorType,
827
+ Actions.zone.requestVerifiableWithdrawal.Parameters<config>,
828
+ context
829
+ >
830
+ | undefined
831
+ }
832
+
833
+ type ReturnType<
834
+ config extends Config = Config,
835
+ context = unknown,
836
+ > = UseMutationResult<
837
+ Actions.zone.requestVerifiableWithdrawal.ReturnValue,
838
+ Actions.zone.requestVerifiableWithdrawal.ErrorType,
839
+ Actions.zone.requestVerifiableWithdrawal.Parameters<config>,
840
+ context
841
+ >
842
+ }
843
+
844
+ /**
845
+ * Hook for requesting a verifiable withdrawal from a zone to the parent Tempo
846
+ * chain.
847
+ *
848
+ * Note: This is a synchronous hook that waits for the transaction
849
+ * to be included on a block before returning a response.
850
+ *
851
+ * @example
852
+ * ```tsx
853
+ * import { Hooks } from 'wagmi/tempo'
854
+ * import { zone } from 'viem/tempo/zones'
855
+ *
856
+ * const zoneChain = zone(7)
857
+ *
858
+ * function App() {
859
+ * const { mutate, isPending } = Hooks.zone.useRequestVerifiableWithdrawalSync()
860
+ *
861
+ * return (
862
+ * <button
863
+ * onClick={() =>
864
+ * mutate({
865
+ * amount: 1_000_000n,
866
+ * chainId: zoneChain.id,
867
+ * revealTo:
868
+ * '0x0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798',
869
+ * token: '0x20c0000000000000000000000000000000000001',
870
+ * })
871
+ * }
872
+ * disabled={isPending}
873
+ * >
874
+ * Request Verifiable Withdrawal
875
+ * </button>
876
+ * )
877
+ * }
878
+ * ```
879
+ *
880
+ * @param parameters - Parameters.
881
+ * @returns Mutation result.
882
+ */
883
+ export function useRequestVerifiableWithdrawalSync<
884
+ config extends Config = ResolvedRegister['config'],
885
+ context = unknown,
886
+ >(
887
+ parameters: useRequestVerifiableWithdrawalSync.Parameters<
888
+ config,
889
+ context
890
+ > = {},
891
+ ): useRequestVerifiableWithdrawalSync.ReturnType<config, context> {
892
+ const { mutation = {} } = parameters
893
+ const config = useConfig(parameters)
894
+ return useMutation({
895
+ ...mutation,
896
+ async mutationFn(variables) {
897
+ return Actions.zone.requestVerifiableWithdrawalSync(config, variables)
898
+ },
899
+ mutationKey: ['requestVerifiableWithdrawalSync'],
900
+ })
901
+ }
902
+
903
+ export declare namespace useRequestVerifiableWithdrawalSync {
904
+ type Parameters<
905
+ config extends Config = Config,
906
+ context = unknown,
907
+ > = ConfigParameter<config> & {
908
+ mutation?:
909
+ | UseMutationParameters<
910
+ Actions.zone.requestVerifiableWithdrawalSync.ReturnValue,
911
+ Actions.zone.requestVerifiableWithdrawalSync.ErrorType,
912
+ Actions.zone.requestVerifiableWithdrawalSync.Parameters<config>,
913
+ context
914
+ >
915
+ | undefined
916
+ }
917
+
918
+ type ReturnType<
919
+ config extends Config = Config,
920
+ context = unknown,
921
+ > = UseMutationResult<
922
+ Actions.zone.requestVerifiableWithdrawalSync.ReturnValue,
923
+ Actions.zone.requestVerifiableWithdrawalSync.ErrorType,
924
+ Actions.zone.requestVerifiableWithdrawalSync.Parameters<config>,
925
+ context
926
+ >
927
+ }