viem 2.10.11 → 2.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (276) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/_cjs/celo/formatters.js +1 -10
  3. package/_cjs/celo/formatters.js.map +1 -1
  4. package/_cjs/celo/serializers.js +0 -25
  5. package/_cjs/celo/serializers.js.map +1 -1
  6. package/_cjs/celo/utils.js +2 -15
  7. package/_cjs/celo/utils.js.map +1 -1
  8. package/_cjs/errors/version.js +1 -1
  9. package/_cjs/errors/version.js.map +1 -1
  10. package/_cjs/zksync/actions/estimateFee.js +26 -0
  11. package/_cjs/zksync/actions/estimateFee.js.map +1 -0
  12. package/_cjs/zksync/actions/estimateGasL1ToL2.js +20 -0
  13. package/_cjs/zksync/actions/estimateGasL1ToL2.js.map +1 -0
  14. package/_cjs/zksync/actions/getAllBalances.js +19 -0
  15. package/_cjs/zksync/actions/getAllBalances.js.map +1 -0
  16. package/_cjs/zksync/actions/getBaseTokenL1Address.js +9 -0
  17. package/_cjs/zksync/actions/getBaseTokenL1Address.js.map +1 -0
  18. package/_cjs/zksync/actions/getBlockDetails.js +12 -0
  19. package/_cjs/zksync/actions/getBlockDetails.js.map +1 -0
  20. package/_cjs/zksync/actions/getBridgehubContractAddress.js +9 -0
  21. package/_cjs/zksync/actions/getBridgehubContractAddress.js.map +1 -0
  22. package/_cjs/zksync/actions/getDefaultBridgeAddresses.js +13 -0
  23. package/_cjs/zksync/actions/getDefaultBridgeAddresses.js.map +1 -0
  24. package/_cjs/zksync/actions/getL1Allowance.js +19 -0
  25. package/_cjs/zksync/actions/getL1Allowance.js.map +1 -0
  26. package/_cjs/zksync/actions/getL1Balance.js +23 -0
  27. package/_cjs/zksync/actions/getL1Balance.js.map +1 -0
  28. package/_cjs/zksync/actions/getL1BatchBlockRange.js +13 -0
  29. package/_cjs/zksync/actions/getL1BatchBlockRange.js.map +1 -0
  30. package/_cjs/zksync/actions/getL1BatchDetails.js +12 -0
  31. package/_cjs/zksync/actions/getL1BatchDetails.js.map +1 -0
  32. package/_cjs/zksync/actions/getL1BatchNumber.js +9 -0
  33. package/_cjs/zksync/actions/getL1BatchNumber.js.map +1 -0
  34. package/_cjs/zksync/actions/getL1ChainId.js +9 -0
  35. package/_cjs/zksync/actions/getL1ChainId.js.map +1 -0
  36. package/_cjs/zksync/actions/getL1TokenBalance.js +24 -0
  37. package/_cjs/zksync/actions/getL1TokenBalance.js.map +1 -0
  38. package/_cjs/zksync/actions/getLogProof.js +12 -0
  39. package/_cjs/zksync/actions/getLogProof.js.map +1 -0
  40. package/_cjs/zksync/actions/getMainContractAddress.js +9 -0
  41. package/_cjs/zksync/actions/getMainContractAddress.js.map +1 -0
  42. package/_cjs/zksync/actions/getRawBlockTransactions.js +13 -0
  43. package/_cjs/zksync/actions/getRawBlockTransactions.js.map +1 -0
  44. package/_cjs/zksync/actions/getTestnetPaymasterAddress.js +9 -0
  45. package/_cjs/zksync/actions/getTestnetPaymasterAddress.js.map +1 -0
  46. package/_cjs/zksync/actions/getTransactionDetails.js +12 -0
  47. package/_cjs/zksync/actions/getTransactionDetails.js.map +1 -0
  48. package/_cjs/zksync/constants/address.js +4 -1
  49. package/_cjs/zksync/constants/address.js.map +1 -1
  50. package/_cjs/zksync/decorators/publicL1.js +15 -0
  51. package/_cjs/zksync/decorators/publicL1.js.map +1 -0
  52. package/_cjs/zksync/decorators/publicL2.js +43 -0
  53. package/_cjs/zksync/decorators/publicL2.js.map +1 -0
  54. package/_cjs/zksync/errors/token-is-eth.js +17 -0
  55. package/_cjs/zksync/errors/token-is-eth.js.map +1 -0
  56. package/_cjs/zksync/index.js +41 -3
  57. package/_cjs/zksync/index.js.map +1 -1
  58. package/_cjs/zksync/types/eip1193.js +3 -0
  59. package/_cjs/zksync/types/eip1193.js.map +1 -0
  60. package/_cjs/zksync/types/proof.js +3 -0
  61. package/_cjs/zksync/types/proof.js.map +1 -0
  62. package/_cjs/zksync/utils/camelCaseKeys.js +17 -0
  63. package/_cjs/zksync/utils/camelCaseKeys.js.map +1 -0
  64. package/_cjs/zksync/utils/isEth.js +17 -0
  65. package/_cjs/zksync/utils/isEth.js.map +1 -0
  66. package/_cjs/zksync/utils/paymaster/getApprovalBasedPaymasterInput.js +4 -3
  67. package/_cjs/zksync/utils/paymaster/getApprovalBasedPaymasterInput.js.map +1 -1
  68. package/_cjs/zksync/utils/paymaster/getGeneralPaymasterInput.js +4 -3
  69. package/_cjs/zksync/utils/paymaster/getGeneralPaymasterInput.js.map +1 -1
  70. package/_esm/celo/formatters.js +2 -11
  71. package/_esm/celo/formatters.js.map +1 -1
  72. package/_esm/celo/serializers.js +1 -29
  73. package/_esm/celo/serializers.js.map +1 -1
  74. package/_esm/celo/utils.js +1 -15
  75. package/_esm/celo/utils.js.map +1 -1
  76. package/_esm/errors/version.js +1 -1
  77. package/_esm/errors/version.js.map +1 -1
  78. package/_esm/zksync/actions/estimateFee.js +22 -0
  79. package/_esm/zksync/actions/estimateFee.js.map +1 -0
  80. package/_esm/zksync/actions/estimateGasL1ToL2.js +16 -0
  81. package/_esm/zksync/actions/estimateGasL1ToL2.js.map +1 -0
  82. package/_esm/zksync/actions/getAllBalances.js +15 -0
  83. package/_esm/zksync/actions/getAllBalances.js.map +1 -0
  84. package/_esm/zksync/actions/getBaseTokenL1Address.js +5 -0
  85. package/_esm/zksync/actions/getBaseTokenL1Address.js.map +1 -0
  86. package/_esm/zksync/actions/getBlockDetails.js +8 -0
  87. package/_esm/zksync/actions/getBlockDetails.js.map +1 -0
  88. package/_esm/zksync/actions/getBridgehubContractAddress.js +5 -0
  89. package/_esm/zksync/actions/getBridgehubContractAddress.js.map +1 -0
  90. package/_esm/zksync/actions/getDefaultBridgeAddresses.js +9 -0
  91. package/_esm/zksync/actions/getDefaultBridgeAddresses.js.map +1 -0
  92. package/_esm/zksync/actions/getL1Allowance.js +15 -0
  93. package/_esm/zksync/actions/getL1Allowance.js.map +1 -0
  94. package/_esm/zksync/actions/getL1Balance.js +19 -0
  95. package/_esm/zksync/actions/getL1Balance.js.map +1 -0
  96. package/_esm/zksync/actions/getL1BatchBlockRange.js +9 -0
  97. package/_esm/zksync/actions/getL1BatchBlockRange.js.map +1 -0
  98. package/_esm/zksync/actions/getL1BatchDetails.js +8 -0
  99. package/_esm/zksync/actions/getL1BatchDetails.js.map +1 -0
  100. package/_esm/zksync/actions/getL1BatchNumber.js +5 -0
  101. package/_esm/zksync/actions/getL1BatchNumber.js.map +1 -0
  102. package/_esm/zksync/actions/getL1ChainId.js +5 -0
  103. package/_esm/zksync/actions/getL1ChainId.js.map +1 -0
  104. package/_esm/zksync/actions/getL1TokenBalance.js +20 -0
  105. package/_esm/zksync/actions/getL1TokenBalance.js.map +1 -0
  106. package/_esm/zksync/actions/getLogProof.js +8 -0
  107. package/_esm/zksync/actions/getLogProof.js.map +1 -0
  108. package/_esm/zksync/actions/getMainContractAddress.js +5 -0
  109. package/_esm/zksync/actions/getMainContractAddress.js.map +1 -0
  110. package/_esm/zksync/actions/getRawBlockTransactions.js +9 -0
  111. package/_esm/zksync/actions/getRawBlockTransactions.js.map +1 -0
  112. package/_esm/zksync/actions/getTestnetPaymasterAddress.js +5 -0
  113. package/_esm/zksync/actions/getTestnetPaymasterAddress.js.map +1 -0
  114. package/_esm/zksync/actions/getTransactionDetails.js +8 -0
  115. package/_esm/zksync/actions/getTransactionDetails.js.map +1 -0
  116. package/_esm/zksync/constants/address.js +3 -0
  117. package/_esm/zksync/constants/address.js.map +1 -1
  118. package/_esm/zksync/decorators/publicL1.js +12 -0
  119. package/_esm/zksync/decorators/publicL1.js.map +1 -0
  120. package/_esm/zksync/decorators/publicL2.js +39 -0
  121. package/_esm/zksync/decorators/publicL2.js.map +1 -0
  122. package/_esm/zksync/errors/token-is-eth.js +13 -0
  123. package/_esm/zksync/errors/token-is-eth.js.map +1 -0
  124. package/_esm/zksync/index.js +20 -1
  125. package/_esm/zksync/index.js.map +1 -1
  126. package/_esm/zksync/types/eip1193.js +2 -0
  127. package/_esm/zksync/types/eip1193.js.map +1 -0
  128. package/_esm/zksync/types/proof.js +2 -0
  129. package/_esm/zksync/types/proof.js.map +1 -0
  130. package/_esm/zksync/utils/camelCaseKeys.js +13 -0
  131. package/_esm/zksync/utils/camelCaseKeys.js.map +1 -0
  132. package/_esm/zksync/utils/isEth.js +13 -0
  133. package/_esm/zksync/utils/isEth.js.map +1 -0
  134. package/_esm/zksync/utils/paymaster/getApprovalBasedPaymasterInput.js +2 -1
  135. package/_esm/zksync/utils/paymaster/getApprovalBasedPaymasterInput.js.map +1 -1
  136. package/_esm/zksync/utils/paymaster/getGeneralPaymasterInput.js +2 -1
  137. package/_esm/zksync/utils/paymaster/getGeneralPaymasterInput.js.map +1 -1
  138. package/_types/celo/chainConfig.d.ts +58 -526
  139. package/_types/celo/chainConfig.d.ts.map +1 -1
  140. package/_types/celo/formatters.d.ts +29 -263
  141. package/_types/celo/formatters.d.ts.map +1 -1
  142. package/_types/celo/index.d.ts +1 -1
  143. package/_types/celo/index.d.ts.map +1 -1
  144. package/_types/celo/serializers.d.ts +2 -3
  145. package/_types/celo/serializers.d.ts.map +1 -1
  146. package/_types/celo/types.d.ts +5 -29
  147. package/_types/celo/types.d.ts.map +1 -1
  148. package/_types/celo/utils.d.ts +1 -2
  149. package/_types/celo/utils.d.ts.map +1 -1
  150. package/_types/chains/definitions/celo.d.ts +58 -526
  151. package/_types/chains/definitions/celo.d.ts.map +1 -1
  152. package/_types/chains/definitions/celoAlfajores.d.ts +58 -526
  153. package/_types/chains/definitions/celoAlfajores.d.ts.map +1 -1
  154. package/_types/chains/definitions/lisk.d.ts +8 -8
  155. package/_types/chains/definitions/playfiAlbireo.d.ts +8 -8
  156. package/_types/chains/definitions/zkSync.d.ts +8 -8
  157. package/_types/chains/definitions/zkSyncInMemoryNode.d.ts +8 -8
  158. package/_types/chains/definitions/zkSyncLocalNode.d.ts +8 -8
  159. package/_types/chains/definitions/zkSyncSepoliaTestnet.d.ts +8 -8
  160. package/_types/chains/definitions/zkSyncTestnet.d.ts +8 -8
  161. package/_types/chains/index.d.ts +1 -1
  162. package/_types/chains/index.d.ts.map +1 -1
  163. package/_types/errors/version.d.ts +1 -1
  164. package/_types/errors/version.d.ts.map +1 -1
  165. package/_types/zksync/actions/estimateFee.d.ts +11 -0
  166. package/_types/zksync/actions/estimateFee.d.ts.map +1 -0
  167. package/_types/zksync/actions/estimateGasL1ToL2.d.ts +10 -0
  168. package/_types/zksync/actions/estimateGasL1ToL2.d.ts.map +1 -0
  169. package/_types/zksync/actions/getAllBalances.d.ts +12 -0
  170. package/_types/zksync/actions/getAllBalances.d.ts.map +1 -0
  171. package/_types/zksync/actions/getBaseTokenL1Address.d.ts +9 -0
  172. package/_types/zksync/actions/getBaseTokenL1Address.d.ts.map +1 -0
  173. package/_types/zksync/actions/getBlockDetails.d.ts +10 -0
  174. package/_types/zksync/actions/getBlockDetails.d.ts.map +1 -0
  175. package/_types/zksync/actions/getBridgehubContractAddress.d.ts +9 -0
  176. package/_types/zksync/actions/getBridgehubContractAddress.d.ts.map +1 -0
  177. package/_types/zksync/actions/getDefaultBridgeAddresses.d.ts +9 -0
  178. package/_types/zksync/actions/getDefaultBridgeAddresses.d.ts.map +1 -0
  179. package/_types/zksync/actions/getL1Allowance.d.ts +17 -0
  180. package/_types/zksync/actions/getL1Allowance.d.ts.map +1 -0
  181. package/_types/zksync/actions/getL1Balance.d.ts +23 -0
  182. package/_types/zksync/actions/getL1Balance.d.ts.map +1 -0
  183. package/_types/zksync/actions/getL1BatchBlockRange.d.ts +11 -0
  184. package/_types/zksync/actions/getL1BatchBlockRange.d.ts.map +1 -0
  185. package/_types/zksync/actions/getL1BatchDetails.d.ts +10 -0
  186. package/_types/zksync/actions/getL1BatchDetails.d.ts.map +1 -0
  187. package/_types/zksync/actions/getL1BatchNumber.d.ts +9 -0
  188. package/_types/zksync/actions/getL1BatchNumber.d.ts.map +1 -0
  189. package/_types/zksync/actions/getL1ChainId.d.ts +9 -0
  190. package/_types/zksync/actions/getL1ChainId.d.ts.map +1 -0
  191. package/_types/zksync/actions/getL1TokenBalance.d.ts +24 -0
  192. package/_types/zksync/actions/getL1TokenBalance.d.ts.map +1 -0
  193. package/_types/zksync/actions/getLogProof.d.ts +14 -0
  194. package/_types/zksync/actions/getLogProof.d.ts.map +1 -0
  195. package/_types/zksync/actions/getMainContractAddress.d.ts +9 -0
  196. package/_types/zksync/actions/getMainContractAddress.d.ts.map +1 -0
  197. package/_types/zksync/actions/getRawBlockTransactions.d.ts +11 -0
  198. package/_types/zksync/actions/getRawBlockTransactions.d.ts.map +1 -0
  199. package/_types/zksync/actions/getTestnetPaymasterAddress.d.ts +9 -0
  200. package/_types/zksync/actions/getTestnetPaymasterAddress.d.ts.map +1 -0
  201. package/_types/zksync/actions/getTransactionDetails.d.ts +13 -0
  202. package/_types/zksync/actions/getTransactionDetails.d.ts.map +1 -0
  203. package/_types/zksync/chainConfig.d.ts +8 -8
  204. package/_types/zksync/constants/address.d.ts +3 -0
  205. package/_types/zksync/constants/address.d.ts.map +1 -1
  206. package/_types/zksync/decorators/publicL1.d.ts +145 -0
  207. package/_types/zksync/decorators/publicL1.d.ts.map +1 -0
  208. package/_types/zksync/decorators/publicL2.d.ts +322 -0
  209. package/_types/zksync/decorators/publicL2.d.ts.map +1 -0
  210. package/_types/zksync/errors/token-is-eth.d.ts +9 -0
  211. package/_types/zksync/errors/token-is-eth.d.ts.map +1 -0
  212. package/_types/zksync/formatters.d.ts +8 -8
  213. package/_types/zksync/index.d.ts +21 -2
  214. package/_types/zksync/index.d.ts.map +1 -1
  215. package/_types/zksync/types/block.d.ts +30 -1
  216. package/_types/zksync/types/block.d.ts.map +1 -1
  217. package/_types/zksync/types/contract.d.ts +6 -0
  218. package/_types/zksync/types/contract.d.ts.map +1 -1
  219. package/_types/zksync/types/eip1193.d.ts +152 -0
  220. package/_types/zksync/types/eip1193.d.ts.map +1 -0
  221. package/_types/zksync/types/fee.d.ts +6 -0
  222. package/_types/zksync/types/fee.d.ts.map +1 -1
  223. package/_types/zksync/types/proof.d.ts +7 -0
  224. package/_types/zksync/types/proof.d.ts.map +1 -0
  225. package/_types/zksync/types/transaction.d.ts +65 -5
  226. package/_types/zksync/types/transaction.d.ts.map +1 -1
  227. package/_types/zksync/utils/camelCaseKeys.d.ts +2 -0
  228. package/_types/zksync/utils/camelCaseKeys.d.ts.map +1 -0
  229. package/_types/zksync/utils/isEth.d.ts +3 -0
  230. package/_types/zksync/utils/isEth.d.ts.map +1 -0
  231. package/_types/zksync/utils/paymaster/getApprovalBasedPaymasterInput.d.ts +1 -1
  232. package/_types/zksync/utils/paymaster/getApprovalBasedPaymasterInput.d.ts.map +1 -1
  233. package/_types/zksync/utils/paymaster/getGeneralPaymasterInput.d.ts +1 -1
  234. package/_types/zksync/utils/paymaster/getGeneralPaymasterInput.d.ts.map +1 -1
  235. package/celo/formatters.ts +3 -11
  236. package/celo/index.ts +0 -2
  237. package/celo/serializers.ts +2 -50
  238. package/celo/types.ts +3 -38
  239. package/celo/utils.ts +1 -24
  240. package/chains/index.ts +0 -2
  241. package/errors/version.ts +1 -1
  242. package/package.json +1 -1
  243. package/zksync/actions/estimateFee.ts +46 -0
  244. package/zksync/actions/estimateGasL1ToL2.ts +38 -0
  245. package/zksync/actions/getAllBalances.ts +33 -0
  246. package/zksync/actions/getBaseTokenL1Address.ts +18 -0
  247. package/zksync/actions/getBlockDetails.ts +27 -0
  248. package/zksync/actions/getBridgehubContractAddress.ts +18 -0
  249. package/zksync/actions/getDefaultBridgeAddresses.ts +22 -0
  250. package/zksync/actions/getL1Allowance.ts +43 -0
  251. package/zksync/actions/getL1Balance.ts +68 -0
  252. package/zksync/actions/getL1BatchBlockRange.ts +26 -0
  253. package/zksync/actions/getL1BatchDetails.ts +27 -0
  254. package/zksync/actions/getL1BatchNumber.ts +18 -0
  255. package/zksync/actions/getL1ChainId.ts +18 -0
  256. package/zksync/actions/getL1TokenBalance.ts +63 -0
  257. package/zksync/actions/getLogProof.ts +28 -0
  258. package/zksync/actions/getMainContractAddress.ts +18 -0
  259. package/zksync/actions/getRawBlockTransactions.ts +26 -0
  260. package/zksync/actions/getTestnetPaymasterAddress.ts +18 -0
  261. package/zksync/actions/getTransactionDetails.ts +27 -0
  262. package/zksync/constants/address.ts +9 -0
  263. package/zksync/decorators/publicL1.ts +180 -0
  264. package/zksync/decorators/publicL2.ts +443 -0
  265. package/zksync/errors/token-is-eth.ts +16 -0
  266. package/zksync/index.ts +85 -6
  267. package/zksync/types/block.ts +37 -1
  268. package/zksync/types/contract.ts +8 -0
  269. package/zksync/types/eip1193.ts +155 -0
  270. package/zksync/types/fee.ts +7 -0
  271. package/zksync/types/proof.ts +7 -0
  272. package/zksync/types/transaction.ts +84 -10
  273. package/zksync/utils/camelCaseKeys.ts +11 -0
  274. package/zksync/utils/isEth.ts +20 -0
  275. package/zksync/utils/paymaster/getApprovalBasedPaymasterInput.ts +5 -2
  276. package/zksync/utils/paymaster/getGeneralPaymasterInput.ts +5 -2
@@ -0,0 +1,155 @@
1
+ import type { Address } from 'abitype'
2
+ import type { Hash, Hex } from '../../types/misc.js'
3
+ import type { ZkSyncBatchDetails, ZkSyncBlockDetails } from './block.js'
4
+ import type { ZkSyncFee } from './fee.js'
5
+ import type { MessageProof } from './proof.js'
6
+ import type {
7
+ TransactionRequest,
8
+ ZkSyncTransactionDetails,
9
+ } from './transaction.js'
10
+
11
+ export type CommonDataRawBlockTransaction = {
12
+ sender: Address
13
+ maxFeePerGas: Hex
14
+ gasLimit: Hex
15
+ gasPerPubdataLimit: Hex
16
+ ethHash: Hash
17
+ ethBlock: number
18
+ canonicalTxHash: Hash
19
+ toMint: Hex
20
+ refundRecipient: Address
21
+ }
22
+
23
+ export type RawBlockTransactions = {
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
51
+ }
52
+ execute: {
53
+ calldata: Hash
54
+ contractAddress: Address
55
+ factoryDeps?: Hash
56
+ value: bigint
57
+ }
58
+ received_timestamp_ms: number
59
+ raw_bytes?: string
60
+ }[]
61
+
62
+ export type PublicZkSyncRpcSchema = [
63
+ {
64
+ Method: 'zks_estimateFee'
65
+ Parameters: [TransactionRequest]
66
+ ReturnType: {
67
+ gas_limit: Hex
68
+ gas_per_pubdata_limit: Hex
69
+ max_fee_per_gas: Hex
70
+ max_priority_fee_per_gas: Hex
71
+ }
72
+ },
73
+ {
74
+ Method: 'zks_estimateGasL1ToL2'
75
+ Parameters: [TransactionRequest]
76
+ ReturnType: bigint
77
+ },
78
+ {
79
+ Method: 'zks_getBridgeContracts'
80
+ Parameters?: undefined
81
+ ReturnType: {
82
+ l1Erc20DefaultBridge: Address
83
+ l2Erc20DefaultBridge: Address
84
+ l1WethBridge: Address
85
+ l2WethBridge: Address
86
+ l1SharedDefaultBridge: Address
87
+ l2SharedDefaultBridge: Address
88
+ }
89
+ },
90
+ {
91
+ Method: 'zks_getAllAccountBalances'
92
+ Parameters: [Address]
93
+ ReturnType: { [key: Address]: Hex }
94
+ },
95
+ {
96
+ Method: 'zks_getTestnetPaymaster'
97
+ Parameters: undefined
98
+ ReturnType: Address
99
+ },
100
+ {
101
+ Method: 'zks_L1ChainId'
102
+ Parameters: undefined
103
+ ReturnType: Hex
104
+ },
105
+ {
106
+ Method: 'zks_getMainContract'
107
+ Parameters: undefined
108
+ ReturnType: Address
109
+ },
110
+ {
111
+ Method: 'zks_L1BatchNumber'
112
+ Parameters: undefined
113
+ ReturnType: Hex
114
+ },
115
+ {
116
+ Method: 'zks_getL2ToL1LogProof'
117
+ Parameters: [Hash, number | undefined]
118
+ ReturnType: MessageProof
119
+ },
120
+ {
121
+ Method: 'zks_getL1BatchBlockRange'
122
+ Parameters: [number]
123
+ ReturnType: [Hex, Hex]
124
+ },
125
+ {
126
+ Method: 'zks_getL1BatchDetails'
127
+ Parameters: [number]
128
+ ReturnType: ZkSyncBatchDetails
129
+ },
130
+ {
131
+ Method: 'zks_getRawBlockTransactions'
132
+ Parameters: [number]
133
+ ReturnType: RawBlockTransactions
134
+ },
135
+ {
136
+ Method: 'zks_getBlockDetails'
137
+ Parameters: [number]
138
+ ReturnType: ZkSyncBlockDetails
139
+ },
140
+ {
141
+ Method: 'zks_getTransactionDetails'
142
+ Parameters: [Hash]
143
+ ReturnType: ZkSyncTransactionDetails
144
+ },
145
+ {
146
+ Method: 'zks_getBridgehubContract'
147
+ Parameters: undefined
148
+ ReturnType: Address
149
+ },
150
+ {
151
+ Method: 'zks_getBaseTokenL1Address'
152
+ Parameters: undefined
153
+ ReturnType: Address
154
+ },
155
+ ]
@@ -1,3 +1,10 @@
1
+ export type ZkSyncFee<TQuantity = bigint> = {
2
+ gasLimit: TQuantity
3
+ gasPerPubdataLimit: TQuantity
4
+ maxPriorityFeePerGas: TQuantity
5
+ maxFeePerGas: TQuantity
6
+ }
7
+
1
8
  export type ZkSyncFeeValues<TQuantity = bigint> = {
2
9
  gasPrice: TQuantity
3
10
  maxFeePerGas: TQuantity
@@ -0,0 +1,7 @@
1
+ import type { Hash } from '../../types/misc.js'
2
+
3
+ export type MessageProof = {
4
+ id: number
5
+ proof: Hash[]
6
+ root: Hash
7
+ }
@@ -1,6 +1,6 @@
1
1
  import type { Address } from 'abitype'
2
2
  import type { FeeValuesEIP1559 } from '../../types/fee.js'
3
- import type { Hex } from '../../types/misc.js'
3
+ import type { Hash, Hex } from '../../types/misc.js'
4
4
  import type {
5
5
  Index,
6
6
  Quantity,
@@ -22,7 +22,7 @@ import type {
22
22
  } from '../../types/transaction.js'
23
23
  import type { ExactPartial, OneOf, UnionOmit } from '../../types/utils.js'
24
24
  import type { ZkSyncEip712Meta } from './eip712.js'
25
- import type { ZkSyncFeeValues } from './fee.js'
25
+ import type { ZkSyncFee, ZkSyncFeeValues } from './fee.js'
26
26
  import type {
27
27
  ZkSyncL2ToL1Log,
28
28
  ZkSyncLog,
@@ -117,7 +117,10 @@ export type ZkSyncRpcTransaction<TPending extends boolean = boolean> =
117
117
  // Transaction Request
118
118
  // https://era.zksync.io/docs/reference/concepts/transactions
119
119
 
120
- type TransactionRequest = TransactionRequest_ & {
120
+ export type TransactionRequest<
121
+ TQuantity = bigint,
122
+ TIndex = number,
123
+ > = TransactionRequest_<TQuantity, TIndex> & {
121
124
  gasPerPubdata?: undefined
122
125
  customSignature?: undefined
123
126
  paymaster?: undefined
@@ -125,10 +128,10 @@ type TransactionRequest = TransactionRequest_ & {
125
128
  factoryDeps?: undefined
126
129
  }
127
130
 
128
- export type ZkSyncTransactionRequestEIP712 = Omit<
129
- TransactionRequestBase,
130
- 'type'
131
- > &
131
+ export type ZkSyncTransactionRequestEIP712<
132
+ TQuantity = bigint,
133
+ TIndex = number,
134
+ > = Omit<TransactionRequestBase<TQuantity, TIndex>, 'type'> &
132
135
  ExactPartial<FeeValuesEIP1559> & {
133
136
  gasPerPubdata?: bigint | undefined
134
137
  customSignature?: Hex | undefined
@@ -139,9 +142,9 @@ export type ZkSyncTransactionRequestEIP712 = Omit<
139
142
  | { paymaster?: undefined; paymasterInput?: undefined }
140
143
  )
141
144
 
142
- export type ZkSyncTransactionRequest =
143
- | TransactionRequest
144
- | ZkSyncTransactionRequestEIP712
145
+ export type ZkSyncTransactionRequest<TQuantity = bigint, TIndex = number> =
146
+ | TransactionRequest<TQuantity, TIndex>
147
+ | ZkSyncTransactionRequestEIP712<TQuantity, TIndex>
145
148
 
146
149
  type RpcTransactionRequest = RpcTransactionRequest_ & { eip712Meta?: undefined }
147
150
 
@@ -243,3 +246,74 @@ export type TransactionRequestEIP712<
243
246
  customSignature?: Hex | undefined
244
247
  type?: TTransactionType | undefined
245
248
  }
249
+
250
+ type CommonDataRawBlockTransaction = {
251
+ sender: Address
252
+ maxFeePerGas: Hex
253
+ gasLimit: Hex
254
+ gasPerPubdataLimit: Hex
255
+ ethHash: Hash
256
+ ethBlock: number
257
+ canonicalTxHash: Hash
258
+ toMint: Hex
259
+ refundRecipient: Address
260
+ }
261
+
262
+ export type ZkSyncRawBlockTransactions = {
263
+ commonData: {
264
+ L1?:
265
+ | ({
266
+ serialId: number
267
+ deadlineBlock: number
268
+ layer2TipFee: Hex
269
+ fullFee: Hex
270
+ opProcessingType: string
271
+ priorityQueueType: string
272
+ } & CommonDataRawBlockTransaction)
273
+ | undefined
274
+ L2?:
275
+ | {
276
+ nonce: number
277
+ fee: ZkSyncFee<Hex>
278
+ initiatorAddress: Address
279
+ signature: Uint8Array
280
+ transactionType: string
281
+ input?:
282
+ | {
283
+ hash: Hash
284
+ data: Uint8Array
285
+ }
286
+ | undefined
287
+ paymasterParams: {
288
+ paymaster: Address
289
+ paymasterInput: Uint8Array
290
+ }
291
+ }
292
+ | undefined
293
+ ProtocolUpgrade?:
294
+ | ({
295
+ upgradeId: string
296
+ } & CommonDataRawBlockTransaction)
297
+ | undefined
298
+ }
299
+ execute: {
300
+ calldata: Hash
301
+ contractAddress: Address
302
+ factoryDeps?: Hash
303
+ value: bigint
304
+ }
305
+ receivedTimestampMs: number
306
+ rawBytes?: string | undefined
307
+ }[]
308
+
309
+ export type ZkSyncTransactionDetails = {
310
+ isL1Originated: boolean
311
+ status: string
312
+ fee: bigint
313
+ gasPerPubdata: bigint
314
+ initiatorAddress: Address
315
+ receivedAt: Date
316
+ ethCommitTxHash?: Hash | undefined
317
+ ethProveTxHash?: Hash | undefined
318
+ ethExecuteTxHash?: Hash | undefined
319
+ }
@@ -0,0 +1,11 @@
1
+ export function camelCaseKeys(response: object): object {
2
+ if (!response) return response
3
+ if (typeof response !== 'object') return response
4
+ if (Array.isArray(response)) return response.map(camelCaseKeys)
5
+ return Object.fromEntries(
6
+ Object.entries(response).map(([key, value]) => [
7
+ key.replace(/_([a-z])/g, (_, letter) => letter.toUpperCase()),
8
+ camelCaseKeys(value),
9
+ ]),
10
+ )
11
+ }
@@ -0,0 +1,20 @@
1
+ import type { Address } from '../../accounts/index.js'
2
+ import {
3
+ ethAddressInContracts,
4
+ l2BaseTokenAddress,
5
+ legacyEthAddress,
6
+ } from '../constants/address.js'
7
+
8
+ export function isEth(token: Address) {
9
+ return (
10
+ token.localeCompare(legacyEthAddress, undefined, {
11
+ sensitivity: 'accent',
12
+ }) === 0 ||
13
+ token.localeCompare(l2BaseTokenAddress, undefined, {
14
+ sensitivity: 'accent',
15
+ }) === 0 ||
16
+ token.localeCompare(ethAddressInContracts, undefined, {
17
+ sensitivity: 'accent',
18
+ }) === 0
19
+ )
20
+ }
@@ -1,7 +1,10 @@
1
1
  import type { Address } from 'abitype'
2
2
  import type { ByteArray, Hex } from '../../../types/misc.js'
3
- import type { EncodeFunctionDataReturnType } from '../../../utils/abi/encodeFunctionData.js'
4
- import { bytesToHex, encodeFunctionData } from '../../../utils/index.js'
3
+ import {
4
+ type EncodeFunctionDataReturnType,
5
+ encodeFunctionData,
6
+ } from '../../../utils/abi/encodeFunctionData.js'
7
+ import { bytesToHex } from '../../../utils/encoding/toHex.js'
5
8
  import { paymasterAbi } from '../../constants/abis.js'
6
9
 
7
10
  export type GetApprovalBasedPaymasterInputParameters = {
@@ -1,6 +1,9 @@
1
1
  import type { ByteArray, Hex } from '../../../types/misc.js'
2
- import type { EncodeFunctionDataReturnType } from '../../../utils/abi/encodeFunctionData.js'
3
- import { bytesToHex, encodeFunctionData } from '../../../utils/index.js'
2
+ import {
3
+ type EncodeFunctionDataReturnType,
4
+ encodeFunctionData,
5
+ } from '../../../utils/abi/encodeFunctionData.js'
6
+ import { bytesToHex } from '../../../utils/encoding/toHex.js'
4
7
  import { paymasterAbi } from '../../constants/abis.js'
5
8
 
6
9
  export type GetGeneralPaymasterInputParameters = {