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
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import * as effect_Cause from 'effect/Cause';
|
|
2
|
+
import * as effect_Types from 'effect/Types';
|
|
3
|
+
import { KzgBlobType, KzgCommitmentType, KzgProofType } from '@tevm/voltaire';
|
|
4
|
+
import * as Context from 'effect/Context';
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
import * as Layer from 'effect/Layer';
|
|
7
|
+
|
|
8
|
+
declare const KZGError_base: new <A extends Record<string, any> = {}>(args: effect_Types.Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => effect_Cause.YieldableError & {
|
|
9
|
+
readonly _tag: "KZGError";
|
|
10
|
+
} & Readonly<A>;
|
|
11
|
+
/**
|
|
12
|
+
* Error thrown when a KZG operation fails.
|
|
13
|
+
*
|
|
14
|
+
* @description
|
|
15
|
+
* Contains the operation that failed, error code, message, and optional cause.
|
|
16
|
+
*
|
|
17
|
+
* Common failure reasons:
|
|
18
|
+
* - Trusted setup not loaded (SETUP_NOT_LOADED)
|
|
19
|
+
* - Invalid blob size or format (INVALID_BLOB)
|
|
20
|
+
* - Invalid commitment format (INVALID_COMMITMENT)
|
|
21
|
+
* - Invalid proof format (INVALID_PROOF)
|
|
22
|
+
* - Verification failure
|
|
23
|
+
*
|
|
24
|
+
* @since 0.0.1
|
|
25
|
+
*/
|
|
26
|
+
declare class KZGError extends KZGError_base<{
|
|
27
|
+
/** Error code for programmatic handling */
|
|
28
|
+
readonly code: "SETUP_NOT_LOADED" | "INVALID_BLOB" | "INVALID_COMMITMENT" | "INVALID_PROOF" | "OPERATION_FAILED";
|
|
29
|
+
/** The KZG operation that failed */
|
|
30
|
+
readonly operation: "blobToKzgCommitment" | "computeBlobKzgProof" | "verifyBlobKzgProof" | "loadTrustedSetup" | "isInitialized";
|
|
31
|
+
/** Human-readable error message */
|
|
32
|
+
readonly message: string;
|
|
33
|
+
/** Underlying error that caused this failure */
|
|
34
|
+
readonly cause?: unknown;
|
|
35
|
+
}> {
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Shape interface for KZG commitment service operations.
|
|
39
|
+
*
|
|
40
|
+
* @description
|
|
41
|
+
* Defines the contract for KZG implementations. Operations require the trusted
|
|
42
|
+
* setup to be loaded first via loadTrustedSetup().
|
|
43
|
+
*
|
|
44
|
+
* @since 0.0.1
|
|
45
|
+
*/
|
|
46
|
+
interface KZGServiceShape {
|
|
47
|
+
/**
|
|
48
|
+
* Computes a KZG commitment for a blob.
|
|
49
|
+
* @param blob - The 128KB blob data
|
|
50
|
+
* @returns Effect containing the 48-byte commitment, or KZGError if operation fails
|
|
51
|
+
*/
|
|
52
|
+
readonly blobToKzgCommitment: (blob: KzgBlobType) => Effect.Effect<KzgCommitmentType, KZGError>;
|
|
53
|
+
/**
|
|
54
|
+
* Computes a KZG proof for a blob and commitment.
|
|
55
|
+
* @param blob - The 128KB blob data
|
|
56
|
+
* @param commitment - The 48-byte commitment
|
|
57
|
+
* @returns Effect containing the 48-byte proof, or KZGError if operation fails
|
|
58
|
+
*/
|
|
59
|
+
readonly computeBlobKzgProof: (blob: KzgBlobType, commitment: KzgCommitmentType) => Effect.Effect<KzgProofType, KZGError>;
|
|
60
|
+
/**
|
|
61
|
+
* Verifies a KZG proof against a blob and commitment.
|
|
62
|
+
* @param blob - The 128KB blob data
|
|
63
|
+
* @param commitment - The 48-byte commitment
|
|
64
|
+
* @param proof - The 48-byte proof
|
|
65
|
+
* @returns Effect containing true if proof is valid, or KZGError if operation fails
|
|
66
|
+
*/
|
|
67
|
+
readonly verifyBlobKzgProof: (blob: KzgBlobType, commitment: KzgCommitmentType, proof: KzgProofType) => Effect.Effect<boolean, KZGError>;
|
|
68
|
+
/**
|
|
69
|
+
* Loads the trusted setup for KZG operations.
|
|
70
|
+
* @returns Effect that completes when setup is loaded, or KZGError if loading fails
|
|
71
|
+
*/
|
|
72
|
+
readonly loadTrustedSetup: () => Effect.Effect<void, KZGError>;
|
|
73
|
+
/**
|
|
74
|
+
* Checks if the trusted setup has been initialized.
|
|
75
|
+
* @returns Effect containing true if initialized, or KZGError if check fails
|
|
76
|
+
*/
|
|
77
|
+
readonly isInitialized: () => Effect.Effect<boolean, KZGError>;
|
|
78
|
+
}
|
|
79
|
+
declare const KZGService_base: Context.TagClass<KZGService, "KZGService", KZGServiceShape>;
|
|
80
|
+
/**
|
|
81
|
+
* KZG polynomial commitment service for Effect-based applications.
|
|
82
|
+
* Implements EIP-4844 blob commitments for Ethereum proto-danksharding.
|
|
83
|
+
*
|
|
84
|
+
* @example
|
|
85
|
+
* ```typescript
|
|
86
|
+
* import { KZGService, KZGLive } from 'voltaire-effect/crypto'
|
|
87
|
+
* import * as Effect from 'effect/Effect'
|
|
88
|
+
*
|
|
89
|
+
* const program = Effect.gen(function* () {
|
|
90
|
+
* const kzg = yield* KZGService
|
|
91
|
+
* yield* kzg.loadTrustedSetup()
|
|
92
|
+
* const commitment = yield* kzg.blobToKzgCommitment(blob)
|
|
93
|
+
* const proof = yield* kzg.computeBlobKzgProof(blob, commitment)
|
|
94
|
+
* return yield* kzg.verifyBlobKzgProof(blob, commitment, proof)
|
|
95
|
+
* }).pipe(Effect.provide(KZGLive))
|
|
96
|
+
* ```
|
|
97
|
+
* @since 0.0.1
|
|
98
|
+
*/
|
|
99
|
+
declare class KZGService extends KZGService_base {
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Production layer for KZGService using native KZG implementation.
|
|
103
|
+
*
|
|
104
|
+
* @description
|
|
105
|
+
* Provides real KZG operations using the c-kzg-4844 library with Ethereum's
|
|
106
|
+
* trusted setup. The trusted setup must be loaded before other operations.
|
|
107
|
+
*
|
|
108
|
+
* @example
|
|
109
|
+
* ```typescript
|
|
110
|
+
* import { KZGService, KZGLive } from 'voltaire-effect/crypto/KZG'
|
|
111
|
+
* import * as Effect from 'effect/Effect'
|
|
112
|
+
*
|
|
113
|
+
* const program = Effect.gen(function* () {
|
|
114
|
+
* const kzg = yield* KZGService
|
|
115
|
+
* yield* kzg.loadTrustedSetup()
|
|
116
|
+
* const commitment = yield* kzg.blobToKzgCommitment(blob)
|
|
117
|
+
* return commitment
|
|
118
|
+
* }).pipe(Effect.provide(KZGLive))
|
|
119
|
+
* ```
|
|
120
|
+
*
|
|
121
|
+
* @since 0.0.1
|
|
122
|
+
* @see {@link KZGTest} for unit testing
|
|
123
|
+
*/
|
|
124
|
+
declare const KZGLive: Layer.Layer<KZGService, never, never>;
|
|
125
|
+
/**
|
|
126
|
+
* Test layer for KZGService returning deterministic mock values.
|
|
127
|
+
*
|
|
128
|
+
* @description
|
|
129
|
+
* Provides mock implementations for unit testing. Returns zero-filled
|
|
130
|
+
* arrays for commitments/proofs and always verifies as true.
|
|
131
|
+
* Use when testing application logic without cryptographic overhead.
|
|
132
|
+
*
|
|
133
|
+
* @example
|
|
134
|
+
* ```typescript
|
|
135
|
+
* import { KZGService, KZGTest, blobToKzgCommitment } from 'voltaire-effect/crypto/KZG'
|
|
136
|
+
* import * as Effect from 'effect/Effect'
|
|
137
|
+
*
|
|
138
|
+
* const testProgram = blobToKzgCommitment(blob).pipe(Effect.provide(KZGTest))
|
|
139
|
+
* // Returns Uint8Array(48) filled with zeros
|
|
140
|
+
* ```
|
|
141
|
+
*
|
|
142
|
+
* @since 0.0.1
|
|
143
|
+
*/
|
|
144
|
+
declare const KZGTest: Layer.Layer<KZGService, never, never>;
|
|
145
|
+
|
|
146
|
+
export { KZGService as K, KZGError as a, KZGLive as b, type KZGServiceShape as c, KZGTest as d };
|
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
import { Keccak256Hash } from '@tevm/voltaire';
|
|
2
|
+
import * as Context from 'effect/Context';
|
|
3
|
+
import * as Effect from 'effect/Effect';
|
|
4
|
+
import * as Layer from 'effect/Layer';
|
|
5
|
+
import * as effect_Cause from 'effect/Cause';
|
|
6
|
+
import * as effect_Types from 'effect/Types';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @fileoverview Keccak-256 service definition and layer implementations for Effect.
|
|
10
|
+
*
|
|
11
|
+
* @description
|
|
12
|
+
* Provides the KeccakService Effect Tag and both production (KeccakLive) and
|
|
13
|
+
* test (KeccakTest) layer implementations. The service pattern enables
|
|
14
|
+
* dependency injection for testability and flexibility.
|
|
15
|
+
*
|
|
16
|
+
* @module Keccak256/KeccakService
|
|
17
|
+
* @since 0.0.1
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Shape interface for the Keccak-256 hashing service.
|
|
22
|
+
*
|
|
23
|
+
* @description
|
|
24
|
+
* Defines the contract for Keccak-256 hash implementations.
|
|
25
|
+
* Used as the service shape for {@link KeccakService}.
|
|
26
|
+
*
|
|
27
|
+
* @since 0.0.1
|
|
28
|
+
*/
|
|
29
|
+
interface KeccakServiceShape {
|
|
30
|
+
/**
|
|
31
|
+
* Computes the Keccak-256 hash of input data.
|
|
32
|
+
*
|
|
33
|
+
* @param {Uint8Array} data - The input bytes to hash (any length)
|
|
34
|
+
* @returns {Effect.Effect<Keccak256Hash>} Effect containing the 32-byte hash
|
|
35
|
+
*/
|
|
36
|
+
readonly hash: (data: Uint8Array) => Effect.Effect<Keccak256Hash>;
|
|
37
|
+
}
|
|
38
|
+
declare const KeccakService_base: Context.TagClass<KeccakService, "KeccakService", KeccakServiceShape>;
|
|
39
|
+
/**
|
|
40
|
+
* Keccak-256 hashing service for Effect-based applications.
|
|
41
|
+
*
|
|
42
|
+
* @description
|
|
43
|
+
* An Effect Context.Tag that provides the standard Ethereum hashing algorithm
|
|
44
|
+
* used for addresses, signatures, state roots, and more. The service pattern
|
|
45
|
+
* enables swapping implementations for testing or alternative backends.
|
|
46
|
+
*
|
|
47
|
+
* The service exposes a single `hash` method that takes arbitrary bytes and
|
|
48
|
+
* produces a 32-byte Keccak-256 hash.
|
|
49
|
+
*
|
|
50
|
+
* @example Basic usage with Effect.gen
|
|
51
|
+
* ```typescript
|
|
52
|
+
* import { KeccakService, KeccakLive } from 'voltaire-effect/crypto/Keccak256'
|
|
53
|
+
* import * as Effect from 'effect/Effect'
|
|
54
|
+
*
|
|
55
|
+
* const program = Effect.gen(function* () {
|
|
56
|
+
* const keccak = yield* KeccakService
|
|
57
|
+
* return yield* keccak.hash(new Uint8Array([1, 2, 3]))
|
|
58
|
+
* }).pipe(Effect.provide(KeccakLive))
|
|
59
|
+
*
|
|
60
|
+
* const hash = await Effect.runPromise(program)
|
|
61
|
+
* ```
|
|
62
|
+
*
|
|
63
|
+
* @example Chaining multiple hashes
|
|
64
|
+
* ```typescript
|
|
65
|
+
* import { KeccakService, KeccakLive } from 'voltaire-effect/crypto/Keccak256'
|
|
66
|
+
* import * as Effect from 'effect/Effect'
|
|
67
|
+
*
|
|
68
|
+
* const doubleHash = Effect.gen(function* () {
|
|
69
|
+
* const keccak = yield* KeccakService
|
|
70
|
+
* const first = yield* keccak.hash(new Uint8Array([1, 2, 3]))
|
|
71
|
+
* return yield* keccak.hash(first)
|
|
72
|
+
* }).pipe(Effect.provide(KeccakLive))
|
|
73
|
+
* ```
|
|
74
|
+
*
|
|
75
|
+
* @example Composing with other services
|
|
76
|
+
* ```typescript
|
|
77
|
+
* import { KeccakService, KeccakLive } from 'voltaire-effect/crypto/Keccak256'
|
|
78
|
+
* import { Secp256k1Service, Secp256k1Live } from 'voltaire-effect/crypto/Secp256k1'
|
|
79
|
+
* import * as Effect from 'effect/Effect'
|
|
80
|
+
* import * as Layer from 'effect/Layer'
|
|
81
|
+
*
|
|
82
|
+
* const program = Effect.gen(function* () {
|
|
83
|
+
* const keccak = yield* KeccakService
|
|
84
|
+
* const secp = yield* Secp256k1Service
|
|
85
|
+
* const msgHash = yield* keccak.hash(message)
|
|
86
|
+
* return yield* secp.sign(msgHash, privateKey)
|
|
87
|
+
* }).pipe(Effect.provide(Layer.merge(KeccakLive, Secp256k1Live)))
|
|
88
|
+
* ```
|
|
89
|
+
*
|
|
90
|
+
* @see {@link KeccakLive} - Production implementation
|
|
91
|
+
* @see {@link KeccakTest} - Test implementation
|
|
92
|
+
* @see {@link hash} - Standalone hash function
|
|
93
|
+
* @since 0.0.1
|
|
94
|
+
*/
|
|
95
|
+
declare class KeccakService extends KeccakService_base {
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Production layer for KeccakService using native Keccak-256 implementation.
|
|
99
|
+
*
|
|
100
|
+
* @description
|
|
101
|
+
* Provides the real Keccak-256 hash implementation from the voltaire library.
|
|
102
|
+
* Use this layer in production applications for cryptographically secure hashing.
|
|
103
|
+
*
|
|
104
|
+
* The underlying implementation uses optimized native code (Zig/Rust) for
|
|
105
|
+
* high-performance hashing.
|
|
106
|
+
*
|
|
107
|
+
* @example Providing the live layer
|
|
108
|
+
* ```typescript
|
|
109
|
+
* import { KeccakService, KeccakLive } from 'voltaire-effect/crypto/Keccak256'
|
|
110
|
+
* import * as Effect from 'effect/Effect'
|
|
111
|
+
*
|
|
112
|
+
* const program = Effect.gen(function* () {
|
|
113
|
+
* const keccak = yield* KeccakService
|
|
114
|
+
* return yield* keccak.hash(new Uint8Array([0xde, 0xad, 0xbe, 0xef]))
|
|
115
|
+
* })
|
|
116
|
+
*
|
|
117
|
+
* const result = await Effect.runPromise(program.pipe(Effect.provide(KeccakLive)))
|
|
118
|
+
* ```
|
|
119
|
+
*
|
|
120
|
+
* @example Merging with other layers
|
|
121
|
+
* ```typescript
|
|
122
|
+
* import { KeccakLive } from 'voltaire-effect/crypto/Keccak256'
|
|
123
|
+
* import { SHA256Live } from 'voltaire-effect/crypto/SHA256'
|
|
124
|
+
* import * as Layer from 'effect/Layer'
|
|
125
|
+
*
|
|
126
|
+
* const CryptoLive = Layer.merge(KeccakLive, SHA256Live)
|
|
127
|
+
* ```
|
|
128
|
+
*
|
|
129
|
+
* @see {@link KeccakService} - The service tag
|
|
130
|
+
* @see {@link KeccakTest} - Test implementation for unit tests
|
|
131
|
+
* @since 0.0.1
|
|
132
|
+
*/
|
|
133
|
+
declare const KeccakLive: Layer.Layer<KeccakService, never, never>;
|
|
134
|
+
/**
|
|
135
|
+
* Test layer for KeccakService returning deterministic zero-filled hashes.
|
|
136
|
+
*
|
|
137
|
+
* @description
|
|
138
|
+
* Provides a mock Keccak-256 implementation that always returns a 32-byte
|
|
139
|
+
* array filled with zeros. Use for unit testing without cryptographic overhead
|
|
140
|
+
* when the actual hash value doesn't matter for the test.
|
|
141
|
+
*
|
|
142
|
+
* This layer is useful for:
|
|
143
|
+
* - Unit tests that need deterministic output
|
|
144
|
+
* - Performance tests that want to isolate non-crypto logic
|
|
145
|
+
* - Tests where the hash value is not validated
|
|
146
|
+
*
|
|
147
|
+
* @example Using in tests
|
|
148
|
+
* ```typescript
|
|
149
|
+
* import { KeccakService, KeccakTest } from 'voltaire-effect/crypto/Keccak256'
|
|
150
|
+
* import * as Effect from 'effect/Effect'
|
|
151
|
+
* import { describe, it, expect } from 'vitest'
|
|
152
|
+
*
|
|
153
|
+
* describe('MyService', () => {
|
|
154
|
+
* it('should hash data', async () => {
|
|
155
|
+
* const program = Effect.gen(function* () {
|
|
156
|
+
* const keccak = yield* KeccakService
|
|
157
|
+
* return yield* keccak.hash(new Uint8Array([1, 2, 3]))
|
|
158
|
+
* })
|
|
159
|
+
*
|
|
160
|
+
* const result = await Effect.runPromise(program.pipe(Effect.provide(KeccakTest)))
|
|
161
|
+
* expect(result).toEqual(new Uint8Array(32)) // All zeros
|
|
162
|
+
* })
|
|
163
|
+
* })
|
|
164
|
+
* ```
|
|
165
|
+
*
|
|
166
|
+
* @see {@link KeccakService} - The service tag
|
|
167
|
+
* @see {@link KeccakLive} - Production implementation
|
|
168
|
+
* @since 0.0.1
|
|
169
|
+
*/
|
|
170
|
+
declare const KeccakTest: Layer.Layer<KeccakService, never, never>;
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* @fileoverview Transport error class for JSON-RPC communication failures.
|
|
174
|
+
*
|
|
175
|
+
* @module TransportError
|
|
176
|
+
* @since 0.0.1
|
|
177
|
+
*
|
|
178
|
+
* @description
|
|
179
|
+
* Defines the error type used by all transport implementations when JSON-RPC
|
|
180
|
+
* communication fails. The error includes the JSON-RPC error code, message,
|
|
181
|
+
* and optional additional data for debugging.
|
|
182
|
+
*
|
|
183
|
+
* Common JSON-RPC error codes:
|
|
184
|
+
* - -32700: Parse error
|
|
185
|
+
* - -32600: Invalid request
|
|
186
|
+
* - -32601: Method not found
|
|
187
|
+
* - -32602: Invalid params
|
|
188
|
+
* - -32603: Internal error
|
|
189
|
+
* - -32000 to -32099: Server errors (implementation-defined)
|
|
190
|
+
*
|
|
191
|
+
* @see {@link TransportService} - The service that uses this error type
|
|
192
|
+
*/
|
|
193
|
+
declare const TransportError_base: new <A extends Record<string, any> = {}>(args: effect_Types.Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => effect_Cause.YieldableError & {
|
|
194
|
+
readonly _tag: "TransportError";
|
|
195
|
+
} & Readonly<A>;
|
|
196
|
+
/**
|
|
197
|
+
* Error thrown when a transport operation fails.
|
|
198
|
+
*
|
|
199
|
+
* @description
|
|
200
|
+
* Contains JSON-RPC error code and optional data for debugging.
|
|
201
|
+
* This error is thrown by all transport implementations (HttpTransport,
|
|
202
|
+
* WebSocketTransport, BrowserTransport) when a JSON-RPC request fails.
|
|
203
|
+
*
|
|
204
|
+
* The error includes:
|
|
205
|
+
* - `code`: Standard JSON-RPC error code
|
|
206
|
+
* - `message`: Human-readable error description
|
|
207
|
+
* - `data`: Optional additional error data from the provider
|
|
208
|
+
*
|
|
209
|
+
* @since 0.0.1
|
|
210
|
+
*
|
|
211
|
+
* @example Creating a transport error
|
|
212
|
+
* ```typescript
|
|
213
|
+
* const error = new TransportError({
|
|
214
|
+
* code: -32603,
|
|
215
|
+
* message: 'Internal error',
|
|
216
|
+
* data: { details: 'Connection refused' }
|
|
217
|
+
* })
|
|
218
|
+
*
|
|
219
|
+
* console.log(error.code) // -32603
|
|
220
|
+
* console.log(error.message) // 'Internal error'
|
|
221
|
+
* console.log(error.data) // { details: 'Connection refused' }
|
|
222
|
+
* ```
|
|
223
|
+
*
|
|
224
|
+
* @example Handling transport errors in Effect
|
|
225
|
+
* ```typescript
|
|
226
|
+
* import { Effect } from 'effect'
|
|
227
|
+
* import { TransportService, TransportError, HttpTransport } from 'voltaire-effect'
|
|
228
|
+
*
|
|
229
|
+
* const program = Effect.gen(function* () {
|
|
230
|
+
* const transport = yield* TransportService
|
|
231
|
+
* return yield* transport.request<string>('eth_blockNumber')
|
|
232
|
+
* }).pipe(
|
|
233
|
+
* Effect.catchTag('TransportError', (error) => {
|
|
234
|
+
* if (error.code === -32601) {
|
|
235
|
+
* console.log('Method not supported by this node')
|
|
236
|
+
* }
|
|
237
|
+
* return Effect.fail(error)
|
|
238
|
+
* }),
|
|
239
|
+
* Effect.provide(HttpTransport('https://mainnet.infura.io/v3/YOUR_KEY'))
|
|
240
|
+
* )
|
|
241
|
+
* ```
|
|
242
|
+
*
|
|
243
|
+
* @see {@link TransportService} - The service that produces this error
|
|
244
|
+
*/
|
|
245
|
+
declare class TransportError extends TransportError_base<{
|
|
246
|
+
/**
|
|
247
|
+
* The original input that caused the error.
|
|
248
|
+
*/
|
|
249
|
+
readonly input: {
|
|
250
|
+
code: number;
|
|
251
|
+
message: string;
|
|
252
|
+
data?: unknown;
|
|
253
|
+
};
|
|
254
|
+
/**
|
|
255
|
+
* JSON-RPC error code.
|
|
256
|
+
*/
|
|
257
|
+
readonly code: number;
|
|
258
|
+
/**
|
|
259
|
+
* Human-readable error message.
|
|
260
|
+
*/
|
|
261
|
+
readonly message: string;
|
|
262
|
+
/**
|
|
263
|
+
* Additional error data from the JSON-RPC response.
|
|
264
|
+
*
|
|
265
|
+
* @description
|
|
266
|
+
* May contain provider-specific error details such as revert reasons,
|
|
267
|
+
* stack traces, or other debugging information.
|
|
268
|
+
*/
|
|
269
|
+
readonly data?: unknown;
|
|
270
|
+
/**
|
|
271
|
+
* Optional underlying cause.
|
|
272
|
+
*/
|
|
273
|
+
readonly cause?: unknown;
|
|
274
|
+
/**
|
|
275
|
+
* Optional context for debugging.
|
|
276
|
+
*/
|
|
277
|
+
readonly context?: Record<string, unknown>;
|
|
278
|
+
}> {
|
|
279
|
+
/**
|
|
280
|
+
* Creates a new TransportError.
|
|
281
|
+
*
|
|
282
|
+
* @param input - JSON-RPC error response containing code, message, and optional data
|
|
283
|
+
* @param message - Optional override for the error message
|
|
284
|
+
* @param options - Optional error options
|
|
285
|
+
* @param options.cause - Underlying error that caused this failure
|
|
286
|
+
*/
|
|
287
|
+
constructor(input: {
|
|
288
|
+
code: number;
|
|
289
|
+
message: string;
|
|
290
|
+
data?: unknown;
|
|
291
|
+
}, message?: string, options?: {
|
|
292
|
+
cause?: unknown;
|
|
293
|
+
context?: Record<string, unknown>;
|
|
294
|
+
});
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
/**
|
|
298
|
+
* @fileoverview Minimal Provider service for blockchain JSON-RPC operations.
|
|
299
|
+
*
|
|
300
|
+
* @module ProviderService
|
|
301
|
+
* @since 0.0.1
|
|
302
|
+
*/
|
|
303
|
+
|
|
304
|
+
/**
|
|
305
|
+
* Minimal provider shape - only the request method.
|
|
306
|
+
* All operations are exposed as free functions that use this internally.
|
|
307
|
+
*/
|
|
308
|
+
type ProviderShape = {
|
|
309
|
+
readonly request: <T>(method: string, params?: unknown[]) => Effect.Effect<T, TransportError>;
|
|
310
|
+
};
|
|
311
|
+
declare const ProviderService_base: Context.TagClass<ProviderService, "ProviderService", ProviderShape>;
|
|
312
|
+
/**
|
|
313
|
+
* Provider service for blockchain JSON-RPC operations.
|
|
314
|
+
* Use free functions (getBalance, getBlock, call, etc.) for operations.
|
|
315
|
+
*/
|
|
316
|
+
declare class ProviderService extends ProviderService_base {
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
export { KeccakService as K, ProviderService as P, TransportError as T, type ProviderShape as a, KeccakLive as b, KeccakTest as c, type KeccakServiceShape as d };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as _tevm_voltaire from '@tevm/voltaire';
|
|
2
2
|
import { Keccak256Hash, Blake2Hash, SHA256Hash, Ripemd160Hash, KzgBlobType, KzgCommitmentType, KzgProofType } from '@tevm/voltaire';
|
|
3
3
|
import * as Effect from 'effect/Effect';
|
|
4
|
-
import {
|
|
4
|
+
import { K as KeccakService, P as ProviderService } from './ProviderService-BZ5pqDrD.js';
|
|
5
5
|
import { HashType } from '@tevm/voltaire/Hash';
|
|
6
6
|
import { Secp256k1SignatureType, Secp256k1PublicKeyType } from '@tevm/voltaire/Secp256k1';
|
|
7
7
|
import { c as InvalidSignatureError, b as InvalidRecoveryIdError, d as Secp256k1Error, S as Secp256k1Service, g as SignOptions, I as InvalidPrivateKeyError, a as InvalidPublicKeyError } from './Secp256k1Service-OxQ6hJFp.js';
|
|
@@ -13,6 +13,7 @@ import * as Context from 'effect/Context';
|
|
|
13
13
|
import * as effect_Cause from 'effect/Cause';
|
|
14
14
|
import * as effect_Types from 'effect/Types';
|
|
15
15
|
import { SignatureError as SignatureError$1, InvalidScalarError } from '@tevm/voltaire/Bls12381';
|
|
16
|
+
import { K as KZGService, a as KZGError } from './KZGService-B7PJerOb.js';
|
|
16
17
|
import { InvalidSecretKeyError, Ed25519Error, InvalidSignatureError as InvalidSignatureError$1, InvalidPublicKeyError as InvalidPublicKeyError$2 } from '@tevm/voltaire/Ed25519';
|
|
17
18
|
import { HexType } from '@tevm/voltaire/Hex';
|
|
18
19
|
import { HMACType } from '@tevm/voltaire/HMAC';
|
|
@@ -3004,144 +3005,6 @@ declare const P256Service_base: Context.TagClass<P256Service, "P256Service", P25
|
|
|
3004
3005
|
declare class P256Service extends P256Service_base {
|
|
3005
3006
|
}
|
|
3006
3007
|
|
|
3007
|
-
declare const KZGError_base: new <A extends Record<string, any> = {}>(args: effect_Types.Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => effect_Cause.YieldableError & {
|
|
3008
|
-
readonly _tag: "KZGError";
|
|
3009
|
-
} & Readonly<A>;
|
|
3010
|
-
/**
|
|
3011
|
-
* Error thrown when a KZG operation fails.
|
|
3012
|
-
*
|
|
3013
|
-
* @description
|
|
3014
|
-
* Contains the operation that failed, error code, message, and optional cause.
|
|
3015
|
-
*
|
|
3016
|
-
* Common failure reasons:
|
|
3017
|
-
* - Trusted setup not loaded (SETUP_NOT_LOADED)
|
|
3018
|
-
* - Invalid blob size or format (INVALID_BLOB)
|
|
3019
|
-
* - Invalid commitment format (INVALID_COMMITMENT)
|
|
3020
|
-
* - Invalid proof format (INVALID_PROOF)
|
|
3021
|
-
* - Verification failure
|
|
3022
|
-
*
|
|
3023
|
-
* @since 0.0.1
|
|
3024
|
-
*/
|
|
3025
|
-
declare class KZGError extends KZGError_base<{
|
|
3026
|
-
/** Error code for programmatic handling */
|
|
3027
|
-
readonly code: "SETUP_NOT_LOADED" | "INVALID_BLOB" | "INVALID_COMMITMENT" | "INVALID_PROOF" | "OPERATION_FAILED";
|
|
3028
|
-
/** The KZG operation that failed */
|
|
3029
|
-
readonly operation: "blobToKzgCommitment" | "computeBlobKzgProof" | "verifyBlobKzgProof" | "loadTrustedSetup" | "isInitialized";
|
|
3030
|
-
/** Human-readable error message */
|
|
3031
|
-
readonly message: string;
|
|
3032
|
-
/** Underlying error that caused this failure */
|
|
3033
|
-
readonly cause?: unknown;
|
|
3034
|
-
}> {
|
|
3035
|
-
}
|
|
3036
|
-
/**
|
|
3037
|
-
* Shape interface for KZG commitment service operations.
|
|
3038
|
-
*
|
|
3039
|
-
* @description
|
|
3040
|
-
* Defines the contract for KZG implementations. Operations require the trusted
|
|
3041
|
-
* setup to be loaded first via loadTrustedSetup().
|
|
3042
|
-
*
|
|
3043
|
-
* @since 0.0.1
|
|
3044
|
-
*/
|
|
3045
|
-
interface KZGServiceShape {
|
|
3046
|
-
/**
|
|
3047
|
-
* Computes a KZG commitment for a blob.
|
|
3048
|
-
* @param blob - The 128KB blob data
|
|
3049
|
-
* @returns Effect containing the 48-byte commitment, or KZGError if operation fails
|
|
3050
|
-
*/
|
|
3051
|
-
readonly blobToKzgCommitment: (blob: KzgBlobType) => Effect.Effect<KzgCommitmentType, KZGError>;
|
|
3052
|
-
/**
|
|
3053
|
-
* Computes a KZG proof for a blob and commitment.
|
|
3054
|
-
* @param blob - The 128KB blob data
|
|
3055
|
-
* @param commitment - The 48-byte commitment
|
|
3056
|
-
* @returns Effect containing the 48-byte proof, or KZGError if operation fails
|
|
3057
|
-
*/
|
|
3058
|
-
readonly computeBlobKzgProof: (blob: KzgBlobType, commitment: KzgCommitmentType) => Effect.Effect<KzgProofType, KZGError>;
|
|
3059
|
-
/**
|
|
3060
|
-
* Verifies a KZG proof against a blob and commitment.
|
|
3061
|
-
* @param blob - The 128KB blob data
|
|
3062
|
-
* @param commitment - The 48-byte commitment
|
|
3063
|
-
* @param proof - The 48-byte proof
|
|
3064
|
-
* @returns Effect containing true if proof is valid, or KZGError if operation fails
|
|
3065
|
-
*/
|
|
3066
|
-
readonly verifyBlobKzgProof: (blob: KzgBlobType, commitment: KzgCommitmentType, proof: KzgProofType) => Effect.Effect<boolean, KZGError>;
|
|
3067
|
-
/**
|
|
3068
|
-
* Loads the trusted setup for KZG operations.
|
|
3069
|
-
* @returns Effect that completes when setup is loaded, or KZGError if loading fails
|
|
3070
|
-
*/
|
|
3071
|
-
readonly loadTrustedSetup: () => Effect.Effect<void, KZGError>;
|
|
3072
|
-
/**
|
|
3073
|
-
* Checks if the trusted setup has been initialized.
|
|
3074
|
-
* @returns Effect containing true if initialized, or KZGError if check fails
|
|
3075
|
-
*/
|
|
3076
|
-
readonly isInitialized: () => Effect.Effect<boolean, KZGError>;
|
|
3077
|
-
}
|
|
3078
|
-
declare const KZGService_base: Context.TagClass<KZGService, "KZGService", KZGServiceShape>;
|
|
3079
|
-
/**
|
|
3080
|
-
* KZG polynomial commitment service for Effect-based applications.
|
|
3081
|
-
* Implements EIP-4844 blob commitments for Ethereum proto-danksharding.
|
|
3082
|
-
*
|
|
3083
|
-
* @example
|
|
3084
|
-
* ```typescript
|
|
3085
|
-
* import { KZGService, KZGLive } from 'voltaire-effect/crypto'
|
|
3086
|
-
* import * as Effect from 'effect/Effect'
|
|
3087
|
-
*
|
|
3088
|
-
* const program = Effect.gen(function* () {
|
|
3089
|
-
* const kzg = yield* KZGService
|
|
3090
|
-
* yield* kzg.loadTrustedSetup()
|
|
3091
|
-
* const commitment = yield* kzg.blobToKzgCommitment(blob)
|
|
3092
|
-
* const proof = yield* kzg.computeBlobKzgProof(blob, commitment)
|
|
3093
|
-
* return yield* kzg.verifyBlobKzgProof(blob, commitment, proof)
|
|
3094
|
-
* }).pipe(Effect.provide(KZGLive))
|
|
3095
|
-
* ```
|
|
3096
|
-
* @since 0.0.1
|
|
3097
|
-
*/
|
|
3098
|
-
declare class KZGService extends KZGService_base {
|
|
3099
|
-
}
|
|
3100
|
-
/**
|
|
3101
|
-
* Production layer for KZGService using native KZG implementation.
|
|
3102
|
-
*
|
|
3103
|
-
* @description
|
|
3104
|
-
* Provides real KZG operations using the c-kzg-4844 library with Ethereum's
|
|
3105
|
-
* trusted setup. The trusted setup must be loaded before other operations.
|
|
3106
|
-
*
|
|
3107
|
-
* @example
|
|
3108
|
-
* ```typescript
|
|
3109
|
-
* import { KZGService, KZGLive } from 'voltaire-effect/crypto/KZG'
|
|
3110
|
-
* import * as Effect from 'effect/Effect'
|
|
3111
|
-
*
|
|
3112
|
-
* const program = Effect.gen(function* () {
|
|
3113
|
-
* const kzg = yield* KZGService
|
|
3114
|
-
* yield* kzg.loadTrustedSetup()
|
|
3115
|
-
* const commitment = yield* kzg.blobToKzgCommitment(blob)
|
|
3116
|
-
* return commitment
|
|
3117
|
-
* }).pipe(Effect.provide(KZGLive))
|
|
3118
|
-
* ```
|
|
3119
|
-
*
|
|
3120
|
-
* @since 0.0.1
|
|
3121
|
-
* @see {@link KZGTest} for unit testing
|
|
3122
|
-
*/
|
|
3123
|
-
declare const KZGLive: Layer.Layer<KZGService, never, never>;
|
|
3124
|
-
/**
|
|
3125
|
-
* Test layer for KZGService returning deterministic mock values.
|
|
3126
|
-
*
|
|
3127
|
-
* @description
|
|
3128
|
-
* Provides mock implementations for unit testing. Returns zero-filled
|
|
3129
|
-
* arrays for commitments/proofs and always verifies as true.
|
|
3130
|
-
* Use when testing application logic without cryptographic overhead.
|
|
3131
|
-
*
|
|
3132
|
-
* @example
|
|
3133
|
-
* ```typescript
|
|
3134
|
-
* import { KZGService, KZGTest, blobToKzgCommitment } from 'voltaire-effect/crypto/KZG'
|
|
3135
|
-
* import * as Effect from 'effect/Effect'
|
|
3136
|
-
*
|
|
3137
|
-
* const testProgram = blobToKzgCommitment(blob).pipe(Effect.provide(KZGTest))
|
|
3138
|
-
* // Returns Uint8Array(48) filled with zeros
|
|
3139
|
-
* ```
|
|
3140
|
-
*
|
|
3141
|
-
* @since 0.0.1
|
|
3142
|
-
*/
|
|
3143
|
-
declare const KZGTest: Layer.Layer<KZGService, never, never>;
|
|
3144
|
-
|
|
3145
3008
|
/**
|
|
3146
3009
|
* @fileoverview KeystoreService Effect service definition for keystore encryption.
|
|
3147
3010
|
* @module Keystore/KeystoreService
|
|
@@ -4016,7 +3879,6 @@ declare const unwrapSignature: (signature: HexType | `0x${string}`) => Effect.Ef
|
|
|
4016
3879
|
* @param params.address - Expected signer address
|
|
4017
3880
|
* @param params.message - 32-byte message hash
|
|
4018
3881
|
* @param params.signature - Signature bytes (may be ERC-6492 wrapped)
|
|
4019
|
-
* @param params.provider - Provider service used for eth_call
|
|
4020
3882
|
* @returns Effect containing true if signature is valid
|
|
4021
3883
|
*
|
|
4022
3884
|
* @since 0.2.14
|
|
@@ -4025,8 +3887,7 @@ declare const verifySignature: (params: {
|
|
|
4025
3887
|
address: AddressType | `0x${string}`;
|
|
4026
3888
|
message: HexType | `0x${string}`;
|
|
4027
3889
|
signature: HexType | `0x${string}`;
|
|
4028
|
-
|
|
4029
|
-
}) => Effect.Effect<boolean, VerifyError>;
|
|
3890
|
+
}) => Effect.Effect<boolean, VerifyError, ProviderService>;
|
|
4030
3891
|
|
|
4031
3892
|
/**
|
|
4032
3893
|
* @fileoverview Wrap signatures for ERC-6492 counterfactual validation.
|
|
@@ -5349,4 +5210,4 @@ declare const X25519Live: Layer.Layer<X25519Service, never, never>;
|
|
|
5349
5210
|
*/
|
|
5350
5211
|
declare const X25519Test: Layer.Layer<X25519Service, never, never>;
|
|
5351
5212
|
|
|
5352
|
-
export {
|
|
5213
|
+
export { g2Mul as $, AddressDerivationError as A, Bip39Service as B, ChaCha20Poly1305Service as C, Blake2Live as D, EIP712Service as E, Blake2Test as F, hash$2 as G, HMACService as H, aggregate as I, Bls12381Live as J, KeystoreService as K, type Bls12381ServiceShape as L, sign$2 as M, verify$2 as N, Bn254Error as O, P256Service as P, Bn254Live as Q, Ripemd160Service as R, SHA256Service as S, type Bn254ServiceShape as T, Bn254Test as U, VerifyError as V, g1Add as W, g1Generator as X, g1Mul as Y, g2Add as Z, g2Generator as _, Blake2Service as a, type ModExpServiceShape as a$, pairingCheck as a0, ChaCha20Poly1305Live as a1, type ChaCha20Poly1305ServiceShape as a2, ChaCha20Poly1305Test as a3, decrypt$1 as a4, encrypt$1 as a5, generateKey as a6, generateNonce as a7, Ed25519Live as a8, type Ed25519ServiceShape as a9, type HDWalletServiceShape as aA, HDWalletTest as aB, InvalidKeyError as aC, InvalidPathError as aD, InvalidSeedError as aE, mnemonicToSeed as aF, withPrivateKey as aG, withSeed as aH, HMACLive as aI, type HMACServiceShape as aJ, HMACTest as aK, hmacSha256 as aL, hmacSha512 as aM, hash$3 as aN, type DecryptError as aO, decrypt as aP, encrypt as aQ, KeystoreLive as aR, type KeystoreServiceShape as aS, KeystoreTest as aT, withDecryptedKey as aU, blobToKzgCommitment as aV, computeBlobKzgProof as aW, verifyBlobKzgProof as aX, calculateGas as aY, ModExpLive as aZ, ModExpService as a_, Ed25519Test as aa, getPublicKey$2 as ab, sign$1 as ac, verify$1 as ad, EIP712Live as ae, type EIP712ServiceShape as af, EIP712Test as ag, hashDomain as ah, hashStruct as ai, hashTypedData as aj, recoverAddress$1 as ak, signTypedData as al, verifyTypedData as am, unwrapSignature as an, verifySignature as ao, wrapSignature as ap, derive as aq, fromMnemonic as ar, fromSeed as as, generateMnemonic as at, getPrivateKey as au, getPublicKey$1 as av, HardenedDerivationError as aw, type HDNode as ax, type HDPath as ay, type HDWalletError as az, Bls12381Service as b, ModExpTest as b0, modexp as b1, modexpBytes as b2, P256Live as b3, type P256ServiceShape as b4, sign as b5, verify as b6, hash$1 as b7, Ripemd160Live as b8, Ripemd160Test as b9, hash as ba, SHA256Live as bb, SHA256Test as bc, recoverAddress as bd, type SignatureError as be, computeSecret as bf, generateKeyPair as bg, getPublicKey as bh, X25519Live as bi, X25519Service as bj, type X25519ServiceShape as bk, X25519Test as bl, recover as bm, Secp256k1Live as bn, Secp256k1Test as bo, sign$3 as bp, verify$3 as bq, type MnemonicStrength as br, WORD_COUNTS as bs, type ChaCha20Poly1305Error as bt, InvalidKeyError$1 as bu, InvalidNonceError as bv, mapToHDWalletError as bw, Bn254Service as c, Ed25519Service as d, HDWalletService as e, CryptoLive as f, CryptoTest as g, type SignatureInput as h, index as i, RecoverError as j, AesGcmLive as k, AesGcmService as l, type AesGcmServiceShape as m, AesGcmTest as n, decrypt$2 as o, encrypt$2 as p, generateKey$1 as q, generateNonce$1 as r, Bip39Live as s, type Bip39ServiceShape as t, Bip39Test as u, generateMnemonic$1 as v, getWordCount as w, mnemonicToSeed$1 as x, mnemonicToSeedSync as y, validateMnemonic as z };
|