tempo.ts 0.12.1 → 0.13.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 (123) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/README.md +28 -34
  3. package/package.json +2 -28
  4. package/dist/wagmi/Actions/amm.d.ts +0 -418
  5. package/dist/wagmi/Actions/amm.d.ts.map +0 -1
  6. package/dist/wagmi/Actions/amm.js +0 -462
  7. package/dist/wagmi/Actions/amm.js.map +0 -1
  8. package/dist/wagmi/Actions/dex.d.ts +0 -864
  9. package/dist/wagmi/Actions/dex.d.ts.map +0 -1
  10. package/dist/wagmi/Actions/dex.js +0 -968
  11. package/dist/wagmi/Actions/dex.js.map +0 -1
  12. package/dist/wagmi/Actions/faucet.d.ts +0 -66
  13. package/dist/wagmi/Actions/faucet.d.ts.map +0 -1
  14. package/dist/wagmi/Actions/faucet.js +0 -64
  15. package/dist/wagmi/Actions/faucet.js.map +0 -1
  16. package/dist/wagmi/Actions/fee.d.ts +0 -111
  17. package/dist/wagmi/Actions/fee.d.ts.map +0 -1
  18. package/dist/wagmi/Actions/fee.js +0 -126
  19. package/dist/wagmi/Actions/fee.js.map +0 -1
  20. package/dist/wagmi/Actions/index.d.ts +0 -9
  21. package/dist/wagmi/Actions/index.d.ts.map +0 -1
  22. package/dist/wagmi/Actions/index.js +0 -9
  23. package/dist/wagmi/Actions/index.js.map +0 -1
  24. package/dist/wagmi/Actions/nonce.d.ts +0 -77
  25. package/dist/wagmi/Actions/nonce.d.ts.map +0 -1
  26. package/dist/wagmi/Actions/nonce.js +0 -87
  27. package/dist/wagmi/Actions/nonce.js.map +0 -1
  28. package/dist/wagmi/Actions/policy.d.ts +0 -480
  29. package/dist/wagmi/Actions/policy.d.ts.map +0 -1
  30. package/dist/wagmi/Actions/policy.js +0 -530
  31. package/dist/wagmi/Actions/policy.js.map +0 -1
  32. package/dist/wagmi/Actions/reward.d.ts +0 -346
  33. package/dist/wagmi/Actions/reward.d.ts.map +0 -1
  34. package/dist/wagmi/Actions/reward.js +0 -382
  35. package/dist/wagmi/Actions/reward.js.map +0 -1
  36. package/dist/wagmi/Actions/token.d.ts +0 -1546
  37. package/dist/wagmi/Actions/token.d.ts.map +0 -1
  38. package/dist/wagmi/Actions/token.js +0 -1712
  39. package/dist/wagmi/Actions/token.js.map +0 -1
  40. package/dist/wagmi/Connector.d.ts +0 -91
  41. package/dist/wagmi/Connector.d.ts.map +0 -1
  42. package/dist/wagmi/Connector.js +0 -473
  43. package/dist/wagmi/Connector.js.map +0 -1
  44. package/dist/wagmi/Hooks/amm.d.ts +0 -411
  45. package/dist/wagmi/Hooks/amm.d.ts.map +0 -1
  46. package/dist/wagmi/Hooks/amm.js +0 -494
  47. package/dist/wagmi/Hooks/amm.js.map +0 -1
  48. package/dist/wagmi/Hooks/dex.d.ts +0 -773
  49. package/dist/wagmi/Hooks/dex.d.ts.map +0 -1
  50. package/dist/wagmi/Hooks/dex.js +0 -921
  51. package/dist/wagmi/Hooks/dex.js.map +0 -1
  52. package/dist/wagmi/Hooks/faucet.d.ts +0 -71
  53. package/dist/wagmi/Hooks/faucet.d.ts.map +0 -1
  54. package/dist/wagmi/Hooks/faucet.js +0 -76
  55. package/dist/wagmi/Hooks/faucet.js.map +0 -1
  56. package/dist/wagmi/Hooks/fee.d.ts +0 -97
  57. package/dist/wagmi/Hooks/fee.d.ts.map +0 -1
  58. package/dist/wagmi/Hooks/fee.js +0 -109
  59. package/dist/wagmi/Hooks/fee.js.map +0 -1
  60. package/dist/wagmi/Hooks/index.d.ts +0 -9
  61. package/dist/wagmi/Hooks/index.d.ts.map +0 -1
  62. package/dist/wagmi/Hooks/index.js +0 -9
  63. package/dist/wagmi/Hooks/index.js.map +0 -1
  64. package/dist/wagmi/Hooks/nonce.d.ts +0 -59
  65. package/dist/wagmi/Hooks/nonce.d.ts.map +0 -1
  66. package/dist/wagmi/Hooks/nonce.js +0 -75
  67. package/dist/wagmi/Hooks/nonce.js.map +0 -1
  68. package/dist/wagmi/Hooks/policy.d.ts +0 -423
  69. package/dist/wagmi/Hooks/policy.d.ts.map +0 -1
  70. package/dist/wagmi/Hooks/policy.js +0 -510
  71. package/dist/wagmi/Hooks/policy.js.map +0 -1
  72. package/dist/wagmi/Hooks/reward.d.ts +0 -305
  73. package/dist/wagmi/Hooks/reward.d.ts.map +0 -1
  74. package/dist/wagmi/Hooks/reward.js +0 -368
  75. package/dist/wagmi/Hooks/reward.js.map +0 -1
  76. package/dist/wagmi/Hooks/token.d.ts +0 -1388
  77. package/dist/wagmi/Hooks/token.d.ts.map +0 -1
  78. package/dist/wagmi/Hooks/token.js +0 -1657
  79. package/dist/wagmi/Hooks/token.js.map +0 -1
  80. package/dist/wagmi/KeyManager.d.ts +0 -60
  81. package/dist/wagmi/KeyManager.d.ts.map +0 -1
  82. package/dist/wagmi/KeyManager.js +0 -106
  83. package/dist/wagmi/KeyManager.js.map +0 -1
  84. package/dist/wagmi/index.d.ts +0 -5
  85. package/dist/wagmi/index.d.ts.map +0 -1
  86. package/dist/wagmi/index.js +0 -5
  87. package/dist/wagmi/index.js.map +0 -1
  88. package/src/wagmi/Actions/amm.test.ts +0 -208
  89. package/src/wagmi/Actions/amm.ts +0 -690
  90. package/src/wagmi/Actions/dex.test.ts +0 -1482
  91. package/src/wagmi/Actions/dex.ts +0 -1540
  92. package/src/wagmi/Actions/faucet.ts +0 -89
  93. package/src/wagmi/Actions/fee.test.ts +0 -63
  94. package/src/wagmi/Actions/fee.ts +0 -211
  95. package/src/wagmi/Actions/index.ts +0 -8
  96. package/src/wagmi/Actions/nonce.test.ts +0 -82
  97. package/src/wagmi/Actions/nonce.ts +0 -139
  98. package/src/wagmi/Actions/policy.test.ts +0 -461
  99. package/src/wagmi/Actions/policy.ts +0 -817
  100. package/src/wagmi/Actions/reward.test.ts +0 -216
  101. package/src/wagmi/Actions/reward.ts +0 -613
  102. package/src/wagmi/Actions/token.test.ts +0 -1309
  103. package/src/wagmi/Actions/token.ts +0 -2644
  104. package/src/wagmi/Connector.test.ts +0 -56
  105. package/src/wagmi/Connector.ts +0 -670
  106. package/src/wagmi/Hooks/amm.test.ts +0 -564
  107. package/src/wagmi/Hooks/amm.ts +0 -796
  108. package/src/wagmi/Hooks/dex.test.ts +0 -992
  109. package/src/wagmi/Hooks/dex.ts +0 -1598
  110. package/src/wagmi/Hooks/faucet.ts +0 -144
  111. package/src/wagmi/Hooks/fee.test.ts +0 -166
  112. package/src/wagmi/Hooks/fee.ts +0 -206
  113. package/src/wagmi/Hooks/index.ts +0 -8
  114. package/src/wagmi/Hooks/nonce.test.ts +0 -142
  115. package/src/wagmi/Hooks/nonce.ts +0 -117
  116. package/src/wagmi/Hooks/policy.test.ts +0 -665
  117. package/src/wagmi/Hooks/policy.ts +0 -873
  118. package/src/wagmi/Hooks/reward.test.ts +0 -249
  119. package/src/wagmi/Hooks/reward.ts +0 -645
  120. package/src/wagmi/Hooks/token.test.ts +0 -1183
  121. package/src/wagmi/Hooks/token.ts +0 -2906
  122. package/src/wagmi/KeyManager.ts +0 -172
  123. package/src/wagmi/index.ts +0 -7
@@ -1,645 +0,0 @@
1
- import type { DefaultError } from '@tanstack/query-core'
2
- import type { UseMutationResult } from '@tanstack/react-query'
3
- import type { Config, ResolvedRegister } from '@wagmi/core'
4
- import { useEffect } from 'react'
5
- import { useChainId, useConfig } from 'wagmi'
6
- import type { ConfigParameter, QueryParameter } from 'wagmi/internal'
7
- import {
8
- type UseMutationParameters,
9
- type UseQueryReturnType,
10
- useMutation,
11
- useQuery,
12
- } from 'wagmi/query'
13
- import type { ExactPartial, UnionCompute } from '../../internal/types.js'
14
- import * as Actions from '../Actions/reward.js'
15
-
16
- /**
17
- * Hook for claiming accumulated rewards.
18
- *
19
- * @example
20
- * ```tsx
21
- * import { Hooks } from 'tempo.ts/wagmi'
22
- *
23
- * function App() {
24
- * const { mutate: claim } = Hooks.reward.useClaim()
25
- *
26
- * return (
27
- * <button onClick={() => claim({
28
- * token: '0x20c0000000000000000000000000000000000001'
29
- * })}>
30
- * Claim Rewards
31
- * </button>
32
- * )
33
- * }
34
- * ```
35
- *
36
- * @param parameters - Parameters.
37
- * @returns Mutation result.
38
- */
39
- export function useClaim<
40
- config extends Config = ResolvedRegister['config'],
41
- context = unknown,
42
- >(
43
- parameters: useClaim.Parameters<config, context> = {},
44
- ): useClaim.ReturnType<config, context> {
45
- const { mutation } = parameters
46
- const config = useConfig(parameters)
47
- return useMutation({
48
- ...mutation,
49
- async mutationFn(variables) {
50
- return Actions.claim(config, variables as never)
51
- },
52
- mutationKey: ['claim'],
53
- }) as never
54
- }
55
-
56
- export declare namespace useClaim {
57
- type Parameters<
58
- config extends Config = Config,
59
- context = unknown,
60
- > = ConfigParameter<config> & {
61
- mutation?:
62
- | UseMutationParameters<
63
- Actions.claim.ReturnValue,
64
- Actions.claim.ErrorType,
65
- Actions.claim.Parameters<config>,
66
- context
67
- >
68
- | undefined
69
- }
70
-
71
- type ReturnType<
72
- config extends Config = Config,
73
- context = unknown,
74
- > = UseMutationResult<
75
- Actions.claim.ReturnValue,
76
- Actions.claim.ErrorType,
77
- Actions.claim.Parameters<config>,
78
- context
79
- >
80
- }
81
-
82
- /**
83
- * Hook for claiming accumulated rewards and waiting for confirmation.
84
- *
85
- * @example
86
- * ```tsx
87
- * import { Hooks } from 'tempo.ts/wagmi'
88
- *
89
- * function App() {
90
- * const { mutate: claimSync } = Hooks.reward.useClaimSync()
91
- *
92
- * return (
93
- * <button onClick={() => claimSync({
94
- * token: '0x20c0000000000000000000000000000000000001'
95
- * })}>
96
- * Claim Rewards
97
- * </button>
98
- * )
99
- * }
100
- * ```
101
- *
102
- * @param parameters - Parameters.
103
- * @returns Mutation result.
104
- */
105
- export function useClaimSync<
106
- config extends Config = ResolvedRegister['config'],
107
- context = unknown,
108
- >(
109
- parameters: useClaimSync.Parameters<config, context> = {},
110
- ): useClaimSync.ReturnType<config, context> {
111
- const { mutation } = parameters
112
- const config = useConfig(parameters)
113
- return useMutation({
114
- ...mutation,
115
- async mutationFn(variables) {
116
- return Actions.claimSync(config, variables as never)
117
- },
118
- mutationKey: ['claimSync'],
119
- }) as never
120
- }
121
-
122
- export declare namespace useClaimSync {
123
- type Parameters<
124
- config extends Config = Config,
125
- context = unknown,
126
- > = ConfigParameter<config> & {
127
- mutation?:
128
- | UseMutationParameters<
129
- Actions.claimSync.ReturnValue,
130
- Actions.claimSync.ErrorType,
131
- Actions.claimSync.Parameters<config>,
132
- context
133
- >
134
- | undefined
135
- }
136
-
137
- type ReturnType<
138
- config extends Config = Config,
139
- context = unknown,
140
- > = UseMutationResult<
141
- Actions.claimSync.ReturnValue,
142
- Actions.claimSync.ErrorType,
143
- Actions.claimSync.Parameters<config>,
144
- context
145
- >
146
- }
147
-
148
- /**
149
- * Hook for getting the total reward per second rate.
150
- *
151
- * @example
152
- * ```tsx
153
- * import { Hooks } from 'tempo.ts/wagmi'
154
- *
155
- * function App() {
156
- * const { data, isLoading } = Hooks.reward.useGetTotalPerSecond({
157
- * token: '0x20c0000000000000000000000000000000000001',
158
- * })
159
- *
160
- * if (isLoading) return <div>Loading...</div>
161
- * return <div>Rate: {data?.toString()}</div>
162
- * }
163
- * ```
164
- *
165
- * @param parameters - Parameters.
166
- * @returns Query result with total reward per second.
167
- */
168
- export function useGetTotalPerSecond<
169
- config extends Config = ResolvedRegister['config'],
170
- selectData = Actions.getTotalPerSecond.ReturnValue,
171
- >(parameters: useGetTotalPerSecond.Parameters<config, selectData> = {}) {
172
- const { query = {}, token } = parameters
173
-
174
- const config = useConfig(parameters)
175
- const chainId = useChainId({ config })
176
-
177
- const options = Actions.getTotalPerSecond.queryOptions(config, {
178
- ...parameters,
179
- chainId: parameters.chainId ?? chainId,
180
- query: undefined,
181
- } as never)
182
- const enabled = Boolean(token && (query.enabled ?? true))
183
-
184
- return useQuery({ ...query, ...options, enabled })
185
- }
186
-
187
- export declare namespace useGetTotalPerSecond {
188
- export type Parameters<
189
- config extends Config = ResolvedRegister['config'],
190
- selectData = Actions.getTotalPerSecond.ReturnValue,
191
- > = ConfigParameter<config> &
192
- QueryParameter<
193
- Actions.getTotalPerSecond.ReturnValue,
194
- DefaultError,
195
- selectData,
196
- Actions.getTotalPerSecond.QueryKey<config>
197
- > &
198
- ExactPartial<
199
- Omit<
200
- Actions.getTotalPerSecond.queryOptions.Parameters<config, selectData>,
201
- 'query'
202
- >
203
- >
204
-
205
- export type ReturnValue<selectData = Actions.getTotalPerSecond.ReturnValue> =
206
- UseQueryReturnType<selectData, Error>
207
- }
208
-
209
- /**
210
- * Hook for getting the reward information for a specific account.
211
- *
212
- * @example
213
- * ```tsx
214
- * import { Hooks } from 'tempo.ts/wagmi'
215
- *
216
- * function App() {
217
- * const { data, isLoading } = Hooks.reward.useUserRewardInfo({
218
- * token: '0x20c0000000000000000000000000000000000001',
219
- * account: '0xa5cc3c03994DB5b0d9A5eEdD10CabaB0813678AC',
220
- * })
221
- *
222
- * if (isLoading) return <div>Loading...</div>
223
- * return (
224
- * <div>
225
- * <div>Recipient: {data?.rewardRecipient}</div>
226
- * <div>Reward per token: {data?.rewardPerToken.toString()}</div>
227
- * <div>Reward balance: {data?.rewardBalance.toString()}</div>
228
- * </div>
229
- * )
230
- * }
231
- * ```
232
- *
233
- * @param parameters - Parameters.
234
- * @returns Query result with reward information (recipient, rewardPerToken, rewardBalance).
235
- */
236
- export function useUserRewardInfo<
237
- config extends Config = ResolvedRegister['config'],
238
- selectData = Actions.getUserRewardInfo.ReturnValue,
239
- >(parameters: useUserRewardInfo.Parameters<config, selectData> = {}) {
240
- const { account, query = {}, token } = parameters
241
-
242
- const config = useConfig(parameters)
243
- const chainId = useChainId({ config })
244
-
245
- const options = Actions.getUserRewardInfo.queryOptions(config, {
246
- ...parameters,
247
- chainId: parameters.chainId ?? chainId,
248
- query: undefined,
249
- } as never)
250
- const enabled = Boolean(token && account && (query.enabled ?? true))
251
-
252
- return useQuery({ ...query, ...options, enabled })
253
- }
254
-
255
- export declare namespace useUserRewardInfo {
256
- export type Parameters<
257
- config extends Config = ResolvedRegister['config'],
258
- selectData = Actions.getUserRewardInfo.ReturnValue,
259
- > = ConfigParameter<config> &
260
- QueryParameter<
261
- Actions.getUserRewardInfo.ReturnValue,
262
- DefaultError,
263
- selectData,
264
- Actions.getUserRewardInfo.QueryKey<config>
265
- > &
266
- ExactPartial<
267
- Omit<
268
- Actions.getUserRewardInfo.queryOptions.Parameters<config, selectData>,
269
- 'query'
270
- >
271
- >
272
-
273
- export type ReturnValue<selectData = Actions.getUserRewardInfo.ReturnValue> =
274
- UseQueryReturnType<selectData, Error>
275
- }
276
-
277
- /**
278
- * Hook for setting the reward recipient for a token holder.
279
- *
280
- * @example
281
- * ```tsx
282
- * import { Hooks } from 'tempo.ts/wagmi'
283
- *
284
- * function App() {
285
- * const { mutate: setRecipient } = Hooks.reward.useSetRecipient()
286
- *
287
- * return (
288
- * <button onClick={() => setRecipient({
289
- * recipient: '0xa5cc3c03994DB5b0d9A5eEdD10CabaB0813678AC',
290
- * token: '0x20c0000000000000000000000000000000000001',
291
- * })}>
292
- * Set Recipient
293
- * </button>
294
- * )
295
- * }
296
- * ```
297
- *
298
- * @param parameters - Parameters.
299
- * @returns Mutation result.
300
- */
301
- export function useSetRecipient<
302
- config extends Config = ResolvedRegister['config'],
303
- context = unknown,
304
- >(
305
- parameters: useSetRecipient.Parameters<config, context> = {},
306
- ): useSetRecipient.ReturnType<config, context> {
307
- const { mutation } = parameters
308
- const config = useConfig(parameters)
309
- return useMutation({
310
- ...mutation,
311
- async mutationFn(variables) {
312
- return Actions.setRecipient(config, variables as never)
313
- },
314
- mutationKey: ['setRecipient'],
315
- }) as never
316
- }
317
-
318
- export declare namespace useSetRecipient {
319
- type Parameters<
320
- config extends Config = Config,
321
- context = unknown,
322
- > = ConfigParameter<config> & {
323
- mutation?:
324
- | UseMutationParameters<
325
- Actions.setRecipient.ReturnValue,
326
- Actions.setRecipient.ErrorType,
327
- Actions.setRecipient.Parameters<config>,
328
- context
329
- >
330
- | undefined
331
- }
332
-
333
- type ReturnType<
334
- config extends Config = Config,
335
- context = unknown,
336
- > = UseMutationResult<
337
- Actions.setRecipient.ReturnValue,
338
- Actions.setRecipient.ErrorType,
339
- Actions.setRecipient.Parameters<config>,
340
- context
341
- >
342
- }
343
-
344
- /**
345
- * Hook for setting the reward recipient and waiting for confirmation.
346
- *
347
- * @example
348
- * ```tsx
349
- * import { Hooks } from 'tempo.ts/wagmi'
350
- *
351
- * function App() {
352
- * const { mutate: setRecipientSync } = Hooks.reward.useSetRecipientSync()
353
- *
354
- * return (
355
- * <button onClick={() => setRecipientSync({
356
- * recipient: '0xa5cc3c03994DB5b0d9A5eEdD10CabaB0813678AC',
357
- * token: '0x20c0000000000000000000000000000000000001',
358
- * })}>
359
- * Set Recipient
360
- * </button>
361
- * )
362
- * }
363
- * ```
364
- *
365
- * @param parameters - Parameters.
366
- * @returns Mutation result.
367
- */
368
- export function useSetRecipientSync<
369
- config extends Config = ResolvedRegister['config'],
370
- context = unknown,
371
- >(
372
- parameters: useSetRecipientSync.Parameters<config, context> = {},
373
- ): useSetRecipientSync.ReturnType<config, context> {
374
- const { mutation } = parameters
375
- const config = useConfig(parameters)
376
- return useMutation({
377
- ...mutation,
378
- async mutationFn(variables) {
379
- return Actions.setRecipientSync(config, variables as never)
380
- },
381
- mutationKey: ['setRecipientSync'],
382
- }) as never
383
- }
384
-
385
- export declare namespace useSetRecipientSync {
386
- type Parameters<
387
- config extends Config = Config,
388
- context = unknown,
389
- > = ConfigParameter<config> & {
390
- mutation?:
391
- | UseMutationParameters<
392
- Actions.setRecipientSync.ReturnValue,
393
- Actions.setRecipientSync.ErrorType,
394
- Actions.setRecipientSync.Parameters<config>,
395
- context
396
- >
397
- | undefined
398
- }
399
-
400
- type ReturnType<
401
- config extends Config = Config,
402
- context = unknown,
403
- > = UseMutationResult<
404
- Actions.setRecipientSync.ReturnValue,
405
- Actions.setRecipientSync.ErrorType,
406
- Actions.setRecipientSync.Parameters<config>,
407
- context
408
- >
409
- }
410
-
411
- /**
412
- * Hook for starting a new reward stream.
413
- *
414
- * @example
415
- * ```tsx
416
- * import { Hooks } from 'tempo.ts/wagmi'
417
- *
418
- * function App() {
419
- * const { mutate: start } = Hooks.reward.useStart()
420
- *
421
- * return (
422
- * <button onClick={() => start({
423
- * amount: 100000000000000000000n,
424
- * seconds: 86400,
425
- * token: '0x20c0000000000000000000000000000000000001',
426
- * })}>
427
- * Start Reward
428
- * </button>
429
- * )
430
- * }
431
- * ```
432
- *
433
- * @param parameters - Parameters.
434
- * @returns Mutation result.
435
- */
436
- export function useStart<
437
- config extends Config = ResolvedRegister['config'],
438
- context = unknown,
439
- >(
440
- parameters: useStart.Parameters<config, context> = {},
441
- ): useStart.ReturnType<config, context> {
442
- const { mutation } = parameters
443
- const config = useConfig(parameters)
444
- return useMutation({
445
- ...mutation,
446
- async mutationFn(variables) {
447
- return Actions.start(config, variables as never)
448
- },
449
- mutationKey: ['start'],
450
- }) as never
451
- }
452
-
453
- export declare namespace useStart {
454
- type Parameters<
455
- config extends Config = Config,
456
- context = unknown,
457
- > = ConfigParameter<config> & {
458
- mutation?:
459
- | UseMutationParameters<
460
- Actions.start.ReturnValue,
461
- Actions.start.ErrorType,
462
- Actions.start.Parameters<config>,
463
- context
464
- >
465
- | undefined
466
- }
467
-
468
- type ReturnType<
469
- config extends Config = Config,
470
- context = unknown,
471
- > = UseMutationResult<
472
- Actions.start.ReturnValue,
473
- Actions.start.ErrorType,
474
- Actions.start.Parameters<config>,
475
- context
476
- >
477
- }
478
-
479
- /**
480
- * Hook for starting a new reward stream and waiting for confirmation.
481
- *
482
- * @example
483
- * ```tsx
484
- * import { Hooks } from 'tempo.ts/wagmi'
485
- *
486
- * function App() {
487
- * const { mutate: startSync } = Hooks.reward.useStartSync()
488
- *
489
- * return (
490
- * <button onClick={() => startSync({
491
- * amount: 100000000000000000000n,
492
- * seconds: 86400,
493
- * token: '0x20c0000000000000000000000000000000000001',
494
- * })}>
495
- * Start Reward
496
- * </button>
497
- * )
498
- * }
499
- * ```
500
- *
501
- * @param parameters - Parameters.
502
- * @returns Mutation result.
503
- */
504
- export function useStartSync<
505
- config extends Config = ResolvedRegister['config'],
506
- context = unknown,
507
- >(
508
- parameters: useStartSync.Parameters<config, context> = {},
509
- ): useStartSync.ReturnType<config, context> {
510
- const { mutation } = parameters
511
- const config = useConfig(parameters)
512
- return useMutation({
513
- ...mutation,
514
- async mutationFn(variables) {
515
- return Actions.startSync(config, variables as never)
516
- },
517
- mutationKey: ['startSync'],
518
- }) as never
519
- }
520
-
521
- export declare namespace useStartSync {
522
- type Parameters<
523
- config extends Config = Config,
524
- context = unknown,
525
- > = ConfigParameter<config> & {
526
- mutation?:
527
- | UseMutationParameters<
528
- Actions.startSync.ReturnValue,
529
- Actions.startSync.ErrorType,
530
- Actions.startSync.Parameters<config>,
531
- context
532
- >
533
- | undefined
534
- }
535
-
536
- type ReturnType<
537
- config extends Config = Config,
538
- context = unknown,
539
- > = UseMutationResult<
540
- Actions.startSync.ReturnValue,
541
- Actions.startSync.ErrorType,
542
- Actions.startSync.Parameters<config>,
543
- context
544
- >
545
- }
546
-
547
- /**
548
- * Hook for watching reward scheduled events.
549
- *
550
- * @example
551
- * ```tsx
552
- * import { Hooks } from 'tempo.ts/wagmi'
553
- *
554
- * function App() {
555
- * Hooks.reward.useWatchRewardScheduled({
556
- * token: '0x20c0000000000000000000000000000000000001',
557
- * onRewardScheduled(args) {
558
- * console.log('Reward scheduled:', args)
559
- * },
560
- * })
561
- *
562
- * return <div>Watching for reward scheduled events...</div>
563
- * }
564
- * ```
565
- *
566
- * @param parameters - Parameters.
567
- */
568
- export function useWatchRewardScheduled<
569
- config extends Config = ResolvedRegister['config'],
570
- >(parameters: useWatchRewardScheduled.Parameters<config> = {}) {
571
- const { enabled = true, onRewardScheduled, token, ...rest } = parameters
572
-
573
- const config = useConfig({ config: parameters.config })
574
- const configChainId = useChainId({ config })
575
- const chainId = parameters.chainId ?? configChainId
576
-
577
- useEffect(() => {
578
- if (!enabled) return
579
- if (!onRewardScheduled) return
580
- if (!token) return
581
- return Actions.watchRewardScheduled(config, {
582
- ...rest,
583
- chainId,
584
- onRewardScheduled,
585
- token,
586
- })
587
- }, [config, enabled, onRewardScheduled, rest, chainId, token])
588
- }
589
-
590
- export declare namespace useWatchRewardScheduled {
591
- type Parameters<config extends Config = Config> = UnionCompute<
592
- ExactPartial<Actions.watchRewardScheduled.Parameters<config>> &
593
- ConfigParameter<config> & { enabled?: boolean | undefined }
594
- >
595
- }
596
-
597
- /**
598
- * Hook for watching reward recipient set events.
599
- *
600
- * @example
601
- * ```tsx
602
- * import { Hooks } from 'tempo.ts/wagmi'
603
- *
604
- * function App() {
605
- * Hooks.reward.useWatchRewardRecipientSet({
606
- * token: '0x20c0000000000000000000000000000000000001',
607
- * onRewardRecipientSet(args) {
608
- * console.log('Reward recipient set:', args)
609
- * },
610
- * })
611
- *
612
- * return <div>Watching for reward recipient set events...</div>
613
- * }
614
- * ```
615
- *
616
- * @param parameters - Parameters.
617
- */
618
- export function useWatchRewardRecipientSet<
619
- config extends Config = ResolvedRegister['config'],
620
- >(parameters: useWatchRewardRecipientSet.Parameters<config> = {}) {
621
- const { enabled = true, onRewardRecipientSet, token, ...rest } = parameters
622
-
623
- const config = useConfig({ config: parameters.config })
624
- const configChainId = useChainId({ config })
625
- const chainId = parameters.chainId ?? configChainId
626
-
627
- useEffect(() => {
628
- if (!enabled) return
629
- if (!onRewardRecipientSet) return
630
- if (!token) return
631
- return Actions.watchRewardRecipientSet(config, {
632
- ...rest,
633
- chainId,
634
- onRewardRecipientSet,
635
- token,
636
- })
637
- }, [config, enabled, onRewardRecipientSet, rest, chainId, token])
638
- }
639
-
640
- export declare namespace useWatchRewardRecipientSet {
641
- type Parameters<config extends Config = Config> = UnionCompute<
642
- ExactPartial<Actions.watchRewardRecipientSet.Parameters<config>> &
643
- ConfigParameter<config> & { enabled?: boolean | undefined }
644
- >
645
- }