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
@@ -13,6 +13,7 @@ exports.createSync = createSync;
13
13
  exports.getAllowance = getAllowance;
14
14
  exports.getBalance = getBalance;
15
15
  exports.getMetadata = getMetadata;
16
+ exports.getTotalSupply = getTotalSupply;
16
17
  exports.getRoleAdmin = getRoleAdmin;
17
18
  exports.hasRole = hasRole;
18
19
  exports.grantRoles = grantRoles;
@@ -48,41 +49,59 @@ exports.watchUpdateQuoteToken = watchUpdateQuoteToken;
48
49
  const Hex = require("ox/Hex");
49
50
  const tempo_1 = require("ox/tempo");
50
51
  const parseAccount_js_1 = require("../../accounts/utils/parseAccount.js");
52
+ const estimateContractGas_js_1 = require("../../actions/public/estimateContractGas.js");
51
53
  const multicall_js_1 = require("../../actions/public/multicall.js");
52
54
  const readContract_js_1 = require("../../actions/public/readContract.js");
55
+ const simulateContract_js_1 = require("../../actions/public/simulateContract.js");
53
56
  const watchContractEvent_js_1 = require("../../actions/public/watchContractEvent.js");
57
+ const internal_Token = require("../../actions/token/internal.js");
54
58
  const sendTransaction_js_1 = require("../../actions/wallet/sendTransaction.js");
55
59
  const sendTransactionSync_js_1 = require("../../actions/wallet/sendTransactionSync.js");
56
60
  const writeContract_js_1 = require("../../actions/wallet/writeContract.js");
57
61
  const writeContractSync_js_1 = require("../../actions/wallet/writeContractSync.js");
62
+ const account_js_1 = require("../../errors/account.js");
58
63
  const encodeFunctionData_js_1 = require("../../utils/abi/encodeFunctionData.js");
59
64
  const parseEventLogs_js_1 = require("../../utils/abi/parseEventLogs.js");
65
+ const formatUnits_js_1 = require("../../utils/unit/formatUnits.js");
60
66
  const Abis = require("../Abis.js");
61
67
  const Addresses = require("../Addresses.js");
62
68
  const utils_js_1 = require("../internal/utils.js");
63
69
  async function approve(client, parameters) {
64
- const { token, ...rest } = parameters;
65
- return approve.inner(writeContract_js_1.writeContract, client, parameters, { ...rest, token });
70
+ return approve.inner(writeContract_js_1.writeContract, client, parameters);
66
71
  }
67
72
  (function (approve) {
68
- async function inner(action, client, parameters, args) {
69
- const call = approve.call(args);
73
+ async function inner(action, client, parameters) {
70
74
  return (await action(client, {
71
75
  ...parameters,
72
- ...call,
76
+ ...approve.call(client, parameters),
73
77
  }));
74
78
  }
75
79
  approve.inner = inner;
76
- function call(args) {
77
- const { spender, amount, token } = args;
80
+ function call(client, parameters) {
81
+ const { amount, spender, token } = parameters;
82
+ const { address, decimals } = (0, utils_js_1.resolveToken)(client, { token });
78
83
  return (0, utils_js_1.defineCall)({
79
- address: tempo_1.TokenId.toAddress(token),
84
+ address,
80
85
  abi: Abis.tip20,
81
86
  functionName: 'approve',
82
- args: [spender, amount],
87
+ args: [spender, internal_Token.toBaseUnits(amount, decimals)],
83
88
  });
84
89
  }
85
90
  approve.call = call;
91
+ async function estimateGas(client, parameters) {
92
+ return (0, estimateContractGas_js_1.estimateContractGas)(client, {
93
+ ...(0, utils_js_1.pickWriteParameters)(parameters),
94
+ ...approve.call(client, parameters),
95
+ });
96
+ }
97
+ approve.estimateGas = estimateGas;
98
+ async function simulate(client, parameters) {
99
+ return (0, simulateContract_js_1.simulateContract)(client, {
100
+ ...(0, utils_js_1.pickWriteParameters)(parameters),
101
+ ...approve.call(client, parameters),
102
+ });
103
+ }
104
+ approve.simulate = simulate;
86
105
  function extractEvent(logs) {
87
106
  const [log] = (0, parseEventLogs_js_1.parseEventLogs)({
88
107
  abi: Abis.tip20,
@@ -96,11 +115,19 @@ async function approve(client, parameters) {
96
115
  approve.extractEvent = extractEvent;
97
116
  })(approve || (exports.approve = approve = {}));
98
117
  async function approveSync(client, parameters) {
99
- const { throwOnReceiptRevert = true, ...rest } = parameters;
100
- const receipt = await approve.inner(writeContractSync_js_1.writeContractSync, client, { ...parameters, throwOnReceiptRevert }, rest);
118
+ const { amount, token, throwOnReceiptRevert = true } = parameters;
119
+ const { decimals } = (0, utils_js_1.resolveToken)(client, { token });
120
+ const resolved = internal_Token.resolveAmountDecimals(amount, decimals);
121
+ const receipt = await approve.inner(writeContractSync_js_1.writeContractSync, client, {
122
+ ...parameters,
123
+ throwOnReceiptRevert,
124
+ });
101
125
  const { args } = approve.extractEvent(receipt.logs);
102
126
  return {
103
127
  ...args,
128
+ ...(resolved === undefined
129
+ ? {}
130
+ : { decimals: resolved, formatted: (0, formatUnits_js_1.formatUnits)(args.amount, resolved) }),
104
131
  receipt,
105
132
  };
106
133
  }
@@ -110,20 +137,21 @@ async function burnBlocked(client, parameters) {
110
137
  (function (burnBlocked) {
111
138
  async function inner(action, client, parameters) {
112
139
  const { amount, from, token, ...rest } = parameters;
113
- const call = burnBlocked.call({ amount, from, token });
140
+ const call = burnBlocked.call(client, { amount, from, token });
114
141
  return (await action(client, {
115
142
  ...rest,
116
143
  ...call,
117
144
  }));
118
145
  }
119
146
  burnBlocked.inner = inner;
120
- function call(args) {
147
+ function call(client, args) {
121
148
  const { from, amount, token } = args;
149
+ const { address, decimals } = (0, utils_js_1.resolveToken)(client, { token });
122
150
  return (0, utils_js_1.defineCall)({
123
- address: tempo_1.TokenId.toAddress(token),
151
+ address,
124
152
  abi: Abis.tip20,
125
153
  functionName: 'burnBlocked',
126
- args: [from, amount],
154
+ args: [from, internal_Token.toBaseUnits(amount, decimals)],
127
155
  });
128
156
  }
129
157
  burnBlocked.call = call;
@@ -157,26 +185,28 @@ async function burn(client, parameters) {
157
185
  (function (burn) {
158
186
  async function inner(action, client, parameters) {
159
187
  const { amount, memo, token, ...rest } = parameters;
160
- const call = burn.call({ amount, memo, token });
188
+ const call = burn.call(client, { amount, memo, token });
161
189
  return (await action(client, {
162
190
  ...rest,
163
191
  ...call,
164
192
  }));
165
193
  }
166
194
  burn.inner = inner;
167
- function call(args) {
195
+ function call(client, args) {
168
196
  const { amount, memo, token } = args;
197
+ const { address, decimals } = (0, utils_js_1.resolveToken)(client, { token });
198
+ const value = internal_Token.toBaseUnits(amount, decimals);
169
199
  const callArgs = memo
170
200
  ? {
171
201
  functionName: 'burnWithMemo',
172
- args: [amount, Hex.padLeft(memo, 32)],
202
+ args: [value, Hex.padLeft(memo, 32)],
173
203
  }
174
204
  : {
175
205
  functionName: 'burn',
176
- args: [amount],
206
+ args: [value],
177
207
  };
178
208
  return (0, utils_js_1.defineCall)({
179
- address: tempo_1.TokenId.toAddress(token),
209
+ address,
180
210
  abi: Abis.tip20,
181
211
  ...callArgs,
182
212
  });
@@ -212,17 +242,17 @@ async function changeTransferPolicy(client, parameters) {
212
242
  (function (changeTransferPolicy) {
213
243
  async function inner(action, client, parameters) {
214
244
  const { policyId, token, ...rest } = parameters;
215
- const call = changeTransferPolicy.call({ policyId, token });
245
+ const call = changeTransferPolicy.call(client, { policyId, token });
216
246
  return (await action(client, {
217
247
  ...rest,
218
248
  ...call,
219
249
  }));
220
250
  }
221
251
  changeTransferPolicy.inner = inner;
222
- function call(args) {
252
+ function call(client, args) {
223
253
  const { token, policyId } = args;
224
254
  return (0, utils_js_1.defineCall)({
225
- address: tempo_1.TokenId.toAddress(token),
255
+ address: (0, utils_js_1.resolveToken)(client, { token }).address,
226
256
  abi: Abis.tip20,
227
257
  functionName: 'changeTransferPolicyId',
228
258
  args: [policyId],
@@ -262,7 +292,7 @@ async function create(client, parameters) {
262
292
  const admin = admin_ ? (0, parseAccount_js_1.parseAccount)(admin_) : undefined;
263
293
  if (!admin)
264
294
  throw new Error('admin is required.');
265
- const call = create.call({ ...rest, admin: admin.address });
295
+ const call = create.call(client, { ...rest, admin: admin.address });
266
296
  return (await action(client, {
267
297
  ...parameters,
268
298
  account,
@@ -271,7 +301,7 @@ async function create(client, parameters) {
271
301
  }));
272
302
  }
273
303
  create.inner = inner;
274
- function call(args) {
304
+ function call(client, args) {
275
305
  const { name, symbol, currency, logoURI, quoteToken = Addresses.pathUsd, admin, salt = Hex.random(32), } = args;
276
306
  return (0, utils_js_1.defineCall)({
277
307
  address: Addresses.tip20Factory,
@@ -281,7 +311,7 @@ async function create(client, parameters) {
281
311
  name,
282
312
  symbol,
283
313
  currency,
284
- tempo_1.TokenId.toAddress(quoteToken),
314
+ (0, utils_js_1.resolveToken)(client, { token: quoteToken }).address,
285
315
  admin,
286
316
  salt,
287
317
  logoURI,
@@ -290,7 +320,7 @@ async function create(client, parameters) {
290
320
  name,
291
321
  symbol,
292
322
  currency,
293
- tempo_1.TokenId.toAddress(quoteToken),
323
+ (0, utils_js_1.resolveToken)(client, { token: quoteToken }).address,
294
324
  admin,
295
325
  salt,
296
326
  ],
@@ -326,42 +356,55 @@ async function createSync(client, parameters) {
326
356
  };
327
357
  }
328
358
  async function getAllowance(client, parameters) {
329
- const { account = client.account } = parameters;
330
- const address = account ? (0, parseAccount_js_1.parseAccount)(account).address : undefined;
331
- if (!address)
332
- throw new Error('account is required.');
333
- return (0, readContract_js_1.readContract)(client, {
334
- ...parameters,
335
- ...getAllowance.call({ ...parameters, account: address }),
336
- });
359
+ const { account, decimals, spender, token, ...rest } = parameters;
360
+ const [amount, { decimals: resolved }] = await Promise.all([
361
+ (0, readContract_js_1.readContract)(client, {
362
+ ...rest,
363
+ ...getAllowance.call(client, { account, spender, token }),
364
+ }),
365
+ (0, utils_js_1.resolveTokenWithDecimals)(client, {
366
+ decimals,
367
+ token,
368
+ }),
369
+ ]);
370
+ return internal_Token.toAmount(amount, resolved);
337
371
  }
338
372
  (function (getAllowance) {
339
- function call(args) {
340
- const { account, spender, token } = args;
373
+ function call(client, args) {
341
374
  return (0, utils_js_1.defineCall)({
342
- address: tempo_1.TokenId.toAddress(token),
375
+ address: (0, utils_js_1.resolveToken)(client, args).address,
343
376
  abi: Abis.tip20,
344
377
  functionName: 'allowance',
345
- args: [account, spender],
378
+ args: [args.account, args.spender],
346
379
  });
347
380
  }
348
381
  getAllowance.call = call;
349
382
  })(getAllowance || (exports.getAllowance = getAllowance = {}));
350
383
  async function getBalance(client, parameters) {
351
- const { account = client.account, ...rest } = parameters;
352
- const address = account ? (0, parseAccount_js_1.parseAccount)(account).address : undefined;
353
- if (!address)
354
- throw new Error('account is required.');
355
- return (0, readContract_js_1.readContract)(client, {
356
- ...rest,
357
- ...getBalance.call({ account: address, ...rest }),
358
- });
384
+ const { account: account_ = client.account, decimals, token, ...rest } = parameters;
385
+ if (!account_)
386
+ throw new account_js_1.AccountNotFoundError();
387
+ const account = (0, parseAccount_js_1.parseAccount)(account_).address;
388
+ const [amount, { decimals: resolved }] = await Promise.all([
389
+ (0, readContract_js_1.readContract)(client, {
390
+ ...rest,
391
+ ...getBalance.call(client, { account, token }),
392
+ }),
393
+ (0, utils_js_1.resolveTokenWithDecimals)(client, {
394
+ decimals,
395
+ token,
396
+ }),
397
+ ]);
398
+ return internal_Token.toAmount(amount, resolved);
359
399
  }
360
400
  (function (getBalance) {
361
- function call(args) {
362
- const { account, token } = args;
401
+ function call(client, args) {
402
+ const account_ = args.account ?? client.account;
403
+ if (!account_)
404
+ throw new account_js_1.AccountNotFoundError();
405
+ const account = (0, parseAccount_js_1.parseAccount)(account_).address;
363
406
  return (0, utils_js_1.defineCall)({
364
- address: tempo_1.TokenId.toAddress(token),
407
+ address: (0, utils_js_1.resolveToken)(client, args).address,
365
408
  abi: Abis.tip20,
366
409
  functionName: 'balanceOf',
367
410
  args: [account],
@@ -371,9 +414,15 @@ async function getBalance(client, parameters) {
371
414
  })(getBalance || (exports.getBalance = getBalance = {}));
372
415
  async function getMetadata(client, parameters) {
373
416
  const { token, ...rest } = parameters;
374
- const address = tempo_1.TokenId.toAddress(token);
417
+ const { address } = (0, utils_js_1.resolveToken)(client, { token });
375
418
  const abi = Abis.tip20;
376
- if (tempo_1.TokenId.from(token) === tempo_1.TokenId.fromAddress(Addresses.pathUsd))
419
+ const declared = (0, utils_js_1.findDeclaredToken)(client, token);
420
+ const overrides = {
421
+ ...(declared?.decimals != null ? { decimals: declared.decimals } : {}),
422
+ ...(declared?.name != null ? { name: declared.name } : {}),
423
+ ...(declared?.symbol != null ? { symbol: declared.symbol } : {}),
424
+ };
425
+ if (tempo_1.TokenId.fromAddress(address) === tempo_1.TokenId.fromAddress(Addresses.pathUsd))
377
426
  return (0, multicall_js_1.multicall)(client, {
378
427
  ...rest,
379
428
  contracts: [
@@ -417,6 +466,7 @@ async function getMetadata(client, parameters) {
417
466
  decimals: unwrapMulticallResult(decimals),
418
467
  logoURI: unwrapMulticallResult(logoURI, ''),
419
468
  totalSupply: unwrapMulticallResult(totalSupply),
469
+ ...overrides,
420
470
  }));
421
471
  return (0, multicall_js_1.multicall)(client, {
422
472
  ...rest,
@@ -485,6 +535,7 @@ async function getMetadata(client, parameters) {
485
535
  paused: unwrapMulticallResult(paused),
486
536
  supplyCap: unwrapMulticallResult(supplyCap),
487
537
  transferPolicyId: unwrapMulticallResult(transferPolicyId),
538
+ ...overrides,
488
539
  }));
489
540
  }
490
541
  function unwrapMulticallResult(response, ...fallback) {
@@ -495,17 +546,42 @@ function unwrapMulticallResult(response, ...fallback) {
495
546
  }
496
547
  return response.result;
497
548
  }
549
+ async function getTotalSupply(client, parameters) {
550
+ const { decimals, token, ...rest } = parameters;
551
+ const [amount, { decimals: resolved }] = await Promise.all([
552
+ (0, readContract_js_1.readContract)(client, {
553
+ ...rest,
554
+ ...getTotalSupply.call(client, { token }),
555
+ }),
556
+ (0, utils_js_1.resolveTokenWithDecimals)(client, {
557
+ decimals,
558
+ token,
559
+ }),
560
+ ]);
561
+ return internal_Token.toAmount(amount, resolved);
562
+ }
563
+ (function (getTotalSupply) {
564
+ function call(client, args) {
565
+ return (0, utils_js_1.defineCall)({
566
+ address: (0, utils_js_1.resolveToken)(client, args).address,
567
+ abi: Abis.tip20,
568
+ args: [],
569
+ functionName: 'totalSupply',
570
+ });
571
+ }
572
+ getTotalSupply.call = call;
573
+ })(getTotalSupply || (exports.getTotalSupply = getTotalSupply = {}));
498
574
  async function getRoleAdmin(client, parameters) {
499
575
  return (0, readContract_js_1.readContract)(client, {
500
576
  ...parameters,
501
- ...getRoleAdmin.call(parameters),
577
+ ...getRoleAdmin.call(client, parameters),
502
578
  });
503
579
  }
504
580
  (function (getRoleAdmin) {
505
- function call(args) {
581
+ function call(client, args) {
506
582
  const { role, token } = args;
507
583
  return (0, utils_js_1.defineCall)({
508
- address: tempo_1.TokenId.toAddress(token),
584
+ address: (0, utils_js_1.resolveToken)(client, { token }).address,
509
585
  abi: Abis.tip20,
510
586
  functionName: 'getRoleAdmin',
511
587
  args: [tempo_1.TokenRole.serialize(role)],
@@ -520,14 +596,14 @@ async function hasRole(client, parameters) {
520
596
  throw new Error('account is required.');
521
597
  return (0, readContract_js_1.readContract)(client, {
522
598
  ...parameters,
523
- ...hasRole.call({ ...parameters, account: address }),
599
+ ...hasRole.call(client, { ...parameters, account: address }),
524
600
  });
525
601
  }
526
602
  (function (hasRole) {
527
- function call(args) {
603
+ function call(client, args) {
528
604
  const { account, role, token } = args;
529
605
  return (0, utils_js_1.defineCall)({
530
- address: tempo_1.TokenId.toAddress(token),
606
+ address: (0, utils_js_1.resolveToken)(client, { token }).address,
531
607
  abi: Abis.tip20,
532
608
  functionName: 'hasRole',
533
609
  args: [account, tempo_1.TokenRole.serialize(role)],
@@ -543,7 +619,7 @@ async function grantRoles(client, parameters) {
543
619
  return (await action(client, {
544
620
  ...parameters,
545
621
  calls: parameters.roles.map((role) => {
546
- const call = grantRoles.call({ ...parameters, role });
622
+ const call = grantRoles.call(client, { ...parameters, role });
547
623
  return {
548
624
  ...call,
549
625
  data: (0, encodeFunctionData_js_1.encodeFunctionData)(call),
@@ -552,11 +628,11 @@ async function grantRoles(client, parameters) {
552
628
  }));
553
629
  }
554
630
  grantRoles.inner = inner;
555
- function call(args) {
631
+ function call(client, args) {
556
632
  const { token, to, role } = args;
557
633
  const roleHash = tempo_1.TokenRole.serialize(role);
558
634
  return (0, utils_js_1.defineCall)({
559
- address: tempo_1.TokenId.toAddress(token),
635
+ address: (0, utils_js_1.resolveToken)(client, { token }).address,
560
636
  abi: Abis.tip20,
561
637
  functionName: 'grantRole',
562
638
  args: [roleHash, to],
@@ -593,26 +669,29 @@ async function mint(client, parameters) {
593
669
  }
594
670
  (function (mint) {
595
671
  async function inner(action, client, parameters) {
596
- const call = mint.call(parameters);
672
+ const { amount, memo, to, token, ...rest } = parameters;
673
+ const call = mint.call(client, { amount, memo, to, token });
597
674
  return (await action(client, {
598
- ...parameters,
675
+ ...rest,
599
676
  ...call,
600
677
  }));
601
678
  }
602
679
  mint.inner = inner;
603
- function call(args) {
680
+ function call(client, args) {
604
681
  const { to, amount, memo, token } = args;
682
+ const { address, decimals } = (0, utils_js_1.resolveToken)(client, { token });
683
+ const value = internal_Token.toBaseUnits(amount, decimals);
605
684
  const callArgs = memo
606
685
  ? {
607
686
  functionName: 'mintWithMemo',
608
- args: [to, amount, Hex.padLeft(memo, 32)],
687
+ args: [to, value, Hex.padLeft(memo, 32)],
609
688
  }
610
689
  : {
611
690
  functionName: 'mint',
612
- args: [to, amount],
691
+ args: [to, value],
613
692
  };
614
693
  return (0, utils_js_1.defineCall)({
615
- address: tempo_1.TokenId.toAddress(token),
694
+ address,
616
695
  abi: Abis.tip20,
617
696
  ...callArgs,
618
697
  });
@@ -648,17 +727,17 @@ async function pause(client, parameters) {
648
727
  (function (pause) {
649
728
  async function inner(action, client, parameters) {
650
729
  const { token, ...rest } = parameters;
651
- const call = pause.call({ token });
730
+ const call = pause.call(client, { token });
652
731
  return (await action(client, {
653
732
  ...rest,
654
733
  ...call,
655
734
  }));
656
735
  }
657
736
  pause.inner = inner;
658
- function call(args) {
737
+ function call(client, args) {
659
738
  const { token } = args;
660
739
  return (0, utils_js_1.defineCall)({
661
- address: tempo_1.TokenId.toAddress(token),
740
+ address: (0, utils_js_1.resolveToken)(client, { token }).address,
662
741
  abi: Abis.tip20,
663
742
  functionName: 'pause',
664
743
  args: [],
@@ -697,7 +776,7 @@ async function renounceRoles(client, parameters) {
697
776
  return (await action(client, {
698
777
  ...parameters,
699
778
  calls: parameters.roles.map((role) => {
700
- const call = renounceRoles.call({ ...parameters, role });
779
+ const call = renounceRoles.call(client, { ...parameters, role });
701
780
  return {
702
781
  ...call,
703
782
  data: (0, encodeFunctionData_js_1.encodeFunctionData)(call),
@@ -706,11 +785,11 @@ async function renounceRoles(client, parameters) {
706
785
  }));
707
786
  }
708
787
  renounceRoles.inner = inner;
709
- function call(args) {
788
+ function call(client, args) {
710
789
  const { token, role } = args;
711
790
  const roleHash = tempo_1.TokenRole.serialize(role);
712
791
  return (0, utils_js_1.defineCall)({
713
- address: tempo_1.TokenId.toAddress(token),
792
+ address: (0, utils_js_1.resolveToken)(client, { token }).address,
714
793
  abi: Abis.tip20,
715
794
  functionName: 'renounceRole',
716
795
  args: [roleHash],
@@ -751,7 +830,7 @@ async function revokeRoles(client, parameters) {
751
830
  return (await action(client, {
752
831
  ...rest,
753
832
  calls: parameters.roles.map((role) => {
754
- const call = revokeRoles.call({ ...parameters, role });
833
+ const call = revokeRoles.call(client, { ...parameters, role });
755
834
  return {
756
835
  ...call,
757
836
  data: (0, encodeFunctionData_js_1.encodeFunctionData)(call),
@@ -760,11 +839,11 @@ async function revokeRoles(client, parameters) {
760
839
  }));
761
840
  }
762
841
  revokeRoles.inner = inner;
763
- function call(args) {
842
+ function call(client, args) {
764
843
  const { token, from, role } = args;
765
844
  const roleHash = tempo_1.TokenRole.serialize(role);
766
845
  return (0, utils_js_1.defineCall)({
767
- address: tempo_1.TokenId.toAddress(token),
846
+ address: (0, utils_js_1.resolveToken)(client, { token }).address,
768
847
  abi: Abis.tip20,
769
848
  functionName: 'revokeRole',
770
849
  args: [roleHash, from],
@@ -802,17 +881,17 @@ async function setSupplyCap(client, parameters) {
802
881
  (function (setSupplyCap) {
803
882
  async function inner(action, client, parameters) {
804
883
  const { supplyCap, token, ...rest } = parameters;
805
- const call = setSupplyCap.call({ supplyCap, token });
884
+ const call = setSupplyCap.call(client, { supplyCap, token });
806
885
  return (await action(client, {
807
886
  ...rest,
808
887
  ...call,
809
888
  }));
810
889
  }
811
890
  setSupplyCap.inner = inner;
812
- function call(args) {
891
+ function call(client, args) {
813
892
  const { token, supplyCap } = args;
814
893
  return (0, utils_js_1.defineCall)({
815
- address: tempo_1.TokenId.toAddress(token),
894
+ address: (0, utils_js_1.resolveToken)(client, { token }).address,
816
895
  abi: Abis.tip20,
817
896
  functionName: 'setSupplyCap',
818
897
  args: [supplyCap],
@@ -849,19 +928,19 @@ async function setRoleAdmin(client, parameters) {
849
928
  (function (setRoleAdmin) {
850
929
  async function inner(action, client, parameters) {
851
930
  const { adminRole, role, token, ...rest } = parameters;
852
- const call = setRoleAdmin.call({ adminRole, role, token });
931
+ const call = setRoleAdmin.call(client, { adminRole, role, token });
853
932
  return (await action(client, {
854
933
  ...rest,
855
934
  ...call,
856
935
  }));
857
936
  }
858
937
  setRoleAdmin.inner = inner;
859
- function call(args) {
938
+ function call(client, args) {
860
939
  const { token, role, adminRole } = args;
861
940
  const roleHash = tempo_1.TokenRole.serialize(role);
862
941
  const adminRoleHash = tempo_1.TokenRole.serialize(adminRole);
863
942
  return (0, utils_js_1.defineCall)({
864
- address: tempo_1.TokenId.toAddress(token),
943
+ address: (0, utils_js_1.resolveToken)(client, { token }).address,
865
944
  abi: Abis.tip20,
866
945
  functionName: 'setRoleAdmin',
867
946
  args: [roleHash, adminRoleHash],
@@ -897,44 +976,58 @@ async function transfer(client, parameters) {
897
976
  }
898
977
  (function (transfer) {
899
978
  async function inner(action, client, parameters) {
900
- const { amount, from, memo, token, to, ...rest } = parameters;
901
- const call = transfer.call({ amount, from, memo, token, to });
902
979
  return (await action(client, {
903
- ...rest,
904
- ...call,
980
+ ...parameters,
981
+ ...transfer.call(client, parameters),
905
982
  }));
906
983
  }
907
984
  transfer.inner = inner;
908
- function call(args) {
909
- const { amount, from, memo, token, to } = args;
985
+ function call(client, parameters) {
986
+ const { from, memo, to, token } = parameters;
987
+ const { address, decimals } = (0, utils_js_1.resolveToken)(client, { token });
988
+ const value = internal_Token.toBaseUnits(parameters.amount, decimals);
910
989
  const callArgs = (() => {
911
990
  if (memo && from)
912
991
  return {
913
992
  functionName: 'transferFromWithMemo',
914
- args: [from, to, amount, Hex.padLeft(memo, 32)],
993
+ args: [from, to, value, Hex.padLeft(memo, 32)],
915
994
  };
916
995
  if (memo)
917
996
  return {
918
997
  functionName: 'transferWithMemo',
919
- args: [to, amount, Hex.padLeft(memo, 32)],
998
+ args: [to, value, Hex.padLeft(memo, 32)],
920
999
  };
921
1000
  if (from)
922
1001
  return {
923
1002
  functionName: 'transferFrom',
924
- args: [from, to, amount],
1003
+ args: [from, to, value],
925
1004
  };
926
1005
  return {
927
1006
  functionName: 'transfer',
928
- args: [to, amount],
1007
+ args: [to, value],
929
1008
  };
930
1009
  })();
931
1010
  return (0, utils_js_1.defineCall)({
932
- address: tempo_1.TokenId.toAddress(token),
1011
+ address,
933
1012
  abi: Abis.tip20,
934
1013
  ...callArgs,
935
1014
  });
936
1015
  }
937
1016
  transfer.call = call;
1017
+ async function estimateGas(client, parameters) {
1018
+ return (0, estimateContractGas_js_1.estimateContractGas)(client, {
1019
+ ...(0, utils_js_1.pickWriteParameters)(parameters),
1020
+ ...transfer.call(client, parameters),
1021
+ });
1022
+ }
1023
+ transfer.estimateGas = estimateGas;
1024
+ async function simulate(client, parameters) {
1025
+ return (0, simulateContract_js_1.simulateContract)(client, {
1026
+ ...(0, utils_js_1.pickWriteParameters)(parameters),
1027
+ ...transfer.call(client, parameters),
1028
+ });
1029
+ }
1030
+ transfer.simulate = simulate;
938
1031
  function extractEvent(logs) {
939
1032
  const [log] = (0, parseEventLogs_js_1.parseEventLogs)({
940
1033
  abi: Abis.tip20,
@@ -948,14 +1041,19 @@ async function transfer(client, parameters) {
948
1041
  transfer.extractEvent = extractEvent;
949
1042
  })(transfer || (exports.transfer = transfer = {}));
950
1043
  async function transferSync(client, parameters) {
951
- const { throwOnReceiptRevert = true, ...rest } = parameters;
1044
+ const { amount, token, throwOnReceiptRevert = true } = parameters;
1045
+ const { decimals } = (0, utils_js_1.resolveToken)(client, { token });
1046
+ const resolved = internal_Token.resolveAmountDecimals(amount, decimals);
952
1047
  const receipt = await transfer.inner(writeContractSync_js_1.writeContractSync, client, {
953
- ...rest,
1048
+ ...parameters,
954
1049
  throwOnReceiptRevert,
955
1050
  });
956
1051
  const { args } = transfer.extractEvent(receipt.logs);
957
1052
  return {
958
1053
  ...args,
1054
+ ...(resolved === undefined
1055
+ ? {}
1056
+ : { decimals: resolved, formatted: (0, formatUnits_js_1.formatUnits)(args.amount, resolved) }),
959
1057
  receipt,
960
1058
  };
961
1059
  }
@@ -965,17 +1063,17 @@ async function unpause(client, parameters) {
965
1063
  (function (unpause) {
966
1064
  async function inner(action, client, parameters) {
967
1065
  const { token, ...rest } = parameters;
968
- const call = unpause.call({ token });
1066
+ const call = unpause.call(client, { token });
969
1067
  return (await action(client, {
970
1068
  ...rest,
971
1069
  ...call,
972
1070
  }));
973
1071
  }
974
1072
  unpause.inner = inner;
975
- function call(args) {
1073
+ function call(client, args) {
976
1074
  const { token } = args;
977
1075
  return (0, utils_js_1.defineCall)({
978
- address: tempo_1.TokenId.toAddress(token),
1076
+ address: (0, utils_js_1.resolveToken)(client, { token }).address,
979
1077
  abi: Abis.tip20,
980
1078
  functionName: 'unpause',
981
1079
  args: [],
@@ -1012,20 +1110,20 @@ async function prepareUpdateQuoteToken(client, parameters) {
1012
1110
  (function (prepareUpdateQuoteToken) {
1013
1111
  async function inner(action, client, parameters) {
1014
1112
  const { quoteToken, token, ...rest } = parameters;
1015
- const call = prepareUpdateQuoteToken.call({ quoteToken, token });
1113
+ const call = prepareUpdateQuoteToken.call(client, { quoteToken, token });
1016
1114
  return (await action(client, {
1017
1115
  ...rest,
1018
1116
  ...call,
1019
1117
  }));
1020
1118
  }
1021
1119
  prepareUpdateQuoteToken.inner = inner;
1022
- function call(args) {
1120
+ function call(client, args) {
1023
1121
  const { token, quoteToken } = args;
1024
1122
  return (0, utils_js_1.defineCall)({
1025
- address: tempo_1.TokenId.toAddress(token),
1123
+ address: (0, utils_js_1.resolveToken)(client, { token }).address,
1026
1124
  abi: Abis.tip20,
1027
1125
  functionName: 'setNextQuoteToken',
1028
- args: [tempo_1.TokenId.toAddress(quoteToken)],
1126
+ args: [(0, utils_js_1.resolveToken)(client, { token: quoteToken }).address],
1029
1127
  });
1030
1128
  }
1031
1129
  prepareUpdateQuoteToken.call = call;
@@ -1055,17 +1153,17 @@ async function updateQuoteToken(client, parameters) {
1055
1153
  (function (updateQuoteToken) {
1056
1154
  async function inner(action, client, parameters) {
1057
1155
  const { token, ...rest } = parameters;
1058
- const call = updateQuoteToken.call({ token });
1156
+ const call = updateQuoteToken.call(client, { token });
1059
1157
  return (await action(client, {
1060
1158
  ...rest,
1061
1159
  ...call,
1062
1160
  }));
1063
1161
  }
1064
1162
  updateQuoteToken.inner = inner;
1065
- function call(args) {
1163
+ function call(client, args) {
1066
1164
  const { token } = args;
1067
1165
  return (0, utils_js_1.defineCall)({
1068
- address: tempo_1.TokenId.toAddress(token),
1166
+ address: (0, utils_js_1.resolveToken)(client, { token }).address,
1069
1167
  abi: Abis.tip20,
1070
1168
  functionName: 'completeQuoteTokenUpdate',
1071
1169
  args: [],
@@ -1096,7 +1194,7 @@ function watchApprove(client, parameters) {
1096
1194
  const { onApproval, token, ...rest } = parameters;
1097
1195
  return (0, watchContractEvent_js_1.watchContractEvent)(client, {
1098
1196
  ...rest,
1099
- address: tempo_1.TokenId.toAddress(token),
1197
+ address: (0, utils_js_1.resolveToken)(client, { token }).address,
1100
1198
  abi: Abis.tip20,
1101
1199
  eventName: 'Approval',
1102
1200
  onLogs: (logs) => {
@@ -1110,7 +1208,7 @@ function watchBurn(client, parameters) {
1110
1208
  const { onBurn, token, ...rest } = parameters;
1111
1209
  return (0, watchContractEvent_js_1.watchContractEvent)(client, {
1112
1210
  ...rest,
1113
- address: tempo_1.TokenId.toAddress(token),
1211
+ address: (0, utils_js_1.resolveToken)(client, { token }).address,
1114
1212
  abi: Abis.tip20,
1115
1213
  eventName: 'Burn',
1116
1214
  onLogs: (logs) => {
@@ -1138,7 +1236,7 @@ function watchMint(client, parameters) {
1138
1236
  const { onMint, token, ...rest } = parameters;
1139
1237
  return (0, watchContractEvent_js_1.watchContractEvent)(client, {
1140
1238
  ...rest,
1141
- address: tempo_1.TokenId.toAddress(token),
1239
+ address: (0, utils_js_1.resolveToken)(client, { token }).address,
1142
1240
  abi: Abis.tip20,
1143
1241
  eventName: 'Mint',
1144
1242
  onLogs: (logs) => {
@@ -1152,7 +1250,7 @@ function watchAdminRole(client, parameters) {
1152
1250
  const { onRoleAdminUpdated, token, ...rest } = parameters;
1153
1251
  return (0, watchContractEvent_js_1.watchContractEvent)(client, {
1154
1252
  ...rest,
1155
- address: tempo_1.TokenId.toAddress(token),
1253
+ address: (0, utils_js_1.resolveToken)(client, { token }).address,
1156
1254
  abi: Abis.tip20,
1157
1255
  eventName: 'RoleAdminUpdated',
1158
1256
  onLogs: (logs) => {
@@ -1166,7 +1264,7 @@ function watchRole(client, parameters) {
1166
1264
  const { onRoleUpdated, token, ...rest } = parameters;
1167
1265
  return (0, watchContractEvent_js_1.watchContractEvent)(client, {
1168
1266
  ...rest,
1169
- address: tempo_1.TokenId.toAddress(token),
1267
+ address: (0, utils_js_1.resolveToken)(client, { token }).address,
1170
1268
  abi: Abis.tip20,
1171
1269
  eventName: 'RoleMembershipUpdated',
1172
1270
  onLogs: (logs) => {
@@ -1182,7 +1280,7 @@ function watchTransfer(client, parameters) {
1182
1280
  const { onTransfer, token, ...rest } = parameters;
1183
1281
  return (0, watchContractEvent_js_1.watchContractEvent)(client, {
1184
1282
  ...rest,
1185
- address: tempo_1.TokenId.toAddress(token),
1283
+ address: (0, utils_js_1.resolveToken)(client, { token }).address,
1186
1284
  abi: Abis.tip20,
1187
1285
  eventName: 'Transfer',
1188
1286
  onLogs: (logs) => {
@@ -1194,7 +1292,7 @@ function watchTransfer(client, parameters) {
1194
1292
  }
1195
1293
  function watchUpdateQuoteToken(client, parameters) {
1196
1294
  const { onUpdateQuoteToken, token, ...rest } = parameters;
1197
- const address = tempo_1.TokenId.toAddress(token);
1295
+ const address = (0, utils_js_1.resolveToken)(client, { token }).address;
1198
1296
  return (0, watchContractEvent_js_1.watchContractEvent)(client, {
1199
1297
  ...rest,
1200
1298
  address,