viem 2.53.1 → 2.54.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (441) hide show
  1. package/CHANGELOG.md +55 -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.map +1 -1
  50. package/_cjs/tempo/Decorator.js +234 -215
  51. package/_cjs/tempo/Decorator.js.map +1 -1
  52. package/_cjs/tempo/actions/token.js +210 -112
  53. package/_cjs/tempo/actions/token.js.map +1 -1
  54. package/_cjs/tempo/internal/utils.js +108 -0
  55. package/_cjs/tempo/internal/utils.js.map +1 -1
  56. package/_cjs/tokens/defineToken.js +21 -0
  57. package/_cjs/tokens/defineToken.js.map +1 -0
  58. package/_cjs/tokens/definitions/alphausd.js +14 -0
  59. package/_cjs/tokens/definitions/alphausd.js.map +1 -0
  60. package/_cjs/tokens/definitions/betausd.js +14 -0
  61. package/_cjs/tokens/definitions/betausd.js.map +1 -0
  62. package/_cjs/tokens/definitions/brla.js +14 -0
  63. package/_cjs/tokens/definitions/brla.js.map +1 -0
  64. package/_cjs/tokens/definitions/cbbtc.js +14 -0
  65. package/_cjs/tokens/definitions/cbbtc.js.map +1 -0
  66. package/_cjs/tokens/definitions/chfau.js +14 -0
  67. package/_cjs/tokens/definitions/chfau.js.map +1 -0
  68. package/_cjs/tokens/definitions/cusd.js +14 -0
  69. package/_cjs/tokens/definitions/cusd.js.map +1 -0
  70. package/_cjs/tokens/definitions/dlusd.js +14 -0
  71. package/_cjs/tokens/definitions/dlusd.js.map +1 -0
  72. package/_cjs/tokens/definitions/eurau.js +14 -0
  73. package/_cjs/tokens/definitions/eurau.js.map +1 -0
  74. package/_cjs/tokens/definitions/eurce.js +15 -0
  75. package/_cjs/tokens/definitions/eurce.js.map +1 -0
  76. package/_cjs/tokens/definitions/frxusd.js +14 -0
  77. package/_cjs/tokens/definitions/frxusd.js.map +1 -0
  78. package/_cjs/tokens/definitions/gbpa.js +14 -0
  79. package/_cjs/tokens/definitions/gbpa.js.map +1 -0
  80. package/_cjs/tokens/definitions/gusd.js +14 -0
  81. package/_cjs/tokens/definitions/gusd.js.map +1 -0
  82. package/_cjs/tokens/definitions/iusd.js +14 -0
  83. package/_cjs/tokens/definitions/iusd.js.map +1 -0
  84. package/_cjs/tokens/definitions/pathusd.js +15 -0
  85. package/_cjs/tokens/definitions/pathusd.js.map +1 -0
  86. package/_cjs/tokens/definitions/reusd.js +14 -0
  87. package/_cjs/tokens/definitions/reusd.js.map +1 -0
  88. package/_cjs/tokens/definitions/rusd.js +14 -0
  89. package/_cjs/tokens/definitions/rusd.js.map +1 -0
  90. package/_cjs/tokens/definitions/sbc.js +14 -0
  91. package/_cjs/tokens/definitions/sbc.js.map +1 -0
  92. package/_cjs/tokens/definitions/siusd.js +14 -0
  93. package/_cjs/tokens/definitions/siusd.js.map +1 -0
  94. package/_cjs/tokens/definitions/stcusd.js +14 -0
  95. package/_cjs/tokens/definitions/stcusd.js.map +1 -0
  96. package/_cjs/tokens/definitions/susde.js +14 -0
  97. package/_cjs/tokens/definitions/susde.js.map +1 -0
  98. package/_cjs/tokens/definitions/syrupusdc.js +14 -0
  99. package/_cjs/tokens/definitions/syrupusdc.js.map +1 -0
  100. package/_cjs/tokens/definitions/thetausd.js +14 -0
  101. package/_cjs/tokens/definitions/thetausd.js.map +1 -0
  102. package/_cjs/tokens/definitions/usd1.js +14 -0
  103. package/_cjs/tokens/definitions/usd1.js.map +1 -0
  104. package/_cjs/tokens/definitions/usdb.js +14 -0
  105. package/_cjs/tokens/definitions/usdb.js.map +1 -0
  106. package/_cjs/tokens/definitions/usdc.js +41 -0
  107. package/_cjs/tokens/definitions/usdc.js.map +1 -0
  108. package/_cjs/tokens/definitions/usdce.js +15 -0
  109. package/_cjs/tokens/definitions/usdce.js.map +1 -0
  110. package/_cjs/tokens/definitions/usde.js +14 -0
  111. package/_cjs/tokens/definitions/usde.js.map +1 -0
  112. package/_cjs/tokens/definitions/usdt0.js +14 -0
  113. package/_cjs/tokens/definitions/usdt0.js.map +1 -0
  114. package/_cjs/tokens/definitions/wsrusd.js +14 -0
  115. package/_cjs/tokens/definitions/wsrusd.js.map +1 -0
  116. package/_cjs/tokens/index.js +64 -0
  117. package/_cjs/tokens/index.js.map +1 -0
  118. package/_cjs/utils/encoding/fromRlp.js +7 -4
  119. package/_cjs/utils/encoding/fromRlp.js.map +1 -1
  120. package/_cjs/utils/rpc/http.js +58 -3
  121. package/_cjs/utils/rpc/http.js.map +1 -1
  122. package/_cjs/utils/transaction/parseTransaction.js +4 -1
  123. package/_cjs/utils/transaction/parseTransaction.js.map +1 -1
  124. package/_esm/actions/index.js +1 -0
  125. package/_esm/actions/index.js.map +1 -1
  126. package/_esm/actions/token/approve.js +123 -0
  127. package/_esm/actions/token/approve.js.map +1 -0
  128. package/_esm/actions/token/approveSync.js +50 -0
  129. package/_esm/actions/token/approveSync.js.map +1 -0
  130. package/_esm/actions/token/getAllowance.js +62 -0
  131. package/_esm/actions/token/getAllowance.js.map +1 -0
  132. package/_esm/actions/token/getBalance.js +70 -0
  133. package/_esm/actions/token/getBalance.js.map +1 -0
  134. package/_esm/actions/token/getMetadata.js +60 -0
  135. package/_esm/actions/token/getMetadata.js.map +1 -0
  136. package/_esm/actions/token/getTotalSupply.js +60 -0
  137. package/_esm/actions/token/getTotalSupply.js.map +1 -0
  138. package/_esm/actions/token/index.js +10 -0
  139. package/_esm/actions/token/index.js.map +1 -0
  140. package/_esm/actions/token/internal.js +188 -0
  141. package/_esm/actions/token/internal.js.map +1 -0
  142. package/_esm/actions/token/transfer.js +147 -0
  143. package/_esm/actions/token/transfer.js.map +1 -0
  144. package/_esm/actions/token/transferSync.js +54 -0
  145. package/_esm/actions/token/transferSync.js.map +1 -0
  146. package/_esm/chains/definitions/battlechain.js +28 -0
  147. package/_esm/chains/definitions/battlechain.js.map +1 -0
  148. package/_esm/chains/definitions/marooTestnet.js +27 -0
  149. package/_esm/chains/definitions/marooTestnet.js.map +1 -0
  150. package/_esm/chains/index.js +2 -0
  151. package/_esm/chains/index.js.map +1 -1
  152. package/_esm/clients/createClient.js +53 -1
  153. package/_esm/clients/createClient.js.map +1 -1
  154. package/_esm/clients/createPublicClient.js.map +1 -1
  155. package/_esm/clients/createWalletClient.js.map +1 -1
  156. package/_esm/clients/decorators/public.js +17 -0
  157. package/_esm/clients/decorators/public.js.map +1 -1
  158. package/_esm/clients/decorators/wallet.js +8 -0
  159. package/_esm/clients/decorators/wallet.js.map +1 -1
  160. package/_esm/clients/transports/http.js +2 -1
  161. package/_esm/clients/transports/http.js.map +1 -1
  162. package/_esm/errors/encoding.js +7 -0
  163. package/_esm/errors/encoding.js.map +1 -1
  164. package/_esm/errors/request.js +22 -0
  165. package/_esm/errors/request.js.map +1 -1
  166. package/_esm/errors/transaction.js +7 -0
  167. package/_esm/errors/transaction.js.map +1 -1
  168. package/_esm/errors/version.js +1 -1
  169. package/_esm/index.js +3 -3
  170. package/_esm/index.js.map +1 -1
  171. package/_esm/tempo/Client.js.map +1 -1
  172. package/_esm/tempo/Decorator.js +234 -218
  173. package/_esm/tempo/Decorator.js.map +1 -1
  174. package/_esm/tempo/actions/token.js +335 -186
  175. package/_esm/tempo/actions/token.js.map +1 -1
  176. package/_esm/tempo/actions/wallet.js +1 -1
  177. package/_esm/tempo/internal/utils.js +154 -0
  178. package/_esm/tempo/internal/utils.js.map +1 -1
  179. package/_esm/tokens/defineToken.js +57 -0
  180. package/_esm/tokens/defineToken.js.map +1 -0
  181. package/_esm/tokens/definitions/alphausd.js +12 -0
  182. package/_esm/tokens/definitions/alphausd.js.map +1 -0
  183. package/_esm/tokens/definitions/betausd.js +12 -0
  184. package/_esm/tokens/definitions/betausd.js.map +1 -0
  185. package/_esm/tokens/definitions/brla.js +12 -0
  186. package/_esm/tokens/definitions/brla.js.map +1 -0
  187. package/_esm/tokens/definitions/cbbtc.js +12 -0
  188. package/_esm/tokens/definitions/cbbtc.js.map +1 -0
  189. package/_esm/tokens/definitions/chfau.js +12 -0
  190. package/_esm/tokens/definitions/chfau.js.map +1 -0
  191. package/_esm/tokens/definitions/cusd.js +12 -0
  192. package/_esm/tokens/definitions/cusd.js.map +1 -0
  193. package/_esm/tokens/definitions/dlusd.js +12 -0
  194. package/_esm/tokens/definitions/dlusd.js.map +1 -0
  195. package/_esm/tokens/definitions/eurau.js +12 -0
  196. package/_esm/tokens/definitions/eurau.js.map +1 -0
  197. package/_esm/tokens/definitions/eurce.js +13 -0
  198. package/_esm/tokens/definitions/eurce.js.map +1 -0
  199. package/_esm/tokens/definitions/frxusd.js +12 -0
  200. package/_esm/tokens/definitions/frxusd.js.map +1 -0
  201. package/_esm/tokens/definitions/gbpa.js +12 -0
  202. package/_esm/tokens/definitions/gbpa.js.map +1 -0
  203. package/_esm/tokens/definitions/gusd.js +12 -0
  204. package/_esm/tokens/definitions/gusd.js.map +1 -0
  205. package/_esm/tokens/definitions/iusd.js +12 -0
  206. package/_esm/tokens/definitions/iusd.js.map +1 -0
  207. package/_esm/tokens/definitions/pathusd.js +13 -0
  208. package/_esm/tokens/definitions/pathusd.js.map +1 -0
  209. package/_esm/tokens/definitions/reusd.js +12 -0
  210. package/_esm/tokens/definitions/reusd.js.map +1 -0
  211. package/_esm/tokens/definitions/rusd.js +12 -0
  212. package/_esm/tokens/definitions/rusd.js.map +1 -0
  213. package/_esm/tokens/definitions/sbc.js +12 -0
  214. package/_esm/tokens/definitions/sbc.js.map +1 -0
  215. package/_esm/tokens/definitions/siusd.js +12 -0
  216. package/_esm/tokens/definitions/siusd.js.map +1 -0
  217. package/_esm/tokens/definitions/stcusd.js +12 -0
  218. package/_esm/tokens/definitions/stcusd.js.map +1 -0
  219. package/_esm/tokens/definitions/susde.js +12 -0
  220. package/_esm/tokens/definitions/susde.js.map +1 -0
  221. package/_esm/tokens/definitions/syrupusdc.js +12 -0
  222. package/_esm/tokens/definitions/syrupusdc.js.map +1 -0
  223. package/_esm/tokens/definitions/thetausd.js +12 -0
  224. package/_esm/tokens/definitions/thetausd.js.map +1 -0
  225. package/_esm/tokens/definitions/usd1.js +12 -0
  226. package/_esm/tokens/definitions/usd1.js.map +1 -0
  227. package/_esm/tokens/definitions/usdb.js +12 -0
  228. package/_esm/tokens/definitions/usdb.js.map +1 -0
  229. package/_esm/tokens/definitions/usdc.js +67 -0
  230. package/_esm/tokens/definitions/usdc.js.map +1 -0
  231. package/_esm/tokens/definitions/usdce.js +13 -0
  232. package/_esm/tokens/definitions/usdce.js.map +1 -0
  233. package/_esm/tokens/definitions/usde.js +12 -0
  234. package/_esm/tokens/definitions/usde.js.map +1 -0
  235. package/_esm/tokens/definitions/usdt0.js +12 -0
  236. package/_esm/tokens/definitions/usdt0.js.map +1 -0
  237. package/_esm/tokens/definitions/wsrusd.js +12 -0
  238. package/_esm/tokens/definitions/wsrusd.js.map +1 -0
  239. package/_esm/tokens/index.js +32 -0
  240. package/_esm/tokens/index.js.map +1 -0
  241. package/_esm/utils/encoding/fromRlp.js +8 -5
  242. package/_esm/utils/encoding/fromRlp.js.map +1 -1
  243. package/_esm/utils/rpc/http.js +59 -4
  244. package/_esm/utils/rpc/http.js.map +1 -1
  245. package/_esm/utils/transaction/parseTransaction.js +5 -2
  246. package/_esm/utils/transaction/parseTransaction.js.map +1 -1
  247. package/_types/actions/index.d.ts +1 -0
  248. package/_types/actions/index.d.ts.map +1 -1
  249. package/_types/actions/token/approve.d.ts +253 -0
  250. package/_types/actions/token/approve.d.ts.map +1 -0
  251. package/_types/actions/token/approveSync.d.ts +57 -0
  252. package/_types/actions/token/approveSync.d.ts.map +1 -0
  253. package/_types/actions/token/getAllowance.d.ts +77 -0
  254. package/_types/actions/token/getAllowance.d.ts.map +1 -0
  255. package/_types/actions/token/getBalance.d.ts +69 -0
  256. package/_types/actions/token/getBalance.d.ts.map +1 -0
  257. package/_types/actions/token/getMetadata.d.ts +43 -0
  258. package/_types/actions/token/getMetadata.d.ts.map +1 -0
  259. package/_types/actions/token/getTotalSupply.d.ts +63 -0
  260. package/_types/actions/token/getTotalSupply.d.ts.map +1 -0
  261. package/_types/actions/token/index.d.ts +9 -0
  262. package/_types/actions/token/index.d.ts.map +1 -0
  263. package/_types/actions/token/internal.d.ts +168 -0
  264. package/_types/actions/token/internal.d.ts.map +1 -0
  265. package/_types/actions/token/transfer.d.ts +288 -0
  266. package/_types/actions/token/transfer.d.ts.map +1 -0
  267. package/_types/actions/token/transferSync.d.ts +61 -0
  268. package/_types/actions/token/transferSync.d.ts.map +1 -0
  269. package/_types/chains/definitions/battlechain.d.ts +447 -0
  270. package/_types/chains/definitions/battlechain.d.ts.map +1 -0
  271. package/_types/chains/definitions/marooTestnet.d.ts +49 -0
  272. package/_types/chains/definitions/marooTestnet.d.ts.map +1 -0
  273. package/_types/chains/index.d.ts +2 -0
  274. package/_types/chains/index.d.ts.map +1 -1
  275. package/_types/clients/createClient.d.ts +24 -6
  276. package/_types/clients/createClient.d.ts.map +1 -1
  277. package/_types/clients/createPublicClient.d.ts +4 -3
  278. package/_types/clients/createPublicClient.d.ts.map +1 -1
  279. package/_types/clients/createWalletClient.d.ts +4 -3
  280. package/_types/clients/createWalletClient.d.ts.map +1 -1
  281. package/_types/clients/decorators/public.d.ts +128 -3
  282. package/_types/clients/decorators/public.d.ts.map +1 -1
  283. package/_types/clients/decorators/wallet.d.ts +208 -3
  284. package/_types/clients/decorators/wallet.d.ts.map +1 -1
  285. package/_types/clients/transports/http.d.ts +2 -0
  286. package/_types/clients/transports/http.d.ts.map +1 -1
  287. package/_types/errors/encoding.d.ts +8 -0
  288. package/_types/errors/encoding.d.ts.map +1 -1
  289. package/_types/errors/request.d.ts +11 -0
  290. package/_types/errors/request.d.ts.map +1 -1
  291. package/_types/errors/transaction.d.ts +8 -0
  292. package/_types/errors/transaction.d.ts.map +1 -1
  293. package/_types/errors/version.d.ts +1 -1
  294. package/_types/index.d.ts +4 -3
  295. package/_types/index.d.ts.map +1 -1
  296. package/_types/tempo/Client.d.ts +1 -1
  297. package/_types/tempo/Client.d.ts.map +1 -1
  298. package/_types/tempo/Decorator.d.ts +88 -5
  299. package/_types/tempo/Decorator.d.ts.map +1 -1
  300. package/_types/tempo/actions/token.d.ts +223 -151
  301. package/_types/tempo/actions/token.d.ts.map +1 -1
  302. package/_types/tempo/actions/wallet.d.ts +3 -3
  303. package/_types/tempo/internal/types.d.ts +17 -0
  304. package/_types/tempo/internal/types.d.ts.map +1 -1
  305. package/_types/tempo/internal/utils.d.ts +73 -0
  306. package/_types/tempo/internal/utils.d.ts.map +1 -1
  307. package/_types/tokens/defineToken.d.ts +112 -0
  308. package/_types/tokens/defineToken.d.ts.map +1 -0
  309. package/_types/tokens/definitions/alphausd.d.ts +11 -0
  310. package/_types/tokens/definitions/alphausd.d.ts.map +1 -0
  311. package/_types/tokens/definitions/betausd.d.ts +11 -0
  312. package/_types/tokens/definitions/betausd.d.ts.map +1 -0
  313. package/_types/tokens/definitions/brla.d.ts +11 -0
  314. package/_types/tokens/definitions/brla.d.ts.map +1 -0
  315. package/_types/tokens/definitions/cbbtc.d.ts +11 -0
  316. package/_types/tokens/definitions/cbbtc.d.ts.map +1 -0
  317. package/_types/tokens/definitions/chfau.d.ts +11 -0
  318. package/_types/tokens/definitions/chfau.d.ts.map +1 -0
  319. package/_types/tokens/definitions/cusd.d.ts +11 -0
  320. package/_types/tokens/definitions/cusd.d.ts.map +1 -0
  321. package/_types/tokens/definitions/dlusd.d.ts +11 -0
  322. package/_types/tokens/definitions/dlusd.d.ts.map +1 -0
  323. package/_types/tokens/definitions/eurau.d.ts +11 -0
  324. package/_types/tokens/definitions/eurau.d.ts.map +1 -0
  325. package/_types/tokens/definitions/eurce.d.ts +12 -0
  326. package/_types/tokens/definitions/eurce.d.ts.map +1 -0
  327. package/_types/tokens/definitions/frxusd.d.ts +11 -0
  328. package/_types/tokens/definitions/frxusd.d.ts.map +1 -0
  329. package/_types/tokens/definitions/gbpa.d.ts +11 -0
  330. package/_types/tokens/definitions/gbpa.d.ts.map +1 -0
  331. package/_types/tokens/definitions/gusd.d.ts +11 -0
  332. package/_types/tokens/definitions/gusd.d.ts.map +1 -0
  333. package/_types/tokens/definitions/iusd.d.ts +11 -0
  334. package/_types/tokens/definitions/iusd.d.ts.map +1 -0
  335. package/_types/tokens/definitions/pathusd.d.ts +12 -0
  336. package/_types/tokens/definitions/pathusd.d.ts.map +1 -0
  337. package/_types/tokens/definitions/reusd.d.ts +11 -0
  338. package/_types/tokens/definitions/reusd.d.ts.map +1 -0
  339. package/_types/tokens/definitions/rusd.d.ts +11 -0
  340. package/_types/tokens/definitions/rusd.d.ts.map +1 -0
  341. package/_types/tokens/definitions/sbc.d.ts +11 -0
  342. package/_types/tokens/definitions/sbc.d.ts.map +1 -0
  343. package/_types/tokens/definitions/siusd.d.ts +11 -0
  344. package/_types/tokens/definitions/siusd.d.ts.map +1 -0
  345. package/_types/tokens/definitions/stcusd.d.ts +11 -0
  346. package/_types/tokens/definitions/stcusd.d.ts.map +1 -0
  347. package/_types/tokens/definitions/susde.d.ts +11 -0
  348. package/_types/tokens/definitions/susde.d.ts.map +1 -0
  349. package/_types/tokens/definitions/syrupusdc.d.ts +11 -0
  350. package/_types/tokens/definitions/syrupusdc.d.ts.map +1 -0
  351. package/_types/tokens/definitions/thetausd.d.ts +11 -0
  352. package/_types/tokens/definitions/thetausd.d.ts.map +1 -0
  353. package/_types/tokens/definitions/usd1.d.ts +11 -0
  354. package/_types/tokens/definitions/usd1.d.ts.map +1 -0
  355. package/_types/tokens/definitions/usdb.d.ts +11 -0
  356. package/_types/tokens/definitions/usdb.d.ts.map +1 -0
  357. package/_types/tokens/definitions/usdc.d.ts +67 -0
  358. package/_types/tokens/definitions/usdc.d.ts.map +1 -0
  359. package/_types/tokens/definitions/usdce.d.ts +12 -0
  360. package/_types/tokens/definitions/usdce.d.ts.map +1 -0
  361. package/_types/tokens/definitions/usde.d.ts +11 -0
  362. package/_types/tokens/definitions/usde.d.ts.map +1 -0
  363. package/_types/tokens/definitions/usdt0.d.ts +11 -0
  364. package/_types/tokens/definitions/usdt0.d.ts.map +1 -0
  365. package/_types/tokens/definitions/wsrusd.d.ts +11 -0
  366. package/_types/tokens/definitions/wsrusd.d.ts.map +1 -0
  367. package/_types/tokens/index.d.ts +31 -0
  368. package/_types/tokens/index.d.ts.map +1 -0
  369. package/_types/utils/encoding/fromRlp.d.ts +2 -2
  370. package/_types/utils/encoding/fromRlp.d.ts.map +1 -1
  371. package/_types/utils/rpc/http.d.ts +6 -2
  372. package/_types/utils/rpc/http.d.ts.map +1 -1
  373. package/_types/utils/transaction/parseTransaction.d.ts +2 -2
  374. package/_types/utils/transaction/parseTransaction.d.ts.map +1 -1
  375. package/actions/index.ts +1 -0
  376. package/actions/token/approve.ts +202 -0
  377. package/actions/token/approveSync.ts +95 -0
  378. package/actions/token/getAllowance.ts +105 -0
  379. package/actions/token/getBalance.ts +115 -0
  380. package/actions/token/getMetadata.ts +98 -0
  381. package/actions/token/getTotalSupply.ts +97 -0
  382. package/actions/token/index.ts +9 -0
  383. package/actions/token/internal.ts +367 -0
  384. package/actions/token/transfer.ts +230 -0
  385. package/actions/token/transferSync.ts +99 -0
  386. package/chains/definitions/battlechain.ts +28 -0
  387. package/chains/definitions/marooTestnet.ts +27 -0
  388. package/chains/index.ts +2 -0
  389. package/clients/createClient.ts +90 -8
  390. package/clients/createPublicClient.ts +22 -4
  391. package/clients/createWalletClient.ts +22 -4
  392. package/clients/decorators/public.ts +166 -4
  393. package/clients/decorators/wallet.ts +242 -3
  394. package/clients/transports/http.ts +4 -0
  395. package/errors/encoding.ts +11 -0
  396. package/errors/request.ts +17 -0
  397. package/errors/transaction.ts +11 -0
  398. package/errors/version.ts +1 -1
  399. package/index.ts +7 -0
  400. package/package.json +6 -1
  401. package/tempo/Client.ts +4 -2
  402. package/tempo/Decorator.ts +398 -337
  403. package/tempo/actions/token.ts +519 -296
  404. package/tempo/actions/wallet.ts +3 -3
  405. package/tempo/internal/types.ts +19 -0
  406. package/tempo/internal/utils.ts +204 -0
  407. package/tokens/defineToken.ts +142 -0
  408. package/tokens/definitions/alphausd.ts +13 -0
  409. package/tokens/definitions/betausd.ts +13 -0
  410. package/tokens/definitions/brla.ts +13 -0
  411. package/tokens/definitions/cbbtc.ts +13 -0
  412. package/tokens/definitions/chfau.ts +13 -0
  413. package/tokens/definitions/cusd.ts +13 -0
  414. package/tokens/definitions/dlusd.ts +13 -0
  415. package/tokens/definitions/eurau.ts +13 -0
  416. package/tokens/definitions/eurce.ts +14 -0
  417. package/tokens/definitions/frxusd.ts +13 -0
  418. package/tokens/definitions/gbpa.ts +13 -0
  419. package/tokens/definitions/gusd.ts +13 -0
  420. package/tokens/definitions/iusd.ts +13 -0
  421. package/tokens/definitions/pathusd.ts +14 -0
  422. package/tokens/definitions/reusd.ts +13 -0
  423. package/tokens/definitions/rusd.ts +13 -0
  424. package/tokens/definitions/sbc.ts +13 -0
  425. package/tokens/definitions/siusd.ts +13 -0
  426. package/tokens/definitions/stcusd.ts +13 -0
  427. package/tokens/definitions/susde.ts +13 -0
  428. package/tokens/definitions/syrupusdc.ts +13 -0
  429. package/tokens/definitions/thetausd.ts +13 -0
  430. package/tokens/definitions/usd1.ts +13 -0
  431. package/tokens/definitions/usdb.ts +13 -0
  432. package/tokens/definitions/usdc.ts +67 -0
  433. package/tokens/definitions/usdce.ts +14 -0
  434. package/tokens/definitions/usde.ts +13 -0
  435. package/tokens/definitions/usdt0.ts +13 -0
  436. package/tokens/definitions/wsrusd.ts +13 -0
  437. package/tokens/index.ts +31 -0
  438. package/tokens/package.json +6 -0
  439. package/utils/encoding/fromRlp.ts +22 -3
  440. package/utils/rpc/http.ts +70 -2
  441. package/utils/transaction/parseTransaction.ts +7 -2
@@ -0,0 +1,99 @@
1
+ import type { Account } from '../../accounts/types.js'
2
+ import type { Client } from '../../clients/createClient.js'
3
+ import type { Transport } from '../../clients/transports/createTransport.js'
4
+ import type { erc20Abi } from '../../constants/abis.js'
5
+ import type { BaseErrorType } from '../../errors/base.js'
6
+ import type { Tokens } from '../../tokens/defineToken.js'
7
+ import type { Chain } from '../../types/chain.js'
8
+ import type { GetEventArgs } from '../../types/contract.js'
9
+ import type { TransactionReceipt } from '../../types/transaction.js'
10
+ import type { Compute } from '../../types/utils.js'
11
+ import { formatUnits } from '../../utils/unit/formatUnits.js'
12
+ import { writeContractSync } from '../wallet/writeContractSync.js'
13
+ import { resolveAmountDecimals, resolveToken } from './internal.js'
14
+ import { transfer } from './transfer.js'
15
+
16
+ /**
17
+ * Transfers ERC-20 tokens to another address, and waits for the transaction to
18
+ * be confirmed.
19
+ *
20
+ * Pass `from` to transfer on behalf of another address using an allowance
21
+ * (calls `transferFrom`); otherwise transfers from the caller (calls
22
+ * `transfer`).
23
+ *
24
+ * @example
25
+ * ```ts
26
+ * import { createClient, http } from 'viem'
27
+ * import { mainnet } from 'viem/chains'
28
+ * import { privateKeyToAccount } from 'viem/accounts'
29
+ * import { token } from 'viem/actions'
30
+ *
31
+ * const client = createClient({
32
+ * account: privateKeyToAccount('0x...'),
33
+ * chain: mainnet,
34
+ * transport: http(),
35
+ * })
36
+ *
37
+ * const { receipt, ...event } = await token.transferSync(client, {
38
+ * amount: 100000000n,
39
+ * to: '0x...',
40
+ * token: '0x...',
41
+ * })
42
+ * ```
43
+ *
44
+ * @param client - Client.
45
+ * @param parameters - Parameters.
46
+ * @returns The transaction receipt and event data.
47
+ */
48
+ export async function transferSync<
49
+ chain extends Chain | undefined,
50
+ account extends Account | undefined,
51
+ tokens extends Tokens | undefined = undefined,
52
+ >(
53
+ client: Client<Transport, chain, account, undefined, undefined, tokens>,
54
+ parameters: transferSync.Parameters<chain, account, tokens>,
55
+ ): Promise<transferSync.ReturnValue> {
56
+ const { amount, token, throwOnReceiptRevert = true } = parameters
57
+ const { decimals } = resolveToken(client, { token })
58
+ const resolved = resolveAmountDecimals(amount, decimals)
59
+ const receipt = await transfer.inner(writeContractSync, client, {
60
+ ...parameters,
61
+ throwOnReceiptRevert,
62
+ } as never)
63
+ const { args } = transfer.extractEvent(receipt.logs)
64
+ return {
65
+ ...args,
66
+ ...(resolved === undefined
67
+ ? {}
68
+ : { decimals: resolved, formatted: formatUnits(args.value, resolved) }),
69
+ receipt,
70
+ } as never
71
+ }
72
+
73
+ export namespace transferSync {
74
+ export type Parameters<
75
+ chain extends Chain | undefined = Chain | undefined,
76
+ account extends Account | undefined = Account | undefined,
77
+ tokens extends Tokens | undefined = Tokens | undefined,
78
+ > = transfer.Parameters<chain, account, tokens>
79
+ export type Args<
80
+ chain extends Chain | undefined = Chain | undefined,
81
+ tokens extends Tokens | undefined = Tokens | undefined,
82
+ > = transfer.Args<chain, tokens>
83
+ export type ReturnValue = Compute<
84
+ GetEventArgs<
85
+ typeof erc20Abi,
86
+ 'Transfer',
87
+ { IndexedOnly: false; Required: true }
88
+ > & {
89
+ /** Token decimals used to derive `formatted`, if known. */
90
+ decimals?: number | undefined
91
+ /** Transferred amount formatted with the token's `decimals`, if known. */
92
+ formatted?: string | undefined
93
+ /** Transaction receipt. */
94
+ receipt: TransactionReceipt
95
+ }
96
+ >
97
+ // TODO: exhaustive error type
98
+ export type ErrorType = BaseErrorType
99
+ }
@@ -0,0 +1,28 @@
1
+ import { defineChain } from '../../utils/chain/defineChain.js'
2
+ import { chainConfig } from '../../zksync/chainConfig.js'
3
+
4
+ export const battlechain = /*#__PURE__*/ defineChain({
5
+ ...chainConfig,
6
+ id: 626,
7
+ name: 'BattleChain Mainnet',
8
+ network: 'battlechain',
9
+ nativeCurrency: { name: 'Ether', symbol: 'ETH', decimals: 18 },
10
+ rpcUrls: {
11
+ default: {
12
+ http: ['https://mainnet.battlechain.com'],
13
+ },
14
+ },
15
+ blockExplorers: {
16
+ default: {
17
+ name: 'BattleChain Explorer',
18
+ url: 'https://explorer.battlechain.com',
19
+ apiUrl: 'https://block-explorer-api.battlechain.com/api',
20
+ },
21
+ },
22
+ contracts: {
23
+ multicall3: {
24
+ address: '0xcA11bde05977b3631167028862bE2a173976CA11',
25
+ blockCreated: 40,
26
+ },
27
+ },
28
+ })
@@ -0,0 +1,27 @@
1
+ import { defineChain } from '../../utils/chain/defineChain.js'
2
+
3
+ export const marooTestnet = /*#__PURE__*/ defineChain({
4
+ id: 450_815,
5
+ name: 'Maroo Testnet',
6
+ nativeCurrency: { name: 'Testnet OKRW', symbol: 'tOKRW', decimals: 18 },
7
+ rpcUrls: {
8
+ default: {
9
+ http: ['https://rpc-testnet.maroo.io'],
10
+ webSocket: ['wss://ws-testnet.maroo.io'],
11
+ },
12
+ },
13
+ blockExplorers: {
14
+ default: {
15
+ name: 'Blockscout',
16
+ url: 'https://explorer-testnet.maroo.io',
17
+ apiUrl: 'https://explorer-testnet.maroo.io/blockscout/api',
18
+ },
19
+ },
20
+ contracts: {
21
+ multicall3: {
22
+ address: '0xcA11bde05977b3631167028862bE2a173976CA11',
23
+ blockCreated: 0,
24
+ },
25
+ },
26
+ testnet: true,
27
+ })
package/chains/index.ts CHANGED
@@ -63,6 +63,7 @@ export { base, basePreconf } from './definitions/base.js'
63
63
  export { basecampTestnet } from './definitions/basecampTestnet.js'
64
64
  export { baseGoerli } from './definitions/baseGoerli.js'
65
65
  export { baseSepolia, baseSepoliaPreconf } from './definitions/baseSepolia.js'
66
+ export { battlechain } from './definitions/battlechain.js'
66
67
  export { battlechainTestnet } from './definitions/battlechainTestnet.js'
67
68
  export { beam } from './definitions/beam.js'
68
69
  export { beamTestnet } from './definitions/beamTestnet.js'
@@ -390,6 +391,7 @@ export { mantleTestnet } from './definitions/mantleTestnet.js'
390
391
  export { mantraDuKongEVMTestnet } from './definitions/mantraDuKongEVMTestnet.js'
391
392
  export { mantraEVM } from './definitions/mantraEVM.js'
392
393
  export { mapProtocol } from './definitions/mapProtocol.js'
394
+ export { marooTestnet } from './definitions/marooTestnet.js'
393
395
  export { matchain } from './definitions/matchain.js'
394
396
  export { matchainTestnet } from './definitions/matchainTestnet.js'
395
397
  export { mchVerse } from './definitions/mchVerse.js'
@@ -6,6 +6,7 @@ import {
6
6
  parseAccount,
7
7
  } from '../accounts/utils/parseAccount.js'
8
8
  import type { ErrorType } from '../errors/utils.js'
9
+ import type { Tokens } from '../tokens/defineToken.js'
9
10
  import type { Account } from '../types/account.js'
10
11
  import type { BlockTag } from '../types/block.js'
11
12
  import type { Chain } from '../types/chain.js'
@@ -33,6 +34,7 @@ export type ClientConfig<
33
34
  | Address
34
35
  | undefined,
35
36
  rpcSchema extends RpcSchema | undefined = undefined,
37
+ tokens extends Tokens | undefined = Tokens | undefined,
36
38
  > = {
37
39
  /** The Account to use for the Client. This will be used for Actions that require an account as an argument. */
38
40
  account?: accountOrAddress | Account | Address | undefined
@@ -90,6 +92,12 @@ export type ClientConfig<
90
92
  * Typed JSON-RPC schema for the client.
91
93
  */
92
94
  rpcSchema?: rpcSchema | undefined
95
+ /**
96
+ * Collection of tokens to declare on the Client. A token's symbol becomes
97
+ * available to token Actions (e.g. `token.transfer`) only when its `addresses`
98
+ * map includes the Client's `chain.id`.
99
+ */
100
+ tokens?: tokens | undefined
93
101
  /** The RPC transport */
94
102
  transport: transport
95
103
  /** The type of client. */
@@ -104,8 +112,9 @@ type ExtendableProtectedActions<
104
112
  transport extends Transport = Transport,
105
113
  chain extends Chain | undefined = Chain | undefined,
106
114
  account extends Account | undefined = Account | undefined,
115
+ tokens extends Tokens | undefined = Tokens | undefined,
107
116
  > = Pick<
108
- PublicActions<transport, chain, account>,
117
+ PublicActions<transport, chain, account, tokens>,
109
118
  | 'call'
110
119
  | 'createContractEventFilter'
111
120
  | 'createEventFilter'
@@ -130,7 +139,10 @@ type ExtendableProtectedActions<
130
139
  | 'watchBlockNumber'
131
140
  | 'watchContractEvent'
132
141
  > &
133
- Pick<WalletActions<chain, account>, 'sendTransaction' | 'writeContract'>
142
+ Pick<
143
+ WalletActions<chain, account, tokens>,
144
+ 'sendTransaction' | 'writeContract'
145
+ >
134
146
 
135
147
  // TODO: Move `transport` to slot index 2 since `chain` and `account` used more frequently.
136
148
  // Otherwise, we end up with a lot of `Client<Transport, chain, account>` in actions.
@@ -140,21 +152,25 @@ export type Client<
140
152
  account extends Account | undefined = Account | undefined,
141
153
  rpcSchema extends RpcSchema | undefined = undefined,
142
154
  extended extends Extended | undefined = Extended | undefined,
143
- > = Client_Base<transport, chain, account, rpcSchema> &
155
+ tokens extends Tokens | undefined = Tokens | undefined,
156
+ > = Client_Base<transport, chain, account, rpcSchema, tokens> &
144
157
  (extended extends Extended ? extended : unknown) & {
145
158
  extend: <
146
159
  const client extends Extended &
147
- ExactPartial<ExtendableProtectedActions<transport, chain, account>>,
160
+ ExactPartial<
161
+ ExtendableProtectedActions<transport, chain, account, tokens>
162
+ >,
148
163
  >(
149
164
  fn: (
150
- client: Client<transport, chain, account, rpcSchema, extended>,
165
+ client: Client<transport, chain, account, rpcSchema, extended, tokens>,
151
166
  ) => client,
152
167
  ) => Client<
153
168
  transport,
154
169
  chain,
155
170
  account,
156
171
  rpcSchema,
157
- Prettify<client> & (extended extends Extended ? extended : unknown)
172
+ Prettify<client> & (extended extends Extended ? extended : unknown),
173
+ tokens
158
174
  >
159
175
  }
160
176
 
@@ -163,6 +179,7 @@ type Client_Base<
163
179
  chain extends Chain | undefined = Chain | undefined,
164
180
  account extends Account | undefined = Account | undefined,
165
181
  rpcSchema extends RpcSchema | undefined = undefined,
182
+ tokens extends Tokens | undefined = Tokens | undefined,
166
183
  > = {
167
184
  /** The Account of the Client. */
168
185
  account: account
@@ -188,6 +205,8 @@ type Client_Base<
188
205
  request: EIP1193RequestFn<
189
206
  rpcSchema extends undefined ? EIP1474Methods : rpcSchema
190
207
  >
208
+ /** Collection of tokens declared on the Client. */
209
+ tokens: tokens
191
210
  /** The RPC transport */
192
211
  transport: ReturnType<transport>['config'] & ReturnType<transport>['value']
193
212
  /** The type of client. */
@@ -219,8 +238,15 @@ export function createClient<
219
238
  chain extends Chain | undefined = undefined,
220
239
  accountOrAddress extends Account | Address | undefined = undefined,
221
240
  rpcSchema extends RpcSchema | undefined = undefined,
241
+ const tokens extends Tokens | undefined = undefined,
222
242
  >(
223
- parameters: ClientConfig<transport, chain, accountOrAddress, rpcSchema>,
243
+ parameters: ClientConfig<
244
+ transport,
245
+ chain,
246
+ accountOrAddress,
247
+ rpcSchema,
248
+ tokens
249
+ >,
224
250
  ): Prettify<
225
251
  Client<
226
252
  transport,
@@ -228,7 +254,9 @@ export function createClient<
228
254
  accountOrAddress extends Address
229
255
  ? Prettify<JsonRpcAccount<accountOrAddress>>
230
256
  : accountOrAddress,
231
- rpcSchema
257
+ rpcSchema,
258
+ undefined,
259
+ tokens
232
260
  >
233
261
  >
234
262
 
@@ -240,6 +268,7 @@ export function createClient(parameters: ClientConfig): Client {
240
268
  dataSuffix,
241
269
  key = 'base',
242
270
  name = 'Base Client',
271
+ tokens,
243
272
  type = 'base',
244
273
  } = parameters
245
274
 
@@ -278,6 +307,7 @@ export function createClient(parameters: ClientConfig): Client {
278
307
  name,
279
308
  pollingInterval,
280
309
  request,
310
+ tokens,
281
311
  transport,
282
312
  type,
283
313
  uid: uid(),
@@ -290,6 +320,17 @@ export function createClient(parameters: ClientConfig): Client {
290
320
  const extended = extendFn(base) as Extended
291
321
  for (const key in client) delete extended[key]
292
322
  const combined = { ...base, ...extended }
323
+ // For keys that exist on both the base client and the extension and
324
+ // resolve to plain objects (e.g. namespaces like `token`), shallow-merge
325
+ // their members instead of overwriting. This lets decorators contribute
326
+ // to the same namespace (e.g. `publicActions` adds read actions and
327
+ // `walletActions` adds write actions to `client.token`).
328
+ for (const key in extended) {
329
+ const a = (base as Record<string, unknown>)[key]
330
+ const b = (extended as Record<string, unknown>)[key]
331
+ if (isPlainObject(a) && isPlainObject(b))
332
+ (combined as Record<string, unknown>)[key] = { ...a, ...b }
333
+ }
293
334
  return Object.assign(combined, { extend: extend(combined as any) })
294
335
  }
295
336
  }
@@ -297,6 +338,47 @@ export function createClient(parameters: ClientConfig): Client {
297
338
  return Object.assign(client, { extend: extend(client) as any })
298
339
  }
299
340
 
341
+ /** Whether `value` is a plain object (`{}`), as opposed to a function, array,
342
+ * or class instance. Used to decide which extension namespaces to merge. */
343
+ function isPlainObject(value: unknown): value is Record<string, unknown> {
344
+ if (typeof value !== 'object' || value === null) return false
345
+ const prototype = Object.getPrototypeOf(value)
346
+ return prototype === Object.prototype || prototype === null
347
+ }
348
+
349
+ /**
350
+ * Binds an action function to a `client`, returning a parameter-only version
351
+ * along with any helpers the action exposes. Helpers that need a client
352
+ * (`.call`, `.calls`, `.callWithPeriod`, `.estimateGas`, `.simulate`) are bound
353
+ * to `client`; pure helpers (`.extractEvent`, `.extractEvents`) are copied
354
+ * as-is. Used by decorators that attach namespaced actions to a Client.
355
+ * @internal
356
+ */
357
+ export function bindActionDecorators(
358
+ client: Client<Transport, Chain | undefined, any>,
359
+ action: any,
360
+ ) {
361
+ const wrapped: any = (parameters: any = {}) => action(client, parameters)
362
+ for (const key of [
363
+ 'call',
364
+ 'calls',
365
+ 'callWithPeriod',
366
+ 'estimateGas',
367
+ 'simulate',
368
+ ] as const)
369
+ if (Object.hasOwn(action, key)) {
370
+ const helper = action[key]
371
+ wrapped[key] = (args: any = {}) => {
372
+ if (helper.length >= 2) return helper(client, args)
373
+ if (helper.length === 0) return helper()
374
+ return helper(args)
375
+ }
376
+ }
377
+ for (const key of ['extractEvent', 'extractEvents'] as const)
378
+ if (Object.hasOwn(action, key)) wrapped[key] = action[key]
379
+ return wrapped
380
+ }
381
+
300
382
  /**
301
383
  * Defines a typed JSON-RPC schema for the client.
302
384
  * Note: This is a runtime noop function.
@@ -1,5 +1,6 @@
1
1
  import type { Address } from 'abitype'
2
2
  import type { ErrorType } from '../errors/utils.js'
3
+ import type { Tokens } from '../tokens/defineToken.js'
3
4
  import type { Account, ParseAccount } from '../types/account.js'
4
5
  import type { Chain } from '../types/chain.js'
5
6
  import type { PublicRpcSchema, RpcSchema } from '../types/eip1193.js'
@@ -18,9 +19,10 @@ export type PublicClientConfig<
18
19
  chain extends Chain | undefined = Chain | undefined,
19
20
  accountOrAddress extends Account | Address | undefined = undefined,
20
21
  rpcSchema extends RpcSchema | undefined = undefined,
22
+ tokens extends Tokens | undefined = Tokens | undefined,
21
23
  > = Prettify<
22
24
  Pick<
23
- ClientConfig<transport, chain, accountOrAddress, rpcSchema>,
25
+ ClientConfig<transport, chain, accountOrAddress, rpcSchema, tokens>,
24
26
  | 'batch'
25
27
  | 'cacheTime'
26
28
  | 'ccipRead'
@@ -30,6 +32,7 @@ export type PublicClientConfig<
30
32
  | 'name'
31
33
  | 'pollingInterval'
32
34
  | 'rpcSchema'
35
+ | 'tokens'
33
36
  | 'transport'
34
37
  >
35
38
  >
@@ -39,6 +42,7 @@ export type PublicClient<
39
42
  chain extends Chain | undefined = Chain | undefined,
40
43
  accountOrAddress extends Account | undefined = undefined,
41
44
  rpcSchema extends RpcSchema | undefined = undefined,
45
+ tokens extends Tokens | undefined = Tokens | undefined,
42
46
  > = Prettify<
43
47
  Client<
44
48
  transport,
@@ -47,7 +51,8 @@ export type PublicClient<
47
51
  rpcSchema extends RpcSchema
48
52
  ? [...PublicRpcSchema, ...rpcSchema]
49
53
  : PublicRpcSchema,
50
- PublicActions<transport, chain>
54
+ PublicActions<transport, chain, accountOrAddress, tokens>,
55
+ tokens
51
56
  >
52
57
  >
53
58
 
@@ -77,9 +82,22 @@ export function createPublicClient<
77
82
  chain extends Chain | undefined = undefined,
78
83
  accountOrAddress extends Account | Address | undefined = undefined,
79
84
  rpcSchema extends RpcSchema | undefined = undefined,
85
+ const tokens extends Tokens | undefined = undefined,
80
86
  >(
81
- parameters: PublicClientConfig<transport, chain, accountOrAddress, rpcSchema>,
82
- ): PublicClient<transport, chain, ParseAccount<accountOrAddress>, rpcSchema> {
87
+ parameters: PublicClientConfig<
88
+ transport,
89
+ chain,
90
+ accountOrAddress,
91
+ rpcSchema,
92
+ tokens
93
+ >,
94
+ ): PublicClient<
95
+ transport,
96
+ chain,
97
+ ParseAccount<accountOrAddress>,
98
+ rpcSchema,
99
+ tokens
100
+ > {
83
101
  const { key = 'public', name = 'Public Client' } = parameters
84
102
  const client = createClient({
85
103
  ...parameters,
@@ -2,6 +2,7 @@ import type { Address } from 'abitype'
2
2
 
3
3
  import type { Account } from '../accounts/types.js'
4
4
  import type { ErrorType } from '../errors/utils.js'
5
+ import type { Tokens } from '../tokens/defineToken.js'
5
6
  import type { ParseAccount } from '../types/account.js'
6
7
  import type { Chain } from '../types/chain.js'
7
8
  import type { RpcSchema, WalletRpcSchema } from '../types/eip1193.js'
@@ -23,9 +24,10 @@ export type WalletClientConfig<
23
24
  | Address
24
25
  | undefined,
25
26
  rpcSchema extends RpcSchema | undefined = undefined,
27
+ tokens extends Tokens | undefined = Tokens | undefined,
26
28
  > = Prettify<
27
29
  Pick<
28
- ClientConfig<transport, chain, accountOrAddress, rpcSchema>,
30
+ ClientConfig<transport, chain, accountOrAddress, rpcSchema, tokens>,
29
31
  | 'account'
30
32
  | 'cacheTime'
31
33
  | 'ccipRead'
@@ -35,6 +37,7 @@ export type WalletClientConfig<
35
37
  | 'name'
36
38
  | 'pollingInterval'
37
39
  | 'rpcSchema'
40
+ | 'tokens'
38
41
  | 'transport'
39
42
  >
40
43
  >
@@ -44,6 +47,7 @@ export type WalletClient<
44
47
  chain extends Chain | undefined = Chain | undefined,
45
48
  account extends Account | undefined = Account | undefined,
46
49
  rpcSchema extends RpcSchema | undefined = undefined,
50
+ tokens extends Tokens | undefined = Tokens | undefined,
47
51
  > = Prettify<
48
52
  Client<
49
53
  transport,
@@ -52,7 +56,8 @@ export type WalletClient<
52
56
  rpcSchema extends RpcSchema
53
57
  ? [...WalletRpcSchema, ...rpcSchema]
54
58
  : WalletRpcSchema,
55
- WalletActions<chain, account>
59
+ WalletActions<chain, account, tokens>,
60
+ tokens
56
61
  >
57
62
  >
58
63
 
@@ -99,9 +104,22 @@ export function createWalletClient<
99
104
  chain extends Chain | undefined = undefined,
100
105
  accountOrAddress extends Account | Address | undefined = undefined,
101
106
  rpcSchema extends RpcSchema | undefined = undefined,
107
+ const tokens extends Tokens | undefined = undefined,
102
108
  >(
103
- parameters: WalletClientConfig<transport, chain, accountOrAddress, rpcSchema>,
104
- ): WalletClient<transport, chain, ParseAccount<accountOrAddress>, rpcSchema>
109
+ parameters: WalletClientConfig<
110
+ transport,
111
+ chain,
112
+ accountOrAddress,
113
+ rpcSchema,
114
+ tokens
115
+ >,
116
+ ): WalletClient<
117
+ transport,
118
+ chain,
119
+ ParseAccount<accountOrAddress>,
120
+ rpcSchema,
121
+ tokens
122
+ >
105
123
 
106
124
  export function createWalletClient(
107
125
  parameters: WalletClientConfig,