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,305 +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 type { ConfigParameter, QueryParameter } from 'wagmi/internal';
5
- import { type UseMutationParameters, type UseQueryReturnType } from 'wagmi/query';
6
- import type { ExactPartial, UnionCompute } from '../../internal/types.js';
7
- import * as Actions from '../Actions/reward.js';
8
- /**
9
- * Hook for claiming accumulated rewards.
10
- *
11
- * @example
12
- * ```tsx
13
- * import { Hooks } from 'tempo.ts/wagmi'
14
- *
15
- * function App() {
16
- * const { mutate: claim } = Hooks.reward.useClaim()
17
- *
18
- * return (
19
- * <button onClick={() => claim({
20
- * token: '0x20c0000000000000000000000000000000000001'
21
- * })}>
22
- * Claim Rewards
23
- * </button>
24
- * )
25
- * }
26
- * ```
27
- *
28
- * @param parameters - Parameters.
29
- * @returns Mutation result.
30
- */
31
- export declare function useClaim<config extends Config = ResolvedRegister['config'], context = unknown>(parameters?: useClaim.Parameters<config, context>): useClaim.ReturnType<config, context>;
32
- export declare namespace useClaim {
33
- type Parameters<config extends Config = Config, context = unknown> = ConfigParameter<config> & {
34
- mutation?: UseMutationParameters<Actions.claim.ReturnValue, Actions.claim.ErrorType, Actions.claim.Parameters<config>, context> | undefined;
35
- };
36
- type ReturnType<config extends Config = Config, context = unknown> = UseMutationResult<Actions.claim.ReturnValue, Actions.claim.ErrorType, Actions.claim.Parameters<config>, context>;
37
- }
38
- /**
39
- * Hook for claiming accumulated rewards and waiting for confirmation.
40
- *
41
- * @example
42
- * ```tsx
43
- * import { Hooks } from 'tempo.ts/wagmi'
44
- *
45
- * function App() {
46
- * const { mutate: claimSync } = Hooks.reward.useClaimSync()
47
- *
48
- * return (
49
- * <button onClick={() => claimSync({
50
- * token: '0x20c0000000000000000000000000000000000001'
51
- * })}>
52
- * Claim Rewards
53
- * </button>
54
- * )
55
- * }
56
- * ```
57
- *
58
- * @param parameters - Parameters.
59
- * @returns Mutation result.
60
- */
61
- export declare function useClaimSync<config extends Config = ResolvedRegister['config'], context = unknown>(parameters?: useClaimSync.Parameters<config, context>): useClaimSync.ReturnType<config, context>;
62
- export declare namespace useClaimSync {
63
- type Parameters<config extends Config = Config, context = unknown> = ConfigParameter<config> & {
64
- mutation?: UseMutationParameters<Actions.claimSync.ReturnValue, Actions.claimSync.ErrorType, Actions.claimSync.Parameters<config>, context> | undefined;
65
- };
66
- type ReturnType<config extends Config = Config, context = unknown> = UseMutationResult<Actions.claimSync.ReturnValue, Actions.claimSync.ErrorType, Actions.claimSync.Parameters<config>, context>;
67
- }
68
- /**
69
- * Hook for getting the total reward per second rate.
70
- *
71
- * @example
72
- * ```tsx
73
- * import { Hooks } from 'tempo.ts/wagmi'
74
- *
75
- * function App() {
76
- * const { data, isLoading } = Hooks.reward.useGetTotalPerSecond({
77
- * token: '0x20c0000000000000000000000000000000000001',
78
- * })
79
- *
80
- * if (isLoading) return <div>Loading...</div>
81
- * return <div>Rate: {data?.toString()}</div>
82
- * }
83
- * ```
84
- *
85
- * @param parameters - Parameters.
86
- * @returns Query result with total reward per second.
87
- */
88
- export declare function useGetTotalPerSecond<config extends Config = ResolvedRegister['config'], selectData = Actions.getTotalPerSecond.ReturnValue>(parameters?: useGetTotalPerSecond.Parameters<config, selectData>): UseQueryReturnType<selectData, Error>;
89
- export declare namespace useGetTotalPerSecond {
90
- type Parameters<config extends Config = ResolvedRegister['config'], selectData = Actions.getTotalPerSecond.ReturnValue> = ConfigParameter<config> & QueryParameter<Actions.getTotalPerSecond.ReturnValue, DefaultError, selectData, Actions.getTotalPerSecond.QueryKey<config>> & ExactPartial<Omit<Actions.getTotalPerSecond.queryOptions.Parameters<config, selectData>, 'query'>>;
91
- type ReturnValue<selectData = Actions.getTotalPerSecond.ReturnValue> = UseQueryReturnType<selectData, Error>;
92
- }
93
- /**
94
- * Hook for getting the reward information for a specific account.
95
- *
96
- * @example
97
- * ```tsx
98
- * import { Hooks } from 'tempo.ts/wagmi'
99
- *
100
- * function App() {
101
- * const { data, isLoading } = Hooks.reward.useUserRewardInfo({
102
- * token: '0x20c0000000000000000000000000000000000001',
103
- * account: '0xa5cc3c03994DB5b0d9A5eEdD10CabaB0813678AC',
104
- * })
105
- *
106
- * if (isLoading) return <div>Loading...</div>
107
- * return (
108
- * <div>
109
- * <div>Recipient: {data?.rewardRecipient}</div>
110
- * <div>Reward per token: {data?.rewardPerToken.toString()}</div>
111
- * <div>Reward balance: {data?.rewardBalance.toString()}</div>
112
- * </div>
113
- * )
114
- * }
115
- * ```
116
- *
117
- * @param parameters - Parameters.
118
- * @returns Query result with reward information (recipient, rewardPerToken, rewardBalance).
119
- */
120
- export declare function useUserRewardInfo<config extends Config = ResolvedRegister['config'], selectData = Actions.getUserRewardInfo.ReturnValue>(parameters?: useUserRewardInfo.Parameters<config, selectData>): UseQueryReturnType<selectData, Error>;
121
- export declare namespace useUserRewardInfo {
122
- type Parameters<config extends Config = ResolvedRegister['config'], selectData = Actions.getUserRewardInfo.ReturnValue> = ConfigParameter<config> & QueryParameter<Actions.getUserRewardInfo.ReturnValue, DefaultError, selectData, Actions.getUserRewardInfo.QueryKey<config>> & ExactPartial<Omit<Actions.getUserRewardInfo.queryOptions.Parameters<config, selectData>, 'query'>>;
123
- type ReturnValue<selectData = Actions.getUserRewardInfo.ReturnValue> = UseQueryReturnType<selectData, Error>;
124
- }
125
- /**
126
- * Hook for setting the reward recipient for a token holder.
127
- *
128
- * @example
129
- * ```tsx
130
- * import { Hooks } from 'tempo.ts/wagmi'
131
- *
132
- * function App() {
133
- * const { mutate: setRecipient } = Hooks.reward.useSetRecipient()
134
- *
135
- * return (
136
- * <button onClick={() => setRecipient({
137
- * recipient: '0xa5cc3c03994DB5b0d9A5eEdD10CabaB0813678AC',
138
- * token: '0x20c0000000000000000000000000000000000001',
139
- * })}>
140
- * Set Recipient
141
- * </button>
142
- * )
143
- * }
144
- * ```
145
- *
146
- * @param parameters - Parameters.
147
- * @returns Mutation result.
148
- */
149
- export declare function useSetRecipient<config extends Config = ResolvedRegister['config'], context = unknown>(parameters?: useSetRecipient.Parameters<config, context>): useSetRecipient.ReturnType<config, context>;
150
- export declare namespace useSetRecipient {
151
- type Parameters<config extends Config = Config, context = unknown> = ConfigParameter<config> & {
152
- mutation?: UseMutationParameters<Actions.setRecipient.ReturnValue, Actions.setRecipient.ErrorType, Actions.setRecipient.Parameters<config>, context> | undefined;
153
- };
154
- type ReturnType<config extends Config = Config, context = unknown> = UseMutationResult<Actions.setRecipient.ReturnValue, Actions.setRecipient.ErrorType, Actions.setRecipient.Parameters<config>, context>;
155
- }
156
- /**
157
- * Hook for setting the reward recipient and waiting for confirmation.
158
- *
159
- * @example
160
- * ```tsx
161
- * import { Hooks } from 'tempo.ts/wagmi'
162
- *
163
- * function App() {
164
- * const { mutate: setRecipientSync } = Hooks.reward.useSetRecipientSync()
165
- *
166
- * return (
167
- * <button onClick={() => setRecipientSync({
168
- * recipient: '0xa5cc3c03994DB5b0d9A5eEdD10CabaB0813678AC',
169
- * token: '0x20c0000000000000000000000000000000000001',
170
- * })}>
171
- * Set Recipient
172
- * </button>
173
- * )
174
- * }
175
- * ```
176
- *
177
- * @param parameters - Parameters.
178
- * @returns Mutation result.
179
- */
180
- export declare function useSetRecipientSync<config extends Config = ResolvedRegister['config'], context = unknown>(parameters?: useSetRecipientSync.Parameters<config, context>): useSetRecipientSync.ReturnType<config, context>;
181
- export declare namespace useSetRecipientSync {
182
- type Parameters<config extends Config = Config, context = unknown> = ConfigParameter<config> & {
183
- mutation?: UseMutationParameters<Actions.setRecipientSync.ReturnValue, Actions.setRecipientSync.ErrorType, Actions.setRecipientSync.Parameters<config>, context> | undefined;
184
- };
185
- type ReturnType<config extends Config = Config, context = unknown> = UseMutationResult<Actions.setRecipientSync.ReturnValue, Actions.setRecipientSync.ErrorType, Actions.setRecipientSync.Parameters<config>, context>;
186
- }
187
- /**
188
- * Hook for starting a new reward stream.
189
- *
190
- * @example
191
- * ```tsx
192
- * import { Hooks } from 'tempo.ts/wagmi'
193
- *
194
- * function App() {
195
- * const { mutate: start } = Hooks.reward.useStart()
196
- *
197
- * return (
198
- * <button onClick={() => start({
199
- * amount: 100000000000000000000n,
200
- * seconds: 86400,
201
- * token: '0x20c0000000000000000000000000000000000001',
202
- * })}>
203
- * Start Reward
204
- * </button>
205
- * )
206
- * }
207
- * ```
208
- *
209
- * @param parameters - Parameters.
210
- * @returns Mutation result.
211
- */
212
- export declare function useStart<config extends Config = ResolvedRegister['config'], context = unknown>(parameters?: useStart.Parameters<config, context>): useStart.ReturnType<config, context>;
213
- export declare namespace useStart {
214
- type Parameters<config extends Config = Config, context = unknown> = ConfigParameter<config> & {
215
- mutation?: UseMutationParameters<Actions.start.ReturnValue, Actions.start.ErrorType, Actions.start.Parameters<config>, context> | undefined;
216
- };
217
- type ReturnType<config extends Config = Config, context = unknown> = UseMutationResult<Actions.start.ReturnValue, Actions.start.ErrorType, Actions.start.Parameters<config>, context>;
218
- }
219
- /**
220
- * Hook for starting a new reward stream and waiting for confirmation.
221
- *
222
- * @example
223
- * ```tsx
224
- * import { Hooks } from 'tempo.ts/wagmi'
225
- *
226
- * function App() {
227
- * const { mutate: startSync } = Hooks.reward.useStartSync()
228
- *
229
- * return (
230
- * <button onClick={() => startSync({
231
- * amount: 100000000000000000000n,
232
- * seconds: 86400,
233
- * token: '0x20c0000000000000000000000000000000000001',
234
- * })}>
235
- * Start Reward
236
- * </button>
237
- * )
238
- * }
239
- * ```
240
- *
241
- * @param parameters - Parameters.
242
- * @returns Mutation result.
243
- */
244
- export declare function useStartSync<config extends Config = ResolvedRegister['config'], context = unknown>(parameters?: useStartSync.Parameters<config, context>): useStartSync.ReturnType<config, context>;
245
- export declare namespace useStartSync {
246
- type Parameters<config extends Config = Config, context = unknown> = ConfigParameter<config> & {
247
- mutation?: UseMutationParameters<Actions.startSync.ReturnValue, Actions.startSync.ErrorType, Actions.startSync.Parameters<config>, context> | undefined;
248
- };
249
- type ReturnType<config extends Config = Config, context = unknown> = UseMutationResult<Actions.startSync.ReturnValue, Actions.startSync.ErrorType, Actions.startSync.Parameters<config>, context>;
250
- }
251
- /**
252
- * Hook for watching reward scheduled events.
253
- *
254
- * @example
255
- * ```tsx
256
- * import { Hooks } from 'tempo.ts/wagmi'
257
- *
258
- * function App() {
259
- * Hooks.reward.useWatchRewardScheduled({
260
- * token: '0x20c0000000000000000000000000000000000001',
261
- * onRewardScheduled(args) {
262
- * console.log('Reward scheduled:', args)
263
- * },
264
- * })
265
- *
266
- * return <div>Watching for reward scheduled events...</div>
267
- * }
268
- * ```
269
- *
270
- * @param parameters - Parameters.
271
- */
272
- export declare function useWatchRewardScheduled<config extends Config = ResolvedRegister['config']>(parameters?: useWatchRewardScheduled.Parameters<config>): void;
273
- export declare namespace useWatchRewardScheduled {
274
- type Parameters<config extends Config = Config> = UnionCompute<ExactPartial<Actions.watchRewardScheduled.Parameters<config>> & ConfigParameter<config> & {
275
- enabled?: boolean | undefined;
276
- }>;
277
- }
278
- /**
279
- * Hook for watching reward recipient set events.
280
- *
281
- * @example
282
- * ```tsx
283
- * import { Hooks } from 'tempo.ts/wagmi'
284
- *
285
- * function App() {
286
- * Hooks.reward.useWatchRewardRecipientSet({
287
- * token: '0x20c0000000000000000000000000000000000001',
288
- * onRewardRecipientSet(args) {
289
- * console.log('Reward recipient set:', args)
290
- * },
291
- * })
292
- *
293
- * return <div>Watching for reward recipient set events...</div>
294
- * }
295
- * ```
296
- *
297
- * @param parameters - Parameters.
298
- */
299
- export declare function useWatchRewardRecipientSet<config extends Config = ResolvedRegister['config']>(parameters?: useWatchRewardRecipientSet.Parameters<config>): void;
300
- export declare namespace useWatchRewardRecipientSet {
301
- type Parameters<config extends Config = Config> = UnionCompute<ExactPartial<Actions.watchRewardRecipientSet.Parameters<config>> & ConfigParameter<config> & {
302
- enabled?: boolean | undefined;
303
- }>;
304
- }
305
- //# sourceMappingURL=reward.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"reward.d.ts","sourceRoot":"","sources":["../../../src/wagmi/Hooks/reward.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AACxD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAA;AAC9D,OAAO,KAAK,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAG3D,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AACrE,OAAO,EACL,KAAK,qBAAqB,EAC1B,KAAK,kBAAkB,EAGxB,MAAM,aAAa,CAAA;AACpB,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AACzE,OAAO,KAAK,OAAO,MAAM,sBAAsB,CAAA;AAE/C;;;;;;;;;;;;;;;;;;;;;;GAsB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CACF;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,0BAA0B,CACxC,MAAM,SAAS,MAAM,GAAG,gBAAgB,CAAC,QAAQ,CAAC,EAClD,UAAU,GAAE,0BAA0B,CAAC,UAAU,CAAC,MAAM,CAAM,QAkB/D;AAED,MAAM,CAAC,OAAO,WAAW,0BAA0B,CAAC;IAClD,KAAK,UAAU,CAAC,MAAM,SAAS,MAAM,GAAG,MAAM,IAAI,YAAY,CAC5D,YAAY,CAAC,OAAO,CAAC,uBAAuB,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,GAC9D,eAAe,CAAC,MAAM,CAAC,GAAG;QAAE,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;KAAE,CAC9D,CAAA;CACF"}
@@ -1,368 +0,0 @@
1
- import { useEffect } from 'react';
2
- import { useChainId, useConfig } from 'wagmi';
3
- import { useMutation, useQuery, } from 'wagmi/query';
4
- import * as Actions from '../Actions/reward.js';
5
- /**
6
- * Hook for claiming accumulated rewards.
7
- *
8
- * @example
9
- * ```tsx
10
- * import { Hooks } from 'tempo.ts/wagmi'
11
- *
12
- * function App() {
13
- * const { mutate: claim } = Hooks.reward.useClaim()
14
- *
15
- * return (
16
- * <button onClick={() => claim({
17
- * token: '0x20c0000000000000000000000000000000000001'
18
- * })}>
19
- * Claim Rewards
20
- * </button>
21
- * )
22
- * }
23
- * ```
24
- *
25
- * @param parameters - Parameters.
26
- * @returns Mutation result.
27
- */
28
- export function useClaim(parameters = {}) {
29
- const { mutation } = parameters;
30
- const config = useConfig(parameters);
31
- return useMutation({
32
- ...mutation,
33
- async mutationFn(variables) {
34
- return Actions.claim(config, variables);
35
- },
36
- mutationKey: ['claim'],
37
- });
38
- }
39
- /**
40
- * Hook for claiming accumulated rewards and waiting for confirmation.
41
- *
42
- * @example
43
- * ```tsx
44
- * import { Hooks } from 'tempo.ts/wagmi'
45
- *
46
- * function App() {
47
- * const { mutate: claimSync } = Hooks.reward.useClaimSync()
48
- *
49
- * return (
50
- * <button onClick={() => claimSync({
51
- * token: '0x20c0000000000000000000000000000000000001'
52
- * })}>
53
- * Claim Rewards
54
- * </button>
55
- * )
56
- * }
57
- * ```
58
- *
59
- * @param parameters - Parameters.
60
- * @returns Mutation result.
61
- */
62
- export function useClaimSync(parameters = {}) {
63
- const { mutation } = parameters;
64
- const config = useConfig(parameters);
65
- return useMutation({
66
- ...mutation,
67
- async mutationFn(variables) {
68
- return Actions.claimSync(config, variables);
69
- },
70
- mutationKey: ['claimSync'],
71
- });
72
- }
73
- /**
74
- * Hook for getting the total reward per second rate.
75
- *
76
- * @example
77
- * ```tsx
78
- * import { Hooks } from 'tempo.ts/wagmi'
79
- *
80
- * function App() {
81
- * const { data, isLoading } = Hooks.reward.useGetTotalPerSecond({
82
- * token: '0x20c0000000000000000000000000000000000001',
83
- * })
84
- *
85
- * if (isLoading) return <div>Loading...</div>
86
- * return <div>Rate: {data?.toString()}</div>
87
- * }
88
- * ```
89
- *
90
- * @param parameters - Parameters.
91
- * @returns Query result with total reward per second.
92
- */
93
- export function useGetTotalPerSecond(parameters = {}) {
94
- const { query = {}, token } = parameters;
95
- const config = useConfig(parameters);
96
- const chainId = useChainId({ config });
97
- const options = Actions.getTotalPerSecond.queryOptions(config, {
98
- ...parameters,
99
- chainId: parameters.chainId ?? chainId,
100
- query: undefined,
101
- });
102
- const enabled = Boolean(token && (query.enabled ?? true));
103
- return useQuery({ ...query, ...options, enabled });
104
- }
105
- /**
106
- * Hook for getting the reward information for a specific account.
107
- *
108
- * @example
109
- * ```tsx
110
- * import { Hooks } from 'tempo.ts/wagmi'
111
- *
112
- * function App() {
113
- * const { data, isLoading } = Hooks.reward.useUserRewardInfo({
114
- * token: '0x20c0000000000000000000000000000000000001',
115
- * account: '0xa5cc3c03994DB5b0d9A5eEdD10CabaB0813678AC',
116
- * })
117
- *
118
- * if (isLoading) return <div>Loading...</div>
119
- * return (
120
- * <div>
121
- * <div>Recipient: {data?.rewardRecipient}</div>
122
- * <div>Reward per token: {data?.rewardPerToken.toString()}</div>
123
- * <div>Reward balance: {data?.rewardBalance.toString()}</div>
124
- * </div>
125
- * )
126
- * }
127
- * ```
128
- *
129
- * @param parameters - Parameters.
130
- * @returns Query result with reward information (recipient, rewardPerToken, rewardBalance).
131
- */
132
- export function useUserRewardInfo(parameters = {}) {
133
- const { account, query = {}, token } = parameters;
134
- const config = useConfig(parameters);
135
- const chainId = useChainId({ config });
136
- const options = Actions.getUserRewardInfo.queryOptions(config, {
137
- ...parameters,
138
- chainId: parameters.chainId ?? chainId,
139
- query: undefined,
140
- });
141
- const enabled = Boolean(token && account && (query.enabled ?? true));
142
- return useQuery({ ...query, ...options, enabled });
143
- }
144
- /**
145
- * Hook for setting the reward recipient for a token holder.
146
- *
147
- * @example
148
- * ```tsx
149
- * import { Hooks } from 'tempo.ts/wagmi'
150
- *
151
- * function App() {
152
- * const { mutate: setRecipient } = Hooks.reward.useSetRecipient()
153
- *
154
- * return (
155
- * <button onClick={() => setRecipient({
156
- * recipient: '0xa5cc3c03994DB5b0d9A5eEdD10CabaB0813678AC',
157
- * token: '0x20c0000000000000000000000000000000000001',
158
- * })}>
159
- * Set Recipient
160
- * </button>
161
- * )
162
- * }
163
- * ```
164
- *
165
- * @param parameters - Parameters.
166
- * @returns Mutation result.
167
- */
168
- export function useSetRecipient(parameters = {}) {
169
- const { mutation } = parameters;
170
- const config = useConfig(parameters);
171
- return useMutation({
172
- ...mutation,
173
- async mutationFn(variables) {
174
- return Actions.setRecipient(config, variables);
175
- },
176
- mutationKey: ['setRecipient'],
177
- });
178
- }
179
- /**
180
- * Hook for setting the reward recipient and waiting for confirmation.
181
- *
182
- * @example
183
- * ```tsx
184
- * import { Hooks } from 'tempo.ts/wagmi'
185
- *
186
- * function App() {
187
- * const { mutate: setRecipientSync } = Hooks.reward.useSetRecipientSync()
188
- *
189
- * return (
190
- * <button onClick={() => setRecipientSync({
191
- * recipient: '0xa5cc3c03994DB5b0d9A5eEdD10CabaB0813678AC',
192
- * token: '0x20c0000000000000000000000000000000000001',
193
- * })}>
194
- * Set Recipient
195
- * </button>
196
- * )
197
- * }
198
- * ```
199
- *
200
- * @param parameters - Parameters.
201
- * @returns Mutation result.
202
- */
203
- export function useSetRecipientSync(parameters = {}) {
204
- const { mutation } = parameters;
205
- const config = useConfig(parameters);
206
- return useMutation({
207
- ...mutation,
208
- async mutationFn(variables) {
209
- return Actions.setRecipientSync(config, variables);
210
- },
211
- mutationKey: ['setRecipientSync'],
212
- });
213
- }
214
- /**
215
- * Hook for starting a new reward stream.
216
- *
217
- * @example
218
- * ```tsx
219
- * import { Hooks } from 'tempo.ts/wagmi'
220
- *
221
- * function App() {
222
- * const { mutate: start } = Hooks.reward.useStart()
223
- *
224
- * return (
225
- * <button onClick={() => start({
226
- * amount: 100000000000000000000n,
227
- * seconds: 86400,
228
- * token: '0x20c0000000000000000000000000000000000001',
229
- * })}>
230
- * Start Reward
231
- * </button>
232
- * )
233
- * }
234
- * ```
235
- *
236
- * @param parameters - Parameters.
237
- * @returns Mutation result.
238
- */
239
- export function useStart(parameters = {}) {
240
- const { mutation } = parameters;
241
- const config = useConfig(parameters);
242
- return useMutation({
243
- ...mutation,
244
- async mutationFn(variables) {
245
- return Actions.start(config, variables);
246
- },
247
- mutationKey: ['start'],
248
- });
249
- }
250
- /**
251
- * Hook for starting a new reward stream and waiting for confirmation.
252
- *
253
- * @example
254
- * ```tsx
255
- * import { Hooks } from 'tempo.ts/wagmi'
256
- *
257
- * function App() {
258
- * const { mutate: startSync } = Hooks.reward.useStartSync()
259
- *
260
- * return (
261
- * <button onClick={() => startSync({
262
- * amount: 100000000000000000000n,
263
- * seconds: 86400,
264
- * token: '0x20c0000000000000000000000000000000000001',
265
- * })}>
266
- * Start Reward
267
- * </button>
268
- * )
269
- * }
270
- * ```
271
- *
272
- * @param parameters - Parameters.
273
- * @returns Mutation result.
274
- */
275
- export function useStartSync(parameters = {}) {
276
- const { mutation } = parameters;
277
- const config = useConfig(parameters);
278
- return useMutation({
279
- ...mutation,
280
- async mutationFn(variables) {
281
- return Actions.startSync(config, variables);
282
- },
283
- mutationKey: ['startSync'],
284
- });
285
- }
286
- /**
287
- * Hook for watching reward scheduled events.
288
- *
289
- * @example
290
- * ```tsx
291
- * import { Hooks } from 'tempo.ts/wagmi'
292
- *
293
- * function App() {
294
- * Hooks.reward.useWatchRewardScheduled({
295
- * token: '0x20c0000000000000000000000000000000000001',
296
- * onRewardScheduled(args) {
297
- * console.log('Reward scheduled:', args)
298
- * },
299
- * })
300
- *
301
- * return <div>Watching for reward scheduled events...</div>
302
- * }
303
- * ```
304
- *
305
- * @param parameters - Parameters.
306
- */
307
- export function useWatchRewardScheduled(parameters = {}) {
308
- const { enabled = true, onRewardScheduled, token, ...rest } = parameters;
309
- const config = useConfig({ config: parameters.config });
310
- const configChainId = useChainId({ config });
311
- const chainId = parameters.chainId ?? configChainId;
312
- useEffect(() => {
313
- if (!enabled)
314
- return;
315
- if (!onRewardScheduled)
316
- return;
317
- if (!token)
318
- return;
319
- return Actions.watchRewardScheduled(config, {
320
- ...rest,
321
- chainId,
322
- onRewardScheduled,
323
- token,
324
- });
325
- }, [config, enabled, onRewardScheduled, rest, chainId, token]);
326
- }
327
- /**
328
- * Hook for watching reward recipient set events.
329
- *
330
- * @example
331
- * ```tsx
332
- * import { Hooks } from 'tempo.ts/wagmi'
333
- *
334
- * function App() {
335
- * Hooks.reward.useWatchRewardRecipientSet({
336
- * token: '0x20c0000000000000000000000000000000000001',
337
- * onRewardRecipientSet(args) {
338
- * console.log('Reward recipient set:', args)
339
- * },
340
- * })
341
- *
342
- * return <div>Watching for reward recipient set events...</div>
343
- * }
344
- * ```
345
- *
346
- * @param parameters - Parameters.
347
- */
348
- export function useWatchRewardRecipientSet(parameters = {}) {
349
- const { enabled = true, onRewardRecipientSet, token, ...rest } = parameters;
350
- const config = useConfig({ config: parameters.config });
351
- const configChainId = useChainId({ config });
352
- const chainId = parameters.chainId ?? configChainId;
353
- useEffect(() => {
354
- if (!enabled)
355
- return;
356
- if (!onRewardRecipientSet)
357
- return;
358
- if (!token)
359
- return;
360
- return Actions.watchRewardRecipientSet(config, {
361
- ...rest,
362
- chainId,
363
- onRewardRecipientSet,
364
- token,
365
- });
366
- }, [config, enabled, onRewardRecipientSet, rest, chainId, token]);
367
- }
368
- //# sourceMappingURL=reward.js.map