tempo.ts 0.11.0 → 0.12.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 (196) hide show
  1. package/CHANGELOG.md +67 -4
  2. package/README.md +3 -34
  3. package/dist/server/Handler.d.ts +14 -14
  4. package/dist/server/Handler.d.ts.map +1 -1
  5. package/dist/server/Handler.js +16 -17
  6. package/dist/server/Handler.js.map +1 -1
  7. package/dist/wagmi/Actions/amm.d.ts +51 -51
  8. package/dist/wagmi/Actions/amm.d.ts.map +1 -1
  9. package/dist/wagmi/Actions/amm.js +37 -37
  10. package/dist/wagmi/Actions/amm.js.map +1 -1
  11. package/dist/wagmi/Actions/dex.d.ts +129 -129
  12. package/dist/wagmi/Actions/dex.d.ts.map +1 -1
  13. package/dist/wagmi/Actions/dex.js +73 -73
  14. package/dist/wagmi/Actions/dex.js.map +1 -1
  15. package/dist/wagmi/Actions/faucet.d.ts +9 -9
  16. package/dist/wagmi/Actions/faucet.d.ts.map +1 -1
  17. package/dist/wagmi/Actions/faucet.js +7 -7
  18. package/dist/wagmi/Actions/faucet.js.map +1 -1
  19. package/dist/wagmi/Actions/fee.d.ts +17 -17
  20. package/dist/wagmi/Actions/fee.d.ts.map +1 -1
  21. package/dist/wagmi/Actions/fee.js +10 -10
  22. package/dist/wagmi/Actions/fee.js.map +1 -1
  23. package/dist/wagmi/Actions/nonce.d.ts +9 -79
  24. package/dist/wagmi/Actions/nonce.d.ts.map +1 -1
  25. package/dist/wagmi/Actions/nonce.js +7 -89
  26. package/dist/wagmi/Actions/nonce.js.map +1 -1
  27. package/dist/wagmi/Actions/policy.d.ts +69 -70
  28. package/dist/wagmi/Actions/policy.d.ts.map +1 -1
  29. package/dist/wagmi/Actions/policy.js +43 -43
  30. package/dist/wagmi/Actions/policy.js.map +1 -1
  31. package/dist/wagmi/Actions/reward.d.ts +51 -51
  32. package/dist/wagmi/Actions/reward.d.ts.map +1 -1
  33. package/dist/wagmi/Actions/reward.js +31 -31
  34. package/dist/wagmi/Actions/reward.js.map +1 -1
  35. package/dist/wagmi/Actions/token.d.ts +238 -238
  36. package/dist/wagmi/Actions/token.d.ts.map +1 -1
  37. package/dist/wagmi/Actions/token.js +136 -136
  38. package/dist/wagmi/Actions/token.js.map +1 -1
  39. package/dist/wagmi/Connector.d.ts +2 -1
  40. package/dist/wagmi/Connector.d.ts.map +1 -1
  41. package/dist/wagmi/Connector.js +83 -22
  42. package/dist/wagmi/Connector.js.map +1 -1
  43. package/dist/wagmi/Hooks/nonce.d.ts +1 -52
  44. package/dist/wagmi/Hooks/nonce.d.ts.map +1 -1
  45. package/dist/wagmi/Hooks/nonce.js +1 -70
  46. package/dist/wagmi/Hooks/nonce.js.map +1 -1
  47. package/dist/wagmi/Hooks/policy.d.ts +0 -1
  48. package/dist/wagmi/Hooks/policy.d.ts.map +1 -1
  49. package/dist/wagmi/Hooks/policy.js.map +1 -1
  50. package/dist/wagmi/KeyManager.d.ts +6 -3
  51. package/dist/wagmi/KeyManager.d.ts.map +1 -1
  52. package/dist/wagmi/KeyManager.js +9 -4
  53. package/dist/wagmi/KeyManager.js.map +1 -1
  54. package/package.json +2 -2
  55. package/src/server/Handler.test.ts +2 -2
  56. package/src/server/Handler.ts +16 -17
  57. package/src/wagmi/Actions/amm.ts +63 -63
  58. package/src/wagmi/Actions/dex.test.ts +1 -1
  59. package/src/wagmi/Actions/dex.ts +153 -153
  60. package/src/wagmi/Actions/faucet.ts +11 -11
  61. package/src/wagmi/Actions/fee.ts +20 -20
  62. package/src/wagmi/Actions/nonce.test.ts +1 -64
  63. package/src/wagmi/Actions/nonce.ts +10 -142
  64. package/src/wagmi/Actions/policy.ts +83 -85
  65. package/src/wagmi/Actions/reward.ts +64 -61
  66. package/src/wagmi/Actions/token.ts +287 -283
  67. package/src/wagmi/Connector.ts +105 -31
  68. package/src/wagmi/Hooks/dex.test.ts +1 -1
  69. package/src/wagmi/Hooks/fee.test.ts +0 -6
  70. package/src/wagmi/Hooks/nonce.test.ts +1 -66
  71. package/src/wagmi/Hooks/nonce.ts +1 -114
  72. package/src/wagmi/Hooks/policy.ts +0 -2
  73. package/src/wagmi/KeyManager.ts +18 -5
  74. package/dist/viem/Abis.d.ts +0 -2649
  75. package/dist/viem/Abis.d.ts.map +0 -1
  76. package/dist/viem/Abis.js +0 -1677
  77. package/dist/viem/Abis.js.map +0 -1
  78. package/dist/viem/Account.d.ts +0 -244
  79. package/dist/viem/Account.d.ts.map +0 -1
  80. package/dist/viem/Account.js +0 -382
  81. package/dist/viem/Account.js.map +0 -1
  82. package/dist/viem/Actions/amm.d.ts +0 -1991
  83. package/dist/viem/Actions/amm.d.ts.map +0 -1
  84. package/dist/viem/Actions/amm.js +0 -814
  85. package/dist/viem/Actions/amm.js.map +0 -1
  86. package/dist/viem/Actions/dex.d.ts +0 -3900
  87. package/dist/viem/Actions/dex.d.ts.map +0 -1
  88. package/dist/viem/Actions/dex.js +0 -1414
  89. package/dist/viem/Actions/dex.js.map +0 -1
  90. package/dist/viem/Actions/faucet.d.ts +0 -69
  91. package/dist/viem/Actions/faucet.d.ts.map +0 -1
  92. package/dist/viem/Actions/faucet.js +0 -73
  93. package/dist/viem/Actions/faucet.js.map +0 -1
  94. package/dist/viem/Actions/fee.d.ts +0 -360
  95. package/dist/viem/Actions/fee.d.ts.map +0 -1
  96. package/dist/viem/Actions/fee.js +0 -237
  97. package/dist/viem/Actions/fee.js.map +0 -1
  98. package/dist/viem/Actions/nonce.d.ts +0 -257
  99. package/dist/viem/Actions/nonce.d.ts.map +0 -1
  100. package/dist/viem/Actions/nonce.js +0 -228
  101. package/dist/viem/Actions/nonce.js.map +0 -1
  102. package/dist/viem/Actions/policy.d.ts +0 -1680
  103. package/dist/viem/Actions/policy.d.ts.map +0 -1
  104. package/dist/viem/Actions/policy.js +0 -875
  105. package/dist/viem/Actions/policy.js.map +0 -1
  106. package/dist/viem/Actions/reward.d.ts +0 -2422
  107. package/dist/viem/Actions/reward.d.ts.map +0 -1
  108. package/dist/viem/Actions/reward.js +0 -651
  109. package/dist/viem/Actions/reward.js.map +0 -1
  110. package/dist/viem/Actions/token.d.ts +0 -16007
  111. package/dist/viem/Actions/token.d.ts.map +0 -1
  112. package/dist/viem/Actions/token.js +0 -2936
  113. package/dist/viem/Actions/token.js.map +0 -1
  114. package/dist/viem/Addresses.d.ts +0 -9
  115. package/dist/viem/Addresses.d.ts.map +0 -1
  116. package/dist/viem/Addresses.js +0 -9
  117. package/dist/viem/Addresses.js.map +0 -1
  118. package/dist/viem/Chain.d.ts +0 -451
  119. package/dist/viem/Chain.d.ts.map +0 -1
  120. package/dist/viem/Chain.js +0 -96
  121. package/dist/viem/Chain.js.map +0 -1
  122. package/dist/viem/Formatters.d.ts +0 -10
  123. package/dist/viem/Formatters.d.ts.map +0 -1
  124. package/dist/viem/Formatters.js +0 -104
  125. package/dist/viem/Formatters.js.map +0 -1
  126. package/dist/viem/Storage.d.ts +0 -24
  127. package/dist/viem/Storage.d.ts.map +0 -1
  128. package/dist/viem/Storage.js +0 -68
  129. package/dist/viem/Storage.js.map +0 -1
  130. package/dist/viem/Transaction.d.ts +0 -76
  131. package/dist/viem/Transaction.d.ts.map +0 -1
  132. package/dist/viem/Transaction.js +0 -176
  133. package/dist/viem/Transaction.js.map +0 -1
  134. package/dist/viem/Transport.d.ts +0 -33
  135. package/dist/viem/Transport.d.ts.map +0 -1
  136. package/dist/viem/Transport.js +0 -138
  137. package/dist/viem/Transport.js.map +0 -1
  138. package/dist/viem/WebAuthnP256.d.ts +0 -82
  139. package/dist/viem/WebAuthnP256.d.ts.map +0 -1
  140. package/dist/viem/WebAuthnP256.js +0 -97
  141. package/dist/viem/WebAuthnP256.js.map +0 -1
  142. package/dist/viem/WebCryptoP256.d.ts +0 -2
  143. package/dist/viem/WebCryptoP256.d.ts.map +0 -1
  144. package/dist/viem/WebCryptoP256.js +0 -2
  145. package/dist/viem/WebCryptoP256.js.map +0 -1
  146. package/dist/viem/internal/types.d.ts +0 -20
  147. package/dist/viem/internal/types.d.ts.map +0 -1
  148. package/dist/viem/internal/types.js +0 -2
  149. package/dist/viem/internal/types.js.map +0 -1
  150. package/dist/viem/internal/utils.d.ts +0 -14
  151. package/dist/viem/internal/utils.d.ts.map +0 -1
  152. package/dist/viem/internal/utils.js +0 -33
  153. package/dist/viem/internal/utils.js.map +0 -1
  154. package/src/chains.ts +0 -54
  155. package/src/viem/Abis.ts +0 -1688
  156. package/src/viem/Account.test.ts +0 -444
  157. package/src/viem/Account.ts +0 -601
  158. package/src/viem/Actions/account.test.ts +0 -414
  159. package/src/viem/Actions/account.ts +0 -106
  160. package/src/viem/Actions/amm.test.ts +0 -381
  161. package/src/viem/Actions/amm.ts +0 -1227
  162. package/src/viem/Actions/dex.test.ts +0 -1549
  163. package/src/viem/Actions/dex.ts +0 -2150
  164. package/src/viem/Actions/faucet.ts +0 -121
  165. package/src/viem/Actions/fee.test.ts +0 -259
  166. package/src/viem/Actions/fee.ts +0 -372
  167. package/src/viem/Actions/index.ts +0 -9
  168. package/src/viem/Actions/nonce.test.ts +0 -206
  169. package/src/viem/Actions/nonce.ts +0 -347
  170. package/src/viem/Actions/policy.test.ts +0 -534
  171. package/src/viem/Actions/policy.ts +0 -1335
  172. package/src/viem/Actions/reward.test.ts +0 -434
  173. package/src/viem/Actions/reward.ts +0 -944
  174. package/src/viem/Actions/token.test.ts +0 -3029
  175. package/src/viem/Actions/token.ts +0 -4458
  176. package/src/viem/Addresses.ts +0 -9
  177. package/src/viem/Chain.bench-d.ts +0 -12
  178. package/src/viem/Chain.test.ts +0 -168
  179. package/src/viem/Chain.ts +0 -157
  180. package/src/viem/Decorator.bench-d.ts +0 -11
  181. package/src/viem/Decorator.test.ts +0 -39
  182. package/src/viem/Decorator.ts +0 -3179
  183. package/src/viem/Formatters.ts +0 -164
  184. package/src/viem/P256.ts +0 -1
  185. package/src/viem/Secp256k1.ts +0 -1
  186. package/src/viem/Storage.ts +0 -110
  187. package/src/viem/TokenIds.ts +0 -1
  188. package/src/viem/Transaction.ts +0 -382
  189. package/src/viem/Transport.ts +0 -191
  190. package/src/viem/WebAuthnP256.ts +0 -146
  191. package/src/viem/WebCryptoP256.ts +0 -1
  192. package/src/viem/e2e.test.ts +0 -1602
  193. package/src/viem/index.ts +0 -30
  194. package/src/viem/internal/types.ts +0 -69
  195. package/src/viem/internal/utils.ts +0 -58
  196. package/src/wagmi/internal/types.ts +0 -16
@@ -1,3179 +0,0 @@
1
- import type { Account, Chain, Client, Transport } from 'viem'
2
- import type { VerifyHashParameters, VerifyHashReturnType } from 'viem/actions'
3
- import type { PartialBy } from '../internal/types.js'
4
- import * as accountActions from './Actions/account.js'
5
- import * as ammActions from './Actions/amm.js'
6
- import * as dexActions from './Actions/dex.js'
7
- import * as faucetActions from './Actions/faucet.js'
8
- import * as feeActions from './Actions/fee.js'
9
- import * as policyActions from './Actions/policy.js'
10
- import * as rewardActions from './Actions/reward.js'
11
- import * as tokenActions from './Actions/token.js'
12
-
13
- export type Decorator<
14
- chain extends Chain | undefined = Chain | undefined,
15
- account extends Account | undefined = Account | undefined,
16
- > = {
17
- /**
18
- * Verifies that a signature is valid for a given hash and address.
19
- * Supports Secp256k1, P256, WebCrypto P256, and WebAuthn signatures.
20
- *
21
- * @example
22
- * ```ts
23
- * import { createClient, http } from 'viem'
24
- * import { tempo } from 'tempo.ts/chains'
25
- * import { tempoActions } from 'tempo.ts/viem'
26
- *
27
- * const client = createClient({
28
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
29
- * transport: http(),
30
- * }).extend(tempoActions())
31
- *
32
- * const valid = await client.verifyHash({
33
- * address: '0x...',
34
- * hash: '0x...',
35
- * signature: '0x...',
36
- * })
37
- * ```
38
- *
39
- * @param parameters - Parameters.
40
- * @returns Whether the signature is valid.
41
- */
42
- verifyHash: (
43
- parameters: PartialBy<VerifyHashParameters, 'address'>,
44
- ) => Promise<VerifyHashReturnType>
45
- amm: {
46
- /**
47
- * Gets the reserves for a liquidity pool.
48
- *
49
- * @example
50
- * ```ts
51
- * import { createClient, http } from 'viem'
52
- * import { tempo } from 'tempo.ts/chains'
53
- * import { tempoActions } from 'tempo.ts/viem'
54
- *
55
- * const client = createClient({
56
- * chain: tempo({ feeToken: '0x20c...001' }),
57
- * transport: http(),
58
- * }).extend(tempoActions())
59
- *
60
- * const pool = await client.amm.getPool({
61
- * userToken: '0x...',
62
- * validatorToken: '0x...',
63
- * })
64
- * ```
65
- *
66
- * @param parameters - Parameters.
67
- * @returns The pool reserves.
68
- */
69
- getPool: (
70
- parameters: ammActions.getPool.Parameters,
71
- ) => Promise<ammActions.getPool.ReturnValue>
72
- /**
73
- * Gets the LP token balance for an account in a specific pool.
74
- *
75
- * @example
76
- * ```ts
77
- * import { createClient, http } from 'viem'
78
- * import { tempo } from 'tempo.ts/chains'
79
- * import { tempoActions } from 'tempo.ts/viem'
80
- *
81
- * const client = createClient({
82
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
83
- * transport: http(),
84
- * }).extend(tempoActions())
85
- *
86
- * const poolId = await client.amm.getPoolId({
87
- * userToken: '0x...',
88
- * validatorToken: '0x...',
89
- * })
90
- *
91
- * const balance = await client.amm.getLiquidityBalance({
92
- * poolId,
93
- * address: '0x...',
94
- * })
95
- * ```
96
- *
97
- * @param parameters - Parameters.
98
- * @returns The LP token balance.
99
- */
100
- getLiquidityBalance: (
101
- parameters: ammActions.getLiquidityBalance.Parameters,
102
- ) => Promise<ammActions.getLiquidityBalance.ReturnValue>
103
- /**
104
- * Removes liquidity from a pool.
105
- *
106
- * @example
107
- * ```ts
108
- * import { createClient, http } from 'viem'
109
- * import { privateKeyToAccount } from 'viem/accounts'
110
- * import { tempo } from 'tempo.ts/chains'
111
- * import { tempoActions } from 'tempo.ts/viem'
112
- *
113
- * const client = createClient({
114
- * account: privateKeyToAccount('0x...'),
115
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
116
- * transport: http(),
117
- * }).extend(tempoActions())
118
- *
119
- * const hash = await client.amm.burn({
120
- * userToken: '0x...',
121
- * validatorToken: '0x...',
122
- * liquidity: 50n,
123
- * to: '0x...',
124
- * })
125
- * ```
126
- *
127
- * @param parameters - Parameters.
128
- * @returns The transaction hash.
129
- */
130
- burn: (
131
- parameters: ammActions.burn.Parameters<chain, account>,
132
- ) => Promise<ammActions.burn.ReturnValue>
133
- /**
134
- * Removes liquidity from a pool and waits for confirmation.
135
- *
136
- * @example
137
- * ```ts
138
- * import { createClient, http } from 'viem'
139
- * import { privateKeyToAccount } from 'viem/accounts'
140
- * import { tempo } from 'tempo.ts/chains'
141
- * import { tempoActions } from 'tempo.ts/viem'
142
- *
143
- * const client = createClient({
144
- * account: privateKeyToAccount('0x...'),
145
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
146
- * transport: http(),
147
- * }).extend(tempoActions())
148
- *
149
- * const { receipt, ...result } = await client.amm.burnSync({
150
- * userToken: '0x...',
151
- * validatorToken: '0x...',
152
- * liquidity: 50n,
153
- * to: '0x...',
154
- * })
155
- * ```
156
- *
157
- * @param parameters - Parameters.
158
- * @returns The transaction receipt and event data.
159
- */
160
- burnSync: (
161
- parameters: ammActions.burnSync.Parameters<chain, account>,
162
- ) => Promise<ammActions.burnSync.ReturnValue>
163
- /**
164
- * Adds liquidity to a pool.
165
- *
166
- * @example
167
- * ```ts
168
- * import { createClient, http } from 'viem'
169
- * import { privateKeyToAccount } from 'viem/accounts'
170
- * import { tempo } from 'tempo.ts/chains'
171
- * import { tempoActions } from 'tempo.ts/viem'
172
- *
173
- * const client = createClient({
174
- * account: privateKeyToAccount('0x...'),
175
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
176
- * transport: http(),
177
- * }).extend(tempoActions())
178
- *
179
- * const hash = await client.amm.mint({
180
- * userTokenAddress: '0x...',
181
- * validatorTokenAddress: '0x...',
182
- * validatorTokenAmount: 100n,
183
- * to: '0x...',
184
- * })
185
- * ```
186
- *
187
- * @param parameters - Parameters.
188
- * @returns The transaction hash.
189
- */
190
- mint: (
191
- parameters: ammActions.mint.Parameters<chain, account>,
192
- ) => Promise<ammActions.mint.ReturnValue>
193
- /**
194
- * Adds liquidity to a pool.
195
- *
196
- * @example
197
- * ```ts
198
- * import { createClient, http } from 'viem'
199
- * import { privateKeyToAccount } from 'viem/accounts'
200
- * import { tempo } from 'tempo.ts/chains'
201
- * import { tempoActions } from 'tempo.ts/viem'
202
- *
203
- * const client = createClient({
204
- * account: privateKeyToAccount('0x...'),
205
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
206
- * transport: http(),
207
- * }).extend(tempoActions())
208
- *
209
- * const result = await client.amm.mintSync({
210
- * userTokenAddress: '0x...',
211
- * validatorTokenAddress: '0x...',
212
- * validatorTokenAmount: 100n,
213
- * to: '0x...',
214
- * })
215
- * ```
216
- *
217
- * @param parameters - Parameters.
218
- * @returns The transaction receipt and event data.
219
- */
220
- mintSync: (
221
- parameters: ammActions.mintSync.Parameters<chain, account>,
222
- ) => Promise<ammActions.mintSync.ReturnValue>
223
- /**
224
- * Swaps tokens during a rebalance operation.
225
- *
226
- * @example
227
- * ```ts
228
- * import { createClient, http } from 'viem'
229
- * import { privateKeyToAccount } from 'viem/accounts'
230
- * import { tempo } from 'tempo.ts/chains'
231
- * import { tempoActions } from 'tempo.ts/viem'
232
- *
233
- * const client = createClient({
234
- * account: privateKeyToAccount('0x...'),
235
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
236
- * transport: http(),
237
- * }).extend(tempoActions())
238
- *
239
- * const hash = await client.amm.rebalanceSwap({
240
- * userToken: '0x...',
241
- * validatorToken: '0x...',
242
- * amountOut: 100n,
243
- * to: '0x...',
244
- * })
245
- * ```
246
- *
247
- * @param parameters - Parameters.
248
- * @returns The transaction hash.
249
- */
250
- rebalanceSwap: (
251
- parameters: ammActions.rebalanceSwap.Parameters<chain, account>,
252
- ) => Promise<ammActions.rebalanceSwap.ReturnValue>
253
- /**
254
- * Swaps tokens during a rebalance operation and waits for confirmation.
255
- *
256
- * @example
257
- * ```ts
258
- * import { createClient, http } from 'viem'
259
- * import { privateKeyToAccount } from 'viem/accounts'
260
- * import { tempo } from 'tempo.ts/chains'
261
- * import { tempoActions } from 'tempo.ts/viem'
262
- *
263
- * const client = createClient({
264
- * account: privateKeyToAccount('0x...'),
265
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
266
- * transport: http(),
267
- * }).extend(tempoActions())
268
- *
269
- * const { receipt, ...result } = await client.amm.rebalanceSwapSync({
270
- * userToken: '0x...',
271
- * validatorToken: '0x...',
272
- * amountOut: 100n,
273
- * to: '0x...',
274
- * })
275
- * ```
276
- *
277
- * @param parameters - Parameters.
278
- * @returns The transaction receipt and event data.
279
- */
280
- rebalanceSwapSync: (
281
- parameters: ammActions.rebalanceSwapSync.Parameters<chain, account>,
282
- ) => Promise<ammActions.rebalanceSwapSync.ReturnValue>
283
- /**
284
- * Watches for burn (liquidity removal) events.
285
- *
286
- * @example
287
- * ```ts
288
- * import { createClient, http } from 'viem'
289
- * import { tempo } from 'tempo.ts/chains'
290
- * import { tempoActions } from 'tempo.ts/viem'
291
- *
292
- * const client = createClient({
293
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
294
- * transport: http(),
295
- * }).extend(tempoActions())
296
- *
297
- * const unwatch = client.amm.watchBurn({
298
- * onBurn: (args, log) => {
299
- * console.log('Liquidity removed:', args)
300
- * },
301
- * })
302
- * ```
303
- *
304
- * @param parameters - Parameters.
305
- * @returns A function to unsubscribe from the event.
306
- */
307
- watchBurn: (parameters: ammActions.watchBurn.Parameters) => () => void
308
- /**
309
- * Watches for fee swap events.
310
- *
311
- * @example
312
- * ```ts
313
- * import { createClient, http } from 'viem'
314
- * import { tempo } from 'tempo.ts/chains'
315
- * import { tempoActions } from 'tempo.ts/viem'
316
- *
317
- * const client = createClient({
318
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
319
- * transport: http(),
320
- * }).extend(tempoActions())
321
- *
322
- * const unwatch = client.amm.watchFeeSwap({
323
- * onFeeSwap: (args, log) => {
324
- * console.log('Fee swap:', args)
325
- * },
326
- * })
327
- * ```
328
- *
329
- * @param parameters - Parameters.
330
- * @returns A function to unsubscribe from the event.
331
- */
332
- watchFeeSwap: (parameters: ammActions.watchFeeSwap.Parameters) => () => void
333
- /**
334
- * Watches for liquidity mint events.
335
- *
336
- * @example
337
- * ```ts
338
- * import { createClient, http } from 'viem'
339
- * import { tempo } from 'tempo.ts/chains'
340
- * import { tempoActions } from 'tempo.ts/viem'
341
- *
342
- * const client = createClient({
343
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
344
- * transport: http(),
345
- * }).extend(tempoActions())
346
- *
347
- * const unwatch = client.amm.watchMint({
348
- * onMint: (args, log) => {
349
- * console.log('Liquidity added:', args)
350
- * },
351
- * })
352
- * ```
353
- *
354
- * @param parameters - Parameters.
355
- * @returns A function to unsubscribe from the event.
356
- */
357
- watchMint: (parameters: ammActions.watchMint.Parameters) => () => void
358
- /**
359
- * Watches for rebalance swap events.
360
- *
361
- * @example
362
- * ```ts
363
- * import { createClient, http } from 'viem'
364
- * import { tempo } from 'tempo.ts/chains'
365
- * import { tempoActions } from 'tempo.ts/viem'
366
- *
367
- * const client = createClient({
368
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
369
- * transport: http(),
370
- * }).extend(tempoActions())
371
- *
372
- * const unwatch = client.amm.watchRebalanceSwap({
373
- * onRebalanceSwap: (args, log) => {
374
- * console.log('Rebalance swap:', args)
375
- * },
376
- * })
377
- * ```
378
- *
379
- * @param parameters - Parameters.
380
- * @returns A function to unsubscribe from the event.
381
- */
382
- watchRebalanceSwap: (
383
- parameters: ammActions.watchRebalanceSwap.Parameters,
384
- ) => () => void
385
- }
386
- dex: {
387
- /**
388
- * Buys a specific amount of tokens.
389
- *
390
- * @example
391
- * ```ts
392
- * import { createClient, http } from 'viem'
393
- * import { privateKeyToAccount } from 'viem/accounts'
394
- * import { tempo } from 'tempo.ts/chains'
395
- * import { tempoActions } from 'tempo.ts/viem'
396
- *
397
- * const client = createClient({
398
- * account: privateKeyToAccount('0x...'),
399
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
400
- * transport: http(),
401
- * }).extend(tempoActions())
402
- *
403
- * const hash = await client.dex.buy({
404
- * tokenIn: '0x20c...11',
405
- * tokenOut: '0x20c...20',
406
- * amountOut: 100n,
407
- * maxAmountIn: 105n,
408
- * })
409
- * ```
410
- *
411
- * @param parameters - Parameters.
412
- * @returns The transaction hash.
413
- */
414
- buy: (
415
- parameters: dexActions.buy.Parameters<chain, account>,
416
- ) => Promise<dexActions.buy.ReturnValue>
417
- /**
418
- * Buys a specific amount of tokens.
419
- *
420
- * @example
421
- * ```ts
422
- * import { createClient, http } from 'viem'
423
- * import { privateKeyToAccount } from 'viem/accounts'
424
- * import { tempo } from 'tempo.ts/chains'
425
- * import { tempoActions } from 'tempo.ts/viem'
426
- *
427
- * const client = createClient({
428
- * account: privateKeyToAccount('0x...'),
429
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
430
- * transport: http(),
431
- * }).extend(tempoActions())
432
- *
433
- * const result = await client.dex.buySync({
434
- * tokenIn: '0x20c...11',
435
- * tokenOut: '0x20c...20',
436
- * amountOut: 100n,
437
- * maxAmountIn: 105n,
438
- * })
439
- * ```
440
- *
441
- * @param parameters - Parameters.
442
- * @returns The transaction receipt.
443
- */
444
- buySync: (
445
- parameters: dexActions.buySync.Parameters<chain, account>,
446
- ) => Promise<dexActions.buySync.ReturnValue>
447
- /**
448
- * Cancels an order from the orderbook.
449
- *
450
- * @example
451
- * ```ts
452
- * import { createClient, http } from 'viem'
453
- * import { privateKeyToAccount } from 'viem/accounts'
454
- * import { tempo } from 'tempo.ts/chains'
455
- * import { tempoActions } from 'tempo.ts/viem'
456
- *
457
- * const client = createClient({
458
- * account: privateKeyToAccount('0x...'),
459
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
460
- * transport: http(),
461
- * }).extend(tempoActions())
462
- *
463
- * const hash = await client.dex.cancel({
464
- * orderId: 123n,
465
- * })
466
- * ```
467
- *
468
- * @param parameters - Parameters.
469
- * @returns The transaction hash.
470
- */
471
- cancel: (
472
- parameters: dexActions.cancel.Parameters<chain, account>,
473
- ) => Promise<dexActions.cancel.ReturnValue>
474
- /**
475
- * Cancels an order from the orderbook.
476
- *
477
- * @example
478
- * ```ts
479
- * import { createClient, http } from 'viem'
480
- * import { privateKeyToAccount } from 'viem/accounts'
481
- * import { tempo } from 'tempo.ts/chains'
482
- * import { tempoActions } from 'tempo.ts/viem'
483
- *
484
- * const client = createClient({
485
- * account: privateKeyToAccount('0x...'),
486
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
487
- * transport: http(),
488
- * }).extend(tempoActions())
489
- *
490
- * const result = await client.dex.cancelSync({
491
- * orderId: 123n,
492
- * })
493
- * ```
494
- *
495
- * @param parameters - Parameters.
496
- * @returns The transaction receipt and event data.
497
- */
498
- cancelSync: (
499
- parameters: dexActions.cancelSync.Parameters<chain, account>,
500
- ) => Promise<dexActions.cancelSync.ReturnValue>
501
- /**
502
- * Creates a new trading pair on the DEX.
503
- *
504
- * @example
505
- * ```ts
506
- * import { createClient, http } from 'viem'
507
- * import { privateKeyToAccount } from 'viem/accounts'
508
- * import { tempo } from 'tempo.ts/chains'
509
- * import { tempoActions } from 'tempo.ts/viem'
510
- *
511
- * const client = createClient({
512
- * account: privateKeyToAccount('0x...'),
513
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
514
- * transport: http(),
515
- * }).extend(tempoActions())
516
- *
517
- * const hash = await client.dex.createPair({
518
- * base: '0x20c...11',
519
- * })
520
- * ```
521
- *
522
- * @param parameters - Parameters.
523
- * @returns The transaction hash.
524
- */
525
- createPair: (
526
- parameters: dexActions.createPair.Parameters<chain, account>,
527
- ) => Promise<dexActions.createPair.ReturnValue>
528
- /**
529
- * Creates a new trading pair on the DEX.
530
- *
531
- * @example
532
- * ```ts
533
- * import { createClient, http } from 'viem'
534
- * import { privateKeyToAccount } from 'viem/accounts'
535
- * import { tempo } from 'tempo.ts/chains'
536
- * import { tempoActions } from 'tempo.ts/viem'
537
- *
538
- * const client = createClient({
539
- * account: privateKeyToAccount('0x...'),
540
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
541
- * transport: http(),
542
- * }).extend(tempoActions())
543
- *
544
- * const result = await client.dex.createPairSync({
545
- * base: '0x20c...11',
546
- * })
547
- * ```
548
- *
549
- * @param parameters - Parameters.
550
- * @returns The transaction receipt and event data.
551
- */
552
- createPairSync: (
553
- parameters: dexActions.createPairSync.Parameters<chain, account>,
554
- ) => Promise<dexActions.createPairSync.ReturnValue>
555
- /**
556
- * Gets a user's token balance on the DEX.
557
- *
558
- * @example
559
- * ```ts
560
- * import { createClient, http } from 'viem'
561
- * import { tempo } from 'tempo.ts/chains'
562
- * import { tempoActions } from 'tempo.ts/viem'
563
- *
564
- * const client = createClient({
565
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
566
- * transport: http(),
567
- * }).extend(tempoActions())
568
- *
569
- * const balance = await client.dex.getBalance({
570
- * account: '0x...',
571
- * token: '0x20c...11',
572
- * })
573
- * ```
574
- *
575
- * @param parameters - Parameters.
576
- * @returns The user's token balance on the DEX.
577
- */
578
- getBalance: (
579
- parameters: dexActions.getBalance.Parameters<account>,
580
- ) => Promise<dexActions.getBalance.ReturnValue>
581
- /**
582
- * Gets the quote for buying a specific amount of tokens.
583
- *
584
- * @example
585
- * ```ts
586
- * import { createClient, http } from 'viem'
587
- * import { tempo } from 'tempo.ts/chains'
588
- * import { tempoActions } from 'tempo.ts/viem'
589
- *
590
- * const client = createClient({
591
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
592
- * transport: http(),
593
- * }).extend(tempoActions())
594
- *
595
- * const amountIn = await client.dex.getBuyQuote({
596
- * tokenIn: '0x20c...11',
597
- * tokenOut: '0x20c...20',
598
- * amountOut: 100n,
599
- * })
600
- * ```
601
- *
602
- * @param parameters - Parameters.
603
- * @returns The amount of tokenIn needed to buy the specified amountOut.
604
- */
605
- getBuyQuote: (
606
- parameters: dexActions.getBuyQuote.Parameters,
607
- ) => Promise<dexActions.getBuyQuote.ReturnValue>
608
- /**
609
- * Gets an order's details from the orderbook.
610
- *
611
- * @example
612
- * ```ts
613
- * import { createClient, http } from 'viem'
614
- * import { tempo } from 'tempo.ts/chains'
615
- * import { tempoActions } from 'tempo.ts/viem'
616
- *
617
- * const client = createClient({
618
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
619
- * transport: http(),
620
- * }).extend(tempoActions())
621
- *
622
- * const order = await client.dex.getOrder({
623
- * orderId: 123n,
624
- * })
625
- * ```
626
- *
627
- * @param parameters - Parameters.
628
- * @returns The order details.
629
- */
630
- getOrder: (
631
- parameters: dexActions.getOrder.Parameters,
632
- ) => Promise<dexActions.getOrder.ReturnValue>
633
- /**
634
- * Gets the price level information at a specific tick.
635
- *
636
- * @example
637
- * ```ts
638
- * import { createClient, http } from 'viem'
639
- * import { tempo } from 'tempo.ts/chains'
640
- * import { tempoActions, Tick } from 'tempo.ts/viem'
641
- *
642
- * const client = createClient({
643
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
644
- * transport: http(),
645
- * }).extend(tempoActions())
646
- *
647
- * const level = await client.dex.getTickLevel({
648
- * base: '0x20c...11',
649
- * tick: Tick.fromPrice('1.001'),
650
- * isBid: true,
651
- * })
652
- * ```
653
- *
654
- * @param parameters - Parameters.
655
- * @returns The price level information.
656
- */
657
- getTickLevel: (
658
- parameters: dexActions.getTickLevel.Parameters,
659
- ) => Promise<dexActions.getTickLevel.ReturnValue>
660
- /**
661
- * Gets the quote for selling a specific amount of tokens.
662
- *
663
- * @example
664
- * ```ts
665
- * import { createClient, http } from 'viem'
666
- * import { tempo } from 'tempo.ts/chains'
667
- * import { tempoActions } from 'tempo.ts/viem'
668
- *
669
- * const client = createClient({
670
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
671
- * transport: http(),
672
- * }).extend(tempoActions())
673
- *
674
- * const amountOut = await client.dex.getSellQuote({
675
- * tokenIn: '0x20c...11',
676
- * tokenOut: '0x20c...20',
677
- * amountIn: 100n,
678
- * })
679
- * ```
680
- *
681
- * @param parameters - Parameters.
682
- * @returns The amount of tokenOut received for selling the specified amountIn.
683
- */
684
- getSellQuote: (
685
- parameters: dexActions.getSellQuote.Parameters,
686
- ) => Promise<dexActions.getSellQuote.ReturnValue>
687
- /**
688
- * Places a limit order on the orderbook.
689
- *
690
- * @example
691
- * ```ts
692
- * import { createClient, http } from 'viem'
693
- * import { privateKeyToAccount } from 'viem/accounts'
694
- * import { tempo } from 'tempo.ts/chains'
695
- * import { tempoActions, Tick } from 'tempo.ts/viem'
696
- *
697
- * const client = createClient({
698
- * account: privateKeyToAccount('0x...'),
699
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
700
- * transport: http(),
701
- * }).extend(tempoActions())
702
- *
703
- * const hash = await client.dex.place({
704
- * token: '0x20c...11',
705
- * amount: 100n,
706
- * type: 'buy',
707
- * tick: Tick.fromPrice('0.99'),
708
- * })
709
- * ```
710
- *
711
- * @param parameters - Parameters.
712
- * @returns The transaction hash.
713
- */
714
- place: (
715
- parameters: dexActions.place.Parameters<chain, account>,
716
- ) => Promise<dexActions.place.ReturnValue>
717
- /**
718
- * Places a limit order on the orderbook.
719
- *
720
- * @example
721
- * ```ts
722
- * import { createClient, http } from 'viem'
723
- * import { privateKeyToAccount } from 'viem/accounts'
724
- * import { tempo } from 'tempo.ts/chains'
725
- * import { tempoActions, Tick } from 'tempo.ts/viem'
726
- *
727
- * const client = createClient({
728
- * account: privateKeyToAccount('0x...'),
729
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
730
- * transport: http(),
731
- * }).extend(tempoActions())
732
- *
733
- * const result = await client.dex.placeSync({
734
- * token: '0x20c...11',
735
- * amount: 100n,
736
- * type: 'buy',
737
- * tick: Tick.fromPrice('0.99'),
738
- * })
739
- * ```
740
- *
741
- * @param parameters - Parameters.
742
- * @returns The transaction receipt and event data.
743
- */
744
- placeSync: (
745
- parameters: dexActions.placeSync.Parameters<chain, account>,
746
- ) => Promise<dexActions.placeSync.ReturnValue>
747
- /**
748
- * Places a flip order that automatically flips when filled.
749
- *
750
- * @example
751
- * ```ts
752
- * import { createClient, http } from 'viem'
753
- * import { privateKeyToAccount } from 'viem/accounts'
754
- * import { tempo } from 'tempo.ts/chains'
755
- * import { tempoActions, Tick } from 'tempo.ts/viem'
756
- *
757
- * const client = createClient({
758
- * account: privateKeyToAccount('0x...'),
759
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
760
- * transport: http(),
761
- * }).extend(tempoActions())
762
- *
763
- * const hash = await client.dex.placeFlip({
764
- * token: '0x20c...11',
765
- * amount: 100n,
766
- * type: 'buy',
767
- * tick: Tick.fromPrice('0.99'),
768
- * flipTick: Tick.fromPrice('1.01'),
769
- * })
770
- * ```
771
- *
772
- * @param parameters - Parameters.
773
- * @returns The transaction hash.
774
- */
775
- placeFlip: (
776
- parameters: dexActions.placeFlip.Parameters<chain, account>,
777
- ) => Promise<dexActions.placeFlip.ReturnValue>
778
- /**
779
- * Places a flip order that automatically flips when filled.
780
- *
781
- * @example
782
- * ```ts
783
- * import { createClient, http } from 'viem'
784
- * import { privateKeyToAccount } from 'viem/accounts'
785
- * import { tempo } from 'tempo.ts/chains'
786
- * import { tempoActions, Tick } from 'tempo.ts/viem'
787
- *
788
- * const client = createClient({
789
- * account: privateKeyToAccount('0x...'),
790
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
791
- * transport: http(),
792
- * }).extend(tempoActions())
793
- *
794
- * const result = await client.dex.placeFlipSync({
795
- * token: '0x20c...11',
796
- * amount: 100n,
797
- * type: 'buy',
798
- * tick: Tick.fromPrice('0.99'),
799
- * flipTick: Tick.fromPrice('1.01'),
800
- * })
801
- * ```
802
- *
803
- * @param parameters - Parameters.
804
- * @returns The transaction receipt and event data.
805
- */
806
- placeFlipSync: (
807
- parameters: dexActions.placeFlipSync.Parameters<chain, account>,
808
- ) => Promise<dexActions.placeFlipSync.ReturnValue>
809
- /**
810
- * Sells a specific amount of tokens.
811
- *
812
- * @example
813
- * ```ts
814
- * import { createClient, http } from 'viem'
815
- * import { privateKeyToAccount } from 'viem/accounts'
816
- * import { tempo } from 'tempo.ts/chains'
817
- * import { tempoActions } from 'tempo.ts/viem'
818
- *
819
- * const client = createClient({
820
- * account: privateKeyToAccount('0x...'),
821
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
822
- * transport: http(),
823
- * }).extend(tempoActions())
824
- *
825
- * const hash = await client.dex.sell({
826
- * tokenIn: '0x20c...11',
827
- * tokenOut: '0x20c...20',
828
- * amountIn: 100n,
829
- * minAmountOut: 95n,
830
- * })
831
- * ```
832
- *
833
- * @param parameters - Parameters.
834
- * @returns The transaction hash.
835
- */
836
- sell: (
837
- parameters: dexActions.sell.Parameters<chain, account>,
838
- ) => Promise<dexActions.sell.ReturnValue>
839
- /**
840
- * Sells a specific amount of tokens.
841
- *
842
- * @example
843
- * ```ts
844
- * import { createClient, http } from 'viem'
845
- * import { privateKeyToAccount } from 'viem/accounts'
846
- * import { tempo } from 'tempo.ts/chains'
847
- * import { tempoActions } from 'tempo.ts/viem'
848
- *
849
- * const client = createClient({
850
- * account: privateKeyToAccount('0x...'),
851
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
852
- * transport: http(),
853
- * }).extend(tempoActions())
854
- *
855
- * const result = await client.dex.sellSync({
856
- * tokenIn: '0x20c...11',
857
- * tokenOut: '0x20c...20',
858
- * amountIn: 100n,
859
- * minAmountOut: 95n,
860
- * })
861
- * ```
862
- *
863
- * @param parameters - Parameters.
864
- * @returns The transaction receipt.
865
- */
866
- sellSync: (
867
- parameters: dexActions.sellSync.Parameters<chain, account>,
868
- ) => Promise<dexActions.sellSync.ReturnValue>
869
- /**
870
- * Withdraws tokens from the DEX to the caller's wallet.
871
- *
872
- * @example
873
- * ```ts
874
- * import { createClient, http } from 'viem'
875
- * import { privateKeyToAccount } from 'viem/accounts'
876
- * import { tempo } from 'tempo.ts/chains'
877
- * import { tempoActions } from 'tempo.ts/viem'
878
- *
879
- * const client = createClient({
880
- * account: privateKeyToAccount('0x...'),
881
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
882
- * transport: http(),
883
- * }).extend(tempoActions())
884
- *
885
- * const hash = await client.dex.withdraw({
886
- * token: '0x20c...11',
887
- * amount: 100n,
888
- * })
889
- * ```
890
- *
891
- * @param parameters - Parameters.
892
- * @returns The transaction hash.
893
- */
894
- withdraw: (
895
- parameters: dexActions.withdraw.Parameters<chain, account>,
896
- ) => Promise<dexActions.withdraw.ReturnValue>
897
- /**
898
- * Withdraws tokens from the DEX to the caller's wallet.
899
- *
900
- * @example
901
- * ```ts
902
- * import { createClient, http } from 'viem'
903
- * import { privateKeyToAccount } from 'viem/accounts'
904
- * import { tempo } from 'tempo.ts/chains'
905
- * import { tempoActions } from 'tempo.ts/viem'
906
- *
907
- * const client = createClient({
908
- * account: privateKeyToAccount('0x...'),
909
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
910
- * transport: http(),
911
- * }).extend(tempoActions())
912
- *
913
- * const result = await client.dex.withdrawSync({
914
- * token: '0x20c...11',
915
- * amount: 100n,
916
- * })
917
- * ```
918
- *
919
- * @param parameters - Parameters.
920
- * @returns The transaction receipt.
921
- */
922
- withdrawSync: (
923
- parameters: dexActions.withdrawSync.Parameters<chain, account>,
924
- ) => Promise<dexActions.withdrawSync.ReturnValue>
925
- /**
926
- * Watches for flip order placed events.
927
- *
928
- * @example
929
- * ```ts
930
- * import { createClient, http } from 'viem'
931
- * import { tempo } from 'tempo.ts/chains'
932
- * import { tempoActions } from 'tempo.ts/viem'
933
- *
934
- * const client = createClient({
935
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
936
- * transport: http(),
937
- * }).extend(tempoActions())
938
- *
939
- * const unwatch = client.dex.watchFlipOrderPlaced({
940
- * onFlipOrderPlaced: (args, log) => {
941
- * console.log('Flip order placed:', args)
942
- * },
943
- * })
944
- * ```
945
- *
946
- * @param parameters - Parameters.
947
- * @returns A function to unsubscribe from the event.
948
- */
949
- watchFlipOrderPlaced: (
950
- parameters: dexActions.watchFlipOrderPlaced.Parameters,
951
- ) => () => void
952
- /**
953
- * Watches for order cancelled events.
954
- *
955
- * @example
956
- * ```ts
957
- * import { createClient, http } from 'viem'
958
- * import { tempo } from 'tempo.ts/chains'
959
- * import { tempoActions } from 'tempo.ts/viem'
960
- *
961
- * const client = createClient({
962
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
963
- * transport: http(),
964
- * }).extend(tempoActions())
965
- *
966
- * const unwatch = client.dex.watchOrderCancelled({
967
- * onOrderCancelled: (args, log) => {
968
- * console.log('Order cancelled:', args)
969
- * },
970
- * })
971
- * ```
972
- *
973
- * @param parameters - Parameters.
974
- * @returns A function to unsubscribe from the event.
975
- */
976
- watchOrderCancelled: (
977
- parameters: dexActions.watchOrderCancelled.Parameters,
978
- ) => () => void
979
- /**
980
- * Watches for order filled events.
981
- *
982
- * @example
983
- * ```ts
984
- * import { createClient, http } from 'viem'
985
- * import { tempo } from 'tempo.ts/chains'
986
- * import { tempoActions } from 'tempo.ts/viem'
987
- *
988
- * const client = createClient({
989
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
990
- * transport: http(),
991
- * }).extend(tempoActions())
992
- *
993
- * const unwatch = client.dex.watchOrderFilled({
994
- * onOrderFilled: (args, log) => {
995
- * console.log('Order filled:', args)
996
- * },
997
- * })
998
- * ```
999
- *
1000
- * @param parameters - Parameters.
1001
- * @returns A function to unsubscribe from the event.
1002
- */
1003
- watchOrderFilled: (
1004
- parameters: dexActions.watchOrderFilled.Parameters,
1005
- ) => () => void
1006
- /**
1007
- * Watches for order placed events.
1008
- *
1009
- * @example
1010
- * ```ts
1011
- * import { createClient, http } from 'viem'
1012
- * import { tempo } from 'tempo.ts/chains'
1013
- * import { tempoActions } from 'tempo.ts/viem'
1014
- *
1015
- * const client = createClient({
1016
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
1017
- * transport: http(),
1018
- * }).extend(tempoActions())
1019
- *
1020
- * const unwatch = client.dex.watchOrderPlaced({
1021
- * onOrderPlaced: (args, log) => {
1022
- * console.log('Order placed:', args)
1023
- * },
1024
- * })
1025
- * ```
1026
- *
1027
- * @param parameters - Parameters.
1028
- * @returns A function to unsubscribe from the event.
1029
- */
1030
- watchOrderPlaced: (
1031
- parameters: dexActions.watchOrderPlaced.Parameters,
1032
- ) => () => void
1033
- }
1034
- faucet: {
1035
- /**
1036
- * Funds an account with an initial amount of set token(s)
1037
- * on Tempo's testnet.
1038
- *
1039
- * @example
1040
- * ```ts
1041
- * import { createClient, http } from 'viem'
1042
- * import { tempo } from 'tempo.ts/chains'
1043
- * import { tempoActions } from 'tempo.ts/viem'
1044
- *
1045
- * const client = createClient({
1046
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
1047
- * transport: http(),
1048
- * }).extend(tempoActions())
1049
- *
1050
- * const hashes = await client.faucet.fund({
1051
- * account: '0xdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef',
1052
- * })
1053
- * ```
1054
- *
1055
- * @param parameters - Parameters.
1056
- * @returns The transaction hashes.
1057
- */
1058
- fund: (
1059
- parameters: faucetActions.fund.Parameters,
1060
- ) => Promise<faucetActions.fund.ReturnValue>
1061
- }
1062
- fee: {
1063
- /**
1064
- * Gets the user's default fee token.
1065
- *
1066
- * @example
1067
- * ```ts
1068
- * import { createClient, http } from 'viem'
1069
- * import { privateKeyToAccount } from 'viem/accounts'
1070
- * import { tempo } from 'tempo.ts/chains'
1071
- * import { tempoActions } from 'tempo.ts/viem'
1072
- *
1073
- * const client = createClient({
1074
- * account: privateKeyToAccount('0x...'),
1075
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
1076
- * transport: http(),
1077
- * }).extend(tempoActions())
1078
- *
1079
- * const { address, id } = await client.token.getUserToken()
1080
- * ```
1081
- *
1082
- * @param client - Client.
1083
- * @param parameters - Parameters.
1084
- * @returns The transaction hash.
1085
- */
1086
- getUserToken: (
1087
- ...parameters: account extends Account
1088
- ? [feeActions.getUserToken.Parameters<account>] | []
1089
- : [feeActions.getUserToken.Parameters<account>]
1090
- ) => Promise<feeActions.getUserToken.ReturnValue>
1091
- /**
1092
- * Sets the user's default fee token.
1093
- *
1094
- * @example
1095
- * ```ts
1096
- * import { createClient, http } from 'viem'
1097
- * import { privateKeyToAccount } from 'viem/accounts'
1098
- * import { tempo } from 'tempo.ts/chains'
1099
- * import { tempoActions } from 'tempo.ts/viem'
1100
- *
1101
- * const client = createClient({
1102
- * account: privateKeyToAccount('0x...'),
1103
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
1104
- * transport: http(),
1105
- * }).extend(tempoActions())
1106
- *
1107
- * const hash = await client.token.setUserToken({
1108
- * token: '0x...',
1109
- * })
1110
- * ```
1111
- *
1112
- * @param client - Client.
1113
- * @param parameters - Parameters.
1114
- * @returns The transaction hash.
1115
- */
1116
- setUserToken: (
1117
- parameters: feeActions.setUserToken.Parameters<chain, account>,
1118
- ) => Promise<feeActions.setUserToken.ReturnValue>
1119
- /**
1120
- * Sets the user's default fee token.
1121
- *
1122
- * @example
1123
- * ```ts
1124
- * import { createClient, http } from 'viem'
1125
- * import { privateKeyToAccount } from 'viem/accounts'
1126
- * import { tempo } from 'tempo.ts/chains'
1127
- * import { tempoActions } from 'tempo.ts/viem'
1128
- *
1129
- * const client = createClient({
1130
- * account: privateKeyToAccount('0x...'),
1131
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
1132
- * transport: http(),
1133
- * }).extend(tempoActions())
1134
- *
1135
- * const result = await client.fee.setUserTokenSync({
1136
- * token: '0x...',
1137
- * })
1138
- * ```
1139
- *
1140
- * @param parameters - Parameters.
1141
- * @returns The transaction receipt and event data.
1142
- */
1143
- setUserTokenSync: (
1144
- parameters: feeActions.setUserTokenSync.Parameters<chain, account>,
1145
- ) => Promise<feeActions.setUserTokenSync.ReturnValue>
1146
- /**
1147
- * Watches for user token set events.
1148
- *
1149
- * @example
1150
- * ```ts
1151
- * import { createClient, http } from 'viem'
1152
- * import { tempo } from 'tempo.ts/chains'
1153
- * import { tempoActions } from 'tempo.ts/viem'
1154
- *
1155
- * const client = createClient({
1156
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
1157
- * transport: http(),
1158
- * }).extend(tempoActions())
1159
- *
1160
- * const unwatch = client.token.watchSetUserToken({
1161
- * onUserTokenSet: (args, log) => {
1162
- * console.log('User token set:', args)
1163
- * },
1164
- * })
1165
- * ```
1166
- *
1167
- * @param client - Client.
1168
- * @param parameters - Parameters.
1169
- * @returns A function to unsubscribe from the event.
1170
- */
1171
- watchSetUserToken: (
1172
- parameters: feeActions.watchSetUserToken.Parameters,
1173
- ) => () => void
1174
- }
1175
- policy: {
1176
- /**
1177
- * Creates a new policy.
1178
- *
1179
- * @example
1180
- * ```ts
1181
- * import { createClient, http } from 'viem'
1182
- * import { privateKeyToAccount } from 'viem/accounts'
1183
- * import { tempo } from 'tempo.ts/chains'
1184
- * import { tempoActions } from 'tempo.ts/viem'
1185
- *
1186
- * const client = createClient({
1187
- * account: privateKeyToAccount('0x...'),
1188
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
1189
- * transport: http(),
1190
- * }).extend(tempoActions())
1191
- *
1192
- * const hash = await client.policy.create({
1193
- * admin: '0x...',
1194
- * type: 'whitelist',
1195
- * })
1196
- * ```
1197
- *
1198
- * @param parameters - Parameters.
1199
- * @returns The transaction hash.
1200
- */
1201
- create: (
1202
- parameters: policyActions.create.Parameters<chain, account>,
1203
- ) => Promise<policyActions.create.ReturnValue>
1204
- /**
1205
- * Creates a new policy.
1206
- *
1207
- * @example
1208
- * ```ts
1209
- * import { createClient, http } from 'viem'
1210
- * import { privateKeyToAccount } from 'viem/accounts'
1211
- * import { tempo } from 'tempo.ts/chains'
1212
- * import { tempoActions } from 'tempo.ts/viem'
1213
- *
1214
- * const client = createClient({
1215
- * account: privateKeyToAccount('0x...'),
1216
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
1217
- * transport: http(),
1218
- * }).extend(tempoActions())
1219
- *
1220
- * const result = await client.policy.createSync({
1221
- * admin: '0x...',
1222
- * type: 'whitelist',
1223
- * })
1224
- * ```
1225
- *
1226
- * @param parameters - Parameters.
1227
- * @returns The transaction receipt and event data.
1228
- */
1229
- createSync: (
1230
- parameters: policyActions.createSync.Parameters<chain, account>,
1231
- ) => Promise<policyActions.createSync.ReturnValue>
1232
- /**
1233
- * Sets the admin for a policy.
1234
- *
1235
- * @example
1236
- * ```ts
1237
- * import { createClient, http } from 'viem'
1238
- * import { privateKeyToAccount } from 'viem/accounts'
1239
- * import { tempo } from 'tempo.ts/chains'
1240
- * import { tempoActions } from 'tempo.ts/viem'
1241
- *
1242
- * const client = createClient({
1243
- * account: privateKeyToAccount('0x...'),
1244
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
1245
- * transport: http(),
1246
- * }).extend(tempoActions())
1247
- *
1248
- * const hash = await client.policy.setAdmin({
1249
- * policyId: 2n,
1250
- * admin: '0x...',
1251
- * })
1252
- * ```
1253
- *
1254
- * @param parameters - Parameters.
1255
- * @returns The transaction hash.
1256
- */
1257
- setAdmin: (
1258
- parameters: policyActions.setAdmin.Parameters<chain, account>,
1259
- ) => Promise<policyActions.setAdmin.ReturnValue>
1260
- /**
1261
- * Sets the admin for a policy.
1262
- *
1263
- * @example
1264
- * ```ts
1265
- * import { createClient, http } from 'viem'
1266
- * import { privateKeyToAccount } from 'viem/accounts'
1267
- * import { tempo } from 'tempo.ts/chains'
1268
- * import { tempoActions } from 'tempo.ts/viem'
1269
- *
1270
- * const client = createClient({
1271
- * account: privateKeyToAccount('0x...'),
1272
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
1273
- * transport: http(),
1274
- * }).extend(tempoActions())
1275
- *
1276
- * const result = await client.policy.setAdminSync({
1277
- * policyId: 2n,
1278
- * admin: '0x...',
1279
- * })
1280
- * ```
1281
- *
1282
- * @param parameters - Parameters.
1283
- * @returns The transaction receipt and event data.
1284
- */
1285
- setAdminSync: (
1286
- parameters: policyActions.setAdminSync.Parameters<chain, account>,
1287
- ) => Promise<policyActions.setAdminSync.ReturnValue>
1288
- /**
1289
- * Modifies a policy whitelist.
1290
- *
1291
- * @example
1292
- * ```ts
1293
- * import { createClient, http } from 'viem'
1294
- * import { privateKeyToAccount } from 'viem/accounts'
1295
- * import { tempo } from 'tempo.ts/chains'
1296
- * import { tempoActions } from 'tempo.ts/viem'
1297
- *
1298
- * const client = createClient({
1299
- * account: privateKeyToAccount('0x...'),
1300
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
1301
- * transport: http(),
1302
- * }).extend(tempoActions())
1303
- *
1304
- * const hash = await client.policy.modifyWhitelist({
1305
- * policyId: 2n,
1306
- * address: '0x...',
1307
- * allowed: true,
1308
- * })
1309
- * ```
1310
- *
1311
- * @param parameters - Parameters.
1312
- * @returns The transaction hash.
1313
- */
1314
- modifyWhitelist: (
1315
- parameters: policyActions.modifyWhitelist.Parameters<chain, account>,
1316
- ) => Promise<policyActions.modifyWhitelist.ReturnValue>
1317
- /**
1318
- * Modifies a policy whitelist.
1319
- *
1320
- * @example
1321
- * ```ts
1322
- * import { createClient, http } from 'viem'
1323
- * import { privateKeyToAccount } from 'viem/accounts'
1324
- * import { tempo } from 'tempo.ts/chains'
1325
- * import { tempoActions } from 'tempo.ts/viem'
1326
- *
1327
- * const client = createClient({
1328
- * account: privateKeyToAccount('0x...'),
1329
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
1330
- * transport: http(),
1331
- * }).extend(tempoActions())
1332
- *
1333
- * const result = await client.policy.modifyWhitelistSync({
1334
- * policyId: 2n,
1335
- * address: '0x...',
1336
- * allowed: true,
1337
- * })
1338
- * ```
1339
- *
1340
- * @param parameters - Parameters.
1341
- * @returns The transaction receipt and event data.
1342
- */
1343
- modifyWhitelistSync: (
1344
- parameters: policyActions.modifyWhitelistSync.Parameters<chain, account>,
1345
- ) => Promise<policyActions.modifyWhitelistSync.ReturnValue>
1346
- /**
1347
- * Modifies a policy blacklist.
1348
- *
1349
- * @example
1350
- * ```ts
1351
- * import { createClient, http } from 'viem'
1352
- * import { privateKeyToAccount } from 'viem/accounts'
1353
- * import { tempo } from 'tempo.ts/chains'
1354
- * import { tempoActions } from 'tempo.ts/viem'
1355
- *
1356
- * const client = createClient({
1357
- * account: privateKeyToAccount('0x...'),
1358
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
1359
- * transport: http(),
1360
- * }).extend(tempoActions())
1361
- *
1362
- * const hash = await client.policy.modifyBlacklist({
1363
- * policyId: 2n,
1364
- * address: '0x...',
1365
- * restricted: true,
1366
- * })
1367
- * ```
1368
- *
1369
- * @param parameters - Parameters.
1370
- * @returns The transaction hash.
1371
- */
1372
- modifyBlacklist: (
1373
- parameters: policyActions.modifyBlacklist.Parameters<chain, account>,
1374
- ) => Promise<policyActions.modifyBlacklist.ReturnValue>
1375
- /**
1376
- * Modifies a policy blacklist.
1377
- *
1378
- * @example
1379
- * ```ts
1380
- * import { createClient, http } from 'viem'
1381
- * import { privateKeyToAccount } from 'viem/accounts'
1382
- * import { tempo } from 'tempo.ts/chains'
1383
- * import { tempoActions } from 'tempo.ts/viem'
1384
- *
1385
- * const client = createClient({
1386
- * account: privateKeyToAccount('0x...'),
1387
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
1388
- * transport: http(),
1389
- * }).extend(tempoActions())
1390
- *
1391
- * const result = await client.policy.modifyBlacklistSync({
1392
- * policyId: 2n,
1393
- * address: '0x...',
1394
- * restricted: true,
1395
- * })
1396
- * ```
1397
- *
1398
- * @param parameters - Parameters.
1399
- * @returns The transaction receipt and event data.
1400
- */
1401
- modifyBlacklistSync: (
1402
- parameters: policyActions.modifyBlacklistSync.Parameters<chain, account>,
1403
- ) => Promise<policyActions.modifyBlacklistSync.ReturnValue>
1404
- /**
1405
- * Gets policy data.
1406
- *
1407
- * @example
1408
- * ```ts
1409
- * import { createClient, http } from 'viem'
1410
- * import { tempo } from 'tempo.ts/chains'
1411
- * import { tempoActions } from 'tempo.ts/viem'
1412
- *
1413
- * const client = createClient({
1414
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
1415
- * transport: http(),
1416
- * }).extend(tempoActions())
1417
- *
1418
- * const data = await client.policy.getData({
1419
- * policyId: 2n,
1420
- * })
1421
- * ```
1422
- *
1423
- * @param parameters - Parameters.
1424
- * @returns The policy data.
1425
- */
1426
- getData: (
1427
- parameters: policyActions.getData.Parameters,
1428
- ) => Promise<policyActions.getData.ReturnValue>
1429
- /**
1430
- * Checks if a user is authorized by a policy.
1431
- *
1432
- * @example
1433
- * ```ts
1434
- * import { createClient, http } from 'viem'
1435
- * import { tempo } from 'tempo.ts/chains'
1436
- * import { tempoActions } from 'tempo.ts/viem'
1437
- *
1438
- * const client = createClient({
1439
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
1440
- * transport: http(),
1441
- * }).extend(tempoActions())
1442
- *
1443
- * const authorized = await client.policy.isAuthorized({
1444
- * policyId: 2n,
1445
- * user: '0x...',
1446
- * })
1447
- * ```
1448
- *
1449
- * @param parameters - Parameters.
1450
- * @returns Whether the user is authorized.
1451
- */
1452
- isAuthorized: (
1453
- parameters: policyActions.isAuthorized.Parameters,
1454
- ) => Promise<policyActions.isAuthorized.ReturnValue>
1455
- /**
1456
- * Watches for policy creation events.
1457
- *
1458
- * @example
1459
- * ```ts
1460
- * import { createClient, http } from 'viem'
1461
- * import { tempo } from 'tempo.ts/chains'
1462
- * import { tempoActions } from 'tempo.ts/viem'
1463
- *
1464
- * const client = createClient({
1465
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
1466
- * transport: http(),
1467
- * }).extend(tempoActions())
1468
- *
1469
- * const unwatch = client.policy.watchCreate({
1470
- * onPolicyCreated: (args, log) => {
1471
- * console.log('Policy created:', args)
1472
- * },
1473
- * })
1474
- * ```
1475
- *
1476
- * @param parameters - Parameters.
1477
- * @returns A function to unsubscribe from the event.
1478
- */
1479
- watchCreate: (
1480
- parameters: policyActions.watchCreate.Parameters,
1481
- ) => () => void
1482
- /**
1483
- * Watches for policy admin update events.
1484
- *
1485
- * @example
1486
- * ```ts
1487
- * import { createClient, http } from 'viem'
1488
- * import { tempo } from 'tempo.ts/chains'
1489
- * import { tempoActions } from 'tempo.ts/viem'
1490
- *
1491
- * const client = createClient({
1492
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
1493
- * transport: http(),
1494
- * }).extend(tempoActions())
1495
- *
1496
- * const unwatch = client.policy.watchAdminUpdated({
1497
- * onAdminUpdated: (args, log) => {
1498
- * console.log('Policy admin updated:', args)
1499
- * },
1500
- * })
1501
- * ```
1502
- *
1503
- * @param parameters - Parameters.
1504
- * @returns A function to unsubscribe from the event.
1505
- */
1506
- watchAdminUpdated: (
1507
- parameters: policyActions.watchAdminUpdated.Parameters,
1508
- ) => () => void
1509
- /**
1510
- * Watches for whitelist update events.
1511
- *
1512
- * @example
1513
- * ```ts
1514
- * import { createClient, http } from 'viem'
1515
- * import { tempo } from 'tempo.ts/chains'
1516
- * import { tempoActions } from 'tempo.ts/viem'
1517
- *
1518
- * const client = createClient({
1519
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
1520
- * transport: http(),
1521
- * }).extend(tempoActions())
1522
- *
1523
- * const unwatch = client.policy.watchWhitelistUpdated({
1524
- * onWhitelistUpdated: (args, log) => {
1525
- * console.log('Whitelist updated:', args)
1526
- * },
1527
- * })
1528
- * ```
1529
- *
1530
- * @param parameters - Parameters.
1531
- * @returns A function to unsubscribe from the event.
1532
- */
1533
- watchWhitelistUpdated: (
1534
- parameters: policyActions.watchWhitelistUpdated.Parameters,
1535
- ) => () => void
1536
- /**
1537
- * Watches for blacklist update events.
1538
- *
1539
- * @example
1540
- * ```ts
1541
- * import { createClient, http } from 'viem'
1542
- * import { tempo } from 'tempo.ts/chains'
1543
- * import { tempoActions } from 'tempo.ts/viem'
1544
- *
1545
- * const client = createClient({
1546
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
1547
- * transport: http(),
1548
- * }).extend(tempoActions())
1549
- *
1550
- * const unwatch = client.policy.watchBlacklistUpdated({
1551
- * onBlacklistUpdated: (args, log) => {
1552
- * console.log('Blacklist updated:', args)
1553
- * },
1554
- * })
1555
- * ```
1556
- *
1557
- * @param parameters - Parameters.
1558
- * @returns A function to unsubscribe from the event.
1559
- */
1560
- watchBlacklistUpdated: (
1561
- parameters: policyActions.watchBlacklistUpdated.Parameters,
1562
- ) => () => void
1563
- }
1564
- reward: {
1565
- /**
1566
- * Claims accumulated rewards for a recipient.
1567
- *
1568
- * @example
1569
- * ```ts
1570
- * import { createClient, http } from 'viem'
1571
- * import { privateKeyToAccount } from 'viem/accounts'
1572
- * import { tempo } from 'tempo.ts/chains'
1573
- * import { tempoActions } from 'tempo.ts/viem'
1574
- *
1575
- * const client = createClient({
1576
- * account: privateKeyToAccount('0x...'),
1577
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
1578
- * transport: http(),
1579
- * }).extend(tempoActions())
1580
- *
1581
- * const hash = await client.reward.claim({
1582
- * token: '0x20c0000000000000000000000000000000000001',
1583
- * })
1584
- * ```
1585
- *
1586
- * @param parameters - Parameters.
1587
- * @returns The transaction hash.
1588
- */
1589
- claim: (
1590
- parameters: rewardActions.claim.Parameters<chain, account>,
1591
- ) => Promise<rewardActions.claim.ReturnValue>
1592
- /**
1593
- * Claims accumulated rewards for a recipient and waits for confirmation.
1594
- *
1595
- * @example
1596
- * ```ts
1597
- * import { createClient, http } from 'viem'
1598
- * import { privateKeyToAccount } from 'viem/accounts'
1599
- * import { tempo } from 'tempo.ts/chains'
1600
- * import { tempoActions } from 'tempo.ts/viem'
1601
- *
1602
- * const client = createClient({
1603
- * account: privateKeyToAccount('0x...'),
1604
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
1605
- * transport: http(),
1606
- * }).extend(tempoActions())
1607
- *
1608
- * const result = await client.reward.claimSync({
1609
- * token: '0x20c0000000000000000000000000000000000001',
1610
- * })
1611
- * ```
1612
- *
1613
- * @param parameters - Parameters.
1614
- * @returns The amount claimed and transaction receipt.
1615
- */
1616
- claimSync: (
1617
- parameters: rewardActions.claimSync.Parameters<chain, account>,
1618
- ) => Promise<rewardActions.claimSync.ReturnValue>
1619
- /**
1620
- * Gets the total reward per second rate for all active streams.
1621
- *
1622
- * @example
1623
- * ```ts
1624
- * import { createClient, http } from 'viem'
1625
- * import { tempo } from 'tempo.ts/chains'
1626
- * import { tempoActions } from 'tempo.ts/viem'
1627
- *
1628
- * const client = createClient({
1629
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
1630
- * transport: http(),
1631
- * }).extend(tempoActions())
1632
- *
1633
- * const rate = await client.reward.getTotalPerSecond({
1634
- * token: '0x20c0000000000000000000000000000000000001',
1635
- * })
1636
- * ```
1637
- *
1638
- * @param parameters - Parameters.
1639
- * @returns The total reward per second (scaled by 1e18).
1640
- */
1641
- getTotalPerSecond: (
1642
- parameters: rewardActions.getTotalPerSecond.Parameters,
1643
- ) => Promise<rewardActions.getTotalPerSecond.ReturnValue>
1644
- /**
1645
- * Gets the reward information for a specific account.
1646
- *
1647
- * @example
1648
- * ```ts
1649
- * import { createClient, http } from 'viem'
1650
- * import { tempo } from 'tempo.ts/chains'
1651
- * import { tempoActions } from 'tempo.ts/viem'
1652
- *
1653
- * const client = createClient({
1654
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
1655
- * transport: http(),
1656
- * }).extend(tempoActions())
1657
- *
1658
- * const info = await client.reward.getUserRewardInfo({
1659
- * token: '0x20c0000000000000000000000000000000000001',
1660
- * account: '0xa5cc3c03994DB5b0d9A5eEdD10CabaB0813678AC',
1661
- * })
1662
- * ```
1663
- *
1664
- * @param parameters - Parameters.
1665
- * @returns The user's reward information (recipient, rewardPerToken, rewardBalance).
1666
- */
1667
- getUserRewardInfo: (
1668
- parameters: rewardActions.getUserRewardInfo.Parameters,
1669
- ) => Promise<rewardActions.getUserRewardInfo.ReturnValue>
1670
- /**
1671
- * Sets or changes the reward recipient for a token holder.
1672
- *
1673
- * @example
1674
- * ```ts
1675
- * import { createClient, http } from 'viem'
1676
- * import { privateKeyToAccount } from 'viem/accounts'
1677
- * import { tempo } from 'tempo.ts/chains'
1678
- * import { tempoActions } from 'tempo.ts/viem'
1679
- *
1680
- * const client = createClient({
1681
- * account: privateKeyToAccount('0x...'),
1682
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
1683
- * transport: http(),
1684
- * }).extend(tempoActions())
1685
- *
1686
- * const hash = await client.reward.setRecipient({
1687
- * recipient: '0xa5cc3c03994DB5b0d9A5eEdD10CabaB0813678AC',
1688
- * token: '0x20c0000000000000000000000000000000000001',
1689
- * })
1690
- * ```
1691
- *
1692
- * @param parameters - Parameters.
1693
- * @returns The transaction hash.
1694
- */
1695
- setRecipient: (
1696
- parameters: rewardActions.setRecipient.Parameters<chain, account>,
1697
- ) => Promise<rewardActions.setRecipient.ReturnValue>
1698
- /**
1699
- * Sets or changes the reward recipient for a token holder and waits for confirmation.
1700
- *
1701
- * @example
1702
- * ```ts
1703
- * import { createClient, http } from 'viem'
1704
- * import { privateKeyToAccount } from 'viem/accounts'
1705
- * import { tempo } from 'tempo.ts/chains'
1706
- * import { tempoActions } from 'tempo.ts/viem'
1707
- *
1708
- * const client = createClient({
1709
- * account: privateKeyToAccount('0x...'),
1710
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
1711
- * transport: http(),
1712
- * }).extend(tempoActions())
1713
- *
1714
- * const result = await client.reward.setRecipientSync({
1715
- * recipient: '0xa5cc3c03994DB5b0d9A5eEdD10CabaB0813678AC',
1716
- * token: '0x20c0000000000000000000000000000000000001',
1717
- * })
1718
- * ```
1719
- *
1720
- * @param parameters - Parameters.
1721
- * @returns The transaction receipt and event data.
1722
- */
1723
- setRecipientSync: (
1724
- parameters: rewardActions.setRecipientSync.Parameters<chain, account>,
1725
- ) => Promise<rewardActions.setRecipientSync.ReturnValue>
1726
- /**
1727
- * Starts a new reward stream that distributes tokens to opted-in holders.
1728
- *
1729
- * @example
1730
- * ```ts
1731
- * import { createClient, http } from 'viem'
1732
- * import { privateKeyToAccount } from 'viem/accounts'
1733
- * import { tempo } from 'tempo.ts/chains'
1734
- * import { tempoActions } from 'tempo.ts/viem'
1735
- *
1736
- * const client = createClient({
1737
- * account: privateKeyToAccount('0x...'),
1738
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
1739
- * transport: http(),
1740
- * }).extend(tempoActions())
1741
- *
1742
- * const hash = await client.reward.start({
1743
- * amount: 100000000000000000000n,
1744
- * seconds: 86400,
1745
- * token: '0x20c0000000000000000000000000000000000001',
1746
- * })
1747
- * ```
1748
- *
1749
- * @param parameters - Parameters.
1750
- * @returns The transaction hash.
1751
- */
1752
- start: (
1753
- parameters: rewardActions.start.Parameters<chain, account>,
1754
- ) => Promise<rewardActions.start.ReturnValue>
1755
- /**
1756
- * Starts a new reward stream that distributes tokens to opted-in holders and waits for confirmation.
1757
- *
1758
- * @example
1759
- * ```ts
1760
- * import { createClient, http } from 'viem'
1761
- * import { privateKeyToAccount } from 'viem/accounts'
1762
- * import { tempo } from 'tempo.ts/chains'
1763
- * import { tempoActions } from 'tempo.ts/viem'
1764
- *
1765
- * const client = createClient({
1766
- * account: privateKeyToAccount('0x...'),
1767
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
1768
- * transport: http(),
1769
- * }).extend(tempoActions())
1770
- *
1771
- * const result = await client.reward.startSync({
1772
- * amount: 100000000000000000000n,
1773
- * seconds: 86400,
1774
- * token: '0x20c0000000000000000000000000000000000001',
1775
- * })
1776
- * ```
1777
- *
1778
- * @param parameters - Parameters.
1779
- * @returns The transaction receipt and event data.
1780
- */
1781
- startSync: (
1782
- parameters: rewardActions.startSync.Parameters<chain, account>,
1783
- ) => Promise<rewardActions.startSync.ReturnValue>
1784
- /**
1785
- * Watches for reward recipient set events.
1786
- *
1787
- * @example
1788
- * ```ts
1789
- * import { createClient, http } from 'viem'
1790
- * import { tempo } from 'tempo.ts/chains'
1791
- * import { tempoActions } from 'tempo.ts/viem'
1792
- *
1793
- * const client = createClient({
1794
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
1795
- * transport: http(),
1796
- * }).extend(tempoActions())
1797
- *
1798
- * const unwatch = client.reward.watchRewardRecipientSet({
1799
- * token: '0x20c0000000000000000000000000000000000001',
1800
- * onRewardRecipientSet: (args, log) => {
1801
- * console.log('Reward recipient set:', args)
1802
- * },
1803
- * })
1804
- * ```
1805
- *
1806
- * @param parameters - Parameters.
1807
- * @returns A function to unsubscribe from the event.
1808
- */
1809
- watchRewardRecipientSet: (
1810
- parameters: rewardActions.watchRewardRecipientSet.Parameters,
1811
- ) => () => void
1812
- /**
1813
- * Watches for reward scheduled events.
1814
- *
1815
- * @example
1816
- * ```ts
1817
- * import { createClient, http } from 'viem'
1818
- * import { tempo } from 'tempo.ts/chains'
1819
- * import { tempoActions } from 'tempo.ts/viem'
1820
- *
1821
- * const client = createClient({
1822
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
1823
- * transport: http(),
1824
- * }).extend(tempoActions())
1825
- *
1826
- * const unwatch = client.reward.watchRewardScheduled({
1827
- * token: '0x20c0000000000000000000000000000000000001',
1828
- * onRewardScheduled: (args, log) => {
1829
- * console.log('Reward scheduled:', args)
1830
- * },
1831
- * })
1832
- * ```
1833
- *
1834
- * @param parameters - Parameters.
1835
- * @returns A function to unsubscribe from the event.
1836
- */
1837
- watchRewardScheduled: (
1838
- parameters: rewardActions.watchRewardScheduled.Parameters,
1839
- ) => () => void
1840
- }
1841
- token: {
1842
- /**
1843
- * Approves a spender to transfer TIP20 tokens on behalf of the caller.
1844
- *
1845
- * @example
1846
- * ```ts
1847
- * import { createClient, http } from 'viem'
1848
- * import { privateKeyToAccount } from 'viem/accounts'
1849
- * import { tempo } from 'tempo.ts/chains'
1850
- * import { tempoActions } from 'tempo.ts/viem'
1851
- *
1852
- * const client = createClient({
1853
- * account: privateKeyToAccount('0x...'),
1854
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
1855
- * transport: http(),
1856
- * }).extend(tempoActions())
1857
- *
1858
- * const hash = await client.token.approve({
1859
- * spender: '0x...',
1860
- * amount: 100n,
1861
- * })
1862
- * ```
1863
- *
1864
- * @param client - Client.
1865
- * @param parameters - Parameters.
1866
- * @returns The transaction hash.
1867
- */
1868
- approve: (
1869
- parameters: tokenActions.approve.Parameters<chain, account>,
1870
- ) => Promise<tokenActions.approve.ReturnValue>
1871
- /**
1872
- * Approves a spender to transfer TIP20 tokens on behalf of the caller.
1873
- *
1874
- * @example
1875
- * ```ts
1876
- * import { createClient, http } from 'viem'
1877
- * import { privateKeyToAccount } from 'viem/accounts'
1878
- * import { tempo } from 'tempo.ts/chains'
1879
- * import { tempoActions } from 'tempo.ts/viem'
1880
- *
1881
- * const client = createClient({
1882
- * account: privateKeyToAccount('0x...'),
1883
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
1884
- * transport: http(),
1885
- * }).extend(tempoActions())
1886
- *
1887
- * const result = await client.token.approveSync({
1888
- * spender: '0x...',
1889
- * amount: 100n,
1890
- * })
1891
- * ```
1892
- *
1893
- * @param client - Client.
1894
- * @param parameters - Parameters.
1895
- * @returns The transaction receipt and event data.
1896
- */
1897
- approveSync: (
1898
- parameters: tokenActions.approveSync.Parameters<chain, account>,
1899
- ) => Promise<tokenActions.approveSync.ReturnValue>
1900
- /**
1901
- * Burns TIP20 tokens from a blocked address.
1902
- *
1903
- * @example
1904
- * ```ts
1905
- * import { createClient, http } from 'viem'
1906
- * import { privateKeyToAccount } from 'viem/accounts'
1907
- * import { tempo } from 'tempo.ts/chains'
1908
- * import { tempoActions } from 'tempo.ts/viem'
1909
- *
1910
- * const client = createClient({
1911
- * account: privateKeyToAccount('0x...'),
1912
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
1913
- * transport: http(),
1914
- * }).extend(tempoActions())
1915
- *
1916
- * const hash = await client.token.burnBlocked({
1917
- * from: '0x...',
1918
- * amount: 100n,
1919
- * token: '0x...',
1920
- * })
1921
- * ```
1922
- *
1923
- * @param client - Client.
1924
- * @param parameters - Parameters.
1925
- * @returns The transaction hash.
1926
- */
1927
- burnBlocked: (
1928
- parameters: tokenActions.burnBlocked.Parameters<chain, account>,
1929
- ) => Promise<tokenActions.burnBlocked.ReturnValue>
1930
- /**
1931
- * Burns TIP20 tokens from a blocked address.
1932
- *
1933
- * @example
1934
- * ```ts
1935
- * import { createClient, http } from 'viem'
1936
- * import { privateKeyToAccount } from 'viem/accounts'
1937
- * import { tempo } from 'tempo.ts/chains'
1938
- * import { tempoActions } from 'tempo.ts/viem'
1939
- *
1940
- * const client = createClient({
1941
- * account: privateKeyToAccount('0x...'),
1942
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
1943
- * transport: http(),
1944
- * }).extend(tempoActions())
1945
- *
1946
- * const result = await client.token.burnBlockedSync({
1947
- * from: '0x...',
1948
- * amount: 100n,
1949
- * token: '0x...',
1950
- * })
1951
- * ```
1952
- *
1953
- * @param client - Client.
1954
- * @param parameters - Parameters.
1955
- * @returns The transaction receipt and event data.
1956
- */
1957
- burnBlockedSync: (
1958
- parameters: tokenActions.burnBlockedSync.Parameters<chain, account>,
1959
- ) => Promise<tokenActions.burnBlockedSync.ReturnValue>
1960
- /**
1961
- * Burns TIP20 tokens from the caller's balance.
1962
- *
1963
- * @example
1964
- * ```ts
1965
- * import { createClient, http } from 'viem'
1966
- * import { privateKeyToAccount } from 'viem/accounts'
1967
- * import { tempo } from 'tempo.ts/chains'
1968
- * import { tempoActions } from 'tempo.ts/viem'
1969
- *
1970
- * const client = createClient({
1971
- * account: privateKeyToAccount('0x...'),
1972
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
1973
- * transport: http(),
1974
- * }).extend(tempoActions())
1975
- *
1976
- * const hash = await client.token.burn({
1977
- * amount: 100n,
1978
- * token: '0x...',
1979
- * })
1980
- * ```
1981
- *
1982
- * @param client - Client.
1983
- * @param parameters - Parameters.
1984
- * @returns The transaction hash.
1985
- */
1986
- burn: (
1987
- parameters: tokenActions.burn.Parameters<chain, account>,
1988
- ) => Promise<tokenActions.burn.ReturnValue>
1989
- /**
1990
- * Burns TIP20 tokens from the caller's balance.
1991
- *
1992
- * @example
1993
- * ```ts
1994
- * import { createClient, http } from 'viem'
1995
- * import { privateKeyToAccount } from 'viem/accounts'
1996
- * import { tempo } from 'tempo.ts/chains'
1997
- * import { tempoActions } from 'tempo.ts/viem'
1998
- *
1999
- * const client = createClient({
2000
- * account: privateKeyToAccount('0x...'),
2001
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
2002
- * transport: http(),
2003
- * }).extend(tempoActions())
2004
- *
2005
- * const result = await client.token.burnSync({
2006
- * amount: 100n,
2007
- * token: '0x...',
2008
- * })
2009
- * ```
2010
- *
2011
- * @param client - Client.
2012
- * @param parameters - Parameters.
2013
- * @returns The transaction receipt and event data.
2014
- */
2015
- burnSync: (
2016
- parameters: tokenActions.burnSync.Parameters<chain, account>,
2017
- ) => Promise<tokenActions.burnSync.ReturnValue>
2018
- /**
2019
- * Changes the transfer policy ID for a TIP20 token.
2020
- *
2021
- * @example
2022
- * ```ts
2023
- * import { createClient, http } from 'viem'
2024
- * import { privateKeyToAccount } from 'viem/accounts'
2025
- * import { tempo } from 'tempo.ts/chains'
2026
- * import { tempoActions } from 'tempo.ts/viem'
2027
- *
2028
- * const client = createClient({
2029
- * account: privateKeyToAccount('0x...'),
2030
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
2031
- * transport: http(),
2032
- * }).extend(tempoActions())
2033
- *
2034
- * const hash = await client.token.changeTransferPolicy({
2035
- * token: '0x...',
2036
- * policyId: 1n,
2037
- * })
2038
- * ```
2039
- *
2040
- * @param client - Client.
2041
- * @param parameters - Parameters.
2042
- * @returns The transaction hash.
2043
- */
2044
- changeTransferPolicy: (
2045
- parameters: tokenActions.changeTransferPolicy.Parameters<chain, account>,
2046
- ) => Promise<tokenActions.changeTransferPolicy.ReturnValue>
2047
- /**
2048
- * Changes the transfer policy ID for a TIP20 token.
2049
- *
2050
- * @example
2051
- * ```ts
2052
- * import { createClient, http } from 'viem'
2053
- * import { privateKeyToAccount } from 'viem/accounts'
2054
- * import { tempo } from 'tempo.ts/chains'
2055
- * import { tempoActions } from 'tempo.ts/viem'
2056
- *
2057
- * const client = createClient({
2058
- * account: privateKeyToAccount('0x...'),
2059
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
2060
- * transport: http(),
2061
- * }).extend(tempoActions())
2062
- *
2063
- * const result = await client.token.changeTransferPolicySync({
2064
- * token: '0x...',
2065
- * policyId: 1n,
2066
- * })
2067
- * ```
2068
- *
2069
- * @param client - Client.
2070
- * @param parameters - Parameters.
2071
- * @returns The transaction receipt and event data.
2072
- */
2073
- changeTransferPolicySync: (
2074
- parameters: tokenActions.changeTransferPolicySync.Parameters<
2075
- chain,
2076
- account
2077
- >,
2078
- ) => Promise<tokenActions.changeTransferPolicySync.ReturnValue>
2079
- /**
2080
- * Creates a new TIP20 token.
2081
- *
2082
- * @example
2083
- * ```ts
2084
- * import { createClient, http } from 'viem'
2085
- * import { privateKeyToAccount } from 'viem/accounts'
2086
- * import { tempo } from 'tempo.ts/chains'
2087
- * import { tempoActions } from 'tempo.ts/viem'
2088
- *
2089
- * const client = createClient({
2090
- * account: privateKeyToAccount('0x...'),
2091
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
2092
- * transport: http(),
2093
- * }).extend(tempoActions())
2094
- *
2095
- * const { hash, id, address } = await client.token.create({
2096
- * name: 'My Token',
2097
- * symbol: 'MTK',
2098
- * currency: 'USD',
2099
- * })
2100
- * ```
2101
- *
2102
- * @param client - Client.
2103
- * @param parameters - Parameters.
2104
- * @returns The transaction hash.
2105
- */
2106
- create: (
2107
- parameters: tokenActions.create.Parameters<chain, account>,
2108
- ) => Promise<tokenActions.create.ReturnValue>
2109
- /**
2110
- * Creates a new TIP20 token.
2111
- *
2112
- * @example
2113
- * ```ts
2114
- * import { createClient, http } from 'viem'
2115
- * import { privateKeyToAccount } from 'viem/accounts'
2116
- * import { tempo } from 'tempo.ts/chains'
2117
- * import { tempoActions } from 'tempo.ts/viem'
2118
- *
2119
- * const client = createClient({
2120
- * account: privateKeyToAccount('0x...'),
2121
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
2122
- * transport: http(),
2123
- * }).extend(tempoActions())
2124
- *
2125
- * const result = await client.token.createSync({
2126
- * name: 'My Token',
2127
- * symbol: 'MTK',
2128
- * currency: 'USD',
2129
- * })
2130
- * ```
2131
- *
2132
- * @param client - Client.
2133
- * @param parameters - Parameters.
2134
- * @returns The transaction receipt and event data.
2135
- */
2136
- createSync: (
2137
- parameters: tokenActions.createSync.Parameters<chain, account>,
2138
- ) => Promise<tokenActions.createSync.ReturnValue>
2139
- /**
2140
- * Gets TIP20 token allowance.
2141
- *
2142
- * @example
2143
- * ```ts
2144
- * import { createClient, http } from 'viem'
2145
- * import { privateKeyToAccount } from 'viem/accounts'
2146
- * import { tempo } from 'tempo.ts/chains'
2147
- * import { tempoActions } from 'tempo.ts/viem'
2148
- *
2149
- * const client = createClient({
2150
- * account: privateKeyToAccount('0x...'),
2151
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
2152
- * transport: http(),
2153
- * }).extend(tempoActions())
2154
- *
2155
- * const allowance = await client.token.getAllowance({
2156
- * spender: '0x...',
2157
- * })
2158
- * ```
2159
- *
2160
- * @param client - Client.
2161
- * @param parameters - Parameters.
2162
- * @returns The token allowance.
2163
- */
2164
- getAllowance: (
2165
- parameters: tokenActions.getAllowance.Parameters,
2166
- ) => Promise<tokenActions.getAllowance.ReturnValue>
2167
- /**
2168
- * Gets TIP20 token balance for an address.
2169
- *
2170
- * @example
2171
- * ```ts
2172
- * import { createClient, http } from 'viem'
2173
- * import { privateKeyToAccount } from 'viem/accounts'
2174
- * import { tempo } from 'tempo.ts/chains'
2175
- * import { tempoActions } from 'tempo.ts/viem'
2176
- *
2177
- * const client = createClient({
2178
- * account: privateKeyToAccount('0x...'),
2179
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
2180
- * transport: http(),
2181
- * }).extend(tempoActions())
2182
- *
2183
- * const balance = await client.token.getBalance()
2184
- * ```
2185
- *
2186
- * @param client - Client.
2187
- * @param parameters - Parameters.
2188
- * @returns The token balance.
2189
- */
2190
- getBalance: (
2191
- parameters: tokenActions.getBalance.Parameters<account>,
2192
- ) => Promise<tokenActions.getBalance.ReturnValue>
2193
- /**
2194
- * Gets TIP20 token metadata including name, symbol, currency, decimals, and total supply.
2195
- *
2196
- * @example
2197
- * ```ts
2198
- * import { createClient, http } from 'viem'
2199
- * import { tempo } from 'tempo.ts/chains'
2200
- * import { tempoActions } from 'tempo.ts/viem'
2201
- *
2202
- * const client = createClient({
2203
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
2204
- * transport: http(),
2205
- * }).extend(tempoActions())
2206
- *
2207
- * const metadata = await client.token.getMetadata({
2208
- * token: '0x...',
2209
- * })
2210
- * ```
2211
- *
2212
- * @param client - Client.
2213
- * @param parameters - Parameters.
2214
- * @returns The token metadata.
2215
- */
2216
- getMetadata: (
2217
- parameters: tokenActions.getMetadata.Parameters,
2218
- ) => Promise<tokenActions.getMetadata.ReturnValue>
2219
- /**
2220
- * Gets the admin role for a specific role in a TIP20 token.
2221
- *
2222
- * @example
2223
- * ```ts
2224
- * import { createClient, http } from 'viem'
2225
- * import { tempo } from 'tempo.ts/chains'
2226
- * import { tempoActions } from 'tempo.ts/viem'
2227
- *
2228
- * const client = createClient({
2229
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
2230
- * transport: http(),
2231
- * }).extend(tempoActions())
2232
- *
2233
- * const adminRole = await client.token.getRoleAdmin({
2234
- * role: 'issuer',
2235
- * token: '0x...',
2236
- * })
2237
- * ```
2238
- *
2239
- * @param client - Client.
2240
- * @param parameters - Parameters.
2241
- * @returns The admin role hash.
2242
- */
2243
- getRoleAdmin: (
2244
- parameters: tokenActions.getRoleAdmin.Parameters,
2245
- ) => Promise<tokenActions.getRoleAdmin.ReturnValue>
2246
- /**
2247
- * Checks if an account has a specific role for a TIP20 token.
2248
- *
2249
- * @example
2250
- * ```ts
2251
- * import { createClient, http } from 'viem'
2252
- * import { privateKeyToAccount } from 'viem/accounts'
2253
- * import { tempo } from 'tempo.ts/chains'
2254
- * import { tempoActions } from 'tempo.ts/viem'
2255
- *
2256
- * const client = createClient({
2257
- * account: privateKeyToAccount('0x...'),
2258
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
2259
- * transport: http(),
2260
- * }).extend(tempoActions())
2261
- *
2262
- * const hasRole = await client.token.hasRole({
2263
- * token: '0x...',
2264
- * role: 'issuer',
2265
- * })
2266
- * ```
2267
- *
2268
- * @param client - Client.
2269
- * @param parameters - Parameters.
2270
- * @returns Whether the account has the role.
2271
- */
2272
- hasRole: (
2273
- parameters: tokenActions.hasRole.Parameters<account>,
2274
- ) => Promise<tokenActions.hasRole.ReturnValue>
2275
- /**
2276
- * Grants a role for a TIP20 token.
2277
- *
2278
- * @example
2279
- * ```ts
2280
- * import { createClient, http } from 'viem'
2281
- * import { privateKeyToAccount } from 'viem/accounts'
2282
- * import { tempo } from 'tempo.ts/chains'
2283
- * import { tempoActions } from 'tempo.ts/viem'
2284
- *
2285
- * const client = createClient({
2286
- * account: privateKeyToAccount('0x...'),
2287
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
2288
- * transport: http(),
2289
- * }).extend(tempoActions())
2290
- *
2291
- * const hash = await client.token.grantRoles({
2292
- * token: '0x...',
2293
- * to: '0x...',
2294
- * roles: ['issuer'],
2295
- * })
2296
- * ```
2297
- *
2298
- * @param client - Client.
2299
- * @param parameters - Parameters.
2300
- * @returns The transaction hash.
2301
- */
2302
- grantRoles: (
2303
- parameters: tokenActions.grantRoles.Parameters<chain, account>,
2304
- ) => Promise<tokenActions.grantRoles.ReturnValue>
2305
- /**
2306
- * Grants a role for a TIP20 token.
2307
- *
2308
- * @example
2309
- * ```ts
2310
- * import { createClient, http } from 'viem'
2311
- * import { privateKeyToAccount } from 'viem/accounts'
2312
- * import { tempo } from 'tempo.ts/chains'
2313
- * import { tempoActions } from 'tempo.ts/viem'
2314
- *
2315
- * const client = createClient({
2316
- * account: privateKeyToAccount('0x...'),
2317
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
2318
- * transport: http(),
2319
- * }).extend(tempoActions())
2320
- *
2321
- * const result = await client.token.grantRolesSync({
2322
- * token: '0x...',
2323
- * to: '0x...',
2324
- * roles: ['issuer'],
2325
- * })
2326
- * ```
2327
- *
2328
- * @param parameters - Parameters.
2329
- * @returns The transaction receipt and event data.
2330
- */
2331
- grantRolesSync: (
2332
- parameters: tokenActions.grantRolesSync.Parameters<chain, account>,
2333
- ) => Promise<tokenActions.grantRolesSync.ReturnValue>
2334
- /**
2335
- * Mints TIP20 tokens to an address.
2336
- *
2337
- * @example
2338
- * ```ts
2339
- * import { createClient, http } from 'viem'
2340
- * import { privateKeyToAccount } from 'viem/accounts'
2341
- * import { tempo } from 'tempo.ts/chains'
2342
- * import { tempoActions } from 'tempo.ts/viem'
2343
- *
2344
- * const client = createClient({
2345
- * account: privateKeyToAccount('0x...'),
2346
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
2347
- * transport: http(),
2348
- * }).extend(tempoActions())
2349
- *
2350
- * const hash = await client.token.mint({
2351
- * to: '0x...',
2352
- * amount: 100n,
2353
- * token: '0x...',
2354
- * })
2355
- * ```
2356
- *
2357
- * @param client - Client.
2358
- * @param parameters - Parameters.
2359
- * @returns The transaction hash.
2360
- */
2361
- mint: (
2362
- parameters: tokenActions.mint.Parameters<chain, account>,
2363
- ) => Promise<tokenActions.mint.ReturnValue>
2364
- /**
2365
- * Mints TIP20 tokens to an address.
2366
- *
2367
- * @example
2368
- * ```ts
2369
- * import { createClient, http } from 'viem'
2370
- * import { privateKeyToAccount } from 'viem/accounts'
2371
- * import { tempo } from 'tempo.ts/chains'
2372
- * import { tempoActions } from 'tempo.ts/viem'
2373
- *
2374
- * const client = createClient({
2375
- * account: privateKeyToAccount('0x...'),
2376
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
2377
- * transport: http(),
2378
- * }).extend(tempoActions())
2379
- *
2380
- * const result = await client.token.mintSync({
2381
- * to: '0x...',
2382
- * amount: 100n,
2383
- * token: '0x...',
2384
- * })
2385
- * ```
2386
- *
2387
- * @param client - Client.
2388
- * @param parameters - Parameters.
2389
- * @returns The transaction receipt and event data.
2390
- */
2391
- mintSync: (
2392
- parameters: tokenActions.mintSync.Parameters<chain, account>,
2393
- ) => Promise<tokenActions.mintSync.ReturnValue>
2394
- /**
2395
- * Pauses a TIP20 token.
2396
- *
2397
- * @example
2398
- * ```ts
2399
- * import { createClient, http } from 'viem'
2400
- * import { privateKeyToAccount } from 'viem/accounts'
2401
- * import { tempo } from 'tempo.ts/chains'
2402
- * import { tempoActions } from 'tempo.ts/viem'
2403
- *
2404
- * const client = createClient({
2405
- * account: privateKeyToAccount('0x...'),
2406
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
2407
- * transport: http(),
2408
- * }).extend(tempoActions())
2409
- *
2410
- * const hash = await client.token.pause({
2411
- * token: '0x...',
2412
- * })
2413
- * ```
2414
- *
2415
- * @param client - Client.
2416
- * @param parameters - Parameters.
2417
- * @returns The transaction hash.
2418
- */
2419
- pause: (
2420
- parameters: tokenActions.pause.Parameters<chain, account>,
2421
- ) => Promise<tokenActions.pause.ReturnValue>
2422
- /**
2423
- * Pauses a TIP20 token.
2424
- *
2425
- * @example
2426
- * ```ts
2427
- * import { createClient, http } from 'viem'
2428
- * import { privateKeyToAccount } from 'viem/accounts'
2429
- * import { tempo } from 'tempo.ts/chains'
2430
- * import { tempoActions } from 'tempo.ts/viem'
2431
- *
2432
- * const client = createClient({
2433
- * account: privateKeyToAccount('0x...'),
2434
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
2435
- * transport: http(),
2436
- * }).extend(tempoActions())
2437
- *
2438
- * const result = await client.token.pauseSync({
2439
- * token: '0x...',
2440
- * })
2441
- * ```
2442
- *
2443
- * @param client - Client.
2444
- * @param parameters - Parameters.
2445
- * @returns The transaction receipt and event data.
2446
- */
2447
- pauseSync: (
2448
- parameters: tokenActions.pauseSync.Parameters<chain, account>,
2449
- ) => Promise<tokenActions.pauseSync.ReturnValue>
2450
- /**
2451
- * Renounces a role for a TIP20 token.
2452
- *
2453
- * @example
2454
- * ```ts
2455
- * import { createClient, http } from 'viem'
2456
- * import { privateKeyToAccount } from 'viem/accounts'
2457
- * import { tempo } from 'tempo.ts/chains'
2458
- * import { tempoActions } from 'tempo.ts/viem'
2459
- *
2460
- * const client = createClient({
2461
- * account: privateKeyToAccount('0x...'),
2462
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
2463
- * transport: http(),
2464
- * }).extend(tempoActions())
2465
- *
2466
- * const hash = await client.token.renounceRoles({
2467
- * token: '0x...',
2468
- * roles: ['issuer'],
2469
- * })
2470
- * ```
2471
- *
2472
- * @param client - Client.
2473
- * @param parameters - Parameters.
2474
- * @returns The transaction hash.
2475
- */
2476
- renounceRoles: (
2477
- parameters: tokenActions.renounceRoles.Parameters<chain, account>,
2478
- ) => Promise<tokenActions.renounceRoles.ReturnValue>
2479
- /**
2480
- * Renounces a role for a TIP20 token.
2481
- *
2482
- * @example
2483
- * ```ts
2484
- * import { createClient, http } from 'viem'
2485
- * import { privateKeyToAccount } from 'viem/accounts'
2486
- * import { tempo } from 'tempo.ts/chains'
2487
- * import { tempoActions } from 'tempo.ts/viem'
2488
- *
2489
- * const client = createClient({
2490
- * account: privateKeyToAccount('0x...'),
2491
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
2492
- * transport: http(),
2493
- * }).extend(tempoActions())
2494
- *
2495
- * const result = await client.token.renounceRolesSync({
2496
- * token: '0x...',
2497
- * roles: ['issuer'],
2498
- * })
2499
- * ```
2500
- *
2501
- * @param parameters - Parameters.
2502
- * @returns The transaction receipt and event data.
2503
- */
2504
- renounceRolesSync: (
2505
- parameters: tokenActions.renounceRolesSync.Parameters<chain, account>,
2506
- ) => Promise<tokenActions.renounceRolesSync.ReturnValue>
2507
- /**
2508
- * Revokes a role for a TIP20 token.
2509
- *
2510
- * @example
2511
- * ```ts
2512
- * import { createClient, http } from 'viem'
2513
- * import { privateKeyToAccount } from 'viem/accounts'
2514
- * import { tempo } from 'tempo.ts/chains'
2515
- * import { tempoActions } from 'tempo.ts/viem'
2516
- *
2517
- * const client = createClient({
2518
- * account: privateKeyToAccount('0x...'),
2519
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
2520
- * transport: http(),
2521
- * }).extend(tempoActions())
2522
- *
2523
- * const hash = await client.token.revokeRoles({
2524
- * token: '0x...',
2525
- * from: '0x...',
2526
- * roles: ['issuer'],
2527
- * })
2528
- * ```
2529
- *
2530
- * @param client - Client.
2531
- * @param parameters - Parameters.
2532
- * @returns The transaction hash.
2533
- */
2534
- revokeRoles: (
2535
- parameters: tokenActions.revokeRoles.Parameters<chain, account>,
2536
- ) => Promise<tokenActions.revokeRoles.ReturnValue>
2537
- /**
2538
- * Revokes a role for a TIP20 token.
2539
- *
2540
- * @example
2541
- * ```ts
2542
- * import { createClient, http } from 'viem'
2543
- * import { privateKeyToAccount } from 'viem/accounts'
2544
- * import { tempo } from 'tempo.ts/chains'
2545
- * import { tempoActions } from 'tempo.ts/viem'
2546
- *
2547
- * const client = createClient({
2548
- * account: privateKeyToAccount('0x...'),
2549
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
2550
- * transport: http(),
2551
- * }).extend(tempoActions())
2552
- *
2553
- * const result = await client.token.revokeRolesSync({
2554
- * token: '0x...',
2555
- * from: '0x...',
2556
- * roles: ['issuer'],
2557
- * })
2558
- * ```
2559
- *
2560
- * @param parameters - Parameters.
2561
- * @returns The transaction receipt and event data.
2562
- */
2563
- revokeRolesSync: (
2564
- parameters: tokenActions.revokeRolesSync.Parameters<chain, account>,
2565
- ) => Promise<tokenActions.revokeRolesSync.ReturnValue>
2566
- /**
2567
- * Sets the supply cap for a TIP20 token.
2568
- *
2569
- * @example
2570
- * ```ts
2571
- * import { createClient, http } from 'viem'
2572
- * import { privateKeyToAccount } from 'viem/accounts'
2573
- * import { tempo } from 'tempo.ts/chains'
2574
- * import { tempoActions } from 'tempo.ts/viem'
2575
- *
2576
- * const client = createClient({
2577
- * account: privateKeyToAccount('0x...'),
2578
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
2579
- * transport: http(),
2580
- * }).extend(tempoActions())
2581
- *
2582
- * const hash = await client.token.setSupplyCap({
2583
- * token: '0x...',
2584
- * supplyCap: 1000000n,
2585
- * })
2586
- * ```
2587
- *
2588
- * @param client - Client.
2589
- * @param parameters - Parameters.
2590
- * @returns The transaction hash.
2591
- */
2592
- setSupplyCap: (
2593
- parameters: tokenActions.setSupplyCap.Parameters<chain, account>,
2594
- ) => Promise<tokenActions.setSupplyCap.ReturnValue>
2595
- /**
2596
- * Sets the supply cap for a TIP20 token.
2597
- *
2598
- * @example
2599
- * ```ts
2600
- * import { createClient, http } from 'viem'
2601
- * import { privateKeyToAccount } from 'viem/accounts'
2602
- * import { tempo } from 'tempo.ts/chains'
2603
- * import { tempoActions } from 'tempo.ts/viem'
2604
- *
2605
- * const client = createClient({
2606
- * account: privateKeyToAccount('0x...'),
2607
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
2608
- * transport: http(),
2609
- * }).extend(tempoActions())
2610
- *
2611
- * const result = await client.token.setSupplyCapSync({
2612
- * token: '0x...',
2613
- * supplyCap: 1000000n,
2614
- * })
2615
- * ```
2616
- *
2617
- * @param client - Client.
2618
- * @param parameters - Parameters.
2619
- * @returns The transaction receipt and event data.
2620
- */
2621
- setSupplyCapSync: (
2622
- parameters: tokenActions.setSupplyCapSync.Parameters<chain, account>,
2623
- ) => Promise<tokenActions.setSupplyCapSync.ReturnValue>
2624
- /**
2625
- * Sets the admin role for a specific role in a TIP20 token.
2626
- *
2627
- * @example
2628
- * ```ts
2629
- * import { createClient, http } from 'viem'
2630
- * import { privateKeyToAccount } from 'viem/accounts'
2631
- * import { tempo } from 'tempo.ts/chains'
2632
- * import { tempoActions } from 'tempo.ts/viem'
2633
- *
2634
- * const client = createClient({
2635
- * account: privateKeyToAccount('0x...'),
2636
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
2637
- * transport: http(),
2638
- * }).extend(tempoActions())
2639
- *
2640
- * const hash = await client.token.setRoleAdmin({
2641
- * token: '0x...',
2642
- * role: 'issuer',
2643
- * adminRole: 'admin',
2644
- * })
2645
- * ```
2646
- *
2647
- * @param client - Client.
2648
- * @param parameters - Parameters.
2649
- * @returns The transaction hash.
2650
- */
2651
- setRoleAdmin: (
2652
- parameters: tokenActions.setRoleAdmin.Parameters<chain, account>,
2653
- ) => Promise<tokenActions.setRoleAdmin.ReturnValue>
2654
- /**
2655
- * Sets the admin role for a specific role in a TIP20 token.
2656
- *
2657
- * @example
2658
- * ```ts
2659
- * import { createClient, http } from 'viem'
2660
- * import { privateKeyToAccount } from 'viem/accounts'
2661
- * import { tempo } from 'tempo.ts/chains'
2662
- * import { tempoActions } from 'tempo.ts/viem'
2663
- *
2664
- * const client = createClient({
2665
- * account: privateKeyToAccount('0x...'),
2666
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
2667
- * transport: http(),
2668
- * }).extend(tempoActions())
2669
- *
2670
- * const result = await client.token.setRoleAdminSync({
2671
- * token: '0x...',
2672
- * role: 'issuer',
2673
- * adminRole: 'admin',
2674
- * })
2675
- * ```
2676
- *
2677
- * @param client - Client.
2678
- * @param parameters - Parameters.
2679
- * @returns The transaction receipt and event data.
2680
- */
2681
- setRoleAdminSync: (
2682
- parameters: tokenActions.setRoleAdminSync.Parameters<chain, account>,
2683
- ) => Promise<tokenActions.setRoleAdminSync.ReturnValue>
2684
- /**
2685
- * Transfers TIP20 tokens to another address.
2686
- *
2687
- * @example
2688
- * ```ts
2689
- * import { createClient, http } from 'viem'
2690
- * import { privateKeyToAccount } from 'viem/accounts'
2691
- * import { tempo } from 'tempo.ts/chains'
2692
- * import { tempoActions } from 'tempo.ts/viem'
2693
- *
2694
- * const client = createClient({
2695
- * account: privateKeyToAccount('0x...'),
2696
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
2697
- * transport: http(),
2698
- * }).extend(tempoActions())
2699
- *
2700
- * const hash = await client.token.transfer({
2701
- * to: '0x...',
2702
- * amount: 100n,
2703
- * })
2704
- * ```
2705
- *
2706
- * @param client - Client.
2707
- * @param parameters - Parameters.
2708
- * @returns The transaction hash.
2709
- */
2710
- transfer: (
2711
- parameters: tokenActions.transfer.Parameters<chain, account>,
2712
- ) => Promise<tokenActions.transfer.ReturnValue>
2713
- /**
2714
- * Transfers TIP20 tokens to another address.
2715
- *
2716
- * @example
2717
- * ```ts
2718
- * import { createClient, http } from 'viem'
2719
- * import { privateKeyToAccount } from 'viem/accounts'
2720
- * import { tempo } from 'tempo.ts/chains'
2721
- * import { tempoActions } from 'tempo.ts/viem'
2722
- *
2723
- * const client = createClient({
2724
- * account: privateKeyToAccount('0x...'),
2725
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
2726
- * transport: http(),
2727
- * }).extend(tempoActions())
2728
- *
2729
- * const result = await client.token.transferSync({
2730
- * to: '0x...',
2731
- * amount: 100n,
2732
- * })
2733
- * ```
2734
- *
2735
- * @param client - Client.
2736
- * @param parameters - Parameters.
2737
- * @returns The transaction receipt and event data.
2738
- */
2739
- transferSync: (
2740
- parameters: tokenActions.transferSync.Parameters<chain, account>,
2741
- ) => Promise<tokenActions.transferSync.ReturnValue>
2742
- /**
2743
- * Unpauses a TIP20 token.
2744
- *
2745
- * @example
2746
- * ```ts
2747
- * import { createClient, http } from 'viem'
2748
- * import { privateKeyToAccount } from 'viem/accounts'
2749
- * import { tempo } from 'tempo.ts/chains'
2750
- * import { tempoActions } from 'tempo.ts/viem'
2751
- *
2752
- * const client = createClient({
2753
- * account: privateKeyToAccount('0x...'),
2754
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
2755
- * transport: http(),
2756
- * }).extend(tempoActions())
2757
- *
2758
- * const hash = await client.token.unpause({
2759
- * token: '0x...',
2760
- * })
2761
- * ```
2762
- *
2763
- * @param client - Client.
2764
- * @param parameters - Parameters.
2765
- * @returns The transaction hash.
2766
- */
2767
- unpause: (
2768
- parameters: tokenActions.unpause.Parameters<chain, account>,
2769
- ) => Promise<tokenActions.unpause.ReturnValue>
2770
- /**
2771
- * Unpauses a TIP20 token.
2772
- *
2773
- * @example
2774
- * ```ts
2775
- * import { createClient, http } from 'viem'
2776
- * import { privateKeyToAccount } from 'viem/accounts'
2777
- * import { tempo } from 'tempo.ts/chains'
2778
- * import { tempoActions } from 'tempo.ts/viem'
2779
- *
2780
- * const client = createClient({
2781
- * account: privateKeyToAccount('0x...'),
2782
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
2783
- * transport: http(),
2784
- * }).extend(tempoActions())
2785
- *
2786
- * const result = await client.token.unpauseSync({
2787
- * token: '0x...',
2788
- * })
2789
- * ```
2790
- *
2791
- * @param client - Client.
2792
- * @param parameters - Parameters.
2793
- * @returns The transaction receipt and event data.
2794
- */
2795
- unpauseSync: (
2796
- parameters: tokenActions.unpauseSync.Parameters<chain, account>,
2797
- ) => Promise<tokenActions.unpauseSync.ReturnValue>
2798
- /**
2799
- * Watches for TIP20 token approval events.
2800
- *
2801
- * @example
2802
- * ```ts
2803
- * import { createClient, http } from 'viem'
2804
- * import { tempo } from 'tempo.ts/chains'
2805
- * import { tempoActions } from 'tempo.ts/viem'
2806
- *
2807
- * const client = createClient({
2808
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
2809
- * transport: http(),
2810
- * }).extend(tempoActions())
2811
- *
2812
- * const unwatch = client.token.watchApprove({
2813
- * onApproval: (args, log) => {
2814
- * console.log('Approval:', args)
2815
- * },
2816
- * })
2817
- * ```
2818
- *
2819
- * @param client - Client.
2820
- * @param parameters - Parameters.
2821
- * @returns A function to unsubscribe from the event.
2822
- */
2823
- watchApprove: (
2824
- parameters: tokenActions.watchApprove.Parameters,
2825
- ) => () => void
2826
- /**
2827
- * Watches for TIP20 token burn events.
2828
- *
2829
- * @example
2830
- * ```ts
2831
- * import { createClient, http } from 'viem'
2832
- * import { tempo } from 'tempo.ts/chains'
2833
- * import { tempoActions } from 'tempo.ts/viem'
2834
- *
2835
- * const client = createClient({
2836
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
2837
- * transport: http(),
2838
- * }).extend(tempoActions())
2839
- *
2840
- * const unwatch = client.token.watchBurn({
2841
- * onBurn: (args, log) => {
2842
- * console.log('Burn:', args)
2843
- * },
2844
- * })
2845
- * ```
2846
- *
2847
- * @param client - Client.
2848
- * @param parameters - Parameters.
2849
- * @returns A function to unsubscribe from the event.
2850
- */
2851
- watchBurn: (parameters: tokenActions.watchBurn.Parameters) => () => void
2852
- /**
2853
- * Watches for new TIP20 tokens created.
2854
- *
2855
- * @example
2856
- * ```ts
2857
- * import { createClient, http } from 'viem'
2858
- * import { tempo } from 'tempo.ts/chains'
2859
- * import { tempoActions } from 'tempo.ts/viem'
2860
- *
2861
- * const client = createClient({
2862
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
2863
- * transport: http(),
2864
- * }).extend(tempoActions())
2865
- *
2866
- * const unwatch = client.token.watchCreate({
2867
- * onTokenCreated: (args, log) => {
2868
- * console.log('Token created:', args)
2869
- * },
2870
- * })
2871
- * ```
2872
- *
2873
- * @param client - Client.
2874
- * @param parameters - Parameters.
2875
- * @returns A function to unsubscribe from the event.
2876
- */
2877
- watchCreate: (parameters: tokenActions.watchCreate.Parameters) => () => void
2878
- /**
2879
- * Watches for TIP20 token mint events.
2880
- *
2881
- * @example
2882
- * ```ts
2883
- * import { createClient, http } from 'viem'
2884
- * import { tempo } from 'tempo.ts/chains'
2885
- * import { tempoActions } from 'tempo.ts/viem'
2886
- *
2887
- * const client = createClient({
2888
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
2889
- * transport: http(),
2890
- * }).extend(tempoActions())
2891
- *
2892
- * const unwatch = client.token.watchMint({
2893
- * onMint: (args, log) => {
2894
- * console.log('Mint:', args)
2895
- * },
2896
- * })
2897
- * ```
2898
- *
2899
- * @param client - Client.
2900
- * @param parameters - Parameters.
2901
- * @returns A function to unsubscribe from the event.
2902
- */
2903
- watchMint: (parameters: tokenActions.watchMint.Parameters) => () => void
2904
- /**
2905
- * Watches for TIP20 token role admin updates.
2906
- *
2907
- * @example
2908
- * ```ts
2909
- * import { createClient, http } from 'viem'
2910
- * import { tempo } from 'tempo.ts/chains'
2911
- * import { tempoActions } from 'tempo.ts/viem'
2912
- *
2913
- * const client = createClient({
2914
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
2915
- * transport: http(),
2916
- * }).extend(tempoActions())
2917
- *
2918
- * const unwatch = client.token.watchAdminRole({
2919
- * onRoleAdminUpdated: (args, log) => {
2920
- * console.log('Role admin updated:', args)
2921
- * },
2922
- * })
2923
- * ```
2924
- *
2925
- * @param client - Client.
2926
- * @param parameters - Parameters.
2927
- * @returns A function to unsubscribe from the event.
2928
- */
2929
- watchAdminRole: (
2930
- parameters: tokenActions.watchAdminRole.Parameters,
2931
- ) => () => void
2932
- /**
2933
- * Watches for TIP20 token role membership updates.
2934
- *
2935
- * @example
2936
- * ```ts
2937
- * import { createClient, http } from 'viem'
2938
- * import { tempo } from 'tempo.ts/chains'
2939
- * import { tempoActions } from 'tempo.ts/viem'
2940
- *
2941
- * const client = createClient({
2942
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
2943
- * transport: http(),
2944
- * }).extend(tempoActions())
2945
- *
2946
- * const unwatch = client.token.watchRole({
2947
- * onRoleUpdated: (args, log) => {
2948
- * console.log('Role updated:', args)
2949
- * },
2950
- * })
2951
- * ```
2952
- *
2953
- * @param client - Client.
2954
- * @param parameters - Parameters.
2955
- * @returns A function to unsubscribe from the event.
2956
- */
2957
- watchRole: (parameters: tokenActions.watchRole.Parameters) => () => void
2958
- /**
2959
- * Watches for TIP20 token transfer events.
2960
- *
2961
- * @example
2962
- * ```ts
2963
- * import { createClient, http } from 'viem'
2964
- * import { tempo } from 'tempo.ts/chains'
2965
- * import { tempoActions } from 'tempo.ts/viem'
2966
- *
2967
- * const client = createClient({
2968
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
2969
- * transport: http(),
2970
- * }).extend(tempoActions())
2971
- *
2972
- * const unwatch = client.token.watchTransfer({
2973
- * onTransfer: (args, log) => {
2974
- * console.log('Transfer:', args)
2975
- * },
2976
- * })
2977
- * ```
2978
- *
2979
- * @param client - Client.
2980
- * @param parameters - Parameters.
2981
- * @returns A function to unsubscribe from the event.
2982
- */
2983
- watchTransfer: (
2984
- parameters: tokenActions.watchTransfer.Parameters,
2985
- ) => () => void
2986
- }
2987
- }
2988
-
2989
- export function decorator() {
2990
- return <
2991
- transport extends Transport,
2992
- chain extends Chain | undefined,
2993
- account extends Account | undefined,
2994
- >(
2995
- client: Client<transport, chain, account>,
2996
- ): Decorator<chain, account> => {
2997
- return {
2998
- verifyHash: (parameters) => accountActions.verifyHash(client, parameters),
2999
- amm: {
3000
- getPool: (parameters) => ammActions.getPool(client, parameters),
3001
- getLiquidityBalance: (parameters) =>
3002
- ammActions.getLiquidityBalance(client, parameters),
3003
- burn: (parameters) => ammActions.burn(client, parameters),
3004
- burnSync: (parameters) => ammActions.burnSync(client, parameters),
3005
- mint: (parameters) => ammActions.mint(client, parameters),
3006
- mintSync: (parameters) => ammActions.mintSync(client, parameters),
3007
- rebalanceSwap: (parameters) =>
3008
- ammActions.rebalanceSwap(client, parameters),
3009
- rebalanceSwapSync: (parameters) =>
3010
- ammActions.rebalanceSwapSync(client, parameters),
3011
- watchBurn: (parameters) => ammActions.watchBurn(client, parameters),
3012
- watchFeeSwap: (parameters) =>
3013
- ammActions.watchFeeSwap(client, parameters),
3014
- watchMint: (parameters) => ammActions.watchMint(client, parameters),
3015
- watchRebalanceSwap: (parameters) =>
3016
- ammActions.watchRebalanceSwap(client, parameters),
3017
- },
3018
- dex: {
3019
- buy: (parameters) => dexActions.buy(client, parameters),
3020
- buySync: (parameters) => dexActions.buySync(client, parameters),
3021
- cancel: (parameters) => dexActions.cancel(client, parameters),
3022
- cancelSync: (parameters) => dexActions.cancelSync(client, parameters),
3023
- createPair: (parameters) => dexActions.createPair(client, parameters),
3024
- createPairSync: (parameters) =>
3025
- dexActions.createPairSync(client, parameters),
3026
- getBalance: (parameters) => dexActions.getBalance(client, parameters),
3027
- getBuyQuote: (parameters) => dexActions.getBuyQuote(client, parameters),
3028
- getOrder: (parameters) => dexActions.getOrder(client, parameters),
3029
- getTickLevel: (parameters) =>
3030
- dexActions.getTickLevel(client, parameters),
3031
- getSellQuote: (parameters) =>
3032
- dexActions.getSellQuote(client, parameters),
3033
- place: (parameters) => dexActions.place(client, parameters),
3034
- placeSync: (parameters) => dexActions.placeSync(client, parameters),
3035
- placeFlip: (parameters) => dexActions.placeFlip(client, parameters),
3036
- placeFlipSync: (parameters) =>
3037
- dexActions.placeFlipSync(client, parameters),
3038
- sell: (parameters) => dexActions.sell(client, parameters),
3039
- sellSync: (parameters) => dexActions.sellSync(client, parameters),
3040
- withdraw: (parameters) => dexActions.withdraw(client, parameters),
3041
- withdrawSync: (parameters) =>
3042
- dexActions.withdrawSync(client, parameters),
3043
- watchFlipOrderPlaced: (parameters) =>
3044
- dexActions.watchFlipOrderPlaced(client, parameters),
3045
- watchOrderCancelled: (parameters) =>
3046
- dexActions.watchOrderCancelled(client, parameters),
3047
- watchOrderFilled: (parameters) =>
3048
- dexActions.watchOrderFilled(client, parameters),
3049
- watchOrderPlaced: (parameters) =>
3050
- dexActions.watchOrderPlaced(client, parameters),
3051
- },
3052
- faucet: {
3053
- fund: (parameters) => faucetActions.fund(client, parameters),
3054
- },
3055
- fee: {
3056
- // @ts-expect-error
3057
- getUserToken: (parameters) =>
3058
- // @ts-expect-error
3059
- feeActions.getUserToken(client, parameters),
3060
- setUserToken: (parameters) =>
3061
- feeActions.setUserToken(client, parameters),
3062
- setUserTokenSync: (parameters) =>
3063
- feeActions.setUserTokenSync(client, parameters),
3064
- watchSetUserToken: (parameters) =>
3065
- feeActions.watchSetUserToken(client, parameters),
3066
- },
3067
- policy: {
3068
- create: (parameters) => policyActions.create(client, parameters),
3069
- createSync: (parameters) =>
3070
- policyActions.createSync(client, parameters),
3071
- setAdmin: (parameters) => policyActions.setAdmin(client, parameters),
3072
- setAdminSync: (parameters) =>
3073
- policyActions.setAdminSync(client, parameters),
3074
- modifyWhitelist: (parameters) =>
3075
- policyActions.modifyWhitelist(client, parameters),
3076
- modifyWhitelistSync: (parameters) =>
3077
- policyActions.modifyWhitelistSync(client, parameters),
3078
- modifyBlacklist: (parameters) =>
3079
- policyActions.modifyBlacklist(client, parameters),
3080
- modifyBlacklistSync: (parameters) =>
3081
- policyActions.modifyBlacklistSync(client, parameters),
3082
- getData: (parameters) => policyActions.getData(client, parameters),
3083
- isAuthorized: (parameters) =>
3084
- policyActions.isAuthorized(client, parameters),
3085
- watchCreate: (parameters) =>
3086
- policyActions.watchCreate(client, parameters),
3087
- watchAdminUpdated: (parameters) =>
3088
- policyActions.watchAdminUpdated(client, parameters),
3089
- watchWhitelistUpdated: (parameters) =>
3090
- policyActions.watchWhitelistUpdated(client, parameters),
3091
- watchBlacklistUpdated: (parameters) =>
3092
- policyActions.watchBlacklistUpdated(client, parameters),
3093
- },
3094
- reward: {
3095
- claim: (parameters) => rewardActions.claim(client, parameters),
3096
- claimSync: (parameters) => rewardActions.claimSync(client, parameters),
3097
- getTotalPerSecond: (parameters) =>
3098
- rewardActions.getTotalPerSecond(client, parameters),
3099
- getUserRewardInfo: (parameters) =>
3100
- rewardActions.getUserRewardInfo(client, parameters),
3101
- setRecipient: (parameters) =>
3102
- rewardActions.setRecipient(client, parameters),
3103
- setRecipientSync: (parameters) =>
3104
- rewardActions.setRecipientSync(client, parameters),
3105
- start: (parameters) => rewardActions.start(client, parameters),
3106
- startSync: (parameters) => rewardActions.startSync(client, parameters),
3107
- watchRewardRecipientSet: (parameters) =>
3108
- rewardActions.watchRewardRecipientSet(client, parameters),
3109
- watchRewardScheduled: (parameters) =>
3110
- rewardActions.watchRewardScheduled(client, parameters),
3111
- },
3112
- token: {
3113
- approve: (parameters) => tokenActions.approve(client, parameters),
3114
- approveSync: (parameters) =>
3115
- tokenActions.approveSync(client, parameters),
3116
- burnBlocked: (parameters) =>
3117
- tokenActions.burnBlocked(client, parameters),
3118
- burnBlockedSync: (parameters) =>
3119
- tokenActions.burnBlockedSync(client, parameters),
3120
- burn: (parameters) => tokenActions.burn(client, parameters),
3121
- burnSync: (parameters) => tokenActions.burnSync(client, parameters),
3122
- changeTransferPolicy: (parameters) =>
3123
- tokenActions.changeTransferPolicy(client, parameters),
3124
- changeTransferPolicySync: (parameters) =>
3125
- tokenActions.changeTransferPolicySync(client, parameters),
3126
- create: (parameters) => tokenActions.create(client, parameters),
3127
- createSync: (parameters) => tokenActions.createSync(client, parameters),
3128
- getAllowance: (parameters) =>
3129
- tokenActions.getAllowance(client, parameters),
3130
- getBalance: (parameters) => tokenActions.getBalance(client, parameters),
3131
- getMetadata: (parameters) =>
3132
- tokenActions.getMetadata(client, parameters),
3133
- getRoleAdmin: (parameters) =>
3134
- tokenActions.getRoleAdmin(client, parameters),
3135
- hasRole: (parameters) => tokenActions.hasRole(client, parameters),
3136
- grantRoles: (parameters) => tokenActions.grantRoles(client, parameters),
3137
- grantRolesSync: (parameters) =>
3138
- tokenActions.grantRolesSync(client, parameters),
3139
- mint: (parameters) => tokenActions.mint(client, parameters),
3140
- mintSync: (parameters) => tokenActions.mintSync(client, parameters),
3141
- pause: (parameters) => tokenActions.pause(client, parameters),
3142
- pauseSync: (parameters) => tokenActions.pauseSync(client, parameters),
3143
- renounceRoles: (parameters) =>
3144
- tokenActions.renounceRoles(client, parameters),
3145
- renounceRolesSync: (parameters) =>
3146
- tokenActions.renounceRolesSync(client, parameters),
3147
- revokeRoles: (parameters) =>
3148
- tokenActions.revokeRoles(client, parameters),
3149
- revokeRolesSync: (parameters) =>
3150
- tokenActions.revokeRolesSync(client, parameters),
3151
- setSupplyCap: (parameters) =>
3152
- tokenActions.setSupplyCap(client, parameters),
3153
- setSupplyCapSync: (parameters) =>
3154
- tokenActions.setSupplyCapSync(client, parameters),
3155
- setRoleAdmin: (parameters) =>
3156
- tokenActions.setRoleAdmin(client, parameters),
3157
- setRoleAdminSync: (parameters) =>
3158
- tokenActions.setRoleAdminSync(client, parameters),
3159
- transfer: (parameters) => tokenActions.transfer(client, parameters),
3160
- transferSync: (parameters) =>
3161
- tokenActions.transferSync(client, parameters),
3162
- unpause: (parameters) => tokenActions.unpause(client, parameters),
3163
- unpauseSync: (parameters) =>
3164
- tokenActions.unpauseSync(client, parameters),
3165
- watchApprove: (parameters) =>
3166
- tokenActions.watchApprove(client, parameters),
3167
- watchBurn: (parameters) => tokenActions.watchBurn(client, parameters),
3168
- watchCreate: (parameters) =>
3169
- tokenActions.watchCreate(client, parameters),
3170
- watchMint: (parameters) => tokenActions.watchMint(client, parameters),
3171
- watchAdminRole: (parameters) =>
3172
- tokenActions.watchAdminRole(client, parameters),
3173
- watchRole: (parameters) => tokenActions.watchRole(client, parameters),
3174
- watchTransfer: (parameters) =>
3175
- tokenActions.watchTransfer(client, parameters),
3176
- },
3177
- }
3178
- }
3179
- }