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,1023 @@
1
+ import { getConnectorClient } from '@wagmi/core';
2
+ import * as viem_Actions from '../../viem/Actions/dex.js';
3
+ /**
4
+ * Buys a specific amount of tokens.
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 hash = await Actions.dex.buy(config, {
20
+ * tokenIn: '0x20c...11',
21
+ * tokenOut: '0x20c...20',
22
+ * amountOut: parseUnits('100', 6),
23
+ * maxAmountIn: parseUnits('105', 6),
24
+ * })
25
+ * ```
26
+ *
27
+ * @param config - Config.
28
+ * @param parameters - Parameters.
29
+ * @returns The transaction hash.
30
+ */
31
+ export async function buy(config, parameters) {
32
+ const { account, chainId, connector } = parameters;
33
+ const client = await getConnectorClient(config, {
34
+ account,
35
+ assertChainId: false,
36
+ chainId,
37
+ connector,
38
+ });
39
+ return viem_Actions.buy(client, parameters);
40
+ }
41
+ /**
42
+ * Buys a specific amount of tokens.
43
+ *
44
+ * Note: This is a synchronous action that waits for the transaction to
45
+ * be included on a block before returning a response.
46
+ *
47
+ * @example
48
+ * ```ts
49
+ * import { createConfig, http } from '@wagmi/core'
50
+ * import { tempo } from 'tempo.ts/chains'
51
+ * import { Actions } from 'tempo.ts/wagmi'
52
+ *
53
+ * const config = createConfig({
54
+ * chains: [tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })],
55
+ * transports: {
56
+ * [tempo.id]: http(),
57
+ * },
58
+ * })
59
+ *
60
+ * const result = await Actions.dex.buySync(config, {
61
+ * tokenIn: '0x20c...11',
62
+ * tokenOut: '0x20c...20',
63
+ * amountOut: parseUnits('100', 6),
64
+ * maxAmountIn: parseUnits('105', 6),
65
+ * })
66
+ * ```
67
+ *
68
+ * @param config - Config.
69
+ * @param parameters - Parameters.
70
+ * @returns The transaction receipt.
71
+ */
72
+ export async function buySync(config, parameters) {
73
+ const { account, chainId, connector } = parameters;
74
+ const client = await getConnectorClient(config, {
75
+ account,
76
+ assertChainId: false,
77
+ chainId,
78
+ connector,
79
+ });
80
+ return viem_Actions.buySync(client, parameters);
81
+ }
82
+ /**
83
+ * Cancels an order from the orderbook.
84
+ *
85
+ * @example
86
+ * ```ts
87
+ * import { createConfig, http } from '@wagmi/core'
88
+ * import { tempo } from 'tempo.ts/chains'
89
+ * import { Actions } from 'tempo.ts/wagmi'
90
+ *
91
+ * const config = createConfig({
92
+ * chains: [tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })],
93
+ * transports: {
94
+ * [tempo.id]: http(),
95
+ * },
96
+ * })
97
+ *
98
+ * const hash = await Actions.dex.cancel(config, {
99
+ * orderId: 123n,
100
+ * })
101
+ * ```
102
+ *
103
+ * @param config - Config.
104
+ * @param parameters - Parameters.
105
+ * @returns The transaction hash.
106
+ */
107
+ export async function cancel(config, parameters) {
108
+ const { account, chainId, connector } = parameters;
109
+ const client = await getConnectorClient(config, {
110
+ account,
111
+ assertChainId: false,
112
+ chainId,
113
+ connector,
114
+ });
115
+ return viem_Actions.cancel(client, parameters);
116
+ }
117
+ /**
118
+ * Cancels an order from the orderbook.
119
+ *
120
+ * Note: This is a synchronous action that waits for the transaction to
121
+ * be included on a block before returning a response.
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({ feeToken: '0x20c0000000000000000000000000000000000001' })],
131
+ * transports: {
132
+ * [tempo.id]: http(),
133
+ * },
134
+ * })
135
+ *
136
+ * const result = await Actions.dex.cancelSync(config, {
137
+ * orderId: 123n,
138
+ * })
139
+ * ```
140
+ *
141
+ * @param config - Config.
142
+ * @param parameters - Parameters.
143
+ * @returns The transaction receipt and event data.
144
+ */
145
+ export async function cancelSync(config, parameters) {
146
+ const { account, chainId, connector } = parameters;
147
+ const client = await getConnectorClient(config, {
148
+ account,
149
+ assertChainId: false,
150
+ chainId,
151
+ connector,
152
+ });
153
+ return viem_Actions.cancelSync(client, parameters);
154
+ }
155
+ /**
156
+ * Creates a new trading pair on the DEX.
157
+ *
158
+ * @example
159
+ * ```ts
160
+ * import { createConfig, http } from '@wagmi/core'
161
+ * import { tempo } from 'tempo.ts/chains'
162
+ * import { Actions } from 'tempo.ts/wagmi'
163
+ *
164
+ * const config = createConfig({
165
+ * chains: [tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })],
166
+ * transports: {
167
+ * [tempo.id]: http(),
168
+ * },
169
+ * })
170
+ *
171
+ * const hash = await Actions.dex.createPair(config, {
172
+ * base: '0x20c...11',
173
+ * })
174
+ * ```
175
+ *
176
+ * @param config - Config.
177
+ * @param parameters - Parameters.
178
+ * @returns The transaction hash.
179
+ */
180
+ export async function createPair(config, parameters) {
181
+ const { account, chainId, connector } = parameters;
182
+ const client = await getConnectorClient(config, {
183
+ account,
184
+ assertChainId: false,
185
+ chainId,
186
+ connector,
187
+ });
188
+ return viem_Actions.createPair(client, parameters);
189
+ }
190
+ /**
191
+ * Creates a new trading pair on the DEX.
192
+ *
193
+ * Note: This is a synchronous action that waits for the transaction to
194
+ * be included on a block before returning a response.
195
+ *
196
+ * @example
197
+ * ```ts
198
+ * import { createConfig, http } from '@wagmi/core'
199
+ * import { tempo } from 'tempo.ts/chains'
200
+ * import { Actions } from 'tempo.ts/wagmi'
201
+ *
202
+ * const config = createConfig({
203
+ * chains: [tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })],
204
+ * transports: {
205
+ * [tempo.id]: http(),
206
+ * },
207
+ * })
208
+ *
209
+ * const result = await Actions.dex.createPairSync(config, {
210
+ * base: '0x20c...11',
211
+ * })
212
+ * ```
213
+ *
214
+ * @param config - Config.
215
+ * @param parameters - Parameters.
216
+ * @returns The transaction receipt and event data.
217
+ */
218
+ export async function createPairSync(config, parameters) {
219
+ const { account, chainId, connector } = parameters;
220
+ const client = await getConnectorClient(config, {
221
+ account,
222
+ assertChainId: false,
223
+ chainId,
224
+ connector,
225
+ });
226
+ return viem_Actions.createPairSync(client, parameters);
227
+ }
228
+ /**
229
+ * Gets a user's token balance on the DEX.
230
+ *
231
+ * @example
232
+ * ```ts
233
+ * import { createConfig, http } from '@wagmi/core'
234
+ * import { tempo } from 'tempo.ts/chains'
235
+ * import { Actions } from 'tempo.ts/wagmi'
236
+ *
237
+ * const config = createConfig({
238
+ * chains: [tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })],
239
+ * transports: {
240
+ * [tempo.id]: http(),
241
+ * },
242
+ * })
243
+ *
244
+ * const balance = await Actions.dex.getBalance(config, {
245
+ * account: '0x...',
246
+ * token: '0x20c...11',
247
+ * })
248
+ * ```
249
+ *
250
+ * @param config - Config.
251
+ * @param parameters - Parameters.
252
+ * @returns The user's token balance on the DEX.
253
+ */
254
+ export function getBalance(config, parameters) {
255
+ const { chainId, ...rest } = parameters;
256
+ const client = config.getClient({ chainId });
257
+ return viem_Actions.getBalance(client, rest);
258
+ }
259
+ (function (getBalance) {
260
+ function queryKey(parameters) {
261
+ return ['getBalance', parameters];
262
+ }
263
+ getBalance.queryKey = queryKey;
264
+ function queryOptions(config, parameters) {
265
+ const { query, ...rest } = parameters;
266
+ return {
267
+ ...query,
268
+ queryKey: queryKey(rest),
269
+ async queryFn({ queryKey }) {
270
+ const [, { account, ...parameters }] = queryKey;
271
+ if (!account)
272
+ throw new Error('account is required.');
273
+ return await getBalance(config, { account, ...parameters });
274
+ },
275
+ };
276
+ }
277
+ getBalance.queryOptions = queryOptions;
278
+ })(getBalance || (getBalance = {}));
279
+ /**
280
+ * Gets the quote for buying a specific amount of tokens.
281
+ *
282
+ * @example
283
+ * ```ts
284
+ * import { createConfig, http } from '@wagmi/core'
285
+ * import { tempo } from 'tempo.ts/chains'
286
+ * import { Actions } from 'tempo.ts/wagmi'
287
+ *
288
+ * const config = createConfig({
289
+ * chains: [tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })],
290
+ * transports: {
291
+ * [tempo.id]: http(),
292
+ * },
293
+ * })
294
+ *
295
+ * const amountIn = await Actions.dex.getBuyQuote(config, {
296
+ * amountOut: parseUnits('100', 6),
297
+ * tokenIn: '0x20c...11',
298
+ * tokenOut: '0x20c...20',
299
+ * })
300
+ * ```
301
+ *
302
+ * @param config - Config.
303
+ * @param parameters - Parameters.
304
+ * @returns The amount of tokenIn needed to buy the specified amountOut.
305
+ */
306
+ export function getBuyQuote(config, parameters) {
307
+ const { chainId, ...rest } = parameters;
308
+ const client = config.getClient({ chainId });
309
+ return viem_Actions.getBuyQuote(client, rest);
310
+ }
311
+ (function (getBuyQuote) {
312
+ function queryKey(parameters) {
313
+ return ['getBuyQuote', parameters];
314
+ }
315
+ getBuyQuote.queryKey = queryKey;
316
+ function queryOptions(config, parameters) {
317
+ const { query, ...rest } = parameters;
318
+ return {
319
+ ...query,
320
+ queryKey: queryKey(rest),
321
+ async queryFn({ queryKey }) {
322
+ const [, parameters] = queryKey;
323
+ return await getBuyQuote(config, parameters);
324
+ },
325
+ };
326
+ }
327
+ getBuyQuote.queryOptions = queryOptions;
328
+ })(getBuyQuote || (getBuyQuote = {}));
329
+ /**
330
+ * Gets an order's details from the orderbook.
331
+ *
332
+ * @example
333
+ * ```ts
334
+ * import { createConfig, http } from '@wagmi/core'
335
+ * import { tempo } from 'tempo.ts/chains'
336
+ * import { Actions } from 'tempo.ts/wagmi'
337
+ *
338
+ * const config = createConfig({
339
+ * chains: [tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })],
340
+ * transports: {
341
+ * [tempo.id]: http(),
342
+ * },
343
+ * })
344
+ *
345
+ * const order = await Actions.dex.getOrder(config, {
346
+ * orderId: 123n,
347
+ * })
348
+ * ```
349
+ *
350
+ * @param config - Config.
351
+ * @param parameters - Parameters.
352
+ * @returns The order details.
353
+ */
354
+ export function getOrder(config, parameters) {
355
+ const { chainId, ...rest } = parameters;
356
+ const client = config.getClient({ chainId });
357
+ return viem_Actions.getOrder(client, rest);
358
+ }
359
+ (function (getOrder) {
360
+ function queryKey(parameters) {
361
+ return ['getOrder', parameters];
362
+ }
363
+ getOrder.queryKey = queryKey;
364
+ function queryOptions(config, parameters) {
365
+ const { query, ...rest } = parameters;
366
+ return {
367
+ ...query,
368
+ queryKey: queryKey(rest),
369
+ async queryFn({ queryKey }) {
370
+ const [, parameters] = queryKey;
371
+ return await getOrder(config, parameters);
372
+ },
373
+ };
374
+ }
375
+ getOrder.queryOptions = queryOptions;
376
+ })(getOrder || (getOrder = {}));
377
+ /**
378
+ * Gets paginated orders from the orderbook.
379
+ *
380
+ * @example
381
+ * ```ts
382
+ * import { createConfig, http } from '@wagmi/core'
383
+ * import { tempo } from 'tempo.ts/chains'
384
+ * import { Actions } from 'tempo.ts/wagmi'
385
+ *
386
+ * const config = createConfig({
387
+ * chains: [tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })],
388
+ * transports: {
389
+ * [tempo.id]: http(),
390
+ * },
391
+ * })
392
+ *
393
+ * const { orders, nextCursor } = await Actions.dex.getOrders(config, {
394
+ * limit: 100,
395
+ * filters: {
396
+ * baseToken: '0x20c0...',
397
+ * isBid: true,
398
+ * }
399
+ * })
400
+ * ```
401
+ *
402
+ * @param config - Config.
403
+ * @param parameters - Parameters.
404
+ * @returns Paginated orders and next cursor.
405
+ */
406
+ export function getOrders(config, parameters = {}) {
407
+ const { chainId, ...rest } = parameters;
408
+ const client = config.getClient({ chainId });
409
+ return viem_Actions.getOrders(client, rest);
410
+ }
411
+ (function (getOrders) {
412
+ function queryKey(parameters) {
413
+ return ['getOrders', parameters];
414
+ }
415
+ getOrders.queryKey = queryKey;
416
+ function infiniteQueryOptions(config, parameters) {
417
+ const { cursor, query, ...rest } = parameters;
418
+ return {
419
+ pages: 1,
420
+ ...query,
421
+ getNextPageParam: (x) => x.nextCursor,
422
+ initialPageParam: cursor ?? undefined,
423
+ queryKey: queryKey(rest),
424
+ async queryFn({ queryKey, pageParam: cursor }) {
425
+ const [, parameters] = queryKey;
426
+ return await getOrders(config, { ...parameters, cursor });
427
+ },
428
+ };
429
+ }
430
+ getOrders.infiniteQueryOptions = infiniteQueryOptions;
431
+ })(getOrders || (getOrders = {}));
432
+ /**
433
+ * Gets orderbook information for a trading pair.
434
+ *
435
+ * @example
436
+ * ```ts
437
+ * import { createConfig, http } from '@wagmi/core'
438
+ * import { tempo } from 'tempo.ts/chains'
439
+ * import { Actions } from 'tempo.ts/wagmi'
440
+ *
441
+ * const config = createConfig({
442
+ * chains: [tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })],
443
+ * transports: {
444
+ * [tempo.id]: http(),
445
+ * },
446
+ * })
447
+ *
448
+ * const book = await Actions.dex.getOrderbook(config, {
449
+ * base: '0x20c...11',
450
+ * quote: '0x20c...20',
451
+ * })
452
+ * ```
453
+ *
454
+ * @param config - Config.
455
+ * @param parameters - Parameters.
456
+ * @returns The orderbook information.
457
+ */
458
+ export function getOrderbook(config, parameters) {
459
+ const { chainId, ...rest } = parameters;
460
+ const client = config.getClient({ chainId });
461
+ return viem_Actions.getOrderbook(client, rest);
462
+ }
463
+ (function (getOrderbook) {
464
+ function queryKey(parameters) {
465
+ return ['getOrderbook', parameters];
466
+ }
467
+ getOrderbook.queryKey = queryKey;
468
+ function queryOptions(config, parameters) {
469
+ const { query, ...rest } = parameters;
470
+ return {
471
+ ...query,
472
+ queryKey: queryKey(rest),
473
+ async queryFn({ queryKey }) {
474
+ const [, parameters] = queryKey;
475
+ return await getOrderbook(config, parameters);
476
+ },
477
+ };
478
+ }
479
+ getOrderbook.queryOptions = queryOptions;
480
+ })(getOrderbook || (getOrderbook = {}));
481
+ /**
482
+ * Gets the price level information at a specific tick.
483
+ *
484
+ * @example
485
+ * ```ts
486
+ * import { createConfig, http } from '@wagmi/core'
487
+ * import { tempo } from 'tempo.ts/chains'
488
+ * import { Actions, Tick } from 'tempo.ts/wagmi'
489
+ *
490
+ * const config = createConfig({
491
+ * chains: [tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })],
492
+ * transports: {
493
+ * [tempo.id]: http(),
494
+ * },
495
+ * })
496
+ *
497
+ * const level = await Actions.dex.getPriceLevel(config, {
498
+ * base: '0x20c...11',
499
+ * tick: Tick.fromPrice('1.001'),
500
+ * isBid: true,
501
+ * })
502
+ * ```
503
+ *
504
+ * @param config - Config.
505
+ * @param parameters - Parameters.
506
+ * @returns The price level information.
507
+ */
508
+ export function getPriceLevel(config, parameters) {
509
+ const { chainId, ...rest } = parameters;
510
+ const client = config.getClient({ chainId });
511
+ return viem_Actions.getPriceLevel(client, rest);
512
+ }
513
+ (function (getPriceLevel) {
514
+ function queryKey(parameters) {
515
+ return ['getPriceLevel', parameters];
516
+ }
517
+ getPriceLevel.queryKey = queryKey;
518
+ function queryOptions(config, parameters) {
519
+ const { query, ...rest } = parameters;
520
+ return {
521
+ ...query,
522
+ queryKey: queryKey(rest),
523
+ async queryFn({ queryKey }) {
524
+ const [, parameters] = queryKey;
525
+ return await getPriceLevel(config, parameters);
526
+ },
527
+ };
528
+ }
529
+ getPriceLevel.queryOptions = queryOptions;
530
+ })(getPriceLevel || (getPriceLevel = {}));
531
+ /**
532
+ * Gets the quote for selling a specific amount of tokens.
533
+ *
534
+ * @example
535
+ * ```ts
536
+ * import { createConfig, http } from '@wagmi/core'
537
+ * import { tempo } from 'tempo.ts/chains'
538
+ * import { Actions } from 'tempo.ts/wagmi'
539
+ *
540
+ * const config = createConfig({
541
+ * chains: [tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })],
542
+ * transports: {
543
+ * [tempo.id]: http(),
544
+ * },
545
+ * })
546
+ *
547
+ * const amountOut = await Actions.dex.getSellQuote(config, {
548
+ * amountIn: parseUnits('100', 6),
549
+ * tokenIn: '0x20c...11',
550
+ * tokenOut: '0x20c...20',
551
+ * })
552
+ * ```
553
+ *
554
+ * @param config - Config.
555
+ * @param parameters - Parameters.
556
+ * @returns The amount of tokenOut received for selling the specified amountIn.
557
+ */
558
+ export function getSellQuote(config, parameters) {
559
+ const { chainId, ...rest } = parameters;
560
+ const client = config.getClient({ chainId });
561
+ return viem_Actions.getSellQuote(client, rest);
562
+ }
563
+ (function (getSellQuote) {
564
+ function queryKey(parameters) {
565
+ return ['getSellQuote', parameters];
566
+ }
567
+ getSellQuote.queryKey = queryKey;
568
+ function queryOptions(config, parameters) {
569
+ const { query, ...rest } = parameters;
570
+ return {
571
+ ...query,
572
+ queryKey: queryKey(rest),
573
+ async queryFn({ queryKey }) {
574
+ const [, parameters] = queryKey;
575
+ return await getSellQuote(config, parameters);
576
+ },
577
+ };
578
+ }
579
+ getSellQuote.queryOptions = queryOptions;
580
+ })(getSellQuote || (getSellQuote = {}));
581
+ /**
582
+ * Places a limit order on the orderbook.
583
+ *
584
+ * @example
585
+ * ```ts
586
+ * import { createConfig, http } from '@wagmi/core'
587
+ * import { tempo } from 'tempo.ts/chains'
588
+ * import { Actions } from 'tempo.ts/wagmi'
589
+ *
590
+ * const config = createConfig({
591
+ * chains: [tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })],
592
+ * transports: {
593
+ * [tempo.id]: http(),
594
+ * },
595
+ * })
596
+ *
597
+ * const hash = await Actions.dex.place(config, {
598
+ * amount: parseUnits('100', 6),
599
+ * tick: Tick.fromPrice('0.99'),
600
+ * token: '0x20c...11',
601
+ * type: 'buy',
602
+ * })
603
+ * ```
604
+ *
605
+ * @param config - Config.
606
+ * @param parameters - Parameters.
607
+ * @returns The transaction hash.
608
+ */
609
+ export async function place(config, parameters) {
610
+ const { account, chainId, connector } = parameters;
611
+ const client = await getConnectorClient(config, {
612
+ account,
613
+ assertChainId: false,
614
+ chainId,
615
+ connector,
616
+ });
617
+ return viem_Actions.place(client, parameters);
618
+ }
619
+ /**
620
+ * Places a flip order that automatically flips when filled.
621
+ *
622
+ * @example
623
+ * ```ts
624
+ * import { createConfig, http } from '@wagmi/core'
625
+ * import { tempo } from 'tempo.ts/chains'
626
+ * import { Actions } from 'tempo.ts/wagmi'
627
+ *
628
+ * const config = createConfig({
629
+ * chains: [tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })],
630
+ * transports: {
631
+ * [tempo.id]: http(),
632
+ * },
633
+ * })
634
+ *
635
+ * const hash = await Actions.dex.placeFlip(config, {
636
+ * amount: parseUnits('100', 6),
637
+ * flipTick: Tick.fromPrice('1.01'),
638
+ * tick: Tick.fromPrice('0.99'),
639
+ * token: '0x20c...11',
640
+ * type: 'buy',
641
+ * })
642
+ * ```
643
+ *
644
+ * @param config - Config.
645
+ * @param parameters - Parameters.
646
+ * @returns The transaction hash.
647
+ */
648
+ export async function placeFlip(config, parameters) {
649
+ const { account, chainId, connector } = parameters;
650
+ const client = await getConnectorClient(config, {
651
+ account,
652
+ assertChainId: false,
653
+ chainId,
654
+ connector,
655
+ });
656
+ return viem_Actions.placeFlip(client, parameters);
657
+ }
658
+ /**
659
+ * Places a flip order that automatically flips when filled.
660
+ *
661
+ * Note: This is a synchronous action that waits for the transaction to
662
+ * be included on a block before returning a response.
663
+ *
664
+ * @example
665
+ * ```ts
666
+ * import { createConfig, http } from '@wagmi/core'
667
+ * import { tempo } from 'tempo.ts/chains'
668
+ * import { Actions } from 'tempo.ts/wagmi'
669
+ *
670
+ * const config = createConfig({
671
+ * chains: [tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })],
672
+ * transports: {
673
+ * [tempo.id]: http(),
674
+ * },
675
+ * })
676
+ *
677
+ * const result = await Actions.dex.placeFlipSync(config, {
678
+ * amount: parseUnits('100', 6),
679
+ * flipTick: Tick.fromPrice('1.01'),
680
+ * tick: Tick.fromPrice('0.99'),
681
+ * token: '0x20c...11',
682
+ * type: 'buy',
683
+ * })
684
+ * ```
685
+ *
686
+ * @param config - Config.
687
+ * @param parameters - Parameters.
688
+ * @returns The transaction receipt and event data.
689
+ */
690
+ export async function placeFlipSync(config, parameters) {
691
+ const { account, chainId, connector } = parameters;
692
+ const client = await getConnectorClient(config, {
693
+ account,
694
+ assertChainId: false,
695
+ chainId,
696
+ connector,
697
+ });
698
+ return viem_Actions.placeFlipSync(client, parameters);
699
+ }
700
+ /**
701
+ * Places a limit order on the orderbook.
702
+ *
703
+ * Note: This is a synchronous action that waits for the transaction to
704
+ * be included on a block before returning a response.
705
+ *
706
+ * @example
707
+ * ```ts
708
+ * import { createConfig, http } from '@wagmi/core'
709
+ * import { tempo } from 'tempo.ts/chains'
710
+ * import { Actions } from 'tempo.ts/wagmi'
711
+ *
712
+ * const config = createConfig({
713
+ * chains: [tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })],
714
+ * transports: {
715
+ * [tempo.id]: http(),
716
+ * },
717
+ * })
718
+ *
719
+ * const result = await Actions.dex.placeSync(config, {
720
+ * amount: parseUnits('100', 6),
721
+ * tick: Tick.fromPrice('0.99'),
722
+ * token: '0x20c...11',
723
+ * type: 'buy',
724
+ * })
725
+ * ```
726
+ *
727
+ * @param config - Config.
728
+ * @param parameters - Parameters.
729
+ * @returns The transaction receipt and event data.
730
+ */
731
+ export async function placeSync(config, parameters) {
732
+ const { account, chainId, connector } = parameters;
733
+ const client = await getConnectorClient(config, {
734
+ account,
735
+ assertChainId: false,
736
+ chainId,
737
+ connector,
738
+ });
739
+ return viem_Actions.placeSync(client, parameters);
740
+ }
741
+ /**
742
+ * Sells a specific amount of tokens.
743
+ *
744
+ * @example
745
+ * ```ts
746
+ * import { createConfig, http } from '@wagmi/core'
747
+ * import { tempo } from 'tempo.ts/chains'
748
+ * import { Actions } from 'tempo.ts/wagmi'
749
+ *
750
+ * const config = createConfig({
751
+ * chains: [tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })],
752
+ * transports: {
753
+ * [tempo.id]: http(),
754
+ * },
755
+ * })
756
+ *
757
+ * const hash = await Actions.dex.sell(config, {
758
+ * amountIn: parseUnits('100', 6),
759
+ * minAmountOut: parseUnits('95', 6),
760
+ * tokenIn: '0x20c...11',
761
+ * tokenOut: '0x20c...20',
762
+ * })
763
+ * ```
764
+ *
765
+ * @param config - Config.
766
+ * @param parameters - Parameters.
767
+ * @returns The transaction hash.
768
+ */
769
+ export async function sell(config, parameters) {
770
+ const { account, chainId, connector } = parameters;
771
+ const client = await getConnectorClient(config, {
772
+ account,
773
+ assertChainId: false,
774
+ chainId,
775
+ connector,
776
+ });
777
+ return viem_Actions.sell(client, parameters);
778
+ }
779
+ /**
780
+ * Sells a specific amount of tokens.
781
+ *
782
+ * Note: This is a synchronous action that waits for the transaction to
783
+ * be included on a block before returning a response.
784
+ *
785
+ * @example
786
+ * ```ts
787
+ * import { createConfig, http } from '@wagmi/core'
788
+ * import { tempo } from 'tempo.ts/chains'
789
+ * import { Actions } from 'tempo.ts/wagmi'
790
+ *
791
+ * const config = createConfig({
792
+ * chains: [tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })],
793
+ * transports: {
794
+ * [tempo.id]: http(),
795
+ * },
796
+ * })
797
+ *
798
+ * const result = await Actions.dex.sellSync(config, {
799
+ * amountIn: parseUnits('100', 6),
800
+ * minAmountOut: parseUnits('95', 6),
801
+ * tokenIn: '0x20c...11',
802
+ * tokenOut: '0x20c...20',
803
+ * })
804
+ * ```
805
+ *
806
+ * @param config - Config.
807
+ * @param parameters - Parameters.
808
+ * @returns The transaction receipt.
809
+ */
810
+ export async function sellSync(config, parameters) {
811
+ const { account, chainId, connector } = parameters;
812
+ const client = await getConnectorClient(config, {
813
+ account,
814
+ assertChainId: false,
815
+ chainId,
816
+ connector,
817
+ });
818
+ return viem_Actions.sellSync(client, parameters);
819
+ }
820
+ /**
821
+ * Watches for flip order placement events on the DEX.
822
+ *
823
+ * @example
824
+ * ```ts
825
+ * import { createConfig, http } from '@wagmi/core'
826
+ * import { tempo } from 'tempo.ts/chains'
827
+ * import { Actions } from 'tempo.ts/wagmi'
828
+ *
829
+ * const config = createConfig({
830
+ * chains: [tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })],
831
+ * transports: {
832
+ * [tempo.id]: http(),
833
+ * },
834
+ * })
835
+ *
836
+ * const unwatch = Actions.dex.watchFlipOrderPlaced(config, {
837
+ * onFlipOrderPlaced: (args, log) => {
838
+ * console.log('Flip order placed:', args)
839
+ * },
840
+ * })
841
+ * ```
842
+ *
843
+ * @param config - Config.
844
+ * @param parameters - Parameters.
845
+ * @returns A function to unsubscribe from the event.
846
+ */
847
+ export function watchFlipOrderPlaced(config, parameters) {
848
+ const { chainId, ...rest } = parameters;
849
+ const client = config.getClient({ chainId });
850
+ return viem_Actions.watchFlipOrderPlaced(client, rest);
851
+ }
852
+ /**
853
+ * Watches for order cancellation events on the DEX.
854
+ *
855
+ * @example
856
+ * ```ts
857
+ * import { createConfig, http } from '@wagmi/core'
858
+ * import { tempo } from 'tempo.ts/chains'
859
+ * import { Actions } from 'tempo.ts/wagmi'
860
+ *
861
+ * const config = createConfig({
862
+ * chains: [tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })],
863
+ * transports: {
864
+ * [tempo.id]: http(),
865
+ * },
866
+ * })
867
+ *
868
+ * const unwatch = Actions.dex.watchOrderCancelled(config, {
869
+ * onOrderCancelled: (args, log) => {
870
+ * console.log('Order cancelled:', args)
871
+ * },
872
+ * })
873
+ * ```
874
+ *
875
+ * @param config - Config.
876
+ * @param parameters - Parameters.
877
+ * @returns A function to unsubscribe from the event.
878
+ */
879
+ export function watchOrderCancelled(config, parameters) {
880
+ const { chainId, ...rest } = parameters;
881
+ const client = config.getClient({ chainId });
882
+ return viem_Actions.watchOrderCancelled(client, rest);
883
+ }
884
+ /**
885
+ * Watches for order filled events on the DEX.
886
+ *
887
+ * @example
888
+ * ```ts
889
+ * import { createConfig, http } from '@wagmi/core'
890
+ * import { tempo } from 'tempo.ts/chains'
891
+ * import { Actions } from 'tempo.ts/wagmi'
892
+ *
893
+ * const config = createConfig({
894
+ * chains: [tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })],
895
+ * transports: {
896
+ * [tempo.id]: http(),
897
+ * },
898
+ * })
899
+ *
900
+ * const unwatch = Actions.dex.watchOrderFilled(config, {
901
+ * onOrderFilled: (args, log) => {
902
+ * console.log('Order filled:', args)
903
+ * },
904
+ * })
905
+ * ```
906
+ *
907
+ * @param config - Config.
908
+ * @param parameters - Parameters.
909
+ * @returns A function to unsubscribe from the event.
910
+ */
911
+ export function watchOrderFilled(config, parameters) {
912
+ const { chainId, ...rest } = parameters;
913
+ const client = config.getClient({ chainId });
914
+ return viem_Actions.watchOrderFilled(client, rest);
915
+ }
916
+ /**
917
+ * Watches for order placement events on the DEX.
918
+ *
919
+ * @example
920
+ * ```ts
921
+ * import { createConfig, http } from '@wagmi/core'
922
+ * import { tempo } from 'tempo.ts/chains'
923
+ * import { Actions } from 'tempo.ts/wagmi'
924
+ *
925
+ * const config = createConfig({
926
+ * chains: [tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })],
927
+ * transports: {
928
+ * [tempo.id]: http(),
929
+ * },
930
+ * })
931
+ *
932
+ * const unwatch = Actions.dex.watchOrderPlaced(config, {
933
+ * onOrderPlaced: (args, log) => {
934
+ * console.log('Order placed:', args)
935
+ * },
936
+ * })
937
+ * ```
938
+ *
939
+ * @param config - Config.
940
+ * @param parameters - Parameters.
941
+ * @returns A function to unsubscribe from the event.
942
+ */
943
+ export function watchOrderPlaced(config, parameters) {
944
+ const { chainId, ...rest } = parameters;
945
+ const client = config.getClient({ chainId });
946
+ return viem_Actions.watchOrderPlaced(client, rest);
947
+ }
948
+ /**
949
+ * Withdraws tokens from the DEX to the caller's wallet.
950
+ *
951
+ * @example
952
+ * ```ts
953
+ * import { createConfig, http } from '@wagmi/core'
954
+ * import { tempo } from 'tempo.ts/chains'
955
+ * import { Actions } from 'tempo.ts/wagmi'
956
+ *
957
+ * const config = createConfig({
958
+ * chains: [tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })],
959
+ * transports: {
960
+ * [tempo.id]: http(),
961
+ * },
962
+ * })
963
+ *
964
+ * const hash = await Actions.dex.withdraw(config, {
965
+ * amount: 100n,
966
+ * token: '0x20c...11',
967
+ * })
968
+ * ```
969
+ *
970
+ * @param config - Config.
971
+ * @param parameters - Parameters.
972
+ * @returns The transaction hash.
973
+ */
974
+ export async function withdraw(config, parameters) {
975
+ const { account, chainId, connector } = parameters;
976
+ const client = await getConnectorClient(config, {
977
+ account,
978
+ assertChainId: false,
979
+ chainId,
980
+ connector,
981
+ });
982
+ return viem_Actions.withdraw(client, parameters);
983
+ }
984
+ /**
985
+ * Withdraws tokens from the DEX to the caller's wallet.
986
+ *
987
+ * Note: This is a synchronous action that waits for the transaction to
988
+ * be included on a block before returning a response.
989
+ *
990
+ * @example
991
+ * ```ts
992
+ * import { createConfig, http } from '@wagmi/core'
993
+ * import { tempo } from 'tempo.ts/chains'
994
+ * import { Actions } from 'tempo.ts/wagmi'
995
+ *
996
+ * const config = createConfig({
997
+ * chains: [tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })],
998
+ * transports: {
999
+ * [tempo.id]: http(),
1000
+ * },
1001
+ * })
1002
+ *
1003
+ * const result = await Actions.dex.withdrawSync(config, {
1004
+ * amount: 100n,
1005
+ * token: '0x20c...11',
1006
+ * })
1007
+ * ```
1008
+ *
1009
+ * @param config - Config.
1010
+ * @param parameters - Parameters.
1011
+ * @returns The transaction receipt and event data.
1012
+ */
1013
+ export async function withdrawSync(config, parameters) {
1014
+ const { account, chainId, connector } = parameters;
1015
+ const client = await getConnectorClient(config, {
1016
+ account,
1017
+ assertChainId: false,
1018
+ chainId,
1019
+ connector,
1020
+ });
1021
+ return viem_Actions.withdrawSync(client, parameters);
1022
+ }
1023
+ //# sourceMappingURL=dex.js.map