voltaire-effect 0.2.23 → 0.2.25

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 (397) hide show
  1. package/dist/KZGService-B7PJerOb.d.ts +146 -0
  2. package/dist/ProviderService-BZ5pqDrD.d.ts +319 -0
  3. package/dist/{X25519Test-DGsk1V9o.d.ts → X25519Test-D5Q-5fL9.d.ts} +4 -143
  4. package/dist/crypto/index.d.ts +5 -6
  5. package/dist/crypto/index.js +227 -201
  6. package/dist/{index-IgkEHjBe.d.ts → index-BCOuszKZ.d.ts} +17634 -11962
  7. package/dist/index.d.ts +3195 -976
  8. package/dist/index.js +6994 -4679
  9. package/dist/native/index.d.ts +25 -16
  10. package/dist/native/index.js +7020 -4705
  11. package/dist/primitives/index.d.ts +14 -8
  12. package/dist/primitives/index.js +4060 -2539
  13. package/dist/services/index.d.ts +9054 -30
  14. package/dist/services/index.js +1592 -1331
  15. package/package.json +2 -2
  16. package/src/crypto/ERC6492/ERC6492.test.ts +32 -14
  17. package/src/crypto/ERC6492/verifySignature.ts +4 -5
  18. package/src/crypto/Keccak256/Keccak256.test.ts +42 -1
  19. package/src/crypto/Keccak256/hashSync.ts +53 -0
  20. package/src/crypto/Keccak256/index.ts +2 -0
  21. package/src/index.ts +7 -2
  22. package/src/primitives/Abi/decode.test.ts +38 -0
  23. package/src/primitives/Abi/decode.ts +67 -0
  24. package/src/primitives/Abi/decodeData.test.ts +37 -0
  25. package/src/primitives/Abi/decodeData.ts +77 -0
  26. package/src/primitives/Abi/decodeLog.test.ts +32 -0
  27. package/src/primitives/Abi/decodeLog.ts +81 -0
  28. package/src/primitives/Abi/decodeWrappedError.test.ts +41 -0
  29. package/src/primitives/Abi/decodeWrappedError.ts +68 -0
  30. package/src/primitives/Abi/encode.test.ts +43 -0
  31. package/src/primitives/Abi/encode.ts +67 -0
  32. package/src/primitives/Abi/encodePacked.test.ts +35 -0
  33. package/src/primitives/Abi/encodePacked.ts +62 -0
  34. package/src/primitives/Abi/encodeWrappedError.test.ts +21 -0
  35. package/src/primitives/Abi/encodeWrappedError.ts +64 -0
  36. package/src/primitives/Abi/findSelectorCollisions.test.ts +50 -0
  37. package/src/primitives/Abi/findSelectorCollisions.ts +83 -0
  38. package/src/primitives/Abi/index.ts +33 -7
  39. package/src/primitives/Abi/parseLogs.test.ts +37 -0
  40. package/src/primitives/Abi/parseLogs.ts +62 -0
  41. package/src/primitives/AccessList/AccessList.test.ts +229 -0
  42. package/src/primitives/AccessList/AccessListTypeSchema.ts +16 -0
  43. package/src/primitives/AccessList/addressCount.ts +21 -0
  44. package/src/primitives/AccessList/assertValid.ts +37 -0
  45. package/src/primitives/AccessList/create.ts +19 -0
  46. package/src/primitives/AccessList/deduplicate.ts +23 -0
  47. package/src/primitives/AccessList/from.ts +39 -0
  48. package/src/primitives/AccessList/fromBytes.ts +36 -0
  49. package/src/primitives/AccessList/gasCost.ts +22 -0
  50. package/src/primitives/AccessList/gasSavings.ts +26 -0
  51. package/src/primitives/AccessList/hasSavings.ts +23 -0
  52. package/src/primitives/AccessList/includesAddress.ts +25 -0
  53. package/src/primitives/AccessList/includesStorageKey.ts +28 -0
  54. package/src/primitives/AccessList/index.ts +99 -19
  55. package/src/primitives/AccessList/is.ts +23 -0
  56. package/src/primitives/AccessList/isEmpty.ts +23 -0
  57. package/src/primitives/AccessList/isItem.ts +22 -0
  58. package/src/primitives/AccessList/keysFor.ts +29 -0
  59. package/src/primitives/AccessList/merge.ts +24 -0
  60. package/src/primitives/AccessList/storageKeyCount.ts +21 -0
  61. package/src/primitives/AccessList/toBytes.ts +23 -0
  62. package/src/primitives/AccessList/withAddress.ts +27 -0
  63. package/src/primitives/AccessList/withStorageKey.ts +30 -0
  64. package/src/primitives/Address/Address.test.ts +146 -0
  65. package/src/primitives/Address/assert.ts +51 -0
  66. package/src/primitives/Address/calculateCreate2Address.ts +33 -0
  67. package/src/primitives/Address/calculateCreateAddress.ts +30 -0
  68. package/src/primitives/Address/deduplicateAddresses.ts +20 -0
  69. package/src/primitives/Address/from.ts +41 -0
  70. package/src/primitives/Address/fromAbiEncoded.ts +35 -0
  71. package/src/primitives/Address/fromBase64.ts +25 -0
  72. package/src/primitives/Address/fromBytes.ts +25 -0
  73. package/src/primitives/Address/fromHex.ts +31 -0
  74. package/src/primitives/Address/fromNumber.ts +25 -0
  75. package/src/primitives/Address/fromPrivateKey.ts +25 -0
  76. package/src/primitives/Address/fromPublicKey.ts +56 -0
  77. package/src/primitives/Address/index.ts +99 -35
  78. package/src/primitives/Address/is.ts +20 -0
  79. package/src/primitives/Address/isAddress.ts +22 -0
  80. package/src/primitives/Address/sortAddresses.ts +19 -0
  81. package/src/primitives/Address/toChecksummed.ts +32 -0
  82. package/src/primitives/Address/toHex.ts +18 -0
  83. package/src/primitives/Address/zero.ts +18 -0
  84. package/src/primitives/Base64/Base64.test.ts +75 -0
  85. package/src/primitives/Base64/convert.ts +37 -0
  86. package/src/primitives/Base64/decode.ts +59 -0
  87. package/src/primitives/Base64/encode.ts +42 -0
  88. package/src/primitives/Base64/from.ts +39 -0
  89. package/src/primitives/Base64/index.ts +81 -1
  90. package/src/primitives/Base64/size.ts +16 -0
  91. package/src/primitives/Base64/validation.ts +16 -0
  92. package/src/primitives/Blob/Blob.test.ts +292 -0
  93. package/src/primitives/Blob/calculateGas.ts +30 -0
  94. package/src/primitives/Blob/estimateBlobCount.ts +30 -0
  95. package/src/primitives/Blob/from.ts +38 -0
  96. package/src/primitives/Blob/fromData.ts +36 -0
  97. package/src/primitives/Blob/index.ts +99 -12
  98. package/src/primitives/Blob/isValidVersion.ts +27 -0
  99. package/src/primitives/Blob/joinData.ts +43 -0
  100. package/src/primitives/Blob/splitData.ts +36 -0
  101. package/src/primitives/Blob/toCommitment.ts +43 -0
  102. package/src/primitives/Blob/toProof.ts +50 -0
  103. package/src/primitives/Blob/toVersionedHash.ts +35 -0
  104. package/src/primitives/Blob/verify.ts +49 -0
  105. package/src/primitives/Blob/verifyBatch.ts +119 -0
  106. package/src/primitives/BloomFilter/BloomFilter.test.ts +138 -0
  107. package/src/primitives/BloomFilter/add.ts +23 -0
  108. package/src/primitives/BloomFilter/combine.ts +21 -0
  109. package/src/primitives/BloomFilter/contains.ts +26 -0
  110. package/src/primitives/BloomFilter/create.ts +35 -0
  111. package/src/primitives/BloomFilter/density.ts +22 -0
  112. package/src/primitives/BloomFilter/expectedFalsePositiveRate.ts +25 -0
  113. package/src/primitives/BloomFilter/fromHex.ts +37 -0
  114. package/src/primitives/BloomFilter/hash.ts +43 -0
  115. package/src/primitives/BloomFilter/index.ts +59 -37
  116. package/src/primitives/BloomFilter/isEmpty.ts +22 -0
  117. package/src/primitives/BloomFilter/merge.ts +24 -0
  118. package/src/primitives/BloomFilter/toHex.ts +22 -0
  119. package/src/primitives/Bytecode/analyze.ts +58 -0
  120. package/src/primitives/Bytecode/detectFusions.ts +10 -0
  121. package/src/primitives/Bytecode/equals.ts +10 -0
  122. package/src/primitives/Bytecode/extractRuntime.ts +12 -0
  123. package/src/primitives/Bytecode/format.ts +16 -0
  124. package/src/primitives/Bytecode/from.ts +16 -0
  125. package/src/primitives/Bytecode/fromHex.ts +14 -0
  126. package/src/primitives/Bytecode/getBlock.ts +12 -0
  127. package/src/primitives/Bytecode/getNextPc.ts +12 -0
  128. package/src/primitives/Bytecode/getPushSize.ts +8 -0
  129. package/src/primitives/Bytecode/hasMetadata.ts +10 -0
  130. package/src/primitives/Bytecode/hash.ts +9 -0
  131. package/src/primitives/Bytecode/index.ts +103 -13
  132. package/src/primitives/Bytecode/isPush.ts +8 -0
  133. package/src/primitives/Bytecode/isTerminator.ts +8 -0
  134. package/src/primitives/Bytecode/isValidJumpDest.ts +12 -0
  135. package/src/primitives/Bytecode/parseInstructions.ts +10 -0
  136. package/src/primitives/Bytecode/prettyPrint.ts +12 -0
  137. package/src/primitives/Bytecode/scan.ts +20 -0
  138. package/src/primitives/Bytecode/size.ts +9 -0
  139. package/src/primitives/Bytecode/stripMetadata.ts +10 -0
  140. package/src/primitives/Bytecode/toAbi.ts +10 -0
  141. package/src/primitives/Bytecode/toHex.ts +10 -0
  142. package/src/primitives/Bytecode/types.ts +23 -0
  143. package/src/primitives/Bytecode/validate.ts +9 -0
  144. package/src/primitives/ContractSignature/ContractSignature.test.ts +1 -13
  145. package/src/primitives/ContractSignature/verifySignature.ts +88 -62
  146. package/src/primitives/Ens/Ens.test.ts +71 -0
  147. package/src/primitives/Ens/convert.ts +13 -0
  148. package/src/primitives/Ens/from.ts +32 -0
  149. package/src/primitives/Ens/hash.ts +46 -0
  150. package/src/primitives/Ens/index.ts +86 -4
  151. package/src/primitives/Ens/normalize.ts +45 -0
  152. package/src/primitives/Ens/validation.ts +38 -0
  153. package/src/primitives/EventLog/accessors.ts +32 -0
  154. package/src/primitives/EventLog/clone.ts +17 -0
  155. package/src/primitives/EventLog/create.ts +46 -0
  156. package/src/primitives/EventLog/filtering.ts +48 -0
  157. package/src/primitives/EventLog/index.ts +96 -6
  158. package/src/primitives/EventLog/status.ts +17 -0
  159. package/src/primitives/EventLog/toRpc.ts +49 -0
  160. package/src/primitives/Hardfork/HardforkSchema.ts +3 -3
  161. package/src/primitives/Hardfork/allIds.ts +13 -0
  162. package/src/primitives/Hardfork/allNames.ts +13 -0
  163. package/src/primitives/Hardfork/compare.ts +17 -0
  164. package/src/primitives/Hardfork/comparisons.ts +45 -0
  165. package/src/primitives/Hardfork/equals.ts +17 -0
  166. package/src/primitives/Hardfork/features.ts +61 -0
  167. package/src/primitives/Hardfork/fromString.ts +16 -0
  168. package/src/primitives/Hardfork/index.ts +128 -18
  169. package/src/primitives/Hardfork/isValidName.ts +14 -0
  170. package/src/primitives/Hardfork/minMax.ts +23 -0
  171. package/src/primitives/Hardfork/range.ts +19 -0
  172. package/src/primitives/Hardfork/toString.ts +16 -0
  173. package/src/primitives/Hash/Hash.test.ts +104 -0
  174. package/src/primitives/Hash/from.ts +47 -0
  175. package/src/primitives/Hash/fromBytes.ts +46 -0
  176. package/src/primitives/Hash/fromHex.ts +44 -0
  177. package/src/primitives/Hash/index.ts +45 -8
  178. package/src/primitives/Hash/isHash.ts +31 -0
  179. package/src/primitives/Hash/toHex.ts +29 -0
  180. package/src/primitives/Hex/Hex.test.ts +327 -153
  181. package/src/primitives/Hex/assertSize.ts +41 -0
  182. package/src/primitives/Hex/concat.ts +37 -0
  183. package/src/primitives/Hex/from.ts +38 -0
  184. package/src/primitives/Hex/fromBigInt.ts +40 -0
  185. package/src/primitives/Hex/fromBoolean.ts +29 -0
  186. package/src/primitives/Hex/fromNumber.ts +41 -0
  187. package/src/primitives/Hex/fromString.ts +28 -0
  188. package/src/primitives/Hex/index.ts +68 -37
  189. package/src/primitives/Hex/pad.ts +40 -0
  190. package/src/primitives/Hex/padRight.ts +39 -0
  191. package/src/primitives/Hex/size.ts +29 -0
  192. package/src/primitives/Hex/slice.ts +42 -0
  193. package/src/primitives/Hex/toBigInt.ts +27 -0
  194. package/src/primitives/Hex/toBoolean.ts +38 -0
  195. package/src/primitives/Hex/toNumber.ts +37 -0
  196. package/src/primitives/Hex/toStringHex.ts +39 -0
  197. package/src/primitives/Hex/trim.ts +27 -0
  198. package/src/primitives/Hex/validate.ts +37 -0
  199. package/src/primitives/Hex/xor.ts +39 -0
  200. package/src/primitives/Opcode/OpcodeSchema.ts +1 -1
  201. package/src/primitives/Opcode/disassemble.ts +15 -0
  202. package/src/primitives/Opcode/dupPosition.ts +15 -0
  203. package/src/primitives/Opcode/format.ts +15 -0
  204. package/src/primitives/Opcode/getters.ts +54 -0
  205. package/src/primitives/Opcode/index.ts +301 -11
  206. package/src/primitives/Opcode/info.ts +18 -0
  207. package/src/primitives/Opcode/jumpDests.ts +15 -0
  208. package/src/primitives/Opcode/logTopics.ts +15 -0
  209. package/src/primitives/Opcode/name.ts +15 -0
  210. package/src/primitives/Opcode/parse.ts +15 -0
  211. package/src/primitives/Opcode/predicates.ts +72 -0
  212. package/src/primitives/Opcode/pushBytes.ts +15 -0
  213. package/src/primitives/Opcode/pushOpcode.ts +15 -0
  214. package/src/primitives/Opcode/swapPosition.ts +15 -0
  215. package/src/primitives/Rlp/decodeBatch.ts +46 -0
  216. package/src/primitives/Rlp/decodeObject.ts +46 -0
  217. package/src/primitives/Rlp/decodeValue.ts +51 -0
  218. package/src/primitives/Rlp/encodeBatch.ts +50 -0
  219. package/src/primitives/Rlp/encodeObject.ts +48 -0
  220. package/src/primitives/Rlp/encodeVariadic.ts +49 -0
  221. package/src/primitives/Rlp/equals.ts +22 -0
  222. package/src/primitives/Rlp/from.ts +44 -0
  223. package/src/primitives/Rlp/fromJSON.ts +45 -0
  224. package/src/primitives/Rlp/getEncodedLength.ts +47 -0
  225. package/src/primitives/Rlp/getLength.ts +44 -0
  226. package/src/primitives/Rlp/index.ts +67 -14
  227. package/src/primitives/Rlp/isBytesData.ts +21 -0
  228. package/src/primitives/Rlp/isCanonical.ts +32 -0
  229. package/src/primitives/Rlp/isData.ts +21 -0
  230. package/src/primitives/Rlp/isList.ts +46 -0
  231. package/src/primitives/Rlp/isListData.ts +21 -0
  232. package/src/primitives/Rlp/isString.ts +46 -0
  233. package/src/primitives/Rlp/toJSON.ts +20 -0
  234. package/src/primitives/Rlp/toRaw.ts +31 -0
  235. package/src/primitives/Signature/Signature.test.ts +217 -0
  236. package/src/primitives/Signature/from.ts +38 -0
  237. package/src/primitives/Signature/fromBytes.ts +31 -0
  238. package/src/primitives/Signature/fromCompact.ts +33 -0
  239. package/src/primitives/Signature/fromDER.ts +35 -0
  240. package/src/primitives/Signature/fromEd25519.ts +24 -0
  241. package/src/primitives/Signature/fromHex.ts +29 -0
  242. package/src/primitives/Signature/fromP256.ts +25 -0
  243. package/src/primitives/Signature/fromRpc.ts +38 -0
  244. package/src/primitives/Signature/fromSecp256k1.ts +29 -0
  245. package/src/primitives/Signature/fromTuple.ts +33 -0
  246. package/src/primitives/Signature/getR.ts +24 -0
  247. package/src/primitives/Signature/getS.ts +24 -0
  248. package/src/primitives/Signature/getV.ts +24 -0
  249. package/src/primitives/Signature/index.ts +61 -11
  250. package/src/primitives/Signature/toDER.ts +24 -0
  251. package/src/primitives/Signature/toHex.ts +24 -0
  252. package/src/primitives/Signature/toRpc.ts +35 -0
  253. package/src/primitives/Signature/toTuple.ts +29 -0
  254. package/src/primitives/Signature/verify.ts +31 -0
  255. package/src/primitives/Siwe/create.ts +56 -0
  256. package/src/primitives/Siwe/hash.ts +27 -0
  257. package/src/primitives/Siwe/index.ts +57 -21
  258. package/src/primitives/Siwe/parse.ts +24 -0
  259. package/src/primitives/Siwe/verify.ts +47 -0
  260. package/src/primitives/Transaction/Transaction.test.ts +309 -0
  261. package/src/primitives/Transaction/index.ts +467 -2
  262. package/src/primitives/Uint/Uint.test.ts +200 -0
  263. package/src/primitives/Uint/dividedBy.ts +34 -0
  264. package/src/primitives/Uint/from.ts +35 -0
  265. package/src/primitives/Uint/fromAbiEncoded.ts +29 -0
  266. package/src/primitives/Uint/fromBigInt.ts +30 -0
  267. package/src/primitives/Uint/fromBytes.ts +32 -0
  268. package/src/primitives/Uint/fromHex.ts +32 -0
  269. package/src/primitives/Uint/fromNumber.ts +30 -0
  270. package/src/primitives/Uint/index.ts +90 -45
  271. package/src/primitives/Uint/isUint256.ts +25 -0
  272. package/src/primitives/Uint/isValid.ts +25 -0
  273. package/src/primitives/Uint/modulo.ts +34 -0
  274. package/src/primitives/Uint/toHex.ts +31 -0
  275. package/src/primitives/Uint/tryFrom.ts +30 -0
  276. package/src/services/Contract/Contract.test.ts +46 -41
  277. package/src/services/Contract/Contract.ts +25 -29
  278. package/src/services/Contract/ContractTypes.ts +6 -3
  279. package/src/services/Contract/estimateGas.test.ts +21 -9
  280. package/src/services/Contract/estimateGas.ts +21 -23
  281. package/src/services/Debug/Debug.ts +1 -1
  282. package/src/services/Debug/DebugService.ts +1 -1
  283. package/src/services/FeeEstimator/DefaultFeeEstimator.ts +10 -6
  284. package/src/services/FeeEstimator/FeeEstimator.test.ts +68 -62
  285. package/src/services/Multicall/BalanceResolver.ts +1 -1
  286. package/src/services/Multicall/GetBalance.ts +1 -1
  287. package/src/services/Multicall/Multicall.ts +1 -1
  288. package/src/services/NonceManager/DefaultNonceManager.ts +4 -7
  289. package/src/services/NonceManager/NonceManager.test.ts +20 -33
  290. package/src/services/Provider/Provider.test.ts +155 -349
  291. package/src/services/Provider/Provider.ts +14 -1180
  292. package/src/services/Provider/ProviderService.ts +14 -1199
  293. package/src/services/Provider/actions/multicall.test.ts +29 -39
  294. package/src/services/Provider/actions/multicall.ts +2 -2
  295. package/src/services/Provider/actions/readContract.test.ts +45 -50
  296. package/src/services/Provider/actions/readContract.ts +2 -6
  297. package/src/services/Provider/actions/simulateContract.test.ts +55 -232
  298. package/src/services/Provider/actions/simulateContract.ts +2 -3
  299. package/src/services/Provider/ens/getEnsAddress.ts +11 -14
  300. package/src/services/Provider/ens/getEnsName.ts +15 -18
  301. package/src/services/Provider/ens/getEnsResolver.ts +11 -14
  302. package/src/services/Provider/ens/getEnsText.ts +15 -18
  303. package/src/services/Provider/functions/backfillBlocks.ts +97 -0
  304. package/src/services/Provider/functions/call.ts +45 -0
  305. package/src/services/Provider/functions/createAccessList.ts +61 -0
  306. package/src/services/Provider/functions/createBlockFilter.ts +41 -0
  307. package/src/services/Provider/functions/createEventFilter.ts +43 -0
  308. package/src/services/Provider/functions/createPendingTransactionFilter.ts +41 -0
  309. package/src/services/Provider/functions/estimateGas.ts +52 -0
  310. package/src/services/Provider/functions/getAccounts.ts +40 -0
  311. package/src/services/Provider/functions/getBalance.ts +50 -0
  312. package/src/services/Provider/functions/getBlobBaseFee.ts +46 -0
  313. package/src/services/Provider/functions/getBlock.ts +95 -0
  314. package/src/services/Provider/functions/getBlockNumber.ts +51 -0
  315. package/src/services/Provider/functions/getBlockReceipts.ts +78 -0
  316. package/src/services/Provider/functions/getBlockTransactionCount.ts +86 -0
  317. package/src/services/Provider/functions/getChainId.ts +46 -0
  318. package/src/services/Provider/functions/getCode.ts +43 -0
  319. package/src/services/Provider/functions/getCoinbase.ts +40 -0
  320. package/src/services/Provider/functions/getFeeHistory.ts +85 -0
  321. package/src/services/Provider/functions/getFilterChanges.ts +42 -0
  322. package/src/services/Provider/functions/getFilterLogs.ts +44 -0
  323. package/src/services/Provider/functions/getGasPrice.ts +46 -0
  324. package/src/services/Provider/functions/getHashrate.ts +46 -0
  325. package/src/services/Provider/functions/getLogs.ts +45 -0
  326. package/src/services/Provider/functions/getMaxPriorityFeePerGas.ts +46 -0
  327. package/src/services/Provider/functions/getMining.ts +40 -0
  328. package/src/services/Provider/functions/getProof.ts +52 -0
  329. package/src/services/Provider/functions/getProtocolVersion.ts +40 -0
  330. package/src/services/Provider/functions/getStorageAt.ts +52 -0
  331. package/src/services/Provider/functions/getSyncing.ts +56 -0
  332. package/src/services/Provider/functions/getTransaction.ts +57 -0
  333. package/src/services/Provider/functions/getTransactionByBlockHashAndIndex.ts +73 -0
  334. package/src/services/Provider/functions/getTransactionByBlockNumberAndIndex.ts +86 -0
  335. package/src/services/Provider/functions/getTransactionConfirmations.ts +70 -0
  336. package/src/services/Provider/functions/getTransactionCount.ts +50 -0
  337. package/src/services/Provider/functions/getTransactionReceipt.ts +57 -0
  338. package/src/services/Provider/functions/getUncle.ts +97 -0
  339. package/src/services/Provider/functions/getUncleCount.ts +86 -0
  340. package/src/services/Provider/functions/index.ts +73 -0
  341. package/src/services/Provider/functions/netVersion.ts +40 -0
  342. package/src/services/Provider/functions/sendRawTransaction.ts +40 -0
  343. package/src/services/Provider/functions/sendTransaction.ts +48 -0
  344. package/src/services/Provider/functions/sign.ts +50 -0
  345. package/src/services/Provider/functions/signTransaction.ts +52 -0
  346. package/src/services/Provider/functions/simulateV1.ts +95 -0
  347. package/src/services/Provider/functions/simulateV2.ts +51 -0
  348. package/src/services/Provider/functions/subscribe.ts +49 -0
  349. package/src/services/Provider/functions/uninstallFilter.ts +40 -0
  350. package/src/services/Provider/functions/unsubscribe.ts +41 -0
  351. package/src/services/Provider/functions/waitForTransactionReceipt.ts +168 -0
  352. package/src/services/Provider/functions/watchBlocks.ts +98 -0
  353. package/src/services/Provider/index.ts +29 -178
  354. package/src/services/Provider/types.ts +780 -0
  355. package/src/services/Provider/utils.ts +204 -0
  356. package/src/services/RawProvider/ForkProviderTransport.ts +2 -3
  357. package/src/services/RawProvider/HttpProviderTransport.ts +3 -3
  358. package/src/services/RawProvider/InMemoryProviderTransport.ts +3 -3
  359. package/src/services/RawProvider/WebSocketProviderTransport.ts +3 -3
  360. package/src/services/Signer/Signer.test.ts +211 -187
  361. package/src/services/Signer/Signer.ts +26 -16
  362. package/src/services/Signer/actions/deployContract.test.ts +125 -105
  363. package/src/services/Signer/actions/deployContract.ts +3 -2
  364. package/src/services/Signer/actions/prepareAuthorization.test.ts +47 -48
  365. package/src/services/Signer/actions/prepareAuthorization.ts +3 -3
  366. package/src/services/Signer/actions/signAuthorization.test.ts +39 -45
  367. package/src/services/Signer/actions/signAuthorization.ts +3 -3
  368. package/src/services/Signer/actions/writeContract.test.ts +41 -57
  369. package/src/services/Transport/FallbackTransport.ts +3 -3
  370. package/src/services/Transport/HttpTransport.ts +3 -3
  371. package/src/services/Transport/config.ts +7 -7
  372. package/src/services/Transport/index.ts +3 -4
  373. package/src/services/errors.test.ts +3 -8
  374. package/src/services/index.ts +8 -90
  375. package/src/services/presets/index.ts +9 -10
  376. package/src/services/presets/presets.test.ts +14 -29
  377. package/src/standards/ERC165.test.ts +19 -20
  378. package/src/standards/ERC165.ts +9 -11
  379. package/src/type-exports.test.ts +37 -0
  380. package/dist/AccountService-BetXokad.d.ts +0 -1717
  381. package/dist/RpcResolver-BpvqybjD.d.ts +0 -6439
  382. package/src/services/Provider/Account.ts +0 -33
  383. package/src/services/Provider/AccountService.ts +0 -84
  384. package/src/services/Provider/Blocks.ts +0 -32
  385. package/src/services/Provider/BlocksService.ts +0 -73
  386. package/src/services/Provider/Events.ts +0 -33
  387. package/src/services/Provider/EventsService.ts +0 -71
  388. package/src/services/Provider/Network.ts +0 -41
  389. package/src/services/Provider/NetworkService.ts +0 -114
  390. package/src/services/Provider/Simulation.ts +0 -34
  391. package/src/services/Provider/SimulationService.ts +0 -161
  392. package/src/services/Provider/Streaming.ts +0 -30
  393. package/src/services/Provider/StreamingService.ts +0 -58
  394. package/src/services/Provider/Transaction.ts +0 -39
  395. package/src/services/Provider/TransactionService.ts +0 -83
  396. package/src/services/Provider/filters.ts +0 -91
  397. package/src/services/Provider/getBlobBaseFee.ts +0 -170
@@ -36,25 +36,15 @@ const erc20Abi = S.decodeUnknownSync(fromArray)([
36
36
  },
37
37
  ]);
38
38
 
39
+ const mockCallFn = vi.fn();
40
+
39
41
  const mockProvider = {
40
- call: vi.fn(),
41
- getLogs: vi.fn(),
42
- getBlockNumber: vi.fn(),
43
- getBalance: vi.fn(),
44
- getBlock: vi.fn(),
45
- getTransaction: vi.fn(),
46
- getTransactionReceipt: vi.fn(),
47
- waitForTransactionReceipt: vi.fn(),
48
- getTransactionCount: vi.fn(),
49
- getCode: vi.fn(),
50
- getStorageAt: vi.fn(),
51
- estimateGas: vi.fn(),
52
- createAccessList: vi.fn(),
53
- getChainId: vi.fn(),
54
- getGasPrice: vi.fn(),
55
- getMaxPriorityFeePerGas: vi.fn(),
56
- getFeeHistory: vi.fn(),
57
- getBlockTransactionCount: vi.fn(),
42
+ request: <T>(method: string, params?: unknown[]) => {
43
+ if (method === "eth_call") {
44
+ return mockCallFn(params?.[0], params?.[1]) as Effect.Effect<T, never>;
45
+ }
46
+ return Effect.succeed(null as T);
47
+ },
58
48
  };
59
49
 
60
50
  const MockProviderLayer = Layer.succeed(ProviderService, mockProvider as any);
@@ -90,7 +80,7 @@ describe("multicall", () => {
90
80
  const balance2 =
91
81
  "0x00000000000000000000000000000000000000000000021e19e0c9bab2400000" as HexType;
92
82
 
93
- mockProvider.call.mockReturnValue(
83
+ mockCallFn.mockReturnValue(
94
84
  Effect.succeed(
95
85
  encodeMulticallResult([
96
86
  { success: true, returnData: balance1 },
@@ -120,12 +110,12 @@ describe("multicall", () => {
120
110
  program.pipe(Effect.provide(MockProviderLayer)),
121
111
  );
122
112
 
123
- expect(mockProvider.call).toHaveBeenCalledTimes(1);
113
+ expect(mockCallFn).toHaveBeenCalledTimes(1);
124
114
  expect(result).toEqual([1000000000000000000n, 10000000000000000000000n]);
125
115
  });
126
116
 
127
117
  it("calls Multicall3 at correct address", async () => {
128
- mockProvider.call.mockReturnValue(
118
+ mockCallFn.mockReturnValue(
129
119
  Effect.succeed(
130
120
  encodeMulticallResult([
131
121
  {
@@ -150,7 +140,7 @@ describe("multicall", () => {
150
140
 
151
141
  await Effect.runPromise(program.pipe(Effect.provide(MockProviderLayer)));
152
142
 
153
- expect(mockProvider.call).toHaveBeenCalledWith(
143
+ expect(mockCallFn).toHaveBeenCalledWith(
154
144
  expect.objectContaining({
155
145
  to: "0xcA11bde05977b3631167028862bE2a173976CA11",
156
146
  }),
@@ -164,7 +154,7 @@ describe("multicall", () => {
164
154
  const balance1 =
165
155
  "0x0000000000000000000000000000000000000000000000000de0b6b3a7640000" as HexType;
166
156
 
167
- mockProvider.call.mockReturnValue(
157
+ mockCallFn.mockReturnValue(
168
158
  Effect.succeed(
169
159
  encodeMulticallResult([
170
160
  { success: true, returnData: balance1 },
@@ -202,7 +192,7 @@ describe("multicall", () => {
202
192
  const balance1 =
203
193
  "0x0000000000000000000000000000000000000000000000000de0b6b3a7640000" as HexType;
204
194
 
205
- mockProvider.call.mockReturnValue(
195
+ mockCallFn.mockReturnValue(
206
196
  Effect.succeed(
207
197
  encodeMulticallResult([
208
198
  { success: true, returnData: balance1 },
@@ -247,7 +237,7 @@ describe("multicall", () => {
247
237
  const balance2 =
248
238
  "0x00000000000000000000000000000000000000000000021e19e0c9bab2400000" as HexType;
249
239
 
250
- mockProvider.call.mockReturnValue(
240
+ mockCallFn.mockReturnValue(
251
241
  Effect.succeed(
252
242
  encodeMulticallResult([
253
243
  { success: true, returnData: balance1 },
@@ -291,7 +281,7 @@ describe("multicall", () => {
291
281
  const balance3 =
292
282
  "0x0000000000000000000000000000000000000000000000000000000000000005" as HexType;
293
283
 
294
- mockProvider.call
284
+ mockCallFn
295
285
  .mockReturnValueOnce(
296
286
  Effect.succeed(
297
287
  encodeMulticallResult([
@@ -333,7 +323,7 @@ describe("multicall", () => {
333
323
  program.pipe(Effect.provide(MockProviderLayer)),
334
324
  );
335
325
 
336
- expect(mockProvider.call).toHaveBeenCalledTimes(2);
326
+ expect(mockCallFn).toHaveBeenCalledTimes(2);
337
327
  expect(result).toEqual([
338
328
  1000000000000000000n,
339
329
  10000000000000000000000n,
@@ -344,7 +334,7 @@ describe("multicall", () => {
344
334
 
345
335
  describe("single call", () => {
346
336
  it("works with single contract call", async () => {
347
- mockProvider.call.mockReturnValue(
337
+ mockCallFn.mockReturnValue(
348
338
  Effect.succeed(
349
339
  encodeMulticallResult([
350
340
  {
@@ -376,7 +366,7 @@ describe("multicall", () => {
376
366
 
377
367
  describe("empty array", () => {
378
368
  it("returns empty array for empty contracts", async () => {
379
- mockProvider.call.mockReturnValue(
369
+ mockCallFn.mockReturnValue(
380
370
  Effect.succeed(encodeMulticallResult([])),
381
371
  );
382
372
 
@@ -393,8 +383,8 @@ describe("multicall", () => {
393
383
  });
394
384
 
395
385
  describe("block tag", () => {
396
- it("passes block tag to provider.call", async () => {
397
- mockProvider.call.mockReturnValue(
386
+ it("passes block tag to call", async () => {
387
+ mockCallFn.mockReturnValue(
398
388
  Effect.succeed(
399
389
  encodeMulticallResult([
400
390
  {
@@ -420,7 +410,7 @@ describe("multicall", () => {
420
410
 
421
411
  await Effect.runPromise(program.pipe(Effect.provide(MockProviderLayer)));
422
412
 
423
- expect(mockProvider.call).toHaveBeenCalledWith(
413
+ expect(mockCallFn).toHaveBeenCalledWith(
424
414
  expect.any(Object),
425
415
  "finalized",
426
416
  );
@@ -456,7 +446,7 @@ describe("multicall", () => {
456
446
  "0x0000000000000000000000000000000000000000000000000de0b6b3a7640000" as HexType;
457
447
  const revertData = "0x08c379a0" as HexType;
458
448
 
459
- mockProvider.call.mockReturnValue(
449
+ mockCallFn.mockReturnValue(
460
450
  Effect.succeed(
461
451
  encodeMulticallResult([
462
452
  { success: true, returnData: balance1 },
@@ -501,7 +491,7 @@ describe("multicall", () => {
501
491
  });
502
492
 
503
493
  it("handles all calls failing with allowFailure true", async () => {
504
- mockProvider.call.mockReturnValue(
494
+ mockCallFn.mockReturnValue(
505
495
  Effect.succeed(
506
496
  encodeMulticallResult([
507
497
  { success: false, returnData: "0x" },
@@ -539,7 +529,7 @@ describe("multicall", () => {
539
529
  const balance1 =
540
530
  "0x0000000000000000000000000000000000000000000000000de0b6b3a7640000" as HexType;
541
531
 
542
- mockProvider.call.mockReturnValue(
532
+ mockCallFn.mockReturnValue(
543
533
  Effect.succeed(
544
534
  encodeMulticallResult([
545
535
  { success: true, returnData: balance1 },
@@ -586,7 +576,7 @@ describe("multicall", () => {
586
576
 
587
577
  describe("transport error propagation", () => {
588
578
  it("propagates transport errors", async () => {
589
- mockProvider.call.mockReturnValue(
579
+ mockCallFn.mockReturnValue(
590
580
  Effect.fail(
591
581
  new TransportError({
592
582
  code: -32603,
@@ -618,7 +608,7 @@ describe("multicall", () => {
618
608
  });
619
609
 
620
610
  it("propagates timeout errors", async () => {
621
- mockProvider.call.mockReturnValue(
611
+ mockCallFn.mockReturnValue(
622
612
  Effect.fail(
623
613
  new TransportError({
624
614
  code: -32000,
@@ -650,7 +640,7 @@ describe("multicall", () => {
650
640
  });
651
641
 
652
642
  it("propagates rate limit errors", async () => {
653
- mockProvider.call.mockReturnValue(
643
+ mockCallFn.mockReturnValue(
654
644
  Effect.fail(
655
645
  new TransportError({
656
646
  code: 429,
@@ -682,7 +672,7 @@ describe("multicall", () => {
682
672
  });
683
673
 
684
674
  it("propagates Multicall3 contract not deployed error", async () => {
685
- mockProvider.call.mockReturnValue(
675
+ mockCallFn.mockReturnValue(
686
676
  Effect.fail(
687
677
  new TransportError({
688
678
  code: -32000,
@@ -22,6 +22,7 @@ import {
22
22
  ProviderService,
23
23
  ProviderValidationError,
24
24
  } from "../ProviderService.js";
25
+ import { call } from "../functions/call.js";
25
26
  import type { Abi } from "./readContract.js";
26
27
 
27
28
  type AddressType = BrandedAddress.AddressType;
@@ -214,7 +215,6 @@ export const multicall = <TContracts extends readonly ContractCall[]>(
214
215
  ProviderService
215
216
  > =>
216
217
  Effect.gen(function* () {
217
- const provider = yield* ProviderService;
218
218
  const allowFailure = params.allowFailure ?? true;
219
219
 
220
220
  if (params.contracts.length === 0) {
@@ -245,7 +245,7 @@ export const multicall = <TContracts extends readonly ContractCall[]>(
245
245
  [calls],
246
246
  );
247
247
 
248
- const result = yield* provider.call(
248
+ const result = yield* call(
249
249
  { to: MULTICALL3_ADDRESS, data },
250
250
  params.blockTag,
251
251
  );
@@ -155,25 +155,20 @@ const complexAbi = S.decodeUnknownSync(fromArray)([
155
155
  },
156
156
  ]);
157
157
 
158
+ const mockCallFn = vi.fn();
159
+
158
160
  const mockProvider = {
159
- call: vi.fn(),
160
- getLogs: vi.fn(),
161
- getBlockNumber: vi.fn(),
162
- getBalance: vi.fn(),
163
- getBlock: vi.fn(),
164
- getTransaction: vi.fn(),
165
- getTransactionReceipt: vi.fn(),
166
- waitForTransactionReceipt: vi.fn(),
167
- getTransactionCount: vi.fn(),
168
- getCode: vi.fn(),
169
- getStorageAt: vi.fn(),
170
- estimateGas: vi.fn(),
171
- createAccessList: vi.fn(),
172
- getChainId: vi.fn(),
173
- getGasPrice: vi.fn(),
174
- getMaxPriorityFeePerGas: vi.fn(),
175
- getFeeHistory: vi.fn(),
176
- getBlockTransactionCount: vi.fn(),
161
+ request: <T>(method: string, params?: unknown[]) => {
162
+ if (method === "eth_call") {
163
+ return mockCallFn(params?.[0], params?.[1]) as Effect.Effect<T, never>;
164
+ }
165
+ return Effect.succeed(null as T);
166
+ },
167
+ };
168
+
169
+ // Helper to set up mock call return value
170
+ const setMockCallReturn = (returnValue: Effect.Effect<unknown, unknown>) => {
171
+ mockCallFn.mockReturnValue(returnValue);
177
172
  };
178
173
 
179
174
  const MockProviderLayer = Layer.succeed(ProviderService, mockProvider as any);
@@ -186,7 +181,7 @@ describe("readContract", () => {
186
181
  describe("ERC-20 balanceOf", () => {
187
182
  it("reads balance with single argument", async () => {
188
183
  const expectedBalance = 1000000000000000000n;
189
- mockProvider.call.mockReturnValue(
184
+ mockCallFn.mockReturnValue(
190
185
  Effect.succeed(
191
186
  "0x0000000000000000000000000000000000000000000000000de0b6b3a7640000" as HexType,
192
187
  ),
@@ -203,12 +198,12 @@ describe("readContract", () => {
203
198
  program.pipe(Effect.provide(MockProviderLayer)),
204
199
  );
205
200
 
206
- expect(mockProvider.call).toHaveBeenCalled();
201
+ expect(mockCallFn).toHaveBeenCalled();
207
202
  expect(result).toBe(expectedBalance);
208
203
  });
209
204
 
210
205
  it("accepts branded address input", async () => {
211
- mockProvider.call.mockReturnValue(
206
+ mockCallFn.mockReturnValue(
212
207
  Effect.succeed(
213
208
  "0x0000000000000000000000000000000000000000000000000de0b6b3a7640000" as HexType,
214
209
  ),
@@ -232,7 +227,7 @@ describe("readContract", () => {
232
227
 
233
228
  describe("functions with no arguments", () => {
234
229
  it("reads totalSupply without args", async () => {
235
- mockProvider.call.mockReturnValue(
230
+ mockCallFn.mockReturnValue(
236
231
  Effect.succeed(
237
232
  "0x00000000000000000000000000000000000000000000d3c21bcecceda1000000" as HexType,
238
233
  ),
@@ -248,12 +243,12 @@ describe("readContract", () => {
248
243
  program.pipe(Effect.provide(MockProviderLayer)),
249
244
  );
250
245
 
251
- expect(mockProvider.call).toHaveBeenCalled();
246
+ expect(mockCallFn).toHaveBeenCalled();
252
247
  expect(typeof result).toBe("bigint");
253
248
  });
254
249
 
255
250
  it("reads decimals", async () => {
256
- mockProvider.call.mockReturnValue(
251
+ mockCallFn.mockReturnValue(
257
252
  Effect.succeed(
258
253
  "0x0000000000000000000000000000000000000000000000000000000000000012" as HexType,
259
254
  ),
@@ -275,7 +270,7 @@ describe("readContract", () => {
275
270
 
276
271
  describe("multi-return functions", () => {
277
272
  it("reads getReserves with multiple return values", async () => {
278
- mockProvider.call.mockReturnValue(
273
+ mockCallFn.mockReturnValue(
279
274
  Effect.succeed(
280
275
  ("0x" +
281
276
  "00000000000000000000000000000000000000000000021e19e0c9bab2400000" +
@@ -301,7 +296,7 @@ describe("readContract", () => {
301
296
 
302
297
  describe("complex arguments", () => {
303
298
  it("handles two address arguments", async () => {
304
- mockProvider.call.mockReturnValue(
299
+ mockCallFn.mockReturnValue(
305
300
  Effect.succeed(
306
301
  "0x0000000000000000000000000000000000000000000000000de0b6b3a7640000" as HexType,
307
302
  ),
@@ -321,12 +316,12 @@ describe("readContract", () => {
321
316
  program.pipe(Effect.provide(MockProviderLayer)),
322
317
  );
323
318
 
324
- expect(mockProvider.call).toHaveBeenCalled();
319
+ expect(mockCallFn).toHaveBeenCalled();
325
320
  expect(typeof result).toBe("bigint");
326
321
  });
327
322
 
328
323
  it("handles mixed argument types (address + bool)", async () => {
329
- mockProvider.call.mockReturnValue(
324
+ mockCallFn.mockReturnValue(
330
325
  Effect.succeed(
331
326
  ("0x" +
332
327
  "0000000000000000000000000000000000000000000000000de0b6b3a7640000" +
@@ -350,8 +345,8 @@ describe("readContract", () => {
350
345
  });
351
346
 
352
347
  describe("block tag", () => {
353
- it("passes block tag to provider.call", async () => {
354
- mockProvider.call.mockReturnValue(
348
+ it("passes block tag to call", async () => {
349
+ mockCallFn.mockReturnValue(
355
350
  Effect.succeed(
356
351
  "0x0000000000000000000000000000000000000000000000000de0b6b3a7640000" as HexType,
357
352
  ),
@@ -367,14 +362,14 @@ describe("readContract", () => {
367
362
 
368
363
  await Effect.runPromise(program.pipe(Effect.provide(MockProviderLayer)));
369
364
 
370
- expect(mockProvider.call).toHaveBeenCalledWith(
365
+ expect(mockCallFn).toHaveBeenCalledWith(
371
366
  expect.any(Object),
372
367
  "finalized",
373
368
  );
374
369
  });
375
370
 
376
371
  it("uses latest by default", async () => {
377
- mockProvider.call.mockReturnValue(
372
+ mockCallFn.mockReturnValue(
378
373
  Effect.succeed(
379
374
  "0x0000000000000000000000000000000000000000000000000de0b6b3a7640000" as HexType,
380
375
  ),
@@ -389,7 +384,7 @@ describe("readContract", () => {
389
384
 
390
385
  await Effect.runPromise(program.pipe(Effect.provide(MockProviderLayer)));
391
386
 
392
- expect(mockProvider.call).toHaveBeenCalledWith(
387
+ expect(mockCallFn).toHaveBeenCalledWith(
393
388
  expect.any(Object),
394
389
  undefined,
395
390
  );
@@ -398,7 +393,7 @@ describe("readContract", () => {
398
393
 
399
394
  describe("error handling", () => {
400
395
  it("surfaces transport errors on call failure", async () => {
401
- mockProvider.call.mockReturnValue(
396
+ mockCallFn.mockReturnValue(
402
397
  Effect.fail(
403
398
  new TransportError({
404
399
  code: -32000,
@@ -425,7 +420,7 @@ describe("readContract", () => {
425
420
  });
426
421
 
427
422
  it("preserves transport error message", async () => {
428
- mockProvider.call.mockReturnValue(
423
+ mockCallFn.mockReturnValue(
429
424
  Effect.fail(
430
425
  new TransportError({
431
426
  code: -32000,
@@ -451,7 +446,7 @@ describe("readContract", () => {
451
446
  });
452
447
 
453
448
  it("fails when function not found in ABI", async () => {
454
- mockProvider.call.mockReturnValue(
449
+ mockCallFn.mockReturnValue(
455
450
  Effect.succeed(
456
451
  "0x0000000000000000000000000000000000000000000000000de0b6b3a7640000" as HexType,
457
452
  ),
@@ -480,7 +475,7 @@ describe("readContract", () => {
480
475
  "0000000000000000000000000000000000000000000000000000000000000020" +
481
476
  "0000000000000000000000000000000000000000000000000000000000000012" +
482
477
  "496e73756666696369656e742062616c616e63650000000000000000000000";
483
- mockProvider.call.mockReturnValue(
478
+ mockCallFn.mockReturnValue(
484
479
  Effect.fail(
485
480
  new TransportError({
486
481
  code: 3,
@@ -509,7 +504,7 @@ describe("readContract", () => {
509
504
 
510
505
  it("handles contract revert with custom error", async () => {
511
506
  const customErrorSelector = "0xcf479181";
512
- mockProvider.call.mockReturnValue(
507
+ mockCallFn.mockReturnValue(
513
508
  Effect.fail(
514
509
  new TransportError({
515
510
  code: 3,
@@ -537,7 +532,7 @@ describe("readContract", () => {
537
532
  });
538
533
 
539
534
  it("propagates transport errors", async () => {
540
- mockProvider.call.mockReturnValue(
535
+ mockCallFn.mockReturnValue(
541
536
  Effect.fail(
542
537
  new TransportError({
543
538
  code: -32603,
@@ -564,7 +559,7 @@ describe("readContract", () => {
564
559
  });
565
560
 
566
561
  it("propagates timeout errors", async () => {
567
- mockProvider.call.mockReturnValue(
562
+ mockCallFn.mockReturnValue(
568
563
  Effect.fail(
569
564
  new TransportError({
570
565
  code: -32000,
@@ -591,7 +586,7 @@ describe("readContract", () => {
591
586
  });
592
587
 
593
588
  it("propagates rate limit errors", async () => {
594
- mockProvider.call.mockReturnValue(
589
+ mockCallFn.mockReturnValue(
595
590
  Effect.fail(
596
591
  new TransportError({
597
592
  code: 429,
@@ -618,7 +613,7 @@ describe("readContract", () => {
618
613
  });
619
614
 
620
615
  it("handles empty return data (0x) for function expecting outputs", async () => {
621
- mockProvider.call.mockReturnValue(Effect.succeed("0x" as HexType));
616
+ mockCallFn.mockReturnValue(Effect.succeed("0x" as HexType));
622
617
 
623
618
  const program = readContract({
624
619
  address: "0x6B175474E89094C44Da98b954EecdEfaE6E286AB",
@@ -635,7 +630,7 @@ describe("readContract", () => {
635
630
  });
636
631
 
637
632
  it("handles malformed hex (odd length)", async () => {
638
- mockProvider.call.mockReturnValue(Effect.succeed("0x123" as HexType));
633
+ mockCallFn.mockReturnValue(Effect.succeed("0x123" as HexType));
639
634
 
640
635
  const program = readContract({
641
636
  address: "0x6B175474E89094C44Da98b954EecdEfaE6E286AB",
@@ -654,7 +649,7 @@ describe("readContract", () => {
654
649
 
655
650
  describe("output type handling", () => {
656
651
  it("handles address output type", async () => {
657
- mockProvider.call.mockReturnValue(
652
+ mockCallFn.mockReturnValue(
658
653
  Effect.succeed(
659
654
  "0x000000000000000000000000d8da6bf26964af9d7eed9e03e53415d37aa96045" as HexType,
660
655
  ),
@@ -675,7 +670,7 @@ describe("readContract", () => {
675
670
  });
676
671
 
677
672
  it("handles bool output type - true", async () => {
678
- mockProvider.call.mockReturnValue(
673
+ mockCallFn.mockReturnValue(
679
674
  Effect.succeed(
680
675
  "0x0000000000000000000000000000000000000000000000000000000000000001" as HexType,
681
676
  ),
@@ -695,7 +690,7 @@ describe("readContract", () => {
695
690
  });
696
691
 
697
692
  it("handles bool output type - false", async () => {
698
- mockProvider.call.mockReturnValue(
693
+ mockCallFn.mockReturnValue(
699
694
  Effect.succeed(
700
695
  "0x0000000000000000000000000000000000000000000000000000000000000000" as HexType,
701
696
  ),
@@ -717,7 +712,7 @@ describe("readContract", () => {
717
712
  it("handles bytes32 output type", async () => {
718
713
  const merkleRoot =
719
714
  "0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890";
720
- mockProvider.call.mockReturnValue(Effect.succeed(merkleRoot as HexType));
715
+ mockCallFn.mockReturnValue(Effect.succeed(merkleRoot as HexType));
721
716
 
722
717
  const program = readContract({
723
718
  address: "0x1234567890123456789012345678901234567890",
@@ -733,7 +728,7 @@ describe("readContract", () => {
733
728
  });
734
729
 
735
730
  it("handles dynamic array (uint256[]) output", async () => {
736
- mockProvider.call.mockReturnValue(
731
+ mockCallFn.mockReturnValue(
737
732
  Effect.succeed(
738
733
  ("0x" +
739
734
  "0000000000000000000000000000000000000000000000000000000000000020" +
@@ -763,7 +758,7 @@ describe("readContract", () => {
763
758
  });
764
759
 
765
760
  it("handles tuple/struct output", async () => {
766
- mockProvider.call.mockReturnValue(
761
+ mockCallFn.mockReturnValue(
767
762
  Effect.succeed(
768
763
  ("0x" +
769
764
  "000000000000000000000000d8da6bf26964af9d7eed9e03e53415d37aa96045" +
@@ -789,7 +784,7 @@ describe("readContract", () => {
789
784
  });
790
785
 
791
786
  it("handles zero output function", async () => {
792
- mockProvider.call.mockReturnValue(Effect.succeed("0x" as HexType));
787
+ mockCallFn.mockReturnValue(Effect.succeed("0x" as HexType));
793
788
 
794
789
  const program = readContract({
795
790
  address: "0x1234567890123456789012345678901234567890",
@@ -22,6 +22,7 @@ import {
22
22
  Hex,
23
23
  } from "@tevm/voltaire";
24
24
  import * as Effect from "effect/Effect";
25
+ import { call } from "../functions/call.js";
25
26
  import {
26
27
  type AddressInput,
27
28
  type BlockTag,
@@ -269,8 +270,6 @@ export const readContract = <
269
270
  ProviderService
270
271
  > =>
271
272
  Effect.gen(function* () {
272
- const provider = yield* ProviderService;
273
-
274
273
  const addressHex =
275
274
  typeof params.address === "string"
276
275
  ? params.address
@@ -282,10 +281,7 @@ export const readContract = <
282
281
  (params.args ?? []) as unknown[],
283
282
  );
284
283
 
285
- const result = yield* provider.call(
286
- { to: addressHex, data },
287
- params.blockTag,
288
- );
284
+ const result = yield* call({ to: addressHex, data }, params.blockTag);
289
285
 
290
286
  const fn = (params.abi as readonly AbiItem[]).find(
291
287
  (item): item is BrandedAbi.Function.FunctionType =>