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.
- package/dist/KZGService-B7PJerOb.d.ts +146 -0
- package/dist/ProviderService-BZ5pqDrD.d.ts +319 -0
- package/dist/{X25519Test-DGsk1V9o.d.ts → X25519Test-D5Q-5fL9.d.ts} +4 -143
- package/dist/crypto/index.d.ts +5 -6
- package/dist/crypto/index.js +227 -201
- package/dist/{index-IgkEHjBe.d.ts → index-BCOuszKZ.d.ts} +17634 -11962
- package/dist/index.d.ts +3195 -976
- package/dist/index.js +6994 -4679
- package/dist/native/index.d.ts +25 -16
- package/dist/native/index.js +7020 -4705
- package/dist/primitives/index.d.ts +14 -8
- package/dist/primitives/index.js +4060 -2539
- package/dist/services/index.d.ts +9054 -30
- package/dist/services/index.js +1592 -1331
- package/package.json +2 -2
- package/src/crypto/ERC6492/ERC6492.test.ts +32 -14
- package/src/crypto/ERC6492/verifySignature.ts +4 -5
- package/src/crypto/Keccak256/Keccak256.test.ts +42 -1
- package/src/crypto/Keccak256/hashSync.ts +53 -0
- package/src/crypto/Keccak256/index.ts +2 -0
- package/src/index.ts +7 -2
- package/src/primitives/Abi/decode.test.ts +38 -0
- package/src/primitives/Abi/decode.ts +67 -0
- package/src/primitives/Abi/decodeData.test.ts +37 -0
- package/src/primitives/Abi/decodeData.ts +77 -0
- package/src/primitives/Abi/decodeLog.test.ts +32 -0
- package/src/primitives/Abi/decodeLog.ts +81 -0
- package/src/primitives/Abi/decodeWrappedError.test.ts +41 -0
- package/src/primitives/Abi/decodeWrappedError.ts +68 -0
- package/src/primitives/Abi/encode.test.ts +43 -0
- package/src/primitives/Abi/encode.ts +67 -0
- package/src/primitives/Abi/encodePacked.test.ts +35 -0
- package/src/primitives/Abi/encodePacked.ts +62 -0
- package/src/primitives/Abi/encodeWrappedError.test.ts +21 -0
- package/src/primitives/Abi/encodeWrappedError.ts +64 -0
- package/src/primitives/Abi/findSelectorCollisions.test.ts +50 -0
- package/src/primitives/Abi/findSelectorCollisions.ts +83 -0
- package/src/primitives/Abi/index.ts +33 -7
- package/src/primitives/Abi/parseLogs.test.ts +37 -0
- package/src/primitives/Abi/parseLogs.ts +62 -0
- package/src/primitives/AccessList/AccessList.test.ts +229 -0
- package/src/primitives/AccessList/AccessListTypeSchema.ts +16 -0
- package/src/primitives/AccessList/addressCount.ts +21 -0
- package/src/primitives/AccessList/assertValid.ts +37 -0
- package/src/primitives/AccessList/create.ts +19 -0
- package/src/primitives/AccessList/deduplicate.ts +23 -0
- package/src/primitives/AccessList/from.ts +39 -0
- package/src/primitives/AccessList/fromBytes.ts +36 -0
- package/src/primitives/AccessList/gasCost.ts +22 -0
- package/src/primitives/AccessList/gasSavings.ts +26 -0
- package/src/primitives/AccessList/hasSavings.ts +23 -0
- package/src/primitives/AccessList/includesAddress.ts +25 -0
- package/src/primitives/AccessList/includesStorageKey.ts +28 -0
- package/src/primitives/AccessList/index.ts +99 -19
- package/src/primitives/AccessList/is.ts +23 -0
- package/src/primitives/AccessList/isEmpty.ts +23 -0
- package/src/primitives/AccessList/isItem.ts +22 -0
- package/src/primitives/AccessList/keysFor.ts +29 -0
- package/src/primitives/AccessList/merge.ts +24 -0
- package/src/primitives/AccessList/storageKeyCount.ts +21 -0
- package/src/primitives/AccessList/toBytes.ts +23 -0
- package/src/primitives/AccessList/withAddress.ts +27 -0
- package/src/primitives/AccessList/withStorageKey.ts +30 -0
- package/src/primitives/Address/Address.test.ts +146 -0
- package/src/primitives/Address/assert.ts +51 -0
- package/src/primitives/Address/calculateCreate2Address.ts +33 -0
- package/src/primitives/Address/calculateCreateAddress.ts +30 -0
- package/src/primitives/Address/deduplicateAddresses.ts +20 -0
- package/src/primitives/Address/from.ts +41 -0
- package/src/primitives/Address/fromAbiEncoded.ts +35 -0
- package/src/primitives/Address/fromBase64.ts +25 -0
- package/src/primitives/Address/fromBytes.ts +25 -0
- package/src/primitives/Address/fromHex.ts +31 -0
- package/src/primitives/Address/fromNumber.ts +25 -0
- package/src/primitives/Address/fromPrivateKey.ts +25 -0
- package/src/primitives/Address/fromPublicKey.ts +56 -0
- package/src/primitives/Address/index.ts +99 -35
- package/src/primitives/Address/is.ts +20 -0
- package/src/primitives/Address/isAddress.ts +22 -0
- package/src/primitives/Address/sortAddresses.ts +19 -0
- package/src/primitives/Address/toChecksummed.ts +32 -0
- package/src/primitives/Address/toHex.ts +18 -0
- package/src/primitives/Address/zero.ts +18 -0
- package/src/primitives/Base64/Base64.test.ts +75 -0
- package/src/primitives/Base64/convert.ts +37 -0
- package/src/primitives/Base64/decode.ts +59 -0
- package/src/primitives/Base64/encode.ts +42 -0
- package/src/primitives/Base64/from.ts +39 -0
- package/src/primitives/Base64/index.ts +81 -1
- package/src/primitives/Base64/size.ts +16 -0
- package/src/primitives/Base64/validation.ts +16 -0
- package/src/primitives/Blob/Blob.test.ts +292 -0
- package/src/primitives/Blob/calculateGas.ts +30 -0
- package/src/primitives/Blob/estimateBlobCount.ts +30 -0
- package/src/primitives/Blob/from.ts +38 -0
- package/src/primitives/Blob/fromData.ts +36 -0
- package/src/primitives/Blob/index.ts +99 -12
- package/src/primitives/Blob/isValidVersion.ts +27 -0
- package/src/primitives/Blob/joinData.ts +43 -0
- package/src/primitives/Blob/splitData.ts +36 -0
- package/src/primitives/Blob/toCommitment.ts +43 -0
- package/src/primitives/Blob/toProof.ts +50 -0
- package/src/primitives/Blob/toVersionedHash.ts +35 -0
- package/src/primitives/Blob/verify.ts +49 -0
- package/src/primitives/Blob/verifyBatch.ts +119 -0
- package/src/primitives/BloomFilter/BloomFilter.test.ts +138 -0
- package/src/primitives/BloomFilter/add.ts +23 -0
- package/src/primitives/BloomFilter/combine.ts +21 -0
- package/src/primitives/BloomFilter/contains.ts +26 -0
- package/src/primitives/BloomFilter/create.ts +35 -0
- package/src/primitives/BloomFilter/density.ts +22 -0
- package/src/primitives/BloomFilter/expectedFalsePositiveRate.ts +25 -0
- package/src/primitives/BloomFilter/fromHex.ts +37 -0
- package/src/primitives/BloomFilter/hash.ts +43 -0
- package/src/primitives/BloomFilter/index.ts +59 -37
- package/src/primitives/BloomFilter/isEmpty.ts +22 -0
- package/src/primitives/BloomFilter/merge.ts +24 -0
- package/src/primitives/BloomFilter/toHex.ts +22 -0
- package/src/primitives/Bytecode/analyze.ts +58 -0
- package/src/primitives/Bytecode/detectFusions.ts +10 -0
- package/src/primitives/Bytecode/equals.ts +10 -0
- package/src/primitives/Bytecode/extractRuntime.ts +12 -0
- package/src/primitives/Bytecode/format.ts +16 -0
- package/src/primitives/Bytecode/from.ts +16 -0
- package/src/primitives/Bytecode/fromHex.ts +14 -0
- package/src/primitives/Bytecode/getBlock.ts +12 -0
- package/src/primitives/Bytecode/getNextPc.ts +12 -0
- package/src/primitives/Bytecode/getPushSize.ts +8 -0
- package/src/primitives/Bytecode/hasMetadata.ts +10 -0
- package/src/primitives/Bytecode/hash.ts +9 -0
- package/src/primitives/Bytecode/index.ts +103 -13
- package/src/primitives/Bytecode/isPush.ts +8 -0
- package/src/primitives/Bytecode/isTerminator.ts +8 -0
- package/src/primitives/Bytecode/isValidJumpDest.ts +12 -0
- package/src/primitives/Bytecode/parseInstructions.ts +10 -0
- package/src/primitives/Bytecode/prettyPrint.ts +12 -0
- package/src/primitives/Bytecode/scan.ts +20 -0
- package/src/primitives/Bytecode/size.ts +9 -0
- package/src/primitives/Bytecode/stripMetadata.ts +10 -0
- package/src/primitives/Bytecode/toAbi.ts +10 -0
- package/src/primitives/Bytecode/toHex.ts +10 -0
- package/src/primitives/Bytecode/types.ts +23 -0
- package/src/primitives/Bytecode/validate.ts +9 -0
- package/src/primitives/ContractSignature/ContractSignature.test.ts +1 -13
- package/src/primitives/ContractSignature/verifySignature.ts +88 -62
- package/src/primitives/Ens/Ens.test.ts +71 -0
- package/src/primitives/Ens/convert.ts +13 -0
- package/src/primitives/Ens/from.ts +32 -0
- package/src/primitives/Ens/hash.ts +46 -0
- package/src/primitives/Ens/index.ts +86 -4
- package/src/primitives/Ens/normalize.ts +45 -0
- package/src/primitives/Ens/validation.ts +38 -0
- package/src/primitives/EventLog/accessors.ts +32 -0
- package/src/primitives/EventLog/clone.ts +17 -0
- package/src/primitives/EventLog/create.ts +46 -0
- package/src/primitives/EventLog/filtering.ts +48 -0
- package/src/primitives/EventLog/index.ts +96 -6
- package/src/primitives/EventLog/status.ts +17 -0
- package/src/primitives/EventLog/toRpc.ts +49 -0
- package/src/primitives/Hardfork/HardforkSchema.ts +3 -3
- package/src/primitives/Hardfork/allIds.ts +13 -0
- package/src/primitives/Hardfork/allNames.ts +13 -0
- package/src/primitives/Hardfork/compare.ts +17 -0
- package/src/primitives/Hardfork/comparisons.ts +45 -0
- package/src/primitives/Hardfork/equals.ts +17 -0
- package/src/primitives/Hardfork/features.ts +61 -0
- package/src/primitives/Hardfork/fromString.ts +16 -0
- package/src/primitives/Hardfork/index.ts +128 -18
- package/src/primitives/Hardfork/isValidName.ts +14 -0
- package/src/primitives/Hardfork/minMax.ts +23 -0
- package/src/primitives/Hardfork/range.ts +19 -0
- package/src/primitives/Hardfork/toString.ts +16 -0
- package/src/primitives/Hash/Hash.test.ts +104 -0
- package/src/primitives/Hash/from.ts +47 -0
- package/src/primitives/Hash/fromBytes.ts +46 -0
- package/src/primitives/Hash/fromHex.ts +44 -0
- package/src/primitives/Hash/index.ts +45 -8
- package/src/primitives/Hash/isHash.ts +31 -0
- package/src/primitives/Hash/toHex.ts +29 -0
- package/src/primitives/Hex/Hex.test.ts +327 -153
- package/src/primitives/Hex/assertSize.ts +41 -0
- package/src/primitives/Hex/concat.ts +37 -0
- package/src/primitives/Hex/from.ts +38 -0
- package/src/primitives/Hex/fromBigInt.ts +40 -0
- package/src/primitives/Hex/fromBoolean.ts +29 -0
- package/src/primitives/Hex/fromNumber.ts +41 -0
- package/src/primitives/Hex/fromString.ts +28 -0
- package/src/primitives/Hex/index.ts +68 -37
- package/src/primitives/Hex/pad.ts +40 -0
- package/src/primitives/Hex/padRight.ts +39 -0
- package/src/primitives/Hex/size.ts +29 -0
- package/src/primitives/Hex/slice.ts +42 -0
- package/src/primitives/Hex/toBigInt.ts +27 -0
- package/src/primitives/Hex/toBoolean.ts +38 -0
- package/src/primitives/Hex/toNumber.ts +37 -0
- package/src/primitives/Hex/toStringHex.ts +39 -0
- package/src/primitives/Hex/trim.ts +27 -0
- package/src/primitives/Hex/validate.ts +37 -0
- package/src/primitives/Hex/xor.ts +39 -0
- package/src/primitives/Opcode/OpcodeSchema.ts +1 -1
- package/src/primitives/Opcode/disassemble.ts +15 -0
- package/src/primitives/Opcode/dupPosition.ts +15 -0
- package/src/primitives/Opcode/format.ts +15 -0
- package/src/primitives/Opcode/getters.ts +54 -0
- package/src/primitives/Opcode/index.ts +301 -11
- package/src/primitives/Opcode/info.ts +18 -0
- package/src/primitives/Opcode/jumpDests.ts +15 -0
- package/src/primitives/Opcode/logTopics.ts +15 -0
- package/src/primitives/Opcode/name.ts +15 -0
- package/src/primitives/Opcode/parse.ts +15 -0
- package/src/primitives/Opcode/predicates.ts +72 -0
- package/src/primitives/Opcode/pushBytes.ts +15 -0
- package/src/primitives/Opcode/pushOpcode.ts +15 -0
- package/src/primitives/Opcode/swapPosition.ts +15 -0
- package/src/primitives/Rlp/decodeBatch.ts +46 -0
- package/src/primitives/Rlp/decodeObject.ts +46 -0
- package/src/primitives/Rlp/decodeValue.ts +51 -0
- package/src/primitives/Rlp/encodeBatch.ts +50 -0
- package/src/primitives/Rlp/encodeObject.ts +48 -0
- package/src/primitives/Rlp/encodeVariadic.ts +49 -0
- package/src/primitives/Rlp/equals.ts +22 -0
- package/src/primitives/Rlp/from.ts +44 -0
- package/src/primitives/Rlp/fromJSON.ts +45 -0
- package/src/primitives/Rlp/getEncodedLength.ts +47 -0
- package/src/primitives/Rlp/getLength.ts +44 -0
- package/src/primitives/Rlp/index.ts +67 -14
- package/src/primitives/Rlp/isBytesData.ts +21 -0
- package/src/primitives/Rlp/isCanonical.ts +32 -0
- package/src/primitives/Rlp/isData.ts +21 -0
- package/src/primitives/Rlp/isList.ts +46 -0
- package/src/primitives/Rlp/isListData.ts +21 -0
- package/src/primitives/Rlp/isString.ts +46 -0
- package/src/primitives/Rlp/toJSON.ts +20 -0
- package/src/primitives/Rlp/toRaw.ts +31 -0
- package/src/primitives/Signature/Signature.test.ts +217 -0
- package/src/primitives/Signature/from.ts +38 -0
- package/src/primitives/Signature/fromBytes.ts +31 -0
- package/src/primitives/Signature/fromCompact.ts +33 -0
- package/src/primitives/Signature/fromDER.ts +35 -0
- package/src/primitives/Signature/fromEd25519.ts +24 -0
- package/src/primitives/Signature/fromHex.ts +29 -0
- package/src/primitives/Signature/fromP256.ts +25 -0
- package/src/primitives/Signature/fromRpc.ts +38 -0
- package/src/primitives/Signature/fromSecp256k1.ts +29 -0
- package/src/primitives/Signature/fromTuple.ts +33 -0
- package/src/primitives/Signature/getR.ts +24 -0
- package/src/primitives/Signature/getS.ts +24 -0
- package/src/primitives/Signature/getV.ts +24 -0
- package/src/primitives/Signature/index.ts +61 -11
- package/src/primitives/Signature/toDER.ts +24 -0
- package/src/primitives/Signature/toHex.ts +24 -0
- package/src/primitives/Signature/toRpc.ts +35 -0
- package/src/primitives/Signature/toTuple.ts +29 -0
- package/src/primitives/Signature/verify.ts +31 -0
- package/src/primitives/Siwe/create.ts +56 -0
- package/src/primitives/Siwe/hash.ts +27 -0
- package/src/primitives/Siwe/index.ts +57 -21
- package/src/primitives/Siwe/parse.ts +24 -0
- package/src/primitives/Siwe/verify.ts +47 -0
- package/src/primitives/Transaction/Transaction.test.ts +309 -0
- package/src/primitives/Transaction/index.ts +467 -2
- package/src/primitives/Uint/Uint.test.ts +200 -0
- package/src/primitives/Uint/dividedBy.ts +34 -0
- package/src/primitives/Uint/from.ts +35 -0
- package/src/primitives/Uint/fromAbiEncoded.ts +29 -0
- package/src/primitives/Uint/fromBigInt.ts +30 -0
- package/src/primitives/Uint/fromBytes.ts +32 -0
- package/src/primitives/Uint/fromHex.ts +32 -0
- package/src/primitives/Uint/fromNumber.ts +30 -0
- package/src/primitives/Uint/index.ts +90 -45
- package/src/primitives/Uint/isUint256.ts +25 -0
- package/src/primitives/Uint/isValid.ts +25 -0
- package/src/primitives/Uint/modulo.ts +34 -0
- package/src/primitives/Uint/toHex.ts +31 -0
- package/src/primitives/Uint/tryFrom.ts +30 -0
- package/src/services/Contract/Contract.test.ts +46 -41
- package/src/services/Contract/Contract.ts +25 -29
- package/src/services/Contract/ContractTypes.ts +6 -3
- package/src/services/Contract/estimateGas.test.ts +21 -9
- package/src/services/Contract/estimateGas.ts +21 -23
- package/src/services/Debug/Debug.ts +1 -1
- package/src/services/Debug/DebugService.ts +1 -1
- package/src/services/FeeEstimator/DefaultFeeEstimator.ts +10 -6
- package/src/services/FeeEstimator/FeeEstimator.test.ts +68 -62
- package/src/services/Multicall/BalanceResolver.ts +1 -1
- package/src/services/Multicall/GetBalance.ts +1 -1
- package/src/services/Multicall/Multicall.ts +1 -1
- package/src/services/NonceManager/DefaultNonceManager.ts +4 -7
- package/src/services/NonceManager/NonceManager.test.ts +20 -33
- package/src/services/Provider/Provider.test.ts +155 -349
- package/src/services/Provider/Provider.ts +14 -1180
- package/src/services/Provider/ProviderService.ts +14 -1199
- package/src/services/Provider/actions/multicall.test.ts +29 -39
- package/src/services/Provider/actions/multicall.ts +2 -2
- package/src/services/Provider/actions/readContract.test.ts +45 -50
- package/src/services/Provider/actions/readContract.ts +2 -6
- package/src/services/Provider/actions/simulateContract.test.ts +55 -232
- package/src/services/Provider/actions/simulateContract.ts +2 -3
- package/src/services/Provider/ens/getEnsAddress.ts +11 -14
- package/src/services/Provider/ens/getEnsName.ts +15 -18
- package/src/services/Provider/ens/getEnsResolver.ts +11 -14
- package/src/services/Provider/ens/getEnsText.ts +15 -18
- package/src/services/Provider/functions/backfillBlocks.ts +97 -0
- package/src/services/Provider/functions/call.ts +45 -0
- package/src/services/Provider/functions/createAccessList.ts +61 -0
- package/src/services/Provider/functions/createBlockFilter.ts +41 -0
- package/src/services/Provider/functions/createEventFilter.ts +43 -0
- package/src/services/Provider/functions/createPendingTransactionFilter.ts +41 -0
- package/src/services/Provider/functions/estimateGas.ts +52 -0
- package/src/services/Provider/functions/getAccounts.ts +40 -0
- package/src/services/Provider/functions/getBalance.ts +50 -0
- package/src/services/Provider/functions/getBlobBaseFee.ts +46 -0
- package/src/services/Provider/functions/getBlock.ts +95 -0
- package/src/services/Provider/functions/getBlockNumber.ts +51 -0
- package/src/services/Provider/functions/getBlockReceipts.ts +78 -0
- package/src/services/Provider/functions/getBlockTransactionCount.ts +86 -0
- package/src/services/Provider/functions/getChainId.ts +46 -0
- package/src/services/Provider/functions/getCode.ts +43 -0
- package/src/services/Provider/functions/getCoinbase.ts +40 -0
- package/src/services/Provider/functions/getFeeHistory.ts +85 -0
- package/src/services/Provider/functions/getFilterChanges.ts +42 -0
- package/src/services/Provider/functions/getFilterLogs.ts +44 -0
- package/src/services/Provider/functions/getGasPrice.ts +46 -0
- package/src/services/Provider/functions/getHashrate.ts +46 -0
- package/src/services/Provider/functions/getLogs.ts +45 -0
- package/src/services/Provider/functions/getMaxPriorityFeePerGas.ts +46 -0
- package/src/services/Provider/functions/getMining.ts +40 -0
- package/src/services/Provider/functions/getProof.ts +52 -0
- package/src/services/Provider/functions/getProtocolVersion.ts +40 -0
- package/src/services/Provider/functions/getStorageAt.ts +52 -0
- package/src/services/Provider/functions/getSyncing.ts +56 -0
- package/src/services/Provider/functions/getTransaction.ts +57 -0
- package/src/services/Provider/functions/getTransactionByBlockHashAndIndex.ts +73 -0
- package/src/services/Provider/functions/getTransactionByBlockNumberAndIndex.ts +86 -0
- package/src/services/Provider/functions/getTransactionConfirmations.ts +70 -0
- package/src/services/Provider/functions/getTransactionCount.ts +50 -0
- package/src/services/Provider/functions/getTransactionReceipt.ts +57 -0
- package/src/services/Provider/functions/getUncle.ts +97 -0
- package/src/services/Provider/functions/getUncleCount.ts +86 -0
- package/src/services/Provider/functions/index.ts +73 -0
- package/src/services/Provider/functions/netVersion.ts +40 -0
- package/src/services/Provider/functions/sendRawTransaction.ts +40 -0
- package/src/services/Provider/functions/sendTransaction.ts +48 -0
- package/src/services/Provider/functions/sign.ts +50 -0
- package/src/services/Provider/functions/signTransaction.ts +52 -0
- package/src/services/Provider/functions/simulateV1.ts +95 -0
- package/src/services/Provider/functions/simulateV2.ts +51 -0
- package/src/services/Provider/functions/subscribe.ts +49 -0
- package/src/services/Provider/functions/uninstallFilter.ts +40 -0
- package/src/services/Provider/functions/unsubscribe.ts +41 -0
- package/src/services/Provider/functions/waitForTransactionReceipt.ts +168 -0
- package/src/services/Provider/functions/watchBlocks.ts +98 -0
- package/src/services/Provider/index.ts +29 -178
- package/src/services/Provider/types.ts +780 -0
- package/src/services/Provider/utils.ts +204 -0
- package/src/services/RawProvider/ForkProviderTransport.ts +2 -3
- package/src/services/RawProvider/HttpProviderTransport.ts +3 -3
- package/src/services/RawProvider/InMemoryProviderTransport.ts +3 -3
- package/src/services/RawProvider/WebSocketProviderTransport.ts +3 -3
- package/src/services/Signer/Signer.test.ts +211 -187
- package/src/services/Signer/Signer.ts +26 -16
- package/src/services/Signer/actions/deployContract.test.ts +125 -105
- package/src/services/Signer/actions/deployContract.ts +3 -2
- package/src/services/Signer/actions/prepareAuthorization.test.ts +47 -48
- package/src/services/Signer/actions/prepareAuthorization.ts +3 -3
- package/src/services/Signer/actions/signAuthorization.test.ts +39 -45
- package/src/services/Signer/actions/signAuthorization.ts +3 -3
- package/src/services/Signer/actions/writeContract.test.ts +41 -57
- package/src/services/Transport/FallbackTransport.ts +3 -3
- package/src/services/Transport/HttpTransport.ts +3 -3
- package/src/services/Transport/config.ts +7 -7
- package/src/services/Transport/index.ts +3 -4
- package/src/services/errors.test.ts +3 -8
- package/src/services/index.ts +8 -90
- package/src/services/presets/index.ts +9 -10
- package/src/services/presets/presets.test.ts +14 -29
- package/src/standards/ERC165.test.ts +19 -20
- package/src/standards/ERC165.ts +9 -11
- package/src/type-exports.test.ts +37 -0
- package/dist/AccountService-BetXokad.d.ts +0 -1717
- package/dist/RpcResolver-BpvqybjD.d.ts +0 -6439
- package/src/services/Provider/Account.ts +0 -33
- package/src/services/Provider/AccountService.ts +0 -84
- package/src/services/Provider/Blocks.ts +0 -32
- package/src/services/Provider/BlocksService.ts +0 -73
- package/src/services/Provider/Events.ts +0 -33
- package/src/services/Provider/EventsService.ts +0 -71
- package/src/services/Provider/Network.ts +0 -41
- package/src/services/Provider/NetworkService.ts +0 -114
- package/src/services/Provider/Simulation.ts +0 -34
- package/src/services/Provider/SimulationService.ts +0 -161
- package/src/services/Provider/Streaming.ts +0 -30
- package/src/services/Provider/StreamingService.ts +0 -58
- package/src/services/Provider/Transaction.ts +0 -39
- package/src/services/Provider/TransactionService.ts +0 -83
- package/src/services/Provider/filters.ts +0 -91
- package/src/services/Provider/getBlobBaseFee.ts +0 -170
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fileoverview Live implementation of StreamingService using ProviderService.
|
|
3
|
-
*
|
|
4
|
-
* @module Streaming
|
|
5
|
-
* @since 0.3.0
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import * as Effect from "effect/Effect";
|
|
9
|
-
import * as Layer from "effect/Layer";
|
|
10
|
-
import { ProviderService } from "./ProviderService.js";
|
|
11
|
-
import { StreamingService } from "./StreamingService.js";
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Live implementation of the Streaming layer.
|
|
15
|
-
*
|
|
16
|
-
* @since 0.3.0
|
|
17
|
-
*/
|
|
18
|
-
export const Streaming: Layer.Layer<StreamingService, never, ProviderService> =
|
|
19
|
-
Layer.effect(
|
|
20
|
-
StreamingService,
|
|
21
|
-
Effect.gen(function* () {
|
|
22
|
-
const provider = yield* ProviderService;
|
|
23
|
-
return {
|
|
24
|
-
watchBlocks: provider.watchBlocks,
|
|
25
|
-
backfillBlocks: provider.backfillBlocks,
|
|
26
|
-
subscribe: provider.subscribe,
|
|
27
|
-
unsubscribe: provider.unsubscribe,
|
|
28
|
-
};
|
|
29
|
-
}),
|
|
30
|
-
);
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fileoverview Streaming service definition for streaming JSON-RPC calls.
|
|
3
|
-
*
|
|
4
|
-
* @module StreamingService
|
|
5
|
-
* @since 0.3.0
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import type {
|
|
9
|
-
BackfillOptions,
|
|
10
|
-
BlockInclude,
|
|
11
|
-
BlockStreamEvent,
|
|
12
|
-
BlocksEvent,
|
|
13
|
-
WatchOptions,
|
|
14
|
-
} from "@tevm/voltaire/block";
|
|
15
|
-
import * as Context from "effect/Context";
|
|
16
|
-
import type * as Effect from "effect/Effect";
|
|
17
|
-
import type * as Stream from "effect/Stream";
|
|
18
|
-
import type {
|
|
19
|
-
BackfillBlocksError,
|
|
20
|
-
SubscribeError,
|
|
21
|
-
UnsubscribeError,
|
|
22
|
-
WatchBlocksError,
|
|
23
|
-
} from "./ProviderService.js";
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Shape of the Streaming service.
|
|
27
|
-
*
|
|
28
|
-
* @since 0.3.0
|
|
29
|
-
*/
|
|
30
|
-
export type StreamingShape = {
|
|
31
|
-
/** Watch for new blocks with reorg detection */
|
|
32
|
-
readonly watchBlocks: <TInclude extends BlockInclude = "header">(
|
|
33
|
-
options?: WatchOptions<TInclude>,
|
|
34
|
-
) => Stream.Stream<BlockStreamEvent<TInclude>, WatchBlocksError>;
|
|
35
|
-
/** Backfill historical blocks */
|
|
36
|
-
readonly backfillBlocks: <TInclude extends BlockInclude = "header">(
|
|
37
|
-
options: BackfillOptions<TInclude>,
|
|
38
|
-
) => Stream.Stream<BlocksEvent<TInclude>, BackfillBlocksError>;
|
|
39
|
-
/** Subscribes to JSON-RPC streams (eth_subscribe) */
|
|
40
|
-
readonly subscribe?: (
|
|
41
|
-
subscription: string,
|
|
42
|
-
params?: readonly unknown[],
|
|
43
|
-
) => Effect.Effect<`0x${string}`, SubscribeError>;
|
|
44
|
-
/** Unsubscribes from JSON-RPC streams (eth_unsubscribe) */
|
|
45
|
-
readonly unsubscribe?: (
|
|
46
|
-
subscriptionId: `0x${string}`,
|
|
47
|
-
) => Effect.Effect<boolean, UnsubscribeError>;
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Streaming service for block streams and subscriptions.
|
|
52
|
-
*
|
|
53
|
-
* @since 0.3.0
|
|
54
|
-
*/
|
|
55
|
-
export class StreamingService extends Context.Tag("StreamingService")<
|
|
56
|
-
StreamingService,
|
|
57
|
-
StreamingShape
|
|
58
|
-
>() {}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fileoverview Live implementation of TransactionService using ProviderService.
|
|
3
|
-
*
|
|
4
|
-
* @module Transaction
|
|
5
|
-
* @since 0.3.0
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import * as Effect from "effect/Effect";
|
|
9
|
-
import * as Layer from "effect/Layer";
|
|
10
|
-
import { ProviderService } from "./ProviderService.js";
|
|
11
|
-
import { TransactionService } from "./TransactionService.js";
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Live implementation of the Transaction layer.
|
|
15
|
-
*
|
|
16
|
-
* @since 0.3.0
|
|
17
|
-
*/
|
|
18
|
-
export const Transaction: Layer.Layer<
|
|
19
|
-
TransactionService,
|
|
20
|
-
never,
|
|
21
|
-
ProviderService
|
|
22
|
-
> = Layer.effect(
|
|
23
|
-
TransactionService,
|
|
24
|
-
Effect.gen(function* () {
|
|
25
|
-
const provider = yield* ProviderService;
|
|
26
|
-
return {
|
|
27
|
-
getTransaction: provider.getTransaction,
|
|
28
|
-
getTransactionReceipt: provider.getTransactionReceipt,
|
|
29
|
-
getTransactionByBlockHashAndIndex:
|
|
30
|
-
provider.getTransactionByBlockHashAndIndex,
|
|
31
|
-
getTransactionByBlockNumberAndIndex:
|
|
32
|
-
provider.getTransactionByBlockNumberAndIndex,
|
|
33
|
-
sendRawTransaction: provider.sendRawTransaction,
|
|
34
|
-
sendTransaction: provider.sendTransaction,
|
|
35
|
-
waitForTransactionReceipt: provider.waitForTransactionReceipt,
|
|
36
|
-
getTransactionConfirmations: provider.getTransactionConfirmations,
|
|
37
|
-
};
|
|
38
|
-
}),
|
|
39
|
-
);
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fileoverview Transaction service definition for transaction-related JSON-RPC calls.
|
|
3
|
-
*
|
|
4
|
-
* @module TransactionService
|
|
5
|
-
* @since 0.3.0
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import type { HexType } from "@tevm/voltaire/Hex";
|
|
9
|
-
import * as Context from "effect/Context";
|
|
10
|
-
import type * as Effect from "effect/Effect";
|
|
11
|
-
import type {
|
|
12
|
-
BlockTag,
|
|
13
|
-
GetTransactionByBlockHashAndIndexError,
|
|
14
|
-
GetTransactionByBlockNumberAndIndexError,
|
|
15
|
-
GetTransactionConfirmationsError,
|
|
16
|
-
GetTransactionError,
|
|
17
|
-
GetTransactionReceiptError,
|
|
18
|
-
HashInput,
|
|
19
|
-
ReceiptType,
|
|
20
|
-
RpcTransactionRequest,
|
|
21
|
-
SendRawTransactionError,
|
|
22
|
-
SendTransactionError,
|
|
23
|
-
TransactionIndexInput,
|
|
24
|
-
TransactionType,
|
|
25
|
-
WaitForTransactionReceiptError,
|
|
26
|
-
} from "./ProviderService.js";
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Shape of the Transaction service.
|
|
30
|
-
*
|
|
31
|
-
* @since 0.3.0
|
|
32
|
-
*/
|
|
33
|
-
export type TransactionShape = {
|
|
34
|
-
/** Gets a transaction by hash */
|
|
35
|
-
readonly getTransaction: (
|
|
36
|
-
hash: HashInput,
|
|
37
|
-
) => Effect.Effect<TransactionType, GetTransactionError>;
|
|
38
|
-
/** Gets a transaction receipt */
|
|
39
|
-
readonly getTransactionReceipt: (
|
|
40
|
-
hash: HashInput,
|
|
41
|
-
) => Effect.Effect<ReceiptType, GetTransactionReceiptError>;
|
|
42
|
-
/** Gets a transaction by block hash and index (if supported) */
|
|
43
|
-
readonly getTransactionByBlockHashAndIndex?: (
|
|
44
|
-
blockHash: HashInput,
|
|
45
|
-
index: TransactionIndexInput,
|
|
46
|
-
) => Effect.Effect<TransactionType, GetTransactionByBlockHashAndIndexError>;
|
|
47
|
-
/** Gets a transaction by block number/tag and index (if supported) */
|
|
48
|
-
readonly getTransactionByBlockNumberAndIndex?: (
|
|
49
|
-
blockTag: BlockTag | bigint,
|
|
50
|
-
index: TransactionIndexInput,
|
|
51
|
-
) => Effect.Effect<TransactionType, GetTransactionByBlockNumberAndIndexError>;
|
|
52
|
-
/** Sends a signed raw transaction */
|
|
53
|
-
readonly sendRawTransaction: (
|
|
54
|
-
signedTx: HexType | `0x${string}`,
|
|
55
|
-
) => Effect.Effect<`0x${string}`, SendRawTransactionError>;
|
|
56
|
-
/** Sends a transaction via unlocked JSON-RPC account (if supported) */
|
|
57
|
-
readonly sendTransaction?: (
|
|
58
|
-
tx: RpcTransactionRequest,
|
|
59
|
-
) => Effect.Effect<`0x${string}`, SendTransactionError>;
|
|
60
|
-
/** Waits for a transaction to be confirmed */
|
|
61
|
-
readonly waitForTransactionReceipt: (
|
|
62
|
-
hash: HashInput,
|
|
63
|
-
opts?: {
|
|
64
|
-
confirmations?: number;
|
|
65
|
-
timeout?: number;
|
|
66
|
-
pollingInterval?: number;
|
|
67
|
-
},
|
|
68
|
-
) => Effect.Effect<ReceiptType, WaitForTransactionReceiptError>;
|
|
69
|
-
/** Gets the number of confirmations for a transaction */
|
|
70
|
-
readonly getTransactionConfirmations: (
|
|
71
|
-
hash: HashInput,
|
|
72
|
-
) => Effect.Effect<bigint, GetTransactionConfirmationsError>;
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* Transaction service for transaction-related JSON-RPC operations.
|
|
77
|
-
*
|
|
78
|
-
* @since 0.3.0
|
|
79
|
-
*/
|
|
80
|
-
export class TransactionService extends Context.Tag("TransactionService")<
|
|
81
|
-
TransactionService,
|
|
82
|
-
TransactionShape
|
|
83
|
-
>() {}
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fileoverview Filter-based subscription helpers for ProviderService.
|
|
3
|
-
*
|
|
4
|
-
* @module Provider/filters
|
|
5
|
-
* @since 0.0.1
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import * as Effect from "effect/Effect";
|
|
9
|
-
import {
|
|
10
|
-
type CreateBlockFilterError,
|
|
11
|
-
type CreateEventFilterError,
|
|
12
|
-
type CreatePendingTransactionFilterError,
|
|
13
|
-
type EventFilter,
|
|
14
|
-
type FilterChanges,
|
|
15
|
-
type FilterId,
|
|
16
|
-
type GetFilterChangesError,
|
|
17
|
-
type GetFilterLogsError,
|
|
18
|
-
type LogType,
|
|
19
|
-
ProviderService,
|
|
20
|
-
type UninstallFilterError,
|
|
21
|
-
} from "./ProviderService.js";
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Creates an event log filter via eth_newFilter.
|
|
25
|
-
*/
|
|
26
|
-
export const createEventFilter = (
|
|
27
|
-
filter?: EventFilter,
|
|
28
|
-
): Effect.Effect<FilterId, CreateEventFilterError, ProviderService> =>
|
|
29
|
-
Effect.gen(function* () {
|
|
30
|
-
const provider = yield* ProviderService;
|
|
31
|
-
return yield* provider.createEventFilter(filter);
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Creates a new block filter via eth_newBlockFilter.
|
|
36
|
-
*/
|
|
37
|
-
export const createBlockFilter = (): Effect.Effect<
|
|
38
|
-
FilterId,
|
|
39
|
-
CreateBlockFilterError,
|
|
40
|
-
ProviderService
|
|
41
|
-
> =>
|
|
42
|
-
Effect.gen(function* () {
|
|
43
|
-
const provider = yield* ProviderService;
|
|
44
|
-
return yield* provider.createBlockFilter();
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* Creates a pending transaction filter via eth_newPendingTransactionFilter.
|
|
49
|
-
*/
|
|
50
|
-
export const createPendingTransactionFilter = (): Effect.Effect<
|
|
51
|
-
FilterId,
|
|
52
|
-
CreatePendingTransactionFilterError,
|
|
53
|
-
ProviderService
|
|
54
|
-
> =>
|
|
55
|
-
Effect.gen(function* () {
|
|
56
|
-
const provider = yield* ProviderService;
|
|
57
|
-
return yield* provider.createPendingTransactionFilter();
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* Gets changes since last poll for a filter via eth_getFilterChanges.
|
|
62
|
-
*/
|
|
63
|
-
export const getFilterChanges = (
|
|
64
|
-
filterId: FilterId,
|
|
65
|
-
): Effect.Effect<FilterChanges, GetFilterChangesError, ProviderService> =>
|
|
66
|
-
Effect.gen(function* () {
|
|
67
|
-
const provider = yield* ProviderService;
|
|
68
|
-
return yield* provider.getFilterChanges(filterId);
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* Gets all logs for a filter via eth_getFilterLogs.
|
|
73
|
-
*/
|
|
74
|
-
export const getFilterLogs = (
|
|
75
|
-
filterId: FilterId,
|
|
76
|
-
): Effect.Effect<LogType[], GetFilterLogsError, ProviderService> =>
|
|
77
|
-
Effect.gen(function* () {
|
|
78
|
-
const provider = yield* ProviderService;
|
|
79
|
-
return yield* provider.getFilterLogs(filterId);
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* Uninstalls a filter via eth_uninstallFilter.
|
|
84
|
-
*/
|
|
85
|
-
export const uninstallFilter = (
|
|
86
|
-
filterId: FilterId,
|
|
87
|
-
): Effect.Effect<boolean, UninstallFilterError, ProviderService> =>
|
|
88
|
-
Effect.gen(function* () {
|
|
89
|
-
const provider = yield* ProviderService;
|
|
90
|
-
return yield* provider.uninstallFilter(filterId);
|
|
91
|
-
});
|
|
@@ -1,170 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fileoverview EIP-4844 blob base fee helpers.
|
|
3
|
-
*
|
|
4
|
-
* @module Provider/getBlobBaseFee
|
|
5
|
-
* @since 0.0.1
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import {
|
|
9
|
-
GAS_PER_BLOB,
|
|
10
|
-
InvalidBlobCountError,
|
|
11
|
-
MAX_PER_TRANSACTION,
|
|
12
|
-
} from "@tevm/voltaire/Blob";
|
|
13
|
-
import { BlobBaseFee } from "@tevm/voltaire/FeeMarket";
|
|
14
|
-
import * as Effect from "effect/Effect";
|
|
15
|
-
import { TransportError } from "../Transport/TransportError.js";
|
|
16
|
-
import { TransportService } from "../Transport/TransportService.js";
|
|
17
|
-
import {
|
|
18
|
-
type BlockType,
|
|
19
|
-
type GetBlobBaseFeeError,
|
|
20
|
-
ProviderNotFoundError,
|
|
21
|
-
ProviderResponseError,
|
|
22
|
-
} from "./ProviderService.js";
|
|
23
|
-
|
|
24
|
-
const METHOD_NOT_FOUND = -32601;
|
|
25
|
-
|
|
26
|
-
const parseHexToBigInt = (
|
|
27
|
-
method: string,
|
|
28
|
-
hex: string,
|
|
29
|
-
): Effect.Effect<bigint, ProviderResponseError> =>
|
|
30
|
-
Effect.try({
|
|
31
|
-
try: () => BigInt(hex),
|
|
32
|
-
catch: (error) =>
|
|
33
|
-
new ProviderResponseError(
|
|
34
|
-
{ method, response: hex },
|
|
35
|
-
`Invalid hex response from RPC: ${hex}`,
|
|
36
|
-
{ cause: error instanceof Error ? error : undefined },
|
|
37
|
-
),
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
const blobBaseFeeFromBlock = (
|
|
41
|
-
block: BlockType,
|
|
42
|
-
): Effect.Effect<bigint, ProviderResponseError> => {
|
|
43
|
-
if (block.excessBlobGas === undefined || block.excessBlobGas === null) {
|
|
44
|
-
return Effect.fail(
|
|
45
|
-
new ProviderResponseError(
|
|
46
|
-
{ method: "eth_getBlockByNumber", blockNumber: block.number },
|
|
47
|
-
"Blob base fee not available for pre-Dencun blocks",
|
|
48
|
-
),
|
|
49
|
-
);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
return parseHexToBigInt("eth_getBlockByNumber", block.excessBlobGas).pipe(
|
|
53
|
-
Effect.map((excessBlobGas) => BlobBaseFee(excessBlobGas)),
|
|
54
|
-
);
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Estimates blob gas usage for a given blob count.
|
|
59
|
-
*
|
|
60
|
-
* @param blobCount - Number of blobs
|
|
61
|
-
* @returns Blob gas used (bigint)
|
|
62
|
-
* @throws {InvalidBlobCountError} When blob count is negative or exceeds maximum
|
|
63
|
-
*
|
|
64
|
-
* @example
|
|
65
|
-
* ```typescript
|
|
66
|
-
* const blobGas = estimateBlobGas(3) // 393216n
|
|
67
|
-
* ```
|
|
68
|
-
*/
|
|
69
|
-
export const estimateBlobGas = (blobCount: number | bigint): bigint => {
|
|
70
|
-
const count = typeof blobCount === "bigint" ? blobCount : BigInt(blobCount);
|
|
71
|
-
const maxBlobs = BigInt(MAX_PER_TRANSACTION);
|
|
72
|
-
|
|
73
|
-
if (count < 0n || count > maxBlobs) {
|
|
74
|
-
throw new InvalidBlobCountError(
|
|
75
|
-
`Invalid blob count: ${blobCount} (max ${MAX_PER_TRANSACTION})`,
|
|
76
|
-
{
|
|
77
|
-
value: blobCount,
|
|
78
|
-
expected: `0-${MAX_PER_TRANSACTION} blobs`,
|
|
79
|
-
},
|
|
80
|
-
);
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
return count * BigInt(GAS_PER_BLOB);
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* Calculates total blob fee from base fee and blob gas used.
|
|
88
|
-
*
|
|
89
|
-
* @param baseFee - Blob base fee (wei per blob gas)
|
|
90
|
-
* @param blobGasUsed - Total blob gas used
|
|
91
|
-
* @returns Total blob gas fee (wei)
|
|
92
|
-
*/
|
|
93
|
-
export const calculateBlobGasPrice = (
|
|
94
|
-
baseFee: bigint,
|
|
95
|
-
blobGasUsed: bigint,
|
|
96
|
-
): bigint => baseFee * blobGasUsed;
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* Gets the current blob base fee (EIP-4844).
|
|
100
|
-
*
|
|
101
|
-
* @description
|
|
102
|
-
* Attempts to call `eth_blobBaseFee` and falls back to calculating the base
|
|
103
|
-
* fee from the latest block's `excessBlobGas` if the RPC method is unavailable.
|
|
104
|
-
*
|
|
105
|
-
* @returns Effect yielding the blob base fee as bigint
|
|
106
|
-
*
|
|
107
|
-
* @example
|
|
108
|
-
* ```typescript
|
|
109
|
-
* const fee = yield* getBlobBaseFee()
|
|
110
|
-
* ```
|
|
111
|
-
*/
|
|
112
|
-
export const getBlobBaseFee = (): Effect.Effect<
|
|
113
|
-
bigint,
|
|
114
|
-
GetBlobBaseFeeError,
|
|
115
|
-
TransportService
|
|
116
|
-
> =>
|
|
117
|
-
Effect.gen(function* () {
|
|
118
|
-
const transport = yield* TransportService;
|
|
119
|
-
|
|
120
|
-
const request = <T>(
|
|
121
|
-
method: string,
|
|
122
|
-
params?: unknown[],
|
|
123
|
-
): Effect.Effect<T, TransportError> =>
|
|
124
|
-
transport.request<T>(method, params).pipe(
|
|
125
|
-
Effect.mapError(
|
|
126
|
-
(error) =>
|
|
127
|
-
new TransportError(error.input, error.message, {
|
|
128
|
-
cause: error,
|
|
129
|
-
context: { method, params },
|
|
130
|
-
}),
|
|
131
|
-
),
|
|
132
|
-
);
|
|
133
|
-
|
|
134
|
-
const fromRpc: Effect.Effect<
|
|
135
|
-
bigint,
|
|
136
|
-
TransportError | ProviderResponseError
|
|
137
|
-
> = request<string>("eth_blobBaseFee").pipe(
|
|
138
|
-
Effect.flatMap((hex) => parseHexToBigInt("eth_blobBaseFee", hex)),
|
|
139
|
-
);
|
|
140
|
-
|
|
141
|
-
const fromBlock: Effect.Effect<
|
|
142
|
-
bigint,
|
|
143
|
-
TransportError | ProviderResponseError | ProviderNotFoundError
|
|
144
|
-
> = request<BlockType | null>("eth_getBlockByNumber", [
|
|
145
|
-
"latest",
|
|
146
|
-
false,
|
|
147
|
-
]).pipe(
|
|
148
|
-
Effect.flatMap((block) =>
|
|
149
|
-
block
|
|
150
|
-
? blobBaseFeeFromBlock(block)
|
|
151
|
-
: Effect.fail<ProviderResponseError | ProviderNotFoundError>(
|
|
152
|
-
new ProviderNotFoundError(
|
|
153
|
-
{ method: "eth_getBlockByNumber", params: ["latest", false] },
|
|
154
|
-
"Block not found",
|
|
155
|
-
{ resource: "block" },
|
|
156
|
-
),
|
|
157
|
-
),
|
|
158
|
-
),
|
|
159
|
-
);
|
|
160
|
-
|
|
161
|
-
const result: Effect.Effect<bigint, GetBlobBaseFeeError> = fromRpc.pipe(
|
|
162
|
-
Effect.catchTag(
|
|
163
|
-
"TransportError",
|
|
164
|
-
(error): Effect.Effect<bigint, GetBlobBaseFeeError> =>
|
|
165
|
-
error.code === METHOD_NOT_FOUND ? fromBlock : Effect.fail(error),
|
|
166
|
-
),
|
|
167
|
-
);
|
|
168
|
-
|
|
169
|
-
return yield* result;
|
|
170
|
-
});
|