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,472 @@
1
+ import { getConnectorClient } from '@wagmi/core';
2
+ import * as viem_Actions from '../../viem/Actions/amm.js';
3
+ /**
4
+ * Gets the reserves for a liquidity pool.
5
+ *
6
+ * @example
7
+ * ```ts
8
+ * import { createConfig, http } from '@wagmi/core'
9
+ * import { tempo } from 'tempo.ts/chains'
10
+ * import { Actions } from 'tempo.ts/wagmi'
11
+ *
12
+ * const config = createConfig({
13
+ * chains: [tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })],
14
+ * transports: {
15
+ * [tempo.id]: http(),
16
+ * },
17
+ * })
18
+ *
19
+ * const pool = await Actions.amm.getPool(config, {
20
+ * userToken: '0x...',
21
+ * validatorToken: '0x...',
22
+ * })
23
+ * ```
24
+ *
25
+ * @param config - Config.
26
+ * @param parameters - Parameters.
27
+ * @returns The pool reserves.
28
+ */
29
+ export function getPool(config, parameters) {
30
+ const { chainId, ...rest } = parameters;
31
+ const client = config.getClient({ chainId });
32
+ return viem_Actions.getPool(client, rest);
33
+ }
34
+ (function (getPool) {
35
+ function queryKey(parameters) {
36
+ return ['getPool', parameters];
37
+ }
38
+ getPool.queryKey = queryKey;
39
+ function queryOptions(config, parameters) {
40
+ const { query, ...rest } = parameters;
41
+ return {
42
+ ...query,
43
+ queryKey: queryKey(rest),
44
+ async queryFn({ queryKey }) {
45
+ const [, parameters] = queryKey;
46
+ return await getPool(config, parameters);
47
+ },
48
+ };
49
+ }
50
+ getPool.queryOptions = queryOptions;
51
+ })(getPool || (getPool = {}));
52
+ /**
53
+ * Gets the LP token balance for an account in a specific pool.
54
+ *
55
+ * @example
56
+ * ```ts
57
+ * import { createConfig, http } from '@wagmi/core'
58
+ * import { tempo } from 'tempo.ts/chains'
59
+ * import { Actions } from 'tempo.ts/wagmi'
60
+ *
61
+ * const config = createConfig({
62
+ * chains: [tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })],
63
+ * transports: {
64
+ * [tempo.id]: http(),
65
+ * },
66
+ * })
67
+ *
68
+ * const poolId = await Actions.amm.getPoolId(config, {
69
+ * userToken: '0x...',
70
+ * validatorToken: '0x...',
71
+ * })
72
+ *
73
+ * const balance = await Actions.amm.getLiquidityBalance(config, {
74
+ * poolId,
75
+ * address: '0x...',
76
+ * })
77
+ * ```
78
+ *
79
+ * @param config - Config.
80
+ * @param parameters - Parameters.
81
+ * @returns The LP token balance.
82
+ */
83
+ export function getLiquidityBalance(config, parameters) {
84
+ const { chainId, ...rest } = parameters;
85
+ const client = config.getClient({ chainId });
86
+ return viem_Actions.getLiquidityBalance(client, rest);
87
+ }
88
+ (function (getLiquidityBalance) {
89
+ function queryKey(parameters) {
90
+ return ['getLiquidityBalance', parameters];
91
+ }
92
+ getLiquidityBalance.queryKey = queryKey;
93
+ function queryOptions(config, parameters) {
94
+ const { query, ...rest } = parameters;
95
+ return {
96
+ ...query,
97
+ queryKey: queryKey(rest),
98
+ async queryFn({ queryKey }) {
99
+ const [, parameters] = queryKey;
100
+ return await getLiquidityBalance(config, parameters);
101
+ },
102
+ };
103
+ }
104
+ getLiquidityBalance.queryOptions = queryOptions;
105
+ })(getLiquidityBalance || (getLiquidityBalance = {}));
106
+ /**
107
+ * Performs a rebalance swap from validator token to user token.
108
+ *
109
+ * @example
110
+ * ```ts
111
+ * import { createConfig, http } from '@wagmi/core'
112
+ * import { tempo } from 'tempo.ts/chains'
113
+ * import { Actions } from 'tempo.ts/wagmi'
114
+ *
115
+ * const config = createConfig({
116
+ * chains: [tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })],
117
+ * transports: {
118
+ * [tempo.id]: http(),
119
+ * },
120
+ * })
121
+ *
122
+ * const hash = await Actions.amm.rebalanceSwap(config, {
123
+ * userToken: '0x...',
124
+ * validatorToken: '0x...',
125
+ * amountOut: 100n,
126
+ * to: '0x...',
127
+ * })
128
+ * ```
129
+ *
130
+ * @param config - Config.
131
+ * @param parameters - Parameters.
132
+ * @returns The transaction hash.
133
+ */
134
+ export async function rebalanceSwap(config, parameters) {
135
+ const { account, chainId, connector } = parameters;
136
+ const client = await getConnectorClient(config, {
137
+ account,
138
+ assertChainId: false,
139
+ chainId,
140
+ connector,
141
+ });
142
+ return viem_Actions.rebalanceSwap(client, parameters);
143
+ }
144
+ /**
145
+ * Performs a rebalance swap from validator token to user token.
146
+ *
147
+ * @example
148
+ * ```ts
149
+ * import { createConfig, http } from '@wagmi/core'
150
+ * import { tempo } from 'tempo.ts/chains'
151
+ * import { Actions } from 'tempo.ts/wagmi'
152
+ *
153
+ * const config = createConfig({
154
+ * chains: [tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })],
155
+ * transports: {
156
+ * [tempo.id]: http(),
157
+ * },
158
+ * })
159
+ *
160
+ * const result = await Actions.amm.rebalanceSwapSync(config, {
161
+ * userToken: '0x...',
162
+ * validatorToken: '0x...',
163
+ * amountOut: 100n,
164
+ * to: '0x...',
165
+ * })
166
+ * ```
167
+ *
168
+ * @param config - Config.
169
+ * @param parameters - Parameters.
170
+ * @returns The transaction receipt and event data.
171
+ */
172
+ export async function rebalanceSwapSync(config, parameters) {
173
+ const { account, chainId, connector } = parameters;
174
+ const client = await getConnectorClient(config, {
175
+ account,
176
+ assertChainId: false,
177
+ chainId,
178
+ connector,
179
+ });
180
+ return viem_Actions.rebalanceSwapSync(client, parameters);
181
+ }
182
+ /**
183
+ * Adds liquidity to a pool.
184
+ *
185
+ * @example
186
+ * ```ts
187
+ * import { createConfig, http } from '@wagmi/core'
188
+ * import { tempo } from 'tempo.ts/chains'
189
+ * import { Actions } from 'tempo.ts/wagmi'
190
+ *
191
+ * const config = createConfig({
192
+ * chains: [tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })],
193
+ * transports: {
194
+ * [tempo.id]: http(),
195
+ * },
196
+ * })
197
+ *
198
+ * const hash = await Actions.amm.mint(config, {
199
+ * userToken: {
200
+ * address: '0x20c0...beef',
201
+ * amount: 100n,
202
+ * },
203
+ * validatorToken: {
204
+ * address: '0x20c0...babe',
205
+ * amount: 100n,
206
+ * },
207
+ * to: '0xfeed...fede',
208
+ * })
209
+ * ```
210
+ *
211
+ * @param config - Config.
212
+ * @param parameters - Parameters.
213
+ * @returns The transaction hash.
214
+ */
215
+ export async function mint(config, parameters) {
216
+ const { account, chainId, connector } = parameters;
217
+ const client = await getConnectorClient(config, {
218
+ account,
219
+ assertChainId: false,
220
+ chainId,
221
+ connector,
222
+ });
223
+ return viem_Actions.mint(client, parameters);
224
+ }
225
+ /**
226
+ * Adds liquidity to a pool.
227
+ *
228
+ * @example
229
+ * ```ts
230
+ * import { createConfig, http } from '@wagmi/core'
231
+ * import { tempo } from 'tempo.ts/chains'
232
+ * import { Actions } from 'tempo.ts/wagmi'
233
+ *
234
+ * const config = createConfig({
235
+ * chains: [tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })],
236
+ * transports: {
237
+ * [tempo.id]: http(),
238
+ * },
239
+ * })
240
+ *
241
+ * const result = await Actions.amm.mintSync(config, {
242
+ * userToken: {
243
+ * address: '0x20c0...beef',
244
+ * amount: 100n,
245
+ * },
246
+ * validatorToken: {
247
+ * address: '0x20c0...babe',
248
+ * amount: 100n,
249
+ * },
250
+ * to: '0xfeed...fede',
251
+ * })
252
+ * ```
253
+ *
254
+ * @param config - Config.
255
+ * @param parameters - Parameters.
256
+ * @returns The transaction receipt and event data.
257
+ */
258
+ export async function mintSync(config, parameters) {
259
+ const { account, chainId, connector } = parameters;
260
+ const client = await getConnectorClient(config, {
261
+ account,
262
+ assertChainId: false,
263
+ chainId,
264
+ connector,
265
+ });
266
+ return viem_Actions.mintSync(client, parameters);
267
+ }
268
+ /**
269
+ * Removes liquidity from a pool.
270
+ *
271
+ * @example
272
+ * ```ts
273
+ * import { createConfig, http } from '@wagmi/core'
274
+ * import { tempo } from 'tempo.ts/chains'
275
+ * import { Actions } from 'tempo.ts/wagmi'
276
+ *
277
+ * const config = createConfig({
278
+ * chains: [tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })],
279
+ * transports: {
280
+ * [tempo.id]: http(),
281
+ * },
282
+ * })
283
+ *
284
+ * const hash = await Actions.amm.burn(config, {
285
+ * userToken: '0x20c0...beef',
286
+ * validatorToken: '0x20c0...babe',
287
+ * liquidity: 50n,
288
+ * to: '0xfeed...fede',
289
+ * })
290
+ * ```
291
+ *
292
+ * @param config - Config.
293
+ * @param parameters - Parameters.
294
+ * @returns The transaction hash.
295
+ */
296
+ export async function burn(config, parameters) {
297
+ const { account, chainId, connector } = parameters;
298
+ const client = await getConnectorClient(config, {
299
+ account,
300
+ assertChainId: false,
301
+ chainId,
302
+ connector,
303
+ });
304
+ return viem_Actions.burn(client, parameters);
305
+ }
306
+ /**
307
+ * Removes liquidity from a pool.
308
+ *
309
+ * @example
310
+ * ```ts
311
+ * import { createConfig, http } from '@wagmi/core'
312
+ * import { tempo } from 'tempo.ts/chains'
313
+ * import { Actions } from 'tempo.ts/wagmi'
314
+ *
315
+ * const config = createConfig({
316
+ * chains: [tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })],
317
+ * transports: {
318
+ * [tempo.id]: http(),
319
+ * },
320
+ * })
321
+ *
322
+ * const result = await Actions.amm.burnSync(config, {
323
+ * userToken: '0x20c0...beef',
324
+ * validatorToken: '0x20c0...babe',
325
+ * liquidity: 50n,
326
+ * to: '0xfeed...fede',
327
+ * })
328
+ * ```
329
+ *
330
+ * @param config - Config.
331
+ * @param parameters - Parameters.
332
+ * @returns The transaction receipt and event data.
333
+ */
334
+ export async function burnSync(config, parameters) {
335
+ const { account, chainId, connector } = parameters;
336
+ const client = await getConnectorClient(config, {
337
+ account,
338
+ assertChainId: false,
339
+ chainId,
340
+ connector,
341
+ });
342
+ return viem_Actions.burnSync(client, parameters);
343
+ }
344
+ /**
345
+ * Watches for rebalance swap events.
346
+ *
347
+ * @example
348
+ * ```ts
349
+ * import { createConfig, http } from '@wagmi/core'
350
+ * import { tempo } from 'tempo.ts/chains'
351
+ * import { Actions } from 'tempo.ts/wagmi'
352
+ *
353
+ * const config = createConfig({
354
+ * chains: [tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })],
355
+ * transports: {
356
+ * [tempo.id]: http(),
357
+ * },
358
+ * })
359
+ *
360
+ * const unwatch = Actions.amm.watchRebalanceSwap(config, {
361
+ * onRebalanceSwap: (args, log) => {
362
+ * console.log('Rebalance swap:', args)
363
+ * },
364
+ * })
365
+ * ```
366
+ *
367
+ * @param config - Config.
368
+ * @param parameters - Parameters.
369
+ * @returns A function to unsubscribe from the event.
370
+ */
371
+ export function watchRebalanceSwap(config, parameters) {
372
+ const { chainId, ...rest } = parameters;
373
+ const client = config.getClient({ chainId });
374
+ return viem_Actions.watchRebalanceSwap(client, rest);
375
+ }
376
+ /**
377
+ * Watches for fee swap events.
378
+ *
379
+ * @example
380
+ * ```ts
381
+ * import { createConfig, http } from '@wagmi/core'
382
+ * import { tempo } from 'tempo.ts/chains'
383
+ * import { Actions } from 'tempo.ts/wagmi'
384
+ *
385
+ * const config = createConfig({
386
+ * chains: [tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })],
387
+ * transports: {
388
+ * [tempo.id]: http(),
389
+ * },
390
+ * })
391
+ *
392
+ * const unwatch = Actions.amm.watchFeeSwap(config, {
393
+ * onFeeSwap: (args, log) => {
394
+ * console.log('Fee swap:', args)
395
+ * },
396
+ * })
397
+ * ```
398
+ *
399
+ * @param config - Config.
400
+ * @param parameters - Parameters.
401
+ * @returns A function to unsubscribe from the event.
402
+ */
403
+ export function watchFeeSwap(config, parameters) {
404
+ const { chainId, ...rest } = parameters;
405
+ const client = config.getClient({ chainId });
406
+ return viem_Actions.watchFeeSwap(client, rest);
407
+ }
408
+ /**
409
+ * Watches for liquidity mint events.
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({ feeToken: '0x20c0000000000000000000000000000000000001' })],
419
+ * transports: {
420
+ * [tempo.id]: http(),
421
+ * },
422
+ * })
423
+ *
424
+ * const unwatch = Actions.amm.watchMint(config, {
425
+ * onMint: (args, log) => {
426
+ * console.log('Liquidity added:', args)
427
+ * },
428
+ * })
429
+ * ```
430
+ *
431
+ * @param config - Config.
432
+ * @param parameters - Parameters.
433
+ * @returns A function to unsubscribe from the event.
434
+ */
435
+ export function watchMint(config, parameters) {
436
+ const { chainId, ...rest } = parameters;
437
+ const client = config.getClient({ chainId });
438
+ return viem_Actions.watchMint(client, rest);
439
+ }
440
+ /**
441
+ * Watches for liquidity burn events.
442
+ *
443
+ * @example
444
+ * ```ts
445
+ * import { createConfig, http } from '@wagmi/core'
446
+ * import { tempo } from 'tempo.ts/chains'
447
+ * import { Actions } from 'tempo.ts/wagmi'
448
+ *
449
+ * const config = createConfig({
450
+ * chains: [tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })],
451
+ * transports: {
452
+ * [tempo.id]: http(),
453
+ * },
454
+ * })
455
+ *
456
+ * const unwatch = Actions.amm.watchBurn(config, {
457
+ * onBurn: (args, log) => {
458
+ * console.log('Liquidity removed:', args)
459
+ * },
460
+ * })
461
+ * ```
462
+ *
463
+ * @param config - Config.
464
+ * @param parameters - Parameters.
465
+ * @returns A function to unsubscribe from the event.
466
+ */
467
+ export function watchBurn(config, parameters) {
468
+ const { chainId, ...rest } = parameters;
469
+ const client = config.getClient({ chainId });
470
+ return viem_Actions.watchBurn(client, rest);
471
+ }
472
+ //# sourceMappingURL=amm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"amm.js","sourceRoot":"","sources":["../../../src/wagmi/Actions/amm.ts"],"names":[],"mappings":"AACA,OAAO,EAAe,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAI7D,OAAO,KAAK,YAAY,MAAM,2BAA2B,CAAA;AAEzD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,UAAU,OAAO,CACrB,MAAc,EACd,UAAsC;IAEtC,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,EAAE,GAAG,UAAU,CAAA;IACvC,MAAM,MAAM,GAAG,MAAM,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,CAAC,CAAA;IAC5C,OAAO,YAAY,CAAC,OAAO,CAAC,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