viem 2.13.7 → 2.13.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (558) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/_cjs/accounts/hdKeyToAccount.js.map +1 -1
  3. package/_cjs/actions/public/call.js.map +1 -1
  4. package/_cjs/actions/public/estimateGas.js.map +1 -1
  5. package/_cjs/actions/public/getBlockNumber.js.map +1 -1
  6. package/_cjs/actions/wallet/prepareTransactionRequest.js.map +1 -1
  7. package/_cjs/actions/wallet/signTypedData.js.map +1 -1
  8. package/_cjs/celo/formatters.js +1 -2
  9. package/_cjs/celo/formatters.js.map +1 -1
  10. package/_cjs/celo/index.js.map +1 -1
  11. package/_cjs/celo/utils.js.map +1 -1
  12. package/_cjs/chains/definitions/ham.js +27 -0
  13. package/_cjs/chains/definitions/ham.js.map +1 -0
  14. package/_cjs/chains/definitions/kakarotSepolia.js +1 -1
  15. package/_cjs/chains/definitions/kakarotSepolia.js.map +1 -1
  16. package/_cjs/chains/definitions/optimism.js +5 -0
  17. package/_cjs/chains/definitions/optimism.js.map +1 -1
  18. package/_cjs/chains/definitions/redbellyTestnet.js +27 -0
  19. package/_cjs/chains/definitions/redbellyTestnet.js.map +1 -0
  20. package/_cjs/chains/definitions/sei.js +1 -0
  21. package/_cjs/chains/definitions/sei.js.map +1 -1
  22. package/_cjs/chains/definitions/xai.js +28 -0
  23. package/_cjs/chains/definitions/xai.js.map +1 -0
  24. package/_cjs/chains/definitions/xaiTestnet.js +22 -0
  25. package/_cjs/chains/definitions/xaiTestnet.js.map +1 -0
  26. package/_cjs/chains/index.js +12 -4
  27. package/_cjs/chains/index.js.map +1 -1
  28. package/_cjs/clients/createClient.js +2 -2
  29. package/_cjs/clients/createClient.js.map +1 -1
  30. package/_cjs/clients/decorators/public.js.map +1 -1
  31. package/_cjs/clients/decorators/wallet.js.map +1 -1
  32. package/_cjs/clients/transports/fallback.js.map +1 -1
  33. package/_cjs/clients/transports/http.js.map +1 -1
  34. package/_cjs/constants/abis.js.map +1 -1
  35. package/_cjs/constants/blob.js +4 -4
  36. package/_cjs/constants/blob.js.map +1 -1
  37. package/_cjs/constants/kzg.js +1 -3
  38. package/_cjs/constants/kzg.js.map +1 -1
  39. package/_cjs/errors/abi.js +1 -13
  40. package/_cjs/errors/abi.js.map +1 -1
  41. package/_cjs/errors/base.js +1 -1
  42. package/_cjs/errors/base.js.map +1 -1
  43. package/_cjs/errors/ccip.js.map +1 -1
  44. package/_cjs/errors/stateOverride.js.map +1 -1
  45. package/_cjs/errors/version.js +1 -1
  46. package/_cjs/experimental/eip5792/actions/getCapabilities.js +2 -2
  47. package/_cjs/experimental/eip5792/actions/getCapabilities.js.map +1 -1
  48. package/_cjs/experimental/eip5792/actions/sendCalls.js +2 -2
  49. package/_cjs/experimental/eip5792/actions/sendCalls.js.map +1 -1
  50. package/_cjs/index.js +6 -4
  51. package/_cjs/index.js.map +1 -1
  52. package/_cjs/node/trustedSetups.js +1 -2
  53. package/_cjs/node/trustedSetups.js.map +1 -1
  54. package/_cjs/op-stack/abis.js +1 -458
  55. package/_cjs/op-stack/abis.js.map +1 -1
  56. package/_cjs/op-stack/actions/buildProveWithdrawal.js.map +1 -1
  57. package/_cjs/op-stack/actions/estimateDepositTransactionGas.js +4 -3
  58. package/_cjs/op-stack/actions/estimateDepositTransactionGas.js.map +1 -1
  59. package/_cjs/op-stack/actions/estimateFinalizeWithdrawalGas.js +4 -3
  60. package/_cjs/op-stack/actions/estimateFinalizeWithdrawalGas.js.map +1 -1
  61. package/_cjs/op-stack/actions/estimateInitiateWithdrawalGas.js +4 -3
  62. package/_cjs/op-stack/actions/estimateInitiateWithdrawalGas.js.map +1 -1
  63. package/_cjs/op-stack/actions/estimateProveWithdrawalGas.js +4 -3
  64. package/_cjs/op-stack/actions/estimateProveWithdrawalGas.js.map +1 -1
  65. package/_cjs/op-stack/actions/getWithdrawalStatus.js.map +1 -1
  66. package/_cjs/op-stack/index.js +15 -2
  67. package/_cjs/op-stack/index.js.map +1 -1
  68. package/_cjs/utils/abi/decodeAbiParameters.js.map +1 -1
  69. package/_cjs/utils/abi/encodeAbiParameters.js.map +1 -1
  70. package/_cjs/utils/abi/encodeDeployData.js.map +1 -1
  71. package/_cjs/utils/abi/getAbiItem.js.map +1 -1
  72. package/_cjs/utils/address/getAddress.js +5 -5
  73. package/_cjs/utils/address/getAddress.js.map +1 -1
  74. package/_cjs/utils/address/isAddress.js.map +1 -1
  75. package/_cjs/utils/blob/toBlobs.js.map +1 -1
  76. package/_cjs/utils/buildRequest.js.map +1 -1
  77. package/_cjs/utils/ccip.js.map +1 -1
  78. package/_cjs/utils/cursor.js.map +1 -1
  79. package/_cjs/utils/encoding/fromRlp.js +1 -9
  80. package/_cjs/utils/encoding/fromRlp.js.map +1 -1
  81. package/_cjs/utils/ens/avatar/utils.js.map +1 -1
  82. package/_cjs/utils/ens/errors.js.map +1 -1
  83. package/_cjs/utils/observe.js.map +1 -1
  84. package/_cjs/utils/promise/createBatchScheduler.js.map +1 -1
  85. package/_cjs/utils/promise/withCache.js.map +1 -1
  86. package/_cjs/utils/promise/withTimeout.js.map +1 -1
  87. package/_cjs/utils/rpc/id.js +1 -2
  88. package/_cjs/utils/rpc/id.js.map +1 -1
  89. package/_cjs/utils/rpc/ipc.js.map +1 -1
  90. package/_cjs/utils/stateOverride.js.map +1 -1
  91. package/_cjs/utils/transaction/parseTransaction.js.map +1 -1
  92. package/_cjs/utils/transaction/serializeTransaction.js +8 -5
  93. package/_cjs/utils/transaction/serializeTransaction.js.map +1 -1
  94. package/_cjs/zksync/actions/deployContract.js.map +1 -1
  95. package/_cjs/zksync/actions/estimateGasL1ToL2.js +2 -2
  96. package/_cjs/zksync/actions/estimateGasL1ToL2.js.map +1 -1
  97. package/_cjs/zksync/actions/getAllBalances.js +2 -2
  98. package/_cjs/zksync/actions/getAllBalances.js.map +1 -1
  99. package/_cjs/zksync/actions/getL1Allowance.js +2 -2
  100. package/_cjs/zksync/actions/getL1Allowance.js.map +1 -1
  101. package/_cjs/zksync/actions/getL1Balance.js +2 -2
  102. package/_cjs/zksync/actions/getL1Balance.js.map +1 -1
  103. package/_cjs/zksync/actions/getL1TokenBalance.js +2 -2
  104. package/_cjs/zksync/actions/getL1TokenBalance.js.map +1 -1
  105. package/_cjs/zksync/actions/sendEip712Transaction.js +7 -7
  106. package/_cjs/zksync/actions/sendEip712Transaction.js.map +1 -1
  107. package/_cjs/zksync/actions/sendTransaction.js +4 -4
  108. package/_cjs/zksync/actions/sendTransaction.js.map +1 -1
  109. package/_cjs/zksync/constants/contract.js +1 -2
  110. package/_cjs/zksync/constants/contract.js.map +1 -1
  111. package/_cjs/zksync/decorators/eip712.js.map +1 -1
  112. package/_cjs/zksync/index.js.map +1 -1
  113. package/_cjs/zksync/serializers.js.map +1 -1
  114. package/_cjs/zksync/utils/abi/encodeDeployData.js.map +1 -1
  115. package/_cjs/zksync/utils/assertEip712Request.js.map +1 -1
  116. package/_cjs/zksync/utils/hashBytecode.js.map +1 -1
  117. package/_esm/accounts/hdKeyToAccount.js.map +1 -1
  118. package/_esm/actions/public/call.js +1 -0
  119. package/_esm/actions/public/call.js.map +1 -1
  120. package/_esm/actions/public/estimateGas.js.map +1 -1
  121. package/_esm/actions/public/getBlockNumber.js +2 -1
  122. package/_esm/actions/public/getBlockNumber.js.map +1 -1
  123. package/_esm/actions/test/sendUnsignedTransaction.js +2 -2
  124. package/_esm/actions/wallet/prepareTransactionRequest.js.map +1 -1
  125. package/_esm/actions/wallet/signTypedData.js.map +1 -1
  126. package/_esm/celo/formatters.js +1 -2
  127. package/_esm/celo/formatters.js.map +1 -1
  128. package/_esm/celo/index.js +1 -1
  129. package/_esm/celo/index.js.map +1 -1
  130. package/_esm/celo/utils.js +1 -0
  131. package/_esm/celo/utils.js.map +1 -1
  132. package/_esm/chains/definitions/ham.js +24 -0
  133. package/_esm/chains/definitions/ham.js.map +1 -0
  134. package/_esm/chains/definitions/kakarotSepolia.js +1 -1
  135. package/_esm/chains/definitions/kakarotSepolia.js.map +1 -1
  136. package/_esm/chains/definitions/optimism.js +5 -0
  137. package/_esm/chains/definitions/optimism.js.map +1 -1
  138. package/_esm/chains/definitions/redbellyTestnet.js +24 -0
  139. package/_esm/chains/definitions/redbellyTestnet.js.map +1 -0
  140. package/_esm/chains/definitions/sei.js +1 -0
  141. package/_esm/chains/definitions/sei.js.map +1 -1
  142. package/_esm/chains/definitions/xai.js +25 -0
  143. package/_esm/chains/definitions/xai.js.map +1 -0
  144. package/_esm/chains/definitions/xaiTestnet.js +19 -0
  145. package/_esm/chains/definitions/xaiTestnet.js.map +1 -0
  146. package/_esm/chains/index.js +4 -0
  147. package/_esm/chains/index.js.map +1 -1
  148. package/_esm/clients/createClient.js +1 -1
  149. package/_esm/clients/createClient.js.map +1 -1
  150. package/_esm/clients/decorators/public.js.map +1 -1
  151. package/_esm/clients/decorators/wallet.js.map +1 -1
  152. package/_esm/clients/transports/fallback.js +1 -0
  153. package/_esm/clients/transports/fallback.js.map +1 -1
  154. package/_esm/clients/transports/http.js.map +1 -1
  155. package/_esm/constants/abis.js +1 -0
  156. package/_esm/constants/abis.js.map +1 -1
  157. package/_esm/constants/blob.js +1 -1
  158. package/_esm/constants/blob.js.map +1 -1
  159. package/_esm/constants/kzg.js +0 -4
  160. package/_esm/constants/kzg.js.map +1 -1
  161. package/_esm/errors/abi.js +0 -11
  162. package/_esm/errors/abi.js.map +1 -1
  163. package/_esm/errors/base.js +1 -1
  164. package/_esm/errors/base.js.map +1 -1
  165. package/_esm/errors/ccip.js.map +1 -1
  166. package/_esm/errors/stateOverride.js +1 -0
  167. package/_esm/errors/stateOverride.js.map +1 -1
  168. package/_esm/errors/version.js +1 -1
  169. package/_esm/experimental/eip5792/actions/getCapabilities.js +1 -1
  170. package/_esm/experimental/eip5792/actions/getCapabilities.js.map +1 -1
  171. package/_esm/experimental/eip5792/actions/sendCalls.js +1 -1
  172. package/_esm/experimental/eip5792/actions/sendCalls.js.map +1 -1
  173. package/_esm/index.js +4 -3
  174. package/_esm/index.js.map +1 -1
  175. package/_esm/node/trustedSetups.js +0 -1
  176. package/_esm/node/trustedSetups.js.map +1 -1
  177. package/_esm/node/trustedSetups_cjs.js +0 -1
  178. package/_esm/node/trustedSetups_cjs.js.map +1 -1
  179. package/_esm/op-stack/abis.js +0 -457
  180. package/_esm/op-stack/abis.js.map +1 -1
  181. package/_esm/op-stack/actions/buildProveWithdrawal.js +1 -0
  182. package/_esm/op-stack/actions/buildProveWithdrawal.js.map +1 -1
  183. package/_esm/op-stack/actions/estimateDepositTransactionGas.js +7 -3
  184. package/_esm/op-stack/actions/estimateDepositTransactionGas.js.map +1 -1
  185. package/_esm/op-stack/actions/estimateFinalizeWithdrawalGas.js +7 -3
  186. package/_esm/op-stack/actions/estimateFinalizeWithdrawalGas.js.map +1 -1
  187. package/_esm/op-stack/actions/estimateInitiateWithdrawalGas.js +7 -3
  188. package/_esm/op-stack/actions/estimateInitiateWithdrawalGas.js.map +1 -1
  189. package/_esm/op-stack/actions/estimateProveWithdrawalGas.js +7 -3
  190. package/_esm/op-stack/actions/estimateProveWithdrawalGas.js.map +1 -1
  191. package/_esm/op-stack/actions/getWithdrawalStatus.js +1 -1
  192. package/_esm/op-stack/actions/getWithdrawalStatus.js.map +1 -1
  193. package/_esm/op-stack/index.js +0 -1
  194. package/_esm/op-stack/index.js.map +1 -1
  195. package/_esm/utils/abi/decodeAbiParameters.js +1 -1
  196. package/_esm/utils/abi/decodeAbiParameters.js.map +1 -1
  197. package/_esm/utils/abi/encodeAbiParameters.js.map +1 -1
  198. package/_esm/utils/abi/encodeDeployData.js.map +1 -1
  199. package/_esm/utils/abi/getAbiItem.js +3 -1
  200. package/_esm/utils/abi/getAbiItem.js.map +1 -1
  201. package/_esm/utils/address/getAddress.js +1 -1
  202. package/_esm/utils/address/getAddress.js.map +1 -1
  203. package/_esm/utils/address/isAddress.js +1 -0
  204. package/_esm/utils/address/isAddress.js.map +1 -1
  205. package/_esm/utils/blob/toBlobs.js.map +1 -1
  206. package/_esm/utils/buildRequest.js +1 -0
  207. package/_esm/utils/buildRequest.js.map +1 -1
  208. package/_esm/utils/ccip.js +1 -1
  209. package/_esm/utils/ccip.js.map +1 -1
  210. package/_esm/utils/cursor.js.map +1 -1
  211. package/_esm/utils/encoding/fromRlp.js +0 -6
  212. package/_esm/utils/encoding/fromRlp.js.map +1 -1
  213. package/_esm/utils/ens/avatar/utils.js +2 -0
  214. package/_esm/utils/ens/avatar/utils.js.map +1 -1
  215. package/_esm/utils/ens/errors.js.map +1 -1
  216. package/_esm/utils/observe.js +2 -0
  217. package/_esm/utils/observe.js.map +1 -1
  218. package/_esm/utils/promise/createBatchScheduler.js +1 -0
  219. package/_esm/utils/promise/createBatchScheduler.js.map +1 -1
  220. package/_esm/utils/promise/withCache.js +2 -0
  221. package/_esm/utils/promise/withCache.js.map +1 -1
  222. package/_esm/utils/promise/withTimeout.js +1 -1
  223. package/_esm/utils/promise/withTimeout.js.map +1 -1
  224. package/_esm/utils/rpc/id.js +1 -1
  225. package/_esm/utils/rpc/id.js.map +1 -1
  226. package/_esm/utils/rpc/ipc.js +1 -0
  227. package/_esm/utils/rpc/ipc.js.map +1 -1
  228. package/_esm/utils/stateOverride.js +3 -0
  229. package/_esm/utils/stateOverride.js.map +1 -1
  230. package/_esm/utils/transaction/parseTransaction.js.map +1 -1
  231. package/_esm/utils/transaction/serializeTransaction.js +8 -5
  232. package/_esm/utils/transaction/serializeTransaction.js.map +1 -1
  233. package/_esm/utils/unit/parseUnits.js +1 -1
  234. package/_esm/utils/unit/parseUnits.js.map +1 -1
  235. package/_esm/zksync/actions/deployContract.js +1 -1
  236. package/_esm/zksync/actions/deployContract.js.map +1 -1
  237. package/_esm/zksync/actions/estimateGasL1ToL2.js +1 -1
  238. package/_esm/zksync/actions/estimateGasL1ToL2.js.map +1 -1
  239. package/_esm/zksync/actions/getAllBalances.js +1 -1
  240. package/_esm/zksync/actions/getAllBalances.js.map +1 -1
  241. package/_esm/zksync/actions/getL1Allowance.js +1 -1
  242. package/_esm/zksync/actions/getL1Allowance.js.map +1 -1
  243. package/_esm/zksync/actions/getL1Balance.js +1 -1
  244. package/_esm/zksync/actions/getL1Balance.js.map +1 -1
  245. package/_esm/zksync/actions/getL1TokenBalance.js +2 -2
  246. package/_esm/zksync/actions/getL1TokenBalance.js.map +1 -1
  247. package/_esm/zksync/actions/sendEip712Transaction.js +7 -7
  248. package/_esm/zksync/actions/sendEip712Transaction.js.map +1 -1
  249. package/_esm/zksync/actions/sendTransaction.js +6 -6
  250. package/_esm/zksync/actions/sendTransaction.js.map +1 -1
  251. package/_esm/zksync/constants/contract.js +0 -1
  252. package/_esm/zksync/constants/contract.js.map +1 -1
  253. package/_esm/zksync/decorators/eip712.js.map +1 -1
  254. package/_esm/zksync/index.js.map +1 -1
  255. package/_esm/zksync/serializers.js.map +1 -1
  256. package/_esm/zksync/utils/abi/encodeDeployData.js +1 -1
  257. package/_esm/zksync/utils/abi/encodeDeployData.js.map +1 -1
  258. package/_esm/zksync/utils/assertEip712Request.js +1 -1
  259. package/_esm/zksync/utils/assertEip712Request.js.map +1 -1
  260. package/_esm/zksync/utils/hashBytecode.js.map +1 -1
  261. package/_types/accounts/hdKeyToAccount.d.ts +1 -1
  262. package/_types/accounts/hdKeyToAccount.d.ts.map +1 -1
  263. package/_types/accounts/types.d.ts +1 -1
  264. package/_types/accounts/types.d.ts.map +1 -1
  265. package/_types/actions/public/call.d.ts +5 -2
  266. package/_types/actions/public/call.d.ts.map +1 -1
  267. package/_types/actions/public/estimateGas.d.ts +2 -1
  268. package/_types/actions/public/estimateGas.d.ts.map +1 -1
  269. package/_types/actions/public/getBlockNumber.d.ts +4 -0
  270. package/_types/actions/public/getBlockNumber.d.ts.map +1 -1
  271. package/_types/actions/test/sendUnsignedTransaction.d.ts +2 -2
  272. package/_types/actions/wallet/prepareTransactionRequest.d.ts +0 -7
  273. package/_types/actions/wallet/prepareTransactionRequest.d.ts.map +1 -1
  274. package/_types/actions/wallet/signTypedData.d.ts +2 -2
  275. package/_types/actions/wallet/signTypedData.d.ts.map +1 -1
  276. package/_types/celo/chainConfig.d.ts +60 -60
  277. package/_types/celo/formatters.d.ts +30 -30
  278. package/_types/celo/formatters.d.ts.map +1 -1
  279. package/_types/celo/index.d.ts +2 -2
  280. package/_types/celo/index.d.ts.map +1 -1
  281. package/_types/celo/utils.d.ts +1 -0
  282. package/_types/celo/utils.d.ts.map +1 -1
  283. package/_types/chains/definitions/ancient8.d.ts +26 -26
  284. package/_types/chains/definitions/ancient8Sepolia.d.ts +26 -26
  285. package/_types/chains/definitions/base.d.ts +26 -26
  286. package/_types/chains/definitions/baseGoerli.d.ts +26 -26
  287. package/_types/chains/definitions/baseSepolia.d.ts +26 -26
  288. package/_types/chains/definitions/celo.d.ts +60 -60
  289. package/_types/chains/definitions/celoAlfajores.d.ts +60 -60
  290. package/_types/chains/definitions/fraxtal.d.ts +26 -26
  291. package/_types/chains/definitions/fraxtalTestnet.d.ts +26 -26
  292. package/_types/chains/definitions/funkiSepolia.d.ts +26 -26
  293. package/_types/chains/definitions/ham.d.ts +37 -0
  294. package/_types/chains/definitions/ham.d.ts.map +1 -0
  295. package/_types/chains/definitions/kakarotSepolia.d.ts +1 -1
  296. package/_types/chains/definitions/liskSepolia.d.ts +26 -26
  297. package/_types/chains/definitions/metalL2.d.ts +26 -26
  298. package/_types/chains/definitions/optimism.d.ts +31 -26
  299. package/_types/chains/definitions/optimism.d.ts.map +1 -1
  300. package/_types/chains/definitions/optimismGoerli.d.ts +26 -26
  301. package/_types/chains/definitions/optimismSepolia.d.ts +26 -26
  302. package/_types/chains/definitions/pgn.d.ts +26 -26
  303. package/_types/chains/definitions/pgnTestnet.d.ts +26 -26
  304. package/_types/chains/definitions/redbellyTestnet.d.ts +36 -0
  305. package/_types/chains/definitions/redbellyTestnet.d.ts.map +1 -0
  306. package/_types/chains/definitions/rss3.d.ts +26 -26
  307. package/_types/chains/definitions/rss3Sepolia.d.ts +26 -26
  308. package/_types/chains/definitions/sei.d.ts +1 -0
  309. package/_types/chains/definitions/sei.d.ts.map +1 -1
  310. package/_types/chains/definitions/xai.d.ts +33 -0
  311. package/_types/chains/definitions/xai.d.ts.map +1 -0
  312. package/_types/chains/definitions/xaiTestnet.d.ts +35 -0
  313. package/_types/chains/definitions/xaiTestnet.d.ts.map +1 -0
  314. package/_types/chains/definitions/zora.d.ts +26 -26
  315. package/_types/chains/definitions/zoraSepolia.d.ts +26 -26
  316. package/_types/chains/definitions/zoraTestnet.d.ts +26 -26
  317. package/_types/chains/index.d.ts +4 -0
  318. package/_types/chains/index.d.ts.map +1 -1
  319. package/_types/clients/createClient.d.ts +1 -1
  320. package/_types/clients/createClient.d.ts.map +1 -1
  321. package/_types/clients/transports/fallback.d.ts +1 -0
  322. package/_types/clients/transports/fallback.d.ts.map +1 -1
  323. package/_types/clients/transports/http.d.ts +6 -7
  324. package/_types/clients/transports/http.d.ts.map +1 -1
  325. package/_types/constants/abis.d.ts +1 -0
  326. package/_types/constants/abis.d.ts.map +1 -1
  327. package/_types/constants/blob.d.ts +0 -2
  328. package/_types/constants/blob.d.ts.map +1 -1
  329. package/_types/constants/kzg.d.ts +0 -4
  330. package/_types/constants/kzg.d.ts.map +1 -1
  331. package/_types/errors/abi.d.ts +0 -10
  332. package/_types/errors/abi.d.ts.map +1 -1
  333. package/_types/errors/base.d.ts +1 -0
  334. package/_types/errors/base.d.ts.map +1 -1
  335. package/_types/errors/ccip.d.ts +1 -0
  336. package/_types/errors/ccip.d.ts.map +1 -1
  337. package/_types/errors/stateOverride.d.ts +1 -0
  338. package/_types/errors/stateOverride.d.ts.map +1 -1
  339. package/_types/errors/version.d.ts +1 -1
  340. package/_types/experimental/eip5792/actions/getCapabilities.d.ts.map +1 -1
  341. package/_types/experimental/eip5792/actions/sendCalls.d.ts.map +1 -1
  342. package/_types/experimental/erc7715/types/permission.d.ts +5 -0
  343. package/_types/experimental/erc7715/types/permission.d.ts.map +1 -1
  344. package/_types/experimental/erc7715/types/signer.d.ts +3 -0
  345. package/_types/experimental/erc7715/types/signer.d.ts.map +1 -1
  346. package/_types/index.d.ts +9 -9
  347. package/_types/index.d.ts.map +1 -1
  348. package/_types/node/trustedSetups.d.ts +0 -1
  349. package/_types/node/trustedSetups.d.ts.map +1 -1
  350. package/_types/node/trustedSetups_cjs.d.ts +0 -1
  351. package/_types/node/trustedSetups_cjs.d.ts.map +1 -1
  352. package/_types/op-stack/abis.d.ts +0 -626
  353. package/_types/op-stack/abis.d.ts.map +1 -1
  354. package/_types/op-stack/actions/buildProveWithdrawal.d.ts +1 -0
  355. package/_types/op-stack/actions/buildProveWithdrawal.d.ts.map +1 -1
  356. package/_types/op-stack/actions/estimateDepositTransactionGas.d.ts +2 -2
  357. package/_types/op-stack/actions/estimateDepositTransactionGas.d.ts.map +1 -1
  358. package/_types/op-stack/actions/estimateFinalizeWithdrawalGas.d.ts +1 -1
  359. package/_types/op-stack/actions/estimateFinalizeWithdrawalGas.d.ts.map +1 -1
  360. package/_types/op-stack/actions/estimateInitiateWithdrawalGas.d.ts +1 -1
  361. package/_types/op-stack/actions/estimateInitiateWithdrawalGas.d.ts.map +1 -1
  362. package/_types/op-stack/actions/estimateProveWithdrawalGas.d.ts +1 -1
  363. package/_types/op-stack/actions/estimateProveWithdrawalGas.d.ts.map +1 -1
  364. package/_types/op-stack/actions/getWithdrawalStatus.d.ts +2 -1
  365. package/_types/op-stack/actions/getWithdrawalStatus.d.ts.map +1 -1
  366. package/_types/op-stack/chainConfig.d.ts +26 -26
  367. package/_types/op-stack/formatters.d.ts +26 -26
  368. package/_types/op-stack/index.d.ts.map +1 -1
  369. package/_types/types/account.d.ts +1 -1
  370. package/_types/types/account.d.ts.map +1 -1
  371. package/_types/types/chain.d.ts +7 -7
  372. package/_types/types/chain.d.ts.map +1 -1
  373. package/_types/types/kzg.d.ts +1 -1
  374. package/_types/types/kzg.d.ts.map +1 -1
  375. package/_types/types/proof.d.ts +3 -2
  376. package/_types/types/proof.d.ts.map +1 -1
  377. package/_types/types/utils.d.ts +11 -3
  378. package/_types/types/utils.d.ts.map +1 -1
  379. package/_types/utils/abi/decodeAbiParameters.d.ts +2 -1
  380. package/_types/utils/abi/decodeAbiParameters.d.ts.map +1 -1
  381. package/_types/utils/abi/encodeAbiParameters.d.ts +12 -11
  382. package/_types/utils/abi/encodeAbiParameters.d.ts.map +1 -1
  383. package/_types/utils/abi/encodeDeployData.d.ts +4 -2
  384. package/_types/utils/abi/encodeDeployData.d.ts.map +1 -1
  385. package/_types/utils/abi/getAbiItem.d.ts +6 -2
  386. package/_types/utils/abi/getAbiItem.d.ts.map +1 -1
  387. package/_types/utils/address/getAddress.d.ts +0 -2
  388. package/_types/utils/address/getAddress.d.ts.map +1 -1
  389. package/_types/utils/address/isAddress.d.ts +1 -0
  390. package/_types/utils/address/isAddress.d.ts.map +1 -1
  391. package/_types/utils/blob/toBlobs.d.ts +2 -1
  392. package/_types/utils/blob/toBlobs.d.ts.map +1 -1
  393. package/_types/utils/buildRequest.d.ts +1 -0
  394. package/_types/utils/buildRequest.d.ts.map +1 -1
  395. package/_types/utils/ccip.d.ts +4 -2
  396. package/_types/utils/ccip.d.ts.map +1 -1
  397. package/_types/utils/cursor.d.ts +7 -6
  398. package/_types/utils/cursor.d.ts.map +1 -1
  399. package/_types/utils/encoding/fromRlp.d.ts +3 -7
  400. package/_types/utils/encoding/fromRlp.d.ts.map +1 -1
  401. package/_types/utils/ens/avatar/parseAvatarRecord.d.ts +2 -1
  402. package/_types/utils/ens/avatar/parseAvatarRecord.d.ts.map +1 -1
  403. package/_types/utils/ens/avatar/utils.d.ts +4 -2
  404. package/_types/utils/ens/avatar/utils.d.ts.map +1 -1
  405. package/_types/utils/ens/errors.d.ts +1 -0
  406. package/_types/utils/ens/errors.d.ts.map +1 -1
  407. package/_types/utils/formatters/transaction.d.ts +1 -1
  408. package/_types/utils/formatters/transactionRequest.d.ts +1 -1
  409. package/_types/utils/hash/normalizeSignature.d.ts +3 -2
  410. package/_types/utils/hash/normalizeSignature.d.ts.map +1 -1
  411. package/_types/utils/observe.d.ts +2 -0
  412. package/_types/utils/observe.d.ts.map +1 -1
  413. package/_types/utils/promise/createBatchScheduler.d.ts +3 -2
  414. package/_types/utils/promise/createBatchScheduler.d.ts.map +1 -1
  415. package/_types/utils/promise/withCache.d.ts +4 -1
  416. package/_types/utils/promise/withCache.d.ts.map +1 -1
  417. package/_types/utils/rpc/id.d.ts +0 -5
  418. package/_types/utils/rpc/id.d.ts.map +1 -1
  419. package/_types/utils/rpc/ipc.d.ts +1 -0
  420. package/_types/utils/rpc/ipc.d.ts.map +1 -1
  421. package/_types/utils/stateOverride.d.ts +9 -5
  422. package/_types/utils/stateOverride.d.ts.map +1 -1
  423. package/_types/utils/transaction/parseTransaction.d.ts +5 -5
  424. package/_types/utils/transaction/parseTransaction.d.ts.map +1 -1
  425. package/_types/utils/transaction/serializeTransaction.d.ts +1 -1
  426. package/_types/utils/transaction/serializeTransaction.d.ts.map +1 -1
  427. package/_types/zksync/actions/deployContract.d.ts +2 -1
  428. package/_types/zksync/actions/deployContract.d.ts.map +1 -1
  429. package/_types/zksync/actions/estimateGasL1ToL2.d.ts.map +1 -1
  430. package/_types/zksync/actions/getAllBalances.d.ts.map +1 -1
  431. package/_types/zksync/actions/getL1Allowance.d.ts.map +1 -1
  432. package/_types/zksync/actions/getL1Balance.d.ts.map +1 -1
  433. package/_types/zksync/actions/getL1TokenBalance.d.ts +4 -4
  434. package/_types/zksync/actions/getL1TokenBalance.d.ts.map +1 -1
  435. package/_types/zksync/actions/sendEip712Transaction.d.ts +3 -3
  436. package/_types/zksync/actions/sendEip712Transaction.d.ts.map +1 -1
  437. package/_types/zksync/actions/sendTransaction.d.ts +5 -5
  438. package/_types/zksync/actions/sendTransaction.d.ts.map +1 -1
  439. package/_types/zksync/constants/contract.d.ts +0 -1
  440. package/_types/zksync/constants/contract.d.ts.map +1 -1
  441. package/_types/zksync/decorators/eip712.d.ts +2 -1
  442. package/_types/zksync/decorators/eip712.d.ts.map +1 -1
  443. package/_types/zksync/index.d.ts +1 -0
  444. package/_types/zksync/index.d.ts.map +1 -1
  445. package/_types/zksync/serializers.d.ts +1 -2
  446. package/_types/zksync/serializers.d.ts.map +1 -1
  447. package/_types/zksync/types/chain.d.ts +2 -2
  448. package/_types/zksync/types/chain.d.ts.map +1 -1
  449. package/_types/zksync/types/eip1193.d.ts +5 -5
  450. package/_types/zksync/types/eip1193.d.ts.map +1 -1
  451. package/_types/zksync/utils/abi/encodeDeployData.d.ts +5 -0
  452. package/_types/zksync/utils/abi/encodeDeployData.d.ts.map +1 -1
  453. package/_types/zksync/utils/assertEip712Request.d.ts +3 -1
  454. package/_types/zksync/utils/assertEip712Request.d.ts.map +1 -1
  455. package/_types/zksync/utils/hashBytecode.d.ts +5 -0
  456. package/_types/zksync/utils/hashBytecode.d.ts.map +1 -1
  457. package/accounts/hdKeyToAccount.ts +1 -2
  458. package/accounts/types.ts +1 -1
  459. package/actions/public/call.ts +5 -5
  460. package/actions/public/estimateGas.ts +3 -4
  461. package/actions/public/getBlockNumber.ts +9 -1
  462. package/actions/test/sendUnsignedTransaction.ts +2 -2
  463. package/actions/wallet/prepareTransactionRequest.ts +0 -20
  464. package/actions/wallet/signTypedData.ts +2 -0
  465. package/celo/formatters.ts +1 -3
  466. package/celo/index.ts +5 -2
  467. package/celo/utils.ts +1 -0
  468. package/chains/definitions/ham.ts +24 -0
  469. package/chains/definitions/kakarotSepolia.ts +1 -1
  470. package/chains/definitions/optimism.ts +5 -0
  471. package/chains/definitions/redbellyTestnet.ts +24 -0
  472. package/chains/definitions/sei.ts +1 -0
  473. package/chains/definitions/xai.ts +25 -0
  474. package/chains/definitions/xaiTestnet.ts +19 -0
  475. package/chains/index.ts +4 -0
  476. package/clients/createClient.ts +4 -2
  477. package/clients/decorators/public.ts +1 -1
  478. package/clients/decorators/wallet.ts +1 -1
  479. package/clients/transports/fallback.ts +1 -0
  480. package/clients/transports/http.ts +9 -8
  481. package/constants/abis.ts +1 -0
  482. package/constants/blob.ts +1 -1
  483. package/constants/kzg.ts +0 -6
  484. package/errors/abi.ts +0 -13
  485. package/errors/base.ts +2 -1
  486. package/errors/ccip.ts +1 -0
  487. package/errors/stateOverride.ts +1 -0
  488. package/errors/version.ts +1 -1
  489. package/experimental/eip5792/actions/getCapabilities.ts +1 -1
  490. package/experimental/eip5792/actions/sendCalls.ts +1 -1
  491. package/experimental/erc7715/types/permission.ts +5 -0
  492. package/experimental/erc7715/types/signer.ts +3 -0
  493. package/index.ts +21 -5
  494. package/node/trustedSetups.ts +0 -5
  495. package/node/trustedSetups_cjs.ts +0 -5
  496. package/op-stack/abis.ts +0 -458
  497. package/op-stack/actions/buildProveWithdrawal.ts +1 -0
  498. package/op-stack/actions/estimateDepositTransactionGas.ts +18 -7
  499. package/op-stack/actions/estimateFinalizeWithdrawalGas.ts +11 -4
  500. package/op-stack/actions/estimateInitiateWithdrawalGas.ts +11 -4
  501. package/op-stack/actions/estimateProveWithdrawalGas.ts +11 -4
  502. package/op-stack/actions/getWithdrawalStatus.ts +6 -1
  503. package/op-stack/index.ts +0 -1
  504. package/package.json +1 -1
  505. package/types/account.ts +1 -11
  506. package/types/chain.ts +7 -7
  507. package/types/kzg.ts +2 -1
  508. package/types/proof.ts +2 -2
  509. package/types/utils.ts +11 -3
  510. package/utils/abi/decodeAbiParameters.ts +6 -1
  511. package/utils/abi/encodeAbiParameters.ts +22 -19
  512. package/utils/abi/encodeDeployData.ts +6 -5
  513. package/utils/abi/getAbiItem.ts +8 -2
  514. package/utils/address/getAddress.ts +1 -1
  515. package/utils/address/isAddress.ts +1 -0
  516. package/utils/blob/toBlobs.ts +2 -1
  517. package/utils/buildRequest.ts +1 -0
  518. package/utils/ccip.ts +11 -3
  519. package/utils/cursor.ts +16 -6
  520. package/utils/encoding/fromRlp.ts +3 -21
  521. package/utils/ens/avatar/parseAvatarRecord.ts +1 -1
  522. package/utils/ens/avatar/utils.ts +4 -2
  523. package/utils/ens/errors.ts +1 -0
  524. package/utils/hash/normalizeSignature.ts +2 -2
  525. package/utils/observe.ts +2 -0
  526. package/utils/promise/createBatchScheduler.ts +3 -2
  527. package/utils/promise/withCache.ts +3 -1
  528. package/utils/promise/withTimeout.ts +2 -2
  529. package/utils/rpc/id.ts +1 -1
  530. package/utils/rpc/ipc.ts +1 -0
  531. package/utils/stateOverride.ts +8 -5
  532. package/utils/transaction/parseTransaction.ts +7 -2
  533. package/utils/transaction/serializeTransaction.ts +11 -5
  534. package/utils/unit/parseUnits.ts +1 -1
  535. package/zksync/actions/deployContract.ts +8 -2
  536. package/zksync/actions/estimateGasL1ToL2.ts +1 -1
  537. package/zksync/actions/getAllBalances.ts +1 -1
  538. package/zksync/actions/getL1Allowance.ts +1 -1
  539. package/zksync/actions/getL1Balance.ts +1 -1
  540. package/zksync/actions/getL1TokenBalance.ts +10 -7
  541. package/zksync/actions/sendEip712Transaction.ts +27 -16
  542. package/zksync/actions/sendTransaction.ts +34 -18
  543. package/zksync/constants/contract.ts +0 -1
  544. package/zksync/decorators/eip712.ts +7 -2
  545. package/zksync/index.ts +5 -0
  546. package/zksync/serializers.ts +1 -2
  547. package/zksync/types/chain.ts +9 -9
  548. package/zksync/types/eip1193.ts +32 -26
  549. package/zksync/utils/abi/encodeDeployData.ts +12 -2
  550. package/zksync/utils/assertEip712Request.ts +9 -2
  551. package/zksync/utils/hashBytecode.ts +14 -2
  552. package/_cjs/utils/accounts.js +0 -8
  553. package/_cjs/utils/accounts.js.map +0 -1
  554. package/_esm/utils/accounts.js +0 -7
  555. package/_esm/utils/accounts.js.map +0 -1
  556. package/_types/utils/accounts.d.ts +0 -3
  557. package/_types/utils/accounts.d.ts.map +0 -1
  558. package/utils/accounts.ts +0 -7
@@ -21,10 +21,11 @@ import type { StateMapping, StateOverride } from '../types/stateOverride.js'
21
21
  import { isAddress } from './address/isAddress.js'
22
22
  import { type NumberToHexErrorType, numberToHex } from './encoding/toHex.js'
23
23
 
24
- export type SerializeStateMappingParameters = StateMapping | undefined
24
+ type SerializeStateMappingParameters = StateMapping | undefined
25
25
 
26
- export type SerializeStateMappingErrorType = InvalidBytesLengthErrorType
26
+ type SerializeStateMappingErrorType = InvalidBytesLengthErrorType
27
27
 
28
+ /** @internal */
28
29
  export function serializeStateMapping(
29
30
  stateMapping: SerializeStateMappingParameters,
30
31
  ): RpcStateMapping | undefined {
@@ -47,16 +48,17 @@ export function serializeStateMapping(
47
48
  }, {} as RpcStateMapping)
48
49
  }
49
50
 
50
- export type SerializeAccountStateOverrideParameters = Omit<
51
+ type SerializeAccountStateOverrideParameters = Omit<
51
52
  StateOverride[number],
52
53
  'address'
53
54
  >
54
55
 
55
- export type SerializeAccountStateOverrideErrorType =
56
+ type SerializeAccountStateOverrideErrorType =
56
57
  | NumberToHexErrorType
57
58
  | StateAssignmentConflictErrorType
58
59
  | SerializeStateMappingErrorType
59
60
 
61
+ /** @internal */
60
62
  export function serializeAccountStateOverride(
61
63
  parameters: SerializeAccountStateOverrideParameters,
62
64
  ): RpcAccountStateOverride {
@@ -75,13 +77,14 @@ export function serializeAccountStateOverride(
75
77
  return rpcAccountStateOverride
76
78
  }
77
79
 
78
- export type SerializeStateOverrideParameters = StateOverride | undefined
80
+ type SerializeStateOverrideParameters = StateOverride | undefined
79
81
 
80
82
  export type SerializeStateOverrideErrorType =
81
83
  | InvalidAddressErrorType
82
84
  | AccountStateConflictErrorType
83
85
  | SerializeAccountStateOverrideErrorType
84
86
 
87
+ /** @internal */
85
88
  export function serializeStateOverride(
86
89
  parameters?: SerializeStateOverrideParameters,
87
90
  ): RpcStateOverride | undefined {
@@ -102,6 +102,7 @@ export function parseTransaction<
102
102
  }
103
103
 
104
104
  type ParseTransactionEIP4844ErrorType =
105
+ | ToTransactionArrayErrorType
105
106
  | AssertTransactionEIP4844ErrorType
106
107
  | ToTransactionArrayErrorType
107
108
  | HexToBigIntErrorType
@@ -204,6 +205,7 @@ function parseTransactionEIP4844(
204
205
  }
205
206
 
206
207
  type ParseTransactionEIP1559ErrorType =
208
+ | ToTransactionArrayErrorType
207
209
  | AssertTransactionEIP1559ErrorType
208
210
  | ToTransactionArrayErrorType
209
211
  | HexToBigIntErrorType
@@ -212,6 +214,7 @@ type ParseTransactionEIP1559ErrorType =
212
214
  | InvalidSerializedTransactionErrorType
213
215
  | IsHexErrorType
214
216
  | ParseEIP155SignatureErrorType
217
+ | ParseAccessListErrorType
215
218
  | ErrorType
216
219
 
217
220
  function parseTransactionEIP1559(
@@ -285,6 +288,7 @@ function parseTransactionEIP1559(
285
288
  }
286
289
 
287
290
  type ParseTransactionEIP2930ErrorType =
291
+ | ToTransactionArrayErrorType
288
292
  | AssertTransactionEIP2930ErrorType
289
293
  | ToTransactionArrayErrorType
290
294
  | HexToBigIntErrorType
@@ -293,6 +297,7 @@ type ParseTransactionEIP2930ErrorType =
293
297
  | InvalidSerializedTransactionErrorType
294
298
  | IsHexErrorType
295
299
  | ParseEIP155SignatureErrorType
300
+ | ParseAccessListErrorType
296
301
  | ErrorType
297
302
 
298
303
  function parseTransactionEIP2930(
@@ -430,13 +435,13 @@ function parseTransactionLegacy(
430
435
  return transaction
431
436
  }
432
437
 
433
- export type ToTransactionArrayErrorType = FromRlpErrorType | ErrorType
438
+ type ToTransactionArrayErrorType = FromRlpErrorType | ErrorType
434
439
 
435
440
  export function toTransactionArray(serializedTransaction: string) {
436
441
  return fromRlp(`0x${serializedTransaction.slice(4)}` as Hex, 'hex')
437
442
  }
438
443
 
439
- export type ParseAccessListErrorType =
444
+ type ParseAccessListErrorType =
440
445
  | InvalidAddressErrorType
441
446
  | IsAddressErrorType
442
447
  | ErrorType
@@ -370,13 +370,18 @@ function serializeTransactionLegacy(
370
370
 
371
371
  export function toYParitySignatureArray(
372
372
  transaction: TransactionSerializableGeneric,
373
- signature?: Signature | undefined,
373
+ signature_?: Signature | undefined,
374
374
  ) {
375
- const { r, s, v, yParity } = signature ?? transaction
376
- if (typeof r === 'undefined') return []
377
- if (typeof s === 'undefined') return []
375
+ const signature = signature_ ?? transaction
376
+ const { v, yParity } = signature
377
+
378
+ if (typeof signature.r === 'undefined') return []
379
+ if (typeof signature.s === 'undefined') return []
378
380
  if (typeof v === 'undefined' && typeof yParity === 'undefined') return []
379
381
 
382
+ const r = trim(signature.r)
383
+ const s = trim(signature.s)
384
+
380
385
  const yParity_ = (() => {
381
386
  if (typeof yParity === 'number') return yParity ? toHex(1) : '0x'
382
387
  if (v === 0n) return '0x'
@@ -384,5 +389,6 @@ export function toYParitySignatureArray(
384
389
 
385
390
  return v === 27n ? '0x' : toHex(1)
386
391
  })()
387
- return [yParity_, trim(r), trim(s)]
392
+
393
+ return [yParity_, r === '0x00' ? '0x' : r, s === '0x00' ? '0x' : s]
388
394
  }
@@ -19,7 +19,7 @@ export function parseUnits(value: string, decimals: number) {
19
19
  const negative = integer.startsWith('-')
20
20
  if (negative) integer = integer.slice(1)
21
21
 
22
- // trim leading zeros.
22
+ // trim trailing zeros.
23
23
  fraction = fraction.replace(/(0+)$/, '')
24
24
 
25
25
  // round off if the fraction is larger than the number of decimals.
@@ -10,7 +10,10 @@ import type { Hash, Hex } from '../../types/misc.js'
10
10
  import { contractDeployerAddress } from '../constants/address.js'
11
11
  import type { ChainEIP712 } from '../types/chain.js'
12
12
  import type { ContractDeploymentType } from '../types/contract.js'
13
- import { encodeDeployData } from '../utils/abi/encodeDeployData.js'
13
+ import {
14
+ type EncodeDeployDataErrorType,
15
+ encodeDeployData,
16
+ } from '../utils/abi/encodeDeployData.js'
14
17
  import {
15
18
  type SendEip712TransactionErrorType,
16
19
  type SendEip712TransactionParameters,
@@ -32,7 +35,10 @@ export type DeployContractParameters<
32
35
 
33
36
  export type DeployContractReturnType = SendEip712TransactionReturnType
34
37
 
35
- export type DeployContractErrorType = SendEip712TransactionErrorType | ErrorType
38
+ export type DeployContractErrorType =
39
+ | EncodeDeployDataErrorType
40
+ | SendEip712TransactionErrorType
41
+ | ErrorType
36
42
 
37
43
  /**
38
44
  * Deploys a contract to the network, given bytecode and constructor arguments using EIP712 transaction.
@@ -1,8 +1,8 @@
1
+ import { parseAccount } from '../../accounts/utils/parseAccount.js'
1
2
  import type { SendTransactionParameters } from '../../actions/wallet/sendTransaction.js'
2
3
  import type { Client } from '../../clients/createClient.js'
3
4
  import type { Transport } from '../../clients/transports/createTransport.js'
4
5
  import type { Account } from '../../types/account.js'
5
- import { parseAccount } from '../../utils/accounts.js'
6
6
  import type { ChainEIP712 } from '../types/chain.js'
7
7
  import type { PublicZkSyncRpcSchema } from '../types/eip1193.js'
8
8
 
@@ -1,9 +1,9 @@
1
1
  import type { Address } from 'abitype'
2
+ import { parseAccount } from '../../accounts/utils/parseAccount.js'
2
3
  import type { Client } from '../../clients/createClient.js'
3
4
  import type { Transport } from '../../clients/transports/createTransport.js'
4
5
  import type { Account, GetAccountParameter } from '../../types/account.js'
5
6
  import type { Chain } from '../../types/chain.js'
6
- import { parseAccount } from '../../utils/accounts.js'
7
7
  import { hexToBigInt } from '../../utils/encoding/fromHex.js'
8
8
  import type { PublicZkSyncRpcSchema } from '../types/eip1193.js'
9
9
 
@@ -1,4 +1,5 @@
1
1
  import type { Address } from 'abitype'
2
+ import { parseAccount } from '../../accounts/utils/parseAccount.js'
2
3
  import { readContract } from '../../actions/public/readContract.js'
3
4
  import type { Client } from '../../clients/createClient.js'
4
5
  import type { Transport } from '../../clients/transports/createTransport.js'
@@ -8,7 +9,6 @@ import type { BaseError } from '../../errors/base.js'
8
9
  import type { Account, GetAccountParameter } from '../../types/account.js'
9
10
  import type { BlockTag } from '../../types/block.js'
10
11
  import type { Chain } from '../../types/chain.js'
11
- import { parseAccount } from '../../utils/accounts.js'
12
12
 
13
13
  export type GetL1AllowanceParameters<
14
14
  TAccount extends Account | undefined = Account | undefined,
@@ -1,4 +1,5 @@
1
1
  import type { Address } from 'abitype'
2
+ import { parseAccount } from '../../accounts/utils/parseAccount.js'
2
3
  import {
3
4
  type GetBalanceParameters,
4
5
  getBalance,
@@ -10,7 +11,6 @@ import type { BaseError } from '../../errors/base.js'
10
11
  import type { Account, GetAccountParameter } from '../../types/account.js'
11
12
  import type { BlockTag } from '../../types/block.js'
12
13
  import type { Chain } from '../../types/chain.js'
13
- import { parseAccount } from '../../utils/accounts.js'
14
14
  import { legacyEthAddress } from '../constants/address.js'
15
15
  import { isEth } from '../utils/isEth.js'
16
16
  import {
@@ -1,15 +1,18 @@
1
1
  import type { Address } from '../../accounts/index.js'
2
+ import { parseAccount } from '../../accounts/utils/parseAccount.js'
2
3
  import { readContract } from '../../actions/index.js'
3
4
  import type { Client } from '../../clients/createClient.js'
4
5
  import type { Transport } from '../../clients/transports/createTransport.js'
5
6
  import { erc20Abi } from '../../constants/abis.js'
6
- import type { AccountNotFoundError } from '../../errors/account.js'
7
- import type { BaseError } from '../../errors/base.js'
7
+ import type { AccountNotFoundErrorType } from '../../errors/account.js'
8
+ import type { BaseErrorType } from '../../errors/base.js'
8
9
  import type { Account, GetAccountParameter } from '../../types/account.js'
9
10
  import type { BlockTag } from '../../types/block.js'
10
11
  import type { Chain } from '../../types/chain.js'
11
- import { parseAccount } from '../../utils/accounts.js'
12
- import { TokenIsEthError } from '../errors/token-is-eth.js'
12
+ import {
13
+ TokenIsEthError,
14
+ type TokenIsEthErrorType,
15
+ } from '../errors/token-is-eth.js'
13
16
  import { isEth } from '../utils/isEth.js'
14
17
 
15
18
  export type GetL1TokenBalanceParameters<
@@ -30,9 +33,9 @@ export type GetL1TokenBalanceParameters<
30
33
  export type GetL1TokenBalanceReturnType = bigint
31
34
 
32
35
  export type GetL1TokenBalanceErrorType =
33
- | AccountNotFoundError
34
- | BaseError
35
- | TokenIsEthError
36
+ | AccountNotFoundErrorType
37
+ | TokenIsEthErrorType
38
+ | BaseErrorType
36
39
 
37
40
  export async function getL1TokenBalance<
38
41
  TChain extends Chain | undefined,
@@ -5,7 +5,8 @@ import { prepareTransactionRequest } from '../../actions/wallet/prepareTransacti
5
5
  import { sendRawTransaction } from '../../actions/wallet/sendRawTransaction.js'
6
6
  import type {
7
7
  SendTransactionErrorType,
8
- SendTransactionParameters as SendTransactionParameters_,
8
+ SendTransactionParameters,
9
+ SendTransactionRequest,
9
10
  SendTransactionReturnType,
10
11
  } from '../../actions/wallet/sendTransaction.js'
11
12
  import type { Client } from '../../clients/createClient.js'
@@ -24,10 +25,14 @@ import { assertEip712Request } from '../utils/assertEip712Request.js'
24
25
  import { signTransaction } from './signTransaction.js'
25
26
 
26
27
  export type SendEip712TransactionParameters<
27
- TChain extends ChainEIP712 | undefined = ChainEIP712 | undefined,
28
- TAccount extends Account | undefined = Account | undefined,
29
- TChainOverride extends ChainEIP712 | undefined = ChainEIP712 | undefined,
30
- > = SendTransactionParameters_<TChain, TAccount, TChainOverride>
28
+ chain extends ChainEIP712 | undefined = ChainEIP712 | undefined,
29
+ account extends Account | undefined = Account | undefined,
30
+ chainOverride extends ChainEIP712 | undefined = ChainEIP712 | undefined,
31
+ request extends SendTransactionRequest<
32
+ chain,
33
+ chainOverride
34
+ > = SendTransactionRequest<chain, chainOverride>,
35
+ > = SendTransactionParameters<chain, account, chainOverride, request>
31
36
 
32
37
  export type SendEip712TransactionReturnType = SendTransactionReturnType
33
38
 
@@ -74,27 +79,33 @@ export type SendEip712TransactionErrorType = SendTransactionErrorType
74
79
  * })
75
80
  */
76
81
  export async function sendEip712Transaction<
77
- TChain extends ChainEIP712 | undefined,
78
- TAccount extends Account | undefined,
79
- TChainOverride extends ChainEIP712 | undefined = undefined,
82
+ chain extends ChainEIP712 | undefined,
83
+ account extends Account | undefined,
84
+ const request extends SendTransactionRequest<chain, chainOverride>,
85
+ chainOverride extends ChainEIP712 | undefined = undefined,
80
86
  >(
81
- client: Client<Transport, TChain, TAccount>,
82
- args: SendEip712TransactionParameters<TChain, TAccount, TChainOverride>,
87
+ client: Client<Transport, chain, account>,
88
+ parameters: SendEip712TransactionParameters<
89
+ chain,
90
+ account,
91
+ chainOverride,
92
+ request
93
+ >,
83
94
  ): Promise<SendEip712TransactionReturnType> {
84
- const { chain = client.chain } = args
95
+ const { chain = client.chain } = parameters
85
96
 
86
- if (!args.account)
97
+ if (!parameters.account)
87
98
  throw new AccountNotFoundError({
88
99
  docsPath: '/docs/actions/wallet/sendTransaction',
89
100
  })
90
- const account = parseAccount(args.account)
101
+ const account = parseAccount(parameters.account)
91
102
 
92
103
  try {
93
- assertEip712Request(args)
104
+ assertEip712Request(parameters)
94
105
 
95
106
  // Prepare the request for signing (assign appropriate fees, etc.)
96
107
  const request = await prepareTransactionRequest(client, {
97
- ...args,
108
+ ...parameters,
98
109
  parameters: ['gas', 'nonce', 'fees'],
99
110
  } as any)
100
111
 
@@ -121,7 +132,7 @@ export async function sendEip712Transaction<
121
132
  })
122
133
  } catch (err) {
123
134
  throw getTransactionError(err as BaseError, {
124
- ...(args as GetTransactionErrorParameters),
135
+ ...(parameters as GetTransactionErrorParameters),
125
136
  account,
126
137
  chain: chain as Chain,
127
138
  })
@@ -1,25 +1,33 @@
1
1
  import type { Account } from '../../accounts/types.js'
2
- import { sendTransaction as sendTransaction_ } from '../../actions/wallet/sendTransaction.js'
2
+ import { sendTransaction as core_sendTransaction } from '../../actions/wallet/sendTransaction.js'
3
3
  import type {
4
- SendTransactionErrorType as SendTransactionErrorType_,
5
- SendTransactionParameters as SendTransactionParameters_,
6
- SendTransactionReturnType as SendTransactionReturnType_,
4
+ SendTransactionRequest,
5
+ SendTransactionErrorType as core_SendTransactionErrorType,
6
+ SendTransactionParameters as core_SendTransactionParameters,
7
+ SendTransactionReturnType as core_SendTransactionReturnType,
7
8
  } from '../../actions/wallet/sendTransaction.js'
8
9
  import type { Client } from '../../clients/createClient.js'
9
10
  import type { Transport } from '../../clients/transports/createTransport.js'
10
11
  import type { ChainEIP712 } from '../types/chain.js'
11
12
  import { isEIP712Transaction } from '../utils/isEip712Transaction.js'
12
- import { sendEip712Transaction } from './sendEip712Transaction.js'
13
+ import {
14
+ type SendEip712TransactionParameters,
15
+ sendEip712Transaction,
16
+ } from './sendEip712Transaction.js'
13
17
 
14
18
  export type SendTransactionParameters<
15
- TChain extends ChainEIP712 | undefined = ChainEIP712 | undefined,
16
- TAccount extends Account | undefined = Account | undefined,
17
- TChainOverride extends ChainEIP712 | undefined = ChainEIP712 | undefined,
18
- > = SendTransactionParameters_<TChain, TAccount, TChainOverride>
19
+ chain extends ChainEIP712 | undefined = ChainEIP712 | undefined,
20
+ account extends Account | undefined = Account | undefined,
21
+ chainOverride extends ChainEIP712 | undefined = ChainEIP712 | undefined,
22
+ request extends SendTransactionRequest<
23
+ chain,
24
+ chainOverride
25
+ > = SendTransactionRequest<chain, chainOverride>,
26
+ > = core_SendTransactionParameters<chain, account, chainOverride, request>
19
27
 
20
- export type SendTransactionReturnType = SendTransactionReturnType_
28
+ export type SendTransactionReturnType = core_SendTransactionReturnType
21
29
 
22
- export type SendTransactionErrorType = SendTransactionErrorType_
30
+ export type SendTransactionErrorType = core_SendTransactionErrorType
23
31
 
24
32
  /**
25
33
  * Creates, signs, and sends a new transaction to the network.
@@ -66,13 +74,21 @@ export type SendTransactionErrorType = SendTransactionErrorType_
66
74
  * })
67
75
  */
68
76
  export async function sendTransaction<
69
- TChain extends ChainEIP712 | undefined,
70
- TAccount extends Account | undefined,
71
- TChainOverride extends ChainEIP712 | undefined = undefined,
77
+ chain extends ChainEIP712 | undefined,
78
+ account extends Account | undefined,
79
+ const request extends SendTransactionRequest<chain, chainOverride>,
80
+ chainOverride extends ChainEIP712 | undefined = undefined,
72
81
  >(
73
- client: Client<Transport, TChain, TAccount>,
74
- args: SendTransactionParameters<TChain, TAccount, TChainOverride>,
82
+ client: Client<Transport, chain, account>,
83
+ parameters: SendTransactionParameters<chain, account, chainOverride, request>,
75
84
  ): Promise<SendTransactionReturnType> {
76
- if (isEIP712Transaction(args)) return sendEip712Transaction(client, args)
77
- return sendTransaction_(client, args)
85
+ if (isEIP712Transaction(parameters))
86
+ return sendEip712Transaction(
87
+ client,
88
+ parameters as SendEip712TransactionParameters,
89
+ )
90
+ return core_sendTransaction(
91
+ client,
92
+ parameters as core_SendTransactionParameters,
93
+ )
78
94
  }
@@ -1,2 +1 @@
1
- export const accountAbstractionVersionNone = 0
2
1
  export const accountAbstractionVersion1 = 1
@@ -1,4 +1,6 @@
1
1
  import type { Abi } from 'abitype'
2
+
3
+ import type { SendTransactionRequest } from '../../actions/wallet/sendTransaction.js'
2
4
  import { writeContract } from '../../actions/wallet/writeContract.js'
3
5
  import type { Client } from '../../clients/createClient.js'
4
6
  import type { WalletActions } from '../../clients/decorators/wallet.js'
@@ -69,8 +71,11 @@ export type Eip712WalletActions<
69
71
  * value: 1000000000000000000n,
70
72
  * })
71
73
  */
72
- sendTransaction: <chainOverride extends ChainEIP712 | undefined = undefined>(
73
- args: SendTransactionParameters<chain, account, chainOverride>,
74
+ sendTransaction: <
75
+ const request extends SendTransactionRequest<chain, chainOverride>,
76
+ chainOverride extends ChainEIP712 | undefined = undefined,
77
+ >(
78
+ args: SendTransactionParameters<chain, account, chainOverride, request>,
74
79
  ) => Promise<SendTransactionReturnType>
75
80
  /**
76
81
  * Signs a transaction.
package/zksync/index.ts CHANGED
@@ -134,6 +134,11 @@ export type {
134
134
  EIP712DomainFn,
135
135
  ZkSyncEip712Meta,
136
136
  } from './types/eip712.js'
137
+ export type {
138
+ CommonDataRawBlockTransaction,
139
+ RawBlockTransactions,
140
+ PublicZkSyncRpcSchema,
141
+ } from './types/eip1193.js'
137
142
  export type { ZkSyncFeeValues } from './types/fee.js'
138
143
  export type {
139
144
  ZkSyncL2ToL1Log,
@@ -32,8 +32,7 @@ export const serializers = {
32
32
  transaction: serializeTransaction,
33
33
  } as const satisfies ChainSerializers
34
34
 
35
- export type SerializeTransactionEIP712ReturnType =
36
- ZkSyncTransactionSerializedEIP712
35
+ type SerializeTransactionEIP712ReturnType = ZkSyncTransactionSerializedEIP712
37
36
 
38
37
  function serializeTransactionEIP712(
39
38
  transaction: ZkSyncTransactionSerializableEIP712,
@@ -6,20 +6,20 @@ import type { ZkSyncTransactionSerializable } from './transaction.js'
6
6
  export type ChainEIP712<
7
7
  formatters extends ChainFormatters | undefined = ChainFormatters | undefined,
8
8
  TransactionSignable = {},
9
+ ///
10
+ transactionSerializable extends
11
+ ZkSyncTransactionSerializable = formatters extends ChainFormatters
12
+ ? formatters['transactionRequest'] extends ChainFormatter
13
+ ? ZkSyncTransactionSerializable &
14
+ Parameters<formatters['transactionRequest']['format']>[0]
15
+ : ZkSyncTransactionSerializable
16
+ : ZkSyncTransactionSerializable,
9
17
  > = Chain<
10
18
  formatters,
11
19
  {
12
20
  /** Return EIP712 Domain for EIP712 transaction */
13
21
  getEip712Domain?:
14
- | EIP712DomainFn<
15
- formatters extends ChainFormatters
16
- ? formatters['transactionRequest'] extends ChainFormatter
17
- ? ZkSyncTransactionSerializable &
18
- Parameters<formatters['transactionRequest']['format']>[0]
19
- : ZkSyncTransactionSerializable
20
- : ZkSyncTransactionSerializable,
21
- TransactionSignable
22
- >
22
+ | EIP712DomainFn<transactionSerializable, TransactionSignable>
23
23
  | undefined
24
24
  }
25
25
  >
@@ -22,32 +22,38 @@ export type CommonDataRawBlockTransaction = {
22
22
 
23
23
  export type RawBlockTransactions = {
24
24
  common_data: {
25
- L1?: {
26
- serialId: number
27
- deadlineBlock: number
28
- layer2TipFee: Hex
29
- fullFee: Hex
30
- opProcessingType: string
31
- priorityQueueType: string
32
- } & CommonDataRawBlockTransaction
33
- L2?: {
34
- nonce: number
35
- fee: ZkSyncFee<Hex>
36
- initiatorAddress: Address
37
- signature: Uint8Array
38
- transactionType: string
39
- input?: {
40
- hash: Hash
41
- data: Uint8Array
42
- }
43
- paymasterParams: {
44
- paymaster: Address
45
- paymasterInput: Uint8Array
46
- }
47
- }
48
- ProtocolUpgrade?: {
49
- upgradeId: string
50
- } & CommonDataRawBlockTransaction
25
+ L1?:
26
+ | ({
27
+ serialId: number
28
+ deadlineBlock: number
29
+ layer2TipFee: Hex
30
+ fullFee: Hex
31
+ opProcessingType: string
32
+ priorityQueueType: string
33
+ } & CommonDataRawBlockTransaction)
34
+ | undefined
35
+ L2?:
36
+ | {
37
+ nonce: number
38
+ fee: ZkSyncFee<Hex>
39
+ initiatorAddress: Address
40
+ signature: Uint8Array
41
+ transactionType: string
42
+ input?: {
43
+ hash: Hash
44
+ data: Uint8Array
45
+ }
46
+ paymasterParams: {
47
+ paymaster: Address
48
+ paymasterInput: Uint8Array
49
+ }
50
+ }
51
+ | undefined
52
+ ProtocolUpgrade?:
53
+ | ({
54
+ upgradeId: string
55
+ } & CommonDataRawBlockTransaction)
56
+ | undefined
51
57
  }
52
58
  execute: {
53
59
  calldata: Hash
@@ -5,6 +5,7 @@ import {
5
5
  AbiConstructorNotFoundError,
6
6
  AbiConstructorParamsNotFoundError,
7
7
  } from '../../../errors/abi.js'
8
+ import type { ErrorType } from '../../../errors/utils.js'
8
9
  import type { ContractConstructorArgs } from '../../../types/contract.js'
9
10
  import type { Hash } from '../../../types/misc.js'
10
11
  import type { Hex } from '../../../types/misc.js'
@@ -13,15 +14,19 @@ import type {
13
14
  EncodeDeployDataParameters as EncodeDeployDataParameters_,
14
15
  EncodeDeployDataReturnType,
15
16
  } from '../../../utils/abi/encodeDeployData.js'
16
- import { encodeFunctionData } from '../../../utils/abi/encodeFunctionData.js'
17
+ import {
18
+ type EncodeFunctionDataErrorType,
19
+ encodeFunctionData,
20
+ } from '../../../utils/abi/encodeFunctionData.js'
17
21
  import { toHex } from '../../../utils/encoding/toHex.js'
18
22
  import { contractDeployerAbi } from '../../constants/abis.js'
19
23
  import { accountAbstractionVersion1 } from '../../constants/contract.js'
20
24
  import type { ContractDeploymentType } from '../../types/contract.js'
21
- import { hashBytecode } from '../hashBytecode.js'
25
+ import { type HashBytecodeErrorType, hashBytecode } from '../hashBytecode.js'
22
26
 
23
27
  const docsPath = '/docs/contract/encodeDeployData'
24
28
 
29
+ /** @internal */
25
30
  export type EncodeDeployDataParameters<
26
31
  abi extends Abi | readonly unknown[] = Abi,
27
32
  hasConstructor = abi extends Abi
@@ -37,6 +42,11 @@ export type EncodeDeployDataParameters<
37
42
  salt?: Hash | undefined
38
43
  }
39
44
 
45
+ export type EncodeDeployDataErrorType =
46
+ | EncodeFunctionDataErrorType
47
+ | HashBytecodeErrorType
48
+ | ErrorType
49
+
40
50
  export function encodeDeployData<const abi extends Abi | readonly unknown[]>(
41
51
  parameters: EncodeDeployDataParameters<abi>,
42
52
  ): EncodeDeployDataReturnType {
@@ -6,14 +6,21 @@ import {
6
6
  } from '../../utils/transaction/assertRequest.js'
7
7
  import type { zkSync } from '../../zksync/chains.js'
8
8
  import type { SendTransactionParameters } from '../actions/sendTransaction.js'
9
- import { InvalidEip712TransactionError } from '../errors/transaction.js'
9
+ import {
10
+ InvalidEip712TransactionError,
11
+ type InvalidEip712TransactionErrorType,
12
+ } from '../errors/transaction.js'
10
13
  import { isEIP712Transaction } from './isEip712Transaction.js'
11
14
 
12
15
  export type AssertEip712RequestParameters = ExactPartial<
13
16
  SendTransactionParameters<typeof zkSync>
14
17
  >
15
18
 
16
- export type AssertEip712RequestErrorType = AssertRequestErrorType | ErrorType
19
+ /** @internal */
20
+ export type AssertEip712RequestErrorType =
21
+ | InvalidEip712TransactionErrorType
22
+ | AssertRequestErrorType
23
+ | ErrorType
17
24
 
18
25
  export function assertEip712Request(args: AssertEip712RequestParameters) {
19
26
  if (!isEIP712Transaction(args as any))