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,691 @@
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/amm.js'
7
+
8
+ /**
9
+ * Gets the reserves for a liquidity pool.
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 pool = await Actions.amm.getPool(config, {
25
+ * userToken: '0x...',
26
+ * validatorToken: '0x...',
27
+ * })
28
+ * ```
29
+ *
30
+ * @param config - Config.
31
+ * @param parameters - Parameters.
32
+ * @returns The pool reserves.
33
+ */
34
+ export function getPool<config extends Config>(
35
+ config: config,
36
+ parameters: getPool.Parameters<config>,
37
+ ) {
38
+ const { chainId, ...rest } = parameters
39
+ const client = config.getClient({ chainId })
40
+ return viem_Actions.getPool(client, rest)
41
+ }
42
+
43
+ export namespace getPool {
44
+ export type Parameters<config extends Config> = ChainIdParameter<config> &
45
+ viem_Actions.getPool.Parameters
46
+
47
+ export type ReturnValue = viem_Actions.getPool.ReturnValue
48
+
49
+ export function queryKey<config extends Config>(
50
+ parameters: Parameters<config>,
51
+ ) {
52
+ return ['getPool', parameters] as const
53
+ }
54
+
55
+ export type QueryKey<config extends Config> = ReturnType<
56
+ typeof queryKey<config>
57
+ >
58
+
59
+ export function queryOptions<config extends Config, selectData = ReturnValue>(
60
+ config: Config,
61
+ parameters: queryOptions.Parameters<config, selectData>,
62
+ ): queryOptions.ReturnValue<config, selectData> {
63
+ const { query, ...rest } = parameters
64
+ return {
65
+ ...query,
66
+ queryKey: queryKey(rest),
67
+ async queryFn({ queryKey }) {
68
+ const [, parameters] = queryKey
69
+ return await getPool(config, parameters)
70
+ },
71
+ }
72
+ }
73
+
74
+ export declare namespace queryOptions {
75
+ export type Parameters<
76
+ config extends Config,
77
+ selectData = getPool.ReturnValue,
78
+ > = getPool.Parameters<config> & {
79
+ query?:
80
+ | Omit<ReturnValue<config, selectData>, 'queryKey' | 'queryFn'>
81
+ | undefined
82
+ }
83
+
84
+ export type ReturnValue<
85
+ config extends Config,
86
+ selectData = getPool.ReturnValue,
87
+ > = RequiredBy<
88
+ Query.QueryOptions<
89
+ getPool.ReturnValue,
90
+ Query.DefaultError,
91
+ selectData,
92
+ getPool.QueryKey<config>
93
+ >,
94
+ 'queryKey' | 'queryFn'
95
+ >
96
+ }
97
+ }
98
+
99
+ /**
100
+ * Gets the LP token balance for an account in a specific pool.
101
+ *
102
+ * @example
103
+ * ```ts
104
+ * import { createConfig, http } from '@wagmi/core'
105
+ * import { tempo } from 'tempo.ts/chains'
106
+ * import { Actions } from 'tempo.ts/wagmi'
107
+ *
108
+ * const config = createConfig({
109
+ * chains: [tempo],
110
+ * transports: {
111
+ * [tempo.id]: http(),
112
+ * },
113
+ * })
114
+ *
115
+ * const poolId = await Actions.amm.getPoolId(config, {
116
+ * userToken: '0x...',
117
+ * validatorToken: '0x...',
118
+ * })
119
+ *
120
+ * const balance = await Actions.amm.getLiquidityBalance(config, {
121
+ * poolId,
122
+ * address: '0x...',
123
+ * })
124
+ * ```
125
+ *
126
+ * @param config - Config.
127
+ * @param parameters - Parameters.
128
+ * @returns The LP token balance.
129
+ */
130
+ export function getLiquidityBalance<config extends Config>(
131
+ config: config,
132
+ parameters: getLiquidityBalance.Parameters<config>,
133
+ ) {
134
+ const { chainId, ...rest } = parameters
135
+ const client = config.getClient({ chainId })
136
+ return viem_Actions.getLiquidityBalance(client, rest)
137
+ }
138
+
139
+ export namespace getLiquidityBalance {
140
+ export type Parameters<config extends Config> = ChainIdParameter<config> &
141
+ viem_Actions.getLiquidityBalance.Parameters
142
+
143
+ export type ReturnValue = viem_Actions.getLiquidityBalance.ReturnValue
144
+
145
+ export function queryKey<config extends Config>(
146
+ parameters: Parameters<config>,
147
+ ) {
148
+ return ['getLiquidityBalance', parameters] as const
149
+ }
150
+
151
+ export type QueryKey<config extends Config> = ReturnType<
152
+ typeof queryKey<config>
153
+ >
154
+
155
+ export function queryOptions<config extends Config, selectData = ReturnValue>(
156
+ config: Config,
157
+ parameters: queryOptions.Parameters<config, selectData>,
158
+ ): queryOptions.ReturnValue<config, selectData> {
159
+ const { query, ...rest } = parameters
160
+ return {
161
+ ...query,
162
+ queryKey: queryKey(rest),
163
+ async queryFn({ queryKey }) {
164
+ const [, parameters] = queryKey
165
+ return await getLiquidityBalance(config, parameters)
166
+ },
167
+ }
168
+ }
169
+
170
+ export declare namespace queryOptions {
171
+ export type Parameters<
172
+ config extends Config,
173
+ selectData = getLiquidityBalance.ReturnValue,
174
+ > = getLiquidityBalance.Parameters<config> & {
175
+ query?:
176
+ | Omit<ReturnValue<config, selectData>, 'queryKey' | 'queryFn'>
177
+ | undefined
178
+ }
179
+
180
+ export type ReturnValue<
181
+ config extends Config,
182
+ selectData = getLiquidityBalance.ReturnValue,
183
+ > = RequiredBy<
184
+ Query.QueryOptions<
185
+ getLiquidityBalance.ReturnValue,
186
+ Query.DefaultError,
187
+ selectData,
188
+ getLiquidityBalance.QueryKey<config>
189
+ >,
190
+ 'queryKey' | 'queryFn'
191
+ >
192
+ }
193
+ }
194
+
195
+ /**
196
+ * Performs a rebalance swap from validator token to user token.
197
+ *
198
+ * @example
199
+ * ```ts
200
+ * import { createConfig, http } from '@wagmi/core'
201
+ * import { tempo } from 'tempo.ts/chains'
202
+ * import { Actions } from 'tempo.ts/wagmi'
203
+ *
204
+ * const config = createConfig({
205
+ * chains: [tempo],
206
+ * transports: {
207
+ * [tempo.id]: http(),
208
+ * },
209
+ * })
210
+ *
211
+ * const hash = await Actions.amm.rebalanceSwap(config, {
212
+ * userToken: '0x...',
213
+ * validatorToken: '0x...',
214
+ * amountOut: 100n,
215
+ * to: '0x...',
216
+ * })
217
+ * ```
218
+ *
219
+ * @param config - Config.
220
+ * @param parameters - Parameters.
221
+ * @returns The transaction hash.
222
+ */
223
+ export async function rebalanceSwap<config extends Config>(
224
+ config: config,
225
+ parameters: rebalanceSwap.Parameters<config>,
226
+ ): Promise<viem_Actions.rebalanceSwap.ReturnValue> {
227
+ const { account, chainId, connector } = parameters
228
+
229
+ const client = await getConnectorClient(config, {
230
+ account,
231
+ assertChainId: false,
232
+ chainId,
233
+ connector,
234
+ })
235
+
236
+ return viem_Actions.rebalanceSwap(
237
+ client,
238
+ parameters as viem_Actions.rebalanceSwap.Parameters,
239
+ )
240
+ }
241
+
242
+ export declare namespace rebalanceSwap {
243
+ export type Parameters<config extends Config> = ChainIdParameter<config> &
244
+ ConnectorParameter &
245
+ Omit<viem_Actions.rebalanceSwap.Parameters<undefined, Account>, 'chain'>
246
+
247
+ export type ReturnValue = viem_Actions.rebalanceSwap.ReturnValue
248
+ }
249
+
250
+ /**
251
+ * Performs a rebalance swap from validator token to user token.
252
+ *
253
+ * @example
254
+ * ```ts
255
+ * import { createConfig, http } from '@wagmi/core'
256
+ * import { tempo } from 'tempo.ts/chains'
257
+ * import { Actions } from 'tempo.ts/wagmi'
258
+ *
259
+ * const config = createConfig({
260
+ * chains: [tempo],
261
+ * transports: {
262
+ * [tempo.id]: http(),
263
+ * },
264
+ * })
265
+ *
266
+ * const result = await Actions.amm.rebalanceSwapSync(config, {
267
+ * userToken: '0x...',
268
+ * validatorToken: '0x...',
269
+ * amountOut: 100n,
270
+ * to: '0x...',
271
+ * })
272
+ * ```
273
+ *
274
+ * @param config - Config.
275
+ * @param parameters - Parameters.
276
+ * @returns The transaction receipt and event data.
277
+ */
278
+ export async function rebalanceSwapSync<config extends Config>(
279
+ config: config,
280
+ parameters: rebalanceSwapSync.Parameters<config>,
281
+ ): Promise<viem_Actions.rebalanceSwapSync.ReturnValue> {
282
+ const { account, chainId, connector } = parameters
283
+
284
+ const client = await getConnectorClient(config, {
285
+ account,
286
+ assertChainId: false,
287
+ chainId,
288
+ connector,
289
+ })
290
+
291
+ return viem_Actions.rebalanceSwapSync(
292
+ client,
293
+ parameters as viem_Actions.rebalanceSwapSync.Parameters,
294
+ )
295
+ }
296
+
297
+ export declare namespace rebalanceSwapSync {
298
+ export type Parameters<config extends Config> = ChainIdParameter<config> &
299
+ ConnectorParameter &
300
+ Omit<viem_Actions.rebalanceSwapSync.Parameters<undefined, Account>, 'chain'>
301
+
302
+ export type ReturnValue = viem_Actions.rebalanceSwapSync.ReturnValue
303
+ }
304
+
305
+ /**
306
+ * Adds liquidity to a pool.
307
+ *
308
+ * @example
309
+ * ```ts
310
+ * import { createConfig, http } from '@wagmi/core'
311
+ * import { tempo } from 'tempo.ts/chains'
312
+ * import { Actions } from 'tempo.ts/wagmi'
313
+ *
314
+ * const config = createConfig({
315
+ * chains: [tempo],
316
+ * transports: {
317
+ * [tempo.id]: http(),
318
+ * },
319
+ * })
320
+ *
321
+ * const hash = await Actions.amm.mint(config, {
322
+ * userToken: {
323
+ * address: '0x20c0...beef',
324
+ * amount: 100n,
325
+ * },
326
+ * validatorToken: {
327
+ * address: '0x20c0...babe',
328
+ * amount: 100n,
329
+ * },
330
+ * to: '0xfeed...fede',
331
+ * })
332
+ * ```
333
+ *
334
+ * @param config - Config.
335
+ * @param parameters - Parameters.
336
+ * @returns The transaction hash.
337
+ */
338
+ export async function mint<config extends Config>(
339
+ config: config,
340
+ parameters: mint.Parameters<config>,
341
+ ): Promise<viem_Actions.mint.ReturnValue> {
342
+ const { account, chainId, connector } = parameters
343
+
344
+ const client = await getConnectorClient(config, {
345
+ account,
346
+ assertChainId: false,
347
+ chainId,
348
+ connector,
349
+ })
350
+
351
+ return viem_Actions.mint(client, parameters as viem_Actions.mint.Parameters)
352
+ }
353
+
354
+ export declare namespace mint {
355
+ export type Parameters<config extends Config> = ChainIdParameter<config> &
356
+ ConnectorParameter &
357
+ Omit<viem_Actions.mint.Parameters<undefined, Account>, 'chain'>
358
+
359
+ export type ReturnValue = viem_Actions.mint.ReturnValue
360
+ }
361
+
362
+ /**
363
+ * Adds liquidity to a pool.
364
+ *
365
+ * @example
366
+ * ```ts
367
+ * import { createConfig, http } from '@wagmi/core'
368
+ * import { tempo } from 'tempo.ts/chains'
369
+ * import { Actions } from 'tempo.ts/wagmi'
370
+ *
371
+ * const config = createConfig({
372
+ * chains: [tempo],
373
+ * transports: {
374
+ * [tempo.id]: http(),
375
+ * },
376
+ * })
377
+ *
378
+ * const result = await Actions.amm.mintSync(config, {
379
+ * userToken: {
380
+ * address: '0x20c0...beef',
381
+ * amount: 100n,
382
+ * },
383
+ * validatorToken: {
384
+ * address: '0x20c0...babe',
385
+ * amount: 100n,
386
+ * },
387
+ * to: '0xfeed...fede',
388
+ * })
389
+ * ```
390
+ *
391
+ * @param config - Config.
392
+ * @param parameters - Parameters.
393
+ * @returns The transaction receipt and event data.
394
+ */
395
+ export async function mintSync<config extends Config>(
396
+ config: config,
397
+ parameters: mintSync.Parameters<config>,
398
+ ): Promise<viem_Actions.mintSync.ReturnValue> {
399
+ const { account, chainId, connector } = parameters
400
+
401
+ const client = await getConnectorClient(config, {
402
+ account,
403
+ assertChainId: false,
404
+ chainId,
405
+ connector,
406
+ })
407
+
408
+ return viem_Actions.mintSync(
409
+ client,
410
+ parameters as viem_Actions.mintSync.Parameters,
411
+ )
412
+ }
413
+
414
+ export declare namespace mintSync {
415
+ export type Parameters<config extends Config> = ChainIdParameter<config> &
416
+ ConnectorParameter &
417
+ Omit<viem_Actions.mintSync.Parameters<undefined, Account>, 'chain'>
418
+
419
+ export type ReturnValue = viem_Actions.mintSync.ReturnValue
420
+ }
421
+
422
+ /**
423
+ * Removes liquidity from a pool.
424
+ *
425
+ * @example
426
+ * ```ts
427
+ * import { createConfig, http } from '@wagmi/core'
428
+ * import { tempo } from 'tempo.ts/chains'
429
+ * import { Actions } from 'tempo.ts/wagmi'
430
+ *
431
+ * const config = createConfig({
432
+ * chains: [tempo],
433
+ * transports: {
434
+ * [tempo.id]: http(),
435
+ * },
436
+ * })
437
+ *
438
+ * const hash = await Actions.amm.burn(config, {
439
+ * userToken: '0x20c0...beef',
440
+ * validatorToken: '0x20c0...babe',
441
+ * liquidity: 50n,
442
+ * to: '0xfeed...fede',
443
+ * })
444
+ * ```
445
+ *
446
+ * @param config - Config.
447
+ * @param parameters - Parameters.
448
+ * @returns The transaction hash.
449
+ */
450
+ export async function burn<config extends Config>(
451
+ config: config,
452
+ parameters: burn.Parameters<config>,
453
+ ): Promise<viem_Actions.burn.ReturnValue> {
454
+ const { account, chainId, connector } = parameters
455
+
456
+ const client = await getConnectorClient(config, {
457
+ account,
458
+ assertChainId: false,
459
+ chainId,
460
+ connector,
461
+ })
462
+
463
+ return viem_Actions.burn(client, parameters as viem_Actions.burn.Parameters)
464
+ }
465
+
466
+ export declare namespace burn {
467
+ export type Parameters<config extends Config> = ChainIdParameter<config> &
468
+ ConnectorParameter &
469
+ Omit<viem_Actions.burn.Parameters<undefined, Account>, 'chain'>
470
+
471
+ export type ReturnValue = viem_Actions.burn.ReturnValue
472
+ }
473
+
474
+ /**
475
+ * Removes liquidity from a pool.
476
+ *
477
+ * @example
478
+ * ```ts
479
+ * import { createConfig, http } from '@wagmi/core'
480
+ * import { tempo } from 'tempo.ts/chains'
481
+ * import { Actions } from 'tempo.ts/wagmi'
482
+ *
483
+ * const config = createConfig({
484
+ * chains: [tempo],
485
+ * transports: {
486
+ * [tempo.id]: http(),
487
+ * },
488
+ * })
489
+ *
490
+ * const result = await Actions.amm.burnSync(config, {
491
+ * userToken: '0x20c0...beef',
492
+ * validatorToken: '0x20c0...babe',
493
+ * liquidity: 50n,
494
+ * to: '0xfeed...fede',
495
+ * })
496
+ * ```
497
+ *
498
+ * @param config - Config.
499
+ * @param parameters - Parameters.
500
+ * @returns The transaction receipt and event data.
501
+ */
502
+ export async function burnSync<config extends Config>(
503
+ config: config,
504
+ parameters: burnSync.Parameters<config>,
505
+ ): Promise<viem_Actions.burnSync.ReturnValue> {
506
+ const { account, chainId, connector } = parameters
507
+
508
+ const client = await getConnectorClient(config, {
509
+ account,
510
+ assertChainId: false,
511
+ chainId,
512
+ connector,
513
+ })
514
+
515
+ return viem_Actions.burnSync(
516
+ client,
517
+ parameters as viem_Actions.burnSync.Parameters,
518
+ )
519
+ }
520
+
521
+ export declare namespace burnSync {
522
+ export type Parameters<config extends Config> = ChainIdParameter<config> &
523
+ ConnectorParameter &
524
+ Omit<viem_Actions.burnSync.Parameters<undefined, Account>, 'chain'>
525
+
526
+ export type ReturnValue = viem_Actions.burnSync.ReturnValue
527
+ }
528
+
529
+ /**
530
+ * Watches for rebalance swap events.
531
+ *
532
+ * @example
533
+ * ```ts
534
+ * import { createConfig, http } from '@wagmi/core'
535
+ * import { tempo } from 'tempo.ts/chains'
536
+ * import { Actions } from 'tempo.ts/wagmi'
537
+ *
538
+ * const config = createConfig({
539
+ * chains: [tempo],
540
+ * transports: {
541
+ * [tempo.id]: http(),
542
+ * },
543
+ * })
544
+ *
545
+ * const unwatch = Actions.amm.watchRebalanceSwap(config, {
546
+ * onRebalanceSwap: (args, log) => {
547
+ * console.log('Rebalance swap:', args)
548
+ * },
549
+ * })
550
+ * ```
551
+ *
552
+ * @param config - Config.
553
+ * @param parameters - Parameters.
554
+ * @returns A function to unsubscribe from the event.
555
+ */
556
+ export function watchRebalanceSwap<config extends Config>(
557
+ config: config,
558
+ parameters: watchRebalanceSwap.Parameters<config>,
559
+ ) {
560
+ const { chainId, ...rest } = parameters
561
+ const client = config.getClient({ chainId })
562
+ return viem_Actions.watchRebalanceSwap(client, rest)
563
+ }
564
+
565
+ export declare namespace watchRebalanceSwap {
566
+ export type Parameters<config extends Config> = ChainIdParameter<config> &
567
+ viem_Actions.watchRebalanceSwap.Parameters
568
+ }
569
+
570
+ /**
571
+ * Watches for fee swap events.
572
+ *
573
+ * @example
574
+ * ```ts
575
+ * import { createConfig, http } from '@wagmi/core'
576
+ * import { tempo } from 'tempo.ts/chains'
577
+ * import { Actions } from 'tempo.ts/wagmi'
578
+ *
579
+ * const config = createConfig({
580
+ * chains: [tempo],
581
+ * transports: {
582
+ * [tempo.id]: http(),
583
+ * },
584
+ * })
585
+ *
586
+ * const unwatch = Actions.amm.watchFeeSwap(config, {
587
+ * onFeeSwap: (args, log) => {
588
+ * console.log('Fee swap:', args)
589
+ * },
590
+ * })
591
+ * ```
592
+ *
593
+ * @param config - Config.
594
+ * @param parameters - Parameters.
595
+ * @returns A function to unsubscribe from the event.
596
+ */
597
+ export function watchFeeSwap<config extends Config>(
598
+ config: config,
599
+ parameters: watchFeeSwap.Parameters<config>,
600
+ ) {
601
+ const { chainId, ...rest } = parameters
602
+ const client = config.getClient({ chainId })
603
+ return viem_Actions.watchFeeSwap(client, rest)
604
+ }
605
+
606
+ export declare namespace watchFeeSwap {
607
+ export type Parameters<config extends Config> = ChainIdParameter<config> &
608
+ viem_Actions.watchFeeSwap.Parameters
609
+ }
610
+
611
+ /**
612
+ * Watches for liquidity mint events.
613
+ *
614
+ * @example
615
+ * ```ts
616
+ * import { createConfig, http } from '@wagmi/core'
617
+ * import { tempo } from 'tempo.ts/chains'
618
+ * import { Actions } from 'tempo.ts/wagmi'
619
+ *
620
+ * const config = createConfig({
621
+ * chains: [tempo],
622
+ * transports: {
623
+ * [tempo.id]: http(),
624
+ * },
625
+ * })
626
+ *
627
+ * const unwatch = Actions.amm.watchMint(config, {
628
+ * onMint: (args, log) => {
629
+ * console.log('Liquidity added:', args)
630
+ * },
631
+ * })
632
+ * ```
633
+ *
634
+ * @param config - Config.
635
+ * @param parameters - Parameters.
636
+ * @returns A function to unsubscribe from the event.
637
+ */
638
+ export function watchMint<config extends Config>(
639
+ config: config,
640
+ parameters: watchMint.Parameters<config>,
641
+ ) {
642
+ const { chainId, ...rest } = parameters
643
+ const client = config.getClient({ chainId })
644
+ return viem_Actions.watchMint(client, rest)
645
+ }
646
+
647
+ export declare namespace watchMint {
648
+ export type Parameters<config extends Config> = ChainIdParameter<config> &
649
+ viem_Actions.watchMint.Parameters
650
+ }
651
+
652
+ /**
653
+ * Watches for liquidity burn events.
654
+ *
655
+ * @example
656
+ * ```ts
657
+ * import { createConfig, http } from '@wagmi/core'
658
+ * import { tempo } from 'tempo.ts/chains'
659
+ * import { Actions } from 'tempo.ts/wagmi'
660
+ *
661
+ * const config = createConfig({
662
+ * chains: [tempo],
663
+ * transports: {
664
+ * [tempo.id]: http(),
665
+ * },
666
+ * })
667
+ *
668
+ * const unwatch = Actions.amm.watchBurn(config, {
669
+ * onBurn: (args, log) => {
670
+ * console.log('Liquidity removed:', args)
671
+ * },
672
+ * })
673
+ * ```
674
+ *
675
+ * @param config - Config.
676
+ * @param parameters - Parameters.
677
+ * @returns A function to unsubscribe from the event.
678
+ */
679
+ export function watchBurn<config extends Config>(
680
+ config: config,
681
+ parameters: watchBurn.Parameters<config>,
682
+ ) {
683
+ const { chainId, ...rest } = parameters
684
+ const client = config.getClient({ chainId })
685
+ return viem_Actions.watchBurn(client, rest)
686
+ }
687
+
688
+ export declare namespace watchBurn {
689
+ export type Parameters<config extends Config> = ChainIdParameter<config> &
690
+ viem_Actions.watchBurn.Parameters
691
+ }