tempo.ts 0.1.5 → 0.2.1

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