viem 2.57.17 → 2.57.19

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 (424) hide show
  1. package/CHANGELOG.md +100 -0
  2. package/_cjs/account-abstraction/actions/paymaster/getPaymasterData.js +4 -2
  3. package/_cjs/account-abstraction/actions/paymaster/getPaymasterData.js.map +1 -1
  4. package/_cjs/account-abstraction/actions/paymaster/getPaymasterStubData.js +6 -2
  5. package/_cjs/account-abstraction/actions/paymaster/getPaymasterStubData.js.map +1 -1
  6. package/_cjs/actions/ens/getEnsAddress.js +11 -1
  7. package/_cjs/actions/ens/getEnsAddress.js.map +1 -1
  8. package/_cjs/actions/ens/getEnsText.js.map +1 -1
  9. package/_cjs/actions/index.js +5 -3
  10. package/_cjs/actions/index.js.map +1 -1
  11. package/_cjs/actions/public/call.js +13 -2
  12. package/_cjs/actions/public/call.js.map +1 -1
  13. package/_cjs/actions/public/getDelegation.js +2 -1
  14. package/_cjs/actions/public/getDelegation.js.map +1 -1
  15. package/_cjs/actions/public/getFeeHistory.js.map +1 -1
  16. package/_cjs/actions/public/getLogs.js +18 -1
  17. package/_cjs/actions/public/getLogs.js.map +1 -1
  18. package/_cjs/actions/public/internal/isRangeError.js +18 -0
  19. package/_cjs/actions/public/internal/isRangeError.js.map +1 -0
  20. package/_cjs/actions/public/internal/watchTransport.js +24 -0
  21. package/_cjs/actions/public/internal/watchTransport.js.map +1 -0
  22. package/_cjs/actions/public/iterateLogs.js +48 -0
  23. package/_cjs/actions/public/iterateLogs.js.map +1 -0
  24. package/_cjs/actions/public/simulateContract.js +4 -4
  25. package/_cjs/actions/public/simulateContract.js.map +1 -1
  26. package/_cjs/actions/public/verifyHash.js +72 -39
  27. package/_cjs/actions/public/verifyHash.js.map +1 -1
  28. package/_cjs/actions/public/waitForTransactionReceipt.js +18 -1
  29. package/_cjs/actions/public/waitForTransactionReceipt.js.map +1 -1
  30. package/_cjs/actions/public/watchBlockHeaders.js +2 -10
  31. package/_cjs/actions/public/watchBlockHeaders.js.map +1 -1
  32. package/_cjs/actions/public/watchBlockNumber.js +3 -18
  33. package/_cjs/actions/public/watchBlockNumber.js.map +1 -1
  34. package/_cjs/actions/public/watchBlocks.js +3 -18
  35. package/_cjs/actions/public/watchBlocks.js.map +1 -1
  36. package/_cjs/actions/public/watchContractEvent.js +5 -33
  37. package/_cjs/actions/public/watchContractEvent.js.map +1 -1
  38. package/_cjs/actions/public/watchEvent.js +5 -33
  39. package/_cjs/actions/public/watchEvent.js.map +1 -1
  40. package/_cjs/actions/token/internal.js +2 -10
  41. package/_cjs/actions/token/internal.js.map +1 -1
  42. package/_cjs/actions/wallet/deployContract.js +2 -1
  43. package/_cjs/actions/wallet/deployContract.js.map +1 -1
  44. package/_cjs/actions/wallet/prepareTransactionRequest.js +16 -3
  45. package/_cjs/actions/wallet/prepareTransactionRequest.js.map +1 -1
  46. package/_cjs/actions/wallet/sendCalls.js +2 -1
  47. package/_cjs/actions/wallet/sendCalls.js.map +1 -1
  48. package/_cjs/actions/wallet/signAuthorization.js +2 -1
  49. package/_cjs/actions/wallet/signAuthorization.js.map +1 -1
  50. package/_cjs/celo/serializers.js +1 -1
  51. package/_cjs/celo/serializers.js.map +1 -1
  52. package/_cjs/chains/definitions/kinetiqElysium.js +30 -0
  53. package/_cjs/chains/definitions/kinetiqElysium.js.map +1 -0
  54. package/_cjs/chains/definitions/kinetiqElysiumTestnet.js +31 -0
  55. package/_cjs/chains/definitions/kinetiqElysiumTestnet.js.map +1 -0
  56. package/_cjs/chains/index.js +14 -9
  57. package/_cjs/chains/index.js.map +1 -1
  58. package/_cjs/clients/decorators/public.js +2 -0
  59. package/_cjs/clients/decorators/public.js.map +1 -1
  60. package/_cjs/constants/contracts.js +1 -1
  61. package/_cjs/constants/contracts.js.map +1 -1
  62. package/_cjs/errors/chain.js +2 -2
  63. package/_cjs/errors/chain.js.map +1 -1
  64. package/_cjs/errors/typedData.js +2 -0
  65. package/_cjs/errors/typedData.js.map +1 -1
  66. package/_cjs/errors/version.js +1 -1
  67. package/_cjs/index.js +5 -4
  68. package/_cjs/index.js.map +1 -1
  69. package/_cjs/op-stack/actions/buildProveWithdrawal.js +5 -5
  70. package/_cjs/op-stack/actions/buildProveWithdrawal.js.map +1 -1
  71. package/_cjs/op-stack/actions/getL2Output.js +13 -9
  72. package/_cjs/op-stack/actions/getL2Output.js.map +1 -1
  73. package/_cjs/op-stack/actions/waitToProve.js +1 -0
  74. package/_cjs/op-stack/actions/waitToProve.js.map +1 -1
  75. package/_cjs/tempo/Account.js +30 -0
  76. package/_cjs/tempo/Account.js.map +1 -1
  77. package/_cjs/tempo/actions/accessKey.js +1 -1
  78. package/_cjs/tempo/actions/accessKey.js.map +1 -1
  79. package/_cjs/tempo/actions/accounts.js +19 -9
  80. package/_cjs/tempo/actions/accounts.js.map +1 -1
  81. package/_cjs/tempo/actions/earn/deployment.js +1 -1
  82. package/_cjs/tempo/actions/earn/deployment.js.map +1 -1
  83. package/_cjs/tempo/actions/earn.js +3 -3
  84. package/_cjs/tempo/actions/earn.js.map +1 -1
  85. package/_cjs/tempo/actions/propAmm.js +1 -1
  86. package/_cjs/tempo/actions/propAmm.js.map +1 -1
  87. package/_cjs/tempo/actions/token.js +10 -2
  88. package/_cjs/tempo/actions/token.js.map +1 -1
  89. package/_cjs/tempo/chainConfig.js +37 -1
  90. package/_cjs/tempo/chainConfig.js.map +1 -1
  91. package/_cjs/tempo/internal/preAuthorized.js +214 -0
  92. package/_cjs/tempo/internal/preAuthorized.js.map +1 -0
  93. package/_cjs/tempo/internal/relay/feePayer.js +25 -7
  94. package/_cjs/tempo/internal/relay/feePayer.js.map +1 -1
  95. package/_cjs/tempo/internal/relay.js +2 -2
  96. package/_cjs/tempo/internal/relay.js.map +1 -1
  97. package/_cjs/tempo/internal/utils.js +2 -10
  98. package/_cjs/tempo/internal/utils.js.map +1 -1
  99. package/_cjs/tokens/defineToken.js +1 -1
  100. package/_cjs/tokens/defineToken.js.map +1 -1
  101. package/_cjs/tokens/definitions/ousd.js +1 -0
  102. package/_cjs/tokens/definitions/ousd.js.map +1 -1
  103. package/_cjs/utils/abi/decodeAbiParameters.js +33 -9
  104. package/_cjs/utils/abi/decodeAbiParameters.js.map +1 -1
  105. package/_cjs/utils/abi/encodeAbiParameters.js +5 -4
  106. package/_cjs/utils/abi/encodeAbiParameters.js.map +1 -1
  107. package/_cjs/utils/abi/encodePacked.js +4 -2
  108. package/_cjs/utils/abi/encodePacked.js.map +1 -1
  109. package/_cjs/utils/ccip.js +5 -1
  110. package/_cjs/utils/ccip.js.map +1 -1
  111. package/_cjs/utils/chain/getChainContractAddress.js +2 -2
  112. package/_cjs/utils/chain/getChainContractAddress.js.map +1 -1
  113. package/_cjs/utils/encoding/toBytes.js +5 -6
  114. package/_cjs/utils/encoding/toBytes.js.map +1 -1
  115. package/_cjs/utils/ens/avatar/utils.js +25 -5
  116. package/_cjs/utils/ens/avatar/utils.js.map +1 -1
  117. package/_cjs/utils/ens/localBatchGatewayRequest.js +13 -1
  118. package/_cjs/utils/ens/localBatchGatewayRequest.js.map +1 -1
  119. package/_cjs/utils/promise/createBatchScheduler.js +1 -1
  120. package/_cjs/utils/promise/createBatchScheduler.js.map +1 -1
  121. package/_cjs/utils/siwe/validateSiweMessage.js +5 -0
  122. package/_cjs/utils/siwe/validateSiweMessage.js.map +1 -1
  123. package/_cjs/zksync/actions/estimateFee.js +1 -1
  124. package/_cjs/zksync/actions/estimateFee.js.map +1 -1
  125. package/_cjs/zksync/actions/estimateGasL1ToL2.js +1 -1
  126. package/_cjs/zksync/actions/estimateGasL1ToL2.js.map +1 -1
  127. package/_cjs/zksync/actions/finalizeWithdrawal.js +3 -3
  128. package/_cjs/zksync/actions/finalizeWithdrawal.js.map +1 -1
  129. package/_cjs/zksync/actions/sendEip712Transaction.js +10 -2
  130. package/_cjs/zksync/actions/sendEip712Transaction.js.map +1 -1
  131. package/_cjs/zksync/actions/signEip712Transaction.js +2 -2
  132. package/_cjs/zksync/actions/signEip712Transaction.js.map +1 -1
  133. package/_esm/account-abstraction/actions/paymaster/getPaymasterData.js +4 -2
  134. package/_esm/account-abstraction/actions/paymaster/getPaymasterData.js.map +1 -1
  135. package/_esm/account-abstraction/actions/paymaster/getPaymasterStubData.js +6 -2
  136. package/_esm/account-abstraction/actions/paymaster/getPaymasterStubData.js.map +1 -1
  137. package/_esm/actions/ens/getEnsAddress.js +12 -1
  138. package/_esm/actions/ens/getEnsAddress.js.map +1 -1
  139. package/_esm/actions/ens/getEnsText.js.map +1 -1
  140. package/_esm/actions/index.js +1 -0
  141. package/_esm/actions/index.js.map +1 -1
  142. package/_esm/actions/public/call.js +13 -2
  143. package/_esm/actions/public/call.js.map +1 -1
  144. package/_esm/actions/public/getDelegation.js +2 -1
  145. package/_esm/actions/public/getDelegation.js.map +1 -1
  146. package/_esm/actions/public/getFeeHistory.js.map +1 -1
  147. package/_esm/actions/public/getLogs.js +18 -1
  148. package/_esm/actions/public/getLogs.js.map +1 -1
  149. package/_esm/actions/public/internal/isRangeError.js +19 -0
  150. package/_esm/actions/public/internal/isRangeError.js.map +1 -0
  151. package/_esm/actions/public/internal/watchTransport.js +22 -0
  152. package/_esm/actions/public/internal/watchTransport.js.map +1 -0
  153. package/_esm/actions/public/iterateLogs.js +84 -0
  154. package/_esm/actions/public/iterateLogs.js.map +1 -0
  155. package/_esm/actions/public/simulateContract.js +5 -4
  156. package/_esm/actions/public/simulateContract.js.map +1 -1
  157. package/_esm/actions/public/verifyHash.js +77 -40
  158. package/_esm/actions/public/verifyHash.js.map +1 -1
  159. package/_esm/actions/public/waitForTransactionReceipt.js +20 -1
  160. package/_esm/actions/public/waitForTransactionReceipt.js.map +1 -1
  161. package/_esm/actions/public/watchBlockHeaders.js +2 -10
  162. package/_esm/actions/public/watchBlockHeaders.js.map +1 -1
  163. package/_esm/actions/public/watchBlockNumber.js +3 -18
  164. package/_esm/actions/public/watchBlockNumber.js.map +1 -1
  165. package/_esm/actions/public/watchBlocks.js +3 -18
  166. package/_esm/actions/public/watchBlocks.js.map +1 -1
  167. package/_esm/actions/public/watchContractEvent.js +4 -36
  168. package/_esm/actions/public/watchContractEvent.js.map +1 -1
  169. package/_esm/actions/public/watchEvent.js +4 -36
  170. package/_esm/actions/public/watchEvent.js.map +1 -1
  171. package/_esm/actions/token/internal.js +2 -10
  172. package/_esm/actions/token/internal.js.map +1 -1
  173. package/_esm/actions/wallet/deployContract.js +2 -1
  174. package/_esm/actions/wallet/deployContract.js.map +1 -1
  175. package/_esm/actions/wallet/prepareTransactionRequest.js +17 -3
  176. package/_esm/actions/wallet/prepareTransactionRequest.js.map +1 -1
  177. package/_esm/actions/wallet/sendCalls.js +2 -1
  178. package/_esm/actions/wallet/sendCalls.js.map +1 -1
  179. package/_esm/actions/wallet/signAuthorization.js +2 -1
  180. package/_esm/actions/wallet/signAuthorization.js.map +1 -1
  181. package/_esm/celo/serializers.js +1 -1
  182. package/_esm/celo/serializers.js.map +1 -1
  183. package/_esm/chains/definitions/kinetiqElysium.js +27 -0
  184. package/_esm/chains/definitions/kinetiqElysium.js.map +1 -0
  185. package/_esm/chains/definitions/kinetiqElysiumTestnet.js +28 -0
  186. package/_esm/chains/definitions/kinetiqElysiumTestnet.js.map +1 -0
  187. package/_esm/chains/index.js +2 -0
  188. package/_esm/chains/index.js.map +1 -1
  189. package/_esm/clients/decorators/public.js +2 -0
  190. package/_esm/clients/decorators/public.js.map +1 -1
  191. package/_esm/constants/contracts.js +1 -1
  192. package/_esm/constants/contracts.js.map +1 -1
  193. package/_esm/errors/chain.js +2 -2
  194. package/_esm/errors/chain.js.map +1 -1
  195. package/_esm/errors/typedData.js +2 -0
  196. package/_esm/errors/typedData.js.map +1 -1
  197. package/_esm/errors/version.js +1 -1
  198. package/_esm/index.js +1 -1
  199. package/_esm/index.js.map +1 -1
  200. package/_esm/op-stack/actions/buildProveWithdrawal.js +5 -5
  201. package/_esm/op-stack/actions/buildProveWithdrawal.js.map +1 -1
  202. package/_esm/op-stack/actions/getL2Output.js +14 -9
  203. package/_esm/op-stack/actions/getL2Output.js.map +1 -1
  204. package/_esm/op-stack/actions/waitToProve.js +1 -0
  205. package/_esm/op-stack/actions/waitToProve.js.map +1 -1
  206. package/_esm/tempo/Account.js +33 -1
  207. package/_esm/tempo/Account.js.map +1 -1
  208. package/_esm/tempo/actions/accessKey.js +1 -1
  209. package/_esm/tempo/actions/accessKey.js.map +1 -1
  210. package/_esm/tempo/actions/accounts.js +24 -10
  211. package/_esm/tempo/actions/accounts.js.map +1 -1
  212. package/_esm/tempo/actions/earn/deployment.js +1 -1
  213. package/_esm/tempo/actions/earn/deployment.js.map +1 -1
  214. package/_esm/tempo/actions/earn.js +3 -3
  215. package/_esm/tempo/actions/earn.js.map +1 -1
  216. package/_esm/tempo/actions/propAmm.js +1 -1
  217. package/_esm/tempo/actions/propAmm.js.map +1 -1
  218. package/_esm/tempo/actions/token.js +10 -2
  219. package/_esm/tempo/actions/token.js.map +1 -1
  220. package/_esm/tempo/chainConfig.js +41 -1
  221. package/_esm/tempo/chainConfig.js.map +1 -1
  222. package/_esm/tempo/internal/preAuthorized.js +244 -0
  223. package/_esm/tempo/internal/preAuthorized.js.map +1 -0
  224. package/_esm/tempo/internal/relay/feePayer.js +26 -7
  225. package/_esm/tempo/internal/relay/feePayer.js.map +1 -1
  226. package/_esm/tempo/internal/relay.js +8 -3
  227. package/_esm/tempo/internal/relay.js.map +1 -1
  228. package/_esm/tempo/internal/utils.js +2 -10
  229. package/_esm/tempo/internal/utils.js.map +1 -1
  230. package/_esm/tokens/defineToken.js +2 -1
  231. package/_esm/tokens/defineToken.js.map +1 -1
  232. package/_esm/tokens/definitions/ousd.js +2 -1
  233. package/_esm/tokens/definitions/ousd.js.map +1 -1
  234. package/_esm/utils/abi/decodeAbiParameters.js +37 -9
  235. package/_esm/utils/abi/decodeAbiParameters.js.map +1 -1
  236. package/_esm/utils/abi/encodeAbiParameters.js +6 -4
  237. package/_esm/utils/abi/encodeAbiParameters.js.map +1 -1
  238. package/_esm/utils/abi/encodePacked.js +5 -2
  239. package/_esm/utils/abi/encodePacked.js.map +1 -1
  240. package/_esm/utils/ccip.js +8 -3
  241. package/_esm/utils/ccip.js.map +1 -1
  242. package/_esm/utils/chain/getChainContractAddress.js +2 -2
  243. package/_esm/utils/chain/getChainContractAddress.js.map +1 -1
  244. package/_esm/utils/encoding/toBytes.js +5 -6
  245. package/_esm/utils/encoding/toBytes.js.map +1 -1
  246. package/_esm/utils/ens/avatar/utils.js +26 -5
  247. package/_esm/utils/ens/avatar/utils.js.map +1 -1
  248. package/_esm/utils/ens/localBatchGatewayRequest.js +17 -1
  249. package/_esm/utils/ens/localBatchGatewayRequest.js.map +1 -1
  250. package/_esm/utils/promise/createBatchScheduler.js +2 -1
  251. package/_esm/utils/promise/createBatchScheduler.js.map +1 -1
  252. package/_esm/utils/siwe/validateSiweMessage.js +6 -0
  253. package/_esm/utils/siwe/validateSiweMessage.js.map +1 -1
  254. package/_esm/zksync/actions/estimateFee.js +1 -1
  255. package/_esm/zksync/actions/estimateFee.js.map +1 -1
  256. package/_esm/zksync/actions/estimateGasL1ToL2.js +1 -1
  257. package/_esm/zksync/actions/estimateGasL1ToL2.js.map +1 -1
  258. package/_esm/zksync/actions/finalizeWithdrawal.js +3 -3
  259. package/_esm/zksync/actions/finalizeWithdrawal.js.map +1 -1
  260. package/_esm/zksync/actions/sendEip712Transaction.js +12 -2
  261. package/_esm/zksync/actions/sendEip712Transaction.js.map +1 -1
  262. package/_esm/zksync/actions/signEip712Transaction.js +2 -2
  263. package/_esm/zksync/actions/signEip712Transaction.js.map +1 -1
  264. package/_types/account-abstraction/actions/paymaster/getPaymasterData.d.ts.map +1 -1
  265. package/_types/account-abstraction/actions/paymaster/getPaymasterStubData.d.ts.map +1 -1
  266. package/_types/actions/ens/getEnsAddress.d.ts +2 -1
  267. package/_types/actions/ens/getEnsAddress.d.ts.map +1 -1
  268. package/_types/actions/ens/getEnsText.d.ts +2 -1
  269. package/_types/actions/ens/getEnsText.d.ts.map +1 -1
  270. package/_types/actions/index.d.ts +1 -0
  271. package/_types/actions/index.d.ts.map +1 -1
  272. package/_types/actions/public/call.d.ts.map +1 -1
  273. package/_types/actions/public/getDelegation.d.ts.map +1 -1
  274. package/_types/actions/public/getFeeHistory.d.ts +2 -1
  275. package/_types/actions/public/getFeeHistory.d.ts.map +1 -1
  276. package/_types/actions/public/getLogs.d.ts +20 -2
  277. package/_types/actions/public/getLogs.d.ts.map +1 -1
  278. package/_types/actions/public/internal/isRangeError.d.ts +3 -0
  279. package/_types/actions/public/internal/isRangeError.d.ts.map +1 -0
  280. package/_types/actions/public/internal/watchTransport.d.ts +6 -0
  281. package/_types/actions/public/internal/watchTransport.d.ts.map +1 -0
  282. package/_types/actions/public/iterateLogs.d.ts +94 -0
  283. package/_types/actions/public/iterateLogs.d.ts.map +1 -0
  284. package/_types/actions/public/simulateContract.d.ts.map +1 -1
  285. package/_types/actions/public/verifyHash.d.ts +2 -1
  286. package/_types/actions/public/verifyHash.d.ts.map +1 -1
  287. package/_types/actions/public/waitForTransactionReceipt.d.ts +7 -2
  288. package/_types/actions/public/waitForTransactionReceipt.d.ts.map +1 -1
  289. package/_types/actions/public/watchBlockHeaders.d.ts.map +1 -1
  290. package/_types/actions/public/watchBlockNumber.d.ts.map +1 -1
  291. package/_types/actions/public/watchBlocks.d.ts.map +1 -1
  292. package/_types/actions/public/watchContractEvent.d.ts.map +1 -1
  293. package/_types/actions/public/watchEvent.d.ts.map +1 -1
  294. package/_types/actions/token/internal.d.ts.map +1 -1
  295. package/_types/actions/wallet/deployContract.d.ts.map +1 -1
  296. package/_types/actions/wallet/prepareTransactionRequest.d.ts +3 -1
  297. package/_types/actions/wallet/prepareTransactionRequest.d.ts.map +1 -1
  298. package/_types/actions/wallet/sendCalls.d.ts.map +1 -1
  299. package/_types/actions/wallet/signAuthorization.d.ts.map +1 -1
  300. package/_types/celo/serializers.d.ts.map +1 -1
  301. package/_types/chains/definitions/kinetiqElysium.d.ts +52 -0
  302. package/_types/chains/definitions/kinetiqElysium.d.ts.map +1 -0
  303. package/_types/chains/definitions/kinetiqElysiumTestnet.d.ts +52 -0
  304. package/_types/chains/definitions/kinetiqElysiumTestnet.d.ts.map +1 -0
  305. package/_types/chains/index.d.ts +2 -0
  306. package/_types/chains/index.d.ts.map +1 -1
  307. package/_types/clients/decorators/public.d.ts +33 -0
  308. package/_types/clients/decorators/public.d.ts.map +1 -1
  309. package/_types/constants/contracts.d.ts +1 -1
  310. package/_types/constants/contracts.d.ts.map +1 -1
  311. package/_types/errors/typedData.d.ts.map +1 -1
  312. package/_types/errors/version.d.ts +1 -1
  313. package/_types/index.d.ts +2 -1
  314. package/_types/index.d.ts.map +1 -1
  315. package/_types/op-stack/actions/getL2Output.d.ts +6 -0
  316. package/_types/op-stack/actions/getL2Output.d.ts.map +1 -1
  317. package/_types/op-stack/actions/waitToProve.d.ts.map +1 -1
  318. package/_types/tempo/Account.d.ts +5 -1
  319. package/_types/tempo/Account.d.ts.map +1 -1
  320. package/_types/tempo/actions/accounts.d.ts +4 -1
  321. package/_types/tempo/actions/accounts.d.ts.map +1 -1
  322. package/_types/tempo/actions/earn/deployment.d.ts.map +1 -1
  323. package/_types/tempo/actions/propAmm.d.ts.map +1 -1
  324. package/_types/tempo/actions/token.d.ts.map +1 -1
  325. package/_types/tempo/chainConfig.d.ts.map +1 -1
  326. package/_types/tempo/internal/preAuthorized.d.ts +41 -0
  327. package/_types/tempo/internal/preAuthorized.d.ts.map +1 -0
  328. package/_types/tempo/internal/relay/feePayer.d.ts.map +1 -1
  329. package/_types/tempo/internal/utils.d.ts.map +1 -1
  330. package/_types/tokens/defineToken.d.ts +5 -1
  331. package/_types/tokens/defineToken.d.ts.map +1 -1
  332. package/_types/tokens/definitions/ousd.d.ts +2 -1
  333. package/_types/tokens/definitions/ousd.d.ts.map +1 -1
  334. package/_types/tokens/sets.d.ts +3 -0
  335. package/_types/tokens/sets.d.ts.map +1 -1
  336. package/_types/utils/abi/decodeAbiParameters.d.ts +15 -1
  337. package/_types/utils/abi/decodeAbiParameters.d.ts.map +1 -1
  338. package/_types/utils/abi/encodeAbiParameters.d.ts.map +1 -1
  339. package/_types/utils/ccip.d.ts +4 -3
  340. package/_types/utils/ccip.d.ts.map +1 -1
  341. package/_types/utils/encoding/toBytes.d.ts +1 -1
  342. package/_types/utils/encoding/toBytes.d.ts.map +1 -1
  343. package/_types/utils/ens/avatar/utils.d.ts +6 -2
  344. package/_types/utils/ens/avatar/utils.d.ts.map +1 -1
  345. package/_types/utils/ens/localBatchGatewayRequest.d.ts +6 -1
  346. package/_types/utils/ens/localBatchGatewayRequest.d.ts.map +1 -1
  347. package/_types/utils/promise/createBatchScheduler.d.ts.map +1 -1
  348. package/_types/utils/siwe/validateSiweMessage.d.ts.map +1 -1
  349. package/_types/zksync/actions/estimateFee.d.ts.map +1 -1
  350. package/_types/zksync/actions/estimateGasL1ToL2.d.ts.map +1 -1
  351. package/_types/zksync/actions/finalizeWithdrawal.d.ts.map +1 -1
  352. package/_types/zksync/actions/sendEip712Transaction.d.ts +1 -1
  353. package/_types/zksync/actions/sendEip712Transaction.d.ts.map +1 -1
  354. package/_types/zksync/errors/bridge.d.ts +1 -1
  355. package/_types/zksync/errors/bridge.d.ts.map +1 -1
  356. package/account-abstraction/actions/paymaster/getPaymasterData.ts +23 -16
  357. package/account-abstraction/actions/paymaster/getPaymasterStubData.ts +27 -16
  358. package/actions/ens/getEnsAddress.ts +15 -1
  359. package/actions/ens/getEnsText.ts +2 -0
  360. package/actions/index.ts +6 -0
  361. package/actions/public/call.ts +15 -2
  362. package/actions/public/getDelegation.ts +6 -1
  363. package/actions/public/getFeeHistory.ts +2 -0
  364. package/actions/public/getLogs.ts +44 -0
  365. package/actions/public/internal/isRangeError.ts +18 -0
  366. package/actions/public/internal/watchTransport.ts +29 -0
  367. package/actions/public/iterateLogs.ts +209 -0
  368. package/actions/public/simulateContract.ts +6 -4
  369. package/actions/public/verifyHash.ts +87 -60
  370. package/actions/public/waitForTransactionReceipt.ts +31 -1
  371. package/actions/public/watchBlockHeaders.ts +2 -12
  372. package/actions/public/watchBlockNumber.ts +6 -24
  373. package/actions/public/watchBlocks.ts +6 -24
  374. package/actions/public/watchContractEvent.ts +7 -42
  375. package/actions/public/watchEvent.ts +7 -42
  376. package/actions/token/internal.ts +2 -10
  377. package/actions/wallet/deployContract.ts +6 -1
  378. package/actions/wallet/prepareTransactionRequest.ts +25 -3
  379. package/actions/wallet/sendCalls.ts +6 -1
  380. package/actions/wallet/signAuthorization.ts +6 -1
  381. package/celo/serializers.ts +5 -2
  382. package/chains/definitions/kinetiqElysium.ts +27 -0
  383. package/chains/definitions/kinetiqElysiumTestnet.ts +28 -0
  384. package/chains/index.ts +2 -0
  385. package/clients/decorators/public.ts +47 -0
  386. package/constants/contracts.ts +1 -1
  387. package/errors/chain.ts +2 -2
  388. package/errors/typedData.ts +2 -0
  389. package/errors/version.ts +1 -1
  390. package/index.ts +7 -0
  391. package/op-stack/actions/buildProveWithdrawal.ts +5 -5
  392. package/op-stack/actions/getL2Output.ts +24 -11
  393. package/op-stack/actions/waitToProve.ts +1 -0
  394. package/package.json +2 -2
  395. package/tempo/Account.ts +38 -1
  396. package/tempo/actions/accessKey.ts +1 -1
  397. package/tempo/actions/accounts.ts +29 -11
  398. package/tempo/actions/earn/deployment.ts +2 -1
  399. package/tempo/actions/earn.ts +2 -2
  400. package/tempo/actions/propAmm.ts +2 -1
  401. package/tempo/actions/token.ts +10 -2
  402. package/tempo/chainConfig.ts +53 -5
  403. package/tempo/internal/preAuthorized.ts +309 -0
  404. package/tempo/internal/relay/feePayer.ts +33 -11
  405. package/tempo/internal/relay.ts +8 -3
  406. package/tempo/internal/utils.ts +2 -10
  407. package/tokens/defineToken.ts +6 -2
  408. package/tokens/definitions/ousd.ts +2 -1
  409. package/utils/abi/decodeAbiParameters.ts +60 -9
  410. package/utils/abi/encodeAbiParameters.ts +6 -4
  411. package/utils/abi/encodePacked.ts +5 -1
  412. package/utils/ccip.ts +17 -3
  413. package/utils/chain/getChainContractAddress.ts +2 -2
  414. package/utils/encoding/toBytes.ts +4 -6
  415. package/utils/ens/avatar/utils.ts +38 -4
  416. package/utils/ens/localBatchGatewayRequest.ts +21 -2
  417. package/utils/promise/createBatchScheduler.ts +2 -1
  418. package/utils/siwe/validateSiweMessage.ts +7 -0
  419. package/zksync/actions/estimateFee.ts +2 -1
  420. package/zksync/actions/estimateGasL1ToL2.ts +2 -1
  421. package/zksync/actions/finalizeWithdrawal.ts +4 -3
  422. package/zksync/actions/sendEip712Transaction.ts +21 -8
  423. package/zksync/actions/signEip712Transaction.ts +3 -3
  424. package/zksync/errors/bridge.ts +1 -1
@@ -13,7 +13,11 @@ import {
13
13
  WaitForTransactionReceiptTimeoutError,
14
14
  type WaitForTransactionReceiptTimeoutErrorType,
15
15
  } from '../../errors/transaction.js'
16
- import type { ErrorType } from '../../errors/utils.js'
16
+ import {
17
+ type AbortErrorType,
18
+ type ErrorType,
19
+ getAbortError,
20
+ } from '../../errors/utils.js'
17
21
  import type { Chain } from '../../types/chain.js'
18
22
  import type { Hash, Hex } from '../../types/misc.js'
19
23
  import type { Transaction } from '../../types/transaction.js'
@@ -26,6 +30,7 @@ import {
26
30
  withRetry,
27
31
  } from '../../utils/promise/withRetry.js'
28
32
  import { stringify } from '../../utils/stringify.js'
33
+ import { uid } from '../../utils/uid.js'
29
34
 
30
35
  import { type GetBlockErrorType, getBlock } from './getBlock.js'
31
36
  import {
@@ -117,6 +122,11 @@ export type WaitForTransactionReceiptParameters<
117
122
  * @default `({ count }) => ~~(1 << count) * 200` (exponential backoff)
118
123
  */
119
124
  retryDelay?: WithRetryParameters['delay'] | undefined
125
+ /**
126
+ * Signal that stops the wait. Aborting rejects with the signal's reason and
127
+ * stops polling and retries. It does not cancel the transaction.
128
+ */
129
+ signal?: AbortSignal | undefined
120
130
  /**
121
131
  * Optional timeout (in milliseconds) to wait before stopping polling.
122
132
  * @default 180_000
@@ -125,6 +135,7 @@ export type WaitForTransactionReceiptParameters<
125
135
  }
126
136
 
127
137
  export type WaitForTransactionReceiptErrorType =
138
+ | AbortErrorType
128
139
  | ObserveErrorType
129
140
  | GetBlockErrorType
130
141
  | GetTransactionErrorType
@@ -188,9 +199,12 @@ export async function waitForTransactionReceipt<
188
199
  onReplaced,
189
200
  retryCount = 6,
190
201
  retryDelay = ({ count }) => ~~(1 << count) * 200, // exponential backoff
202
+ signal,
191
203
  timeout = 180_000,
192
204
  } = parameters
193
205
 
206
+ if (signal?.aborted) throw getAbortError(signal)
207
+
194
208
  // On chains with their own replacement keys, a sender and nonce do not
195
209
  // identify a nonce slot.
196
210
  const replacement = client.chain?.transactionReplacement?.getKey
@@ -221,6 +235,9 @@ export async function waitForTransactionReceipt<
221
235
  pollingInterval,
222
236
  replacement,
223
237
  retryCount,
238
+ // A cancellable wait polls on its own, so aborting it cannot stop
239
+ // polling for another caller.
240
+ signal: signal ? uid() : undefined,
224
241
  timeout,
225
242
  },
226
243
  ])
@@ -249,6 +266,14 @@ export async function waitForTransactionReceipt<
249
266
  }, timeout)
250
267
  : undefined
251
268
 
269
+ const onAbort = () => {
270
+ clearTimeout(timer)
271
+ _unwatch?.()
272
+ _unobserve?.()
273
+ reject(getAbortError(signal))
274
+ }
275
+ signal?.addEventListener('abort', onAbort, { once: true })
276
+
252
277
  _unobserve = observe(
253
278
  observerId,
254
279
  { onReplaced, resolve, reject },
@@ -259,6 +284,8 @@ export async function waitForTransactionReceipt<
259
284
  'getTransactionReceipt',
260
285
  )({ hash }).catch(() => undefined)
261
286
 
287
+ if (signal?.aborted) return
288
+
262
289
  if (receipt && confirmations <= 1) {
263
290
  clearTimeout(timer)
264
291
  emit.resolve(receipt)
@@ -350,6 +377,7 @@ export async function waitForTransactionReceipt<
350
377
  {
351
378
  delay: retryDelay,
352
379
  retryCount,
380
+ signal,
353
381
  // A dropped transaction does not reappear, so a known
354
382
  // sender and nonce are looked up without the retries.
355
383
  shouldRetry: ({ error }) =>
@@ -498,6 +526,7 @@ export async function waitForTransactionReceipt<
498
526
  {
499
527
  delay: retryDelay,
500
528
  retryCount,
529
+ signal,
501
530
  shouldRetry: ({ error }) =>
502
531
  error instanceof BlockNotFoundError,
503
532
  },
@@ -589,6 +618,7 @@ export async function waitForTransactionReceipt<
589
618
  // never start polling again. The timer is cleared here as well, since a
590
619
  // caller that resolves through another caller's poll never reaches `done`.
591
620
  return promise.finally(() => {
621
+ signal?.removeEventListener('abort', onAbort)
592
622
  clearTimeout(timer)
593
623
  _unobserve?.()
594
624
  })
@@ -8,6 +8,7 @@ import { observe } from '../../utils/observe.js'
8
8
  import { type StringifyErrorType, stringify } from '../../utils/stringify.js'
9
9
 
10
10
  import type { GetBlockReturnType } from './getBlock.js'
11
+ import { getSubscriptionTransport } from './internal/watchTransport.js'
11
12
 
12
13
  const blockFields = [
13
14
  'size',
@@ -88,18 +89,7 @@ export function watchBlockHeaders<
88
89
  let unsubscribe = () => (active = false)
89
90
  ;(async () => {
90
91
  try {
91
- const transport = (() => {
92
- if (client.transport.type === 'fallback') {
93
- const transport = client.transport.transports.find(
94
- (transport: ReturnType<Transport>) =>
95
- transport.config.type === 'webSocket' ||
96
- transport.config.type === 'ipc',
97
- )
98
- if (!transport) return client.transport
99
- return transport.value
100
- }
101
- return client.transport
102
- })()
92
+ const transport = getSubscriptionTransport(client)
103
93
 
104
94
  const { unsubscribe: unsubscribe_ } = await transport.subscribe({
105
95
  params: ['newHeads'],
@@ -13,6 +13,10 @@ import {
13
13
  type GetBlockNumberReturnType,
14
14
  getBlockNumber,
15
15
  } from './getBlockNumber.js'
16
+ import {
17
+ getSubscriptionTransport,
18
+ shouldPoll,
19
+ } from './internal/watchTransport.js'
16
20
 
17
21
  export type OnBlockNumberParameter = GetBlockNumberReturnType
18
22
  export type OnBlockNumberFn = (
@@ -97,18 +101,7 @@ export function watchBlockNumber<
97
101
  ): WatchBlockNumberReturnType {
98
102
  const enablePolling = (() => {
99
103
  if (typeof poll_ !== 'undefined') return poll_
100
- if (
101
- client.transport.type === 'webSocket' ||
102
- client.transport.type === 'ipc'
103
- )
104
- return false
105
- if (
106
- client.transport.type === 'fallback' &&
107
- (client.transport.transports[0].config.type === 'webSocket' ||
108
- client.transport.transports[0].config.type === 'ipc')
109
- )
110
- return false
111
- return true
104
+ return shouldPoll(client)
112
105
  })()
113
106
  // Polling less than twice per block skips blocks, so emit the missed
114
107
  // ones unless told otherwise.
@@ -186,18 +179,7 @@ export function watchBlockNumber<
186
179
  let unsubscribe = () => (active = false)
187
180
  ;(async () => {
188
181
  try {
189
- const transport = (() => {
190
- if (client.transport.type === 'fallback') {
191
- const transport = client.transport.transports.find(
192
- (transport: ReturnType<Transport>) =>
193
- transport.config.type === 'webSocket' ||
194
- transport.config.type === 'ipc',
195
- )
196
- if (!transport) return client.transport
197
- return transport.value
198
- }
199
- return client.transport
200
- })()
182
+ const transport = getSubscriptionTransport(client)
201
183
 
202
184
  const { unsubscribe: unsubscribe_ } = await transport.subscribe({
203
185
  params: ['newHeads'],
@@ -10,6 +10,10 @@ import { type PollErrorType, poll } from '../../utils/poll.js'
10
10
  import { type StringifyErrorType, stringify } from '../../utils/stringify.js'
11
11
 
12
12
  import { type GetBlockReturnType, getBlock } from './getBlock.js'
13
+ import {
14
+ getSubscriptionTransport,
15
+ shouldPoll,
16
+ } from './internal/watchTransport.js'
13
17
 
14
18
  export type OnBlockParameter<
15
19
  chain extends Chain | undefined = Chain,
@@ -120,18 +124,7 @@ export function watchBlocks<
120
124
  ): WatchBlocksReturnType {
121
125
  const enablePolling = (() => {
122
126
  if (typeof poll_ !== 'undefined') return poll_
123
- if (
124
- client.transport.type === 'webSocket' ||
125
- client.transport.type === 'ipc'
126
- )
127
- return false
128
- if (
129
- client.transport.type === 'fallback' &&
130
- (client.transport.transports[0].config.type === 'webSocket' ||
131
- client.transport.transports[0].config.type === 'ipc')
132
- )
133
- return false
134
- return true
127
+ return shouldPoll(client)
135
128
  })()
136
129
  const includeTransactions = includeTransactions_ ?? false
137
130
  // Polling less than twice per block skips blocks, so emit the missed
@@ -260,18 +253,7 @@ export function watchBlocks<
260
253
  .catch(onError)
261
254
  }
262
255
 
263
- const transport = (() => {
264
- if (client.transport.type === 'fallback') {
265
- const transport = client.transport.transports.find(
266
- (transport: ReturnType<Transport>) =>
267
- transport.config.type === 'webSocket' ||
268
- transport.config.type === 'ipc',
269
- )
270
- if (!transport) return client.transport
271
- return transport.value
272
- }
273
- return client.transport
274
- })()
256
+ const transport = getSubscriptionTransport(client)
275
257
 
276
258
  const { unsubscribe: unsubscribe_ } = await transport.subscribe({
277
259
  params: ['newHeads'],
@@ -8,8 +8,6 @@ import {
8
8
  DecodeLogDataMismatch,
9
9
  DecodeLogTopicsMismatch,
10
10
  } from '../../errors/abi.js'
11
- import { BaseError } from '../../errors/base.js'
12
- import { HttpRequestError, RpcRequestError } from '../../errors/request.js'
13
11
  import { InvalidInputRpcError } from '../../errors/rpc.js'
14
12
  import type { ErrorType } from '../../errors/utils.js'
15
13
  import type { BlockNumber } from '../../types/block.js'
@@ -42,6 +40,11 @@ import {
42
40
  getContractEvents,
43
41
  } from './getContractEvents.js'
44
42
  import { getFilterChanges } from './getFilterChanges.js'
43
+ import { isRangeError } from './internal/isRangeError.js'
44
+ import {
45
+ getSubscriptionTransport,
46
+ shouldPoll,
47
+ } from './internal/watchTransport.js'
45
48
  import { uninstallFilter } from './uninstallFilter.js'
46
49
 
47
50
  export type WatchContractEventOnLogsParameter<
@@ -163,18 +166,7 @@ export function watchContractEvent<
163
166
  const enablePolling = (() => {
164
167
  if (typeof poll_ !== 'undefined') return poll_
165
168
  if (typeof fromBlock === 'bigint') return true
166
- if (
167
- client.transport.type === 'webSocket' ||
168
- client.transport.type === 'ipc'
169
- )
170
- return false
171
- if (
172
- client.transport.type === 'fallback' &&
173
- (client.transport.transports[0].config.type === 'webSocket' ||
174
- client.transport.transports[0].config.type === 'ipc')
175
- )
176
- return false
177
- return true
169
+ return shouldPoll(client)
178
170
  })()
179
171
 
180
172
  const pollContractEvent = () => {
@@ -332,18 +324,7 @@ export function watchContractEvent<
332
324
  return observe(observerId, { onLogs, onError }, (emit) => {
333
325
  ;(async () => {
334
326
  try {
335
- const transport = (() => {
336
- if (client.transport.type === 'fallback') {
337
- const transport = client.transport.transports.find(
338
- (transport: ReturnType<Transport>) =>
339
- transport.config.type === 'webSocket' ||
340
- transport.config.type === 'ipc',
341
- )
342
- if (!transport) return client.transport
343
- return transport.value
344
- }
345
- return client.transport
346
- })()
327
+ const transport = getSubscriptionTransport(client)
347
328
 
348
329
  // A topic filter cannot select an anonymous event, so the
349
330
  // subscription can deliver logs that match no requested event. Skip
@@ -422,19 +403,3 @@ export function watchContractEvent<
422
403
 
423
404
  return enablePolling ? pollContractEvent() : subscribeContractEvent()
424
405
  }
425
-
426
- /** Returns whether a failed `eth_getLogs` request may succeed with a smaller block range. */
427
- function isRangeError(error: unknown) {
428
- if (!(error instanceof BaseError)) return true
429
- const cause = error.walk(
430
- (err) => err instanceof HttpRequestError || err instanceof RpcRequestError,
431
- ) as HttpRequestError | RpcRequestError | null
432
- if (!cause) return true
433
- // Rate limited.
434
- if (cause instanceof RpcRequestError && cause.code === 429) return false
435
- // Unreachable.
436
- if (cause instanceof HttpRequestError && cause.status === undefined)
437
- return false
438
- // Unauthorized, forbidden or rate limited.
439
- return cause.status !== 401 && cause.status !== 403 && cause.status !== 429
440
- }
@@ -8,8 +8,6 @@ import {
8
8
  DecodeLogDataMismatch,
9
9
  DecodeLogTopicsMismatch,
10
10
  } from '../../errors/abi.js'
11
- import { BaseError } from '../../errors/base.js'
12
- import { HttpRequestError, RpcRequestError } from '../../errors/request.js'
13
11
  import { InvalidInputRpcError } from '../../errors/rpc.js'
14
12
  import type { ErrorType } from '../../errors/utils.js'
15
13
  import type { BlockNumber } from '../../types/block.js'
@@ -42,6 +40,11 @@ import {
42
40
  import { getBlockNumber } from './getBlockNumber.js'
43
41
  import { getFilterChanges } from './getFilterChanges.js'
44
42
  import { type GetLogsParameters, getLogs } from './getLogs.js'
43
+ import { isRangeError } from './internal/isRangeError.js'
44
+ import {
45
+ getSubscriptionTransport,
46
+ shouldPoll,
47
+ } from './internal/watchTransport.js'
45
48
  import { uninstallFilter } from './uninstallFilter.js'
46
49
 
47
50
  export type WatchEventOnLogsParameter<
@@ -183,18 +186,7 @@ export function watchEvent<
183
186
  const enablePolling = (() => {
184
187
  if (typeof poll_ !== 'undefined') return poll_
185
188
  if (typeof fromBlock === 'bigint') return true
186
- if (
187
- client.transport.type === 'webSocket' ||
188
- client.transport.type === 'ipc'
189
- )
190
- return false
191
- if (
192
- client.transport.type === 'fallback' &&
193
- (client.transport.transports[0].config.type === 'webSocket' ||
194
- client.transport.transports[0].config.type === 'ipc')
195
- )
196
- return false
197
- return true
189
+ return shouldPoll(client)
198
190
  })()
199
191
  const strict = strict_ ?? false
200
192
 
@@ -344,18 +336,7 @@ export function watchEvent<
344
336
  let unsubscribe = () => (active = false)
345
337
  ;(async () => {
346
338
  try {
347
- const transport = (() => {
348
- if (client.transport.type === 'fallback') {
349
- const transport = client.transport.transports.find(
350
- (transport: ReturnType<Transport>) =>
351
- transport.config.type === 'webSocket' ||
352
- transport.config.type === 'ipc',
353
- )
354
- if (!transport) return client.transport
355
- return transport.value
356
- }
357
- return client.transport
358
- })()
339
+ const transport = getSubscriptionTransport(client)
359
340
 
360
341
  const events_ = events ?? (event ? [event] : undefined)
361
342
  let topics: LogTopic[] = []
@@ -435,19 +416,3 @@ export function watchEvent<
435
416
 
436
417
  return enablePolling ? pollEvent() : subscribeEvent()
437
418
  }
438
-
439
- /** Returns whether a failed `eth_getLogs` request may succeed with a smaller block range. */
440
- function isRangeError(error: unknown) {
441
- if (!(error instanceof BaseError)) return true
442
- const cause = error.walk(
443
- (err) => err instanceof HttpRequestError || err instanceof RpcRequestError,
444
- ) as HttpRequestError | RpcRequestError | null
445
- if (!cause) return true
446
- // Rate limited.
447
- if (cause instanceof RpcRequestError && cause.code === 429) return false
448
- // Unreachable.
449
- if (cause instanceof HttpRequestError && cause.status === undefined)
450
- return false
451
- // Unauthorized, forbidden or rate limited.
452
- return cause.status !== 401 && cause.status !== 403 && cause.status !== 429
453
- }
@@ -247,16 +247,8 @@ function resolveTokenForChain(
247
247
  token: Token,
248
248
  chainId: number,
249
249
  ): ResolvedToken | undefined {
250
- const address = (token.addresses as Record<number, Address>)[chainId]
251
- if (!address) return undefined
252
- return {
253
- address,
254
- currency: token.currency,
255
- decimals: token.decimals,
256
- name: token.name,
257
- popular: token.popular,
258
- symbol: token.symbol,
259
- }
250
+ if (!(token.addresses as Record<number, Address>)[chainId]) return undefined
251
+ return token(chainId as never)
260
252
  }
261
253
 
262
254
  /** Finds a {@link Token} by symbol (case-insensitively) on a `tokens` array. @internal */
@@ -9,6 +9,7 @@ import type { ContractConstructorArgs } from '../../types/contract.js'
9
9
  import type { Hex } from '../../types/misc.js'
10
10
  import type { UnionEvaluate, UnionOmit } from '../../types/utils.js'
11
11
  import { encodeDeployData } from '../../utils/abi/encodeDeployData.js'
12
+ import { getAction } from '../../utils/getAction.js'
12
13
  import {
13
14
  type SendTransactionErrorType,
14
15
  type SendTransactionParameters,
@@ -80,7 +81,11 @@ export function deployContract<
80
81
  const { abi, args, bytecode, ...request } =
81
82
  parameters as DeployContractParameters
82
83
  const calldata = encodeDeployData({ abi, args, bytecode })
83
- return sendTransaction(walletClient, {
84
+ return getAction(
85
+ walletClient,
86
+ sendTransaction,
87
+ 'sendTransaction',
88
+ )({
84
89
  ...request,
85
90
  ...(request.authorizationList ? { to: null } : {}),
86
91
  data: calldata,
@@ -25,11 +25,16 @@ import type { Client } from '../../clients/createClient.js'
25
25
  import type { Transport } from '../../clients/transports/createTransport.js'
26
26
  import type { AccountNotFoundErrorType } from '../../errors/account.js'
27
27
  import type { BaseError } from '../../errors/base.js'
28
+ import {
29
+ ChainMismatchError,
30
+ type ChainMismatchErrorType,
31
+ } from '../../errors/chain.js'
28
32
  import {
29
33
  Eip1559FeesNotSupportedError,
30
34
  MaxFeePerGasTooLowError,
31
35
  } from '../../errors/fee.js'
32
36
  import { FeePayerNonceMismatchError } from '../../errors/transaction.js'
37
+ import type { ErrorType } from '../../errors/utils.js'
33
38
  import type { DeriveAccount, GetAccountParameter } from '../../types/account.js'
34
39
  import type { Block } from '../../types/block.js'
35
40
  import type { ExtractCapabilities } from '../../types/capabilities.js'
@@ -232,11 +237,13 @@ export type PrepareTransactionRequestReturnType<
232
237
  export type PrepareTransactionRequestErrorType =
233
238
  | AccountNotFoundErrorType
234
239
  | AssertRequestErrorType
240
+ | ChainMismatchErrorType
235
241
  | ParseAccountErrorType
236
242
  | GetBlockErrorType
237
243
  | GetTransactionCountErrorType
238
244
  | EstimateGasErrorType
239
245
  | EstimateFeesPerGasErrorType
246
+ | ErrorType
240
247
 
241
248
  /**
242
249
  * Prepares a transaction request for signing.
@@ -302,9 +309,9 @@ export async function prepareTransactionRequest<
302
309
  request
303
310
  >
304
311
  > {
305
- let request = args as PrepareTransactionRequestParameters
312
+ let request = { ...args } as PrepareTransactionRequestParameters
306
313
 
307
- request.account ??= client.account
314
+ if (typeof request.account === 'undefined') request.account = client.account
308
315
  request.parameters ??= defaultParameters
309
316
 
310
317
  const {
@@ -434,6 +441,7 @@ export async function prepareTransactionRequest<
434
441
  return false
435
442
  })()
436
443
 
444
+ let filledChainId: number | undefined
437
445
  const fill = (request: PrepareTransactionRequestParameters) =>
438
446
  getAction(
439
447
  client,
@@ -462,6 +470,7 @@ export async function prepareTransactionRequest<
462
470
  feeToken !== null &&
463
471
  (!('feeToken' in request) || hasFilledFeePayerSignature)
464
472
  supportsFillTransaction.set(client.uid, true)
473
+ filledChainId = chainId
465
474
  // The fee payer signs over the filled fee token, so a requested one must not replace or outlive it.
466
475
  type WithFeeToken = { feeToken?: unknown }
467
476
  const { feeToken: _feeToken, ...unsponsored } = request as WithFeeToken
@@ -469,7 +478,6 @@ export async function prepareTransactionRequest<
469
478
  ...(hasFilledFeePayerSignature ? unsponsored : request),
470
479
  ...(from ? { from } : {}),
471
480
  ...(type && !request.type ? { type } : {}),
472
- ...(typeof chainId !== 'undefined' ? { chainId } : {}),
473
481
  ...(typeof gas !== 'undefined' ? { gas } : {}),
474
482
  ...(typeof gasPrice !== 'undefined' ? { gasPrice } : {}),
475
483
  ...(typeof nonce !== 'undefined' ? { nonce } : {}),
@@ -572,6 +580,20 @@ export async function prepareTransactionRequest<
572
580
  ...(account ? { from: account?.address } : {}),
573
581
  ...(typeof nonce !== 'undefined' ? { nonce } : {}),
574
582
  }
583
+
584
+ // The filled chain id only applies when neither the request nor the chain provides one.
585
+ if (typeof filledChainId !== 'undefined') {
586
+ request.chainId ??= chain?.id ?? filledChainId
587
+ if (request.chainId !== filledChainId)
588
+ throw new ChainMismatchError({
589
+ chain:
590
+ chain?.id === request.chainId
591
+ ? chain
592
+ : ({ id: request.chainId, name: 'Unknown' } as Chain),
593
+ currentChainId: filledChainId,
594
+ })
595
+ }
596
+
575
597
  const { blobs, gas, kzg, type } = request
576
598
 
577
599
  if (
@@ -21,6 +21,7 @@ import { concat } from '../../utils/data/concat.js'
21
21
  import { hexToBigInt } from '../../utils/encoding/fromHex.js'
22
22
  import { numberToHex } from '../../utils/encoding/toHex.js'
23
23
  import { getTransactionError } from '../../utils/errors/getTransactionError.js'
24
+ import { getAction } from '../../utils/getAction.js'
24
25
  import { sendTransaction } from './sendTransaction.js'
25
26
 
26
27
  export const fallbackMagicIdentifier =
@@ -225,7 +226,11 @@ export async function sendCalls<
225
226
  const results: PromiseSettledResult<Hex>[] = []
226
227
  for (const call of calls) {
227
228
  try {
228
- const value = await sendTransaction(client, {
229
+ const value = await getAction(
230
+ client,
231
+ sendTransaction,
232
+ 'sendTransaction',
233
+ )({
229
234
  account,
230
235
  chain,
231
236
  data: call.data,
@@ -17,6 +17,7 @@ import {
17
17
  } from '../../errors/account.js'
18
18
  import type { ErrorType } from '../../errors/utils.js'
19
19
  import type { Chain } from '../../types/chain.js'
20
+ import { getAction } from '../../utils/getAction.js'
20
21
  import {
21
22
  type PrepareAuthorizationErrorType,
22
23
  type PrepareAuthorizationParameters,
@@ -103,6 +104,10 @@ export async function signAuthorization<
103
104
  type: account.type,
104
105
  })
105
106
 
106
- const authorization = await prepareAuthorization(client, parameters)
107
+ const authorization = await getAction(
108
+ client,
109
+ prepareAuthorization,
110
+ 'prepareAuthorization',
111
+ )(parameters)
107
112
  return account.signAuthorization(authorization)
108
113
  }
@@ -24,8 +24,11 @@ export function serializeTransaction(
24
24
  transaction: CeloTransactionSerializable,
25
25
  signature?: Signature | undefined,
26
26
  ) {
27
- if (isCIP64(transaction))
28
- return serializeTransactionCIP64(transaction, signature)
27
+ if (isCIP64(transaction) || isPresent(transaction.feeCurrency))
28
+ return serializeTransactionCIP64(
29
+ transaction as TransactionSerializableCIP64,
30
+ signature,
31
+ )
29
32
  return serializeTransaction_op(transaction, signature)
30
33
  }
31
34
 
@@ -0,0 +1,27 @@
1
+ import { defineChain } from '../../utils/chain/defineChain.js'
2
+
3
+ export const kinetiqElysium = /*#__PURE__*/ defineChain({
4
+ id: 99_901,
5
+ name: 'Elysium',
6
+ blockTime: 100,
7
+ nativeCurrency: { name: 'HYPE', symbol: 'HYPE', decimals: 18 },
8
+ rpcUrls: {
9
+ default: {
10
+ http: ['https://rpc.elysium.kinetiq.xyz'],
11
+ },
12
+ },
13
+ blockExplorers: {
14
+ default: {
15
+ name: 'Elysium Explorer',
16
+ url: 'https://elysium.kinetiq.xyz',
17
+ apiUrl: 'https://elysium.kinetiq.xyz/api',
18
+ },
19
+ },
20
+ contracts: {
21
+ multicall3: {
22
+ address: '0xcA11bde05977b3631167028862bE2a173976CA11',
23
+ blockCreated: 1343,
24
+ },
25
+ },
26
+ sourceId: 999,
27
+ })
@@ -0,0 +1,28 @@
1
+ import { defineChain } from '../../utils/chain/defineChain.js'
2
+
3
+ export const kinetiqElysiumTestnet = /*#__PURE__*/ defineChain({
4
+ id: 99_801,
5
+ name: 'Kinetiq Elysium Testnet',
6
+ blockTime: 100,
7
+ nativeCurrency: { name: 'HYPE', symbol: 'HYPE', decimals: 18 },
8
+ rpcUrls: {
9
+ default: {
10
+ http: ['https://testnet-rpc.elysium.kinetiq.xyz'],
11
+ },
12
+ },
13
+ blockExplorers: {
14
+ default: {
15
+ name: 'Elysium Testnet Explorer',
16
+ url: 'https://testnet.elysium.kinetiq.xyz',
17
+ apiUrl: 'https://testnet.elysium.kinetiq.xyz/api',
18
+ },
19
+ },
20
+ contracts: {
21
+ multicall3: {
22
+ address: '0xcA11bde05977b3631167028862bE2a173976CA11',
23
+ blockCreated: 91163,
24
+ },
25
+ },
26
+ sourceId: 998,
27
+ testnet: true,
28
+ })
package/chains/index.ts CHANGED
@@ -351,6 +351,8 @@ export { kavaTestnet } from './definitions/kavaTestnet.js'
351
351
  export { kcc } from './definitions/kcc.js'
352
352
  export { kii } from './definitions/kii.js'
353
353
  export { kiiTestnetOro } from './definitions/kiiTestnet.js'
354
+ export { kinetiqElysium } from './definitions/kinetiqElysium.js'
355
+ export { kinetiqElysiumTestnet } from './definitions/kinetiqElysiumTestnet.js'
354
356
  export { kinto } from './definitions/kinto.js'
355
357
  /** @deprecated Use `kaia` instead. */
356
358
  export { klaytn } from './definitions/klaytn.js'