tempo.ts 0.12.0 → 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 +26 -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,613 +0,0 @@
1
- import type * as Query from '@tanstack/query-core'
2
- import { type Config, getConnectorClient } from '@wagmi/core'
3
- import type { ChainIdParameter, ConnectorParameter } from '@wagmi/core/internal'
4
- import type { Account } from 'viem'
5
- import { Actions } from 'viem/tempo'
6
- import type { RequiredBy, UnionOmit } from '../../internal/types.js'
7
-
8
- /**
9
- * Claims accumulated rewards for a recipient.
10
- *
11
- * @example
12
- * ```ts
13
- * import { createConfig, http } from '@wagmi/core'
14
- * import { tempo } from 'viem/chains'
15
- * import { Actions } from 'tempo.ts/wagmi'
16
- *
17
- * const config = createConfig({
18
- * chains: [tempoTestnet],
19
- * transports: {
20
- * [tempo.id]: http(),
21
- * },
22
- * })
23
- *
24
- * const hash = await Actions.reward.claim(config, {
25
- * token: '0x20c0000000000000000000000000000000000001',
26
- * })
27
- * ```
28
- *
29
- * @param config - Config.
30
- * @param parameters - Parameters.
31
- * @returns The transaction hash.
32
- */
33
- export async function claim<config extends Config>(
34
- config: config,
35
- parameters: claim.Parameters<config>,
36
- ): Promise<Actions.reward.claim.ReturnValue> {
37
- const { account, chainId, connector } = parameters
38
-
39
- const client = await getConnectorClient(config, {
40
- account,
41
- assertChainId: false,
42
- chainId,
43
- connector,
44
- })
45
-
46
- return Actions.reward.claim(client, parameters as never)
47
- }
48
-
49
- export declare namespace claim {
50
- export type Parameters<config extends Config = Config> =
51
- ChainIdParameter<config> &
52
- ConnectorParameter &
53
- UnionOmit<
54
- Actions.reward.claim.Parameters<config['chains'][number], Account>,
55
- 'chain'
56
- >
57
-
58
- export type ReturnValue = Actions.reward.claim.ReturnValue
59
-
60
- export type ErrorType = Actions.reward.claim.ErrorType
61
- }
62
-
63
- /**
64
- * Claims accumulated rewards for a recipient and waits for confirmation.
65
- *
66
- * @example
67
- * ```ts
68
- * import { createConfig, http } from '@wagmi/core'
69
- * import { tempo } from 'viem/chains'
70
- * import { Actions } from 'tempo.ts/wagmi'
71
- *
72
- * const config = createConfig({
73
- * chains: [tempoTestnet],
74
- * transports: {
75
- * [tempo.id]: http(),
76
- * },
77
- * })
78
- *
79
- * const result = await Actions.reward.claimSync(config, {
80
- * token: '0x20c0000000000000000000000000000000000001',
81
- * })
82
- * ```
83
- *
84
- * @param config - Config.
85
- * @param parameters - Parameters.
86
- * @returns The transaction receipt.
87
- */
88
- export async function claimSync<config extends Config>(
89
- config: config,
90
- parameters: claimSync.Parameters<config>,
91
- ): Promise<Actions.reward.claimSync.ReturnValue> {
92
- const { account, chainId, connector } = parameters
93
-
94
- const client = await getConnectorClient(config, {
95
- account,
96
- assertChainId: false,
97
- chainId,
98
- connector,
99
- })
100
-
101
- return Actions.reward.claimSync(client, parameters as never)
102
- }
103
-
104
- export declare namespace claimSync {
105
- export type Parameters<config extends Config = Config> =
106
- ChainIdParameter<config> &
107
- ConnectorParameter &
108
- UnionOmit<
109
- Actions.reward.claimSync.Parameters<config['chains'][number], Account>,
110
- 'chain'
111
- >
112
-
113
- export type ReturnValue = Actions.reward.claimSync.ReturnValue
114
-
115
- export type ErrorType = Actions.reward.claimSync.ErrorType
116
- }
117
-
118
- /**
119
- * Gets the total reward per second rate for all active streams.
120
- *
121
- * @example
122
- * ```ts
123
- * import { createConfig, http } from '@wagmi/core'
124
- * import { tempo } from 'viem/chains'
125
- * import { Actions } from 'tempo.ts/wagmi'
126
- *
127
- * const config = createConfig({
128
- * chains: [tempoTestnet],
129
- * transports: {
130
- * [tempo.id]: http(),
131
- * },
132
- * })
133
- *
134
- * const rate = await Actions.reward.getTotalPerSecond(config, {
135
- * token: '0x20c0000000000000000000000000000000000001',
136
- * })
137
- * ```
138
- *
139
- * @param config - Config.
140
- * @param parameters - Parameters.
141
- * @returns The total reward per second (scaled by 1e18).
142
- */
143
- export function getTotalPerSecond<config extends Config>(
144
- config: config,
145
- parameters: getTotalPerSecond.Parameters<config>,
146
- ) {
147
- const { chainId, ...rest } = parameters
148
- const client = config.getClient({ chainId })
149
- return Actions.reward.getTotalPerSecond(client, rest)
150
- }
151
-
152
- export namespace getTotalPerSecond {
153
- export type Parameters<config extends Config> = ChainIdParameter<config> &
154
- Actions.reward.getTotalPerSecond.Parameters
155
-
156
- export type ReturnValue = Actions.reward.getTotalPerSecond.ReturnValue
157
-
158
- export function queryKey<config extends Config>(
159
- parameters: Parameters<config>,
160
- ) {
161
- return ['getTotalPerSecond', parameters] as const
162
- }
163
-
164
- export type QueryKey<config extends Config> = ReturnType<
165
- typeof queryKey<config>
166
- >
167
-
168
- export function queryOptions<config extends Config, selectData = ReturnValue>(
169
- config: Config,
170
- parameters: queryOptions.Parameters<config, selectData>,
171
- ): queryOptions.ReturnValue<config, selectData> {
172
- const { query, ...rest } = parameters
173
- return {
174
- ...query,
175
- queryKey: queryKey(rest),
176
- async queryFn({ queryKey }) {
177
- const [, parameters] = queryKey
178
- return await getTotalPerSecond(config, parameters)
179
- },
180
- }
181
- }
182
-
183
- export declare namespace queryOptions {
184
- export type Parameters<
185
- config extends Config,
186
- selectData = getTotalPerSecond.ReturnValue,
187
- > = getTotalPerSecond.Parameters<config> & {
188
- query?:
189
- | Omit<ReturnValue<config, selectData>, 'queryKey' | 'queryFn'>
190
- | undefined
191
- }
192
-
193
- export type ReturnValue<
194
- config extends Config,
195
- selectData = getTotalPerSecond.ReturnValue,
196
- > = RequiredBy<
197
- Query.QueryOptions<
198
- getTotalPerSecond.ReturnValue,
199
- Query.DefaultError,
200
- selectData,
201
- getTotalPerSecond.QueryKey<config>
202
- >,
203
- 'queryKey' | 'queryFn'
204
- >
205
- }
206
- }
207
-
208
- /**
209
- * Gets the reward information for a specific account.
210
- *
211
- * @example
212
- * ```ts
213
- * import { createConfig, http } from '@wagmi/core'
214
- * import { tempo } from 'viem/chains'
215
- * import { Actions } from 'tempo.ts/wagmi'
216
- *
217
- * const config = createConfig({
218
- * chains: [tempoTestnet],
219
- * transports: {
220
- * [tempo.id]: http(),
221
- * },
222
- * })
223
- *
224
- * const info = await Actions.reward.getUserRewardInfo(config, {
225
- * token: '0x20c0000000000000000000000000000000000001',
226
- * account: '0xa5cc3c03994DB5b0d9A5eEdD10CabaB0813678AC',
227
- * })
228
- * ```
229
- *
230
- * @param config - Config.
231
- * @param parameters - Parameters.
232
- * @returns The user's reward information (recipient, rewardPerToken, rewardBalance).
233
- */
234
- export function getUserRewardInfo<config extends Config>(
235
- config: config,
236
- parameters: getUserRewardInfo.Parameters<config>,
237
- ) {
238
- const { chainId, ...rest } = parameters
239
- const client = config.getClient({ chainId })
240
- return Actions.reward.getUserRewardInfo(client, rest)
241
- }
242
-
243
- export namespace getUserRewardInfo {
244
- export type Parameters<config extends Config> = ChainIdParameter<config> &
245
- Actions.reward.getUserRewardInfo.Parameters
246
-
247
- export type ReturnValue = Actions.reward.getUserRewardInfo.ReturnValue
248
-
249
- export function queryKey<config extends Config>(
250
- parameters: Parameters<config>,
251
- ) {
252
- return ['getUserRewardInfo', parameters] as const
253
- }
254
-
255
- export type QueryKey<config extends Config> = ReturnType<
256
- typeof queryKey<config>
257
- >
258
-
259
- export function queryOptions<config extends Config, selectData = ReturnValue>(
260
- config: Config,
261
- parameters: queryOptions.Parameters<config, selectData>,
262
- ): queryOptions.ReturnValue<config, selectData> {
263
- const { query, ...rest } = parameters
264
- return {
265
- ...query,
266
- queryKey: queryKey(rest),
267
- async queryFn({ queryKey }) {
268
- const [, parameters] = queryKey
269
- return await getUserRewardInfo(config, parameters)
270
- },
271
- }
272
- }
273
-
274
- export declare namespace queryOptions {
275
- export type Parameters<
276
- config extends Config,
277
- selectData = getUserRewardInfo.ReturnValue,
278
- > = getUserRewardInfo.Parameters<config> & {
279
- query?:
280
- | Omit<ReturnValue<config, selectData>, 'queryKey' | 'queryFn'>
281
- | undefined
282
- }
283
-
284
- export type ReturnValue<
285
- config extends Config,
286
- selectData = getUserRewardInfo.ReturnValue,
287
- > = RequiredBy<
288
- Query.QueryOptions<
289
- getUserRewardInfo.ReturnValue,
290
- Query.DefaultError,
291
- selectData,
292
- getUserRewardInfo.QueryKey<config>
293
- >,
294
- 'queryKey' | 'queryFn'
295
- >
296
- }
297
- }
298
-
299
- /**
300
- * Sets or changes the reward recipient for a token holder.
301
- *
302
- * @example
303
- * ```ts
304
- * import { createConfig, http } from '@wagmi/core'
305
- * import { tempo } from 'viem/chains'
306
- * import { Actions } from 'tempo.ts/wagmi'
307
- *
308
- * const config = createConfig({
309
- * chains: [tempoTestnet],
310
- * transports: {
311
- * [tempo.id]: http(),
312
- * },
313
- * })
314
- *
315
- * const hash = await Actions.reward.setRecipient(config, {
316
- * recipient: '0xa5cc3c03994DB5b0d9A5eEdD10CabaB0813678AC',
317
- * token: '0x20c0000000000000000000000000000000000001',
318
- * })
319
- * ```
320
- *
321
- * @param config - Config.
322
- * @param parameters - Parameters.
323
- * @returns The transaction hash.
324
- */
325
- export async function setRecipient<config extends Config>(
326
- config: config,
327
- parameters: setRecipient.Parameters<config>,
328
- ): Promise<Actions.reward.setRecipient.ReturnValue> {
329
- const { account, chainId, connector } = parameters
330
-
331
- const client = await getConnectorClient(config, {
332
- account,
333
- assertChainId: false,
334
- chainId,
335
- connector,
336
- })
337
-
338
- return Actions.reward.setRecipient(client, parameters as never)
339
- }
340
-
341
- export declare namespace setRecipient {
342
- export type Parameters<config extends Config = Config> =
343
- ChainIdParameter<config> &
344
- ConnectorParameter &
345
- UnionOmit<
346
- Actions.reward.setRecipient.Parameters<
347
- config['chains'][number],
348
- Account
349
- >,
350
- 'chain'
351
- >
352
-
353
- export type ReturnValue = Actions.reward.setRecipient.ReturnValue
354
-
355
- export type ErrorType = Actions.reward.setRecipient.ErrorType
356
- }
357
-
358
- /**
359
- * Sets or changes the reward recipient for a token holder and waits for confirmation.
360
- *
361
- * @example
362
- * ```ts
363
- * import { createConfig, http } from '@wagmi/core'
364
- * import { tempo } from 'viem/chains'
365
- * import { Actions } from 'tempo.ts/wagmi'
366
- *
367
- * const config = createConfig({
368
- * chains: [tempoTestnet],
369
- * transports: {
370
- * [tempo.id]: http(),
371
- * },
372
- * })
373
- *
374
- * const result = await Actions.reward.setRecipientSync(config, {
375
- * recipient: '0xa5cc3c03994DB5b0d9A5eEdD10CabaB0813678AC',
376
- * token: '0x20c0000000000000000000000000000000000001',
377
- * })
378
- * ```
379
- *
380
- * @param config - Config.
381
- * @param parameters - Parameters.
382
- * @returns The transaction receipt and event data.
383
- */
384
- export async function setRecipientSync<config extends Config>(
385
- config: config,
386
- parameters: setRecipientSync.Parameters<config>,
387
- ): Promise<Actions.reward.setRecipientSync.ReturnValue> {
388
- const { account, chainId, connector } = parameters
389
-
390
- const client = await getConnectorClient(config, {
391
- account,
392
- assertChainId: false,
393
- chainId,
394
- connector,
395
- })
396
-
397
- return Actions.reward.setRecipientSync(client, parameters as never)
398
- }
399
-
400
- export declare namespace setRecipientSync {
401
- export type Parameters<config extends Config = Config> =
402
- ChainIdParameter<config> &
403
- ConnectorParameter &
404
- UnionOmit<
405
- Actions.reward.setRecipientSync.Parameters<
406
- config['chains'][number],
407
- Account
408
- >,
409
- 'chain'
410
- >
411
-
412
- export type ReturnValue = Actions.reward.setRecipientSync.ReturnValue
413
-
414
- export type ErrorType = Actions.reward.setRecipientSync.ErrorType
415
- }
416
-
417
- /**
418
- * Starts a new reward stream that distributes tokens to opted-in holders.
419
- *
420
- * @example
421
- * ```ts
422
- * import { createConfig, http } from '@wagmi/core'
423
- * import { tempo } from 'viem/chains'
424
- * import { Actions } from 'tempo.ts/wagmi'
425
- *
426
- * const config = createConfig({
427
- * chains: [tempoTestnet],
428
- * transports: {
429
- * [tempo.id]: http(),
430
- * },
431
- * })
432
- *
433
- * const hash = await Actions.reward.start(config, {
434
- * amount: 100000000000000000000n,
435
- * seconds: 86400,
436
- * token: '0x20c0000000000000000000000000000000000001',
437
- * })
438
- * ```
439
- *
440
- * @param config - Config.
441
- * @param parameters - Parameters.
442
- * @returns The transaction hash.
443
- */
444
- export async function start<config extends Config>(
445
- config: config,
446
- parameters: start.Parameters<config>,
447
- ): Promise<Actions.reward.start.ReturnValue> {
448
- const { account, chainId, connector } = parameters
449
-
450
- const client = await getConnectorClient(config, {
451
- account,
452
- assertChainId: false,
453
- chainId,
454
- connector,
455
- })
456
-
457
- return Actions.reward.start(client, parameters as never)
458
- }
459
-
460
- export declare namespace start {
461
- export type Parameters<config extends Config = Config> =
462
- ChainIdParameter<config> &
463
- ConnectorParameter &
464
- UnionOmit<
465
- Actions.reward.start.Parameters<config['chains'][number], Account>,
466
- 'chain'
467
- >
468
-
469
- export type ReturnValue = Actions.reward.start.ReturnValue
470
-
471
- export type ErrorType = Actions.reward.start.ErrorType
472
- }
473
-
474
- /**
475
- * Starts a new reward stream that distributes tokens to opted-in holders and waits for confirmation.
476
- *
477
- * @example
478
- * ```ts
479
- * import { createConfig, http } from '@wagmi/core'
480
- * import { tempo } from 'viem/chains'
481
- * import { Actions } from 'tempo.ts/wagmi'
482
- *
483
- * const config = createConfig({
484
- * chains: [tempoTestnet],
485
- * transports: {
486
- * [tempo.id]: http(),
487
- * },
488
- * })
489
- *
490
- * const result = await Actions.reward.startSync(config, {
491
- * amount: 100000000000000000000n,
492
- * seconds: 86400,
493
- * token: '0x20c0000000000000000000000000000000000001',
494
- * })
495
- * ```
496
- *
497
- * @param config - Config.
498
- * @param parameters - Parameters.
499
- * @returns The transaction receipt and event data.
500
- */
501
- export async function startSync<config extends Config>(
502
- config: config,
503
- parameters: startSync.Parameters<config>,
504
- ): Promise<Actions.reward.startSync.ReturnValue> {
505
- const { account, chainId, connector } = parameters
506
-
507
- const client = await getConnectorClient(config, {
508
- account,
509
- assertChainId: false,
510
- chainId,
511
- connector,
512
- })
513
-
514
- return Actions.reward.startSync(client, parameters as never)
515
- }
516
-
517
- export declare namespace startSync {
518
- export type Parameters<config extends Config = Config> =
519
- ChainIdParameter<config> &
520
- ConnectorParameter &
521
- UnionOmit<
522
- Actions.reward.startSync.Parameters<config['chains'][number], Account>,
523
- 'chain'
524
- >
525
-
526
- export type ReturnValue = Actions.reward.startSync.ReturnValue
527
-
528
- export type ErrorType = Actions.reward.startSync.ErrorType
529
- }
530
-
531
- /**
532
- * Watches for reward scheduled events.
533
- *
534
- * @example
535
- * ```ts
536
- * import { createConfig, http } from '@wagmi/core'
537
- * import { tempo } from 'viem/chains'
538
- * import { Actions } from 'tempo.ts/wagmi'
539
- *
540
- * const config = createConfig({
541
- * chains: [tempoTestnet],
542
- * transports: {
543
- * [tempo.id]: http(),
544
- * },
545
- * })
546
- *
547
- * const unwatch = Actions.reward.watchRewardScheduled(config, {
548
- * token: '0x20c0000000000000000000000000000000000001',
549
- * onRewardScheduled: (args, log) => {
550
- * console.log('Reward scheduled:', args)
551
- * },
552
- * })
553
- * ```
554
- *
555
- * @param config - Config.
556
- * @param parameters - Parameters.
557
- * @returns A function to unsubscribe from the event.
558
- */
559
- export function watchRewardScheduled<config extends Config>(
560
- config: config,
561
- parameters: watchRewardScheduled.Parameters<config>,
562
- ) {
563
- const { chainId, ...rest } = parameters
564
- const client = config.getClient({ chainId })
565
- return Actions.reward.watchRewardScheduled(client, rest)
566
- }
567
-
568
- export declare namespace watchRewardScheduled {
569
- export type Parameters<config extends Config> = ChainIdParameter<config> &
570
- Actions.reward.watchRewardScheduled.Parameters
571
- }
572
-
573
- /**
574
- * Watches for reward recipient set events.
575
- *
576
- * @example
577
- * ```ts
578
- * import { createConfig, http } from '@wagmi/core'
579
- * import { tempo } from 'viem/chains'
580
- * import { Actions } from 'tempo.ts/wagmi'
581
- *
582
- * const config = createConfig({
583
- * chains: [tempoTestnet],
584
- * transports: {
585
- * [tempo.id]: http(),
586
- * },
587
- * })
588
- *
589
- * const unwatch = Actions.reward.watchRewardRecipientSet(config, {
590
- * token: '0x20c0000000000000000000000000000000000001',
591
- * onRewardRecipientSet: (args, log) => {
592
- * console.log('Reward recipient set:', args)
593
- * },
594
- * })
595
- * ```
596
- *
597
- * @param config - Config.
598
- * @param parameters - Parameters.
599
- * @returns A function to unsubscribe from the event.
600
- */
601
- export function watchRewardRecipientSet<config extends Config>(
602
- config: config,
603
- parameters: watchRewardRecipientSet.Parameters<config>,
604
- ) {
605
- const { chainId, ...rest } = parameters
606
- const client = config.getClient({ chainId })
607
- return Actions.reward.watchRewardRecipientSet(client, rest)
608
- }
609
-
610
- export declare namespace watchRewardRecipientSet {
611
- export type Parameters<config extends Config> = ChainIdParameter<config> &
612
- Actions.reward.watchRewardRecipientSet.Parameters
613
- }