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,1640 @@
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 * as Hex from 'ox/Hex'
5
+ import type { Account } from 'viem'
6
+ import type {
7
+ PartialBy,
8
+ RequiredBy,
9
+ UnionRequiredBy,
10
+ } from '../../internal/types.js'
11
+ import * as viem_Actions from '../../viem/Actions/dex.js'
12
+
13
+ /**
14
+ * Buys a specific amount of tokens.
15
+ *
16
+ * @example
17
+ * ```ts
18
+ * import { createConfig, http } from '@wagmi/core'
19
+ * import { tempo } from 'tempo.ts/chains'
20
+ * import { Actions } from 'tempo.ts/wagmi'
21
+ *
22
+ * const config = createConfig({
23
+ * chains: [tempo],
24
+ * transports: {
25
+ * [tempo.id]: http(),
26
+ * },
27
+ * })
28
+ *
29
+ * const hash = await Actions.dex.buy(config, {
30
+ * tokenIn: '0x20c...11',
31
+ * tokenOut: '0x20c...20',
32
+ * amountOut: parseUnits('100', 6),
33
+ * maxAmountIn: parseUnits('105', 6),
34
+ * })
35
+ * ```
36
+ *
37
+ * @param config - Config.
38
+ * @param parameters - Parameters.
39
+ * @returns The transaction hash.
40
+ */
41
+ export async function buy<config extends Config>(
42
+ config: config,
43
+ parameters: buy.Parameters<config>,
44
+ ): Promise<viem_Actions.buy.ReturnValue> {
45
+ const { account, chainId, connector } = parameters
46
+
47
+ const client = await getConnectorClient(config, {
48
+ account,
49
+ assertChainId: false,
50
+ chainId,
51
+ connector,
52
+ })
53
+
54
+ return viem_Actions.buy(client, parameters as viem_Actions.buy.Parameters)
55
+ }
56
+
57
+ export declare namespace buy {
58
+ export type Parameters<config extends Config> = ChainIdParameter<config> &
59
+ ConnectorParameter &
60
+ Omit<viem_Actions.buy.Parameters<undefined, Account>, 'chain'>
61
+
62
+ export type ReturnValue = viem_Actions.buy.ReturnValue
63
+
64
+ export type ErrorType = viem_Actions.buy.ErrorType
65
+ }
66
+
67
+ /**
68
+ * Buys a specific amount of tokens.
69
+ *
70
+ * Note: This is a synchronous action that waits for the transaction to
71
+ * be included on a block before returning a response.
72
+ *
73
+ * @example
74
+ * ```ts
75
+ * import { createConfig, http } from '@wagmi/core'
76
+ * import { tempo } from 'tempo.ts/chains'
77
+ * import { Actions } from 'tempo.ts/wagmi'
78
+ *
79
+ * const config = createConfig({
80
+ * chains: [tempo],
81
+ * transports: {
82
+ * [tempo.id]: http(),
83
+ * },
84
+ * })
85
+ *
86
+ * const result = await Actions.dex.buySync(config, {
87
+ * tokenIn: '0x20c...11',
88
+ * tokenOut: '0x20c...20',
89
+ * amountOut: parseUnits('100', 6),
90
+ * maxAmountIn: parseUnits('105', 6),
91
+ * })
92
+ * ```
93
+ *
94
+ * @param config - Config.
95
+ * @param parameters - Parameters.
96
+ * @returns The transaction receipt.
97
+ */
98
+ export async function buySync<config extends Config>(
99
+ config: config,
100
+ parameters: buySync.Parameters<config>,
101
+ ): Promise<viem_Actions.buySync.ReturnValue> {
102
+ const { account, chainId, connector } = parameters
103
+
104
+ const client = await getConnectorClient(config, {
105
+ account,
106
+ assertChainId: false,
107
+ chainId,
108
+ connector,
109
+ })
110
+
111
+ return viem_Actions.buySync(
112
+ client,
113
+ parameters as viem_Actions.buySync.Parameters,
114
+ )
115
+ }
116
+
117
+ export declare namespace buySync {
118
+ export type Parameters<config extends Config> = ChainIdParameter<config> &
119
+ ConnectorParameter &
120
+ Omit<viem_Actions.buySync.Parameters<undefined, Account>, 'chain'>
121
+
122
+ export type ReturnValue = viem_Actions.buySync.ReturnValue
123
+
124
+ export type ErrorType = viem_Actions.buySync.ErrorType
125
+ }
126
+
127
+ /**
128
+ * Cancels an order from the orderbook.
129
+ *
130
+ * @example
131
+ * ```ts
132
+ * import { createConfig, http } from '@wagmi/core'
133
+ * import { tempo } from 'tempo.ts/chains'
134
+ * import { Actions } from 'tempo.ts/wagmi'
135
+ *
136
+ * const config = createConfig({
137
+ * chains: [tempo],
138
+ * transports: {
139
+ * [tempo.id]: http(),
140
+ * },
141
+ * })
142
+ *
143
+ * const hash = await Actions.dex.cancel(config, {
144
+ * orderId: 123n,
145
+ * })
146
+ * ```
147
+ *
148
+ * @param config - Config.
149
+ * @param parameters - Parameters.
150
+ * @returns The transaction hash.
151
+ */
152
+ export async function cancel<config extends Config>(
153
+ config: config,
154
+ parameters: cancel.Parameters<config>,
155
+ ): Promise<viem_Actions.cancel.ReturnValue> {
156
+ const { account, chainId, connector } = parameters
157
+
158
+ const client = await getConnectorClient(config, {
159
+ account,
160
+ assertChainId: false,
161
+ chainId,
162
+ connector,
163
+ })
164
+
165
+ return viem_Actions.cancel(
166
+ client,
167
+ parameters as viem_Actions.cancel.Parameters,
168
+ )
169
+ }
170
+
171
+ export declare namespace cancel {
172
+ export type Parameters<config extends Config> = ChainIdParameter<config> &
173
+ ConnectorParameter &
174
+ Omit<viem_Actions.cancel.Parameters<undefined, Account>, 'chain'>
175
+
176
+ export type ReturnValue = viem_Actions.cancel.ReturnValue
177
+
178
+ export type ErrorType = viem_Actions.cancel.ErrorType
179
+ }
180
+
181
+ /**
182
+ * Cancels an order from the orderbook.
183
+ *
184
+ * Note: This is a synchronous action that waits for the transaction to
185
+ * be included on a block before returning a response.
186
+ *
187
+ * @example
188
+ * ```ts
189
+ * import { createConfig, http } from '@wagmi/core'
190
+ * import { tempo } from 'tempo.ts/chains'
191
+ * import { Actions } from 'tempo.ts/wagmi'
192
+ *
193
+ * const config = createConfig({
194
+ * chains: [tempo],
195
+ * transports: {
196
+ * [tempo.id]: http(),
197
+ * },
198
+ * })
199
+ *
200
+ * const result = await Actions.dex.cancelSync(config, {
201
+ * orderId: 123n,
202
+ * })
203
+ * ```
204
+ *
205
+ * @param config - Config.
206
+ * @param parameters - Parameters.
207
+ * @returns The transaction receipt and event data.
208
+ */
209
+ export async function cancelSync<config extends Config>(
210
+ config: config,
211
+ parameters: cancelSync.Parameters<config>,
212
+ ): Promise<viem_Actions.cancelSync.ReturnValue> {
213
+ const { account, chainId, connector } = parameters
214
+
215
+ const client = await getConnectorClient(config, {
216
+ account,
217
+ assertChainId: false,
218
+ chainId,
219
+ connector,
220
+ })
221
+
222
+ return viem_Actions.cancelSync(
223
+ client,
224
+ parameters as viem_Actions.cancelSync.Parameters,
225
+ )
226
+ }
227
+
228
+ export declare namespace cancelSync {
229
+ export type Parameters<config extends Config> = ChainIdParameter<config> &
230
+ ConnectorParameter &
231
+ Omit<viem_Actions.cancelSync.Parameters<undefined, Account>, 'chain'>
232
+
233
+ export type ReturnValue = viem_Actions.cancelSync.ReturnValue
234
+
235
+ export type ErrorType = viem_Actions.cancelSync.ErrorType
236
+ }
237
+
238
+ /**
239
+ * Creates a new trading pair on the DEX.
240
+ *
241
+ * @example
242
+ * ```ts
243
+ * import { createConfig, http } from '@wagmi/core'
244
+ * import { tempo } from 'tempo.ts/chains'
245
+ * import { Actions } from 'tempo.ts/wagmi'
246
+ *
247
+ * const config = createConfig({
248
+ * chains: [tempo],
249
+ * transports: {
250
+ * [tempo.id]: http(),
251
+ * },
252
+ * })
253
+ *
254
+ * const hash = await Actions.dex.createPair(config, {
255
+ * base: '0x20c...11',
256
+ * })
257
+ * ```
258
+ *
259
+ * @param config - Config.
260
+ * @param parameters - Parameters.
261
+ * @returns The transaction hash.
262
+ */
263
+ export async function createPair<config extends Config>(
264
+ config: config,
265
+ parameters: createPair.Parameters<config>,
266
+ ): Promise<viem_Actions.createPair.ReturnValue> {
267
+ const { account, chainId, connector } = parameters
268
+
269
+ const client = await getConnectorClient(config, {
270
+ account,
271
+ assertChainId: false,
272
+ chainId,
273
+ connector,
274
+ })
275
+
276
+ return viem_Actions.createPair(
277
+ client,
278
+ parameters as viem_Actions.createPair.Parameters,
279
+ )
280
+ }
281
+
282
+ export declare namespace createPair {
283
+ export type Parameters<config extends Config> = ChainIdParameter<config> &
284
+ ConnectorParameter &
285
+ Omit<viem_Actions.createPair.Parameters<undefined, Account>, 'chain'>
286
+
287
+ export type ReturnValue = viem_Actions.createPair.ReturnValue
288
+
289
+ export type ErrorType = viem_Actions.createPair.ErrorType
290
+ }
291
+
292
+ /**
293
+ * Creates a new trading pair on the DEX.
294
+ *
295
+ * Note: This is a synchronous action that waits for the transaction to
296
+ * be included on a block before returning a response.
297
+ *
298
+ * @example
299
+ * ```ts
300
+ * import { createConfig, http } from '@wagmi/core'
301
+ * import { tempo } from 'tempo.ts/chains'
302
+ * import { Actions } from 'tempo.ts/wagmi'
303
+ *
304
+ * const config = createConfig({
305
+ * chains: [tempo],
306
+ * transports: {
307
+ * [tempo.id]: http(),
308
+ * },
309
+ * })
310
+ *
311
+ * const result = await Actions.dex.createPairSync(config, {
312
+ * base: '0x20c...11',
313
+ * })
314
+ * ```
315
+ *
316
+ * @param config - Config.
317
+ * @param parameters - Parameters.
318
+ * @returns The transaction receipt and event data.
319
+ */
320
+ export async function createPairSync<config extends Config>(
321
+ config: config,
322
+ parameters: createPairSync.Parameters<config>,
323
+ ): Promise<viem_Actions.createPairSync.ReturnValue> {
324
+ const { account, chainId, connector } = parameters
325
+
326
+ const client = await getConnectorClient(config, {
327
+ account,
328
+ assertChainId: false,
329
+ chainId,
330
+ connector,
331
+ })
332
+
333
+ return viem_Actions.createPairSync(
334
+ client,
335
+ parameters as viem_Actions.createPairSync.Parameters,
336
+ )
337
+ }
338
+
339
+ export declare namespace createPairSync {
340
+ export type Parameters<config extends Config> = ChainIdParameter<config> &
341
+ ConnectorParameter &
342
+ Omit<viem_Actions.createPairSync.Parameters<undefined, Account>, 'chain'>
343
+
344
+ export type ReturnValue = viem_Actions.createPairSync.ReturnValue
345
+
346
+ export type ErrorType = viem_Actions.createPairSync.ErrorType
347
+ }
348
+
349
+ /**
350
+ * Gets a user's token balance on the DEX.
351
+ *
352
+ * @example
353
+ * ```ts
354
+ * import { createConfig, http } from '@wagmi/core'
355
+ * import { tempo } from 'tempo.ts/chains'
356
+ * import { Actions } from 'tempo.ts/wagmi'
357
+ *
358
+ * const config = createConfig({
359
+ * chains: [tempo],
360
+ * transports: {
361
+ * [tempo.id]: http(),
362
+ * },
363
+ * })
364
+ *
365
+ * const balance = await Actions.dex.getBalance(config, {
366
+ * account: '0x...',
367
+ * token: '0x20c...11',
368
+ * })
369
+ * ```
370
+ *
371
+ * @param config - Config.
372
+ * @param parameters - Parameters.
373
+ * @returns The user's token balance on the DEX.
374
+ */
375
+ export function getBalance<config extends Config>(
376
+ config: config,
377
+ parameters: getBalance.Parameters<config>,
378
+ ): Promise<getBalance.ReturnValue> {
379
+ const { chainId, ...rest } = parameters
380
+ const client = config.getClient({ chainId })
381
+ return viem_Actions.getBalance(client, rest)
382
+ }
383
+
384
+ export namespace getBalance {
385
+ export type Parameters<config extends Config> = ChainIdParameter<config> &
386
+ viem_Actions.getBalance.Parameters
387
+
388
+ export type ReturnValue = viem_Actions.getBalance.ReturnValue
389
+
390
+ export function queryKey<config extends Config>(
391
+ parameters: PartialBy<Parameters<config>, 'account'>,
392
+ ) {
393
+ return ['getBalance', parameters] as const
394
+ }
395
+
396
+ export type QueryKey<config extends Config> = ReturnType<
397
+ typeof queryKey<config>
398
+ >
399
+
400
+ export function queryOptions<config extends Config, selectData = ReturnValue>(
401
+ config: Config,
402
+ parameters: queryOptions.Parameters<config, selectData>,
403
+ ): queryOptions.ReturnValue<config, selectData> {
404
+ const { query, ...rest } = parameters
405
+ return {
406
+ ...query,
407
+ queryKey: queryKey(rest),
408
+ async queryFn({ queryKey }) {
409
+ const [, { account, ...parameters }] = queryKey
410
+ if (!account) throw new Error('account is required.')
411
+ return await getBalance(config, { account, ...parameters })
412
+ },
413
+ }
414
+ }
415
+
416
+ export declare namespace queryOptions {
417
+ export type Parameters<
418
+ config extends Config,
419
+ selectData = getBalance.ReturnValue,
420
+ > = PartialBy<getBalance.Parameters<config>, 'account'> & {
421
+ query?:
422
+ | Omit<ReturnValue<config, selectData>, 'queryKey' | 'queryFn'>
423
+ | undefined
424
+ }
425
+
426
+ export type ReturnValue<
427
+ config extends Config,
428
+ selectData = getBalance.ReturnValue,
429
+ > = RequiredBy<
430
+ Query.QueryOptions<
431
+ getBalance.ReturnValue,
432
+ Query.DefaultError,
433
+ selectData,
434
+ getBalance.QueryKey<config>
435
+ >,
436
+ 'queryKey' | 'queryFn'
437
+ >
438
+ }
439
+ }
440
+
441
+ /**
442
+ * Gets the quote for buying a specific amount of tokens.
443
+ *
444
+ * @example
445
+ * ```ts
446
+ * import { createConfig, http } from '@wagmi/core'
447
+ * import { tempo } from 'tempo.ts/chains'
448
+ * import { Actions } from 'tempo.ts/wagmi'
449
+ *
450
+ * const config = createConfig({
451
+ * chains: [tempo],
452
+ * transports: {
453
+ * [tempo.id]: http(),
454
+ * },
455
+ * })
456
+ *
457
+ * const amountIn = await Actions.dex.getBuyQuote(config, {
458
+ * amountOut: parseUnits('100', 6),
459
+ * tokenIn: '0x20c...11',
460
+ * tokenOut: '0x20c...20',
461
+ * })
462
+ * ```
463
+ *
464
+ * @param config - Config.
465
+ * @param parameters - Parameters.
466
+ * @returns The amount of tokenIn needed to buy the specified amountOut.
467
+ */
468
+ export function getBuyQuote<config extends Config>(
469
+ config: config,
470
+ parameters: getBuyQuote.Parameters<config>,
471
+ ): Promise<getBuyQuote.ReturnValue> {
472
+ const { chainId, ...rest } = parameters
473
+ const client = config.getClient({ chainId })
474
+ return viem_Actions.getBuyQuote(client, rest)
475
+ }
476
+
477
+ export namespace getBuyQuote {
478
+ export type Parameters<config extends Config> = ChainIdParameter<config> &
479
+ viem_Actions.getBuyQuote.Parameters
480
+
481
+ export type ReturnValue = viem_Actions.getBuyQuote.ReturnValue
482
+
483
+ export function queryKey<config extends Config>(
484
+ parameters: Parameters<config>,
485
+ ) {
486
+ return ['getBuyQuote', parameters] as const
487
+ }
488
+
489
+ export type QueryKey<config extends Config> = ReturnType<
490
+ typeof queryKey<config>
491
+ >
492
+
493
+ export function queryOptions<config extends Config, selectData = ReturnValue>(
494
+ config: Config,
495
+ parameters: queryOptions.Parameters<config, selectData>,
496
+ ): queryOptions.ReturnValue<config, selectData> {
497
+ const { query, ...rest } = parameters
498
+ return {
499
+ ...query,
500
+ queryKey: queryKey(rest),
501
+ async queryFn({ queryKey }) {
502
+ const [, parameters] = queryKey
503
+ return await getBuyQuote(config, parameters)
504
+ },
505
+ }
506
+ }
507
+
508
+ export declare namespace queryOptions {
509
+ export type Parameters<
510
+ config extends Config,
511
+ selectData = getBuyQuote.ReturnValue,
512
+ > = getBuyQuote.Parameters<config> & {
513
+ query?:
514
+ | Omit<ReturnValue<config, selectData>, 'queryKey' | 'queryFn'>
515
+ | undefined
516
+ }
517
+
518
+ export type ReturnValue<
519
+ config extends Config,
520
+ selectData = getBuyQuote.ReturnValue,
521
+ > = RequiredBy<
522
+ Query.QueryOptions<
523
+ getBuyQuote.ReturnValue,
524
+ Query.DefaultError,
525
+ selectData,
526
+ getBuyQuote.QueryKey<config>
527
+ >,
528
+ 'queryKey' | 'queryFn'
529
+ >
530
+ }
531
+ }
532
+
533
+ /**
534
+ * Gets an order's details from the orderbook.
535
+ *
536
+ * @example
537
+ * ```ts
538
+ * import { createConfig, http } from '@wagmi/core'
539
+ * import { tempo } from 'tempo.ts/chains'
540
+ * import { Actions } from 'tempo.ts/wagmi'
541
+ *
542
+ * const config = createConfig({
543
+ * chains: [tempo],
544
+ * transports: {
545
+ * [tempo.id]: http(),
546
+ * },
547
+ * })
548
+ *
549
+ * const order = await Actions.dex.getOrder(config, {
550
+ * orderId: 123n,
551
+ * })
552
+ * ```
553
+ *
554
+ * @param config - Config.
555
+ * @param parameters - Parameters.
556
+ * @returns The order details.
557
+ */
558
+ export function getOrder<config extends Config>(
559
+ config: config,
560
+ parameters: getOrder.Parameters<config>,
561
+ ): Promise<getOrder.ReturnValue> {
562
+ const { chainId, ...rest } = parameters
563
+ const client = config.getClient({ chainId })
564
+ return viem_Actions.getOrder(client, rest)
565
+ }
566
+
567
+ export namespace getOrder {
568
+ export type Parameters<config extends Config> = ChainIdParameter<config> &
569
+ viem_Actions.getOrder.Parameters
570
+
571
+ export type ReturnValue = viem_Actions.getOrder.ReturnValue
572
+
573
+ export function queryKey<config extends Config>(
574
+ parameters: Parameters<config>,
575
+ ) {
576
+ return ['getOrder', parameters] as const
577
+ }
578
+
579
+ export type QueryKey<config extends Config> = ReturnType<
580
+ typeof queryKey<config>
581
+ >
582
+
583
+ export function queryOptions<config extends Config, selectData = ReturnValue>(
584
+ config: Config,
585
+ parameters: queryOptions.Parameters<config, selectData>,
586
+ ): queryOptions.ReturnValue<config, selectData> {
587
+ const { query, ...rest } = parameters
588
+ return {
589
+ ...query,
590
+ queryKey: queryKey(rest),
591
+ async queryFn({ queryKey }) {
592
+ const [, parameters] = queryKey
593
+ return await getOrder(config, parameters)
594
+ },
595
+ }
596
+ }
597
+
598
+ export declare namespace queryOptions {
599
+ export type Parameters<
600
+ config extends Config,
601
+ selectData = getOrder.ReturnValue,
602
+ > = getOrder.Parameters<config> & {
603
+ query?:
604
+ | Omit<ReturnValue<config, selectData>, 'queryKey' | 'queryFn'>
605
+ | undefined
606
+ }
607
+
608
+ export type ReturnValue<
609
+ config extends Config,
610
+ selectData = getOrder.ReturnValue,
611
+ > = RequiredBy<
612
+ Query.QueryOptions<
613
+ getOrder.ReturnValue,
614
+ Query.DefaultError,
615
+ selectData,
616
+ getOrder.QueryKey<config>
617
+ >,
618
+ 'queryKey' | 'queryFn'
619
+ >
620
+ }
621
+ }
622
+
623
+ /**
624
+ * Gets paginated orders from the orderbook.
625
+ *
626
+ * @example
627
+ * ```ts
628
+ * import { createConfig, http } from '@wagmi/core'
629
+ * import { tempo } from 'tempo.ts/chains'
630
+ * import { Actions } from 'tempo.ts/wagmi'
631
+ *
632
+ * const config = createConfig({
633
+ * chains: [tempo],
634
+ * transports: {
635
+ * [tempo.id]: http(),
636
+ * },
637
+ * })
638
+ *
639
+ * const { orders, nextCursor } = await Actions.dex.getOrders(config, {
640
+ * limit: 100,
641
+ * filters: {
642
+ * baseToken: '0x20c0...',
643
+ * isBid: true,
644
+ * }
645
+ * })
646
+ * ```
647
+ *
648
+ * @param config - Config.
649
+ * @param parameters - Parameters.
650
+ * @returns Paginated orders and next cursor.
651
+ */
652
+ export function getOrders<config extends Config>(
653
+ config: config,
654
+ parameters: getOrders.Parameters<config> = {},
655
+ ): Promise<getOrders.ReturnValue> {
656
+ const { chainId, ...rest } = parameters
657
+ const client = config.getClient({ chainId })
658
+ return viem_Actions.getOrders(client, rest)
659
+ }
660
+
661
+ export namespace getOrders {
662
+ export type Parameters<config extends Config> = ChainIdParameter<config> &
663
+ viem_Actions.getOrders.Parameters
664
+
665
+ export type ReturnValue = viem_Actions.getOrders.ReturnValue
666
+
667
+ export function queryKey<config extends Config>(
668
+ parameters: Parameters<config>,
669
+ ) {
670
+ return ['getOrders', parameters] as const
671
+ }
672
+
673
+ export type QueryKey<config extends Config> = ReturnType<
674
+ typeof queryKey<config>
675
+ >
676
+
677
+ export function infiniteQueryOptions<
678
+ config extends Config,
679
+ selectData = ReturnValue,
680
+ >(
681
+ config: Config,
682
+ parameters: infiniteQueryOptions.Parameters<config, selectData>,
683
+ ): infiniteQueryOptions.ReturnValue<config, selectData> {
684
+ const { cursor, query, ...rest } = parameters
685
+ return {
686
+ pages: 1,
687
+ ...query,
688
+ getNextPageParam: (x) => x.nextCursor,
689
+ initialPageParam: cursor ?? undefined,
690
+ queryKey: queryKey(rest),
691
+ async queryFn({ queryKey, pageParam: cursor }) {
692
+ const [, parameters] = queryKey
693
+ return await getOrders(config, { ...parameters, cursor })
694
+ },
695
+ }
696
+ }
697
+
698
+ export declare namespace infiniteQueryOptions {
699
+ export type Parameters<
700
+ config extends Config,
701
+ selectData = getOrders.ReturnValue,
702
+ > = getOrders.Parameters<config> & {
703
+ query?:
704
+ | Omit<
705
+ ReturnValue<config, selectData>,
706
+ 'initialPageParam' | 'queryKey' | 'queryFn'
707
+ >
708
+ | undefined
709
+ }
710
+
711
+ export type ReturnValue<
712
+ config extends Config,
713
+ selectData = getOrders.ReturnValue,
714
+ > = UnionRequiredBy<
715
+ Query.FetchInfiniteQueryOptions<
716
+ getOrders.ReturnValue,
717
+ Query.DefaultError,
718
+ selectData,
719
+ getOrders.QueryKey<config>,
720
+ Hex.Hex | undefined
721
+ >,
722
+ 'queryKey' | 'queryFn'
723
+ >
724
+ }
725
+ }
726
+
727
+ /**
728
+ * Gets orderbook information for a trading pair.
729
+ *
730
+ * @example
731
+ * ```ts
732
+ * import { createConfig, http } from '@wagmi/core'
733
+ * import { tempo } from 'tempo.ts/chains'
734
+ * import { Actions } from 'tempo.ts/wagmi'
735
+ *
736
+ * const config = createConfig({
737
+ * chains: [tempo],
738
+ * transports: {
739
+ * [tempo.id]: http(),
740
+ * },
741
+ * })
742
+ *
743
+ * const book = await Actions.dex.getOrderbook(config, {
744
+ * base: '0x20c...11',
745
+ * quote: '0x20c...20',
746
+ * })
747
+ * ```
748
+ *
749
+ * @param config - Config.
750
+ * @param parameters - Parameters.
751
+ * @returns The orderbook information.
752
+ */
753
+ export function getOrderbook<config extends Config>(
754
+ config: config,
755
+ parameters: getOrderbook.Parameters<config>,
756
+ ): Promise<getOrderbook.ReturnValue> {
757
+ const { chainId, ...rest } = parameters
758
+ const client = config.getClient({ chainId })
759
+ return viem_Actions.getOrderbook(client, rest)
760
+ }
761
+
762
+ export namespace getOrderbook {
763
+ export type Parameters<config extends Config> = ChainIdParameter<config> &
764
+ viem_Actions.getOrderbook.Parameters
765
+
766
+ export type ReturnValue = viem_Actions.getOrderbook.ReturnValue
767
+
768
+ export function queryKey<config extends Config>(
769
+ parameters: Parameters<config>,
770
+ ) {
771
+ return ['getOrderbook', parameters] as const
772
+ }
773
+
774
+ export type QueryKey<config extends Config> = ReturnType<
775
+ typeof queryKey<config>
776
+ >
777
+
778
+ export function queryOptions<config extends Config, selectData = ReturnValue>(
779
+ config: Config,
780
+ parameters: queryOptions.Parameters<config, selectData>,
781
+ ): queryOptions.ReturnValue<config, selectData> {
782
+ const { query, ...rest } = parameters
783
+ return {
784
+ ...query,
785
+ queryKey: queryKey(rest),
786
+ async queryFn({ queryKey }) {
787
+ const [, parameters] = queryKey
788
+ return await getOrderbook(config, parameters)
789
+ },
790
+ }
791
+ }
792
+
793
+ export declare namespace queryOptions {
794
+ export type Parameters<
795
+ config extends Config,
796
+ selectData = getOrderbook.ReturnValue,
797
+ > = getOrderbook.Parameters<config> & {
798
+ query?:
799
+ | Omit<ReturnValue<config, selectData>, 'queryKey' | 'queryFn'>
800
+ | undefined
801
+ }
802
+
803
+ export type ReturnValue<
804
+ config extends Config,
805
+ selectData = getOrderbook.ReturnValue,
806
+ > = RequiredBy<
807
+ Query.QueryOptions<
808
+ getOrderbook.ReturnValue,
809
+ Query.DefaultError,
810
+ selectData,
811
+ getOrderbook.QueryKey<config>
812
+ >,
813
+ 'queryKey' | 'queryFn'
814
+ >
815
+ }
816
+ }
817
+
818
+ /**
819
+ * Gets the price level information at a specific tick.
820
+ *
821
+ * @example
822
+ * ```ts
823
+ * import { createConfig, http } from '@wagmi/core'
824
+ * import { tempo } from 'tempo.ts/chains'
825
+ * import { Actions, Tick } from 'tempo.ts/wagmi'
826
+ *
827
+ * const config = createConfig({
828
+ * chains: [tempo],
829
+ * transports: {
830
+ * [tempo.id]: http(),
831
+ * },
832
+ * })
833
+ *
834
+ * const level = await Actions.dex.getPriceLevel(config, {
835
+ * base: '0x20c...11',
836
+ * tick: Tick.fromPrice('1.001'),
837
+ * isBid: true,
838
+ * })
839
+ * ```
840
+ *
841
+ * @param config - Config.
842
+ * @param parameters - Parameters.
843
+ * @returns The price level information.
844
+ */
845
+ export function getPriceLevel<config extends Config>(
846
+ config: config,
847
+ parameters: getPriceLevel.Parameters<config>,
848
+ ): Promise<getPriceLevel.ReturnValue> {
849
+ const { chainId, ...rest } = parameters
850
+ const client = config.getClient({ chainId })
851
+ return viem_Actions.getPriceLevel(client, rest)
852
+ }
853
+
854
+ export namespace getPriceLevel {
855
+ export type Parameters<config extends Config> = ChainIdParameter<config> &
856
+ viem_Actions.getPriceLevel.Parameters
857
+
858
+ export type ReturnValue = viem_Actions.getPriceLevel.ReturnValue
859
+
860
+ export function queryKey<config extends Config>(
861
+ parameters: Parameters<config>,
862
+ ) {
863
+ return ['getPriceLevel', parameters] as const
864
+ }
865
+
866
+ export type QueryKey<config extends Config> = ReturnType<
867
+ typeof queryKey<config>
868
+ >
869
+
870
+ export function queryOptions<config extends Config, selectData = ReturnValue>(
871
+ config: Config,
872
+ parameters: queryOptions.Parameters<config, selectData>,
873
+ ): queryOptions.ReturnValue<config, selectData> {
874
+ const { query, ...rest } = parameters
875
+ return {
876
+ ...query,
877
+ queryKey: queryKey(rest),
878
+ async queryFn({ queryKey }) {
879
+ const [, parameters] = queryKey
880
+ return await getPriceLevel(config, parameters)
881
+ },
882
+ }
883
+ }
884
+
885
+ export declare namespace queryOptions {
886
+ export type Parameters<
887
+ config extends Config,
888
+ selectData = getPriceLevel.ReturnValue,
889
+ > = getPriceLevel.Parameters<config> & {
890
+ query?:
891
+ | Omit<ReturnValue<config, selectData>, 'queryKey' | 'queryFn'>
892
+ | undefined
893
+ }
894
+
895
+ export type ReturnValue<
896
+ config extends Config,
897
+ selectData = getPriceLevel.ReturnValue,
898
+ > = RequiredBy<
899
+ Query.QueryOptions<
900
+ getPriceLevel.ReturnValue,
901
+ Query.DefaultError,
902
+ selectData,
903
+ getPriceLevel.QueryKey<config>
904
+ >,
905
+ 'queryKey' | 'queryFn'
906
+ >
907
+ }
908
+ }
909
+
910
+ /**
911
+ * Gets the quote for selling a specific amount of tokens.
912
+ *
913
+ * @example
914
+ * ```ts
915
+ * import { createConfig, http } from '@wagmi/core'
916
+ * import { tempo } from 'tempo.ts/chains'
917
+ * import { Actions } from 'tempo.ts/wagmi'
918
+ *
919
+ * const config = createConfig({
920
+ * chains: [tempo],
921
+ * transports: {
922
+ * [tempo.id]: http(),
923
+ * },
924
+ * })
925
+ *
926
+ * const amountOut = await Actions.dex.getSellQuote(config, {
927
+ * amountIn: parseUnits('100', 6),
928
+ * tokenIn: '0x20c...11',
929
+ * tokenOut: '0x20c...20',
930
+ * })
931
+ * ```
932
+ *
933
+ * @param config - Config.
934
+ * @param parameters - Parameters.
935
+ * @returns The amount of tokenOut received for selling the specified amountIn.
936
+ */
937
+ export function getSellQuote<config extends Config>(
938
+ config: config,
939
+ parameters: getSellQuote.Parameters<config>,
940
+ ): Promise<getSellQuote.ReturnValue> {
941
+ const { chainId, ...rest } = parameters
942
+ const client = config.getClient({ chainId })
943
+ return viem_Actions.getSellQuote(client, rest)
944
+ }
945
+
946
+ export namespace getSellQuote {
947
+ export type Parameters<config extends Config> = ChainIdParameter<config> &
948
+ viem_Actions.getSellQuote.Parameters
949
+
950
+ export type ReturnValue = viem_Actions.getSellQuote.ReturnValue
951
+
952
+ export function queryKey<config extends Config>(
953
+ parameters: Parameters<config>,
954
+ ) {
955
+ return ['getSellQuote', parameters] as const
956
+ }
957
+
958
+ export type QueryKey<config extends Config> = ReturnType<
959
+ typeof queryKey<config>
960
+ >
961
+
962
+ export function queryOptions<config extends Config, selectData = ReturnValue>(
963
+ config: Config,
964
+ parameters: queryOptions.Parameters<config, selectData>,
965
+ ): queryOptions.ReturnValue<config, selectData> {
966
+ const { query, ...rest } = parameters
967
+ return {
968
+ ...query,
969
+ queryKey: queryKey(rest),
970
+ async queryFn({ queryKey }) {
971
+ const [, parameters] = queryKey
972
+ return await getSellQuote(config, parameters)
973
+ },
974
+ }
975
+ }
976
+
977
+ export declare namespace queryOptions {
978
+ export type Parameters<
979
+ config extends Config,
980
+ selectData = getSellQuote.ReturnValue,
981
+ > = getSellQuote.Parameters<config> & {
982
+ query?:
983
+ | Omit<ReturnValue<config, selectData>, 'queryKey' | 'queryFn'>
984
+ | undefined
985
+ }
986
+
987
+ export type ReturnValue<
988
+ config extends Config,
989
+ selectData = getSellQuote.ReturnValue,
990
+ > = RequiredBy<
991
+ Query.QueryOptions<
992
+ getSellQuote.ReturnValue,
993
+ Query.DefaultError,
994
+ selectData,
995
+ getSellQuote.QueryKey<config>
996
+ >,
997
+ 'queryKey' | 'queryFn'
998
+ >
999
+ }
1000
+ }
1001
+
1002
+ /**
1003
+ * Places a limit order on the orderbook.
1004
+ *
1005
+ * @example
1006
+ * ```ts
1007
+ * import { createConfig, http } from '@wagmi/core'
1008
+ * import { tempo } from 'tempo.ts/chains'
1009
+ * import { Actions } from 'tempo.ts/wagmi'
1010
+ *
1011
+ * const config = createConfig({
1012
+ * chains: [tempo],
1013
+ * transports: {
1014
+ * [tempo.id]: http(),
1015
+ * },
1016
+ * })
1017
+ *
1018
+ * const hash = await Actions.dex.place(config, {
1019
+ * amount: parseUnits('100', 6),
1020
+ * tick: Tick.fromPrice('0.99'),
1021
+ * token: '0x20c...11',
1022
+ * type: 'buy',
1023
+ * })
1024
+ * ```
1025
+ *
1026
+ * @param config - Config.
1027
+ * @param parameters - Parameters.
1028
+ * @returns The transaction hash.
1029
+ */
1030
+ export async function place<config extends Config>(
1031
+ config: config,
1032
+ parameters: place.Parameters<config>,
1033
+ ): Promise<viem_Actions.place.ReturnValue> {
1034
+ const { account, chainId, connector } = parameters
1035
+
1036
+ const client = await getConnectorClient(config, {
1037
+ account,
1038
+ assertChainId: false,
1039
+ chainId,
1040
+ connector,
1041
+ })
1042
+
1043
+ return viem_Actions.place(client, parameters as viem_Actions.place.Parameters)
1044
+ }
1045
+
1046
+ export declare namespace place {
1047
+ export type Parameters<config extends Config> = ChainIdParameter<config> &
1048
+ ConnectorParameter &
1049
+ Omit<viem_Actions.place.Parameters<undefined, Account>, 'chain'>
1050
+
1051
+ export type ReturnValue = viem_Actions.place.ReturnValue
1052
+
1053
+ export type ErrorType = viem_Actions.place.ErrorType
1054
+ }
1055
+
1056
+ /**
1057
+ * Places a flip order that automatically flips when filled.
1058
+ *
1059
+ * @example
1060
+ * ```ts
1061
+ * import { createConfig, http } from '@wagmi/core'
1062
+ * import { tempo } from 'tempo.ts/chains'
1063
+ * import { Actions } from 'tempo.ts/wagmi'
1064
+ *
1065
+ * const config = createConfig({
1066
+ * chains: [tempo],
1067
+ * transports: {
1068
+ * [tempo.id]: http(),
1069
+ * },
1070
+ * })
1071
+ *
1072
+ * const hash = await Actions.dex.placeFlip(config, {
1073
+ * amount: parseUnits('100', 6),
1074
+ * flipTick: Tick.fromPrice('1.01'),
1075
+ * tick: Tick.fromPrice('0.99'),
1076
+ * token: '0x20c...11',
1077
+ * type: 'buy',
1078
+ * })
1079
+ * ```
1080
+ *
1081
+ * @param config - Config.
1082
+ * @param parameters - Parameters.
1083
+ * @returns The transaction hash.
1084
+ */
1085
+ export async function placeFlip<config extends Config>(
1086
+ config: config,
1087
+ parameters: placeFlip.Parameters<config>,
1088
+ ): Promise<viem_Actions.placeFlip.ReturnValue> {
1089
+ const { account, chainId, connector } = parameters
1090
+
1091
+ const client = await getConnectorClient(config, {
1092
+ account,
1093
+ assertChainId: false,
1094
+ chainId,
1095
+ connector,
1096
+ })
1097
+
1098
+ return viem_Actions.placeFlip(
1099
+ client,
1100
+ parameters as viem_Actions.placeFlip.Parameters,
1101
+ )
1102
+ }
1103
+
1104
+ export declare namespace placeFlip {
1105
+ export type Parameters<config extends Config> = ChainIdParameter<config> &
1106
+ ConnectorParameter &
1107
+ Omit<viem_Actions.placeFlip.Parameters<undefined, Account>, 'chain'>
1108
+
1109
+ export type ReturnValue = viem_Actions.placeFlip.ReturnValue
1110
+
1111
+ export type ErrorType = viem_Actions.placeFlip.ErrorType
1112
+ }
1113
+
1114
+ /**
1115
+ * Places a flip order that automatically flips when filled.
1116
+ *
1117
+ * Note: This is a synchronous action that waits for the transaction to
1118
+ * be included on a block before returning a response.
1119
+ *
1120
+ * @example
1121
+ * ```ts
1122
+ * import { createConfig, http } from '@wagmi/core'
1123
+ * import { tempo } from 'tempo.ts/chains'
1124
+ * import { Actions } from 'tempo.ts/wagmi'
1125
+ *
1126
+ * const config = createConfig({
1127
+ * chains: [tempo],
1128
+ * transports: {
1129
+ * [tempo.id]: http(),
1130
+ * },
1131
+ * })
1132
+ *
1133
+ * const result = await Actions.dex.placeFlipSync(config, {
1134
+ * amount: parseUnits('100', 6),
1135
+ * flipTick: Tick.fromPrice('1.01'),
1136
+ * tick: Tick.fromPrice('0.99'),
1137
+ * token: '0x20c...11',
1138
+ * type: 'buy',
1139
+ * })
1140
+ * ```
1141
+ *
1142
+ * @param config - Config.
1143
+ * @param parameters - Parameters.
1144
+ * @returns The transaction receipt and event data.
1145
+ */
1146
+ export async function placeFlipSync<config extends Config>(
1147
+ config: config,
1148
+ parameters: placeFlipSync.Parameters<config>,
1149
+ ): Promise<viem_Actions.placeFlipSync.ReturnValue> {
1150
+ const { account, chainId, connector } = parameters
1151
+
1152
+ const client = await getConnectorClient(config, {
1153
+ account,
1154
+ assertChainId: false,
1155
+ chainId,
1156
+ connector,
1157
+ })
1158
+
1159
+ return viem_Actions.placeFlipSync(
1160
+ client,
1161
+ parameters as viem_Actions.placeFlipSync.Parameters,
1162
+ )
1163
+ }
1164
+
1165
+ export declare namespace placeFlipSync {
1166
+ export type Parameters<config extends Config> = ChainIdParameter<config> &
1167
+ ConnectorParameter &
1168
+ Omit<viem_Actions.placeFlipSync.Parameters<undefined, Account>, 'chain'>
1169
+
1170
+ export type ReturnValue = viem_Actions.placeFlipSync.ReturnValue
1171
+
1172
+ export type ErrorType = viem_Actions.placeFlipSync.ErrorType
1173
+ }
1174
+
1175
+ /**
1176
+ * Places a limit order on the orderbook.
1177
+ *
1178
+ * Note: This is a synchronous action that waits for the transaction to
1179
+ * be included on a block before returning a response.
1180
+ *
1181
+ * @example
1182
+ * ```ts
1183
+ * import { createConfig, http } from '@wagmi/core'
1184
+ * import { tempo } from 'tempo.ts/chains'
1185
+ * import { Actions } from 'tempo.ts/wagmi'
1186
+ *
1187
+ * const config = createConfig({
1188
+ * chains: [tempo],
1189
+ * transports: {
1190
+ * [tempo.id]: http(),
1191
+ * },
1192
+ * })
1193
+ *
1194
+ * const result = await Actions.dex.placeSync(config, {
1195
+ * amount: parseUnits('100', 6),
1196
+ * tick: Tick.fromPrice('0.99'),
1197
+ * token: '0x20c...11',
1198
+ * type: 'buy',
1199
+ * })
1200
+ * ```
1201
+ *
1202
+ * @param config - Config.
1203
+ * @param parameters - Parameters.
1204
+ * @returns The transaction receipt and event data.
1205
+ */
1206
+ export async function placeSync<config extends Config>(
1207
+ config: config,
1208
+ parameters: placeSync.Parameters<config>,
1209
+ ): Promise<viem_Actions.placeSync.ReturnValue> {
1210
+ const { account, chainId, connector } = parameters
1211
+
1212
+ const client = await getConnectorClient(config, {
1213
+ account,
1214
+ assertChainId: false,
1215
+ chainId,
1216
+ connector,
1217
+ })
1218
+
1219
+ return viem_Actions.placeSync(
1220
+ client,
1221
+ parameters as viem_Actions.placeSync.Parameters,
1222
+ )
1223
+ }
1224
+
1225
+ export declare namespace placeSync {
1226
+ export type Parameters<config extends Config> = ChainIdParameter<config> &
1227
+ ConnectorParameter &
1228
+ Omit<viem_Actions.placeSync.Parameters<undefined, Account>, 'chain'>
1229
+
1230
+ export type ReturnValue = viem_Actions.placeSync.ReturnValue
1231
+
1232
+ export type ErrorType = viem_Actions.placeSync.ErrorType
1233
+ }
1234
+
1235
+ /**
1236
+ * Sells a specific amount of tokens.
1237
+ *
1238
+ * @example
1239
+ * ```ts
1240
+ * import { createConfig, http } from '@wagmi/core'
1241
+ * import { tempo } from 'tempo.ts/chains'
1242
+ * import { Actions } from 'tempo.ts/wagmi'
1243
+ *
1244
+ * const config = createConfig({
1245
+ * chains: [tempo],
1246
+ * transports: {
1247
+ * [tempo.id]: http(),
1248
+ * },
1249
+ * })
1250
+ *
1251
+ * const hash = await Actions.dex.sell(config, {
1252
+ * amountIn: parseUnits('100', 6),
1253
+ * minAmountOut: parseUnits('95', 6),
1254
+ * tokenIn: '0x20c...11',
1255
+ * tokenOut: '0x20c...20',
1256
+ * })
1257
+ * ```
1258
+ *
1259
+ * @param config - Config.
1260
+ * @param parameters - Parameters.
1261
+ * @returns The transaction hash.
1262
+ */
1263
+ export async function sell<config extends Config>(
1264
+ config: config,
1265
+ parameters: sell.Parameters<config>,
1266
+ ): Promise<viem_Actions.sell.ReturnValue> {
1267
+ const { account, chainId, connector } = parameters
1268
+
1269
+ const client = await getConnectorClient(config, {
1270
+ account,
1271
+ assertChainId: false,
1272
+ chainId,
1273
+ connector,
1274
+ })
1275
+
1276
+ return viem_Actions.sell(client, parameters as viem_Actions.sell.Parameters)
1277
+ }
1278
+
1279
+ export declare namespace sell {
1280
+ export type Parameters<config extends Config> = ChainIdParameter<config> &
1281
+ ConnectorParameter &
1282
+ Omit<viem_Actions.sell.Parameters<undefined, Account>, 'chain'>
1283
+
1284
+ export type ReturnValue = viem_Actions.sell.ReturnValue
1285
+
1286
+ export type ErrorType = viem_Actions.sell.ErrorType
1287
+ }
1288
+
1289
+ /**
1290
+ * Sells a specific amount of tokens.
1291
+ *
1292
+ * Note: This is a synchronous action that waits for the transaction to
1293
+ * be included on a block before returning a response.
1294
+ *
1295
+ * @example
1296
+ * ```ts
1297
+ * import { createConfig, http } from '@wagmi/core'
1298
+ * import { tempo } from 'tempo.ts/chains'
1299
+ * import { Actions } from 'tempo.ts/wagmi'
1300
+ *
1301
+ * const config = createConfig({
1302
+ * chains: [tempo],
1303
+ * transports: {
1304
+ * [tempo.id]: http(),
1305
+ * },
1306
+ * })
1307
+ *
1308
+ * const result = await Actions.dex.sellSync(config, {
1309
+ * amountIn: parseUnits('100', 6),
1310
+ * minAmountOut: parseUnits('95', 6),
1311
+ * tokenIn: '0x20c...11',
1312
+ * tokenOut: '0x20c...20',
1313
+ * })
1314
+ * ```
1315
+ *
1316
+ * @param config - Config.
1317
+ * @param parameters - Parameters.
1318
+ * @returns The transaction receipt.
1319
+ */
1320
+ export async function sellSync<config extends Config>(
1321
+ config: config,
1322
+ parameters: sellSync.Parameters<config>,
1323
+ ): Promise<viem_Actions.sellSync.ReturnValue> {
1324
+ const { account, chainId, connector } = parameters
1325
+
1326
+ const client = await getConnectorClient(config, {
1327
+ account,
1328
+ assertChainId: false,
1329
+ chainId,
1330
+ connector,
1331
+ })
1332
+
1333
+ return viem_Actions.sellSync(
1334
+ client,
1335
+ parameters as viem_Actions.sellSync.Parameters,
1336
+ )
1337
+ }
1338
+
1339
+ export declare namespace sellSync {
1340
+ export type Parameters<config extends Config> = ChainIdParameter<config> &
1341
+ ConnectorParameter &
1342
+ Omit<viem_Actions.sellSync.Parameters<undefined, Account>, 'chain'>
1343
+
1344
+ export type ReturnValue = viem_Actions.sellSync.ReturnValue
1345
+
1346
+ export type ErrorType = viem_Actions.sellSync.ErrorType
1347
+ }
1348
+
1349
+ /**
1350
+ * Watches for flip order placement events on the DEX.
1351
+ *
1352
+ * @example
1353
+ * ```ts
1354
+ * import { createConfig, http } from '@wagmi/core'
1355
+ * import { tempo } from 'tempo.ts/chains'
1356
+ * import { Actions } from 'tempo.ts/wagmi'
1357
+ *
1358
+ * const config = createConfig({
1359
+ * chains: [tempo],
1360
+ * transports: {
1361
+ * [tempo.id]: http(),
1362
+ * },
1363
+ * })
1364
+ *
1365
+ * const unwatch = Actions.dex.watchFlipOrderPlaced(config, {
1366
+ * onFlipOrderPlaced: (args, log) => {
1367
+ * console.log('Flip order placed:', args)
1368
+ * },
1369
+ * })
1370
+ * ```
1371
+ *
1372
+ * @param config - Config.
1373
+ * @param parameters - Parameters.
1374
+ * @returns A function to unsubscribe from the event.
1375
+ */
1376
+ export function watchFlipOrderPlaced<config extends Config>(
1377
+ config: config,
1378
+ parameters: watchFlipOrderPlaced.Parameters<config>,
1379
+ ) {
1380
+ const { chainId, ...rest } = parameters
1381
+ const client = config.getClient({ chainId })
1382
+ return viem_Actions.watchFlipOrderPlaced(client, rest)
1383
+ }
1384
+
1385
+ export declare namespace watchFlipOrderPlaced {
1386
+ export type Parameters<config extends Config> = ChainIdParameter<config> &
1387
+ viem_Actions.watchFlipOrderPlaced.Parameters
1388
+
1389
+ export type Args = viem_Actions.watchFlipOrderPlaced.Args
1390
+
1391
+ export type Log = viem_Actions.watchFlipOrderPlaced.Log
1392
+ }
1393
+
1394
+ /**
1395
+ * Watches for order cancellation events on the DEX.
1396
+ *
1397
+ * @example
1398
+ * ```ts
1399
+ * import { createConfig, http } from '@wagmi/core'
1400
+ * import { tempo } from 'tempo.ts/chains'
1401
+ * import { Actions } from 'tempo.ts/wagmi'
1402
+ *
1403
+ * const config = createConfig({
1404
+ * chains: [tempo],
1405
+ * transports: {
1406
+ * [tempo.id]: http(),
1407
+ * },
1408
+ * })
1409
+ *
1410
+ * const unwatch = Actions.dex.watchOrderCancelled(config, {
1411
+ * onOrderCancelled: (args, log) => {
1412
+ * console.log('Order cancelled:', args)
1413
+ * },
1414
+ * })
1415
+ * ```
1416
+ *
1417
+ * @param config - Config.
1418
+ * @param parameters - Parameters.
1419
+ * @returns A function to unsubscribe from the event.
1420
+ */
1421
+ export function watchOrderCancelled<config extends Config>(
1422
+ config: config,
1423
+ parameters: watchOrderCancelled.Parameters<config>,
1424
+ ) {
1425
+ const { chainId, ...rest } = parameters
1426
+ const client = config.getClient({ chainId })
1427
+ return viem_Actions.watchOrderCancelled(client, rest)
1428
+ }
1429
+
1430
+ export declare namespace watchOrderCancelled {
1431
+ export type Parameters<config extends Config> = ChainIdParameter<config> &
1432
+ viem_Actions.watchOrderCancelled.Parameters
1433
+
1434
+ export type Args = viem_Actions.watchOrderCancelled.Args
1435
+
1436
+ export type Log = viem_Actions.watchOrderCancelled.Log
1437
+ }
1438
+
1439
+ /**
1440
+ * Watches for order filled events on the DEX.
1441
+ *
1442
+ * @example
1443
+ * ```ts
1444
+ * import { createConfig, http } from '@wagmi/core'
1445
+ * import { tempo } from 'tempo.ts/chains'
1446
+ * import { Actions } from 'tempo.ts/wagmi'
1447
+ *
1448
+ * const config = createConfig({
1449
+ * chains: [tempo],
1450
+ * transports: {
1451
+ * [tempo.id]: http(),
1452
+ * },
1453
+ * })
1454
+ *
1455
+ * const unwatch = Actions.dex.watchOrderFilled(config, {
1456
+ * onOrderFilled: (args, log) => {
1457
+ * console.log('Order filled:', args)
1458
+ * },
1459
+ * })
1460
+ * ```
1461
+ *
1462
+ * @param config - Config.
1463
+ * @param parameters - Parameters.
1464
+ * @returns A function to unsubscribe from the event.
1465
+ */
1466
+ export function watchOrderFilled<config extends Config>(
1467
+ config: config,
1468
+ parameters: watchOrderFilled.Parameters<config>,
1469
+ ) {
1470
+ const { chainId, ...rest } = parameters
1471
+ const client = config.getClient({ chainId })
1472
+ return viem_Actions.watchOrderFilled(client, rest)
1473
+ }
1474
+
1475
+ export declare namespace watchOrderFilled {
1476
+ export type Parameters<config extends Config> = ChainIdParameter<config> &
1477
+ viem_Actions.watchOrderFilled.Parameters
1478
+
1479
+ export type Args = viem_Actions.watchOrderFilled.Args
1480
+
1481
+ export type Log = viem_Actions.watchOrderFilled.Log
1482
+ }
1483
+
1484
+ /**
1485
+ * Watches for order placement events on the DEX.
1486
+ *
1487
+ * @example
1488
+ * ```ts
1489
+ * import { createConfig, http } from '@wagmi/core'
1490
+ * import { tempo } from 'tempo.ts/chains'
1491
+ * import { Actions } from 'tempo.ts/wagmi'
1492
+ *
1493
+ * const config = createConfig({
1494
+ * chains: [tempo],
1495
+ * transports: {
1496
+ * [tempo.id]: http(),
1497
+ * },
1498
+ * })
1499
+ *
1500
+ * const unwatch = Actions.dex.watchOrderPlaced(config, {
1501
+ * onOrderPlaced: (args, log) => {
1502
+ * console.log('Order placed:', args)
1503
+ * },
1504
+ * })
1505
+ * ```
1506
+ *
1507
+ * @param config - Config.
1508
+ * @param parameters - Parameters.
1509
+ * @returns A function to unsubscribe from the event.
1510
+ */
1511
+ export function watchOrderPlaced<config extends Config>(
1512
+ config: config,
1513
+ parameters: watchOrderPlaced.Parameters<config>,
1514
+ ) {
1515
+ const { chainId, ...rest } = parameters
1516
+ const client = config.getClient({ chainId })
1517
+ return viem_Actions.watchOrderPlaced(client, rest)
1518
+ }
1519
+
1520
+ export declare namespace watchOrderPlaced {
1521
+ export type Parameters<config extends Config> = ChainIdParameter<config> &
1522
+ viem_Actions.watchOrderPlaced.Parameters
1523
+
1524
+ export type Args = viem_Actions.watchOrderPlaced.Args
1525
+
1526
+ export type Log = viem_Actions.watchOrderPlaced.Log
1527
+ }
1528
+
1529
+ /**
1530
+ * Withdraws tokens from the DEX to the caller's wallet.
1531
+ *
1532
+ * @example
1533
+ * ```ts
1534
+ * import { createConfig, http } from '@wagmi/core'
1535
+ * import { tempo } from 'tempo.ts/chains'
1536
+ * import { Actions } from 'tempo.ts/wagmi'
1537
+ *
1538
+ * const config = createConfig({
1539
+ * chains: [tempo],
1540
+ * transports: {
1541
+ * [tempo.id]: http(),
1542
+ * },
1543
+ * })
1544
+ *
1545
+ * const hash = await Actions.dex.withdraw(config, {
1546
+ * amount: 100n,
1547
+ * token: '0x20c...11',
1548
+ * })
1549
+ * ```
1550
+ *
1551
+ * @param config - Config.
1552
+ * @param parameters - Parameters.
1553
+ * @returns The transaction hash.
1554
+ */
1555
+ export async function withdraw<config extends Config>(
1556
+ config: config,
1557
+ parameters: withdraw.Parameters<config>,
1558
+ ): Promise<viem_Actions.withdraw.ReturnValue> {
1559
+ const { account, chainId, connector } = parameters
1560
+
1561
+ const client = await getConnectorClient(config, {
1562
+ account,
1563
+ assertChainId: false,
1564
+ chainId,
1565
+ connector,
1566
+ })
1567
+
1568
+ return viem_Actions.withdraw(
1569
+ client,
1570
+ parameters as viem_Actions.withdraw.Parameters,
1571
+ )
1572
+ }
1573
+
1574
+ export declare namespace withdraw {
1575
+ export type Parameters<config extends Config> = ChainIdParameter<config> &
1576
+ ConnectorParameter &
1577
+ Omit<viem_Actions.withdraw.Parameters<undefined, Account>, 'chain'>
1578
+
1579
+ export type ReturnValue = viem_Actions.withdraw.ReturnValue
1580
+
1581
+ export type ErrorType = viem_Actions.withdraw.ErrorType
1582
+ }
1583
+
1584
+ /**
1585
+ * Withdraws tokens from the DEX to the caller's wallet.
1586
+ *
1587
+ * Note: This is a synchronous action that waits for the transaction to
1588
+ * be included on a block before returning a response.
1589
+ *
1590
+ * @example
1591
+ * ```ts
1592
+ * import { createConfig, http } from '@wagmi/core'
1593
+ * import { tempo } from 'tempo.ts/chains'
1594
+ * import { Actions } from 'tempo.ts/wagmi'
1595
+ *
1596
+ * const config = createConfig({
1597
+ * chains: [tempo],
1598
+ * transports: {
1599
+ * [tempo.id]: http(),
1600
+ * },
1601
+ * })
1602
+ *
1603
+ * const result = await Actions.dex.withdrawSync(config, {
1604
+ * amount: 100n,
1605
+ * token: '0x20c...11',
1606
+ * })
1607
+ * ```
1608
+ *
1609
+ * @param config - Config.
1610
+ * @param parameters - Parameters.
1611
+ * @returns The transaction receipt and event data.
1612
+ */
1613
+ export async function withdrawSync<config extends Config>(
1614
+ config: config,
1615
+ parameters: withdrawSync.Parameters<config>,
1616
+ ): Promise<viem_Actions.withdrawSync.ReturnValue> {
1617
+ const { account, chainId, connector } = parameters
1618
+
1619
+ const client = await getConnectorClient(config, {
1620
+ account,
1621
+ assertChainId: false,
1622
+ chainId,
1623
+ connector,
1624
+ })
1625
+
1626
+ return viem_Actions.withdrawSync(
1627
+ client,
1628
+ parameters as viem_Actions.withdrawSync.Parameters,
1629
+ )
1630
+ }
1631
+
1632
+ export declare namespace withdrawSync {
1633
+ export type Parameters<config extends Config> = ChainIdParameter<config> &
1634
+ ConnectorParameter &
1635
+ Omit<viem_Actions.withdrawSync.Parameters<undefined, Account>, 'chain'>
1636
+
1637
+ export type ReturnValue = viem_Actions.withdrawSync.ReturnValue
1638
+
1639
+ export type ErrorType = viem_Actions.withdrawSync.ErrorType
1640
+ }