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
@@ -0,0 +1,13 @@
1
+ // Generated with `pnpm gen:tokenlist`. Do not modify manually.
2
+
3
+ import { defineToken } from '../defineToken.js'
4
+
5
+ export const reusd = /*#__PURE__*/ defineToken({
6
+ addresses: {
7
+ 4217: '0x20c000000000000000000000383a23bacb546ab9', // tempo
8
+ },
9
+ currency: 'USD',
10
+ decimals: 6,
11
+ name: 'Re Protocol reUSD',
12
+ symbol: 'reUSD',
13
+ })
@@ -0,0 +1,13 @@
1
+ // Generated with `pnpm gen:tokenlist`. Do not modify manually.
2
+
3
+ import { defineToken } from '../defineToken.js'
4
+
5
+ export const rusd = /*#__PURE__*/ defineToken({
6
+ addresses: {
7
+ 4217: '0x20c0000000000000000000007f7ba549dd0251b9', // tempo
8
+ },
9
+ currency: 'USD',
10
+ decimals: 6,
11
+ name: 'Reservoir Stablecoin',
12
+ symbol: 'rUSD',
13
+ })
@@ -0,0 +1,13 @@
1
+ // Generated with `pnpm gen:tokenlist`. Do not modify manually.
2
+
3
+ import { defineToken } from '../defineToken.js'
4
+
5
+ export const sbc = /*#__PURE__*/ defineToken({
6
+ addresses: {
7
+ 4217: '0x20c000000000000000000000ae247a1130450f09', // tempo
8
+ },
9
+ currency: 'USD',
10
+ decimals: 6,
11
+ name: 'Stable Coin',
12
+ symbol: 'SBC',
13
+ })
@@ -0,0 +1,13 @@
1
+ // Generated with `pnpm gen:tokenlist`. Do not modify manually.
2
+
3
+ import { defineToken } from '../defineToken.js'
4
+
5
+ export const siusd = /*#__PURE__*/ defineToken({
6
+ addresses: {
7
+ 4217: '0x20c000000000000000000000048c8f36df1c9a4a', // tempo
8
+ },
9
+ currency: 'siUSD',
10
+ decimals: 6,
11
+ name: 'InfiniFi Staked USD',
12
+ symbol: 'siUSD',
13
+ })
@@ -0,0 +1,13 @@
1
+ // Generated with `pnpm gen:tokenlist`. Do not modify manually.
2
+
3
+ import { defineToken } from '../defineToken.js'
4
+
5
+ export const stcusd = /*#__PURE__*/ defineToken({
6
+ addresses: {
7
+ 4217: '0x20c0000000000000000000008ee4fcff88888888', // tempo
8
+ },
9
+ currency: 'stcUSD',
10
+ decimals: 6,
11
+ name: 'Staked Cap USD',
12
+ symbol: 'stcUSD',
13
+ })
@@ -0,0 +1,13 @@
1
+ // Generated with `pnpm gen:tokenlist`. Do not modify manually.
2
+
3
+ import { defineToken } from '../defineToken.js'
4
+
5
+ export const susde = /*#__PURE__*/ defineToken({
6
+ addresses: {
7
+ 4217: '0x20c000000000000000000000bd95bfb69fbe6ce3', // tempo
8
+ },
9
+ currency: 'sUSDe',
10
+ decimals: 6,
11
+ name: 'Staked USDe',
12
+ symbol: 'sUSDe',
13
+ })
@@ -0,0 +1,13 @@
1
+ // Generated with `pnpm gen:tokenlist`. Do not modify manually.
2
+
3
+ import { defineToken } from '../defineToken.js'
4
+
5
+ export const syrupusdc = /*#__PURE__*/ defineToken({
6
+ addresses: {
7
+ 4217: '0x20c0000000000000000000008191667423f70e67', // tempo
8
+ },
9
+ currency: 'syrupUSDC',
10
+ decimals: 6,
11
+ name: 'Syrup USDC',
12
+ symbol: 'syrupUSDC',
13
+ })
@@ -0,0 +1,13 @@
1
+ // Generated with `pnpm gen:tokenlist`. Do not modify manually.
2
+
3
+ import { defineToken } from '../defineToken.js'
4
+
5
+ export const thetausd = /*#__PURE__*/ defineToken({
6
+ addresses: {
7
+ 42431: '0x20c0000000000000000000000000000000000003', // tempoModerato
8
+ },
9
+ currency: 'USD',
10
+ decimals: 6,
11
+ name: 'ThetaUSD',
12
+ symbol: 'thetaUSD',
13
+ })
@@ -0,0 +1,13 @@
1
+ // Generated with `pnpm gen:tokenlist`. Do not modify manually.
2
+
3
+ import { defineToken } from '../defineToken.js'
4
+
5
+ export const usd1 = /*#__PURE__*/ defineToken({
6
+ addresses: {
7
+ 4217: '0x20c000000000000000000000111111111e910f0f', // tempo
8
+ },
9
+ currency: 'USD',
10
+ decimals: 6,
11
+ name: 'USD1',
12
+ symbol: 'USD1',
13
+ })
@@ -0,0 +1,13 @@
1
+ // Generated with `pnpm gen:tokenlist`. Do not modify manually.
2
+
3
+ import { defineToken } from '../defineToken.js'
4
+
5
+ export const usdb = /*#__PURE__*/ defineToken({
6
+ addresses: {
7
+ 4217: '0x20c0000000000000000000003158081efd85bfc2', // tempo
8
+ },
9
+ currency: 'USD',
10
+ decimals: 6,
11
+ name: 'USDBridge',
12
+ symbol: 'USDB',
13
+ })
@@ -0,0 +1,85 @@
1
+ import { defineToken } from '../defineToken.js'
2
+
3
+ /**
4
+ * [USDC](https://www.circle.com/usdc) token, with canonical contract addresses
5
+ * across supported chains.
6
+ *
7
+ * Pass to a Client's `tokens` array, call with a chain id to produce a
8
+ * [token config](/docs/chains/tokens), or read the metadata and `addresses`
9
+ * map directly.
10
+ *
11
+ * @example
12
+ * ```ts
13
+ * import { createPublicClient, http } from 'viem'
14
+ * import { mainnet } from 'viem/chains'
15
+ * import { usdc } from 'viem/tokens'
16
+ *
17
+ * const client = createPublicClient({
18
+ * chain: mainnet,
19
+ * tokens: [usdc],
20
+ * transport: http(),
21
+ * })
22
+ * ```
23
+ *
24
+ * @example
25
+ * ```ts
26
+ * import { usdc } from 'viem/tokens'
27
+ *
28
+ * usdc.addresses[1]
29
+ * // '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48'
30
+ * ```
31
+ */
32
+ export const usdc = /*#__PURE__*/ defineToken({
33
+ addresses: {
34
+ 1: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', // mainnet
35
+ 10: '0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85', // optimism
36
+ 25: '0x3D7F2C478aAfdB65542BCB44bCeeC05849999d2D', // cronos
37
+ 50: '0xfA2958CB79b0491CC627c1557F441eF849Ca8eb1', // xdc
38
+ 51: '0xb5AB69F7bBada22B28e79C8FFAECe55eF1c771D4', // xdcTestnet
39
+ 130: '0x078D782b760474a361dDA0AF3839290b0EF57AD6', // unichain
40
+ 137: '0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359', // polygon
41
+ 143: '0x754704Bc059F8C67012fEd69BC8A327a5aafb603', // monad
42
+ 146: '0x29219dd400f2Bf60E5a23d13Be72B486D4038894', // sonic
43
+ 300: '0xAe045DE5638162fa134807Cb558E15A3F5A7F853', // zksyncSepoliaTestnet
44
+ 324: '0x1d17CBcF0D6D143135aE902365D2E5e2A16538D4', // zksync
45
+ 338: '0xEb33dc5fac03833e132593659e1dE7256aB59794', // cronosTestnet
46
+ 480: '0x79A02482A880bCE3F13e09Da970dC34db4CD24d1', // worldchain
47
+ 998: '0x2B3370eE501B4a559b57D449569354196457D8Ab', // hyperliquidEvmTestnet
48
+ 999: '0xb88339CB7199b77E23DB6E890353E22632Ba630f', // hyperEvm
49
+ 1301: '0x31d0220469e10c4E71834a79b1f276d740d3768F', // unichainSepolia
50
+ 1328: '0x4fCF1784B31630811181f670Aea7A7bEF803eaED', // seiTestnet
51
+ 1329: '0xe15fC38F6D8c56aF07bbCBe3BAf5708A2Bf42392', // sei
52
+ 1439: '0x0C382e685bbeeFE5d3d9C29e29E341fEE8E84C5d', // injectiveTestnet
53
+ 1776: '0xa00C59fF5a080D2b954d0c75e46E22a0c371235a', // injective
54
+ 2818: '0xCfb1186F4e93D60E60a8bDd997427D1F33bc372B', // morph
55
+ 4801: '0x66145f38cBAC35Ca6F1Dfb4914dF98F1614aeA88', // worldchainSepolia
56
+ 8453: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913', // base
57
+ 10143: '0x534b2f3A21130d7a60830c2Df862319e593943A3', // monadTestnet
58
+ 42161: '0xaf88d065e77c8cC2239327C5EDb3A432268e5831', // arbitrum
59
+ 42220: '0xcebA9300f2b948710d2653dD7B07f33A8B32118C', // celo
60
+ 43113: '0x5425890298aed601595a70AB815c96711a31Bc65', // avalancheFuji
61
+ 43114: '0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E', // avalanche
62
+ 57054: '0xA4879Fed32Ecbef99399e5cbC247E533421C4eC6', // sonicBlazeTestnet
63
+ 57073: '0x2D270e6886d130D724215A266106e6832161EAEd', // ink
64
+ 59141: '0xFEce4462D57bD51A6A552365A011b95f0E16d9B7', // lineaSepolia
65
+ 59144: '0x176211869cA2b568f2A7D4EE941E073a821EE1ff', // linea
66
+ 64165: '0x0BA304580ee7c9a980CF72e55f5Ed2E9fd30Bc51', // sonicTestnet
67
+ 80002: '0x41E94Eb019C0762f9Bfcf9Fb1E58725BfB0e7582', // polygonAmoy
68
+ 81224: '0xd996633a415985DBd7D6D12f4A4343E31f5037cf', // codex
69
+ 84532: '0x036CbD53842c5426634e7929541eC2318f3dCF7e', // baseSepolia
70
+ 98866: '0x222365EF19F7947e5484218551B56bb3965Aa7aF', // plumeMainnet
71
+ 98867: '0xcB5f30e335672893c7eb944B374c196392C19D18', // plumeSepolia
72
+ 421614: '0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d', // arbitrumSepolia
73
+ 763373: '0xFabab97dCE620294D2B0b0e46C68964e326300Ac', // inkSepolia
74
+ 812242: '0x6d7f141b6819C2c9CC2f818e6ad549E7Ca090F8f', // codexTestnet
75
+ 5042002: '0x3600000000000000000000000000000000000000', // arcTestnet
76
+ 11142220: '0x01C5C0122039549AD1493B8220cABEdD739BC44E', // celoSepolia
77
+ 11155111: '0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238', // sepolia
78
+ 11155420: '0x5fd84259d66Cd46123540766Be93DFE6D43130D7', // optimismSepolia
79
+ },
80
+ currency: 'USD',
81
+ decimals: 6,
82
+ name: 'USD Coin',
83
+ popular: true,
84
+ symbol: 'USDC',
85
+ })
@@ -0,0 +1,14 @@
1
+ // Generated with `pnpm gen:tokenlist`. Do not modify manually.
2
+
3
+ import { defineToken } from '../defineToken.js'
4
+
5
+ export const usdce = /*#__PURE__*/ defineToken({
6
+ addresses: {
7
+ 4217: '0x20c000000000000000000000b9537d11c60e8b50', // tempo
8
+ 42431: '0x20c0000000000000000000009e8d7eb59b783726', // tempoModerato
9
+ },
10
+ currency: 'USD',
11
+ decimals: 6,
12
+ name: 'Bridged USDC (Stargate)',
13
+ symbol: 'USDC.e',
14
+ })
@@ -0,0 +1,13 @@
1
+ // Generated with `pnpm gen:tokenlist`. Do not modify manually.
2
+
3
+ import { defineToken } from '../defineToken.js'
4
+
5
+ export const usde = /*#__PURE__*/ defineToken({
6
+ addresses: {
7
+ 4217: '0x20c0000000000000000000002f52d5cc21a3207b', // tempo
8
+ },
9
+ currency: 'USD',
10
+ decimals: 6,
11
+ name: 'USDe',
12
+ symbol: 'USDe',
13
+ })
@@ -0,0 +1,13 @@
1
+ // Generated with `pnpm gen:tokenlist`. Do not modify manually.
2
+
3
+ import { defineToken } from '../defineToken.js'
4
+
5
+ export const usdt0 = /*#__PURE__*/ defineToken({
6
+ addresses: {
7
+ 4217: '0x20c00000000000000000000014f22ca97301eb73', // tempo
8
+ },
9
+ currency: 'USD',
10
+ decimals: 6,
11
+ name: 'USDT0',
12
+ symbol: 'USDT0',
13
+ })
@@ -0,0 +1,23 @@
1
+ import { defineToken } from '../defineToken.js'
2
+
3
+ /**
4
+ * [USYC](https://developers.circle.com/tokenized/usyc/overview) token, with
5
+ * canonical contract addresses across supported EVM chains.
6
+ *
7
+ * Pass to a Client's `tokens` array, call with a chain id to produce a
8
+ * [token config](/docs/chains/tokens), or read the metadata and `addresses`
9
+ * map directly.
10
+ */
11
+ export const usyc = /*#__PURE__*/ defineToken({
12
+ addresses: {
13
+ 1: '0x136471a34f6ef19fE571EFFC1CA711fdb8E49f2b', // mainnet
14
+ 56: '0x8D0fA28f221eB5735BC71d3a0Da67EE5bC821311', // bsc
15
+ 97: '0x109656Aba6F175c634c63C9874f29CeAAAB8E606', // bscTestnet
16
+ 5042002: '0xe9185F0c5F296Ed1797AaE4238D26CCaBEadb86C', // arcTestnet
17
+ 11155111: '0x38D3A3f8717F4DB1CcB4Ad7D8C755919440848A3', // sepolia
18
+ },
19
+ currency: 'USD',
20
+ decimals: 6,
21
+ name: 'US Yield Coin',
22
+ symbol: 'USYC',
23
+ })
@@ -0,0 +1,13 @@
1
+ // Generated with `pnpm gen:tokenlist`. Do not modify manually.
2
+
3
+ import { defineToken } from '../defineToken.js'
4
+
5
+ export const wsrusd = /*#__PURE__*/ defineToken({
6
+ addresses: {
7
+ 4217: '0x20c000000000000000000000aeed2ec36a54d0e5', // tempo
8
+ },
9
+ currency: 'wsrUSD',
10
+ decimals: 6,
11
+ name: 'Wrapped Savings rUSD',
12
+ symbol: 'wsrUSD',
13
+ })
@@ -0,0 +1,35 @@
1
+ // biome-ignore lint/performance/noBarrelFile: entrypoint module
2
+ export { defineToken, type Token, type Tokens } from './defineToken.js'
3
+ export { alphausd } from './definitions/alphausd.js'
4
+ export { betausd } from './definitions/betausd.js'
5
+ export { brla } from './definitions/brla.js'
6
+ export { cbbtc } from './definitions/cbbtc.js'
7
+ export { chfau } from './definitions/chfau.js'
8
+ export { cirbtc } from './definitions/cirbtc.js'
9
+ export { cusd } from './definitions/cusd.js'
10
+ export { dlusd } from './definitions/dlusd.js'
11
+ export { eurau } from './definitions/eurau.js'
12
+ export { eurc } from './definitions/eurc.js'
13
+ export { eurce } from './definitions/eurce.js'
14
+ export { frxusd } from './definitions/frxusd.js'
15
+ export { gbpa } from './definitions/gbpa.js'
16
+ export { gusd } from './definitions/gusd.js'
17
+ export { iusd } from './definitions/iusd.js'
18
+ export { pathusd } from './definitions/pathusd.js'
19
+ export { reusd } from './definitions/reusd.js'
20
+ export { rusd } from './definitions/rusd.js'
21
+ export { sbc } from './definitions/sbc.js'
22
+ export { siusd } from './definitions/siusd.js'
23
+ export { stcusd } from './definitions/stcusd.js'
24
+ export { susde } from './definitions/susde.js'
25
+ export { syrupusdc } from './definitions/syrupusdc.js'
26
+ export { thetausd } from './definitions/thetausd.js'
27
+ export { usd1 } from './definitions/usd1.js'
28
+ export { usdb } from './definitions/usdb.js'
29
+ export { usdc } from './definitions/usdc.js'
30
+ export { usdce } from './definitions/usdce.js'
31
+ export { usde } from './definitions/usde.js'
32
+ export { usdt0 } from './definitions/usdt0.js'
33
+ export { usyc } from './definitions/usyc.js'
34
+ export { wsrusd } from './definitions/wsrusd.js'
35
+ export { tokens } from './sets.js'
@@ -0,0 +1,6 @@
1
+ {
2
+ "type": "module",
3
+ "types": "../_types/tokens/index.d.ts",
4
+ "module": "../_esm/tokens/index.js",
5
+ "main": "../_cjs/tokens/index.js"
6
+ }
package/tokens/sets.ts ADDED
@@ -0,0 +1,109 @@
1
+ // Generated with `pnpm gen:tokenlist`. Do not modify manually.
2
+
3
+ import type { Tokens } from './defineToken.js'
4
+ import { alphausd } from './definitions/alphausd.js'
5
+ import { betausd } from './definitions/betausd.js'
6
+ import { brla } from './definitions/brla.js'
7
+ import { cbbtc } from './definitions/cbbtc.js'
8
+ import { chfau } from './definitions/chfau.js'
9
+ import { cirbtc } from './definitions/cirbtc.js'
10
+ import { cusd } from './definitions/cusd.js'
11
+ import { dlusd } from './definitions/dlusd.js'
12
+ import { eurau } from './definitions/eurau.js'
13
+ import { eurc } from './definitions/eurc.js'
14
+ import { eurce } from './definitions/eurce.js'
15
+ import { frxusd } from './definitions/frxusd.js'
16
+ import { gbpa } from './definitions/gbpa.js'
17
+ import { gusd } from './definitions/gusd.js'
18
+ import { iusd } from './definitions/iusd.js'
19
+ import { pathusd } from './definitions/pathusd.js'
20
+ import { reusd } from './definitions/reusd.js'
21
+ import { rusd } from './definitions/rusd.js'
22
+ import { sbc } from './definitions/sbc.js'
23
+ import { siusd } from './definitions/siusd.js'
24
+ import { stcusd } from './definitions/stcusd.js'
25
+ import { susde } from './definitions/susde.js'
26
+ import { syrupusdc } from './definitions/syrupusdc.js'
27
+ import { thetausd } from './definitions/thetausd.js'
28
+ import { usd1 } from './definitions/usd1.js'
29
+ import { usdb } from './definitions/usdb.js'
30
+ import { usdc } from './definitions/usdc.js'
31
+ import { usdce } from './definitions/usdce.js'
32
+ import { usde } from './definitions/usde.js'
33
+ import { usdt0 } from './definitions/usdt0.js'
34
+ import { usyc } from './definitions/usyc.js'
35
+ import { wsrusd } from './definitions/wsrusd.js'
36
+
37
+ /** Every token definition. */
38
+ const all = [
39
+ alphausd,
40
+ betausd,
41
+ brla,
42
+ cbbtc,
43
+ chfau,
44
+ cirbtc,
45
+ cusd,
46
+ dlusd,
47
+ eurau,
48
+ eurc,
49
+ eurce,
50
+ frxusd,
51
+ gbpa,
52
+ gusd,
53
+ iusd,
54
+ pathusd,
55
+ reusd,
56
+ rusd,
57
+ sbc,
58
+ siusd,
59
+ stcusd,
60
+ susde,
61
+ syrupusdc,
62
+ thetausd,
63
+ usd1,
64
+ usdb,
65
+ usdc,
66
+ usdce,
67
+ usde,
68
+ usdt0,
69
+ usyc,
70
+ wsrusd,
71
+ ] as const satisfies Tokens
72
+
73
+ /** Tokens flagged as popular. */
74
+ const popular = [usdc] as const satisfies Tokens
75
+
76
+ /** All tokens available on Tempo chains. */
77
+ const tempo = [
78
+ alphausd,
79
+ betausd,
80
+ brla,
81
+ cbbtc,
82
+ chfau,
83
+ cusd,
84
+ dlusd,
85
+ eurau,
86
+ eurce,
87
+ frxusd,
88
+ gbpa,
89
+ gusd,
90
+ iusd,
91
+ pathusd,
92
+ reusd,
93
+ rusd,
94
+ sbc,
95
+ siusd,
96
+ stcusd,
97
+ susde,
98
+ syrupusdc,
99
+ thetausd,
100
+ usd1,
101
+ usdb,
102
+ usdce,
103
+ usde,
104
+ usdt0,
105
+ wsrusd,
106
+ ] as const satisfies Tokens
107
+
108
+ /** Curated token sets that can be passed to a Client's `tokens` property. */
109
+ export const tokens = { all, popular, tempo }
@@ -2,6 +2,8 @@ import { BaseError, type BaseErrorType } from '../../errors/base.js'
2
2
  import {
3
3
  InvalidHexValueError,
4
4
  type InvalidHexValueErrorType,
5
+ RlpDepthLimitExceededError,
6
+ type RlpDepthLimitExceededErrorType,
5
7
  } from '../../errors/encoding.js'
6
8
  import type { ErrorType } from '../../errors/utils.js'
7
9
  import type { ByteArray, Hex } from '../../types/misc.js'
@@ -17,6 +19,8 @@ import type { RecursiveArray } from './toRlp.js'
17
19
 
18
20
  type To = 'hex' | 'bytes'
19
21
 
22
+ const rlpDepthLimit = 1_024
23
+
20
24
  export type FromRlpReturnType<to extends To> =
21
25
  | (to extends 'bytes' ? RecursiveArray<ByteArray> : never)
22
26
  | (to extends 'hex' ? RecursiveArray<Hex> : never)
@@ -26,6 +30,7 @@ export type FromRlpErrorType =
26
30
  | FromRlpCursorErrorType
27
31
  | HexToBytesErrorType
28
32
  | InvalidHexValueErrorType
33
+ | RlpDepthLimitExceededErrorType
29
34
  | ErrorType
30
35
 
31
36
  export function fromRlp<to extends To = 'hex'>(
@@ -58,7 +63,11 @@ type FromRlpCursorErrorType =
58
63
  function fromRlpCursor<to extends To = 'hex'>(
59
64
  cursor: Cursor,
60
65
  to: to | To | undefined = 'hex',
66
+ recursiveDepth = 0,
61
67
  ): FromRlpReturnType<to> {
68
+ if (recursiveDepth >= rlpDepthLimit)
69
+ throw new RlpDepthLimitExceededError({ limit: rlpDepthLimit })
70
+
62
71
  if (cursor.bytes.length === 0)
63
72
  return (
64
73
  to === 'hex' ? bytesToHex(cursor.bytes) : cursor.bytes
@@ -76,7 +85,12 @@ function fromRlpCursor<to extends To = 'hex'>(
76
85
 
77
86
  // list
78
87
  const length = readLength(cursor, prefix, 0xc0)
79
- return readList(cursor, length, to) as {} as FromRlpReturnType<to>
88
+ return readList(
89
+ cursor,
90
+ length,
91
+ to,
92
+ recursiveDepth + 1,
93
+ ) as {} as FromRlpReturnType<to>
80
94
  }
81
95
 
82
96
  type ReadLengthErrorType = BaseErrorType | ErrorType
@@ -93,10 +107,15 @@ function readLength(cursor: Cursor, prefix: number, offset: number) {
93
107
 
94
108
  type ReadListErrorType = ErrorType
95
109
 
96
- function readList<to extends To>(cursor: Cursor, length: number, to: to | To) {
110
+ function readList<to extends To>(
111
+ cursor: Cursor,
112
+ length: number,
113
+ to: to | To,
114
+ recursiveDepth: number,
115
+ ) {
97
116
  const position = cursor.position
98
117
  const value: FromRlpReturnType<to>[] = []
99
118
  while (cursor.position - position < length)
100
- value.push(fromRlpCursor(cursor, to))
119
+ value.push(fromRlpCursor(cursor, to, recursiveDepth))
101
120
  return value
102
121
  }
package/utils/rpc/http.ts CHANGED
@@ -1,6 +1,8 @@
1
1
  import {
2
2
  HttpRequestError,
3
3
  type HttpRequestErrorType as HttpRequestErrorType_,
4
+ ResponseBodyTooLargeError,
5
+ type ResponseBodyTooLargeErrorType,
4
6
  TimeoutError,
5
7
  type TimeoutErrorType,
6
8
  } from '../../errors/request.js'
@@ -25,6 +27,8 @@ export type HttpRpcClientOptions = {
25
27
  | undefined
26
28
  /** Request configuration to pass to `fetch`. */
27
29
  fetchOptions?: Omit<RequestInit, 'body'> | undefined
30
+ /** Maximum response body size in bytes. Set to `false` to disable. @default 10_485_760 */
31
+ maxResponseBodySize?: number | false | undefined
28
32
  /** A callback to handle the request. */
29
33
  onRequest?:
30
34
  | ((
@@ -49,6 +53,8 @@ export type HttpRequestParameters<
49
53
  fetchFn?: HttpRpcClientOptions['fetchFn'] | undefined
50
54
  /** Request configuration to pass to `fetch`. */
51
55
  fetchOptions?: HttpRpcClientOptions['fetchOptions'] | undefined
56
+ /** Maximum response body size in bytes. Set to `false` to disable. */
57
+ maxResponseBodySize?: HttpRpcClientOptions['maxResponseBodySize'] | undefined
52
58
  /** A callback to handle the response. */
53
59
  onRequest?:
54
60
  | ((
@@ -70,10 +76,13 @@ export type HttpRequestReturnType<
70
76
 
71
77
  export type HttpRequestErrorType =
72
78
  | HttpRequestErrorType_
79
+ | ResponseBodyTooLargeErrorType
73
80
  | TimeoutErrorType
74
81
  | WithTimeoutErrorType
75
82
  | ErrorType
76
83
 
84
+ const defaultMaxResponseBodySize = 10_485_760
85
+
77
86
  export type HttpRpcClient = {
78
87
  request<body extends RpcRequest | RpcRequest[]>(
79
88
  params: HttpRequestParameters<body>,
@@ -91,6 +100,8 @@ export function getHttpRpcClient(
91
100
  const {
92
101
  body,
93
102
  fetchFn = options.fetchFn ?? fetch,
103
+ maxResponseBodySize = options.maxResponseBodySize ??
104
+ defaultMaxResponseBodySize,
94
105
  onRequest = options.onRequest,
95
106
  onResponse = options.onResponse,
96
107
  timeout = options.timeout ?? 10_000,
@@ -144,12 +155,15 @@ export function getHttpRpcClient(
144
155
  if (onResponse) await onResponse(response)
145
156
 
146
157
  let data: any
158
+ const responseBody = await readResponseBody(response, {
159
+ maxResponseBodySize,
160
+ })
147
161
  if (
148
162
  response.headers.get('Content-Type')?.startsWith('application/json')
149
163
  )
150
- data = await response.json()
164
+ data = JSON.parse(responseBody)
151
165
  else {
152
- data = await response.text()
166
+ data = responseBody
153
167
  try {
154
168
  data = JSON.parse(data || '{}')
155
169
  } catch (err) {
@@ -181,6 +195,7 @@ export function getHttpRpcClient(
181
195
  if (signal_?.aborted) throw getAbortError(signal_)
182
196
  if (isAbortError(err)) throw err
183
197
  if (err instanceof HttpRequestError) throw err
198
+ if (err instanceof ResponseBodyTooLargeError) throw err
184
199
  if (err instanceof TimeoutError) throw err
185
200
  throw new HttpRequestError({
186
201
  body,
@@ -192,6 +207,59 @@ export function getHttpRpcClient(
192
207
  }
193
208
  }
194
209
 
210
+ async function readResponseBody(
211
+ response: Response,
212
+ { maxResponseBodySize }: { maxResponseBodySize: number | false },
213
+ ): Promise<string> {
214
+ if (maxResponseBodySize === false) return response.text()
215
+
216
+ const contentLength = response.headers.get('Content-Length')
217
+ if (contentLength) {
218
+ const size = Number(contentLength)
219
+ if (size > maxResponseBodySize)
220
+ throw new ResponseBodyTooLargeError({
221
+ maxSize: maxResponseBodySize,
222
+ size,
223
+ })
224
+ }
225
+
226
+ if (!response.body) {
227
+ const body = await response.text()
228
+ const size = new TextEncoder().encode(body).length
229
+ if (size > maxResponseBodySize)
230
+ throw new ResponseBodyTooLargeError({
231
+ maxSize: maxResponseBodySize,
232
+ size,
233
+ })
234
+ return body
235
+ }
236
+
237
+ const reader = response.body.getReader()
238
+ const decoder = new TextDecoder()
239
+ let body = ''
240
+ let size = 0
241
+
242
+ try {
243
+ while (true) {
244
+ const { done, value } = await reader.read()
245
+ if (done) break
246
+ size += value.byteLength
247
+ if (size > maxResponseBodySize) {
248
+ await reader.cancel()
249
+ throw new ResponseBodyTooLargeError({
250
+ maxSize: maxResponseBodySize,
251
+ size,
252
+ })
253
+ }
254
+ body += decoder.decode(value, { stream: true })
255
+ }
256
+ body += decoder.decode()
257
+ return body
258
+ } finally {
259
+ reader.releaseLock()
260
+ }
261
+ }
262
+
195
263
  /** @internal */
196
264
  export function parseUrl(url_: string) {
197
265
  try {