viem 2.57.11 → 2.57.13

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 (377) hide show
  1. package/CHANGELOG.md +62 -0
  2. package/_cjs/actions/public/fillTransaction.js +6 -3
  3. package/_cjs/actions/public/fillTransaction.js.map +1 -1
  4. package/_cjs/actions/public/waitForTransactionReceipt.js +83 -23
  5. package/_cjs/actions/public/waitForTransactionReceipt.js.map +1 -1
  6. package/_cjs/actions/public/watchContractEvent.js +58 -29
  7. package/_cjs/actions/public/watchContractEvent.js.map +1 -1
  8. package/_cjs/actions/public/watchEvent.js +58 -28
  9. package/_cjs/actions/public/watchEvent.js.map +1 -1
  10. package/_cjs/actions/token/approve.js +1 -1
  11. package/_cjs/actions/token/approve.js.map +1 -1
  12. package/_cjs/actions/token/getAllowance.js +1 -1
  13. package/_cjs/actions/token/getAllowance.js.map +1 -1
  14. package/_cjs/actions/token/getBalance.js +1 -1
  15. package/_cjs/actions/token/getBalance.js.map +1 -1
  16. package/_cjs/actions/token/getTotalSupply.js +1 -1
  17. package/_cjs/actions/token/getTotalSupply.js.map +1 -1
  18. package/_cjs/actions/token/transfer.js +1 -1
  19. package/_cjs/actions/token/transfer.js.map +1 -1
  20. package/_cjs/actions/wallet/sendCalls.js +1 -1
  21. package/_cjs/actions/wallet/sendCalls.js.map +1 -1
  22. package/_cjs/chains/definitions/molibra.js +21 -0
  23. package/_cjs/chains/definitions/molibra.js.map +1 -0
  24. package/_cjs/chains/definitions/valuechain.js +22 -0
  25. package/_cjs/chains/definitions/valuechain.js.map +1 -0
  26. package/_cjs/chains/definitions/valuechainTestnet.js +23 -0
  27. package/_cjs/chains/definitions/valuechainTestnet.js.map +1 -0
  28. package/_cjs/chains/index.js +13 -7
  29. package/_cjs/chains/index.js.map +1 -1
  30. package/_cjs/clients/decorators/public.js.map +1 -1
  31. package/_cjs/clients/transports/http.js +5 -1
  32. package/_cjs/clients/transports/http.js.map +1 -1
  33. package/_cjs/errors/node.js +1 -1
  34. package/_cjs/errors/node.js.map +1 -1
  35. package/_cjs/errors/request.js +20 -2
  36. package/_cjs/errors/request.js.map +1 -1
  37. package/_cjs/errors/typedData.js +3 -1
  38. package/_cjs/errors/typedData.js.map +1 -1
  39. package/_cjs/errors/version.js +1 -1
  40. package/_cjs/op-stack/abis.js +52 -0
  41. package/_cjs/op-stack/abis.js.map +1 -1
  42. package/_cjs/op-stack/actions/getTimeToFinalize.js +53 -4
  43. package/_cjs/op-stack/actions/getTimeToFinalize.js.map +1 -1
  44. package/_cjs/op-stack/actions/getTimeToProve.js +29 -2
  45. package/_cjs/op-stack/actions/getTimeToProve.js.map +1 -1
  46. package/_cjs/op-stack/actions/getWithdrawalStatus.js +20 -4
  47. package/_cjs/op-stack/actions/getWithdrawalStatus.js.map +1 -1
  48. package/_cjs/op-stack/actions/waitToProve.js +28 -2
  49. package/_cjs/op-stack/actions/waitToProve.js.map +1 -1
  50. package/_cjs/op-stack/errors/withdrawal.js +12 -1
  51. package/_cjs/op-stack/errors/withdrawal.js.map +1 -1
  52. package/_cjs/tempo/Account.js +6 -9
  53. package/_cjs/tempo/Account.js.map +1 -1
  54. package/_cjs/tempo/Addresses.js +1 -2
  55. package/_cjs/tempo/Addresses.js.map +1 -1
  56. package/_cjs/tempo/Formatters.js +13 -2
  57. package/_cjs/tempo/Formatters.js.map +1 -1
  58. package/_cjs/tempo/Relay.js.map +1 -1
  59. package/_cjs/tempo/Transaction.js.map +1 -1
  60. package/_cjs/tempo/accounts/Config.js +22 -12
  61. package/_cjs/tempo/accounts/Config.js.map +1 -1
  62. package/_cjs/tempo/actions/accessKey.js +8 -8
  63. package/_cjs/tempo/actions/accessKey.js.map +1 -1
  64. package/_cjs/tempo/actions/accounts.js +5 -5
  65. package/_cjs/tempo/actions/accounts.js.map +1 -1
  66. package/_cjs/tempo/actions/amm.js +4 -4
  67. package/_cjs/tempo/actions/amm.js.map +1 -1
  68. package/_cjs/tempo/actions/channel.js +7 -7
  69. package/_cjs/tempo/actions/channel.js.map +1 -1
  70. package/_cjs/tempo/actions/dex.js +14 -14
  71. package/_cjs/tempo/actions/dex.js.map +1 -1
  72. package/_cjs/tempo/actions/earn/deployment.js +3 -3
  73. package/_cjs/tempo/actions/earn/deployment.js.map +1 -1
  74. package/_cjs/tempo/actions/earn.js +6 -6
  75. package/_cjs/tempo/actions/earn.js.map +1 -1
  76. package/_cjs/tempo/actions/fee.js +4 -4
  77. package/_cjs/tempo/actions/fee.js.map +1 -1
  78. package/_cjs/tempo/actions/nonce.js +1 -1
  79. package/_cjs/tempo/actions/nonce.js.map +1 -1
  80. package/_cjs/tempo/actions/policy.js +6 -6
  81. package/_cjs/tempo/actions/policy.js.map +1 -1
  82. package/_cjs/tempo/actions/propAmm.js +10 -10
  83. package/_cjs/tempo/actions/propAmm.js.map +1 -1
  84. package/_cjs/tempo/actions/receivePolicy.js +6 -6
  85. package/_cjs/tempo/actions/receivePolicy.js.map +1 -1
  86. package/_cjs/tempo/actions/reward.js +6 -6
  87. package/_cjs/tempo/actions/reward.js.map +1 -1
  88. package/_cjs/tempo/actions/token.js +21 -21
  89. package/_cjs/tempo/actions/token.js.map +1 -1
  90. package/_cjs/tempo/actions/validator.js +11 -11
  91. package/_cjs/tempo/actions/validator.js.map +1 -1
  92. package/_cjs/tempo/actions/virtualAddress.js +2 -2
  93. package/_cjs/tempo/actions/virtualAddress.js.map +1 -1
  94. package/_cjs/tempo/chainConfig.js +11 -4
  95. package/_cjs/tempo/chainConfig.js.map +1 -1
  96. package/_cjs/tempo/internal/relay/accounts.js +42 -7
  97. package/_cjs/tempo/internal/relay/accounts.js.map +1 -1
  98. package/_cjs/tempo/internal/relay/feePayer.js +4 -1
  99. package/_cjs/tempo/internal/relay/feePayer.js.map +1 -1
  100. package/_cjs/utils/abi/getAbiItem.js +33 -12
  101. package/_cjs/utils/abi/getAbiItem.js.map +1 -1
  102. package/_cjs/utils/abi/parseEventLogs.js +18 -10
  103. package/_cjs/utils/abi/parseEventLogs.js.map +1 -1
  104. package/_cjs/utils/authorization/serializeAuthorizationList.js +4 -1
  105. package/_cjs/utils/authorization/serializeAuthorizationList.js.map +1 -1
  106. package/_cjs/utils/buildRequest.js +25 -14
  107. package/_cjs/utils/buildRequest.js.map +1 -1
  108. package/_cjs/utils/data/isHex.js +3 -1
  109. package/_cjs/utils/data/isHex.js.map +1 -1
  110. package/_cjs/utils/hash/normalizeSignature.js +1 -1
  111. package/_cjs/utils/hash/normalizeSignature.js.map +1 -1
  112. package/_cjs/utils/rpc/http.js +24 -4
  113. package/_cjs/utils/rpc/http.js.map +1 -1
  114. package/_cjs/utils/signature/compactSignatureToSignature.js +3 -2
  115. package/_cjs/utils/signature/compactSignatureToSignature.js.map +1 -1
  116. package/_cjs/utils/signature/hashTypedData.js +1 -2
  117. package/_cjs/utils/signature/hashTypedData.js.map +1 -1
  118. package/_cjs/utils/signature/signatureToCompactSignature.js +15 -7
  119. package/_cjs/utils/signature/signatureToCompactSignature.js.map +1 -1
  120. package/_cjs/utils/siwe/createSiweMessage.js +1 -1
  121. package/_cjs/utils/siwe/createSiweMessage.js.map +1 -1
  122. package/_cjs/utils/typedData.js +6 -7
  123. package/_cjs/utils/typedData.js.map +1 -1
  124. package/_cjs/utils/wait.js +1 -1
  125. package/_cjs/utils/wait.js.map +1 -1
  126. package/_esm/actions/public/fillTransaction.js +8 -3
  127. package/_esm/actions/public/fillTransaction.js.map +1 -1
  128. package/_esm/actions/public/waitForTransactionReceipt.js +101 -23
  129. package/_esm/actions/public/waitForTransactionReceipt.js.map +1 -1
  130. package/_esm/actions/public/watchContractEvent.js +73 -36
  131. package/_esm/actions/public/watchContractEvent.js.map +1 -1
  132. package/_esm/actions/public/watchEvent.js +73 -35
  133. package/_esm/actions/public/watchEvent.js.map +1 -1
  134. package/_esm/actions/token/approve.js +1 -1
  135. package/_esm/actions/token/approve.js.map +1 -1
  136. package/_esm/actions/token/getAllowance.js +1 -1
  137. package/_esm/actions/token/getAllowance.js.map +1 -1
  138. package/_esm/actions/token/getBalance.js +1 -1
  139. package/_esm/actions/token/getBalance.js.map +1 -1
  140. package/_esm/actions/token/getTotalSupply.js +1 -1
  141. package/_esm/actions/token/getTotalSupply.js.map +1 -1
  142. package/_esm/actions/token/transfer.js +1 -1
  143. package/_esm/actions/token/transfer.js.map +1 -1
  144. package/_esm/actions/wallet/sendCalls.js +1 -1
  145. package/_esm/actions/wallet/sendCalls.js.map +1 -1
  146. package/_esm/chains/definitions/molibra.js +18 -0
  147. package/_esm/chains/definitions/molibra.js.map +1 -0
  148. package/_esm/chains/definitions/valuechain.js +20 -0
  149. package/_esm/chains/definitions/valuechain.js.map +1 -0
  150. package/_esm/chains/definitions/valuechainTestnet.js +21 -0
  151. package/_esm/chains/definitions/valuechainTestnet.js.map +1 -0
  152. package/_esm/chains/index.js +5 -0
  153. package/_esm/chains/index.js.map +1 -1
  154. package/_esm/clients/decorators/public.js.map +1 -1
  155. package/_esm/clients/transports/http.js +6 -1
  156. package/_esm/clients/transports/http.js.map +1 -1
  157. package/_esm/errors/node.js +1 -1
  158. package/_esm/errors/node.js.map +1 -1
  159. package/_esm/errors/request.js +22 -2
  160. package/_esm/errors/request.js.map +1 -1
  161. package/_esm/errors/typedData.js +3 -1
  162. package/_esm/errors/typedData.js.map +1 -1
  163. package/_esm/errors/version.js +1 -1
  164. package/_esm/op-stack/abis.js +52 -0
  165. package/_esm/op-stack/abis.js.map +1 -1
  166. package/_esm/op-stack/actions/getTimeToFinalize.js +64 -6
  167. package/_esm/op-stack/actions/getTimeToFinalize.js.map +1 -1
  168. package/_esm/op-stack/actions/getTimeToProve.js +30 -2
  169. package/_esm/op-stack/actions/getTimeToProve.js.map +1 -1
  170. package/_esm/op-stack/actions/getWithdrawalStatus.js +24 -5
  171. package/_esm/op-stack/actions/getWithdrawalStatus.js.map +1 -1
  172. package/_esm/op-stack/actions/waitToProve.js +30 -3
  173. package/_esm/op-stack/actions/waitToProve.js.map +1 -1
  174. package/_esm/op-stack/errors/withdrawal.js +10 -0
  175. package/_esm/op-stack/errors/withdrawal.js.map +1 -1
  176. package/_esm/tempo/Account.js +6 -9
  177. package/_esm/tempo/Account.js.map +1 -1
  178. package/_esm/tempo/Addresses.js +0 -2
  179. package/_esm/tempo/Addresses.js.map +1 -1
  180. package/_esm/tempo/Formatters.js +12 -2
  181. package/_esm/tempo/Formatters.js.map +1 -1
  182. package/_esm/tempo/Relay.js.map +1 -1
  183. package/_esm/tempo/Transaction.js.map +1 -1
  184. package/_esm/tempo/accounts/Config.js +28 -16
  185. package/_esm/tempo/accounts/Config.js.map +1 -1
  186. package/_esm/tempo/actions/accessKey.js +8 -8
  187. package/_esm/tempo/actions/accessKey.js.map +1 -1
  188. package/_esm/tempo/actions/accounts.js +7 -7
  189. package/_esm/tempo/actions/accounts.js.map +1 -1
  190. package/_esm/tempo/actions/amm.js +4 -4
  191. package/_esm/tempo/actions/amm.js.map +1 -1
  192. package/_esm/tempo/actions/channel.js +7 -7
  193. package/_esm/tempo/actions/channel.js.map +1 -1
  194. package/_esm/tempo/actions/dex.js +14 -14
  195. package/_esm/tempo/actions/dex.js.map +1 -1
  196. package/_esm/tempo/actions/earn/deployment.js +3 -3
  197. package/_esm/tempo/actions/earn/deployment.js.map +1 -1
  198. package/_esm/tempo/actions/earn.js +6 -6
  199. package/_esm/tempo/actions/earn.js.map +1 -1
  200. package/_esm/tempo/actions/fee.js +4 -4
  201. package/_esm/tempo/actions/fee.js.map +1 -1
  202. package/_esm/tempo/actions/nonce.js +1 -1
  203. package/_esm/tempo/actions/nonce.js.map +1 -1
  204. package/_esm/tempo/actions/policy.js +6 -6
  205. package/_esm/tempo/actions/policy.js.map +1 -1
  206. package/_esm/tempo/actions/propAmm.js +10 -10
  207. package/_esm/tempo/actions/propAmm.js.map +1 -1
  208. package/_esm/tempo/actions/receivePolicy.js +6 -6
  209. package/_esm/tempo/actions/receivePolicy.js.map +1 -1
  210. package/_esm/tempo/actions/reward.js +6 -6
  211. package/_esm/tempo/actions/reward.js.map +1 -1
  212. package/_esm/tempo/actions/token.js +21 -21
  213. package/_esm/tempo/actions/token.js.map +1 -1
  214. package/_esm/tempo/actions/validator.js +11 -11
  215. package/_esm/tempo/actions/validator.js.map +1 -1
  216. package/_esm/tempo/actions/virtualAddress.js +2 -2
  217. package/_esm/tempo/actions/virtualAddress.js.map +1 -1
  218. package/_esm/tempo/chainConfig.js +13 -4
  219. package/_esm/tempo/chainConfig.js.map +1 -1
  220. package/_esm/tempo/internal/relay/accounts.js +44 -7
  221. package/_esm/tempo/internal/relay/accounts.js.map +1 -1
  222. package/_esm/tempo/internal/relay/feePayer.js +4 -1
  223. package/_esm/tempo/internal/relay/feePayer.js.map +1 -1
  224. package/_esm/utils/abi/getAbiItem.js +36 -14
  225. package/_esm/utils/abi/getAbiItem.js.map +1 -1
  226. package/_esm/utils/abi/parseEventLogs.js +25 -11
  227. package/_esm/utils/abi/parseEventLogs.js.map +1 -1
  228. package/_esm/utils/authorization/serializeAuthorizationList.js +7 -1
  229. package/_esm/utils/authorization/serializeAuthorizationList.js.map +1 -1
  230. package/_esm/utils/buildRequest.js +29 -15
  231. package/_esm/utils/buildRequest.js.map +1 -1
  232. package/_esm/utils/data/isHex.js +3 -1
  233. package/_esm/utils/data/isHex.js.map +1 -1
  234. package/_esm/utils/hash/normalizeSignature.js +1 -1
  235. package/_esm/utils/hash/normalizeSignature.js.map +1 -1
  236. package/_esm/utils/hash/toSignature.js +1 -1
  237. package/_esm/utils/hash/toSignatureHash.js +1 -1
  238. package/_esm/utils/rpc/http.js +29 -7
  239. package/_esm/utils/rpc/http.js.map +1 -1
  240. package/_esm/utils/signature/compactSignatureToSignature.js +3 -2
  241. package/_esm/utils/signature/compactSignatureToSignature.js.map +1 -1
  242. package/_esm/utils/signature/hashTypedData.js +1 -2
  243. package/_esm/utils/signature/hashTypedData.js.map +1 -1
  244. package/_esm/utils/signature/signatureToCompactSignature.js +16 -7
  245. package/_esm/utils/signature/signatureToCompactSignature.js.map +1 -1
  246. package/_esm/utils/siwe/createSiweMessage.js +1 -1
  247. package/_esm/utils/siwe/createSiweMessage.js.map +1 -1
  248. package/_esm/utils/typedData.js +12 -8
  249. package/_esm/utils/typedData.js.map +1 -1
  250. package/_esm/utils/wait.js +2 -1
  251. package/_esm/utils/wait.js.map +1 -1
  252. package/_types/actions/getContract.d.ts +1 -1
  253. package/_types/actions/public/fillTransaction.d.ts.map +1 -1
  254. package/_types/actions/public/waitForTransactionReceipt.d.ts +31 -1
  255. package/_types/actions/public/waitForTransactionReceipt.d.ts.map +1 -1
  256. package/_types/actions/public/watchContractEvent.d.ts +1 -1
  257. package/_types/actions/public/watchContractEvent.d.ts.map +1 -1
  258. package/_types/actions/public/watchEvent.d.ts +1 -1
  259. package/_types/actions/public/watchEvent.d.ts.map +1 -1
  260. package/_types/chains/definitions/molibra.d.ts +52 -0
  261. package/_types/chains/definitions/molibra.d.ts.map +1 -0
  262. package/_types/chains/definitions/tempo.d.ts +14 -6
  263. package/_types/chains/definitions/tempo.d.ts.map +1 -1
  264. package/_types/chains/definitions/tempoDevnet.d.ts +14 -6
  265. package/_types/chains/definitions/tempoDevnet.d.ts.map +1 -1
  266. package/_types/chains/definitions/tempoLocalnet.d.ts +14 -6
  267. package/_types/chains/definitions/tempoLocalnet.d.ts.map +1 -1
  268. package/_types/chains/definitions/tempoModerato.d.ts +14 -6
  269. package/_types/chains/definitions/tempoModerato.d.ts.map +1 -1
  270. package/_types/chains/definitions/valuechain.d.ts +53 -0
  271. package/_types/chains/definitions/valuechain.d.ts.map +1 -0
  272. package/_types/chains/definitions/valuechainTestnet.d.ts +53 -0
  273. package/_types/chains/definitions/valuechainTestnet.d.ts.map +1 -0
  274. package/_types/chains/index.d.ts +5 -0
  275. package/_types/chains/index.d.ts.map +1 -1
  276. package/_types/clients/decorators/public.d.ts +5 -2
  277. package/_types/clients/decorators/public.d.ts.map +1 -1
  278. package/_types/clients/transports/http.d.ts.map +1 -1
  279. package/_types/errors/node.d.ts.map +1 -1
  280. package/_types/errors/request.d.ts +7 -1
  281. package/_types/errors/request.d.ts.map +1 -1
  282. package/_types/errors/typedData.d.ts.map +1 -1
  283. package/_types/errors/version.d.ts +1 -1
  284. package/_types/op-stack/abis.d.ts +40 -0
  285. package/_types/op-stack/abis.d.ts.map +1 -1
  286. package/_types/op-stack/actions/getTimeToFinalize.d.ts +3 -2
  287. package/_types/op-stack/actions/getTimeToFinalize.d.ts.map +1 -1
  288. package/_types/op-stack/actions/getTimeToProve.d.ts +3 -1
  289. package/_types/op-stack/actions/getTimeToProve.d.ts.map +1 -1
  290. package/_types/op-stack/actions/getWithdrawalStatus.d.ts +2 -2
  291. package/_types/op-stack/actions/getWithdrawalStatus.d.ts.map +1 -1
  292. package/_types/op-stack/actions/waitToProve.d.ts +3 -1
  293. package/_types/op-stack/actions/waitToProve.d.ts.map +1 -1
  294. package/_types/op-stack/errors/withdrawal.d.ts +8 -0
  295. package/_types/op-stack/errors/withdrawal.d.ts.map +1 -1
  296. package/_types/tempo/Account.d.ts +14 -5
  297. package/_types/tempo/Account.d.ts.map +1 -1
  298. package/_types/tempo/Addresses.d.ts +0 -2
  299. package/_types/tempo/Addresses.d.ts.map +1 -1
  300. package/_types/tempo/Formatters.d.ts +3 -0
  301. package/_types/tempo/Formatters.d.ts.map +1 -1
  302. package/_types/tempo/Relay.d.ts +20 -0
  303. package/_types/tempo/Relay.d.ts.map +1 -1
  304. package/_types/tempo/Transaction.d.ts +7 -2
  305. package/_types/tempo/Transaction.d.ts.map +1 -1
  306. package/_types/tempo/accounts/Config.d.ts +24 -2
  307. package/_types/tempo/accounts/Config.d.ts.map +1 -1
  308. package/_types/tempo/actions/accounts.d.ts +2 -2
  309. package/_types/tempo/chainConfig.d.ts +8 -3
  310. package/_types/tempo/chainConfig.d.ts.map +1 -1
  311. package/_types/tempo/internal/relay/accounts.d.ts.map +1 -1
  312. package/_types/tempo/internal/relay/feePayer.d.ts.map +1 -1
  313. package/_types/utils/abi/getAbiItem.d.ts.map +1 -1
  314. package/_types/utils/abi/parseEventLogs.d.ts.map +1 -1
  315. package/_types/utils/authorization/serializeAuthorizationList.d.ts.map +1 -1
  316. package/_types/utils/buildRequest.d.ts.map +1 -1
  317. package/_types/utils/data/isHex.d.ts +12 -1
  318. package/_types/utils/data/isHex.d.ts.map +1 -1
  319. package/_types/utils/hash/toSignature.d.ts +1 -1
  320. package/_types/utils/hash/toSignatureHash.d.ts +1 -1
  321. package/_types/utils/rpc/http.d.ts +2 -2
  322. package/_types/utils/rpc/http.d.ts.map +1 -1
  323. package/_types/utils/signature/compactSignatureToSignature.d.ts +2 -1
  324. package/_types/utils/signature/compactSignatureToSignature.d.ts.map +1 -1
  325. package/_types/utils/signature/hashTypedData.d.ts.map +1 -1
  326. package/_types/utils/signature/signatureToCompactSignature.d.ts +2 -1
  327. package/_types/utils/signature/signatureToCompactSignature.d.ts.map +1 -1
  328. package/_types/utils/typedData.d.ts.map +1 -1
  329. package/_types/utils/wait.d.ts.map +1 -1
  330. package/actions/getContract.ts +1 -1
  331. package/actions/public/fillTransaction.ts +12 -3
  332. package/actions/public/waitForTransactionReceipt.ts +164 -33
  333. package/actions/public/watchContractEvent.ts +82 -39
  334. package/actions/public/watchEvent.ts +82 -38
  335. package/actions/wallet/sendCalls.ts +1 -1
  336. package/chains/definitions/molibra.ts +18 -0
  337. package/chains/definitions/valuechain.ts +20 -0
  338. package/chains/definitions/valuechainTestnet.ts +21 -0
  339. package/chains/index.ts +5 -0
  340. package/clients/decorators/public.ts +5 -2
  341. package/clients/transports/http.ts +6 -1
  342. package/errors/node.ts +1 -1
  343. package/errors/request.ts +15 -1
  344. package/errors/typedData.ts +3 -1
  345. package/errors/version.ts +1 -1
  346. package/op-stack/abis.ts +52 -0
  347. package/op-stack/actions/getTimeToFinalize.ts +89 -10
  348. package/op-stack/actions/getTimeToProve.ts +43 -2
  349. package/op-stack/actions/getWithdrawalStatus.ts +30 -6
  350. package/op-stack/actions/waitToProve.ts +45 -3
  351. package/op-stack/errors/withdrawal.ts +17 -0
  352. package/package.json +2 -2
  353. package/tempo/Account.ts +20 -22
  354. package/tempo/Addresses.ts +0 -3
  355. package/tempo/Formatters.ts +19 -7
  356. package/tempo/Relay.ts +26 -0
  357. package/tempo/Transaction.ts +10 -2
  358. package/tempo/accounts/Config.ts +40 -25
  359. package/tempo/actions/accounts.ts +2 -2
  360. package/tempo/chainConfig.ts +15 -4
  361. package/tempo/internal/relay/accounts.ts +45 -9
  362. package/tempo/internal/relay/feePayer.ts +6 -1
  363. package/utils/abi/getAbiItem.ts +49 -17
  364. package/utils/abi/parseEventLogs.ts +32 -11
  365. package/utils/authorization/serializeAuthorizationList.ts +7 -1
  366. package/utils/buildRequest.ts +29 -14
  367. package/utils/data/isHex.ts +18 -1
  368. package/utils/hash/normalizeSignature.ts +1 -1
  369. package/utils/hash/toSignature.ts +1 -1
  370. package/utils/hash/toSignatureHash.ts +1 -1
  371. package/utils/rpc/http.ts +33 -8
  372. package/utils/signature/compactSignatureToSignature.ts +4 -2
  373. package/utils/signature/hashTypedData.ts +1 -2
  374. package/utils/signature/signatureToCompactSignature.ts +13 -8
  375. package/utils/siwe/createSiweMessage.ts +1 -1
  376. package/utils/typedData.ts +11 -8
  377. package/utils/wait.ts +8 -4
@@ -18,9 +18,12 @@ import type { TransactionReceipt } from '../../types/transaction.js'
18
18
  import type { OneOf } from '../../types/utils.js'
19
19
  import { anchorStateRegistryAbi, portal2Abi, portalAbi } from '../abis.js'
20
20
  import {
21
+ L2TimestampRequiredError,
22
+ type L2TimestampRequiredErrorType,
21
23
  ReceiptContainsNoWithdrawalsError,
22
24
  type ReceiptContainsNoWithdrawalsErrorType,
23
25
  } from '../errors/withdrawal.js'
26
+ import { isSuperGameType } from '../gameTypes.js'
24
27
  import type { TargetChain } from '../types/chain.js'
25
28
  import type { GetContractAddressParameter } from '../types/contract.js'
26
29
  import {
@@ -106,6 +109,7 @@ export type GetWithdrawalStatusErrorType =
106
109
  | GetL2OutputErrorType
107
110
  | GetTimeToFinalizeErrorType
108
111
  | GetWithdrawalsErrorType
112
+ | L2TimestampRequiredErrorType
109
113
  | ReadContractErrorType
110
114
  | ReceiptContainsNoWithdrawalsErrorType
111
115
  | ErrorType
@@ -152,6 +156,7 @@ export async function getWithdrawalStatus<
152
156
  chain = client.chain,
153
157
  gameLimit = 100,
154
158
  receipt,
159
+ l2Timestamp,
155
160
  targetChain: targetChain_,
156
161
  logIndex = 0,
157
162
  } = parameters
@@ -165,7 +170,7 @@ export async function getWithdrawalStatus<
165
170
  })()
166
171
 
167
172
  const l2BlockNumber =
168
- parameters.l2Timestamp ?? receipt?.blockNumber ?? parameters.l2BlockNumber
173
+ l2Timestamp ?? receipt?.blockNumber ?? parameters.l2BlockNumber
169
174
 
170
175
  const withdrawal = (() => {
171
176
  if (receipt) {
@@ -254,17 +259,36 @@ export async function getWithdrawalStatus<
254
259
  args: [withdrawal.withdrawalHash, numProofSubmitters - 1n],
255
260
  }).catch(() => withdrawal.sender)
256
261
 
262
+ // Super-root games anchor on L2 timestamps instead of L2 block numbers.
263
+ // Not awaited, so a missing L2 timestamp only fails the game lookup and a
264
+ // finalized withdrawal still resolves.
265
+ const gameL2BlockNumber = (async () => {
266
+ if (typeof l2Timestamp === 'bigint') return l2Timestamp
267
+ const gameType = await readContract(client, {
268
+ abi: portal2Abi,
269
+ address: portalAddress,
270
+ functionName: 'respectedGameType',
271
+ })
272
+ if (!isSuperGameType(gameType)) return l2BlockNumber
273
+ const timestamp = receipt?.logs[0]?.blockTimestamp
274
+ if (typeof timestamp !== 'bigint')
275
+ throw new L2TimestampRequiredError({ gameType })
276
+ return timestamp
277
+ })()
278
+
257
279
  const [
258
280
  disputeGameResult,
259
281
  provenWithdrawalsResult,
260
282
  checkWithdrawalResult,
261
283
  finalizedResult,
262
284
  ] = await Promise.allSettled([
263
- getGame(client, {
264
- ...parameters,
265
- l2BlockNumber,
266
- limit: gameLimit,
267
- } as GetGameParameters),
285
+ gameL2BlockNumber.then((l2BlockNumber) =>
286
+ getGame(client, {
287
+ ...parameters,
288
+ l2BlockNumber,
289
+ limit: gameLimit,
290
+ } as GetGameParameters),
291
+ ),
268
292
  readContract(client, {
269
293
  abi: portal2Abi,
270
294
  address: portalAddress,
@@ -1,3 +1,7 @@
1
+ import {
2
+ type ReadContractErrorType,
3
+ readContract,
4
+ } from '../../actions/public/readContract.js'
1
5
  import type { Client } from '../../clients/createClient.js'
2
6
  import type { Transport } from '../../clients/transports/createTransport.js'
3
7
  import type { ErrorType } from '../../errors/utils.js'
@@ -9,7 +13,14 @@ import type {
9
13
  } from '../../types/chain.js'
10
14
  import type { TransactionReceipt } from '../../types/transaction.js'
11
15
  import type { OneOf } from '../../types/utils.js'
12
- import { ReceiptContainsNoWithdrawalsError } from '../errors/withdrawal.js'
16
+ import { portal2Abi } from '../abis.js'
17
+ import {
18
+ L2TimestampRequiredError,
19
+ type L2TimestampRequiredErrorType,
20
+ ReceiptContainsNoWithdrawalsError,
21
+ } from '../errors/withdrawal.js'
22
+ import { isSuperGameType } from '../gameTypes.js'
23
+ import type { TargetChain } from '../types/chain.js'
13
24
  import type { GetContractAddressParameter } from '../types/contract.js'
14
25
  import type { Withdrawal } from '../types/withdrawal.js'
15
26
  import {
@@ -68,6 +79,8 @@ export type WaitToProveReturnType = {
68
79
 
69
80
  export type WaitToProveErrorType =
70
81
  | GetWithdrawalsErrorType
82
+ | L2TimestampRequiredErrorType
83
+ | ReadContractErrorType
71
84
  | WaitForNextL2OutputErrorType
72
85
  | ErrorType
73
86
 
@@ -109,7 +122,15 @@ export async function waitToProve<
109
122
  client: Client<Transport, chain, account>,
110
123
  parameters: WaitToProveParameters<chain, chainOverride>,
111
124
  ): Promise<WaitToProveReturnType> {
112
- const { gameLimit, l2Timestamp, receipt } = parameters
125
+ const {
126
+ chain = client.chain,
127
+ gameLimit,
128
+ l2Timestamp,
129
+ receipt,
130
+ targetChain: targetChain_,
131
+ } = parameters
132
+
133
+ const targetChain = targetChain_ as unknown as TargetChain
113
134
 
114
135
  const [withdrawal] = getWithdrawals(receipt)
115
136
 
@@ -144,10 +165,31 @@ export async function waitToProve<
144
165
  }
145
166
  }
146
167
 
168
+ const portalAddress = (() => {
169
+ if (parameters.portalAddress) return parameters.portalAddress
170
+ if (chain) return targetChain.contracts.portal[chain.id].address
171
+ return Object.values(targetChain.contracts.portal)[0].address
172
+ })()
173
+
174
+ // Super-root games anchor on L2 timestamps instead of L2 block numbers.
175
+ const l2BlockNumber = await (async () => {
176
+ if (typeof l2Timestamp === 'bigint') return l2Timestamp
177
+ const gameType = await readContract(client, {
178
+ abi: portal2Abi,
179
+ address: portalAddress,
180
+ functionName: 'respectedGameType',
181
+ })
182
+ if (!isSuperGameType(gameType)) return receipt.blockNumber
183
+ const timestamp = receipt.logs[0]?.blockTimestamp
184
+ if (typeof timestamp !== 'bigint')
185
+ throw new L2TimestampRequiredError({ gameType })
186
+ return timestamp
187
+ })()
188
+
147
189
  const game = await waitForNextGame(client, {
148
190
  ...parameters,
149
191
  limit: gameLimit,
150
- l2BlockNumber: l2Timestamp ?? receipt.blockNumber,
192
+ l2BlockNumber,
151
193
  } as WaitForNextGameParameters)
152
194
  return {
153
195
  game,
@@ -22,3 +22,20 @@ export class ReceiptContainsNoWithdrawalsError extends BaseError {
22
22
  )
23
23
  }
24
24
  }
25
+
26
+ export type L2TimestampRequiredErrorType = L2TimestampRequiredError & {
27
+ name: 'L2TimestampRequiredError'
28
+ }
29
+ export class L2TimestampRequiredError extends BaseError {
30
+ constructor({ gameType }: { gameType: number }) {
31
+ super(
32
+ `Dispute game type ${gameType} anchors on L2 timestamps, so the L2 timestamp of the withdrawal is required.`,
33
+ {
34
+ metaMessages: [
35
+ 'Pass `l2Timestamp`, or a receipt whose logs include `blockTimestamp`.',
36
+ ],
37
+ name: 'L2TimestampRequiredError',
38
+ },
39
+ )
40
+ }
41
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "viem",
3
3
  "description": "TypeScript Interface for Ethereum",
4
- "version": "2.57.11",
4
+ "version": "2.57.13",
5
5
  "main": "./_cjs/index.js",
6
6
  "module": "./_esm/index.js",
7
7
  "types": "./_types/index.d.ts",
@@ -229,7 +229,7 @@
229
229
  "@scure/bip39": "1.6.0",
230
230
  "abitype": "1.2.3",
231
231
  "isows": "1.0.7",
232
- "ox": "0.14.57",
232
+ "ox": "0.14.59",
233
233
  "ws": "8.21.0"
234
234
  },
235
235
  "license": "MIT",
package/tempo/Account.ts CHANGED
@@ -24,7 +24,6 @@ import { keccak256 } from '../utils/hash/keccak256.js'
24
24
  import { hashMessage } from '../utils/signature/hashMessage.js'
25
25
  import { hashTypedData } from '../utils/signature/hashTypedData.js'
26
26
  import type { SerializeTransactionFn } from '../utils/transaction/serializeTransaction.js'
27
- import { configurableAccountRecoveryFactory } from './Addresses.js'
28
27
  import { parseApproval } from './accounts/Signature.js'
29
28
  import type { KeyAuthorizationManager } from './KeyAuthorizationManager.js'
30
29
  import * as Transaction from './Transaction.js'
@@ -295,6 +294,14 @@ export declare namespace fromSecp256k1 {
295
294
  * Normalizes supplied config fields with `AccountConfig.from`, so callers do
296
295
  * not need to normalize owner ordering themselves.
297
296
  *
297
+ * `sign`, `signMessage`, and `signTypedData` return a configurable signature
298
+ * envelope with local owner approvals up to the config threshold. Signatures
299
+ * verify against the account's current config, so a config update invalidates
300
+ * earlier signatures. Verify them with `verifyHash`, `verifyMessage`, or
301
+ * `verifyTypedData` on a Tempo client, which use the signature verifier
302
+ * precompile. Configurable accounts have no code and do not implement ERC-1271
303
+ * `isValidSignature`, so ERC-1271 verifiers do not accept their signatures.
304
+ *
298
305
  * @example
299
306
  * ```ts
300
307
  * import { Account } from 'viem/tempo'
@@ -331,11 +338,7 @@ export function fromConfig(value: fromConfig.Parameters): ConfigurableAccount {
331
338
  const configInput = (() => {
332
339
  if (typeof value === 'string') return undefined
333
340
  if ('upgrade' in value) return value.upgrade
334
- const {
335
- address: _,
336
- factory: __,
337
- ...config
338
- } = value as fromConfig.InitialConfig
341
+ const { address: _, ...config } = value as fromConfig.InitialConfig
339
342
  return config
340
343
  })()
341
344
  const config = (() => {
@@ -371,9 +374,7 @@ export function fromConfig(value: fromConfig.Parameters): ConfigurableAccount {
371
374
  (() => {
372
375
  if (typeof value === 'string') return value
373
376
  if (value.address === undefined || value.address === 'infer')
374
- return AccountConfig.getAddress(config!, {
375
- factory: value.factory ?? configurableAccountRecoveryFactory,
376
- })
377
+ return AccountConfig.getAddress(config!)
377
378
  return value.address
378
379
  })(),
379
380
  )
@@ -413,10 +414,8 @@ export function fromConfig(value: fromConfig.Parameters): ConfigurableAccount {
413
414
  await signConfigurable(account, { payload: hash }),
414
415
  )
415
416
  },
416
- async signMessage() {
417
- throw new Error(
418
- '`signMessage` is not supported for configurable accounts.',
419
- )
417
+ async signMessage({ message }) {
418
+ return await account.sign({ hash: hashMessage(message) })
420
419
  },
421
420
  async signTransaction(transaction, options) {
422
421
  const { serializer = Transaction.serialize } = options ?? {}
@@ -463,10 +462,8 @@ export function fromConfig(value: fromConfig.Parameters): ConfigurableAccount {
463
462
  signature as never,
464
463
  )) as Hex.Hex
465
464
  },
466
- async signTypedData() {
467
- throw new Error(
468
- '`signTypedData` is not supported for configurable accounts.',
469
- )
465
+ async signTypedData(typedData) {
466
+ return await account.sign({ hash: hashTypedData(typedData) })
470
467
  },
471
468
  }
472
469
  return account
@@ -494,11 +491,6 @@ export declare namespace fromConfig {
494
491
  export type InitialConfig = {
495
492
  /** Derives the stable account address from this initial config. */
496
493
  address?: 'infer' | undefined
497
- /**
498
- * Recovery factory used to derive the address.
499
- * @default `Addresses.configurableAccountRecoveryFactory`
500
- */
501
- factory?: Address.Address | undefined
502
494
  /** Weighted owners. */
503
495
  owners: readonly Owner[]
504
496
  /** Caller-chosen 32-byte salt. */
@@ -540,6 +532,12 @@ export declare namespace fromConfig {
540
532
  }
541
533
  }
542
534
 
535
+ /**
536
+ * Configurable account (TIP-1107) returned by {@link fromConfig}.
537
+ *
538
+ * Its signatures verify against the account's current config through Tempo's
539
+ * `verifyHash`, not ERC-1271, and a config update invalidates earlier signatures.
540
+ */
543
541
  export type ConfigurableAccount<
544
542
  config extends AccountConfig.Config | undefined =
545
543
  | AccountConfig.Config
@@ -13,9 +13,6 @@ export const accountKeychain = '0xaAAAaaAA00000000000000000000000000000000'
13
13
  export const accountRegistrar = '0x7702ac0000000000000000000000000000000000'
14
14
  export const addressRegistry = '0xfdc0000000000000000000000000000000000000'
15
15
  export const configurableAccount = '0xAACC000000000000000000000000000000000000'
16
- /** Default configurable account recovery factory. Temporary until the production address is finalized. */
17
- export const configurableAccountRecoveryFactory =
18
- '0x7171717171717171717171717171717171717171'
19
16
  /** Current consensus committee precompile address, used with `Abis.currentCommittee` to read committee members. */
20
17
  export const currentCommittee = '0xC077e00000000000000000000000000000000000'
21
18
  export const feeManager = '0xfeec000000000000000000000000000000000000'
@@ -9,6 +9,9 @@ import {
9
9
  } from 'ox/tempo'
10
10
  import type { Account as viem_Account } from '../accounts/types.js'
11
11
  import { parseAccount } from '../accounts/utils/parseAccount.js'
12
+ import type { Block } from '../types/block.js'
13
+ import type { RpcBlock } from '../types/rpc.js'
14
+ import { formatBlock as viem_formatBlock } from '../utils/formatters/block.js'
12
15
  import { formatTransaction as viem_formatTransaction } from '../utils/formatters/transaction.js'
13
16
  import { formatTransactionReceipt as viem_formatTransactionReceipt } from '../utils/formatters/transactionReceipt.js'
14
17
  import { formatTransactionRequest as viem_formatTransactionRequest } from '../utils/formatters/transactionRequest.js'
@@ -23,6 +26,18 @@ import {
23
26
  type TransactionRpc,
24
27
  } from './Transaction.js'
25
28
 
29
+ export function formatBlock(block: RpcBlock): Block {
30
+ const { transactions = [], ...rest } = block
31
+ return {
32
+ ...viem_formatBlock({ ...rest, transactions: [] }),
33
+ transactions: transactions.map((transaction) =>
34
+ typeof transaction === 'string'
35
+ ? transaction
36
+ : formatTransaction(transaction as never),
37
+ ),
38
+ } as never
39
+ }
40
+
26
41
  export function formatTransaction(
27
42
  transaction: TransactionRpc,
28
43
  ): Transaction<bigint, number, boolean> {
@@ -34,12 +49,9 @@ export function formatTransaction(
34
49
  ? undefined
35
50
  : BigInt(transaction.blockTimestamp)
36
51
  const operation = transaction.operation
37
- const {
38
- feePayerSignature,
39
- gasPrice: _,
40
- nonce,
41
- ...tx
42
- } = ox_Transaction.fromRpc(transaction as never) as ox_Transaction.Tempo
52
+ const { feePayerSignature, nonce, ...tx } = ox_Transaction.fromRpc(
53
+ transaction as never,
54
+ ) as ox_Transaction.Tempo
43
55
 
44
56
  return {
45
57
  ...tx,
@@ -53,7 +65,7 @@ export function formatTransaction(
53
65
  yParity: feePayerSignature.yParity,
54
66
  }
55
67
  : undefined,
56
- nonce: Number(nonce),
68
+ nonce: nonce ?? 0n,
57
69
  operation: formatOperation(operation),
58
70
  typeHex:
59
71
  ox_Transaction.toRpcType[
package/tempo/Relay.ts CHANGED
@@ -1,9 +1,12 @@
1
1
  import type { Address } from 'abitype'
2
+ import type * as Hex from 'ox/Hex'
2
3
  import * as RpcResponse from 'ox/RpcResponse'
4
+ import type { AccountConfig } from 'ox/tempo'
3
5
  import type { LocalAccount } from '../accounts/types.js'
4
6
  import type { Client as Client_ } from '../clients/createClient.js'
5
7
  import { ChainNotConfiguredError } from '../clients/createClientResolver.js'
6
8
  import type { EIP1193RequestOptions } from '../types/eip1193.js'
9
+ import type { MaybePromise } from '../types/utils.js'
7
10
  import * as Accounts from './internal/relay/accounts.js'
8
11
  import * as Sponsorship from './internal/relay/feePayer.js'
9
12
  import * as FeeToken from './internal/relay/feeToken.js'
@@ -342,9 +345,32 @@ export function accounts(options: accounts.Options): accounts.ReturnType {
342
345
  export declare namespace accounts {
343
346
  /** Configurable account options. */
344
347
  export type Options = {
348
+ /**
349
+ * Resolves a config that `store` does not hold, such as from an indexer of
350
+ * `ConfigurableAccountConfigUpdated` events. The plugin stores and returns
351
+ * a resolved config only when it matches the account and commitment.
352
+ */
353
+ resolveConfig?:
354
+ | ((
355
+ options: resolveConfig.Options,
356
+ ) => MaybePromise<AccountConfig.Config | null | undefined>)
357
+ | undefined
345
358
  /** Store shared by relays, with atomic compare-and-set support. */
346
359
  store: Store.Atomic
347
360
  }
361
+
362
+ export namespace resolveConfig {
363
+ /** Lookup that `resolveConfig` receives. */
364
+ export type Options = {
365
+ /** Configurable account address. */
366
+ address: Address
367
+ /** Chain whose commitment the config must match. */
368
+ chainId: number
369
+ /** Config commitment read from the chain. */
370
+ commitment: Hex.Hex
371
+ }
372
+ }
373
+
348
374
  /** Middleware advertising configurable account support. */
349
375
  export type ReturnType = Plugin & { readonly [accountsBrand]: true }
350
376
  }
@@ -72,7 +72,10 @@ export type TransactionTempo<
72
72
  isPending extends boolean = boolean,
73
73
  type = 'tempo',
74
74
  > = PartialBy<
75
- Omit<TransactionBase<quantity, index, isPending>, 'input' | 'value' | 'to'>,
75
+ Omit<
76
+ TransactionBase<quantity, index, isPending>,
77
+ 'input' | 'nonce' | 'value' | 'to'
78
+ >,
76
79
  'r' | 's' | 'v' | 'yParity'
77
80
  > & {
78
81
  accessList: AccessList
@@ -83,12 +86,17 @@ export type TransactionTempo<
83
86
  feePayerSignature?: viem_Signature | undefined
84
87
  keyAuthorization?: KeyAuthorization.Signed<quantity, index> | null | undefined
85
88
  operation?: AccountOperation.TransactionOperation | undefined
89
+ /** Sequence number, or for expiring nonce transactions (TIP-1106) an opaque `uint64` discriminator, often above `Number.MAX_SAFE_INTEGER`. */
90
+ nonce: quantity
86
91
  nonceKey?: quantity | undefined
87
92
  signature: SignatureEnvelope.SignatureEnvelope
88
93
  type: type
89
94
  validBefore?: index | undefined
90
95
  validAfter?: index | undefined
91
- } & FeeValuesEIP1559<quantity>
96
+ } & Omit<FeeValuesEIP1559<quantity>, 'gasPrice'> & {
97
+ /** Effective gas price the transaction paid, once included. */
98
+ gasPrice?: quantity | undefined
99
+ }
92
100
 
93
101
  export type TransactionRequest<
94
102
  bigintType = bigint,
@@ -4,7 +4,6 @@ import type * as Hex from 'ox/Hex'
4
4
  import * as Json from 'ox/Json'
5
5
  import { AccountConfig } from 'ox/tempo'
6
6
  import { BaseError } from '../../errors/base.js'
7
- import { configurableAccountRecoveryFactory } from '../Addresses.js'
8
7
  import type * as Store from '../Store.js'
9
8
 
10
9
  /** A valid 48-owner config is much smaller; 64 KiB bounds hostile store parsing work. */
@@ -18,8 +17,8 @@ export async function read(
18
17
  store: Store.Store,
19
18
  options: read.Options,
20
19
  ): Promise<AccountConfig.Config | null> {
21
- const { address, commitment } = options
22
- const value = await store.getItem(key({ address, commitment }))
20
+ const { address, chainId, commitment } = options
21
+ const value = await store.getItem(key({ address, chainId, commitment }))
23
22
  if (value === null || value === undefined) return null
24
23
  const config = deserialize(value)
25
24
  assertKey({ address, commitment, config })
@@ -31,25 +30,43 @@ export declare namespace read {
31
30
  export type Options = {
32
31
  /** Configurable account address. */
33
32
  address: Address.Address
33
+ /** Chain whose commitment selects the config. */
34
+ chainId: number
34
35
  /** Config commitment observed onchain. */
35
36
  commitment: Hex.Hex
36
37
  }
37
38
  }
38
39
 
39
- /** Writes a validated account config. */
40
+ /**
41
+ * Writes a validated account config.
42
+ *
43
+ * Each key fixes one config, through its commitment or, before initialization, the account
44
+ * address. An existing key therefore holds the same config and is not written again.
45
+ */
40
46
  export async function write(
41
- store: Store.Store,
47
+ store: Store.Atomic,
42
48
  options: write.Options,
43
49
  ): Promise<void> {
44
- const { address, commitment } = options
45
- const config = AccountConfig.from(options.config)
50
+ const { address, chainId, commitment } = options
51
+ const config = (() => {
52
+ try {
53
+ return AccountConfig.from(options.config)
54
+ } catch (cause) {
55
+ throw new InvalidStoreValueError({ cause })
56
+ }
57
+ })()
46
58
  assertKey({ address, commitment, config })
47
59
  const value = serialize(config)
48
- await store.setItem(key({ address, commitment }), value)
60
+ await store.compareAndSet(key({ address, chainId, commitment }), null, value)
49
61
  // Initialization commits the version-zero config without changing its version.
50
62
  if (commitment.toLowerCase() === zeroCommitment)
51
- await store.setItem(
52
- key({ address, commitment: AccountConfig.getCommitment(config) }),
63
+ await store.compareAndSet(
64
+ key({
65
+ address,
66
+ chainId,
67
+ commitment: AccountConfig.getCommitment(config),
68
+ }),
69
+ null,
53
70
  value,
54
71
  )
55
72
  }
@@ -59,6 +76,8 @@ export declare namespace write {
59
76
  export type Options = {
60
77
  /** Configurable account address. */
61
78
  address: Address.Address
79
+ /** Chain whose commitment selects the config. */
80
+ chainId: number
62
81
  /** Config commitment used for lookup. */
63
82
  commitment: Hex.Hex
64
83
  /** Complete config. */
@@ -76,14 +95,7 @@ function assertKey(options: {
76
95
  if (!Address.validate(address) || !Hash.validate(commitment))
77
96
  throw new InvalidStoreValueError()
78
97
  if (config.version === 0n) {
79
- if (
80
- !Address.isEqual(
81
- AccountConfig.getAddress(config, {
82
- factory: configurableAccountRecoveryFactory,
83
- }),
84
- address,
85
- )
86
- )
98
+ if (!Address.isEqual(AccountConfig.getAddress(config), address))
87
99
  throw new InvalidStoreValueError()
88
100
  if (commitment.toLowerCase() === zeroCommitment) return
89
101
  }
@@ -105,10 +117,14 @@ function deserialize(value: string): AccountConfig.Config {
105
117
  }
106
118
  }
107
119
 
108
- /** Returns the store key for an account and config commitment. */
109
- function key(options: { address: Address.Address; commitment: Hex.Hex }) {
110
- const { address, commitment } = options
111
- return `configurableAccount:config:${address.toLowerCase()}:${commitment.toLowerCase()}`
120
+ /** Returns the store key for an account and config commitment on one chain. */
121
+ function key(options: {
122
+ address: Address.Address
123
+ chainId: number
124
+ commitment: Hex.Hex
125
+ }) {
126
+ const { address, chainId, commitment } = options
127
+ return `configurableAccount:config:${chainId}:${address.toLowerCase()}:${commitment.toLowerCase()}`
112
128
  }
113
129
 
114
130
  /** Serializes an account config for storage. */
@@ -124,8 +140,7 @@ function serialize(config: AccountConfig.Config): string {
124
140
  }
125
141
 
126
142
  /** Thrown when a stored account config is malformed or mismatched. */
127
- // biome-ignore lint/correctness/noUnusedVariables: declaration merge
128
- class InvalidStoreValueError extends BaseError {
143
+ export class InvalidStoreValueError extends BaseError {
129
144
  /** Creates an invalid store value error. */
130
145
  constructor(options: InvalidStoreValueError.Options = {}) {
131
146
  super('Stored account config is malformed or mismatched.', {
@@ -135,7 +150,7 @@ class InvalidStoreValueError extends BaseError {
135
150
  }
136
151
  }
137
152
 
138
- declare namespace InvalidStoreValueError {
153
+ export declare namespace InvalidStoreValueError {
139
154
  /** Error construction options. */
140
155
  export type Options = {
141
156
  /** Underlying error. */
@@ -28,8 +28,8 @@ import type * as Transaction from '../Transaction.js'
28
28
  * Derives a configurable account address from an initial config with the
29
29
  * configurable account precompile.
30
30
  *
31
- * The precompile validates the config and derives the address with the chain's
32
- * recovery factory. To derive the address locally, use
31
+ * The precompile validates the config and derives the address from its hash.
32
+ * To derive the address locally, use
33
33
  * `AccountConfig.getAddress` or `Account.fromConfig({ address: 'infer' })`.
34
34
  *
35
35
  * @example
@@ -15,6 +15,7 @@ import { maxUint256 } from '../constants/number.js'
15
15
  import { BaseError } from '../errors/base.js'
16
16
  import { ContractFunctionRevertedError } from '../errors/contract.js'
17
17
  import type { Chain, ChainConfig as viem_ChainConfig } from '../types/chain.js'
18
+ import type { RpcBlock } from '../types/rpc.js'
18
19
  import { isAddressEqual } from '../utils/address/isAddressEqual.js'
19
20
  import { extendSchema } from '../utils/chain/defineChain.js'
20
21
  import { defineTransaction } from '../utils/formatters/transaction.js'
@@ -41,6 +42,8 @@ const maxExpirySecs = 25
41
42
  const serializeTransaction = ((transaction, signature) =>
42
43
  Transaction.serialize(transaction, signature)) as SerializeTransactionFn
43
44
 
45
+ // The base formatters decode nonces as safe integers and throw on Tempo expiring nonces (random
46
+ // u64 values), so Tempo formats every transaction itself, including those inside blocks.
44
47
  export const chainConfig = {
45
48
  blockTime: 1_000,
46
49
  extendSchema: extendSchema<{
@@ -48,10 +51,18 @@ export const chainConfig = {
48
51
  hardfork?: Hardfork | undefined
49
52
  }>(),
50
53
  formatters: {
51
- transaction: defineTransaction({
52
- exclude: ['aaAuthorizationList' as never],
53
- format: Formatters.formatTransaction,
54
- }),
54
+ block: {
55
+ format: (block: RpcBlock) => Formatters.formatBlock(block),
56
+ type: 'block' as const,
57
+ },
58
+ transaction: {
59
+ ...defineTransaction({
60
+ exclude: ['aaAuthorizationList' as never],
61
+ format: Formatters.formatTransaction,
62
+ }),
63
+ format: (transaction: Transaction.TransactionRpc) =>
64
+ Formatters.formatTransaction(transaction),
65
+ },
55
66
  transactionReceipt: defineTransactionReceipt({
56
67
  format: Formatters.formatTransactionReceipt,
57
68
  }),