wagmi 3.6.2 → 3.6.4
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/tempo/hooks/index.js +1 -0
- package/dist/esm/tempo/hooks/index.js.map +1 -1
- package/dist/esm/tempo/hooks/zone.js +533 -0
- package/dist/esm/tempo/hooks/zone.js.map +1 -0
- package/dist/esm/tsconfig.build.tsbuildinfo +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/types/tempo/hooks/index.d.ts +1 -0
- package/dist/types/tempo/hooks/index.d.ts.map +1 -1
- package/dist/types/tempo/hooks/zone.d.ts +483 -0
- package/dist/types/tempo/hooks/zone.d.ts.map +1 -0
- package/dist/types/version.d.ts +1 -1
- package/package.json +3 -3
- package/src/tempo/hooks/index.ts +1 -0
- package/src/tempo/hooks/zone.ts +927 -0
- package/src/version.ts +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/tempo/hooks/index.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,qDAAqD;AACrD,OAAO,KAAK,GAAG,MAAM,UAAU,CAAA;AAC/B,OAAO,KAAK,GAAG,MAAM,UAAU,CAAA;AAC/B,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AACrC,OAAO,KAAK,GAAG,MAAM,UAAU,CAAA;AAC/B,OAAO,KAAK,KAAK,MAAM,YAAY,CAAA;AACnC,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AACrC,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AACrC,OAAO,KAAK,KAAK,MAAM,YAAY,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/tempo/hooks/index.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,qDAAqD;AACrD,OAAO,KAAK,GAAG,MAAM,UAAU,CAAA;AAC/B,OAAO,KAAK,GAAG,MAAM,UAAU,CAAA;AAC/B,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AACrC,OAAO,KAAK,GAAG,MAAM,UAAU,CAAA;AAC/B,OAAO,KAAK,KAAK,MAAM,YAAY,CAAA;AACnC,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AACrC,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AACrC,OAAO,KAAK,KAAK,MAAM,YAAY,CAAA;AACnC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAA"}
|
|
@@ -0,0 +1,533 @@
|
|
|
1
|
+
import { Actions } from '@wagmi/core/tempo';
|
|
2
|
+
import { useChainId } from '../../hooks/useChainId.js';
|
|
3
|
+
import { useConfig } from '../../hooks/useConfig.js';
|
|
4
|
+
import { useMutation, useQuery, } from '../../utils/query.js';
|
|
5
|
+
/**
|
|
6
|
+
* Hook for getting information about the current zone authorization token.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```tsx
|
|
10
|
+
* import { Hooks } from 'wagmi/tempo'
|
|
11
|
+
* import { zone } from 'viem/tempo/zones'
|
|
12
|
+
*
|
|
13
|
+
* const zoneChain = zone(7)
|
|
14
|
+
*
|
|
15
|
+
* function App() {
|
|
16
|
+
* const { data, isLoading } = Hooks.zone.useAuthorizationTokenInfo({
|
|
17
|
+
* chainId: zoneChain.id,
|
|
18
|
+
* })
|
|
19
|
+
*
|
|
20
|
+
* if (isLoading) return <div>Loading...</div>
|
|
21
|
+
* return <div>Expires At: {data?.expiresAt.toString()}</div>
|
|
22
|
+
* }
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* @param parameters - Parameters.
|
|
26
|
+
* @returns Query result with the current authorization token info.
|
|
27
|
+
*/
|
|
28
|
+
export function useAuthorizationTokenInfo(parameters = {}) {
|
|
29
|
+
const config = useConfig(parameters);
|
|
30
|
+
const chainId = useChainId({ config });
|
|
31
|
+
const options = Actions.zone.getAuthorizationTokenInfo.queryOptions(config, {
|
|
32
|
+
...parameters,
|
|
33
|
+
chainId: parameters.chainId ?? chainId,
|
|
34
|
+
});
|
|
35
|
+
return useQuery(options);
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Hook for getting deposit processing status for a Tempo block number.
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```tsx
|
|
42
|
+
* import { Hooks } from 'wagmi/tempo'
|
|
43
|
+
* import { zone } from 'viem/tempo/zones'
|
|
44
|
+
*
|
|
45
|
+
* const zoneChain = zone(7)
|
|
46
|
+
*
|
|
47
|
+
* function App() {
|
|
48
|
+
* const { data, isLoading } = Hooks.zone.useDepositStatus({
|
|
49
|
+
* chainId: zoneChain.id,
|
|
50
|
+
* tempoBlockNumber: 42n,
|
|
51
|
+
* })
|
|
52
|
+
*
|
|
53
|
+
* if (isLoading) return <div>Loading...</div>
|
|
54
|
+
* return <div>Processed: {String(data?.processed)}</div>
|
|
55
|
+
* }
|
|
56
|
+
* ```
|
|
57
|
+
*
|
|
58
|
+
* @param parameters - Parameters.
|
|
59
|
+
* @returns Query result with the current deposit status.
|
|
60
|
+
*/
|
|
61
|
+
export function useDepositStatus(parameters = {}) {
|
|
62
|
+
const config = useConfig(parameters);
|
|
63
|
+
const chainId = useChainId({ config });
|
|
64
|
+
const options = Actions.zone.getDepositStatus.queryOptions(config, {
|
|
65
|
+
...parameters,
|
|
66
|
+
chainId: parameters.chainId ?? chainId,
|
|
67
|
+
});
|
|
68
|
+
return useQuery(options);
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Hook for getting the withdrawal fee for a given gas limit.
|
|
72
|
+
*
|
|
73
|
+
* @example
|
|
74
|
+
* ```tsx
|
|
75
|
+
* import { Hooks } from 'wagmi/tempo'
|
|
76
|
+
* import { zone } from 'viem/tempo/zones'
|
|
77
|
+
*
|
|
78
|
+
* const zoneChain = zone(7)
|
|
79
|
+
*
|
|
80
|
+
* function App() {
|
|
81
|
+
* const { data, isLoading } = Hooks.zone.useWithdrawalFee({
|
|
82
|
+
* chainId: zoneChain.id,
|
|
83
|
+
* gas: 21_000n,
|
|
84
|
+
* })
|
|
85
|
+
*
|
|
86
|
+
* if (isLoading) return <div>Loading...</div>
|
|
87
|
+
* return <div>Fee: {data?.toString()}</div>
|
|
88
|
+
* }
|
|
89
|
+
* ```
|
|
90
|
+
*
|
|
91
|
+
* @param parameters - Parameters.
|
|
92
|
+
* @returns Query result with the withdrawal fee.
|
|
93
|
+
*/
|
|
94
|
+
export function useWithdrawalFee(parameters = {}) {
|
|
95
|
+
const config = useConfig(parameters);
|
|
96
|
+
const chainId = useChainId({ config });
|
|
97
|
+
const options = Actions.zone.getWithdrawalFee.queryOptions(config, {
|
|
98
|
+
...parameters,
|
|
99
|
+
chainId: parameters.chainId ?? chainId,
|
|
100
|
+
});
|
|
101
|
+
return useQuery(options);
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Hook for getting the current zone metadata.
|
|
105
|
+
*
|
|
106
|
+
* @example
|
|
107
|
+
* ```tsx
|
|
108
|
+
* import { Hooks } from 'wagmi/tempo'
|
|
109
|
+
* import { zone } from 'viem/tempo/zones'
|
|
110
|
+
*
|
|
111
|
+
* const zoneChain = zone(7)
|
|
112
|
+
*
|
|
113
|
+
* function App() {
|
|
114
|
+
* const { data, isLoading } = Hooks.zone.useZoneInfo({
|
|
115
|
+
* chainId: zoneChain.id,
|
|
116
|
+
* })
|
|
117
|
+
*
|
|
118
|
+
* if (isLoading) return <div>Loading...</div>
|
|
119
|
+
* return <div>Zone ID: {data?.zoneId}</div>
|
|
120
|
+
* }
|
|
121
|
+
* ```
|
|
122
|
+
*
|
|
123
|
+
* @param parameters - Parameters.
|
|
124
|
+
* @returns Query result with the current zone metadata.
|
|
125
|
+
*/
|
|
126
|
+
export function useZoneInfo(parameters = {}) {
|
|
127
|
+
const config = useConfig(parameters);
|
|
128
|
+
const chainId = useChainId({ config });
|
|
129
|
+
const options = Actions.zone.getZoneInfo.queryOptions(config, {
|
|
130
|
+
...parameters,
|
|
131
|
+
chainId: parameters.chainId ?? chainId,
|
|
132
|
+
});
|
|
133
|
+
return useQuery(options);
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Hook for signing and storing a zone authorization token.
|
|
137
|
+
*
|
|
138
|
+
* @example
|
|
139
|
+
* ```tsx
|
|
140
|
+
* import { Hooks } from 'wagmi/tempo'
|
|
141
|
+
* import { zone } from 'viem/tempo/zones'
|
|
142
|
+
*
|
|
143
|
+
* const zoneChain = zone(7)
|
|
144
|
+
*
|
|
145
|
+
* function App() {
|
|
146
|
+
* const { mutate, isPending } = Hooks.zone.useSignAuthorizationToken()
|
|
147
|
+
*
|
|
148
|
+
* return (
|
|
149
|
+
* <button
|
|
150
|
+
* onClick={() => mutate({ chainId: zoneChain.id })}
|
|
151
|
+
* disabled={isPending}
|
|
152
|
+
* >
|
|
153
|
+
* Sign Zone Token
|
|
154
|
+
* </button>
|
|
155
|
+
* )
|
|
156
|
+
* }
|
|
157
|
+
* ```
|
|
158
|
+
*
|
|
159
|
+
* @param parameters - Parameters.
|
|
160
|
+
* @returns Mutation result.
|
|
161
|
+
*/
|
|
162
|
+
export function useSignAuthorizationToken(parameters = {}) {
|
|
163
|
+
const { mutation = {} } = parameters;
|
|
164
|
+
const config = useConfig(parameters);
|
|
165
|
+
return useMutation({
|
|
166
|
+
...mutation,
|
|
167
|
+
async mutationFn(variables) {
|
|
168
|
+
return Actions.zone.signAuthorizationToken(config, variables);
|
|
169
|
+
},
|
|
170
|
+
mutationKey: ['signAuthorizationToken'],
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Hook for depositing tokens into a zone on the parent Tempo chain.
|
|
175
|
+
*
|
|
176
|
+
* @example
|
|
177
|
+
* ```tsx
|
|
178
|
+
* import { Hooks } from 'wagmi/tempo'
|
|
179
|
+
*
|
|
180
|
+
* function App() {
|
|
181
|
+
* const { mutate, isPending } = Hooks.zone.useDeposit()
|
|
182
|
+
*
|
|
183
|
+
* return (
|
|
184
|
+
* <button
|
|
185
|
+
* onClick={() =>
|
|
186
|
+
* mutate({
|
|
187
|
+
* amount: 1_000_000n,
|
|
188
|
+
* token: '0x20c0000000000000000000000000000000000001',
|
|
189
|
+
* zoneId: 7,
|
|
190
|
+
* })
|
|
191
|
+
* }
|
|
192
|
+
* disabled={isPending}
|
|
193
|
+
* >
|
|
194
|
+
* Deposit
|
|
195
|
+
* </button>
|
|
196
|
+
* )
|
|
197
|
+
* }
|
|
198
|
+
* ```
|
|
199
|
+
*
|
|
200
|
+
* @param parameters - Parameters.
|
|
201
|
+
* @returns Mutation result.
|
|
202
|
+
*/
|
|
203
|
+
export function useDeposit(parameters = {}) {
|
|
204
|
+
const { mutation = {} } = parameters;
|
|
205
|
+
const config = useConfig(parameters);
|
|
206
|
+
return useMutation({
|
|
207
|
+
...mutation,
|
|
208
|
+
async mutationFn(variables) {
|
|
209
|
+
return Actions.zone.deposit(config, variables);
|
|
210
|
+
},
|
|
211
|
+
mutationKey: ['deposit'],
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Hook for depositing tokens into a zone on the parent Tempo chain.
|
|
216
|
+
*
|
|
217
|
+
* Note: This is a synchronous hook that waits for the transaction
|
|
218
|
+
* to be included on a block before returning a response.
|
|
219
|
+
*
|
|
220
|
+
* @example
|
|
221
|
+
* ```tsx
|
|
222
|
+
* import { Hooks } from 'wagmi/tempo'
|
|
223
|
+
*
|
|
224
|
+
* function App() {
|
|
225
|
+
* const { mutate, isPending } = Hooks.zone.useDepositSync()
|
|
226
|
+
*
|
|
227
|
+
* return (
|
|
228
|
+
* <button
|
|
229
|
+
* onClick={() =>
|
|
230
|
+
* mutate({
|
|
231
|
+
* amount: 1_000_000n,
|
|
232
|
+
* token: '0x20c0000000000000000000000000000000000001',
|
|
233
|
+
* zoneId: 7,
|
|
234
|
+
* })
|
|
235
|
+
* }
|
|
236
|
+
* disabled={isPending}
|
|
237
|
+
* >
|
|
238
|
+
* Deposit
|
|
239
|
+
* </button>
|
|
240
|
+
* )
|
|
241
|
+
* }
|
|
242
|
+
* ```
|
|
243
|
+
*
|
|
244
|
+
* @param parameters - Parameters.
|
|
245
|
+
* @returns Mutation result.
|
|
246
|
+
*/
|
|
247
|
+
export function useDepositSync(parameters = {}) {
|
|
248
|
+
const { mutation = {} } = parameters;
|
|
249
|
+
const config = useConfig(parameters);
|
|
250
|
+
return useMutation({
|
|
251
|
+
...mutation,
|
|
252
|
+
async mutationFn(variables) {
|
|
253
|
+
return Actions.zone.depositSync(config, variables);
|
|
254
|
+
},
|
|
255
|
+
mutationKey: ['depositSync'],
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* Hook for depositing tokens into a zone on the parent Tempo chain with an
|
|
260
|
+
* encrypted recipient and memo.
|
|
261
|
+
*
|
|
262
|
+
* @example
|
|
263
|
+
* ```tsx
|
|
264
|
+
* import { Hooks } from 'wagmi/tempo'
|
|
265
|
+
*
|
|
266
|
+
* function App() {
|
|
267
|
+
* const { mutate, isPending } = Hooks.zone.useEncryptedDeposit()
|
|
268
|
+
*
|
|
269
|
+
* return (
|
|
270
|
+
* <button
|
|
271
|
+
* onClick={() =>
|
|
272
|
+
* mutate({
|
|
273
|
+
* amount: 1_000_000n,
|
|
274
|
+
* token: '0x20c0000000000000000000000000000000000001',
|
|
275
|
+
* zoneId: 7,
|
|
276
|
+
* })
|
|
277
|
+
* }
|
|
278
|
+
* disabled={isPending}
|
|
279
|
+
* >
|
|
280
|
+
* Encrypted Deposit
|
|
281
|
+
* </button>
|
|
282
|
+
* )
|
|
283
|
+
* }
|
|
284
|
+
* ```
|
|
285
|
+
*
|
|
286
|
+
* @param parameters - Parameters.
|
|
287
|
+
* @returns Mutation result.
|
|
288
|
+
*/
|
|
289
|
+
export function useEncryptedDeposit(parameters = {}) {
|
|
290
|
+
const { mutation = {} } = parameters;
|
|
291
|
+
const config = useConfig(parameters);
|
|
292
|
+
return useMutation({
|
|
293
|
+
...mutation,
|
|
294
|
+
async mutationFn(variables) {
|
|
295
|
+
return Actions.zone.encryptedDeposit(config, variables);
|
|
296
|
+
},
|
|
297
|
+
mutationKey: ['encryptedDeposit'],
|
|
298
|
+
});
|
|
299
|
+
}
|
|
300
|
+
/**
|
|
301
|
+
* Hook for depositing tokens into a zone on the parent Tempo chain with an
|
|
302
|
+
* encrypted recipient and memo.
|
|
303
|
+
*
|
|
304
|
+
* Note: This is a synchronous hook that waits for the transaction
|
|
305
|
+
* to be included on a block before returning a response.
|
|
306
|
+
*
|
|
307
|
+
* @example
|
|
308
|
+
* ```tsx
|
|
309
|
+
* import { Hooks } from 'wagmi/tempo'
|
|
310
|
+
*
|
|
311
|
+
* function App() {
|
|
312
|
+
* const { mutate, isPending } = Hooks.zone.useEncryptedDepositSync()
|
|
313
|
+
*
|
|
314
|
+
* return (
|
|
315
|
+
* <button
|
|
316
|
+
* onClick={() =>
|
|
317
|
+
* mutate({
|
|
318
|
+
* amount: 1_000_000n,
|
|
319
|
+
* token: '0x20c0000000000000000000000000000000000001',
|
|
320
|
+
* zoneId: 7,
|
|
321
|
+
* })
|
|
322
|
+
* }
|
|
323
|
+
* disabled={isPending}
|
|
324
|
+
* >
|
|
325
|
+
* Encrypted Deposit
|
|
326
|
+
* </button>
|
|
327
|
+
* )
|
|
328
|
+
* }
|
|
329
|
+
* ```
|
|
330
|
+
*
|
|
331
|
+
* @param parameters - Parameters.
|
|
332
|
+
* @returns Mutation result.
|
|
333
|
+
*/
|
|
334
|
+
export function useEncryptedDepositSync(parameters = {}) {
|
|
335
|
+
const { mutation = {} } = parameters;
|
|
336
|
+
const config = useConfig(parameters);
|
|
337
|
+
return useMutation({
|
|
338
|
+
...mutation,
|
|
339
|
+
async mutationFn(variables) {
|
|
340
|
+
return Actions.zone.encryptedDepositSync(config, variables);
|
|
341
|
+
},
|
|
342
|
+
mutationKey: ['encryptedDepositSync'],
|
|
343
|
+
});
|
|
344
|
+
}
|
|
345
|
+
/**
|
|
346
|
+
* Hook for requesting a withdrawal from a zone to the parent Tempo chain.
|
|
347
|
+
*
|
|
348
|
+
* @example
|
|
349
|
+
* ```tsx
|
|
350
|
+
* import { Hooks } from 'wagmi/tempo'
|
|
351
|
+
* import { zone } from 'viem/tempo/zones'
|
|
352
|
+
*
|
|
353
|
+
* const zoneChain = zone(7)
|
|
354
|
+
*
|
|
355
|
+
* function App() {
|
|
356
|
+
* const { mutate, isPending } = Hooks.zone.useRequestWithdrawal()
|
|
357
|
+
*
|
|
358
|
+
* return (
|
|
359
|
+
* <button
|
|
360
|
+
* onClick={() =>
|
|
361
|
+
* mutate({
|
|
362
|
+
* amount: 1_000_000n,
|
|
363
|
+
* chainId: zoneChain.id,
|
|
364
|
+
* token: '0x20c0000000000000000000000000000000000001',
|
|
365
|
+
* })
|
|
366
|
+
* }
|
|
367
|
+
* disabled={isPending}
|
|
368
|
+
* >
|
|
369
|
+
* Request Withdrawal
|
|
370
|
+
* </button>
|
|
371
|
+
* )
|
|
372
|
+
* }
|
|
373
|
+
* ```
|
|
374
|
+
*
|
|
375
|
+
* @param parameters - Parameters.
|
|
376
|
+
* @returns Mutation result.
|
|
377
|
+
*/
|
|
378
|
+
export function useRequestWithdrawal(parameters = {}) {
|
|
379
|
+
const { mutation = {} } = parameters;
|
|
380
|
+
const config = useConfig(parameters);
|
|
381
|
+
return useMutation({
|
|
382
|
+
...mutation,
|
|
383
|
+
async mutationFn(variables) {
|
|
384
|
+
return Actions.zone.requestWithdrawal(config, variables);
|
|
385
|
+
},
|
|
386
|
+
mutationKey: ['requestWithdrawal'],
|
|
387
|
+
});
|
|
388
|
+
}
|
|
389
|
+
/**
|
|
390
|
+
* Hook for requesting a withdrawal from a zone to the parent Tempo chain.
|
|
391
|
+
*
|
|
392
|
+
* Note: This is a synchronous hook that waits for the transaction
|
|
393
|
+
* to be included on a block before returning a response.
|
|
394
|
+
*
|
|
395
|
+
* @example
|
|
396
|
+
* ```tsx
|
|
397
|
+
* import { Hooks } from 'wagmi/tempo'
|
|
398
|
+
* import { zone } from 'viem/tempo/zones'
|
|
399
|
+
*
|
|
400
|
+
* const zoneChain = zone(7)
|
|
401
|
+
*
|
|
402
|
+
* function App() {
|
|
403
|
+
* const { mutate, isPending } = Hooks.zone.useRequestWithdrawalSync()
|
|
404
|
+
*
|
|
405
|
+
* return (
|
|
406
|
+
* <button
|
|
407
|
+
* onClick={() =>
|
|
408
|
+
* mutate({
|
|
409
|
+
* amount: 1_000_000n,
|
|
410
|
+
* chainId: zoneChain.id,
|
|
411
|
+
* token: '0x20c0000000000000000000000000000000000001',
|
|
412
|
+
* })
|
|
413
|
+
* }
|
|
414
|
+
* disabled={isPending}
|
|
415
|
+
* >
|
|
416
|
+
* Request Withdrawal
|
|
417
|
+
* </button>
|
|
418
|
+
* )
|
|
419
|
+
* }
|
|
420
|
+
* ```
|
|
421
|
+
*
|
|
422
|
+
* @param parameters - Parameters.
|
|
423
|
+
* @returns Mutation result.
|
|
424
|
+
*/
|
|
425
|
+
export function useRequestWithdrawalSync(parameters = {}) {
|
|
426
|
+
const { mutation = {} } = parameters;
|
|
427
|
+
const config = useConfig(parameters);
|
|
428
|
+
return useMutation({
|
|
429
|
+
...mutation,
|
|
430
|
+
async mutationFn(variables) {
|
|
431
|
+
return Actions.zone.requestWithdrawalSync(config, variables);
|
|
432
|
+
},
|
|
433
|
+
mutationKey: ['requestWithdrawalSync'],
|
|
434
|
+
});
|
|
435
|
+
}
|
|
436
|
+
/**
|
|
437
|
+
* Hook for requesting a verifiable withdrawal from a zone to the parent Tempo
|
|
438
|
+
* chain.
|
|
439
|
+
*
|
|
440
|
+
* @example
|
|
441
|
+
* ```tsx
|
|
442
|
+
* import { Hooks } from 'wagmi/tempo'
|
|
443
|
+
* import { zone } from 'viem/tempo/zones'
|
|
444
|
+
*
|
|
445
|
+
* const zoneChain = zone(7)
|
|
446
|
+
*
|
|
447
|
+
* function App() {
|
|
448
|
+
* const { mutate, isPending } = Hooks.zone.useRequestVerifiableWithdrawal()
|
|
449
|
+
*
|
|
450
|
+
* return (
|
|
451
|
+
* <button
|
|
452
|
+
* onClick={() =>
|
|
453
|
+
* mutate({
|
|
454
|
+
* amount: 1_000_000n,
|
|
455
|
+
* chainId: zoneChain.id,
|
|
456
|
+
* revealTo:
|
|
457
|
+
* '0x0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798',
|
|
458
|
+
* token: '0x20c0000000000000000000000000000000000001',
|
|
459
|
+
* })
|
|
460
|
+
* }
|
|
461
|
+
* disabled={isPending}
|
|
462
|
+
* >
|
|
463
|
+
* Request Verifiable Withdrawal
|
|
464
|
+
* </button>
|
|
465
|
+
* )
|
|
466
|
+
* }
|
|
467
|
+
* ```
|
|
468
|
+
*
|
|
469
|
+
* @param parameters - Parameters.
|
|
470
|
+
* @returns Mutation result.
|
|
471
|
+
*/
|
|
472
|
+
export function useRequestVerifiableWithdrawal(parameters = {}) {
|
|
473
|
+
const { mutation = {} } = parameters;
|
|
474
|
+
const config = useConfig(parameters);
|
|
475
|
+
return useMutation({
|
|
476
|
+
...mutation,
|
|
477
|
+
async mutationFn(variables) {
|
|
478
|
+
return Actions.zone.requestVerifiableWithdrawal(config, variables);
|
|
479
|
+
},
|
|
480
|
+
mutationKey: ['requestVerifiableWithdrawal'],
|
|
481
|
+
});
|
|
482
|
+
}
|
|
483
|
+
/**
|
|
484
|
+
* Hook for requesting a verifiable withdrawal from a zone to the parent Tempo
|
|
485
|
+
* chain.
|
|
486
|
+
*
|
|
487
|
+
* Note: This is a synchronous hook that waits for the transaction
|
|
488
|
+
* to be included on a block before returning a response.
|
|
489
|
+
*
|
|
490
|
+
* @example
|
|
491
|
+
* ```tsx
|
|
492
|
+
* import { Hooks } from 'wagmi/tempo'
|
|
493
|
+
* import { zone } from 'viem/tempo/zones'
|
|
494
|
+
*
|
|
495
|
+
* const zoneChain = zone(7)
|
|
496
|
+
*
|
|
497
|
+
* function App() {
|
|
498
|
+
* const { mutate, isPending } = Hooks.zone.useRequestVerifiableWithdrawalSync()
|
|
499
|
+
*
|
|
500
|
+
* return (
|
|
501
|
+
* <button
|
|
502
|
+
* onClick={() =>
|
|
503
|
+
* mutate({
|
|
504
|
+
* amount: 1_000_000n,
|
|
505
|
+
* chainId: zoneChain.id,
|
|
506
|
+
* revealTo:
|
|
507
|
+
* '0x0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798',
|
|
508
|
+
* token: '0x20c0000000000000000000000000000000000001',
|
|
509
|
+
* })
|
|
510
|
+
* }
|
|
511
|
+
* disabled={isPending}
|
|
512
|
+
* >
|
|
513
|
+
* Request Verifiable Withdrawal
|
|
514
|
+
* </button>
|
|
515
|
+
* )
|
|
516
|
+
* }
|
|
517
|
+
* ```
|
|
518
|
+
*
|
|
519
|
+
* @param parameters - Parameters.
|
|
520
|
+
* @returns Mutation result.
|
|
521
|
+
*/
|
|
522
|
+
export function useRequestVerifiableWithdrawalSync(parameters = {}) {
|
|
523
|
+
const { mutation = {} } = parameters;
|
|
524
|
+
const config = useConfig(parameters);
|
|
525
|
+
return useMutation({
|
|
526
|
+
...mutation,
|
|
527
|
+
async mutationFn(variables) {
|
|
528
|
+
return Actions.zone.requestVerifiableWithdrawalSync(config, variables);
|
|
529
|
+
},
|
|
530
|
+
mutationKey: ['requestVerifiableWithdrawalSync'],
|
|
531
|
+
});
|
|
532
|
+
}
|
|
533
|
+
//# sourceMappingURL=zone.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zone.js","sourceRoot":"","sources":["../../../../src/tempo/hooks/zone.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAA;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAA;AACpD,OAAO,EAGL,WAAW,EACX,QAAQ,GACT,MAAM,sBAAsB,CAAA;AAG7B;;;;;;;;;;;;;;;;;;;;;;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