tempo.ts 0.1.5 → 0.2.1

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