viem 2.53.1 → 2.54.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 (471) hide show
  1. package/CHANGELOG.md +65 -0
  2. package/_cjs/actions/index.js +3 -2
  3. package/_cjs/actions/index.js.map +1 -1
  4. package/_cjs/actions/token/approve.js +62 -0
  5. package/_cjs/actions/token/approve.js.map +1 -0
  6. package/_cjs/actions/token/approveSync.js +25 -0
  7. package/_cjs/actions/token/approveSync.js.map +1 -0
  8. package/_cjs/actions/token/getAllowance.js +32 -0
  9. package/_cjs/actions/token/getAllowance.js.map +1 -0
  10. package/_cjs/actions/token/getBalance.js +41 -0
  11. package/_cjs/actions/token/getBalance.js.map +1 -0
  12. package/_cjs/actions/token/getMetadata.js +40 -0
  13. package/_cjs/actions/token/getMetadata.js.map +1 -0
  14. package/_cjs/actions/token/getTotalSupply.js +32 -0
  15. package/_cjs/actions/token/getTotalSupply.js.map +1 -0
  16. package/_cjs/actions/token/index.js +20 -0
  17. package/_cjs/actions/token/index.js.map +1 -0
  18. package/_cjs/actions/token/internal.js +125 -0
  19. package/_cjs/actions/token/internal.js.map +1 -0
  20. package/_cjs/actions/token/transfer.js +70 -0
  21. package/_cjs/actions/token/transfer.js.map +1 -0
  22. package/_cjs/actions/token/transferSync.js +25 -0
  23. package/_cjs/actions/token/transferSync.js.map +1 -0
  24. package/_cjs/chains/definitions/battlechain.js +31 -0
  25. package/_cjs/chains/definitions/battlechain.js.map +1 -0
  26. package/_cjs/chains/definitions/marooTestnet.js +30 -0
  27. package/_cjs/chains/definitions/marooTestnet.js.map +1 -0
  28. package/_cjs/chains/index.js +18 -14
  29. package/_cjs/chains/index.js.map +1 -1
  30. package/_cjs/clients/createClient.js +39 -1
  31. package/_cjs/clients/createClient.js.map +1 -1
  32. package/_cjs/clients/createPublicClient.js.map +1 -1
  33. package/_cjs/clients/createWalletClient.js.map +1 -1
  34. package/_cjs/clients/decorators/public.js +11 -0
  35. package/_cjs/clients/decorators/public.js.map +1 -1
  36. package/_cjs/clients/decorators/wallet.js +8 -0
  37. package/_cjs/clients/decorators/wallet.js.map +1 -1
  38. package/_cjs/clients/transports/http.js +2 -1
  39. package/_cjs/clients/transports/http.js.map +1 -1
  40. package/_cjs/errors/encoding.js +9 -1
  41. package/_cjs/errors/encoding.js.map +1 -1
  42. package/_cjs/errors/request.js +24 -1
  43. package/_cjs/errors/request.js.map +1 -1
  44. package/_cjs/errors/transaction.js +9 -1
  45. package/_cjs/errors/transaction.js.map +1 -1
  46. package/_cjs/errors/version.js +1 -1
  47. package/_cjs/index.js +9 -6
  48. package/_cjs/index.js.map +1 -1
  49. package/_cjs/tempo/Client.js +3 -1
  50. package/_cjs/tempo/Client.js.map +1 -1
  51. package/_cjs/tempo/Decorator.js +234 -215
  52. package/_cjs/tempo/Decorator.js.map +1 -1
  53. package/_cjs/tempo/actions/token.js +210 -112
  54. package/_cjs/tempo/actions/token.js.map +1 -1
  55. package/_cjs/tempo/internal/utils.js +108 -0
  56. package/_cjs/tempo/internal/utils.js.map +1 -1
  57. package/_cjs/tokens/defineToken.js +21 -0
  58. package/_cjs/tokens/defineToken.js.map +1 -0
  59. package/_cjs/tokens/definitions/alphausd.js +14 -0
  60. package/_cjs/tokens/definitions/alphausd.js.map +1 -0
  61. package/_cjs/tokens/definitions/betausd.js +14 -0
  62. package/_cjs/tokens/definitions/betausd.js.map +1 -0
  63. package/_cjs/tokens/definitions/brla.js +14 -0
  64. package/_cjs/tokens/definitions/brla.js.map +1 -0
  65. package/_cjs/tokens/definitions/cbbtc.js +14 -0
  66. package/_cjs/tokens/definitions/cbbtc.js.map +1 -0
  67. package/_cjs/tokens/definitions/chfau.js +14 -0
  68. package/_cjs/tokens/definitions/chfau.js.map +1 -0
  69. package/_cjs/tokens/definitions/cirbtc.js +16 -0
  70. package/_cjs/tokens/definitions/cirbtc.js.map +1 -0
  71. package/_cjs/tokens/definitions/cusd.js +14 -0
  72. package/_cjs/tokens/definitions/cusd.js.map +1 -0
  73. package/_cjs/tokens/definitions/dlusd.js +14 -0
  74. package/_cjs/tokens/definitions/dlusd.js.map +1 -0
  75. package/_cjs/tokens/definitions/eurau.js +14 -0
  76. package/_cjs/tokens/definitions/eurau.js.map +1 -0
  77. package/_cjs/tokens/definitions/eurc.js +24 -0
  78. package/_cjs/tokens/definitions/eurc.js.map +1 -0
  79. package/_cjs/tokens/definitions/eurce.js +15 -0
  80. package/_cjs/tokens/definitions/eurce.js.map +1 -0
  81. package/_cjs/tokens/definitions/frxusd.js +14 -0
  82. package/_cjs/tokens/definitions/frxusd.js.map +1 -0
  83. package/_cjs/tokens/definitions/gbpa.js +14 -0
  84. package/_cjs/tokens/definitions/gbpa.js.map +1 -0
  85. package/_cjs/tokens/definitions/gusd.js +14 -0
  86. package/_cjs/tokens/definitions/gusd.js.map +1 -0
  87. package/_cjs/tokens/definitions/iusd.js +14 -0
  88. package/_cjs/tokens/definitions/iusd.js.map +1 -0
  89. package/_cjs/tokens/definitions/pathusd.js +15 -0
  90. package/_cjs/tokens/definitions/pathusd.js.map +1 -0
  91. package/_cjs/tokens/definitions/reusd.js +14 -0
  92. package/_cjs/tokens/definitions/reusd.js.map +1 -0
  93. package/_cjs/tokens/definitions/rusd.js +14 -0
  94. package/_cjs/tokens/definitions/rusd.js.map +1 -0
  95. package/_cjs/tokens/definitions/sbc.js +14 -0
  96. package/_cjs/tokens/definitions/sbc.js.map +1 -0
  97. package/_cjs/tokens/definitions/siusd.js +14 -0
  98. package/_cjs/tokens/definitions/siusd.js.map +1 -0
  99. package/_cjs/tokens/definitions/stcusd.js +14 -0
  100. package/_cjs/tokens/definitions/stcusd.js.map +1 -0
  101. package/_cjs/tokens/definitions/susde.js +14 -0
  102. package/_cjs/tokens/definitions/susde.js.map +1 -0
  103. package/_cjs/tokens/definitions/syrupusdc.js +14 -0
  104. package/_cjs/tokens/definitions/syrupusdc.js.map +1 -0
  105. package/_cjs/tokens/definitions/thetausd.js +14 -0
  106. package/_cjs/tokens/definitions/thetausd.js.map +1 -0
  107. package/_cjs/tokens/definitions/usd1.js +14 -0
  108. package/_cjs/tokens/definitions/usd1.js.map +1 -0
  109. package/_cjs/tokens/definitions/usdb.js +14 -0
  110. package/_cjs/tokens/definitions/usdb.js.map +1 -0
  111. package/_cjs/tokens/definitions/usdc.js +59 -0
  112. package/_cjs/tokens/definitions/usdc.js.map +1 -0
  113. package/_cjs/tokens/definitions/usdce.js +15 -0
  114. package/_cjs/tokens/definitions/usdce.js.map +1 -0
  115. package/_cjs/tokens/definitions/usde.js +14 -0
  116. package/_cjs/tokens/definitions/usde.js.map +1 -0
  117. package/_cjs/tokens/definitions/usdt0.js +14 -0
  118. package/_cjs/tokens/definitions/usdt0.js.map +1 -0
  119. package/_cjs/tokens/definitions/usyc.js +18 -0
  120. package/_cjs/tokens/definitions/usyc.js.map +1 -0
  121. package/_cjs/tokens/definitions/wsrusd.js +14 -0
  122. package/_cjs/tokens/definitions/wsrusd.js.map +1 -0
  123. package/_cjs/tokens/index.js +72 -0
  124. package/_cjs/tokens/index.js.map +1 -0
  125. package/_cjs/tokens/sets.js +102 -0
  126. package/_cjs/tokens/sets.js.map +1 -0
  127. package/_cjs/utils/encoding/fromRlp.js +7 -4
  128. package/_cjs/utils/encoding/fromRlp.js.map +1 -1
  129. package/_cjs/utils/rpc/http.js +58 -3
  130. package/_cjs/utils/rpc/http.js.map +1 -1
  131. package/_cjs/utils/transaction/parseTransaction.js +4 -1
  132. package/_cjs/utils/transaction/parseTransaction.js.map +1 -1
  133. package/_esm/actions/index.js +1 -0
  134. package/_esm/actions/index.js.map +1 -1
  135. package/_esm/actions/token/approve.js +123 -0
  136. package/_esm/actions/token/approve.js.map +1 -0
  137. package/_esm/actions/token/approveSync.js +50 -0
  138. package/_esm/actions/token/approveSync.js.map +1 -0
  139. package/_esm/actions/token/getAllowance.js +62 -0
  140. package/_esm/actions/token/getAllowance.js.map +1 -0
  141. package/_esm/actions/token/getBalance.js +70 -0
  142. package/_esm/actions/token/getBalance.js.map +1 -0
  143. package/_esm/actions/token/getMetadata.js +60 -0
  144. package/_esm/actions/token/getMetadata.js.map +1 -0
  145. package/_esm/actions/token/getTotalSupply.js +60 -0
  146. package/_esm/actions/token/getTotalSupply.js.map +1 -0
  147. package/_esm/actions/token/index.js +10 -0
  148. package/_esm/actions/token/index.js.map +1 -0
  149. package/_esm/actions/token/internal.js +188 -0
  150. package/_esm/actions/token/internal.js.map +1 -0
  151. package/_esm/actions/token/transfer.js +147 -0
  152. package/_esm/actions/token/transfer.js.map +1 -0
  153. package/_esm/actions/token/transferSync.js +54 -0
  154. package/_esm/actions/token/transferSync.js.map +1 -0
  155. package/_esm/chains/definitions/battlechain.js +28 -0
  156. package/_esm/chains/definitions/battlechain.js.map +1 -0
  157. package/_esm/chains/definitions/marooTestnet.js +27 -0
  158. package/_esm/chains/definitions/marooTestnet.js.map +1 -0
  159. package/_esm/chains/index.js +2 -0
  160. package/_esm/chains/index.js.map +1 -1
  161. package/_esm/clients/createClient.js +53 -1
  162. package/_esm/clients/createClient.js.map +1 -1
  163. package/_esm/clients/createPublicClient.js.map +1 -1
  164. package/_esm/clients/createWalletClient.js.map +1 -1
  165. package/_esm/clients/decorators/public.js +17 -0
  166. package/_esm/clients/decorators/public.js.map +1 -1
  167. package/_esm/clients/decorators/wallet.js +8 -0
  168. package/_esm/clients/decorators/wallet.js.map +1 -1
  169. package/_esm/clients/transports/http.js +2 -1
  170. package/_esm/clients/transports/http.js.map +1 -1
  171. package/_esm/errors/encoding.js +7 -0
  172. package/_esm/errors/encoding.js.map +1 -1
  173. package/_esm/errors/request.js +22 -0
  174. package/_esm/errors/request.js.map +1 -1
  175. package/_esm/errors/transaction.js +7 -0
  176. package/_esm/errors/transaction.js.map +1 -1
  177. package/_esm/errors/version.js +1 -1
  178. package/_esm/index.js +3 -3
  179. package/_esm/index.js.map +1 -1
  180. package/_esm/tempo/Client.js +3 -1
  181. package/_esm/tempo/Client.js.map +1 -1
  182. package/_esm/tempo/Decorator.js +234 -218
  183. package/_esm/tempo/Decorator.js.map +1 -1
  184. package/_esm/tempo/actions/token.js +335 -186
  185. package/_esm/tempo/actions/token.js.map +1 -1
  186. package/_esm/tempo/actions/wallet.js +1 -1
  187. package/_esm/tempo/internal/utils.js +154 -0
  188. package/_esm/tempo/internal/utils.js.map +1 -1
  189. package/_esm/tokens/defineToken.js +57 -0
  190. package/_esm/tokens/defineToken.js.map +1 -0
  191. package/_esm/tokens/definitions/alphausd.js +12 -0
  192. package/_esm/tokens/definitions/alphausd.js.map +1 -0
  193. package/_esm/tokens/definitions/betausd.js +12 -0
  194. package/_esm/tokens/definitions/betausd.js.map +1 -0
  195. package/_esm/tokens/definitions/brla.js +12 -0
  196. package/_esm/tokens/definitions/brla.js.map +1 -0
  197. package/_esm/tokens/definitions/cbbtc.js +12 -0
  198. package/_esm/tokens/definitions/cbbtc.js.map +1 -0
  199. package/_esm/tokens/definitions/chfau.js +12 -0
  200. package/_esm/tokens/definitions/chfau.js.map +1 -0
  201. package/_esm/tokens/definitions/cirbtc.js +21 -0
  202. package/_esm/tokens/definitions/cirbtc.js.map +1 -0
  203. package/_esm/tokens/definitions/cusd.js +12 -0
  204. package/_esm/tokens/definitions/cusd.js.map +1 -0
  205. package/_esm/tokens/definitions/dlusd.js +12 -0
  206. package/_esm/tokens/definitions/dlusd.js.map +1 -0
  207. package/_esm/tokens/definitions/eurau.js +12 -0
  208. package/_esm/tokens/definitions/eurau.js.map +1 -0
  209. package/_esm/tokens/definitions/eurc.js +29 -0
  210. package/_esm/tokens/definitions/eurc.js.map +1 -0
  211. package/_esm/tokens/definitions/eurce.js +13 -0
  212. package/_esm/tokens/definitions/eurce.js.map +1 -0
  213. package/_esm/tokens/definitions/frxusd.js +12 -0
  214. package/_esm/tokens/definitions/frxusd.js.map +1 -0
  215. package/_esm/tokens/definitions/gbpa.js +12 -0
  216. package/_esm/tokens/definitions/gbpa.js.map +1 -0
  217. package/_esm/tokens/definitions/gusd.js +12 -0
  218. package/_esm/tokens/definitions/gusd.js.map +1 -0
  219. package/_esm/tokens/definitions/iusd.js +12 -0
  220. package/_esm/tokens/definitions/iusd.js.map +1 -0
  221. package/_esm/tokens/definitions/pathusd.js +13 -0
  222. package/_esm/tokens/definitions/pathusd.js.map +1 -0
  223. package/_esm/tokens/definitions/reusd.js +12 -0
  224. package/_esm/tokens/definitions/reusd.js.map +1 -0
  225. package/_esm/tokens/definitions/rusd.js +12 -0
  226. package/_esm/tokens/definitions/rusd.js.map +1 -0
  227. package/_esm/tokens/definitions/sbc.js +12 -0
  228. package/_esm/tokens/definitions/sbc.js.map +1 -0
  229. package/_esm/tokens/definitions/siusd.js +12 -0
  230. package/_esm/tokens/definitions/siusd.js.map +1 -0
  231. package/_esm/tokens/definitions/stcusd.js +12 -0
  232. package/_esm/tokens/definitions/stcusd.js.map +1 -0
  233. package/_esm/tokens/definitions/susde.js +12 -0
  234. package/_esm/tokens/definitions/susde.js.map +1 -0
  235. package/_esm/tokens/definitions/syrupusdc.js +12 -0
  236. package/_esm/tokens/definitions/syrupusdc.js.map +1 -0
  237. package/_esm/tokens/definitions/thetausd.js +12 -0
  238. package/_esm/tokens/definitions/thetausd.js.map +1 -0
  239. package/_esm/tokens/definitions/usd1.js +12 -0
  240. package/_esm/tokens/definitions/usd1.js.map +1 -0
  241. package/_esm/tokens/definitions/usdb.js +12 -0
  242. package/_esm/tokens/definitions/usdb.js.map +1 -0
  243. package/_esm/tokens/definitions/usdc.js +85 -0
  244. package/_esm/tokens/definitions/usdc.js.map +1 -0
  245. package/_esm/tokens/definitions/usdce.js +13 -0
  246. package/_esm/tokens/definitions/usdce.js.map +1 -0
  247. package/_esm/tokens/definitions/usde.js +12 -0
  248. package/_esm/tokens/definitions/usde.js.map +1 -0
  249. package/_esm/tokens/definitions/usdt0.js +12 -0
  250. package/_esm/tokens/definitions/usdt0.js.map +1 -0
  251. package/_esm/tokens/definitions/usyc.js +23 -0
  252. package/_esm/tokens/definitions/usyc.js.map +1 -0
  253. package/_esm/tokens/definitions/wsrusd.js +12 -0
  254. package/_esm/tokens/definitions/wsrusd.js.map +1 -0
  255. package/_esm/tokens/index.js +36 -0
  256. package/_esm/tokens/index.js.map +1 -0
  257. package/_esm/tokens/sets.js +104 -0
  258. package/_esm/tokens/sets.js.map +1 -0
  259. package/_esm/utils/encoding/fromRlp.js +8 -5
  260. package/_esm/utils/encoding/fromRlp.js.map +1 -1
  261. package/_esm/utils/rpc/http.js +59 -4
  262. package/_esm/utils/rpc/http.js.map +1 -1
  263. package/_esm/utils/transaction/parseTransaction.js +5 -2
  264. package/_esm/utils/transaction/parseTransaction.js.map +1 -1
  265. package/_types/actions/index.d.ts +1 -0
  266. package/_types/actions/index.d.ts.map +1 -1
  267. package/_types/actions/token/approve.d.ts +253 -0
  268. package/_types/actions/token/approve.d.ts.map +1 -0
  269. package/_types/actions/token/approveSync.d.ts +57 -0
  270. package/_types/actions/token/approveSync.d.ts.map +1 -0
  271. package/_types/actions/token/getAllowance.d.ts +77 -0
  272. package/_types/actions/token/getAllowance.d.ts.map +1 -0
  273. package/_types/actions/token/getBalance.d.ts +69 -0
  274. package/_types/actions/token/getBalance.d.ts.map +1 -0
  275. package/_types/actions/token/getMetadata.d.ts +43 -0
  276. package/_types/actions/token/getMetadata.d.ts.map +1 -0
  277. package/_types/actions/token/getTotalSupply.d.ts +63 -0
  278. package/_types/actions/token/getTotalSupply.d.ts.map +1 -0
  279. package/_types/actions/token/index.d.ts +9 -0
  280. package/_types/actions/token/index.d.ts.map +1 -0
  281. package/_types/actions/token/internal.d.ts +168 -0
  282. package/_types/actions/token/internal.d.ts.map +1 -0
  283. package/_types/actions/token/transfer.d.ts +288 -0
  284. package/_types/actions/token/transfer.d.ts.map +1 -0
  285. package/_types/actions/token/transferSync.d.ts +61 -0
  286. package/_types/actions/token/transferSync.d.ts.map +1 -0
  287. package/_types/chains/definitions/battlechain.d.ts +447 -0
  288. package/_types/chains/definitions/battlechain.d.ts.map +1 -0
  289. package/_types/chains/definitions/marooTestnet.d.ts +49 -0
  290. package/_types/chains/definitions/marooTestnet.d.ts.map +1 -0
  291. package/_types/chains/index.d.ts +2 -0
  292. package/_types/chains/index.d.ts.map +1 -1
  293. package/_types/clients/createClient.d.ts +24 -6
  294. package/_types/clients/createClient.d.ts.map +1 -1
  295. package/_types/clients/createPublicClient.d.ts +4 -3
  296. package/_types/clients/createPublicClient.d.ts.map +1 -1
  297. package/_types/clients/createWalletClient.d.ts +4 -3
  298. package/_types/clients/createWalletClient.d.ts.map +1 -1
  299. package/_types/clients/decorators/public.d.ts +128 -3
  300. package/_types/clients/decorators/public.d.ts.map +1 -1
  301. package/_types/clients/decorators/wallet.d.ts +208 -3
  302. package/_types/clients/decorators/wallet.d.ts.map +1 -1
  303. package/_types/clients/transports/http.d.ts +2 -0
  304. package/_types/clients/transports/http.d.ts.map +1 -1
  305. package/_types/errors/encoding.d.ts +8 -0
  306. package/_types/errors/encoding.d.ts.map +1 -1
  307. package/_types/errors/request.d.ts +11 -0
  308. package/_types/errors/request.d.ts.map +1 -1
  309. package/_types/errors/transaction.d.ts +8 -0
  310. package/_types/errors/transaction.d.ts.map +1 -1
  311. package/_types/errors/version.d.ts +1 -1
  312. package/_types/index.d.ts +4 -3
  313. package/_types/index.d.ts.map +1 -1
  314. package/_types/tempo/Client.d.ts +1 -1
  315. package/_types/tempo/Client.d.ts.map +1 -1
  316. package/_types/tempo/Decorator.d.ts +88 -5
  317. package/_types/tempo/Decorator.d.ts.map +1 -1
  318. package/_types/tempo/actions/token.d.ts +223 -151
  319. package/_types/tempo/actions/token.d.ts.map +1 -1
  320. package/_types/tempo/actions/wallet.d.ts +3 -3
  321. package/_types/tempo/internal/types.d.ts +17 -0
  322. package/_types/tempo/internal/types.d.ts.map +1 -1
  323. package/_types/tempo/internal/utils.d.ts +73 -0
  324. package/_types/tempo/internal/utils.d.ts.map +1 -1
  325. package/_types/tokens/defineToken.d.ts +112 -0
  326. package/_types/tokens/defineToken.d.ts.map +1 -0
  327. package/_types/tokens/definitions/alphausd.d.ts +11 -0
  328. package/_types/tokens/definitions/alphausd.d.ts.map +1 -0
  329. package/_types/tokens/definitions/betausd.d.ts +11 -0
  330. package/_types/tokens/definitions/betausd.d.ts.map +1 -0
  331. package/_types/tokens/definitions/brla.d.ts +11 -0
  332. package/_types/tokens/definitions/brla.d.ts.map +1 -0
  333. package/_types/tokens/definitions/cbbtc.d.ts +11 -0
  334. package/_types/tokens/definitions/cbbtc.d.ts.map +1 -0
  335. package/_types/tokens/definitions/chfau.d.ts +11 -0
  336. package/_types/tokens/definitions/chfau.d.ts.map +1 -0
  337. package/_types/tokens/definitions/cirbtc.d.ts +21 -0
  338. package/_types/tokens/definitions/cirbtc.d.ts.map +1 -0
  339. package/_types/tokens/definitions/cusd.d.ts +11 -0
  340. package/_types/tokens/definitions/cusd.d.ts.map +1 -0
  341. package/_types/tokens/definitions/dlusd.d.ts +11 -0
  342. package/_types/tokens/definitions/dlusd.d.ts.map +1 -0
  343. package/_types/tokens/definitions/eurau.d.ts +11 -0
  344. package/_types/tokens/definitions/eurau.d.ts.map +1 -0
  345. package/_types/tokens/definitions/eurc.d.ts +29 -0
  346. package/_types/tokens/definitions/eurc.d.ts.map +1 -0
  347. package/_types/tokens/definitions/eurce.d.ts +12 -0
  348. package/_types/tokens/definitions/eurce.d.ts.map +1 -0
  349. package/_types/tokens/definitions/frxusd.d.ts +11 -0
  350. package/_types/tokens/definitions/frxusd.d.ts.map +1 -0
  351. package/_types/tokens/definitions/gbpa.d.ts +11 -0
  352. package/_types/tokens/definitions/gbpa.d.ts.map +1 -0
  353. package/_types/tokens/definitions/gusd.d.ts +11 -0
  354. package/_types/tokens/definitions/gusd.d.ts.map +1 -0
  355. package/_types/tokens/definitions/iusd.d.ts +11 -0
  356. package/_types/tokens/definitions/iusd.d.ts.map +1 -0
  357. package/_types/tokens/definitions/pathusd.d.ts +12 -0
  358. package/_types/tokens/definitions/pathusd.d.ts.map +1 -0
  359. package/_types/tokens/definitions/reusd.d.ts +11 -0
  360. package/_types/tokens/definitions/reusd.d.ts.map +1 -0
  361. package/_types/tokens/definitions/rusd.d.ts +11 -0
  362. package/_types/tokens/definitions/rusd.d.ts.map +1 -0
  363. package/_types/tokens/definitions/sbc.d.ts +11 -0
  364. package/_types/tokens/definitions/sbc.d.ts.map +1 -0
  365. package/_types/tokens/definitions/siusd.d.ts +11 -0
  366. package/_types/tokens/definitions/siusd.d.ts.map +1 -0
  367. package/_types/tokens/definitions/stcusd.d.ts +11 -0
  368. package/_types/tokens/definitions/stcusd.d.ts.map +1 -0
  369. package/_types/tokens/definitions/susde.d.ts +11 -0
  370. package/_types/tokens/definitions/susde.d.ts.map +1 -0
  371. package/_types/tokens/definitions/syrupusdc.d.ts +11 -0
  372. package/_types/tokens/definitions/syrupusdc.d.ts.map +1 -0
  373. package/_types/tokens/definitions/thetausd.d.ts +11 -0
  374. package/_types/tokens/definitions/thetausd.d.ts.map +1 -0
  375. package/_types/tokens/definitions/usd1.d.ts +11 -0
  376. package/_types/tokens/definitions/usd1.d.ts.map +1 -0
  377. package/_types/tokens/definitions/usdb.d.ts +11 -0
  378. package/_types/tokens/definitions/usdb.d.ts.map +1 -0
  379. package/_types/tokens/definitions/usdc.d.ts +85 -0
  380. package/_types/tokens/definitions/usdc.d.ts.map +1 -0
  381. package/_types/tokens/definitions/usdce.d.ts +12 -0
  382. package/_types/tokens/definitions/usdce.d.ts.map +1 -0
  383. package/_types/tokens/definitions/usde.d.ts +11 -0
  384. package/_types/tokens/definitions/usde.d.ts.map +1 -0
  385. package/_types/tokens/definitions/usdt0.d.ts +11 -0
  386. package/_types/tokens/definitions/usdt0.d.ts.map +1 -0
  387. package/_types/tokens/definitions/usyc.d.ts +23 -0
  388. package/_types/tokens/definitions/usyc.d.ts.map +1 -0
  389. package/_types/tokens/definitions/wsrusd.d.ts +11 -0
  390. package/_types/tokens/definitions/wsrusd.d.ts.map +1 -0
  391. package/_types/tokens/index.d.ts +35 -0
  392. package/_types/tokens/index.d.ts.map +1 -0
  393. package/_types/tokens/sets.d.ts +607 -0
  394. package/_types/tokens/sets.d.ts.map +1 -0
  395. package/_types/utils/encoding/fromRlp.d.ts +2 -2
  396. package/_types/utils/encoding/fromRlp.d.ts.map +1 -1
  397. package/_types/utils/rpc/http.d.ts +6 -2
  398. package/_types/utils/rpc/http.d.ts.map +1 -1
  399. package/_types/utils/transaction/parseTransaction.d.ts +2 -2
  400. package/_types/utils/transaction/parseTransaction.d.ts.map +1 -1
  401. package/actions/index.ts +1 -0
  402. package/actions/token/approve.ts +202 -0
  403. package/actions/token/approveSync.ts +95 -0
  404. package/actions/token/getAllowance.ts +105 -0
  405. package/actions/token/getBalance.ts +115 -0
  406. package/actions/token/getMetadata.ts +98 -0
  407. package/actions/token/getTotalSupply.ts +97 -0
  408. package/actions/token/index.ts +9 -0
  409. package/actions/token/internal.ts +367 -0
  410. package/actions/token/transfer.ts +230 -0
  411. package/actions/token/transferSync.ts +99 -0
  412. package/chains/definitions/battlechain.ts +28 -0
  413. package/chains/definitions/marooTestnet.ts +27 -0
  414. package/chains/index.ts +2 -0
  415. package/clients/createClient.ts +90 -8
  416. package/clients/createPublicClient.ts +22 -4
  417. package/clients/createWalletClient.ts +22 -4
  418. package/clients/decorators/public.ts +166 -4
  419. package/clients/decorators/wallet.ts +242 -3
  420. package/clients/transports/http.ts +4 -0
  421. package/errors/encoding.ts +11 -0
  422. package/errors/request.ts +17 -0
  423. package/errors/transaction.ts +11 -0
  424. package/errors/version.ts +1 -1
  425. package/index.ts +7 -0
  426. package/package.json +6 -1
  427. package/tempo/Client.ts +7 -3
  428. package/tempo/Decorator.ts +398 -337
  429. package/tempo/actions/token.ts +519 -296
  430. package/tempo/actions/wallet.ts +3 -3
  431. package/tempo/internal/types.ts +19 -0
  432. package/tempo/internal/utils.ts +204 -0
  433. package/tokens/defineToken.ts +142 -0
  434. package/tokens/definitions/alphausd.ts +13 -0
  435. package/tokens/definitions/betausd.ts +13 -0
  436. package/tokens/definitions/brla.ts +13 -0
  437. package/tokens/definitions/cbbtc.ts +13 -0
  438. package/tokens/definitions/chfau.ts +13 -0
  439. package/tokens/definitions/cirbtc.ts +21 -0
  440. package/tokens/definitions/cusd.ts +13 -0
  441. package/tokens/definitions/dlusd.ts +13 -0
  442. package/tokens/definitions/eurau.ts +13 -0
  443. package/tokens/definitions/eurc.ts +29 -0
  444. package/tokens/definitions/eurce.ts +14 -0
  445. package/tokens/definitions/frxusd.ts +13 -0
  446. package/tokens/definitions/gbpa.ts +13 -0
  447. package/tokens/definitions/gusd.ts +13 -0
  448. package/tokens/definitions/iusd.ts +13 -0
  449. package/tokens/definitions/pathusd.ts +14 -0
  450. package/tokens/definitions/reusd.ts +13 -0
  451. package/tokens/definitions/rusd.ts +13 -0
  452. package/tokens/definitions/sbc.ts +13 -0
  453. package/tokens/definitions/siusd.ts +13 -0
  454. package/tokens/definitions/stcusd.ts +13 -0
  455. package/tokens/definitions/susde.ts +13 -0
  456. package/tokens/definitions/syrupusdc.ts +13 -0
  457. package/tokens/definitions/thetausd.ts +13 -0
  458. package/tokens/definitions/usd1.ts +13 -0
  459. package/tokens/definitions/usdb.ts +13 -0
  460. package/tokens/definitions/usdc.ts +85 -0
  461. package/tokens/definitions/usdce.ts +14 -0
  462. package/tokens/definitions/usde.ts +13 -0
  463. package/tokens/definitions/usdt0.ts +13 -0
  464. package/tokens/definitions/usyc.ts +23 -0
  465. package/tokens/definitions/wsrusd.ts +13 -0
  466. package/tokens/index.ts +35 -0
  467. package/tokens/package.json +6 -0
  468. package/tokens/sets.ts +109 -0
  469. package/utils/encoding/fromRlp.ts +22 -3
  470. package/utils/rpc/http.ts +70 -2
  471. package/utils/transaction/parseTransaction.ts +7 -2
@@ -3,7 +3,9 @@ import * as Hex from 'ox/Hex';
3
3
  import { TokenId, TokenRole } from 'ox/tempo';
4
4
  import type { Account } from '../../accounts/types.js';
5
5
  import type { ReadContractReturnType } from '../../actions/public/readContract.js';
6
+ import { type SimulateContractReturnType } from '../../actions/public/simulateContract.js';
6
7
  import type { WatchContractEventParameters, WatchContractEventReturnType } from '../../actions/public/watchContractEvent.js';
8
+ import * as internal_Token from '../../actions/token/internal.js';
7
9
  import { sendTransaction } from '../../actions/wallet/sendTransaction.js';
8
10
  import { type SendTransactionSyncParameters, sendTransactionSync } from '../../actions/wallet/sendTransactionSync.js';
9
11
  import type { WriteContractReturnType } from '../../actions/wallet/writeContract.js';
@@ -17,7 +19,7 @@ import type { ExtractAbiItem, GetEventArgs } from '../../types/contract.js';
17
19
  import type { Log, Log as viem_Log } from '../../types/log.js';
18
20
  import type { Compute, OneOf, UnionOmit } from '../../types/utils.js';
19
21
  import * as Abis from '../Abis.js';
20
- import type { GetAccountParameter, ReadParameters, WriteParameters } from '../internal/types.js';
22
+ import type { GetAccountParameter, ReadParameters, TokenParameter, TokenParameters, WriteParameters } from '../internal/types.js';
21
23
  import type { TransactionReceipt } from '../Transaction.js';
22
24
  /**
23
25
  * Approves a spender to transfer TIP20 tokens on behalf of the caller.
@@ -47,53 +49,31 @@ import type { TransactionReceipt } from '../Transaction.js';
47
49
  */
48
50
  export declare function approve<chain extends Chain | undefined, account extends Account | undefined>(client: Client<Transport, chain, account>, parameters: approve.Parameters<chain, account>): Promise<approve.ReturnValue>;
49
51
  export declare namespace approve {
50
- type Parameters<chain extends Chain | undefined = Chain | undefined, account extends Account | undefined = Account | undefined> = WriteParameters<chain, account> & Args;
51
52
  type Args = {
52
- /** Amount of tokens to approve. */
53
- amount: bigint;
53
+ /** Amount of tokens to approve, in base units or formatted decimal form. */
54
+ amount: internal_Token.AmountInput;
54
55
  /** Address of the spender. */
55
56
  spender: Address;
56
- /** Address or ID of the TIP20 token. */
57
- token: TokenId.TokenIdOrAddress;
58
- };
57
+ } & TokenParameter;
58
+ type Parameters<chain extends Chain | undefined = Chain | undefined, account extends Account | undefined = Account | undefined> = WriteParameters<chain, account> & Args;
59
59
  type ReturnValue = WriteContractReturnType;
60
60
  type ErrorType = BaseErrorType;
61
61
  /** @internal */
62
- function inner<action extends typeof writeContract | typeof writeContractSync, chain extends Chain | undefined, account extends Account | undefined>(action: action, client: Client<Transport, chain, account>, parameters: approve.Parameters<chain, account>, args: Args): Promise<ReturnType<action>>;
62
+ function inner<action extends typeof writeContract | typeof writeContractSync, chain extends Chain | undefined, account extends Account | undefined>(action: action, client: Client<Transport, chain, account>, parameters: approve.Parameters<chain, account>): Promise<ReturnType<action>>;
63
63
  /**
64
64
  * Defines a call to the `approve` function.
65
65
  *
66
- * Can be passed as a parameter to:
67
- * - [`estimateContractGas`](https://viem.sh/docs/contract/estimateContractGas): estimate the gas cost of the call
68
- * - [`simulateContract`](https://viem.sh/docs/contract/simulateContract): simulate the call
69
- * - [`sendCalls`](https://viem.sh/docs/actions/wallet/sendCalls): send multiple calls
70
- *
71
- * @example
72
- * ```ts
73
- * import { createClient, http, walletActions } from 'viem'
74
- * import { tempo } from 'viem/chains'
75
- * import { Actions } from 'viem/tempo'
76
- *
77
- * const client = createClient({
78
- * chain: tempo.extend({ feeToken: '0x20c0000000000000000000000000000000000001' })
79
- * transport: http(),
80
- * }).extend(walletActions)
81
- *
82
- * const { result } = await client.sendCalls({
83
- * calls: [
84
- * actions.token.approve.call({
85
- * spender: '0x20c0...beef',
86
- * amount: 100n,
87
- * token: '0x20c0...babe',
88
- * }),
89
- * ]
90
- * })
91
- * ```
66
+ * Can be passed as a parameter to `estimateContractGas`, `simulateContract`,
67
+ * `sendCalls`, `sendTransaction` (`calls`), or `multicall`. The token is
68
+ * selected by `token`, which is either a TIP20 token id or a contract
69
+ * `address`; `amount.decimals` is inferred from the client's declared
70
+ * `tokens` when omitted.
92
71
  *
93
- * @param args - Arguments.
72
+ * @param client - Client.
73
+ * @param parameters - Parameters.
94
74
  * @returns The call.
95
75
  */
96
- function call(args: Args): {
76
+ function call<chain extends Chain | undefined>(client: Client<Transport, chain>, parameters: Args): {
97
77
  abi: [{
98
78
  readonly name: "approve";
99
79
  readonly type: "function";
@@ -118,6 +98,30 @@ export declare namespace approve {
118
98
  data: import("../../index.js").Hex;
119
99
  to: Address;
120
100
  };
101
+ /**
102
+ * Estimates the gas required to approve a spender. `amount.decimals` is
103
+ * inferred from the client's declared `tokens` when omitted.
104
+ *
105
+ * @param client - Client.
106
+ * @param parameters - Parameters.
107
+ * @returns The gas estimate.
108
+ */
109
+ function estimateGas<chain extends Chain | undefined, account extends Account | undefined>(client: Client<Transport, chain, account>, parameters: approve.Parameters<chain, account>): Promise<bigint>;
110
+ /**
111
+ * Simulates an approval of a spender. `amount.decimals` is inferred from
112
+ * the client's declared `tokens` when omitted.
113
+ *
114
+ * @param client - Client.
115
+ * @param parameters - Parameters.
116
+ * @returns The simulation result and write request.
117
+ */
118
+ function simulate<chain extends Chain | undefined, account extends Account | undefined>(client: Client<Transport, chain, account>, parameters: approve.Parameters<chain, account>): Promise<SimulateContractReturnType<typeof Abis.tip20, 'approve'>>;
119
+ /**
120
+ * Extracts the `Approval` event from logs.
121
+ *
122
+ * @param logs - The logs.
123
+ * @returns The `Approval` event.
124
+ */
121
125
  function extractEvent(logs: Log[]): Log<bigint, number, false, undefined, true, readonly [{
122
126
  readonly name: "name";
123
127
  readonly type: "function";
@@ -984,12 +988,16 @@ export declare namespace approve {
984
988
  */
985
989
  export declare function approveSync<chain extends Chain | undefined, account extends Account | undefined>(client: Client<Transport, chain, account>, parameters: approveSync.Parameters<chain, account>): Promise<approveSync.ReturnValue>;
986
990
  export declare namespace approveSync {
987
- type Parameters<chain extends Chain | undefined = Chain | undefined, account extends Account | undefined = Account | undefined> = approve.Parameters<chain, account>;
988
991
  type Args = approve.Args;
992
+ type Parameters<chain extends Chain | undefined = Chain | undefined, account extends Account | undefined = Account | undefined> = approve.Parameters<chain, account>;
989
993
  type ReturnValue = Compute<GetEventArgs<typeof Abis.tip20, 'Approval', {
990
994
  IndexedOnly: false;
991
995
  Required: true;
992
996
  }> & {
997
+ /** Token decimals used to derive `formatted`, if known. */
998
+ decimals?: number | undefined;
999
+ /** Approved amount formatted with the token's `decimals`, if known. */
1000
+ formatted?: string | undefined;
993
1001
  /** Transaction receipt. */
994
1002
  receipt: TransactionReceipt;
995
1003
  }>;
@@ -1024,15 +1032,13 @@ export declare namespace approveSync {
1024
1032
  */
1025
1033
  export declare function burnBlocked<chain extends Chain | undefined, account extends Account | undefined>(client: Client<Transport, chain, account>, parameters: burnBlocked.Parameters<chain, account>): Promise<burnBlocked.ReturnValue>;
1026
1034
  export declare namespace burnBlocked {
1027
- type Parameters<chain extends Chain | undefined = Chain | undefined, account extends Account | undefined = Account | undefined> = WriteParameters<chain, account> & Args;
1028
1035
  type Args = {
1029
- /** Amount of tokens to burn. */
1030
- amount: bigint;
1036
+ /** Amount of tokens to burn, in base units or formatted decimal form. */
1037
+ amount: internal_Token.AmountInput;
1031
1038
  /** Address to burn tokens from. */
1032
1039
  from: Address;
1033
- /** Address or ID of the TIP20 token. */
1034
- token: TokenId.TokenIdOrAddress;
1035
- };
1040
+ } & TokenParameter;
1041
+ type Parameters<chain extends Chain | undefined = Chain | undefined, account extends Account | undefined = Account | undefined> = WriteParameters<chain, account> & Args;
1036
1042
  type ReturnValue = WriteContractReturnType;
1037
1043
  type ErrorType = BaseErrorType;
1038
1044
  /** @internal */
@@ -1058,7 +1064,7 @@ export declare namespace burnBlocked {
1058
1064
  *
1059
1065
  * const { result } = await client.sendCalls({
1060
1066
  * calls: [
1061
- * actions.token.burnBlocked.call({
1067
+ * actions.token.burnBlocked.call(client, {
1062
1068
  * from: '0x20c0...beef',
1063
1069
  * amount: 100n,
1064
1070
  * token: '0x20c0...babe',
@@ -1067,10 +1073,12 @@ export declare namespace burnBlocked {
1067
1073
  * })
1068
1074
  * ```
1069
1075
  *
1076
+ * `amount.decimals` is inferred from the client's declared `tokens` when omitted.
1077
+ *
1070
1078
  * @param args - Arguments.
1071
1079
  * @returns The call.
1072
1080
  */
1073
- function call(args: Args): {
1081
+ function call<chain extends Chain | undefined>(client: Client<Transport, chain>, args: Args): {
1074
1082
  abi: [{
1075
1083
  readonly name: "burnBlocked";
1076
1084
  readonly type: "function";
@@ -2005,15 +2013,13 @@ export declare namespace burnBlockedSync {
2005
2013
  */
2006
2014
  export declare function burn<chain extends Chain | undefined, account extends Account | undefined>(client: Client<Transport, chain, account>, parameters: burn.Parameters<chain, account>): Promise<burn.ReturnValue>;
2007
2015
  export declare namespace burn {
2008
- type Parameters<chain extends Chain | undefined = Chain | undefined, account extends Account | undefined = Account | undefined> = WriteParameters<chain, account> & Args;
2009
2016
  type Args = {
2010
- /** Amount of tokens to burn. */
2011
- amount: bigint;
2017
+ /** Amount of tokens to burn, in base units or formatted decimal form. */
2018
+ amount: internal_Token.AmountInput;
2012
2019
  /** Memo to include in the transfer. */
2013
2020
  memo?: Hex.Hex | undefined;
2014
- /** Address or ID of the TIP20 token. */
2015
- token: TokenId.TokenIdOrAddress;
2016
- };
2021
+ } & TokenParameter;
2022
+ type Parameters<chain extends Chain | undefined = Chain | undefined, account extends Account | undefined = Account | undefined> = WriteParameters<chain, account> & Args;
2017
2023
  type ReturnValue = WriteContractReturnType;
2018
2024
  type ErrorType = BaseErrorType;
2019
2025
  /** @internal */
@@ -2039,7 +2045,7 @@ export declare namespace burn {
2039
2045
  *
2040
2046
  * const { result } = await client.sendCalls({
2041
2047
  * calls: [
2042
- * actions.token.burn.call({
2048
+ * actions.token.burn.call(client, {
2043
2049
  * amount: 100n,
2044
2050
  * token: '0x20c0...babe',
2045
2051
  * }),
@@ -2047,10 +2053,12 @@ export declare namespace burn {
2047
2053
  * })
2048
2054
  * ```
2049
2055
  *
2056
+ * `amount.decimals` is inferred from the client's declared `tokens` when omitted.
2057
+ *
2050
2058
  * @param args - Arguments.
2051
2059
  * @returns The call.
2052
2060
  */
2053
- function call(args: Args): {
2061
+ function call<chain extends Chain | undefined>(client: Client<Transport, chain>, args: Args): {
2054
2062
  abi: [{
2055
2063
  readonly name: "burn";
2056
2064
  readonly type: "function";
@@ -3024,7 +3032,7 @@ export declare namespace changeTransferPolicy {
3024
3032
  *
3025
3033
  * const { result } = await client.sendCalls({
3026
3034
  * calls: [
3027
- * actions.token.changeTransferPolicy.call({
3035
+ * actions.token.changeTransferPolicy.call(client, {
3028
3036
  * token: '0x20c0...babe',
3029
3037
  * policyId: 1n,
3030
3038
  * }),
@@ -3035,7 +3043,7 @@ export declare namespace changeTransferPolicy {
3035
3043
  * @param args - Arguments.
3036
3044
  * @returns The call.
3037
3045
  */
3038
- function call(args: Args): {
3046
+ function call<chain extends Chain | undefined>(client: Client<Transport, chain>, args: Args): {
3039
3047
  abi: [{
3040
3048
  readonly name: "changeTransferPolicyId";
3041
3049
  readonly type: "function";
@@ -4013,7 +4021,7 @@ export declare namespace create {
4013
4021
  *
4014
4022
  * const { result } = await client.sendCalls({
4015
4023
  * calls: [
4016
- * actions.token.create.call({
4024
+ * actions.token.create.call(client, {
4017
4025
  * name: 'My Token',
4018
4026
  * symbol: 'MTK',
4019
4027
  * currency: 'USD',
@@ -4027,7 +4035,7 @@ export declare namespace create {
4027
4035
  * @param args - Arguments.
4028
4036
  * @returns The call.
4029
4037
  */
4030
- function call(args: Args): {
4038
+ function call<chain extends Chain | undefined>(client: Client<Transport, chain>, args: Args): {
4031
4039
  abi: [{
4032
4040
  readonly name: "createToken";
4033
4041
  readonly type: "function";
@@ -4286,33 +4294,38 @@ export declare namespace createSync {
4286
4294
  * })
4287
4295
  *
4288
4296
  * const allowance = await Actions.token.getAllowance(client, {
4297
+ * account: '0x...',
4289
4298
  * spender: '0x...',
4299
+ * token: '0x...',
4290
4300
  * })
4291
4301
  * ```
4292
4302
  *
4293
4303
  * @param client - Client.
4294
4304
  * @param parameters - Parameters.
4295
- * @returns The token allowance.
4305
+ * @returns The token allowance, in base units and human-readable form.
4296
4306
  */
4297
- export declare function getAllowance<chain extends Chain | undefined, account extends Account | undefined>(client: Client<Transport, chain, account>, parameters: getAllowance.Parameters<account>): Promise<getAllowance.ReturnValue>;
4307
+ export declare function getAllowance<chain extends Chain | undefined>(client: Client<Transport, chain>, parameters: getAllowance.Parameters): Promise<getAllowance.ReturnValue>;
4298
4308
  export declare namespace getAllowance {
4299
- type Parameters<account extends Account | undefined = Account | undefined> = ReadParameters & GetAccountParameter<account> & Omit<Args, 'account'> & {};
4300
4309
  type Args = {
4301
- /** Account address. */
4310
+ /** Account that owns the tokens. */
4302
4311
  account: Address;
4303
- /** Address of the spender. */
4312
+ /** Spender of the tokens. */
4304
4313
  spender: Address;
4305
- /** Address or ID of the TIP20 token. */
4306
- token: TokenId.TokenIdOrAddress;
4307
- };
4308
- type ReturnValue = ReadContractReturnType<typeof Abis.tip20, 'allowance', never>;
4314
+ } & TokenParameters;
4315
+ type Parameters = ReadParameters & Args;
4316
+ type ReturnValue = internal_Token.Amount;
4309
4317
  /**
4310
4318
  * Defines a call to the `allowance` function.
4311
4319
  *
4320
+ * Can be passed as a parameter to `multicall`, `simulateContract`, or any
4321
+ * other action that accepts a contract call. The token is selected by `token`,
4322
+ * which is either a TIP20 token id or a contract address.
4323
+ *
4324
+ * @param client - Client.
4312
4325
  * @param args - Arguments.
4313
4326
  * @returns The call.
4314
4327
  */
4315
- function call(args: Args): {
4328
+ function call<chain extends Chain | undefined>(client: Client<Transport, chain>, args: Args): {
4316
4329
  abi: [{
4317
4330
  readonly name: "allowance";
4318
4331
  readonly type: "function";
@@ -4355,31 +4368,32 @@ export declare namespace getAllowance {
4355
4368
  * })
4356
4369
  *
4357
4370
  * const balance = await Actions.token.getBalance(client, {
4371
+ * account: '0x...',
4358
4372
  * token: '0x...',
4359
4373
  * })
4360
4374
  * ```
4361
4375
  *
4362
4376
  * @param client - Client.
4363
4377
  * @param parameters - Parameters.
4364
- * @returns The token balance.
4378
+ * @returns The token balance, in base units and human-readable form.
4365
4379
  */
4366
4380
  export declare function getBalance<chain extends Chain | undefined, account extends Account | undefined>(client: Client<Transport, chain, account>, parameters: getBalance.Parameters<account>): Promise<getBalance.ReturnValue>;
4367
4381
  export declare namespace getBalance {
4368
- type Parameters<account extends Account | undefined = Account | undefined> = ReadParameters & GetAccountParameter<account> & Omit<Args, 'account'>;
4369
- type Args = {
4370
- /** Account address. */
4371
- account: Address;
4372
- /** Address or ID of the TIP20 token. */
4373
- token: TokenId.TokenIdOrAddress;
4374
- };
4375
- type ReturnValue = ReadContractReturnType<typeof Abis.tip20, 'balanceOf', never>;
4382
+ type Args<account extends Account | undefined = Account | undefined> = GetAccountParameter<account, Account | Address> & TokenParameters;
4383
+ type Parameters<account extends Account | undefined = Account | undefined> = Omit<ReadParameters, 'account'> & Args<account>;
4384
+ type ReturnValue = internal_Token.Amount;
4376
4385
  /**
4377
4386
  * Defines a call to the `balanceOf` function.
4378
4387
  *
4388
+ * Can be passed as a parameter to `multicall`, `simulateContract`, or any
4389
+ * other action that accepts a contract call. The token is selected by `token`,
4390
+ * which is either a TIP20 token id or a contract address.
4391
+ *
4392
+ * @param client - Client.
4379
4393
  * @param args - Arguments.
4380
4394
  * @returns The call.
4381
4395
  */
4382
- function call(args: Args): {
4396
+ function call<chain extends Chain | undefined, account extends Account | undefined>(client: Client<Transport, chain, account>, args: Args<account>): {
4383
4397
  abi: [{
4384
4398
  readonly name: "balanceOf";
4385
4399
  readonly type: "function";
@@ -4429,10 +4443,7 @@ export declare namespace getBalance {
4429
4443
  */
4430
4444
  export declare function getMetadata<chain extends Chain | undefined>(client: Client<Transport, chain>, parameters: getMetadata.Parameters): Promise<getMetadata.ReturnValue>;
4431
4445
  export declare namespace getMetadata {
4432
- type Parameters = {
4433
- /** Address or ID of the TIP20 token. */
4434
- token: TokenId.TokenIdOrAddress;
4435
- };
4446
+ type Parameters = Omit<ReadParameters, 'account'> & TokenParameter;
4436
4447
  type ReturnValue = Compute<{
4437
4448
  /**
4438
4449
  * Currency (e.g. "USD").
@@ -4486,6 +4497,65 @@ export declare namespace getMetadata {
4486
4497
  transferPolicyId?: bigint | undefined;
4487
4498
  }>;
4488
4499
  }
4500
+ /**
4501
+ * Gets the total supply of a TIP20 token.
4502
+ *
4503
+ * @example
4504
+ * ```ts
4505
+ * import { createClient, http } from 'viem'
4506
+ * import { tempo } from 'viem/chains'
4507
+ * import { Actions } from 'viem/tempo'
4508
+ *
4509
+ * const client = createClient({
4510
+ * chain: tempo.extend({ feeToken: '0x20c0000000000000000000000000000000000001' })
4511
+ * transport: http(),
4512
+ * })
4513
+ *
4514
+ * const totalSupply = await Actions.token.getTotalSupply(client, {
4515
+ * token: '0x...',
4516
+ * })
4517
+ * ```
4518
+ *
4519
+ * @param client - Client.
4520
+ * @param parameters - Parameters.
4521
+ * @returns The token total supply, in base units and human-readable form.
4522
+ */
4523
+ export declare function getTotalSupply<chain extends Chain | undefined>(client: Client<Transport, chain>, parameters: getTotalSupply.Parameters): Promise<getTotalSupply.ReturnValue>;
4524
+ export declare namespace getTotalSupply {
4525
+ type Args = TokenParameters;
4526
+ type Parameters = Omit<ReadParameters, 'account'> & Args;
4527
+ type ReturnValue = internal_Token.Amount;
4528
+ /**
4529
+ * Defines a call to the `totalSupply` function.
4530
+ *
4531
+ * Can be passed as a parameter to `multicall`, `simulateContract`, or any
4532
+ * other action that accepts a contract call. The token is selected by `token`,
4533
+ * which is either a TIP20 token id or a contract address.
4534
+ *
4535
+ * @param client - Client.
4536
+ * @param args - Arguments.
4537
+ * @returns The call.
4538
+ */
4539
+ function call<chain extends Chain | undefined>(client: Client<Transport, chain>, args: Args): {
4540
+ abi: [{
4541
+ readonly name: "totalSupply";
4542
+ readonly type: "function";
4543
+ readonly stateMutability: "view";
4544
+ readonly inputs: readonly [];
4545
+ readonly outputs: readonly [{
4546
+ readonly type: "uint256";
4547
+ }];
4548
+ }];
4549
+ functionName: "totalSupply";
4550
+ } & {
4551
+ args?: readonly [] | undefined;
4552
+ } & {
4553
+ address: Address;
4554
+ } & {
4555
+ data: import("../../index.js").Hex;
4556
+ to: Address;
4557
+ };
4558
+ }
4489
4559
  /**
4490
4560
  * Gets the admin role for a specific role in a TIP20 token.
4491
4561
  *
@@ -4526,7 +4596,7 @@ export declare namespace getRoleAdmin {
4526
4596
  * @param args - Arguments.
4527
4597
  * @returns The call.
4528
4598
  */
4529
- function call(args: Args): {
4599
+ function call<chain extends Chain | undefined>(client: Client<Transport, chain>, args: Args): {
4530
4600
  abi: [{
4531
4601
  readonly name: "getRoleAdmin";
4532
4602
  readonly type: "function";
@@ -4592,7 +4662,7 @@ export declare namespace hasRole {
4592
4662
  * @param args - Arguments.
4593
4663
  * @returns The call.
4594
4664
  */
4595
- function call(args: Args): {
4665
+ function call<chain extends Chain | undefined>(client: Client<Transport, chain>, args: Args): {
4596
4666
  abi: [{
4597
4667
  readonly name: "hasRole";
4598
4668
  readonly type: "function";
@@ -4684,7 +4754,7 @@ export declare namespace grantRoles {
4684
4754
  *
4685
4755
  * const { result } = await client.sendCalls({
4686
4756
  * calls: [
4687
- * actions.token.grantRoles.call({
4757
+ * actions.token.grantRoles.call(client, {
4688
4758
  * token: '0x20c0...babe',
4689
4759
  * to: '0x20c0...beef',
4690
4760
  * role: 'issuer',
@@ -4696,7 +4766,7 @@ export declare namespace grantRoles {
4696
4766
  * @param args - Arguments.
4697
4767
  * @returns The call.
4698
4768
  */
4699
- function call(args: Args): {
4769
+ function call<chain extends Chain | undefined>(client: Client<Transport, chain>, args: Args): {
4700
4770
  abi: [{
4701
4771
  readonly name: "grantRole";
4702
4772
  readonly type: "function";
@@ -5632,21 +5702,19 @@ export declare namespace grantRolesSync {
5632
5702
  */
5633
5703
  export declare function mint<chain extends Chain | undefined, account extends Account | undefined>(client: Client<Transport, chain, account>, parameters: mint.Parameters<chain, account>): Promise<mint.ReturnValue>;
5634
5704
  export declare namespace mint {
5635
- type Parameters<chain extends Chain | undefined = Chain | undefined, account extends Account | undefined = Account | undefined> = WriteParameters<chain, account> & Args;
5636
5705
  type Args = {
5637
- /** Amount of tokens to mint. */
5638
- amount: bigint;
5706
+ /** Amount of tokens to mint, in base units or formatted decimal form. */
5707
+ amount: internal_Token.AmountInput;
5639
5708
  /** Memo to include in the mint. */
5640
5709
  memo?: Hex.Hex | undefined;
5641
5710
  /** Address to mint tokens to. */
5642
5711
  to: Address;
5643
- /** Address or ID of the TIP20 token. */
5644
- token: TokenId.TokenIdOrAddress;
5645
- };
5712
+ } & TokenParameter;
5713
+ type Parameters<chain extends Chain | undefined = Chain | undefined, account extends Account | undefined = Account | undefined> = WriteParameters<chain, account> & Args;
5646
5714
  type ReturnValue = WriteContractReturnType;
5647
5715
  type ErrorType = BaseErrorType;
5648
5716
  /** @internal */
5649
- function inner<action extends typeof writeContract | typeof writeContractSync, chain extends Chain | undefined, account extends Account | undefined>(action: action, client: Client<Transport, chain, account>, parameters: any): Promise<ReturnType<action>>;
5717
+ function inner<action extends typeof writeContract | typeof writeContractSync, chain extends Chain | undefined, account extends Account | undefined>(action: action, client: Client<Transport, chain, account>, parameters: mint.Parameters<chain, account>): Promise<ReturnType<action>>;
5650
5718
  /**
5651
5719
  * Defines a call to the `mint` or `mintWithMemo` function.
5652
5720
  *
@@ -5668,7 +5736,7 @@ export declare namespace mint {
5668
5736
  *
5669
5737
  * const { result } = await client.sendCalls({
5670
5738
  * calls: [
5671
- * actions.token.mint.call({
5739
+ * actions.token.mint.call(client, {
5672
5740
  * to: '0x20c0...beef',
5673
5741
  * amount: 100n,
5674
5742
  * token: '0x20c0...babe',
@@ -5677,10 +5745,12 @@ export declare namespace mint {
5677
5745
  * })
5678
5746
  * ```
5679
5747
  *
5748
+ * `amount.decimals` is inferred from the client's declared `tokens` when omitted.
5749
+ *
5680
5750
  * @param args - Arguments.
5681
5751
  * @returns The call.
5682
5752
  */
5683
- function call(args: Args): {
5753
+ function call<chain extends Chain | undefined>(client: Client<Transport, chain>, args: Args): {
5684
5754
  abi: [{
5685
5755
  readonly name: "mint";
5686
5756
  readonly type: "function";
@@ -6658,7 +6728,7 @@ export declare namespace pause {
6658
6728
  *
6659
6729
  * const { result } = await client.sendCalls({
6660
6730
  * calls: [
6661
- * actions.token.pause.call({
6731
+ * actions.token.pause.call(client, {
6662
6732
  * token: '0x20c0...babe',
6663
6733
  * }),
6664
6734
  * ]
@@ -6668,7 +6738,7 @@ export declare namespace pause {
6668
6738
  * @param args - Arguments.
6669
6739
  * @returns The call.
6670
6740
  */
6671
- function call(args: Args): {
6741
+ function call<chain extends Chain | undefined>(client: Client<Transport, chain>, args: Args): {
6672
6742
  abi: [{
6673
6743
  readonly name: "pause";
6674
6744
  readonly type: "function";
@@ -7629,7 +7699,7 @@ export declare namespace renounceRoles {
7629
7699
  *
7630
7700
  * const { result } = await client.sendCalls({
7631
7701
  * calls: [
7632
- * actions.token.renounceRoles.call({
7702
+ * actions.token.renounceRoles.call(client, {
7633
7703
  * token: '0x20c0...babe',
7634
7704
  * role: 'issuer',
7635
7705
  * }),
@@ -7640,7 +7710,7 @@ export declare namespace renounceRoles {
7640
7710
  * @param args - Arguments.
7641
7711
  * @returns The call.
7642
7712
  */
7643
- function call(args: Args): {
7713
+ function call<chain extends Chain | undefined>(client: Client<Transport, chain>, args: Args): {
7644
7714
  abi: [{
7645
7715
  readonly name: "renounceRole";
7646
7716
  readonly type: "function";
@@ -8609,7 +8679,7 @@ export declare namespace revokeRoles {
8609
8679
  *
8610
8680
  * const { result } = await client.sendCalls({
8611
8681
  * calls: [
8612
- * actions.token.revokeRoles.call({
8682
+ * actions.token.revokeRoles.call(client, {
8613
8683
  * token: '0x20c0...babe',
8614
8684
  * from: '0x20c0...beef',
8615
8685
  * role: 'issuer',
@@ -8621,7 +8691,7 @@ export declare namespace revokeRoles {
8621
8691
  * @param args - Arguments.
8622
8692
  * @returns The call.
8623
8693
  */
8624
- function call(args: Args): {
8694
+ function call<chain extends Chain | undefined>(client: Client<Transport, chain>, args: Args): {
8625
8695
  abi: [{
8626
8696
  readonly name: "revokeRole";
8627
8697
  readonly type: "function";
@@ -9588,7 +9658,7 @@ export declare namespace setSupplyCap {
9588
9658
  *
9589
9659
  * const { result } = await client.sendCalls({
9590
9660
  * calls: [
9591
- * actions.token.setSupplyCap.call({
9661
+ * actions.token.setSupplyCap.call(client, {
9592
9662
  * token: '0x20c0...babe',
9593
9663
  * supplyCap: 1000000n,
9594
9664
  * }),
@@ -9599,7 +9669,7 @@ export declare namespace setSupplyCap {
9599
9669
  * @param args - Arguments.
9600
9670
  * @returns The call.
9601
9671
  */
9602
- function call(args: Args): {
9672
+ function call<chain extends Chain | undefined>(client: Client<Transport, chain>, args: Args): {
9603
9673
  abi: [{
9604
9674
  readonly name: "setSupplyCap";
9605
9675
  readonly type: "function";
@@ -10564,7 +10634,7 @@ export declare namespace setRoleAdmin {
10564
10634
  *
10565
10635
  * const { result } = await client.sendCalls({
10566
10636
  * calls: [
10567
- * actions.token.setRoleAdmin.call({
10637
+ * actions.token.setRoleAdmin.call(client, {
10568
10638
  * token: '0x20c0...babe',
10569
10639
  * role: 'issuer',
10570
10640
  * adminRole: 'admin',
@@ -10576,7 +10646,7 @@ export declare namespace setRoleAdmin {
10576
10646
  * @param args - Arguments.
10577
10647
  * @returns The call.
10578
10648
  */
10579
- function call(args: Args): {
10649
+ function call<chain extends Chain | undefined>(client: Client<Transport, chain>, args: Args): {
10580
10650
  abi: [{
10581
10651
  readonly name: "setRoleAdmin";
10582
10652
  readonly type: "function";
@@ -11510,57 +11580,36 @@ export declare namespace setRoleAdminSync {
11510
11580
  */
11511
11581
  export declare function transfer<chain extends Chain | undefined, account extends Account | undefined>(client: Client<Transport, chain, account>, parameters: transfer.Parameters<chain, account>): Promise<transfer.ReturnValue>;
11512
11582
  export declare namespace transfer {
11513
- type Parameters<chain extends Chain | undefined = Chain | undefined, account extends Account | undefined = Account | undefined> = WriteParameters<chain, account> & Args;
11514
11583
  type Args = {
11515
- /** Amount of tokens to transfer. */
11516
- amount: bigint;
11517
- /** Address to transfer tokens from. */
11584
+ /** Amount of tokens to transfer, in base units or formatted decimal form. */
11585
+ amount: internal_Token.AmountInput;
11586
+ /** Address to transfer tokens from (uses an allowance via `transferFrom`). */
11518
11587
  from?: Address | undefined;
11519
11588
  /** Memo to include in the transfer. */
11520
11589
  memo?: Hex.Hex | undefined;
11521
- /** Address or ID of the TIP20 token. */
11522
- token: TokenId.TokenIdOrAddress;
11523
11590
  /** Address to transfer tokens to. */
11524
11591
  to: Address;
11525
- };
11592
+ } & TokenParameter;
11593
+ type Parameters<chain extends Chain | undefined = Chain | undefined, account extends Account | undefined = Account | undefined> = WriteParameters<chain, account> & Args;
11526
11594
  type ReturnValue = WriteContractReturnType;
11527
11595
  type ErrorType = BaseErrorType;
11528
11596
  /** @internal */
11529
11597
  function inner<action extends typeof writeContract | typeof writeContractSync, chain extends Chain | undefined, account extends Account | undefined>(action: action, client: Client<Transport, chain, account>, parameters: transfer.Parameters<chain, account>): Promise<ReturnType<action>>;
11530
11598
  /**
11531
- * Defines a call to the `transfer`, `transferFrom`, `transferWithMemo`, or `transferFromWithMemo` function.
11599
+ * Defines a call to the `transfer`, `transferFrom`, `transferWithMemo`, or
11600
+ * `transferFromWithMemo` function.
11532
11601
  *
11533
- * Can be passed as a parameter to:
11534
- * - [`estimateContractGas`](https://viem.sh/docs/contract/estimateContractGas): estimate the gas cost of the call
11535
- * - [`simulateContract`](https://viem.sh/docs/contract/simulateContract): simulate the call
11536
- * - [`sendCalls`](https://viem.sh/docs/actions/wallet/sendCalls): send multiple calls
11602
+ * Can be passed as a parameter to `estimateContractGas`, `simulateContract`,
11603
+ * `sendCalls`, `sendTransaction` (`calls`), or `multicall`. The token is
11604
+ * selected by `token`, which is either a TIP20 token id or a contract
11605
+ * `address`; `amount.decimals` is inferred from the client's declared
11606
+ * `tokens` when omitted.
11537
11607
  *
11538
- * @example
11539
- * ```ts
11540
- * import { createClient, http, walletActions } from 'viem'
11541
- * import { tempo } from 'viem/chains'
11542
- * import { Actions } from 'viem/tempo'
11543
- *
11544
- * const client = createClient({
11545
- * chain: tempo.extend({ feeToken: '0x20c0000000000000000000000000000000000001' })
11546
- * transport: http(),
11547
- * }).extend(walletActions)
11548
- *
11549
- * const { result } = await client.sendCalls({
11550
- * calls: [
11551
- * actions.token.transfer.call({
11552
- * to: '0x20c0...beef',
11553
- * amount: 100n,
11554
- * token: '0x20c0...babe',
11555
- * }),
11556
- * ]
11557
- * })
11558
- * ```
11559
- *
11560
- * @param args - Arguments.
11608
+ * @param client - Client.
11609
+ * @param parameters - Parameters.
11561
11610
  * @returns The call.
11562
11611
  */
11563
- function call(args: Args): {
11612
+ function call<chain extends Chain | undefined>(client: Client<Transport, chain>, parameters: Args): {
11564
11613
  abi: [{
11565
11614
  readonly name: "transfer";
11566
11615
  readonly type: "function";
@@ -11638,10 +11687,28 @@ export declare namespace transfer {
11638
11687
  to: Address;
11639
11688
  };
11640
11689
  /**
11641
- * Extracts the event from the logs.
11690
+ * Estimates the gas required to transfer TIP20 tokens. `amount.decimals` is
11691
+ * inferred from the client's declared `tokens` when omitted.
11692
+ *
11693
+ * @param client - Client.
11694
+ * @param parameters - Parameters.
11695
+ * @returns The gas estimate.
11696
+ */
11697
+ function estimateGas<chain extends Chain | undefined, account extends Account | undefined>(client: Client<Transport, chain, account>, parameters: transfer.Parameters<chain, account>): Promise<bigint>;
11698
+ /**
11699
+ * Simulates a transfer of TIP20 tokens. `amount.decimals` is inferred from
11700
+ * the client's declared `tokens` when omitted.
11701
+ *
11702
+ * @param client - Client.
11703
+ * @param parameters - Parameters.
11704
+ * @returns The simulation result and write request.
11705
+ */
11706
+ function simulate<chain extends Chain | undefined, account extends Account | undefined>(client: Client<Transport, chain, account>, parameters: transfer.Parameters<chain, account>): Promise<SimulateContractReturnType<typeof Abis.tip20, 'transfer' | 'transferFrom' | 'transferWithMemo' | 'transferFromWithMemo'>>;
11707
+ /**
11708
+ * Extracts the `Transfer` event from logs.
11642
11709
  *
11643
11710
  * @param logs - Logs.
11644
- * @returns The event.
11711
+ * @returns The `Transfer` event.
11645
11712
  */
11646
11713
  function extractEvent(logs: Log[]): Log<bigint, number, false, undefined, true, readonly [{
11647
11714
  readonly name: "name";
@@ -12509,14 +12576,19 @@ export declare namespace transfer {
12509
12576
  */
12510
12577
  export declare function transferSync<chain extends Chain | undefined, account extends Account | undefined>(client: Client<Transport, chain, account>, parameters: transferSync.Parameters<chain, account>): Promise<transferSync.ReturnValue>;
12511
12578
  export declare namespace transferSync {
12512
- type Parameters<chain extends Chain | undefined = Chain | undefined, account extends Account | undefined = Account | undefined> = transfer.Parameters<chain, account>;
12513
12579
  type Args = transfer.Args;
12514
- type ReturnValue = GetEventArgs<typeof Abis.tip20, 'Transfer', {
12580
+ type Parameters<chain extends Chain | undefined = Chain | undefined, account extends Account | undefined = Account | undefined> = transfer.Parameters<chain, account>;
12581
+ type ReturnValue = Compute<GetEventArgs<typeof Abis.tip20, 'Transfer', {
12515
12582
  IndexedOnly: false;
12516
12583
  Required: true;
12517
12584
  }> & {
12585
+ /** Token decimals used to derive `formatted`, if known. */
12586
+ decimals?: number | undefined;
12587
+ /** Transferred amount formatted with the token's `decimals`, if known. */
12588
+ formatted?: string | undefined;
12589
+ /** Transaction receipt. */
12518
12590
  receipt: TransactionReceipt;
12519
- };
12591
+ }>;
12520
12592
  type ErrorType = BaseErrorType;
12521
12593
  }
12522
12594
  /**
@@ -12576,7 +12648,7 @@ export declare namespace unpause {
12576
12648
  *
12577
12649
  * const { result } = await client.sendCalls({
12578
12650
  * calls: [
12579
- * actions.token.unpause.call({
12651
+ * actions.token.unpause.call(client, {
12580
12652
  * token: '0x20c0...babe',
12581
12653
  * }),
12582
12654
  * ]
@@ -12586,7 +12658,7 @@ export declare namespace unpause {
12586
12658
  * @param args - Arguments.
12587
12659
  * @returns The call.
12588
12660
  */
12589
- function call(args: Args): {
12661
+ function call<chain extends Chain | undefined>(client: Client<Transport, chain>, args: Args): {
12590
12662
  abi: [{
12591
12663
  readonly name: "unpause";
12592
12664
  readonly type: "function";
@@ -13544,7 +13616,7 @@ export declare namespace prepareUpdateQuoteToken {
13544
13616
  *
13545
13617
  * const { result } = await client.sendCalls({
13546
13618
  * calls: [
13547
- * actions.token.prepareUpdateQuoteToken.call({
13619
+ * actions.token.prepareUpdateQuoteToken.call(client, {
13548
13620
  * token: '0x20c0...babe',
13549
13621
  * quoteToken: '0x20c0...cafe',
13550
13622
  * }),
@@ -13555,7 +13627,7 @@ export declare namespace prepareUpdateQuoteToken {
13555
13627
  * @param args - Arguments.
13556
13628
  * @returns The call.
13557
13629
  */
13558
- function call(args: Args): {
13630
+ function call<chain extends Chain | undefined>(client: Client<Transport, chain>, args: Args): {
13559
13631
  abi: [{
13560
13632
  readonly name: "setNextQuoteToken";
13561
13633
  readonly type: "function";
@@ -14514,7 +14586,7 @@ export declare namespace updateQuoteToken {
14514
14586
  *
14515
14587
  * const { result } = await client.sendCalls({
14516
14588
  * calls: [
14517
- * actions.token.updateQuoteToken.call({
14589
+ * actions.token.updateQuoteToken.call(client, {
14518
14590
  * token: '0x20c0...babe',
14519
14591
  * }),
14520
14592
  * ]
@@ -14524,7 +14596,7 @@ export declare namespace updateQuoteToken {
14524
14596
  * @param args - Arguments.
14525
14597
  * @returns The call.
14526
14598
  */
14527
- function call(args: Args): {
14599
+ function call<chain extends Chain | undefined>(client: Client<Transport, chain>, args: Args): {
14528
14600
  abi: [{
14529
14601
  readonly name: "completeQuoteTokenUpdate";
14530
14602
  readonly type: "function";