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