viem 2.57.14 → 2.57.16

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 (363) hide show
  1. package/CHANGELOG.md +58 -0
  2. package/_cjs/account-abstraction/utils/formatters/userOperationReceipt.js +2 -0
  3. package/_cjs/account-abstraction/utils/formatters/userOperationReceipt.js.map +1 -1
  4. package/_cjs/actions/public/estimateGas.js +5 -2
  5. package/_cjs/actions/public/estimateGas.js.map +1 -1
  6. package/_cjs/actions/public/fillTransaction.js +2 -0
  7. package/_cjs/actions/public/fillTransaction.js.map +1 -1
  8. package/_cjs/actions/public/getFilterChanges.js +1 -0
  9. package/_cjs/actions/public/getFilterChanges.js.map +1 -1
  10. package/_cjs/actions/public/getFilterLogs.js +1 -0
  11. package/_cjs/actions/public/getFilterLogs.js.map +1 -1
  12. package/_cjs/actions/public/watchBlockNumber.js +3 -1
  13. package/_cjs/actions/public/watchBlockNumber.js.map +1 -1
  14. package/_cjs/actions/public/watchBlocks.js +20 -8
  15. package/_cjs/actions/public/watchBlocks.js.map +1 -1
  16. package/_cjs/actions/public/watchContractEvent.js +10 -3
  17. package/_cjs/actions/public/watchContractEvent.js.map +1 -1
  18. package/_cjs/actions/public/watchEvent.js +5 -0
  19. package/_cjs/actions/public/watchEvent.js.map +1 -1
  20. package/_cjs/actions/wallet/prepareTransactionRequest.js +3 -2
  21. package/_cjs/actions/wallet/prepareTransactionRequest.js.map +1 -1
  22. package/_cjs/actions/wallet/sendTransaction.js +4 -2
  23. package/_cjs/actions/wallet/sendTransaction.js.map +1 -1
  24. package/_cjs/actions/wallet/sendTransactionSync.js +48 -7
  25. package/_cjs/actions/wallet/sendTransactionSync.js.map +1 -1
  26. package/_cjs/chains/definitions/hashKeyChain.js +4 -4
  27. package/_cjs/chains/definitions/hashKeyChain.js.map +1 -1
  28. package/_cjs/chains/definitions/hashkeyChainTestnet.js +4 -4
  29. package/_cjs/chains/definitions/hashkeyChainTestnet.js.map +1 -1
  30. package/_cjs/chains/definitions/turkchain.js +26 -0
  31. package/_cjs/chains/definitions/turkchain.js.map +1 -0
  32. package/_cjs/chains/definitions/zksync.js +1 -1
  33. package/_cjs/chains/definitions/zksync.js.map +1 -1
  34. package/_cjs/chains/index.js +4 -2
  35. package/_cjs/chains/index.js.map +1 -1
  36. package/_cjs/clients/createClient.js.map +1 -1
  37. package/_cjs/clients/transports/fallback.js +5 -0
  38. package/_cjs/clients/transports/fallback.js.map +1 -1
  39. package/_cjs/errors/node.js +10 -4
  40. package/_cjs/errors/node.js.map +1 -1
  41. package/_cjs/errors/typedData.js +4 -2
  42. package/_cjs/errors/typedData.js.map +1 -1
  43. package/_cjs/errors/version.js +1 -1
  44. package/_cjs/index.js +5 -4
  45. package/_cjs/index.js.map +1 -1
  46. package/_cjs/tempo/Account.js +85 -12
  47. package/_cjs/tempo/Account.js.map +1 -1
  48. package/_cjs/tempo/Gateway.js +195 -0
  49. package/_cjs/tempo/Gateway.js.map +1 -0
  50. package/_cjs/tempo/GatewayDecorator.js +168 -0
  51. package/_cjs/tempo/GatewayDecorator.js.map +1 -0
  52. package/_cjs/tempo/Transaction.js +2 -1
  53. package/_cjs/tempo/Transaction.js.map +1 -1
  54. package/_cjs/tempo/actions/ai.js +69 -0
  55. package/_cjs/tempo/actions/ai.js.map +1 -0
  56. package/_cjs/tempo/actions/bucket.js +85 -0
  57. package/_cjs/tempo/actions/bucket.js.map +1 -0
  58. package/_cjs/tempo/actions/compute.js +165 -0
  59. package/_cjs/tempo/actions/compute.js.map +1 -0
  60. package/_cjs/tempo/actions/gateway.js +8 -0
  61. package/_cjs/tempo/actions/gateway.js.map +1 -0
  62. package/_cjs/tempo/actions/index.js +6 -1
  63. package/_cjs/tempo/actions/index.js.map +1 -1
  64. package/_cjs/tempo/actions/kv.js +44 -0
  65. package/_cjs/tempo/actions/kv.js.map +1 -0
  66. package/_cjs/tempo/chainConfig.js +4 -12
  67. package/_cjs/tempo/chainConfig.js.map +1 -1
  68. package/_cjs/tempo/index.js +4 -1
  69. package/_cjs/tempo/index.js.map +1 -1
  70. package/_cjs/tempo/internal/ndjson.js +43 -0
  71. package/_cjs/tempo/internal/ndjson.js.map +1 -0
  72. package/_cjs/tempo/internal/relay/feePayer.js +18 -5
  73. package/_cjs/tempo/internal/relay/feePayer.js.map +1 -1
  74. package/_cjs/utils/abi/decodeEventLog.js +57 -7
  75. package/_cjs/utils/abi/decodeEventLog.js.map +1 -1
  76. package/_cjs/utils/abi/getAbiItem.js +27 -6
  77. package/_cjs/utils/abi/getAbiItem.js.map +1 -1
  78. package/_cjs/utils/abi/parseEventLogs.js +27 -4
  79. package/_cjs/utils/abi/parseEventLogs.js.map +1 -1
  80. package/_cjs/utils/authorization/recoverAuthorizationAddress.js +9 -2
  81. package/_cjs/utils/authorization/recoverAuthorizationAddress.js.map +1 -1
  82. package/_cjs/utils/authorization/verifyAuthorization.js +14 -4
  83. package/_cjs/utils/authorization/verifyAuthorization.js.map +1 -1
  84. package/_cjs/utils/buildRequest.js +4 -0
  85. package/_cjs/utils/buildRequest.js.map +1 -1
  86. package/_cjs/utils/ccip.js +134 -28
  87. package/_cjs/utils/ccip.js.map +1 -1
  88. package/_cjs/utils/ccipTunnel.js +5 -1
  89. package/_cjs/utils/ccipTunnel.js.map +1 -1
  90. package/_cjs/utils/ens/localBatchGatewayRequest.js +55 -5
  91. package/_cjs/utils/ens/localBatchGatewayRequest.js.map +1 -1
  92. package/_cjs/utils/hash/toSignatureHash.js +10 -1
  93. package/_cjs/utils/hash/toSignatureHash.js.map +1 -1
  94. package/_cjs/utils/internal/http.js +79 -0
  95. package/_cjs/utils/internal/http.js.map +1 -0
  96. package/_cjs/utils/nonceManager.js.map +1 -1
  97. package/_cjs/utils/rpc/http.js +9 -76
  98. package/_cjs/utils/rpc/http.js.map +1 -1
  99. package/_cjs/utils/rpc/socket.js +20 -9
  100. package/_cjs/utils/rpc/socket.js.map +1 -1
  101. package/_cjs/utils/transaction/assertRequest.js +2 -2
  102. package/_cjs/utils/transaction/assertRequest.js.map +1 -1
  103. package/_cjs/utils/transaction/assertTransaction.js +2 -2
  104. package/_cjs/utils/transaction/assertTransaction.js.map +1 -1
  105. package/_cjs/utils/transaction/parseTransaction.js +21 -7
  106. package/_cjs/utils/transaction/parseTransaction.js.map +1 -1
  107. package/_cjs/utils/typedData.js +19 -6
  108. package/_cjs/utils/typedData.js.map +1 -1
  109. package/_cjs/zksync/actions/finalizeWithdrawal.js +4 -2
  110. package/_cjs/zksync/actions/finalizeWithdrawal.js.map +1 -1
  111. package/_cjs/zksync/actions/isWithdrawalFinalized.js +4 -5
  112. package/_cjs/zksync/actions/isWithdrawalFinalized.js.map +1 -1
  113. package/_esm/account-abstraction/utils/formatters/userOperationReceipt.js +2 -0
  114. package/_esm/account-abstraction/utils/formatters/userOperationReceipt.js.map +1 -1
  115. package/_esm/actions/public/estimateGas.js +10 -5
  116. package/_esm/actions/public/estimateGas.js.map +1 -1
  117. package/_esm/actions/public/fillTransaction.js +2 -0
  118. package/_esm/actions/public/fillTransaction.js.map +1 -1
  119. package/_esm/actions/public/getFilterChanges.js +1 -0
  120. package/_esm/actions/public/getFilterChanges.js.map +1 -1
  121. package/_esm/actions/public/getFilterLogs.js +1 -0
  122. package/_esm/actions/public/getFilterLogs.js.map +1 -1
  123. package/_esm/actions/public/watchBlockNumber.js +5 -1
  124. package/_esm/actions/public/watchBlockNumber.js.map +1 -1
  125. package/_esm/actions/public/watchBlocks.js +28 -8
  126. package/_esm/actions/public/watchBlocks.js.map +1 -1
  127. package/_esm/actions/public/watchContractEvent.js +15 -5
  128. package/_esm/actions/public/watchContractEvent.js.map +1 -1
  129. package/_esm/actions/public/watchEvent.js +11 -2
  130. package/_esm/actions/public/watchEvent.js.map +1 -1
  131. package/_esm/actions/wallet/prepareTransactionRequest.js +3 -2
  132. package/_esm/actions/wallet/prepareTransactionRequest.js.map +1 -1
  133. package/_esm/actions/wallet/sendTransaction.js +6 -2
  134. package/_esm/actions/wallet/sendTransaction.js.map +1 -1
  135. package/_esm/actions/wallet/sendTransactionSync.js +59 -8
  136. package/_esm/actions/wallet/sendTransactionSync.js.map +1 -1
  137. package/_esm/chains/definitions/hashKeyChain.js +4 -4
  138. package/_esm/chains/definitions/hashKeyChain.js.map +1 -1
  139. package/_esm/chains/definitions/hashkeyChainTestnet.js +4 -4
  140. package/_esm/chains/definitions/hashkeyChainTestnet.js.map +1 -1
  141. package/_esm/chains/definitions/turkchain.js +23 -0
  142. package/_esm/chains/definitions/turkchain.js.map +1 -0
  143. package/_esm/chains/definitions/zksync.js +1 -1
  144. package/_esm/chains/definitions/zksync.js.map +1 -1
  145. package/_esm/chains/index.js +1 -0
  146. package/_esm/chains/index.js.map +1 -1
  147. package/_esm/clients/createClient.js.map +1 -1
  148. package/_esm/clients/transports/fallback.js +8 -0
  149. package/_esm/clients/transports/fallback.js.map +1 -1
  150. package/_esm/errors/node.js +10 -4
  151. package/_esm/errors/node.js.map +1 -1
  152. package/_esm/errors/typedData.js +5 -2
  153. package/_esm/errors/typedData.js.map +1 -1
  154. package/_esm/errors/version.js +1 -1
  155. package/_esm/index.js +1 -1
  156. package/_esm/index.js.map +1 -1
  157. package/_esm/tempo/Account.js +122 -11
  158. package/_esm/tempo/Account.js.map +1 -1
  159. package/_esm/tempo/Gateway.js +294 -0
  160. package/_esm/tempo/Gateway.js.map +1 -0
  161. package/_esm/tempo/GatewayDecorator.js +207 -0
  162. package/_esm/tempo/GatewayDecorator.js.map +1 -0
  163. package/_esm/tempo/Transaction.js +2 -0
  164. package/_esm/tempo/Transaction.js.map +1 -1
  165. package/_esm/tempo/actions/ai.js +132 -0
  166. package/_esm/tempo/actions/ai.js.map +1 -0
  167. package/_esm/tempo/actions/bucket.js +181 -0
  168. package/_esm/tempo/actions/bucket.js.map +1 -0
  169. package/_esm/tempo/actions/compute.js +424 -0
  170. package/_esm/tempo/actions/compute.js.map +1 -0
  171. package/_esm/tempo/actions/gateway.js +22 -0
  172. package/_esm/tempo/actions/gateway.js.map +1 -0
  173. package/_esm/tempo/actions/index.js +10 -0
  174. package/_esm/tempo/actions/index.js.map +1 -1
  175. package/_esm/tempo/actions/kv.js +124 -0
  176. package/_esm/tempo/actions/kv.js.map +1 -0
  177. package/_esm/tempo/chainConfig.js +13 -15
  178. package/_esm/tempo/chainConfig.js.map +1 -1
  179. package/_esm/tempo/index.js +9 -0
  180. package/_esm/tempo/index.js.map +1 -1
  181. package/_esm/tempo/internal/ndjson.js +45 -0
  182. package/_esm/tempo/internal/ndjson.js.map +1 -0
  183. package/_esm/tempo/internal/relay/feePayer.js +24 -7
  184. package/_esm/tempo/internal/relay/feePayer.js.map +1 -1
  185. package/_esm/utils/abi/decodeEventLog.js +69 -7
  186. package/_esm/utils/abi/decodeEventLog.js.map +1 -1
  187. package/_esm/utils/abi/getAbiItem.js +34 -6
  188. package/_esm/utils/abi/getAbiItem.js.map +1 -1
  189. package/_esm/utils/abi/parseEventLogs.js +43 -10
  190. package/_esm/utils/abi/parseEventLogs.js.map +1 -1
  191. package/_esm/utils/authorization/recoverAuthorizationAddress.js +11 -2
  192. package/_esm/utils/authorization/recoverAuthorizationAddress.js.map +1 -1
  193. package/_esm/utils/authorization/verifyAuthorization.js +15 -4
  194. package/_esm/utils/authorization/verifyAuthorization.js.map +1 -1
  195. package/_esm/utils/buildRequest.js +6 -0
  196. package/_esm/utils/buildRequest.js.map +1 -1
  197. package/_esm/utils/ccip.js +163 -31
  198. package/_esm/utils/ccip.js.map +1 -1
  199. package/_esm/utils/ccipTunnel.js +5 -1
  200. package/_esm/utils/ccipTunnel.js.map +1 -1
  201. package/_esm/utils/ens/localBatchGatewayRequest.js +69 -4
  202. package/_esm/utils/ens/localBatchGatewayRequest.js.map +1 -1
  203. package/_esm/utils/hash/toSignatureHash.js +11 -1
  204. package/_esm/utils/hash/toSignatureHash.js.map +1 -1
  205. package/_esm/utils/internal/http.js +83 -0
  206. package/_esm/utils/internal/http.js.map +1 -0
  207. package/_esm/utils/nonceManager.js.map +1 -1
  208. package/_esm/utils/rpc/http.js +12 -78
  209. package/_esm/utils/rpc/http.js.map +1 -1
  210. package/_esm/utils/rpc/socket.js +24 -9
  211. package/_esm/utils/rpc/socket.js.map +1 -1
  212. package/_esm/utils/transaction/assertRequest.js +2 -2
  213. package/_esm/utils/transaction/assertRequest.js.map +1 -1
  214. package/_esm/utils/transaction/assertTransaction.js +2 -2
  215. package/_esm/utils/transaction/assertTransaction.js.map +1 -1
  216. package/_esm/utils/transaction/parseTransaction.js +24 -7
  217. package/_esm/utils/transaction/parseTransaction.js.map +1 -1
  218. package/_esm/utils/typedData.js +25 -8
  219. package/_esm/utils/typedData.js.map +1 -1
  220. package/_esm/zksync/actions/finalizeWithdrawal.js +5 -2
  221. package/_esm/zksync/actions/finalizeWithdrawal.js.map +1 -1
  222. package/_esm/zksync/actions/isWithdrawalFinalized.js +5 -5
  223. package/_esm/zksync/actions/isWithdrawalFinalized.js.map +1 -1
  224. package/_types/account-abstraction/utils/formatters/userOperationReceipt.d.ts.map +1 -1
  225. package/_types/actions/public/estimateGas.d.ts.map +1 -1
  226. package/_types/actions/public/fillTransaction.d.ts.map +1 -1
  227. package/_types/actions/public/getFilterChanges.d.ts.map +1 -1
  228. package/_types/actions/public/getFilterLogs.d.ts.map +1 -1
  229. package/_types/actions/public/watchBlockNumber.d.ts +6 -2
  230. package/_types/actions/public/watchBlockNumber.d.ts.map +1 -1
  231. package/_types/actions/public/watchBlocks.d.ts +7 -2
  232. package/_types/actions/public/watchBlocks.d.ts.map +1 -1
  233. package/_types/actions/public/watchContractEvent.d.ts.map +1 -1
  234. package/_types/actions/public/watchEvent.d.ts.map +1 -1
  235. package/_types/actions/wallet/prepareTransactionRequest.d.ts.map +1 -1
  236. package/_types/actions/wallet/sendTransaction.d.ts.map +1 -1
  237. package/_types/actions/wallet/sendTransactionSync.d.ts.map +1 -1
  238. package/_types/chains/definitions/hashKeyChain.d.ts +4 -4
  239. package/_types/chains/definitions/hashkeyChainTestnet.d.ts +4 -4
  240. package/_types/chains/definitions/turkchain.d.ts +53 -0
  241. package/_types/chains/definitions/turkchain.d.ts.map +1 -0
  242. package/_types/chains/definitions/zksync.d.ts +1 -1
  243. package/_types/chains/index.d.ts +1 -0
  244. package/_types/chains/index.d.ts.map +1 -1
  245. package/_types/clients/createClient.d.ts +6 -0
  246. package/_types/clients/createClient.d.ts.map +1 -1
  247. package/_types/clients/transports/fallback.d.ts.map +1 -1
  248. package/_types/errors/node.d.ts.map +1 -1
  249. package/_types/errors/typedData.d.ts.map +1 -1
  250. package/_types/errors/version.d.ts +1 -1
  251. package/_types/index.d.ts +1 -1
  252. package/_types/index.d.ts.map +1 -1
  253. package/_types/tempo/Account.d.ts +77 -4
  254. package/_types/tempo/Account.d.ts.map +1 -1
  255. package/_types/tempo/Gateway.d.ts +337 -0
  256. package/_types/tempo/Gateway.d.ts.map +1 -0
  257. package/_types/tempo/GatewayDecorator.d.ts +635 -0
  258. package/_types/tempo/GatewayDecorator.d.ts.map +1 -0
  259. package/_types/tempo/Relay.d.ts +1 -1
  260. package/_types/tempo/Relay.d.ts.map +1 -1
  261. package/_types/tempo/Transaction.d.ts +2 -0
  262. package/_types/tempo/Transaction.d.ts.map +1 -1
  263. package/_types/tempo/actions/ai.d.ts +145 -0
  264. package/_types/tempo/actions/ai.d.ts.map +1 -0
  265. package/_types/tempo/actions/bucket.d.ts +210 -0
  266. package/_types/tempo/actions/bucket.d.ts.map +1 -0
  267. package/_types/tempo/actions/compute.d.ts +628 -0
  268. package/_types/tempo/actions/compute.d.ts.map +1 -0
  269. package/_types/tempo/actions/gateway.d.ts +25 -0
  270. package/_types/tempo/actions/gateway.d.ts.map +1 -0
  271. package/_types/tempo/actions/index.d.ts +10 -0
  272. package/_types/tempo/actions/index.d.ts.map +1 -1
  273. package/_types/tempo/actions/kv.d.ts +167 -0
  274. package/_types/tempo/actions/kv.d.ts.map +1 -0
  275. package/_types/tempo/chainConfig.d.ts.map +1 -1
  276. package/_types/tempo/index.d.ts +11 -0
  277. package/_types/tempo/index.d.ts.map +1 -1
  278. package/_types/tempo/internal/ndjson.d.ts +9 -0
  279. package/_types/tempo/internal/ndjson.d.ts.map +1 -0
  280. package/_types/tempo/internal/relay/feePayer.d.ts.map +1 -1
  281. package/_types/tempo/internal/relay/utils.d.ts +8 -8
  282. package/_types/utils/abi/decodeEventLog.d.ts +13 -1
  283. package/_types/utils/abi/decodeEventLog.d.ts.map +1 -1
  284. package/_types/utils/abi/getAbiItem.d.ts.map +1 -1
  285. package/_types/utils/abi/parseEventLogs.d.ts.map +1 -1
  286. package/_types/utils/authorization/recoverAuthorizationAddress.d.ts +2 -1
  287. package/_types/utils/authorization/recoverAuthorizationAddress.d.ts.map +1 -1
  288. package/_types/utils/authorization/verifyAuthorization.d.ts.map +1 -1
  289. package/_types/utils/buildRequest.d.ts.map +1 -1
  290. package/_types/utils/ccip.d.ts +24 -4
  291. package/_types/utils/ccip.d.ts.map +1 -1
  292. package/_types/utils/ccipTunnel.d.ts.map +1 -1
  293. package/_types/utils/ens/localBatchGatewayRequest.d.ts +26 -0
  294. package/_types/utils/ens/localBatchGatewayRequest.d.ts.map +1 -1
  295. package/_types/utils/hash/toSignatureHash.d.ts +1 -1
  296. package/_types/utils/hash/toSignatureHash.d.ts.map +1 -1
  297. package/_types/utils/internal/http.d.ts +16 -0
  298. package/_types/utils/internal/http.d.ts.map +1 -0
  299. package/_types/utils/nonceManager.d.ts +15 -1
  300. package/_types/utils/nonceManager.d.ts.map +1 -1
  301. package/_types/utils/rpc/http.d.ts.map +1 -1
  302. package/_types/utils/rpc/socket.d.ts.map +1 -1
  303. package/_types/utils/transaction/parseTransaction.d.ts.map +1 -1
  304. package/_types/utils/typedData.d.ts.map +1 -1
  305. package/account-abstraction/utils/formatters/userOperationReceipt.ts +1 -0
  306. package/actions/public/estimateGas.ts +12 -5
  307. package/actions/public/fillTransaction.ts +2 -0
  308. package/actions/public/getFilterChanges.ts +1 -0
  309. package/actions/public/getFilterLogs.ts +1 -0
  310. package/actions/public/watchBlockNumber.ts +11 -2
  311. package/actions/public/watchBlocks.ts +46 -14
  312. package/actions/public/watchContractEvent.ts +22 -4
  313. package/actions/public/watchEvent.ts +17 -1
  314. package/actions/wallet/prepareTransactionRequest.ts +6 -2
  315. package/actions/wallet/sendTransaction.ts +9 -3
  316. package/actions/wallet/sendTransactionSync.ts +74 -12
  317. package/chains/definitions/hashKeyChain.ts +4 -4
  318. package/chains/definitions/hashkeyChainTestnet.ts +4 -4
  319. package/chains/definitions/turkchain.ts +23 -0
  320. package/chains/definitions/zksync.ts +1 -1
  321. package/chains/index.ts +1 -0
  322. package/clients/createClient.ts +6 -0
  323. package/clients/transports/fallback.ts +11 -0
  324. package/errors/node.ts +11 -5
  325. package/errors/typedData.ts +5 -2
  326. package/errors/version.ts +1 -1
  327. package/index.ts +2 -0
  328. package/package.json +5 -1
  329. package/tempo/Account.ts +202 -16
  330. package/tempo/Gateway.ts +477 -0
  331. package/tempo/GatewayDecorator.ts +909 -0
  332. package/tempo/Relay.ts +1 -1
  333. package/tempo/Transaction.ts +3 -0
  334. package/tempo/actions/ai.ts +250 -0
  335. package/tempo/actions/bucket.ts +324 -0
  336. package/tempo/actions/compute.ts +894 -0
  337. package/tempo/actions/gateway.ts +33 -0
  338. package/tempo/actions/index.ts +10 -0
  339. package/tempo/actions/kv.ts +229 -0
  340. package/tempo/chainConfig.ts +13 -15
  341. package/tempo/index.ts +12 -0
  342. package/tempo/internal/ndjson.ts +51 -0
  343. package/tempo/internal/relay/feePayer.ts +30 -7
  344. package/utils/abi/decodeEventLog.ts +97 -10
  345. package/utils/abi/getAbiItem.ts +35 -5
  346. package/utils/abi/parseEventLogs.ts +48 -11
  347. package/utils/authorization/recoverAuthorizationAddress.ts +18 -2
  348. package/utils/authorization/verifyAuthorization.ts +12 -7
  349. package/utils/buildRequest.ts +4 -0
  350. package/utils/ccip.ts +199 -33
  351. package/utils/ccipTunnel.ts +5 -1
  352. package/utils/ens/localBatchGatewayRequest.ts +82 -4
  353. package/utils/hash/toSignatureHash.ts +12 -2
  354. package/utils/internal/http.ts +92 -0
  355. package/utils/nonceManager.ts +16 -1
  356. package/utils/rpc/http.ts +12 -86
  357. package/utils/rpc/socket.ts +28 -15
  358. package/utils/transaction/assertRequest.ts +2 -2
  359. package/utils/transaction/assertTransaction.ts +2 -2
  360. package/utils/transaction/parseTransaction.ts +32 -7
  361. package/utils/typedData.ts +31 -8
  362. package/zksync/actions/finalizeWithdrawal.ts +5 -2
  363. package/zksync/actions/isWithdrawalFinalized.ts +5 -5
@@ -0,0 +1,23 @@
1
+ import { defineChain } from '../../utils/chain/defineChain.js'
2
+
3
+ export const turkchain = /*#__PURE__*/ defineChain({
4
+ id: 1919,
5
+ name: 'Turkchain',
6
+ nativeCurrency: {
7
+ decimals: 18,
8
+ name: 'TC',
9
+ symbol: 'TURK',
10
+ },
11
+ rpcUrls: {
12
+ default: {
13
+ http: ['https://rpc.turkscan.com'],
14
+ webSocket: ['wss://evm-ws.turkscan.com'],
15
+ },
16
+ },
17
+ blockExplorers: {
18
+ default: {
19
+ name: 'TurkScan',
20
+ url: 'https://turkscan.com',
21
+ },
22
+ },
23
+ })
@@ -21,7 +21,7 @@ export const zksync = /*#__PURE__*/ defineChain({
21
21
  blockExplorers: {
22
22
  default: {
23
23
  name: 'ZKsync Explorer',
24
- url: 'https://explorer.zksync.io/',
24
+ url: 'https://explorer.zksync.io',
25
25
  apiUrl: 'https://block-explorer-api.mainnet.zksync.io/api',
26
26
  },
27
27
  },
package/chains/index.ts CHANGED
@@ -689,6 +689,7 @@ export { treasureTopaz } from './definitions/treasureTopaz.js'
689
689
  export { tron } from './definitions/tron.js'
690
690
  export { tronNile } from './definitions/tronNile.js'
691
691
  export { tronShasta } from './definitions/tronShasta.js'
692
+ export { turkchain } from './definitions/turkchain.js'
692
693
  export { ubiq } from './definitions/ubiq.js'
693
694
  export { ultra } from './definitions/ultra.js'
694
695
  export { ultraTestnet } from './definitions/ultraTestnet.js'
@@ -62,6 +62,12 @@ export type ClientConfig<
62
62
  /**
63
63
  * [CCIP Read](https://eips.ethereum.org/EIPS/eip-3668) configuration.
64
64
  * If `false`, the client will not support offchain CCIP lookups.
65
+ *
66
+ * Gateway URLs must be HTTP(S). A lookup follows at most 4 nested callbacks
67
+ * and 4 nested local batches, and makes at most 256 gateway requests to
68
+ * contract-chosen URLs, 16 at a time. Each gateway request, including the
69
+ * response body, uses the transport timeout (default 10 seconds; the longest
70
+ * of a `fallback`'s transports) and reads at most 10 MiB.
65
71
  */
66
72
  ccipRead?:
67
73
  | {
@@ -1,3 +1,4 @@
1
+ import { BaseError } from '../../errors/base.js'
1
2
  import { ExecutionRevertedError } from '../../errors/node.js'
2
3
  import {
3
4
  TransactionRejectedRpcError,
@@ -164,6 +165,16 @@ export function fallback<const transports extends readonly Transport[]>(
164
165
 
165
166
  if (shouldThrow_(err as Error)) throw err
166
167
 
168
+ // The node accepted the transaction but stopped waiting for its
169
+ // receipt (EIP-7966), so do not send it to the next one. Custom
170
+ // transports wrap the provider's error, so check the causes too.
171
+ if (
172
+ method === 'eth_sendRawTransactionSync' &&
173
+ err instanceof BaseError &&
174
+ err.walk((e) => (e as { code?: unknown } | null)?.code === 4)
175
+ )
176
+ throw err
177
+
167
178
  // If we've reached the end of the fallbacks, throw the error.
168
179
  if (i === transports.length - 1) throw err
169
180
 
package/errors/node.ts CHANGED
@@ -53,7 +53,9 @@ export class FeeCapTooHighError extends BaseError {
53
53
  } = {}) {
54
54
  super(
55
55
  `The fee cap (\`maxFeePerGas\`${
56
- maxFeePerGas ? ` = ${formatGwei(maxFeePerGas)} gwei` : ''
56
+ typeof maxFeePerGas === 'bigint'
57
+ ? ` = ${formatGwei(maxFeePerGas)} gwei`
58
+ : ''
57
59
  }) cannot be higher than the maximum allowed value (2^256-1).`,
58
60
  {
59
61
  cause,
@@ -78,8 +80,10 @@ export class FeeCapTooLowError extends BaseError {
78
80
  } = {}) {
79
81
  super(
80
82
  `The fee cap (\`maxFeePerGas\`${
81
- maxFeePerGas ? ` = ${formatGwei(maxFeePerGas)}` : ''
82
- } gwei) cannot be lower than the block base fee.`,
83
+ typeof maxFeePerGas === 'bigint'
84
+ ? ` = ${formatGwei(maxFeePerGas)} gwei`
85
+ : ''
86
+ }) cannot be lower than the block base fee.`,
83
87
  {
84
88
  cause,
85
89
  name: 'FeeCapTooLowError',
@@ -249,11 +253,13 @@ export class TipAboveFeeCapError extends BaseError {
249
253
  super(
250
254
  [
251
255
  `The provided tip (\`maxPriorityFeePerGas\`${
252
- maxPriorityFeePerGas
256
+ typeof maxPriorityFeePerGas === 'bigint'
253
257
  ? ` = ${formatGwei(maxPriorityFeePerGas)} gwei`
254
258
  : ''
255
259
  }) cannot be higher than the fee cap (\`maxFeePerGas\`${
256
- maxFeePerGas ? ` = ${formatGwei(maxFeePerGas)} gwei` : ''
260
+ typeof maxFeePerGas === 'bigint'
261
+ ? ` = ${formatGwei(maxFeePerGas)} gwei`
262
+ : ''
257
263
  }).`,
258
264
  ].join('\n'),
259
265
  {
@@ -51,9 +51,12 @@ export type InvalidTypedDataTypeErrorType = InvalidTypedDataTypeError & {
51
51
  }
52
52
  export class InvalidTypedDataTypeError extends BaseError {
53
53
  constructor({ type }: { type: string }) {
54
- const canonicalType = type.replace(/^(u?int)/, '$&256')
54
+ // Suggest the canonical type only for the `int`/`uint` aliases.
55
+ const isAlias = /^u?int(\[[0-9]*\])*$/.test(type)
55
56
  super(`Type "${type}" is not a valid EIP-712 type.`, {
56
- metaMessages: [`Use "${canonicalType}" instead.`],
57
+ metaMessages: isAlias
58
+ ? [`Use "${type.replace(/^(u?int)/, '$&256')}" instead.`]
59
+ : undefined,
57
60
  name: 'InvalidTypedDataTypeError',
58
61
  })
59
62
  }
package/errors/version.ts CHANGED
@@ -1 +1 @@
1
- export const version = '2.57.14'
1
+ export const version = '2.57.16'
package/index.ts CHANGED
@@ -1350,6 +1350,8 @@ export {
1350
1350
  decodeErrorResult,
1351
1351
  } from './utils/abi/decodeErrorResult.js'
1352
1352
  export {
1353
+ AbiEventAmbiguityError,
1354
+ type AbiEventAmbiguityErrorType,
1353
1355
  type DecodeEventLogErrorType,
1354
1356
  type DecodeEventLogParameters,
1355
1357
  type DecodeEventLogReturnType,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "viem",
3
3
  "description": "TypeScript Interface for Ethereum",
4
- "version": "2.57.14",
4
+ "version": "2.57.16",
5
5
  "main": "./_cjs/index.js",
6
6
  "module": "./_esm/index.js",
7
7
  "types": "./_types/index.d.ts",
@@ -215,9 +215,13 @@
215
215
  }
216
216
  },
217
217
  "peerDependencies": {
218
+ "mppx": ">=0.17.0",
218
219
  "typescript": ">=5.0.4"
219
220
  },
220
221
  "peerDependenciesMeta": {
222
+ "mppx": {
223
+ "optional": true
224
+ },
221
225
  "typescript": {
222
226
  "optional": true
223
227
  }
package/tempo/Account.ts CHANGED
@@ -17,6 +17,7 @@ import type {
17
17
  Account as viem_Account,
18
18
  } from '../accounts/types.js'
19
19
  import { parseAccount } from '../accounts/utils/parseAccount.js'
20
+ import { BaseError } from '../errors/base.js'
20
21
  import type { TransactionSerializable } from '../types/transaction.js'
21
22
  import type { OneOf, RequiredBy } from '../types/utils.js'
22
23
  import { hashAuthorization } from '../utils/authorization/hashAuthorization.js'
@@ -93,6 +94,73 @@ export type AccessKeyAccount = Account_base<'accessKey'> & {
93
94
 
94
95
  export type Account = OneOf<RootAccount | AccessKeyAccount>
95
96
 
97
+ /**
98
+ * Rebuilds a configurable account (TIP-1107) from the value of {@link serialize},
99
+ * such as one read from storage, without a request.
100
+ *
101
+ * Passkeys among `credentials` sign as owners when their public key derives an
102
+ * owner's address; others are ignored. A version-zero config must derive
103
+ * `address`, and a later version keeps `address`.
104
+ *
105
+ * @example
106
+ * ```ts
107
+ * import { Account } from 'viem/tempo'
108
+ *
109
+ * const account = Account.deserialize(JSON.parse(localStorage.getItem('account')!), {
110
+ * credentials: [credential],
111
+ * })
112
+ * ```
113
+ *
114
+ * @param value Serialized account.
115
+ * @param options Options.
116
+ * @returns Configurable account.
117
+ */
118
+ export function deserialize(
119
+ value: Serialized,
120
+ options: deserialize.Options = {},
121
+ ): ConfigurableAccount {
122
+ const { address, config } = value
123
+ const { credentials = [], getFn } = options
124
+ if (!config) return fromConfig(address)
125
+
126
+ const owners = config.owners.map(({ owner, weight }) => {
127
+ const credential = credentials.find((credential) =>
128
+ Address.isEqual(
129
+ Address.fromPublicKey(PublicKey.fromHex(credential.publicKey)),
130
+ owner,
131
+ ),
132
+ )
133
+ if (!credential) return { owner, weight }
134
+ const { rpId } = credential
135
+ return { owner: fromWebAuthnP256(credential, { getFn, rpId }), weight }
136
+ })
137
+ const { salt, threshold } = config
138
+ const version = BigInt(config.version)
139
+ const account =
140
+ version === 0n
141
+ ? fromConfig({ owners, salt, threshold })
142
+ : fromConfig({ address, owners, salt, threshold, version })
143
+ if (!Address.isEqual(account.address, address))
144
+ throw new AddressMismatchError({ address, derived: account.address })
145
+ return account
146
+ }
147
+
148
+ export declare namespace deserialize {
149
+ export type Credential = fromWebAuthnP256.Credential & {
150
+ /** Relying party ID of the passkey, such as `example.com`. */
151
+ rpId?: string | undefined
152
+ }
153
+
154
+ export type Options = {
155
+ /** Passkeys that may hold owner keys of the account. */
156
+ credentials?: readonly Credential[] | undefined
157
+ /** Runs a passkey owner's ceremony in place of `navigator.credentials.get`. */
158
+ getFn?: fromWebAuthnP256.Options['getFn'] | undefined
159
+ }
160
+
161
+ export type ErrorType = AddressMismatchError | Error
162
+ }
163
+
96
164
  /** Instantiates an Account. */
97
165
  export function from<const parameters extends from.Parameters>(
98
166
  parameters: parameters | from.Parameters,
@@ -137,13 +205,19 @@ export function fromHeadlessWebAuthn<
137
205
  privateKey: Hex.Hex,
138
206
  options: options | fromHeadlessWebAuthn.Options,
139
207
  ): fromHeadlessWebAuthn.ReturnValue<options> {
140
- const { access, keyAuthorizationManager, rpId, origin, internal_version } =
141
- options
208
+ const {
209
+ access,
210
+ keyAuthorization,
211
+ keyAuthorizationManager,
212
+ rpId,
213
+ origin,
214
+ internal_version,
215
+ } = options
142
216
 
143
217
  const publicKey = P256.getPublicKey({ privateKey })
144
218
 
145
219
  return from({
146
- ...(access ? { access, keyAuthorizationManager } : {}),
220
+ ...(access ? { access, keyAuthorization, keyAuthorizationManager } : {}),
147
221
  internal_version,
148
222
  keyType: 'webAuthn',
149
223
  publicKey,
@@ -176,7 +250,10 @@ export declare namespace fromHeadlessWebAuthn {
176
250
  > &
177
251
  Pick<
178
252
  from.Parameters,
179
- 'access' | 'internal_version' | 'keyAuthorizationManager'
253
+ | 'access'
254
+ | 'internal_version'
255
+ | 'keyAuthorization'
256
+ | 'keyAuthorizationManager'
180
257
  > & {
181
258
  rpId: string
182
259
  origin: string
@@ -203,11 +280,16 @@ export function fromP256<const options extends fromP256.Options>(
203
280
  privateKey: Hex.Hex,
204
281
  options: options | fromP256.Options = {},
205
282
  ): fromP256.ReturnValue<options> {
206
- const { access, keyAuthorizationManager, internal_version } = options
283
+ const {
284
+ access,
285
+ keyAuthorization,
286
+ keyAuthorizationManager,
287
+ internal_version,
288
+ } = options
207
289
  const publicKey = P256.getPublicKey({ privateKey })
208
290
 
209
291
  return from({
210
- ...(access ? { access, keyAuthorizationManager } : {}),
292
+ ...(access ? { access, keyAuthorization, keyAuthorizationManager } : {}),
211
293
  internal_version,
212
294
  keyType: 'p256',
213
295
  publicKey,
@@ -225,7 +307,10 @@ export function fromP256<const options extends fromP256.Options>(
225
307
  export declare namespace fromP256 {
226
308
  export type Options = Pick<
227
309
  from.Parameters,
228
- 'access' | 'internal_version' | 'keyAuthorizationManager'
310
+ | 'access'
311
+ | 'internal_version'
312
+ | 'keyAuthorization'
313
+ | 'keyAuthorizationManager'
229
314
  >
230
315
 
231
316
  export type ReturnValue<options extends Options = Options> =
@@ -249,11 +334,16 @@ export function fromSecp256k1<const options extends fromSecp256k1.Options>(
249
334
  privateKey: Hex.Hex,
250
335
  options: options | fromSecp256k1.Options = {},
251
336
  ): fromSecp256k1.ReturnValue<options> {
252
- const { access, keyAuthorizationManager, internal_version } = options
337
+ const {
338
+ access,
339
+ keyAuthorization,
340
+ keyAuthorizationManager,
341
+ internal_version,
342
+ } = options
253
343
  const publicKey = Secp256k1.getPublicKey({ privateKey })
254
344
 
255
345
  return from({
256
- ...(access ? { access, keyAuthorizationManager } : {}),
346
+ ...(access ? { access, keyAuthorization, keyAuthorizationManager } : {}),
257
347
  internal_version,
258
348
  keyType: 'secp256k1',
259
349
  publicKey,
@@ -268,7 +358,10 @@ export function fromSecp256k1<const options extends fromSecp256k1.Options>(
268
358
  export declare namespace fromSecp256k1 {
269
359
  export type Options = Pick<
270
360
  from.Parameters,
271
- 'access' | 'internal_version' | 'keyAuthorizationManager'
361
+ | 'access'
362
+ | 'internal_version'
363
+ | 'keyAuthorization'
364
+ | 'keyAuthorizationManager'
272
365
  >
273
366
 
274
367
  export type ReturnValue<options extends Options = Options> =
@@ -745,11 +838,16 @@ export function fromWebCryptoP256<
745
838
  keyPair: Awaited<ReturnType<typeof WebCryptoP256.createKeyPair>>,
746
839
  options: options | fromWebCryptoP256.Options = {},
747
840
  ): fromWebCryptoP256.ReturnValue<options> {
748
- const { access, keyAuthorizationManager, internal_version } = options
841
+ const {
842
+ access,
843
+ keyAuthorization,
844
+ keyAuthorizationManager,
845
+ internal_version,
846
+ } = options
749
847
  const { publicKey, privateKey } = keyPair
750
848
 
751
849
  return from({
752
- ...(access ? { access, keyAuthorizationManager } : {}),
850
+ ...(access ? { access, keyAuthorization, keyAuthorizationManager } : {}),
753
851
  internal_version,
754
852
  keyType: 'p256',
755
853
  publicKey,
@@ -768,7 +866,10 @@ export function fromWebCryptoP256<
768
866
  export declare namespace fromWebCryptoP256 {
769
867
  export type Options = Pick<
770
868
  from.Parameters,
771
- 'access' | 'internal_version' | 'keyAuthorizationManager'
869
+ | 'access'
870
+ | 'internal_version'
871
+ | 'keyAuthorization'
872
+ | 'keyAuthorizationManager'
772
873
  >
773
874
 
774
875
  export type ReturnValue<options extends Options = Options> =
@@ -1114,17 +1215,52 @@ declare namespace fromRoot {
1114
1215
 
1115
1216
  // biome-ignore lint/correctness/noUnusedVariables: _
1116
1217
  function fromAccessKey(parameters: fromAccessKey.Parameters): AccessKeyAccount {
1117
- const { access, keyAuthorizationManager } = parameters
1218
+ const { access, keyAuthorization } = parameters
1118
1219
  const { address: parentAddress } = parseAccount(access)
1119
- const account = fromBase({ ...parameters, parentAddress })
1220
+ const accessKeyAddress = Address.fromPublicKey(parameters.publicKey)
1221
+ if (
1222
+ keyAuthorization &&
1223
+ !Address.isEqual(keyAuthorization.address, accessKeyAddress)
1224
+ )
1225
+ throw new Error('Key authorization does not authorize this access key.')
1226
+ const keyAuthorizationManager =
1227
+ parameters.keyAuthorizationManager ??
1228
+ (keyAuthorization ? pending(keyAuthorization) : undefined)
1229
+ const account = fromBase({
1230
+ ...parameters,
1231
+ keyAuthorizationManager,
1232
+ parentAddress,
1233
+ })
1120
1234
  return {
1121
1235
  ...account,
1122
- accessKeyAddress: Address.fromPublicKey(parameters.publicKey),
1236
+ accessKeyAddress,
1123
1237
  keyAuthorizationManager,
1124
1238
  source: 'accessKey',
1125
1239
  }
1126
1240
  }
1127
1241
 
1242
+ /**
1243
+ * Returns a key authorization manager that holds `keyAuthorization` until the
1244
+ * chain registers its access key.
1245
+ */
1246
+ function pending(
1247
+ keyAuthorization: KeyAuthorization.Signed,
1248
+ ): KeyAuthorizationManager {
1249
+ let value: KeyAuthorization.Signed | undefined = keyAuthorization
1250
+ const matches = (key: { accessKey: Address.Address; chainId: number }) =>
1251
+ Address.isEqual(key.accessKey, keyAuthorization.address) &&
1252
+ BigInt(key.chainId) === BigInt(keyAuthorization.chainId)
1253
+ return {
1254
+ get: (key) => (matches(key) ? value : undefined),
1255
+ remove(key) {
1256
+ if (matches(key)) value = undefined
1257
+ },
1258
+ set(key, next) {
1259
+ if (matches(key)) value = next
1260
+ },
1261
+ }
1262
+ }
1263
+
1128
1264
  declare namespace fromAccessKey {
1129
1265
  export type Parameters = fromBase.Parameters & {
1130
1266
  /**
@@ -1133,6 +1269,12 @@ declare namespace fromAccessKey {
1133
1269
  * the parent account's address as the keychain address.
1134
1270
  */
1135
1271
  access: viem_Account | Address.Address
1272
+ /**
1273
+ * Signed key authorization of the access key, which the account attaches
1274
+ * to its transactions until the chain registers the access key. Ignored
1275
+ * when `keyAuthorizationManager` is set.
1276
+ */
1277
+ keyAuthorization?: KeyAuthorization.Signed | undefined
1136
1278
  /** Pending key authorization manager. */
1137
1279
  keyAuthorizationManager?: KeyAuthorizationManager | undefined
1138
1280
  }
@@ -1190,6 +1332,50 @@ export declare namespace resolveAccessKey {
1190
1332
  }
1191
1333
  }
1192
1334
 
1335
+ /**
1336
+ * Returns a configurable account (TIP-1107) as JSON-safe public values: its
1337
+ * address and, when known, its config. {@link deserialize} rebuilds it.
1338
+ *
1339
+ * @example
1340
+ * ```ts
1341
+ * import { Account } from 'viem/tempo'
1342
+ *
1343
+ * localStorage.setItem('account', JSON.stringify(Account.serialize(account)))
1344
+ * ```
1345
+ *
1346
+ * @param account Configurable account.
1347
+ * @returns Serialized account.
1348
+ */
1349
+ export function serialize(account: ConfigurableAccount): Serialized {
1350
+ const { address, config } = account
1351
+ return {
1352
+ address,
1353
+ ...(config ? { config: AccountConfig.toRpc(config) } : {}),
1354
+ }
1355
+ }
1356
+
1357
+ /** Configurable account as JSON, which {@link serialize} returns and {@link deserialize} rebuilds. */
1358
+ export type Serialized = {
1359
+ /** Account address. */
1360
+ address: Address.Address
1361
+ /** Current config, in RPC format. Absent for an address-only account. */
1362
+ config?: AccountConfig.Rpc | undefined
1363
+ }
1364
+
1365
+ /** Thrown when a version-zero config does not derive the account's address. */
1366
+ export class AddressMismatchError extends BaseError {
1367
+ /** Address the config derives. */
1368
+ readonly derived: Address.Address
1369
+
1370
+ constructor(options: { address: Address.Address; derived: Address.Address }) {
1371
+ const { address, derived } = options
1372
+ super(`Account config derives ${derived}, not ${address}.`, {
1373
+ name: 'Account.AddressMismatchError',
1374
+ })
1375
+ this.derived = derived
1376
+ }
1377
+ }
1378
+
1193
1379
  // Export types required for inference.
1194
1380
  // biome-ignore lint/performance/noBarrelFile: _
1195
1381
  export {