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
@@ -56,54 +56,90 @@ const mockAccount: AccountShape = {
56
56
  clearKey: () => Effect.void,
57
57
  };
58
58
 
59
- const mockProvider: ProviderShape = {
60
- getBlockNumber: () => Effect.succeed(12345n),
61
- getBlock: () => Effect.succeed({} as never),
62
- getBlockTransactionCount: () => Effect.succeed(0n),
63
- getBalance: () => Effect.succeed(1000000000000000000n),
64
- getTransactionCount: () => Effect.succeed(5n),
65
- getCode: () => Effect.succeed("0x"),
66
- getStorageAt: () => Effect.succeed("0x0"),
67
- getTransaction: () => Effect.succeed({} as never),
68
- getTransactionReceipt: () => Effect.succeed({} as never),
69
- waitForTransactionReceipt: () => Effect.succeed({} as never),
70
- call: () => Effect.succeed("0x"),
71
- estimateGas: () => Effect.succeed(21000n),
72
- createAccessList: () => Effect.succeed({ accessList: [], gasUsed: "0x0" }),
73
- getLogs: () => Effect.succeed([]),
74
- createEventFilter: () => Effect.succeed("0x1" as any),
75
- createBlockFilter: () => Effect.succeed("0x1" as any),
76
- createPendingTransactionFilter: () => Effect.succeed("0x1" as any),
77
- getFilterChanges: () => Effect.succeed([]),
78
- getFilterLogs: () => Effect.succeed([]),
79
- uninstallFilter: () => Effect.succeed(true),
80
- getChainId: () => Effect.succeed(1),
81
- getGasPrice: () => Effect.succeed(20000000000n),
82
- getMaxPriorityFeePerGas: () => Effect.succeed(1000000000n),
83
- getFeeHistory: () =>
84
- Effect.succeed({ oldestBlock: "0x0", baseFeePerGas: [], gasUsedRatio: [] }),
85
- watchBlocks: () => {
86
- throw new Error("Not implemented in mock");
87
- },
88
- backfillBlocks: () => {
89
- throw new Error("Not implemented in mock");
90
- },
91
- sendRawTransaction: () => Effect.succeed("0x" as `0x${string}`),
92
- getUncle: () => Effect.succeed({} as never),
93
- getProof: () =>
94
- Effect.succeed({
95
- address: "0x",
96
- accountProof: [],
97
- balance: "0x0",
98
- codeHash: "0x",
99
- nonce: "0x0",
100
- storageHash: "0x",
101
- storageProof: [],
102
- } as never),
103
- getBlobBaseFee: () => Effect.succeed(1n),
104
- getTransactionConfirmations: () => Effect.succeed(0n),
59
+ type ProviderOverrides = {
60
+ getBlock?: unknown;
61
+ getTransactionCount?: (address: unknown, blockTag?: unknown) => bigint;
62
+ getMaxPriorityFeePerGas?: bigint;
105
63
  };
106
64
 
65
+ const createMockProviderWithOverrides = (
66
+ overrides: ProviderOverrides = {},
67
+ ): ProviderShape => ({
68
+ request: <T>(method: string, params?: unknown[]) => {
69
+ switch (method) {
70
+ case "eth_blockNumber":
71
+ return Effect.succeed("0x3039" as T); // 12345
72
+ case "eth_getBlockByNumber":
73
+ case "eth_getBlockByHash":
74
+ if (overrides.getBlock !== undefined) {
75
+ return Effect.succeed(overrides.getBlock as T);
76
+ }
77
+ return Effect.succeed({
78
+ number: "0x1",
79
+ hash: "0xabc",
80
+ parentHash: "0x0",
81
+ nonce: "0x0",
82
+ sha3Uncles: "0x0",
83
+ logsBloom: "0x0",
84
+ transactionsRoot: "0x0",
85
+ stateRoot: "0x0",
86
+ receiptsRoot: "0x0",
87
+ miner: "0x0",
88
+ difficulty: "0x0",
89
+ totalDifficulty: "0x0",
90
+ extraData: "0x",
91
+ size: "0x0",
92
+ gasLimit: "0x0",
93
+ gasUsed: "0x0",
94
+ timestamp: "0x0",
95
+ transactions: [],
96
+ uncles: [],
97
+ } as T);
98
+ case "eth_getBalance":
99
+ return Effect.succeed("0xde0b6b3a7640000" as T); // 1 ETH
100
+ case "eth_getTransactionCount":
101
+ if (overrides.getTransactionCount) {
102
+ const nonce = overrides.getTransactionCount(params?.[0], params?.[1]);
103
+ return Effect.succeed(`0x${nonce.toString(16)}` as T);
104
+ }
105
+ return Effect.succeed("0x5" as T);
106
+ case "eth_getCode":
107
+ return Effect.succeed("0x" as T);
108
+ case "eth_getStorageAt":
109
+ return Effect.succeed("0x0" as T);
110
+ case "eth_call":
111
+ return Effect.succeed("0x" as T);
112
+ case "eth_estimateGas":
113
+ return Effect.succeed("0x5208" as T); // 21000
114
+ case "eth_chainId":
115
+ return Effect.succeed("0x1" as T);
116
+ case "eth_gasPrice":
117
+ return Effect.succeed("0x4a817c800" as T); // 20 gwei
118
+ case "eth_maxPriorityFeePerGas":
119
+ if (overrides.getMaxPriorityFeePerGas !== undefined) {
120
+ return Effect.succeed(
121
+ `0x${overrides.getMaxPriorityFeePerGas.toString(16)}` as T,
122
+ );
123
+ }
124
+ return Effect.succeed("0x3b9aca00" as T); // 1 gwei
125
+ case "eth_feeHistory":
126
+ return Effect.succeed({
127
+ oldestBlock: "0x0",
128
+ baseFeePerGas: [],
129
+ gasUsedRatio: [],
130
+ } as T);
131
+ case "eth_sendRawTransaction":
132
+ return Effect.succeed("0x" as T);
133
+ case "eth_blobBaseFee":
134
+ return Effect.succeed("0x1" as T);
135
+ default:
136
+ return Effect.succeed(null as T);
137
+ }
138
+ },
139
+ });
140
+
141
+ const mockProvider: ProviderShape = createMockProviderWithOverrides();
142
+
107
143
  const mockTransport: TransportShape = {
108
144
  request: <T>(_method: string, _params?: unknown[]): Effect.Effect<T, never> =>
109
145
  Effect.succeed(mockTxHashHex as T),
@@ -763,13 +799,12 @@ describe("SignerService", () => {
763
799
  describe("nonce handling", () => {
764
800
  it("fetches nonce with 'pending' block tag", async () => {
765
801
  let capturedBlockTag: string | undefined;
766
- const providerWithCapture: ProviderShape = {
767
- ...mockProvider,
802
+ const providerWithCapture = createMockProviderWithOverrides({
768
803
  getTransactionCount: (_address, blockTag) => {
769
804
  capturedBlockTag = blockTag as string;
770
- return Effect.succeed(5n);
805
+ return 5n;
771
806
  },
772
- };
807
+ });
773
808
 
774
809
  const customLayers = Layer.mergeAll(
775
810
  TestAccountLayer,
@@ -793,13 +828,12 @@ describe("SignerService", () => {
793
828
 
794
829
  it("uses provided nonce without fetching", async () => {
795
830
  let fetchCalled = false;
796
- const providerWithCapture: ProviderShape = {
797
- ...mockProvider,
831
+ const providerWithCapture = createMockProviderWithOverrides({
798
832
  getTransactionCount: () => {
799
833
  fetchCalled = true;
800
- return Effect.succeed(5n);
834
+ return 5n;
801
835
  },
802
- };
836
+ });
803
837
 
804
838
  const customLayers = Layer.mergeAll(
805
839
  TestAccountLayer,
@@ -825,32 +859,30 @@ describe("SignerService", () => {
825
859
 
826
860
  describe("EIP-1559 auto-detection", () => {
827
861
  it("uses EIP-1559 when network supports it and no gas fields provided", async () => {
828
- const providerWithEIP1559: ProviderShape = {
829
- ...mockProvider,
830
- getBlock: () =>
831
- Effect.succeed({
832
- number: "0x1",
833
- hash: "0xabc",
834
- parentHash: "0x0",
835
- nonce: "0x0",
836
- sha3Uncles: "0x0",
837
- logsBloom: "0x0",
838
- transactionsRoot: "0x0",
839
- stateRoot: "0x0",
840
- receiptsRoot: "0x0",
841
- miner: "0x0",
842
- difficulty: "0x0",
843
- totalDifficulty: "0x0",
844
- extraData: "0x",
845
- size: "0x0",
846
- gasLimit: "0x0",
847
- gasUsed: "0x0",
848
- timestamp: "0x0",
849
- transactions: [],
850
- uncles: [],
851
- baseFeePerGas: "0x3b9aca00", // 1 gwei - indicates EIP-1559 support
852
- }),
853
- };
862
+ const providerWithEIP1559 = createMockProviderWithOverrides({
863
+ getBlock: {
864
+ number: "0x1",
865
+ hash: "0xabc",
866
+ parentHash: "0x0",
867
+ nonce: "0x0",
868
+ sha3Uncles: "0x0",
869
+ logsBloom: "0x0",
870
+ transactionsRoot: "0x0",
871
+ stateRoot: "0x0",
872
+ receiptsRoot: "0x0",
873
+ miner: "0x0",
874
+ difficulty: "0x0",
875
+ totalDifficulty: "0x0",
876
+ extraData: "0x",
877
+ size: "0x0",
878
+ gasLimit: "0x0",
879
+ gasUsed: "0x0",
880
+ timestamp: "0x0",
881
+ transactions: [],
882
+ uncles: [],
883
+ baseFeePerGas: "0x3b9aca00", // 1 gwei - indicates EIP-1559 support
884
+ },
885
+ });
854
886
 
855
887
  const customLayers = Layer.mergeAll(
856
888
  TestAccountLayer,
@@ -876,32 +908,30 @@ describe("SignerService", () => {
876
908
  });
877
909
 
878
910
  it("uses legacy when network does not support EIP-1559", async () => {
879
- const providerWithoutEIP1559: ProviderShape = {
880
- ...mockProvider,
881
- getBlock: () =>
882
- Effect.succeed({
883
- number: "0x1",
884
- hash: "0xabc",
885
- parentHash: "0x0",
886
- nonce: "0x0",
887
- sha3Uncles: "0x0",
888
- logsBloom: "0x0",
889
- transactionsRoot: "0x0",
890
- stateRoot: "0x0",
891
- receiptsRoot: "0x0",
892
- miner: "0x0",
893
- difficulty: "0x0",
894
- totalDifficulty: "0x0",
895
- extraData: "0x",
896
- size: "0x0",
897
- gasLimit: "0x0",
898
- gasUsed: "0x0",
899
- timestamp: "0x0",
900
- transactions: [],
901
- uncles: [],
902
- // No baseFeePerGas - pre-London
903
- }),
904
- };
911
+ const providerWithoutEIP1559 = createMockProviderWithOverrides({
912
+ getBlock: {
913
+ number: "0x1",
914
+ hash: "0xabc",
915
+ parentHash: "0x0",
916
+ nonce: "0x0",
917
+ sha3Uncles: "0x0",
918
+ logsBloom: "0x0",
919
+ transactionsRoot: "0x0",
920
+ stateRoot: "0x0",
921
+ receiptsRoot: "0x0",
922
+ miner: "0x0",
923
+ difficulty: "0x0",
924
+ totalDifficulty: "0x0",
925
+ extraData: "0x",
926
+ size: "0x0",
927
+ gasLimit: "0x0",
928
+ gasUsed: "0x0",
929
+ timestamp: "0x0",
930
+ transactions: [],
931
+ uncles: [],
932
+ // No baseFeePerGas - pre-London
933
+ },
934
+ });
905
935
 
906
936
  const customLayers = Layer.mergeAll(
907
937
  TestAccountLayer,
@@ -942,33 +972,31 @@ describe("SignerService", () => {
942
972
  },
943
973
  };
944
974
 
945
- const providerWithEIP1559: ProviderShape = {
946
- ...mockProvider,
947
- getBlock: () =>
948
- Effect.succeed({
949
- number: "0x1",
950
- hash: "0xabc",
951
- parentHash: "0x0",
952
- nonce: "0x0",
953
- sha3Uncles: "0x0",
954
- logsBloom: "0x0",
955
- transactionsRoot: "0x0",
956
- stateRoot: "0x0",
957
- receiptsRoot: "0x0",
958
- miner: "0x0",
959
- difficulty: "0x0",
960
- totalDifficulty: "0x0",
961
- extraData: "0x",
962
- size: "0x0",
963
- gasLimit: "0x0",
964
- gasUsed: "0x0",
965
- timestamp: "0x0",
966
- transactions: [],
967
- uncles: [],
968
- baseFeePerGas: `0x${baseFeeWei.toString(16)}`,
969
- }),
970
- getMaxPriorityFeePerGas: () => Effect.succeed(priorityFeeWei),
971
- };
975
+ const providerWithEIP1559 = createMockProviderWithOverrides({
976
+ getBlock: {
977
+ number: "0x1",
978
+ hash: "0xabc",
979
+ parentHash: "0x0",
980
+ nonce: "0x0",
981
+ sha3Uncles: "0x0",
982
+ logsBloom: "0x0",
983
+ transactionsRoot: "0x0",
984
+ stateRoot: "0x0",
985
+ receiptsRoot: "0x0",
986
+ miner: "0x0",
987
+ difficulty: "0x0",
988
+ totalDifficulty: "0x0",
989
+ extraData: "0x",
990
+ size: "0x0",
991
+ gasLimit: "0x0",
992
+ gasUsed: "0x0",
993
+ timestamp: "0x0",
994
+ transactions: [],
995
+ uncles: [],
996
+ baseFeePerGas: `0x${baseFeeWei.toString(16)}`,
997
+ },
998
+ getMaxPriorityFeePerGas: priorityFeeWei,
999
+ });
972
1000
 
973
1001
  const customLayers = Layer.mergeAll(
974
1002
  Layer.succeed(AccountService, accountWithCapture),
@@ -1010,33 +1038,31 @@ describe("SignerService", () => {
1010
1038
  },
1011
1039
  };
1012
1040
 
1013
- const providerWithEIP1559: ProviderShape = {
1014
- ...mockProvider,
1015
- getBlock: () =>
1016
- Effect.succeed({
1017
- number: "0x1",
1018
- hash: "0xabc",
1019
- parentHash: "0x0",
1020
- nonce: "0x0",
1021
- sha3Uncles: "0x0",
1022
- logsBloom: "0x0",
1023
- transactionsRoot: "0x0",
1024
- stateRoot: "0x0",
1025
- receiptsRoot: "0x0",
1026
- miner: "0x0",
1027
- difficulty: "0x0",
1028
- totalDifficulty: "0x0",
1029
- extraData: "0x",
1030
- size: "0x0",
1031
- gasLimit: "0x0",
1032
- gasUsed: "0x0",
1033
- timestamp: "0x0",
1034
- transactions: [],
1035
- uncles: [],
1036
- baseFeePerGas: `0x${baseFeeWei.toString(16)}`,
1037
- }),
1038
- getMaxPriorityFeePerGas: () => Effect.succeed(priorityFeeWei),
1039
- };
1041
+ const providerWithEIP1559 = createMockProviderWithOverrides({
1042
+ getBlock: {
1043
+ number: "0x1",
1044
+ hash: "0xabc",
1045
+ parentHash: "0x0",
1046
+ nonce: "0x0",
1047
+ sha3Uncles: "0x0",
1048
+ logsBloom: "0x0",
1049
+ transactionsRoot: "0x0",
1050
+ stateRoot: "0x0",
1051
+ receiptsRoot: "0x0",
1052
+ miner: "0x0",
1053
+ difficulty: "0x0",
1054
+ totalDifficulty: "0x0",
1055
+ extraData: "0x",
1056
+ size: "0x0",
1057
+ gasLimit: "0x0",
1058
+ gasUsed: "0x0",
1059
+ timestamp: "0x0",
1060
+ transactions: [],
1061
+ uncles: [],
1062
+ baseFeePerGas: `0x${baseFeeWei.toString(16)}`,
1063
+ },
1064
+ getMaxPriorityFeePerGas: priorityFeeWei,
1065
+ });
1040
1066
 
1041
1067
  const customLayers = Layer.mergeAll(
1042
1068
  Layer.succeed(AccountService, accountWithCapture),
@@ -1077,33 +1103,31 @@ describe("SignerService", () => {
1077
1103
  },
1078
1104
  };
1079
1105
 
1080
- const providerWithEIP1559: ProviderShape = {
1081
- ...mockProvider,
1082
- getBlock: () =>
1083
- Effect.succeed({
1084
- number: "0x1",
1085
- hash: "0xabc",
1086
- parentHash: "0x0",
1087
- nonce: "0x0",
1088
- sha3Uncles: "0x0",
1089
- logsBloom: "0x0",
1090
- transactionsRoot: "0x0",
1091
- stateRoot: "0x0",
1092
- receiptsRoot: "0x0",
1093
- miner: "0x0",
1094
- difficulty: "0x0",
1095
- totalDifficulty: "0x0",
1096
- extraData: "0x",
1097
- size: "0x0",
1098
- gasLimit: "0x0",
1099
- gasUsed: "0x0",
1100
- timestamp: "0x0",
1101
- transactions: [],
1102
- uncles: [],
1103
- baseFeePerGas: `0x${baseFeeWei.toString(16)}`,
1104
- }),
1105
- getMaxPriorityFeePerGas: () => Effect.succeed(priorityFeeWei),
1106
- };
1106
+ const providerWithEIP1559 = createMockProviderWithOverrides({
1107
+ getBlock: {
1108
+ number: "0x1",
1109
+ hash: "0xabc",
1110
+ parentHash: "0x0",
1111
+ nonce: "0x0",
1112
+ sha3Uncles: "0x0",
1113
+ logsBloom: "0x0",
1114
+ transactionsRoot: "0x0",
1115
+ stateRoot: "0x0",
1116
+ receiptsRoot: "0x0",
1117
+ miner: "0x0",
1118
+ difficulty: "0x0",
1119
+ totalDifficulty: "0x0",
1120
+ extraData: "0x",
1121
+ size: "0x0",
1122
+ gasLimit: "0x0",
1123
+ gasUsed: "0x0",
1124
+ timestamp: "0x0",
1125
+ transactions: [],
1126
+ uncles: [],
1127
+ baseFeePerGas: `0x${baseFeeWei.toString(16)}`,
1128
+ },
1129
+ getMaxPriorityFeePerGas: priorityFeeWei,
1130
+ });
1107
1131
 
1108
1132
  const customLayers = Layer.mergeAll(
1109
1133
  Layer.succeed(AccountService, accountWithCapture),
@@ -39,6 +39,14 @@ type HexType = BrandedHex.HexType;
39
39
  type SignatureType = BrandedSignature.SignatureType;
40
40
 
41
41
  import { AccountService, LocalAccount } from "../Account/index.js";
42
+ import {
43
+ getTransactionCount,
44
+ getChainId,
45
+ estimateGas,
46
+ getBlock,
47
+ getGasPrice,
48
+ getMaxPriorityFeePerGas,
49
+ } from "../Provider/functions/index.js";
42
50
  import { ProviderService } from "../Provider/index.js";
43
51
  import { TransportService } from "../Transport/index.js";
44
52
  import { prepareAuthorization as prepareAuthorizationAction } from "./actions/prepareAuthorization.js";
@@ -292,13 +300,13 @@ const SignerLive: Layer.Layer<
292
300
 
293
301
  const signTransaction = (
294
302
  tx: TransactionRequest,
295
- ): Effect.Effect<HexType, SignerError> =>
303
+ ): Effect.Effect<HexType, SignerError, ProviderService> =>
296
304
  Effect.gen(function* () {
297
305
  const addressHex = Address.toHex(account.address as AddressType);
298
306
  const nonce =
299
307
  tx.nonce ??
300
- (yield* provider.getTransactionCount(addressHex, "pending"));
301
- const chainId = tx.chainId ?? BigInt(yield* provider.getChainId());
308
+ (yield* getTransactionCount(addressHex, "pending"));
309
+ const chainId = tx.chainId ?? BigInt(yield* getChainId());
302
310
  const toHex = tx.to
303
311
  ? typeof tx.to === "string"
304
312
  ? tx.to
@@ -312,9 +320,9 @@ const SignerLive: Layer.Layer<
312
320
  gas: tx.gasLimit,
313
321
  };
314
322
  const gasLimit =
315
- tx.gasLimit ?? (yield* provider.estimateGas(txForEstimate));
323
+ tx.gasLimit ?? (yield* estimateGas(txForEstimate));
316
324
 
317
- const latestBlock = yield* provider.getBlock({ blockTag: "latest" });
325
+ const latestBlock = yield* getBlock({ blockTag: "latest" });
318
326
  const baseFeePerGas = latestBlock.baseFeePerGas
319
327
  ? BigInt(latestBlock.baseFeePerGas)
320
328
  : undefined;
@@ -330,16 +338,16 @@ const SignerLive: Layer.Layer<
330
338
  };
331
339
 
332
340
  if (txType === 0 || txType === 1) {
333
- const gasPrice = tx.gasPrice ?? (yield* provider.getGasPrice());
334
- gasParams = { gasPrice };
341
+ const gasPriceValue = tx.gasPrice ?? (yield* getGasPrice());
342
+ gasParams = { gasPrice: gasPriceValue };
335
343
  } else {
336
- const maxPriorityFeePerGas =
344
+ const maxPriorityFeePerGasValue =
337
345
  tx.maxPriorityFeePerGas ??
338
- (yield* provider.getMaxPriorityFeePerGas());
339
- const baseFee = baseFeePerGas ?? (yield* provider.getGasPrice());
346
+ (yield* getMaxPriorityFeePerGas());
347
+ const baseFee = baseFeePerGas ?? (yield* getGasPrice());
340
348
  const maxFeePerGas =
341
- tx.maxFeePerGas ?? (baseFee * 12n) / 10n + maxPriorityFeePerGas;
342
- gasParams = { maxFeePerGas, maxPriorityFeePerGas };
349
+ tx.maxFeePerGas ?? (baseFee * 12n) / 10n + maxPriorityFeePerGasValue;
350
+ gasParams = { maxFeePerGas, maxPriorityFeePerGas: maxPriorityFeePerGasValue };
343
351
 
344
352
  if (txType === 3 && tx.maxFeePerBlobGas !== undefined) {
345
353
  gasParams.maxFeePerBlobGas = tx.maxFeePerBlobGas;
@@ -416,7 +424,8 @@ const SignerLive: Layer.Layer<
416
424
  ),
417
425
  ),
418
426
 
419
- signTransaction,
427
+ signTransaction: (tx) =>
428
+ signTransaction(tx).pipe(Effect.provideService(ProviderService, provider)),
420
429
 
421
430
  signTypedData: (typedData) =>
422
431
  account
@@ -454,7 +463,7 @@ const SignerLive: Layer.Layer<
454
463
  ),
455
464
  ),
456
465
  );
457
- }),
466
+ }).pipe(Effect.provideService(ProviderService, provider)),
458
467
 
459
468
  sendRawTransaction: (signedTx) =>
460
469
  transport.request<string>("eth_sendRawTransaction", [signedTx]).pipe(
@@ -608,7 +617,7 @@ const SignerLive: Layer.Layer<
608
617
 
609
618
  sendCalls: (params) =>
610
619
  Effect.gen(function* () {
611
- const chainId = yield* provider.getChainId();
620
+ const chainIdValue = yield* getChainId();
612
621
  const formattedCalls = params.calls.map((call) => ({
613
622
  to:
614
623
  typeof call.to === "string"
@@ -624,13 +633,14 @@ const SignerLive: Layer.Layer<
624
633
  return yield* transport.request<string>("wallet_sendCalls", [
625
634
  {
626
635
  version: "1.0",
627
- chainId: `0x${chainId.toString(16)}`,
636
+ chainId: `0x${chainIdValue.toString(16)}`,
628
637
  from: Address.toHex(account.address as AddressType),
629
638
  calls: formattedCalls,
630
639
  capabilities: params.capabilities,
631
640
  },
632
641
  ]);
633
642
  }).pipe(
643
+ Effect.provideService(ProviderService, provider),
634
644
  Effect.mapError((e) => {
635
645
  const err = e as Error & { code?: number };
636
646
  return new SignerError(