viem 1.5.4 → 1.6.2

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 (343) hide show
  1. package/chains/utils/package.json +5 -0
  2. package/dist/cjs/accounts/index.js +5 -1
  3. package/dist/cjs/accounts/index.js.map +1 -1
  4. package/dist/cjs/accounts/utils/privateKeyToAddress.js +12 -0
  5. package/dist/cjs/accounts/utils/privateKeyToAddress.js.map +1 -0
  6. package/dist/cjs/accounts/utils/signTransaction.js.map +1 -1
  7. package/dist/cjs/actions/getContract.js.map +1 -1
  8. package/dist/cjs/actions/public/estimateGas.js +3 -1
  9. package/dist/cjs/actions/public/estimateGas.js.map +1 -1
  10. package/dist/cjs/actions/public/multicall.js +2 -3
  11. package/dist/cjs/actions/public/multicall.js.map +1 -1
  12. package/dist/cjs/actions/public/watchContractEvent.js +134 -67
  13. package/dist/cjs/actions/public/watchContractEvent.js.map +1 -1
  14. package/dist/cjs/actions/public/watchEvent.js +136 -62
  15. package/dist/cjs/actions/public/watchEvent.js.map +1 -1
  16. package/dist/cjs/actions/wallet/sendTransaction.js.map +1 -1
  17. package/dist/cjs/actions/wallet/writeContract.js.map +1 -1
  18. package/dist/cjs/chains/{formatters/celo.js → celo/formatters.js} +1 -1
  19. package/dist/cjs/chains/celo/formatters.js.map +1 -0
  20. package/dist/cjs/chains/{serializers/celo.js → celo/serializers.js} +1 -1
  21. package/dist/cjs/chains/celo/serializers.js.map +1 -0
  22. package/dist/cjs/{types/formatter.js → chains/celo/types.js} +1 -1
  23. package/dist/cjs/chains/celo/types.js.map +1 -0
  24. package/dist/cjs/chains/index.js +32 -16
  25. package/dist/cjs/chains/index.js.map +1 -1
  26. package/dist/cjs/chains/optimism/fees.js +7 -0
  27. package/dist/cjs/chains/optimism/fees.js.map +1 -0
  28. package/dist/cjs/chains/{formatters/optimism.js → optimism/formatters.js} +13 -1
  29. package/dist/cjs/chains/optimism/formatters.js.map +1 -0
  30. package/dist/cjs/{types/serializer.js → chains/optimism/types.js} +1 -1
  31. package/dist/cjs/chains/optimism/types.js.map +1 -0
  32. package/dist/cjs/chains/utils.js +11 -0
  33. package/dist/cjs/chains/utils.js.map +1 -0
  34. package/dist/cjs/clients/decorators/public.js.map +1 -1
  35. package/dist/cjs/constants/number.js +96 -96
  36. package/dist/cjs/constants/number.js.map +1 -1
  37. package/dist/cjs/errors/node.js +1 -1
  38. package/dist/cjs/errors/node.js.map +1 -1
  39. package/dist/cjs/errors/version.js +1 -1
  40. package/dist/cjs/index.js.map +1 -1
  41. package/dist/cjs/utils/abi/decodeAbiParameters.js.map +1 -1
  42. package/dist/cjs/utils/abi/decodeDeployData.js.map +1 -1
  43. package/dist/cjs/utils/abi/decodeErrorResult.js.map +1 -1
  44. package/dist/cjs/utils/abi/decodeFunctionResult.js.map +1 -1
  45. package/dist/cjs/utils/abi/encodeAbiParameters.js.map +1 -1
  46. package/dist/cjs/utils/abi/encodeDeployData.js.map +1 -1
  47. package/dist/cjs/utils/abi/encodeEventTopics.js.map +1 -1
  48. package/dist/cjs/utils/abi/encodePacked.js.map +1 -1
  49. package/dist/cjs/utils/chain.js +5 -3
  50. package/dist/cjs/utils/chain.js.map +1 -1
  51. package/dist/cjs/utils/formatters/block.js.map +1 -1
  52. package/dist/cjs/utils/formatters/extract.js.map +1 -1
  53. package/dist/cjs/utils/formatters/formatter.js.map +1 -1
  54. package/dist/cjs/utils/formatters/transaction.js.map +1 -1
  55. package/dist/cjs/utils/formatters/transactionReceipt.js.map +1 -1
  56. package/dist/cjs/utils/formatters/transactionRequest.js.map +1 -1
  57. package/dist/cjs/utils/poll.js +1 -1
  58. package/dist/cjs/utils/poll.js.map +1 -1
  59. package/dist/cjs/utils/transaction/prepareRequest.js +15 -6
  60. package/dist/cjs/utils/transaction/prepareRequest.js.map +1 -1
  61. package/dist/cjs/utils/typedData.js +2 -2
  62. package/dist/cjs/utils/typedData.js.map +1 -1
  63. package/dist/esm/accounts/index.js +2 -0
  64. package/dist/esm/accounts/index.js.map +1 -1
  65. package/dist/esm/accounts/utils/privateKeyToAddress.js +15 -0
  66. package/dist/esm/accounts/utils/privateKeyToAddress.js.map +1 -0
  67. package/dist/esm/accounts/utils/signTransaction.js.map +1 -1
  68. package/dist/esm/actions/getContract.js.map +1 -1
  69. package/dist/esm/actions/public/estimateGas.js +4 -2
  70. package/dist/esm/actions/public/estimateGas.js.map +1 -1
  71. package/dist/esm/actions/public/multicall.js +2 -4
  72. package/dist/esm/actions/public/multicall.js.map +1 -1
  73. package/dist/esm/actions/public/watchContractEvent.js +145 -76
  74. package/dist/esm/actions/public/watchContractEvent.js.map +1 -1
  75. package/dist/esm/actions/public/watchEvent.js +146 -70
  76. package/dist/esm/actions/public/watchEvent.js.map +1 -1
  77. package/dist/esm/actions/wallet/sendTransaction.js +1 -1
  78. package/dist/esm/actions/wallet/sendTransaction.js.map +1 -1
  79. package/dist/esm/actions/wallet/writeContract.js.map +1 -1
  80. package/dist/esm/chains/{formatters/celo.js → celo/formatters.js} +2 -2
  81. package/dist/esm/chains/celo/formatters.js.map +1 -0
  82. package/dist/esm/chains/{serializers/celo.js → celo/serializers.js} +1 -1
  83. package/dist/esm/chains/celo/serializers.js.map +1 -0
  84. package/dist/esm/chains/celo/types.js +2 -0
  85. package/dist/esm/chains/celo/types.js.map +1 -0
  86. package/dist/esm/chains/index.js +23 -7
  87. package/dist/esm/chains/index.js.map +1 -1
  88. package/dist/esm/chains/optimism/fees.js +4 -0
  89. package/dist/esm/chains/optimism/fees.js.map +1 -0
  90. package/dist/esm/chains/{formatters/optimism.js → optimism/formatters.js} +15 -2
  91. package/dist/esm/chains/optimism/formatters.js.map +1 -0
  92. package/dist/esm/chains/optimism/types.js +2 -0
  93. package/dist/esm/chains/optimism/types.js.map +1 -0
  94. package/dist/esm/chains/utils.js +4 -0
  95. package/dist/esm/chains/utils.js.map +1 -0
  96. package/dist/esm/clients/decorators/public.js.map +1 -1
  97. package/dist/esm/constants/number.js +96 -96
  98. package/dist/esm/constants/number.js.map +1 -1
  99. package/dist/esm/errors/node.js +1 -1
  100. package/dist/esm/errors/node.js.map +1 -1
  101. package/dist/esm/errors/version.js +1 -1
  102. package/dist/esm/index.js.map +1 -1
  103. package/dist/esm/utils/abi/decodeAbiParameters.js.map +1 -1
  104. package/dist/esm/utils/abi/decodeDeployData.js.map +1 -1
  105. package/dist/esm/utils/abi/decodeErrorResult.js.map +1 -1
  106. package/dist/esm/utils/abi/decodeFunctionResult.js.map +1 -1
  107. package/dist/esm/utils/abi/encodeAbiParameters.js.map +1 -1
  108. package/dist/esm/utils/abi/encodeDeployData.js.map +1 -1
  109. package/dist/esm/utils/abi/encodeEventTopics.js.map +1 -1
  110. package/dist/esm/utils/abi/encodePacked.js.map +1 -1
  111. package/dist/esm/utils/chain.js +5 -3
  112. package/dist/esm/utils/chain.js.map +1 -1
  113. package/dist/esm/utils/formatters/block.js.map +1 -1
  114. package/dist/esm/utils/formatters/extract.js.map +1 -1
  115. package/dist/esm/utils/formatters/formatter.js.map +1 -1
  116. package/dist/esm/utils/formatters/transaction.js.map +1 -1
  117. package/dist/esm/utils/formatters/transactionReceipt.js.map +1 -1
  118. package/dist/esm/utils/formatters/transactionRequest.js.map +1 -1
  119. package/dist/esm/utils/poll.js +1 -1
  120. package/dist/esm/utils/poll.js.map +1 -1
  121. package/dist/esm/utils/transaction/prepareRequest.js +14 -5
  122. package/dist/esm/utils/transaction/prepareRequest.js.map +1 -1
  123. package/dist/esm/utils/typedData.js +2 -2
  124. package/dist/esm/utils/typedData.js.map +1 -1
  125. package/dist/types/accounts/index.d.ts +2 -0
  126. package/dist/types/accounts/index.d.ts.map +1 -1
  127. package/dist/types/accounts/types.d.ts +1 -1
  128. package/dist/types/accounts/types.d.ts.map +1 -1
  129. package/dist/types/accounts/utils/privateKeyToAddress.d.ts +11 -0
  130. package/dist/types/accounts/utils/privateKeyToAddress.d.ts.map +1 -0
  131. package/dist/types/accounts/utils/signTransaction.d.ts +2 -2
  132. package/dist/types/accounts/utils/signTransaction.d.ts.map +1 -1
  133. package/dist/types/accounts/utils/signTypedData.d.ts +1 -1
  134. package/dist/types/accounts/utils/signTypedData.d.ts.map +1 -1
  135. package/dist/types/actions/getContract.d.ts +5 -5
  136. package/dist/types/actions/getContract.d.ts.map +1 -1
  137. package/dist/types/actions/public/createContractEventFilter.d.ts +3 -3
  138. package/dist/types/actions/public/createContractEventFilter.d.ts.map +1 -1
  139. package/dist/types/actions/public/createEventFilter.d.ts +5 -5
  140. package/dist/types/actions/public/createEventFilter.d.ts.map +1 -1
  141. package/dist/types/actions/public/estimateContractGas.d.ts +1 -1
  142. package/dist/types/actions/public/estimateContractGas.d.ts.map +1 -1
  143. package/dist/types/actions/public/estimateGas.d.ts.map +1 -1
  144. package/dist/types/actions/public/getFilterChanges.d.ts +1 -1
  145. package/dist/types/actions/public/getFilterChanges.d.ts.map +1 -1
  146. package/dist/types/actions/public/getFilterLogs.d.ts +1 -1
  147. package/dist/types/actions/public/getFilterLogs.d.ts.map +1 -1
  148. package/dist/types/actions/public/getLogs.d.ts +4 -4
  149. package/dist/types/actions/public/getLogs.d.ts.map +1 -1
  150. package/dist/types/actions/public/getTransactionReceipt.d.ts +1 -1
  151. package/dist/types/actions/public/getTransactionReceipt.d.ts.map +1 -1
  152. package/dist/types/actions/public/multicall.d.ts +1 -1
  153. package/dist/types/actions/public/multicall.d.ts.map +1 -1
  154. package/dist/types/actions/public/readContract.d.ts +1 -1
  155. package/dist/types/actions/public/readContract.d.ts.map +1 -1
  156. package/dist/types/actions/public/simulateContract.d.ts +3 -3
  157. package/dist/types/actions/public/simulateContract.d.ts.map +1 -1
  158. package/dist/types/actions/public/watchContractEvent.d.ts +34 -8
  159. package/dist/types/actions/public/watchContractEvent.d.ts.map +1 -1
  160. package/dist/types/actions/public/watchEvent.d.ts +35 -12
  161. package/dist/types/actions/public/watchEvent.d.ts.map +1 -1
  162. package/dist/types/actions/wallet/deployContract.d.ts +4 -4
  163. package/dist/types/actions/wallet/deployContract.d.ts.map +1 -1
  164. package/dist/types/actions/wallet/sendTransaction.d.ts +2 -2
  165. package/dist/types/actions/wallet/sendTransaction.d.ts.map +1 -1
  166. package/dist/types/actions/wallet/signTypedData.d.ts +1 -1
  167. package/dist/types/actions/wallet/signTypedData.d.ts.map +1 -1
  168. package/dist/types/actions/wallet/writeContract.d.ts +4 -2
  169. package/dist/types/actions/wallet/writeContract.d.ts.map +1 -1
  170. package/dist/types/chains/{formatters/celo.d.ts → celo/formatters.d.ts} +26 -85
  171. package/dist/types/chains/celo/formatters.d.ts.map +1 -0
  172. package/dist/types/chains/{serializers/celo.d.ts → celo/serializers.d.ts} +4 -4
  173. package/dist/types/chains/celo/serializers.d.ts.map +1 -0
  174. package/dist/types/chains/celo/types.d.ts +60 -0
  175. package/dist/types/chains/celo/types.d.ts.map +1 -0
  176. package/dist/types/chains/index.d.ts +2681 -2790
  177. package/dist/types/chains/index.d.ts.map +1 -1
  178. package/dist/types/chains/optimism/fees.d.ts +4 -0
  179. package/dist/types/chains/optimism/fees.d.ts.map +1 -0
  180. package/dist/types/chains/{formatters/optimism.d.ts → optimism/formatters.d.ts} +77 -54
  181. package/dist/types/chains/optimism/formatters.d.ts.map +1 -0
  182. package/dist/types/chains/optimism/types.d.ts +53 -0
  183. package/dist/types/chains/optimism/types.d.ts.map +1 -0
  184. package/dist/types/chains/utils.d.ts +6 -0
  185. package/dist/types/chains/utils.d.ts.map +1 -0
  186. package/dist/types/clients/decorators/public.d.ts +10 -10
  187. package/dist/types/clients/decorators/public.d.ts.map +1 -1
  188. package/dist/types/clients/decorators/wallet.d.ts +3 -3
  189. package/dist/types/clients/decorators/wallet.d.ts.map +1 -1
  190. package/dist/types/constants/number.d.ts.map +1 -1
  191. package/dist/types/errors/node.d.ts.map +1 -1
  192. package/dist/types/errors/version.d.ts +1 -1
  193. package/dist/types/index.d.ts +14 -4
  194. package/dist/types/index.d.ts.map +1 -1
  195. package/dist/types/types/chain.d.ts +52 -8
  196. package/dist/types/types/chain.d.ts.map +1 -1
  197. package/dist/types/types/multicall.d.ts +8 -8
  198. package/dist/types/types/multicall.d.ts.map +1 -1
  199. package/dist/types/types/rpc.d.ts +1 -1
  200. package/dist/types/types/rpc.d.ts.map +1 -1
  201. package/dist/types/types/typedData.d.ts +3 -3
  202. package/dist/types/types/typedData.d.ts.map +1 -1
  203. package/dist/types/types/utils.d.ts +10 -0
  204. package/dist/types/types/utils.d.ts.map +1 -1
  205. package/dist/types/utils/abi/decodeAbiParameters.d.ts +2 -2
  206. package/dist/types/utils/abi/decodeAbiParameters.d.ts.map +1 -1
  207. package/dist/types/utils/abi/decodeDeployData.d.ts +3 -3
  208. package/dist/types/utils/abi/decodeDeployData.d.ts.map +1 -1
  209. package/dist/types/utils/abi/decodeErrorResult.d.ts +3 -3
  210. package/dist/types/utils/abi/decodeErrorResult.d.ts.map +1 -1
  211. package/dist/types/utils/abi/decodeEventLog.d.ts +3 -3
  212. package/dist/types/utils/abi/decodeEventLog.d.ts.map +1 -1
  213. package/dist/types/utils/abi/decodeFunctionResult.d.ts +4 -4
  214. package/dist/types/utils/abi/decodeFunctionResult.d.ts.map +1 -1
  215. package/dist/types/utils/abi/encodeAbiParameters.d.ts +2 -2
  216. package/dist/types/utils/abi/encodeAbiParameters.d.ts.map +1 -1
  217. package/dist/types/utils/abi/encodeDeployData.d.ts +3 -3
  218. package/dist/types/utils/abi/encodeDeployData.d.ts.map +1 -1
  219. package/dist/types/utils/abi/encodeErrorResult.d.ts +4 -4
  220. package/dist/types/utils/abi/encodeErrorResult.d.ts.map +1 -1
  221. package/dist/types/utils/abi/encodeEventTopics.d.ts +4 -4
  222. package/dist/types/utils/abi/encodeEventTopics.d.ts.map +1 -1
  223. package/dist/types/utils/abi/encodeFunctionData.d.ts +4 -4
  224. package/dist/types/utils/abi/encodeFunctionData.d.ts.map +1 -1
  225. package/dist/types/utils/abi/encodeFunctionResult.d.ts +4 -4
  226. package/dist/types/utils/abi/encodeFunctionResult.d.ts.map +1 -1
  227. package/dist/types/utils/abi/encodePacked.d.ts +3 -3
  228. package/dist/types/utils/abi/encodePacked.d.ts.map +1 -1
  229. package/dist/types/utils/abi/getAbiItem.d.ts +3 -3
  230. package/dist/types/utils/abi/getAbiItem.d.ts.map +1 -1
  231. package/dist/types/utils/chain.d.ts +3 -6
  232. package/dist/types/utils/chain.d.ts.map +1 -1
  233. package/dist/types/utils/formatters/block.d.ts +7 -3
  234. package/dist/types/utils/formatters/block.d.ts.map +1 -1
  235. package/dist/types/utils/formatters/extract.d.ts +2 -2
  236. package/dist/types/utils/formatters/extract.d.ts.map +1 -1
  237. package/dist/types/utils/formatters/formatter.d.ts +1 -1
  238. package/dist/types/utils/formatters/transaction.d.ts +8 -4
  239. package/dist/types/utils/formatters/transaction.d.ts.map +1 -1
  240. package/dist/types/utils/formatters/transactionReceipt.d.ts +3 -4
  241. package/dist/types/utils/formatters/transactionReceipt.d.ts.map +1 -1
  242. package/dist/types/utils/formatters/transactionRequest.d.ts +4 -5
  243. package/dist/types/utils/formatters/transactionRequest.d.ts.map +1 -1
  244. package/dist/types/utils/signature/hashTypedData.d.ts +1 -1
  245. package/dist/types/utils/signature/hashTypedData.d.ts.map +1 -1
  246. package/dist/types/utils/signature/recoverTypedDataAddress.d.ts +1 -1
  247. package/dist/types/utils/signature/recoverTypedDataAddress.d.ts.map +1 -1
  248. package/dist/types/utils/signature/verifyTypedData.d.ts +1 -1
  249. package/dist/types/utils/signature/verifyTypedData.d.ts.map +1 -1
  250. package/dist/types/utils/transaction/prepareRequest.d.ts +6 -11
  251. package/dist/types/utils/transaction/prepareRequest.d.ts.map +1 -1
  252. package/dist/types/utils/typedData.d.ts +1 -1
  253. package/dist/types/utils/typedData.d.ts.map +1 -1
  254. package/package.json +9 -3
  255. package/src/accounts/index.ts +6 -0
  256. package/src/accounts/types.ts +1 -1
  257. package/src/accounts/utils/privateKeyToAddress.ts +20 -0
  258. package/src/accounts/utils/signTransaction.ts +2 -2
  259. package/src/accounts/utils/signTypedData.ts +1 -1
  260. package/src/actions/getContract.ts +6 -5
  261. package/src/actions/public/createContractEventFilter.ts +3 -3
  262. package/src/actions/public/createEventFilter.ts +6 -6
  263. package/src/actions/public/estimateContractGas.ts +1 -1
  264. package/src/actions/public/estimateGas.ts +11 -2
  265. package/src/actions/public/getFilterChanges.ts +1 -1
  266. package/src/actions/public/getFilterLogs.ts +1 -1
  267. package/src/actions/public/getLogs.ts +5 -5
  268. package/src/actions/public/multicall.ts +9 -8
  269. package/src/actions/public/readContract.ts +1 -1
  270. package/src/actions/public/simulateContract.ts +3 -3
  271. package/src/actions/public/watchContractEvent.ts +204 -90
  272. package/src/actions/public/watchEvent.ts +232 -111
  273. package/src/actions/wallet/deployContract.ts +4 -4
  274. package/src/actions/wallet/sendTransaction.ts +9 -6
  275. package/src/actions/wallet/signTypedData.ts +1 -1
  276. package/src/actions/wallet/writeContract.ts +12 -8
  277. package/src/chains/{formatters/celo.ts → celo/formatters.ts} +29 -48
  278. package/src/chains/{serializers/celo.ts → celo/serializers.ts} +5 -5
  279. package/src/chains/celo/types.ts +111 -0
  280. package/src/chains/index.ts +23 -7
  281. package/src/chains/optimism/fees.ts +5 -0
  282. package/src/chains/optimism/formatters.ts +74 -0
  283. package/src/chains/optimism/types.ts +102 -0
  284. package/src/chains/utils.ts +41 -0
  285. package/src/clients/decorators/public.ts +16 -16
  286. package/src/clients/decorators/wallet.ts +3 -3
  287. package/src/constants/number.ts +96 -96
  288. package/src/errors/node.ts +2 -1
  289. package/src/errors/version.ts +1 -1
  290. package/src/index.ts +25 -8
  291. package/src/types/chain.ts +91 -14
  292. package/src/types/multicall.ts +14 -11
  293. package/src/types/rpc.ts +2 -6
  294. package/src/types/typedData.ts +2 -3
  295. package/src/types/utils.ts +11 -0
  296. package/src/utils/abi/decodeAbiParameters.ts +7 -8
  297. package/src/utils/abi/decodeDeployData.ts +3 -3
  298. package/src/utils/abi/decodeErrorResult.ts +3 -8
  299. package/src/utils/abi/decodeEventLog.ts +3 -3
  300. package/src/utils/abi/decodeFunctionResult.ts +4 -6
  301. package/src/utils/abi/encodeAbiParameters.ts +8 -9
  302. package/src/utils/abi/encodeDeployData.ts +3 -3
  303. package/src/utils/abi/encodeErrorResult.ts +4 -4
  304. package/src/utils/abi/encodeEventTopics.ts +4 -9
  305. package/src/utils/abi/encodeFunctionData.ts +4 -4
  306. package/src/utils/abi/encodeFunctionResult.ts +4 -4
  307. package/src/utils/abi/encodePacked.ts +6 -8
  308. package/src/utils/abi/getAbiItem.ts +3 -3
  309. package/src/utils/chain.ts +21 -10
  310. package/src/utils/formatters/block.ts +8 -6
  311. package/src/utils/formatters/extract.ts +2 -2
  312. package/src/utils/formatters/formatter.ts +2 -2
  313. package/src/utils/formatters/transaction.ts +8 -6
  314. package/src/utils/formatters/transactionReceipt.ts +9 -3
  315. package/src/utils/formatters/transactionRequest.ts +9 -3
  316. package/src/utils/poll.ts +1 -1
  317. package/src/utils/signature/hashTypedData.ts +1 -1
  318. package/src/utils/signature/recoverTypedDataAddress.ts +1 -1
  319. package/src/utils/signature/verifyTypedData.ts +1 -1
  320. package/src/utils/transaction/prepareRequest.ts +48 -22
  321. package/src/utils/typedData.ts +2 -3
  322. package/dist/cjs/chains/formatters/celo.js.map +0 -1
  323. package/dist/cjs/chains/formatters/optimism.js.map +0 -1
  324. package/dist/cjs/chains/serializers/celo.js.map +0 -1
  325. package/dist/cjs/types/formatter.js.map +0 -1
  326. package/dist/cjs/types/serializer.js.map +0 -1
  327. package/dist/esm/chains/formatters/celo.js.map +0 -1
  328. package/dist/esm/chains/formatters/optimism.js.map +0 -1
  329. package/dist/esm/chains/serializers/celo.js.map +0 -1
  330. package/dist/esm/types/formatter.js +0 -2
  331. package/dist/esm/types/formatter.js.map +0 -1
  332. package/dist/esm/types/serializer.js +0 -2
  333. package/dist/esm/types/serializer.js.map +0 -1
  334. package/dist/types/chains/formatters/celo.d.ts.map +0 -1
  335. package/dist/types/chains/formatters/optimism.d.ts.map +0 -1
  336. package/dist/types/chains/serializers/celo.d.ts.map +0 -1
  337. package/dist/types/types/formatter.d.ts +0 -17
  338. package/dist/types/types/formatter.d.ts.map +0 -1
  339. package/dist/types/types/serializer.d.ts +0 -7
  340. package/dist/types/types/serializer.d.ts.map +0 -1
  341. package/src/chains/formatters/optimism.ts +0 -91
  342. package/src/types/formatter.ts +0 -42
  343. package/src/types/serializer.ts +0 -19
@@ -1,4 +1,4 @@
1
- import type { AbiEvent, Address, Narrow } from 'abitype'
1
+ import type { Abi, AbiEvent, Address } from 'abitype'
2
2
 
3
3
  import type { Client } from '../../clients/createClient.js'
4
4
  import type { Transport } from '../../clients/transports/createTransport.js'
@@ -9,11 +9,23 @@ import type {
9
9
  } from '../../types/contract.js'
10
10
  import type { Filter } from '../../types/filter.js'
11
11
  import type { Log } from '../../types/log.js'
12
+ import type { LogTopic } from '../../types/misc.js'
13
+ import type { GetTransportConfig } from '../../types/transport.js'
14
+ import type { EncodeEventTopicsParameters } from '../../utils/index.js'
12
15
  import { observe } from '../../utils/observe.js'
13
16
  import { poll } from '../../utils/poll.js'
14
17
  import { stringify } from '../../utils/stringify.js'
15
18
 
19
+ import {
20
+ DecodeLogDataMismatch,
21
+ DecodeLogTopicsMismatch,
22
+ } from '../../errors/abi.js'
16
23
  import { InvalidInputRpcError } from '../../errors/rpc.js'
24
+ import {
25
+ decodeEventLog,
26
+ encodeEventTopics,
27
+ formatLog,
28
+ } from '../../utils/index.js'
17
29
  import {
18
30
  type CreateEventFilterParameters,
19
31
  createEventFilter,
@@ -23,6 +35,19 @@ import { getFilterChanges } from './getFilterChanges.js'
23
35
  import { type GetLogsParameters, getLogs } from './getLogs.js'
24
36
  import { uninstallFilter } from './uninstallFilter.js'
25
37
 
38
+ type PollOptions = {
39
+ /**
40
+ * Whether or not the transaction hashes should be batched on each invocation.
41
+ * @default true
42
+ */
43
+ batch?: boolean
44
+ /**
45
+ * Polling frequency (in ms). Defaults to Client's pollingInterval config.
46
+ * @default client.pollingInterval
47
+ */
48
+ pollingInterval?: number
49
+ }
50
+
26
51
  export type WatchEventOnLogsParameter<
27
52
  TAbiEvent extends AbiEvent | undefined = undefined,
28
53
  TAbiEvents extends
@@ -55,45 +80,59 @@ export type WatchEventParameters<
55
80
  > = {
56
81
  /** The address of the contract. */
57
82
  address?: Address | Address[]
58
- /**
59
- * Whether or not the event logs should be batched on each invocation.
60
- * @default true
61
- */
62
- batch?: boolean
63
83
  /** The callback to call when an error occurred when trying to get for a new block. */
64
84
  onError?: (error: Error) => void
65
85
  /** The callback to call when new event logs are received. */
66
86
  onLogs: WatchEventOnLogsFn<TAbiEvent, TAbiEvents, TStrict, _EventName>
67
- /** Polling frequency (in ms). Defaults to Client's pollingInterval config. */
68
- pollingInterval?: number
69
- } & (
70
- | {
71
- event: Narrow<TAbiEvent>
72
- events?: never
73
- args?: MaybeExtractEventArgsFromAbi<TAbiEvents, _EventName>
74
- /**
75
- * Whether or not the logs must match the indexed/non-indexed arguments on `event`.
76
- * @default false
77
- */
78
- strict?: TStrict
79
- }
80
- | {
81
- event?: never
82
- events?: Narrow<TAbiEvents>
83
- args?: never
84
- /**
85
- * Whether or not the logs must match the indexed/non-indexed arguments on `event`.
86
- * @default false
87
- */
88
- strict?: TStrict
89
- }
90
- | {
91
- event?: never
92
- events?: never
93
- args?: never
94
- strict?: never
95
- }
96
- )
87
+ } & (GetTransportConfig<Transport>['type'] extends 'webSocket'
88
+ ?
89
+ | {
90
+ batch?: never
91
+ /**
92
+ * Whether or not the WebSocket Transport should poll the JSON-RPC, rather than using `eth_subscribe`.
93
+ * @default false
94
+ */
95
+ poll?: false
96
+ pollingInterval?: never
97
+ }
98
+ | (PollOptions & {
99
+ /**
100
+ * Whether or not the WebSocket Transport should poll the JSON-RPC, rather than using `eth_subscribe`.
101
+ * @default true
102
+ */
103
+ poll?: true
104
+ })
105
+ : PollOptions & {
106
+ poll?: true
107
+ }) &
108
+ (
109
+ | {
110
+ event: TAbiEvent
111
+ events?: never
112
+ args?: MaybeExtractEventArgsFromAbi<TAbiEvents, _EventName>
113
+ /**
114
+ * Whether or not the logs must match the indexed/non-indexed arguments on `event`.
115
+ * @default false
116
+ */
117
+ strict?: TStrict
118
+ }
119
+ | {
120
+ event?: never
121
+ events?: TAbiEvents
122
+ args?: never
123
+ /**
124
+ * Whether or not the logs must match the indexed/non-indexed arguments on `event`.
125
+ * @default false
126
+ */
127
+ strict?: TStrict
128
+ }
129
+ | {
130
+ event?: never
131
+ events?: never
132
+ args?: never
133
+ strict?: never
134
+ }
135
+ )
97
136
 
98
137
  export type WatchEventReturnType = () => void
99
138
 
@@ -131,8 +170,8 @@ export type WatchEventReturnType = () => void
131
170
  */
132
171
  export function watchEvent<
133
172
  TChain extends Chain | undefined,
134
- TAbiEvent extends AbiEvent | undefined = undefined,
135
- TAbiEvents extends
173
+ const TAbiEvent extends AbiEvent | undefined = undefined,
174
+ const TAbiEvents extends
136
175
  | readonly AbiEvent[]
137
176
  | readonly unknown[]
138
177
  | undefined = TAbiEvent extends AbiEvent ? [TAbiEvent] : undefined,
@@ -148,94 +187,176 @@ export function watchEvent<
148
187
  events,
149
188
  onError,
150
189
  onLogs,
190
+ poll: poll_,
151
191
  pollingInterval = client.pollingInterval,
152
192
  strict: strict_,
153
193
  }: WatchEventParameters<TAbiEvent, TAbiEvents, TStrict>,
154
194
  ): WatchEventReturnType {
155
- const observerId = stringify([
156
- 'watchEvent',
157
- address,
158
- args,
159
- batch,
160
- client.uid,
161
- event,
162
- pollingInterval,
163
- ])
195
+ const enablePolling =
196
+ typeof poll_ !== 'undefined' ? poll_ : client.transport.type !== 'webSocket'
164
197
  const strict = strict_ ?? false
165
198
 
166
- return observe(observerId, { onLogs, onError }, (emit) => {
167
- let previousBlockNumber: bigint
168
- let filter: Filter<'event', TAbiEvents, _EventName, any>
169
- let initialized = false
199
+ const pollEvent = () => {
200
+ const observerId = stringify([
201
+ 'watchEvent',
202
+ address,
203
+ args,
204
+ batch,
205
+ client.uid,
206
+ event,
207
+ pollingInterval,
208
+ ])
170
209
 
171
- const unwatch = poll(
172
- async () => {
173
- if (!initialized) {
174
- try {
175
- filter = (await createEventFilter(client, {
176
- address,
177
- args,
178
- event: event!,
179
- events,
180
- strict,
181
- } as unknown as CreateEventFilterParameters)) as unknown as Filter<
182
- 'event',
183
- TAbiEvents,
184
- _EventName
185
- >
186
- } catch {}
187
- initialized = true
188
- return
189
- }
210
+ return observe(observerId, { onLogs, onError }, (emit) => {
211
+ let previousBlockNumber: bigint
212
+ let filter: Filter<'event', TAbiEvents, _EventName, any>
213
+ let initialized = false
190
214
 
191
- try {
192
- let logs: Log[]
193
- if (filter) {
194
- logs = await getFilterChanges(client, { filter })
195
- } else {
196
- // If the filter doesn't exist, we will fall back to use `getLogs`.
197
- // The fall back exists because some RPC Providers do not support filters.
198
-
199
- // Fetch the block number to use for `getLogs`.
200
- const blockNumber = await getBlockNumber(client)
201
-
202
- // If the block number has changed, we will need to fetch the logs.
203
- // If the block number doesn't exist, we are yet to reach the first poll interval,
204
- // so do not emit any logs.
205
- if (previousBlockNumber && previousBlockNumber !== blockNumber) {
206
- logs = await getLogs(client, {
215
+ const unwatch = poll(
216
+ async () => {
217
+ if (!initialized) {
218
+ try {
219
+ filter = (await createEventFilter(client, {
207
220
  address,
208
221
  args,
209
222
  event: event!,
210
223
  events,
211
- fromBlock: previousBlockNumber + 1n,
212
- toBlock: blockNumber,
213
- } as unknown as GetLogsParameters)
224
+ strict,
225
+ } as unknown as CreateEventFilterParameters)) as unknown as Filter<
226
+ 'event',
227
+ TAbiEvents,
228
+ _EventName
229
+ >
230
+ } catch {}
231
+ initialized = true
232
+ return
233
+ }
234
+
235
+ try {
236
+ let logs: Log[]
237
+ if (filter) {
238
+ logs = await getFilterChanges(client, { filter })
214
239
  } else {
215
- logs = []
240
+ // If the filter doesn't exist, we will fall back to use `getLogs`.
241
+ // The fall back exists because some RPC Providers do not support filters.
242
+
243
+ // Fetch the block number to use for `getLogs`.
244
+ const blockNumber = await getBlockNumber(client)
245
+
246
+ // If the block number has changed, we will need to fetch the logs.
247
+ // If the block number doesn't exist, we are yet to reach the first poll interval,
248
+ // so do not emit any logs.
249
+ if (previousBlockNumber && previousBlockNumber !== blockNumber) {
250
+ logs = await getLogs(client, {
251
+ address,
252
+ args,
253
+ event: event!,
254
+ events,
255
+ fromBlock: previousBlockNumber + 1n,
256
+ toBlock: blockNumber,
257
+ } as unknown as GetLogsParameters)
258
+ } else {
259
+ logs = []
260
+ }
261
+ previousBlockNumber = blockNumber
216
262
  }
217
- previousBlockNumber = blockNumber
263
+
264
+ if (logs.length === 0) return
265
+ if (batch) emit.onLogs(logs as any)
266
+ else logs.forEach((log) => emit.onLogs([log] as any))
267
+ } catch (err) {
268
+ // If a filter has been set and gets uninstalled, providers will throw an InvalidInput error.
269
+ // Reinitalize the filter when this occurs
270
+ if (filter && err instanceof InvalidInputRpcError)
271
+ initialized = false
272
+ emit.onError?.(err as Error)
218
273
  }
274
+ },
275
+ {
276
+ emitOnBegin: true,
277
+ interval: pollingInterval,
278
+ },
279
+ )
280
+
281
+ return async () => {
282
+ if (filter) await uninstallFilter(client, { filter })
283
+ unwatch()
284
+ }
285
+ })
286
+ }
219
287
 
220
- if (logs.length === 0) return
221
- if (batch) emit.onLogs(logs as any)
222
- else logs.forEach((log) => emit.onLogs([log] as any))
223
- } catch (err) {
224
- // If a filter has been set and gets uninstalled, providers will throw an InvalidInput error.
225
- // Reinitalize the filter when this occurs
226
- if (filter && err instanceof InvalidInputRpcError) initialized = false
227
- emit.onError?.(err as Error)
288
+ const subscribeEvent = () => {
289
+ let active = true
290
+ let unsubscribe = () => (active = false)
291
+ ;(async () => {
292
+ try {
293
+ const events_ = events ?? (event ? [event] : undefined)
294
+ let topics: LogTopic[] = []
295
+ if (events_) {
296
+ topics = [
297
+ (events_ as AbiEvent[]).flatMap((event) =>
298
+ encodeEventTopics({
299
+ abi: [event],
300
+ eventName: (event as AbiEvent).name,
301
+ args,
302
+ } as EncodeEventTopicsParameters),
303
+ ),
304
+ ]
305
+ if (event) topics = topics[0] as LogTopic[]
228
306
  }
229
- },
230
- {
231
- emitOnBegin: true,
232
- interval: pollingInterval,
233
- },
234
- )
235
-
236
- return async () => {
237
- if (filter) await uninstallFilter(client, { filter })
238
- unwatch()
239
- }
240
- })
307
+
308
+ const { unsubscribe: unsubscribe_ } = await client.transport.subscribe({
309
+ params: ['logs', { address, topics }],
310
+ onData(data: any) {
311
+ if (!active) return
312
+ const log = data.result
313
+ try {
314
+ const { eventName, args } = decodeEventLog({
315
+ abi: events_ as Abi,
316
+ data: log.data,
317
+ topics: log.topics as any,
318
+ strict,
319
+ })
320
+ const formatted = formatLog(log, {
321
+ args,
322
+ eventName: eventName as string,
323
+ })
324
+ onLogs([formatted] as any)
325
+ } catch (err) {
326
+ let eventName
327
+ let isUnnamed
328
+ if (
329
+ err instanceof DecodeLogDataMismatch ||
330
+ err instanceof DecodeLogTopicsMismatch
331
+ ) {
332
+ // If strict mode is on, and log data/topics do not match event definition, skip.
333
+ if (strict_) return
334
+ eventName = err.abiItem.name
335
+ isUnnamed = err.abiItem.inputs?.some(
336
+ (x) => !('name' in x && x.name),
337
+ )
338
+ }
339
+
340
+ // Set args to empty if there is an error decoding (e.g. indexed/non-indexed params mismatch).
341
+ const formatted = formatLog(log, {
342
+ args: isUnnamed ? [] : {},
343
+ eventName,
344
+ })
345
+ onLogs([formatted] as any)
346
+ }
347
+ },
348
+ onError(error: Error) {
349
+ onError?.(error)
350
+ },
351
+ })
352
+ unsubscribe = unsubscribe_
353
+ if (!active) unsubscribe()
354
+ } catch (err) {
355
+ onError?.(err as Error)
356
+ }
357
+ })()
358
+ return unsubscribe
359
+ }
360
+
361
+ return enablePolling ? pollEvent() : subscribeEvent()
241
362
  }
@@ -1,4 +1,4 @@
1
- import type { Abi, Narrow } from 'abitype'
1
+ import type { Abi } from 'abitype'
2
2
 
3
3
  import type { Account } from '../../accounts/types.js'
4
4
  import type { Client } from '../../clients/createClient.js'
@@ -19,12 +19,12 @@ export type DeployContractParameters<
19
19
  TAbi extends Abi | readonly unknown[] = Abi,
20
20
  TChain extends Chain | undefined = Chain | undefined,
21
21
  TAccount extends Account | undefined = Account | undefined,
22
- TChainOverride extends Chain | undefined = undefined,
22
+ TChainOverride extends Chain | undefined = Chain | undefined,
23
23
  > = UnionOmit<
24
24
  SendTransactionParameters<TChain, TAccount, TChainOverride>,
25
25
  'accessList' | 'chain' | 'to' | 'data'
26
26
  > & {
27
- abi: Narrow<TAbi>
27
+ abi: TAbi
28
28
  bytecode: Hex
29
29
  } & GetChain<TChain, TChainOverride> &
30
30
  GetConstructorArgs<TAbi>
@@ -59,7 +59,7 @@ export type DeployContractReturnType = SendTransactionReturnType
59
59
  * })
60
60
  */
61
61
  export function deployContract<
62
- TAbi extends Abi | readonly unknown[],
62
+ const TAbi extends Abi | readonly unknown[],
63
63
  TChain extends Chain | undefined,
64
64
  TAccount extends Account | undefined,
65
65
  TChainOverride extends Chain | undefined,
@@ -11,7 +11,7 @@ import type {
11
11
  TransactionRequest,
12
12
  TransactionSerializable,
13
13
  } from '../../types/transaction.js'
14
- import type { IsUndefined, UnionOmit } from '../../types/utils.js'
14
+ import type { UnionOmit } from '../../types/utils.js'
15
15
  import { assertCurrentChain } from '../../utils/chain.js'
16
16
  import { getTransactionError } from '../../utils/errors/getTransactionError.js'
17
17
  import { extract } from '../../utils/formatters/extract.js'
@@ -19,17 +19,20 @@ import {
19
19
  type FormattedTransactionRequest,
20
20
  formatTransactionRequest,
21
21
  } from '../../utils/formatters/transactionRequest.js'
22
- import { assertRequest } from '../../utils/transaction/assertRequest.js'
22
+ import {
23
+ type AssertRequestParameters,
24
+ assertRequest,
25
+ } from '../../utils/transaction/assertRequest.js'
23
26
  import { prepareRequest } from '../../utils/transaction/prepareRequest.js'
24
27
  import { getChainId } from '../public/getChainId.js'
25
28
 
26
29
  export type SendTransactionParameters<
27
30
  TChain extends Chain | undefined = Chain | undefined,
28
31
  TAccount extends Account | undefined = Account | undefined,
29
- TChainOverride extends Chain | undefined = Chain,
32
+ TChainOverride extends Chain | undefined = Chain | undefined,
30
33
  > = UnionOmit<
31
34
  FormattedTransactionRequest<
32
- IsUndefined<TChain> extends true ? TChainOverride : TChain
35
+ TChainOverride extends Chain ? TChainOverride : TChain
33
36
  >,
34
37
  'from'
35
38
  > &
@@ -113,7 +116,7 @@ export async function sendTransaction<
113
116
  const account = parseAccount(account_)
114
117
 
115
118
  try {
116
- assertRequest(args)
119
+ assertRequest(args as AssertRequestParameters)
117
120
 
118
121
  let chainId
119
122
  if (chain !== null) {
@@ -139,7 +142,7 @@ export async function sendTransaction<
139
142
  to,
140
143
  value,
141
144
  ...rest,
142
- })
145
+ } as any)
143
146
 
144
147
  if (!chainId) chainId = await getChainId(client)
145
148
 
@@ -121,7 +121,7 @@ export type SignTypedDataReturnType = Hex
121
121
  * })
122
122
  */
123
123
  export async function signTypedData<
124
- TTypedData extends TypedData | { [key: string]: unknown },
124
+ const TTypedData extends TypedData | { [key: string]: unknown },
125
125
  TPrimaryType extends string,
126
126
  TChain extends Chain | undefined,
127
127
  TAccount extends Account | undefined,
@@ -3,6 +3,7 @@ import type { Abi } from 'abitype'
3
3
  import type { Account } from '../../accounts/types.js'
4
4
  import type { Client } from '../../clients/createClient.js'
5
5
  import type { Transport } from '../../clients/transports/createTransport.js'
6
+ import type { GetAccountParameter } from '../../types/account.js'
6
7
  import type { Chain, GetChain } from '../../types/chain.js'
7
8
  import type { ContractFunctionConfig, GetValue } from '../../types/contract.js'
8
9
  import type { Hex } from '../../types/misc.js'
@@ -11,7 +12,7 @@ import {
11
12
  type EncodeFunctionDataParameters,
12
13
  encodeFunctionData,
13
14
  } from '../../utils/abi/encodeFunctionData.js'
14
-
15
+ import type { FormattedTransactionRequest } from '../../utils/formatters/transactionRequest.js'
15
16
  import {
16
17
  type SendTransactionParameters,
17
18
  type SendTransactionReturnType,
@@ -22,14 +23,17 @@ export type WriteContractParameters<
22
23
  TAbi extends Abi | readonly unknown[] = Abi,
23
24
  TFunctionName extends string = string,
24
25
  TChain extends Chain | undefined = Chain,
25
- TAccount extends Account | undefined = undefined,
26
- TChainOverride extends Chain | undefined = undefined,
26
+ TAccount extends Account | undefined = Account | undefined,
27
+ TChainOverride extends Chain | undefined = Chain | undefined,
27
28
  > = ContractFunctionConfig<TAbi, TFunctionName, 'payable' | 'nonpayable'> &
29
+ GetAccountParameter<TAccount> &
30
+ GetChain<TChain, TChainOverride> &
28
31
  UnionOmit<
29
- SendTransactionParameters<TChain, TAccount, TChainOverride>,
30
- 'chain' | 'to' | 'data' | 'value'
32
+ FormattedTransactionRequest<
33
+ TChainOverride extends Chain ? TChainOverride : TChain
34
+ >,
35
+ 'from' | 'to' | 'data' | 'value'
31
36
  > &
32
- GetChain<TChain, TChainOverride> &
33
37
  GetValue<
34
38
  TAbi,
35
39
  TFunctionName,
@@ -100,9 +104,9 @@ export type WriteContractReturnType = SendTransactionReturnType
100
104
  export async function writeContract<
101
105
  TChain extends Chain | undefined,
102
106
  TAccount extends Account | undefined,
103
- TAbi extends Abi | readonly unknown[],
107
+ const TAbi extends Abi | readonly unknown[],
104
108
  TFunctionName extends string,
105
- TChainOverride extends Chain | undefined = undefined,
109
+ TChainOverride extends Chain | undefined,
106
110
  >(
107
111
  client: Client<Transport, TChain, TAccount>,
108
112
  {
@@ -1,9 +1,5 @@
1
- import type { Address } from 'abitype'
2
-
3
- import { type Formatters } from '../../types/formatter.js'
4
- import type { Hash, Hex } from '../../types/misc.js'
5
- import type { RpcTransaction } from '../../types/rpc.js'
6
- import type { Transaction } from '../../types/transaction.js'
1
+ import { type ChainFormatters } from '../../types/chain.js'
2
+ import type { Hash } from '../../types/misc.js'
7
3
  import { hexToBigInt } from '../../utils/encoding/fromHex.js'
8
4
  import { numberToHex } from '../../utils/encoding/toHex.js'
9
5
  import { defineBlock } from '../../utils/formatters/block.js'
@@ -13,47 +9,28 @@ import {
13
9
  } from '../../utils/formatters/transaction.js'
14
10
  import { defineTransactionReceipt } from '../../utils/formatters/transactionReceipt.js'
15
11
  import { defineTransactionRequest } from '../../utils/formatters/transactionRequest.js'
16
-
17
- export type CeloFormatOverrides = {
18
- RpcBlock: {
19
- randomness: {
20
- committed: Hex
21
- revealed: Hex
22
- }
23
- transactions:
24
- | Hash[]
25
- | (RpcTransaction & {
26
- feeCurrency: Address | null
27
- gatewayFee: Hex | null
28
- gatewayFeeRecipient: Address | null
29
- })[]
30
- }
31
- RpcTransaction: {
32
- feeCurrency: Address | null
33
- gatewayFee: Hex | null
34
- gatewayFeeRecipient: Address | null
35
- }
36
- RpcTransactionReceipt: {
37
- feeCurrency: Address | null
38
- gatewayFee: Hex | null
39
- gatewayFeeRecipient: Address | null
40
- }
41
- TransactionRequest: {
42
- feeCurrency?: Address
43
- gatewayFee?: bigint
44
- gatewayFeeRecipient?: Address
45
- }
46
- Transaction: {
47
- feeCurrency: Address | null
48
- gatewayFee: bigint | null
49
- gatewayFeeRecipient: Address | null
50
- }
51
- }
12
+ import type {
13
+ CeloBlockOverrides,
14
+ CeloRpcTransaction,
15
+ CeloRpcTransactionOverrides,
16
+ CeloRpcTransactionReceiptOverrides,
17
+ CeloRpcTransactionRequestOverrides,
18
+ CeloTransaction,
19
+ CeloTransactionOverrides,
20
+ CeloTransactionReceiptOverrides,
21
+ CeloTransactionRequestOverrides,
22
+ } from './types.js'
52
23
 
53
24
  export const formattersCelo = {
54
25
  block: /*#__PURE__*/ defineBlock({
55
26
  exclude: ['difficulty', 'gasLimit', 'mixHash', 'nonce', 'uncles'],
56
- format(args: CeloFormatOverrides['RpcBlock']) {
27
+ format(
28
+ args: CeloBlockOverrides & {
29
+ transactions: Hash[] | CeloRpcTransaction[]
30
+ },
31
+ ): CeloBlockOverrides & {
32
+ transactions: Hash[] | CeloTransaction[]
33
+ } {
57
34
  const transactions = args.transactions?.map((transaction) => {
58
35
  if (typeof transaction === 'string') return transaction
59
36
  return {
@@ -64,7 +41,7 @@ export const formattersCelo = {
64
41
  : null,
65
42
  gatewayFeeRecipient: transaction.gatewayFeeRecipient,
66
43
  }
67
- }) as Hash[] | (Transaction & CeloFormatOverrides['Transaction'])[]
44
+ }) as Hash[] | CeloTransaction[]
68
45
  return {
69
46
  randomness: args.randomness,
70
47
  transactions,
@@ -72,7 +49,7 @@ export const formattersCelo = {
72
49
  },
73
50
  }),
74
51
  transaction: /*#__PURE__*/ defineTransaction({
75
- format(args: CeloFormatOverrides['RpcTransaction']) {
52
+ format(args: CeloRpcTransactionOverrides): CeloTransactionOverrides {
76
53
  return {
77
54
  feeCurrency: args.feeCurrency,
78
55
  gatewayFee: args.gatewayFee ? hexToBigInt(args.gatewayFee) : null,
@@ -81,7 +58,9 @@ export const formattersCelo = {
81
58
  },
82
59
  }),
83
60
  transactionReceipt: /*#__PURE__*/ defineTransactionReceipt({
84
- format(args: CeloFormatOverrides['RpcTransactionReceipt']) {
61
+ format(
62
+ args: CeloRpcTransactionReceiptOverrides,
63
+ ): CeloTransactionReceiptOverrides {
85
64
  return {
86
65
  feeCurrency: args.feeCurrency,
87
66
  gatewayFee: args.gatewayFee ? hexToBigInt(args.gatewayFee) : null,
@@ -90,7 +69,9 @@ export const formattersCelo = {
90
69
  },
91
70
  }),
92
71
  transactionRequest: /*#__PURE__*/ defineTransactionRequest({
93
- format(args: CeloFormatOverrides['TransactionRequest']) {
72
+ format(
73
+ args: CeloTransactionRequestOverrides,
74
+ ): CeloRpcTransactionRequestOverrides {
94
75
  return {
95
76
  feeCurrency: args.feeCurrency,
96
77
  gatewayFee:
@@ -101,4 +82,4 @@ export const formattersCelo = {
101
82
  }
102
83
  },
103
84
  }),
104
- } as const satisfies Formatters
85
+ } as const satisfies ChainFormatters