voltaire-effect 0.2.23
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/README.md +42 -0
- package/dist/AccountService-BetXokad.d.ts +1717 -0
- package/dist/RpcResolver-BpvqybjD.d.ts +6439 -0
- package/dist/Secp256k1Service-OxQ6hJFp.d.ts +250 -0
- package/dist/X25519Test-DGsk1V9o.d.ts +5352 -0
- package/dist/crypto/index.d.ts +289 -0
- package/dist/crypto/index.js +1254 -0
- package/dist/index-IgkEHjBe.d.ts +20058 -0
- package/dist/index.d.ts +11961 -0
- package/dist/index.js +20715 -0
- package/dist/native/index.d.ts +193 -0
- package/dist/native/index.js +20931 -0
- package/dist/primitives/index.d.ts +273 -0
- package/dist/primitives/index.js +8688 -0
- package/dist/services/index.d.ts +42 -0
- package/dist/services/index.js +6176 -0
- package/package.json +108 -0
- package/src/auth/index.ts +20 -0
- package/src/auth/siwe.test.ts +156 -0
- package/src/auth/siwe.ts +319 -0
- package/src/block/BlockError.test.ts +120 -0
- package/src/block/BlockError.ts +52 -0
- package/src/block/block.test.ts +579 -0
- package/src/block/fetchBlock.ts +100 -0
- package/src/block/fetchBlockByHash.ts +97 -0
- package/src/block/fetchBlockReceipts.ts +129 -0
- package/src/block/index.ts +52 -0
- package/src/block/toLightBlock.ts +43 -0
- package/src/blockchain/Blockchain.test.ts +468 -0
- package/src/blockchain/Blockchain.ts +441 -0
- package/src/blockchain/BlockchainService.ts +203 -0
- package/src/blockchain/index.ts +46 -0
- package/src/contract/EventStream.test.ts +802 -0
- package/src/contract/EventStream.ts +138 -0
- package/src/contract/EventStreamError.test.ts +92 -0
- package/src/contract/EventStreamError.ts +33 -0
- package/src/contract/EventStreamService.ts +124 -0
- package/src/contract/index.ts +39 -0
- package/src/crypto/AesGcm/AesGcm.test.ts +185 -0
- package/src/crypto/AesGcm/AesGcmService.ts +86 -0
- package/src/crypto/AesGcm/errors.ts +38 -0
- package/src/crypto/AesGcm/index.ts +101 -0
- package/src/crypto/AesGcm/operations.ts +191 -0
- package/src/crypto/Bip39/Bip39.test.ts +183 -0
- package/src/crypto/Bip39/Bip39Service.ts +160 -0
- package/src/crypto/Bip39/index.ts +52 -0
- package/src/crypto/Bip39/operations.ts +168 -0
- package/src/crypto/Bip39/types.ts +16 -0
- package/src/crypto/Bip39/utils.ts +42 -0
- package/src/crypto/Blake2/Blake2.test.ts +317 -0
- package/src/crypto/Blake2/Blake2Service.ts +121 -0
- package/src/crypto/Blake2/hash.ts +59 -0
- package/src/crypto/Blake2/index.ts +30 -0
- package/src/crypto/Bls12381/Bls12381.test.ts +464 -0
- package/src/crypto/Bls12381/Bls12381Live.ts +43 -0
- package/src/crypto/Bls12381/Bls12381Service.ts +131 -0
- package/src/crypto/Bls12381/aggregate.ts +66 -0
- package/src/crypto/Bls12381/index.ts +43 -0
- package/src/crypto/Bls12381/sign.ts +65 -0
- package/src/crypto/Bls12381/verify.ts +71 -0
- package/src/crypto/Bn254/Bn254.test.ts +131 -0
- package/src/crypto/Bn254/Bn254Service.ts +369 -0
- package/src/crypto/Bn254/index.ts +56 -0
- package/src/crypto/Bn254/operations.ts +259 -0
- package/src/crypto/Bn254/types.ts +15 -0
- package/src/crypto/ChaCha20Poly1305/ChaCha20Poly1305.test.ts +199 -0
- package/src/crypto/ChaCha20Poly1305/ChaCha20Poly1305Service.ts +177 -0
- package/src/crypto/ChaCha20Poly1305/errors.ts +38 -0
- package/src/crypto/ChaCha20Poly1305/index.ts +46 -0
- package/src/crypto/ChaCha20Poly1305/operations.ts +161 -0
- package/src/crypto/CryptoLive.test.ts +42 -0
- package/src/crypto/CryptoLive.ts +52 -0
- package/src/crypto/CryptoTest.ts +49 -0
- package/src/crypto/EIP712/EIP712.test.ts +197 -0
- package/src/crypto/EIP712/EIP712Service.ts +184 -0
- package/src/crypto/EIP712/index.ts +50 -0
- package/src/crypto/EIP712/operations.ts +220 -0
- package/src/crypto/ERC6492/ERC6492.test.ts +115 -0
- package/src/crypto/ERC6492/index.ts +9 -0
- package/src/crypto/ERC6492/unwrapSignature.ts +72 -0
- package/src/crypto/ERC6492/verifySignature.ts +139 -0
- package/src/crypto/ERC6492/wrapSignature.ts +55 -0
- package/src/crypto/Ed25519/Ed25519.test.ts +472 -0
- package/src/crypto/Ed25519/Ed25519Live.ts +44 -0
- package/src/crypto/Ed25519/Ed25519Service.ts +134 -0
- package/src/crypto/Ed25519/Ed25519Test.ts +59 -0
- package/src/crypto/Ed25519/getPublicKey.ts +60 -0
- package/src/crypto/Ed25519/index.ts +42 -0
- package/src/crypto/Ed25519/sign.ts +66 -0
- package/src/crypto/Ed25519/verify.ts +75 -0
- package/src/crypto/HDWallet/HDWallet.cleanup.test.ts +128 -0
- package/src/crypto/HDWallet/HDWallet.test.ts +383 -0
- package/src/crypto/HDWallet/HDWalletLive.ts +201 -0
- package/src/crypto/HDWallet/HDWalletService.ts +186 -0
- package/src/crypto/HDWallet/derive.ts +348 -0
- package/src/crypto/HDWallet/errors.ts +121 -0
- package/src/crypto/HDWallet/index.ts +65 -0
- package/src/crypto/HMAC/HMAC.test.ts +380 -0
- package/src/crypto/HMAC/HMACService.ts +174 -0
- package/src/crypto/HMAC/index.ts +39 -0
- package/src/crypto/HMAC/operations.ts +112 -0
- package/src/crypto/Hash/index.ts +51 -0
- package/src/crypto/KZG/KZG.test.ts +94 -0
- package/src/crypto/KZG/KZGService.ts +241 -0
- package/src/crypto/KZG/commit.ts +76 -0
- package/src/crypto/KZG/index.ts +42 -0
- package/src/crypto/KZG/verify.ts +52 -0
- package/src/crypto/Keccak256/Keccak256.test.ts +265 -0
- package/src/crypto/Keccak256/KeccakService.ts +177 -0
- package/src/crypto/Keccak256/hash.ts +76 -0
- package/src/crypto/Keccak256/index.ts +49 -0
- package/src/crypto/Keystore/Keystore.cleanup.test.ts +93 -0
- package/src/crypto/Keystore/Keystore.test.ts +511 -0
- package/src/crypto/Keystore/KeystoreLive.ts +35 -0
- package/src/crypto/Keystore/KeystoreService.ts +115 -0
- package/src/crypto/Keystore/KeystoreTest.ts +65 -0
- package/src/crypto/Keystore/decrypt.ts +105 -0
- package/src/crypto/Keystore/encrypt.ts +71 -0
- package/src/crypto/Keystore/index.ts +41 -0
- package/src/crypto/ModExp/ModExp.test.ts +177 -0
- package/src/crypto/ModExp/ModExpService.ts +139 -0
- package/src/crypto/ModExp/index.ts +39 -0
- package/src/crypto/ModExp/operations.ts +122 -0
- package/src/crypto/P256/P256.test.ts +414 -0
- package/src/crypto/P256/P256Live.ts +41 -0
- package/src/crypto/P256/P256Service.ts +115 -0
- package/src/crypto/P256/index.ts +37 -0
- package/src/crypto/P256/sign.ts +66 -0
- package/src/crypto/P256/verify.ts +75 -0
- package/src/crypto/Ripemd160/Ripemd160.test.ts +61 -0
- package/src/crypto/Ripemd160/Ripemd160Service.ts +119 -0
- package/src/crypto/Ripemd160/hash.ts +58 -0
- package/src/crypto/Ripemd160/index.ts +35 -0
- package/src/crypto/SHA256/SHA256.test.ts +284 -0
- package/src/crypto/SHA256/SHA256Service.ts +179 -0
- package/src/crypto/SHA256/hash.ts +93 -0
- package/src/crypto/SHA256/index.ts +48 -0
- package/src/crypto/Secp256k1/Secp256k1.test.ts +469 -0
- package/src/crypto/Secp256k1/Secp256k1Live.ts +83 -0
- package/src/crypto/Secp256k1/Secp256k1Service.ts +194 -0
- package/src/crypto/Secp256k1/Secp256k1Test.ts +101 -0
- package/src/crypto/Secp256k1/errors.ts +224 -0
- package/src/crypto/Secp256k1/index.ts +65 -0
- package/src/crypto/Secp256k1/recover.ts +106 -0
- package/src/crypto/Secp256k1/sign.ts +96 -0
- package/src/crypto/Secp256k1/verify.ts +111 -0
- package/src/crypto/Signature/Signature.test.ts +323 -0
- package/src/crypto/Signature/constantTimeEqual.ts +54 -0
- package/src/crypto/Signature/errors.ts +93 -0
- package/src/crypto/Signature/hashMessage.ts +83 -0
- package/src/crypto/Signature/index.ts +69 -0
- package/src/crypto/Signature/recoverAddress.ts +163 -0
- package/src/crypto/Signature/recoverMessageAddress.ts +70 -0
- package/src/crypto/Signature/verifyHash.ts +72 -0
- package/src/crypto/Signature/verifyMessage.ts +71 -0
- package/src/crypto/Signature/verifyTypedData.ts +88 -0
- package/src/crypto/Signers/Signers.test.ts +149 -0
- package/src/crypto/Signers/SignersLive.ts +40 -0
- package/src/crypto/Signers/SignersService.ts +73 -0
- package/src/crypto/Signers/SignersTest.ts +49 -0
- package/src/crypto/Signers/index.ts +44 -0
- package/src/crypto/Signers/operations.ts +123 -0
- package/src/crypto/Verify/errors.ts +97 -0
- package/src/crypto/Verify/hashMessage.ts +68 -0
- package/src/crypto/Verify/recoverAddress.ts +163 -0
- package/src/crypto/X25519/X25519.test.ts +168 -0
- package/src/crypto/X25519/X25519Live.ts +37 -0
- package/src/crypto/X25519/X25519Service.ts +81 -0
- package/src/crypto/X25519/X25519Test.ts +38 -0
- package/src/crypto/X25519/computeSecret.ts +61 -0
- package/src/crypto/X25519/generateKeyPair.ts +37 -0
- package/src/crypto/X25519/getPublicKey.ts +40 -0
- package/src/crypto/X25519/index.ts +41 -0
- package/src/crypto/index.ts +239 -0
- package/src/crypto/utils/constantTimeEqual.test.ts +40 -0
- package/src/crypto/utils/constantTimeEqual.ts +36 -0
- package/src/crypto/utils/index.ts +7 -0
- package/src/index.ts +224 -0
- package/src/jsonrpc/Anvil.ts +87 -0
- package/src/jsonrpc/BatchRequest.ts +23 -0
- package/src/jsonrpc/BatchResponse.ts +55 -0
- package/src/jsonrpc/Error.ts +107 -0
- package/src/jsonrpc/Eth.ts +224 -0
- package/src/jsonrpc/Hardhat.ts +69 -0
- package/src/jsonrpc/IdCounter.ts +7 -0
- package/src/jsonrpc/JsonRpc.test.ts +751 -0
- package/src/jsonrpc/Net.ts +24 -0
- package/src/jsonrpc/Request.ts +44 -0
- package/src/jsonrpc/Response.ts +98 -0
- package/src/jsonrpc/Txpool.ts +24 -0
- package/src/jsonrpc/Wallet.ts +52 -0
- package/src/jsonrpc/Web3.ts +22 -0
- package/src/jsonrpc/errors.test.ts +355 -0
- package/src/jsonrpc/errors.ts +680 -0
- package/src/jsonrpc/index.ts +112 -0
- package/src/jsonrpc/schemas/anvil/dropTransaction.ts +53 -0
- package/src/jsonrpc/schemas/anvil/impersonateAccount.ts +53 -0
- package/src/jsonrpc/schemas/anvil/index.ts +73 -0
- package/src/jsonrpc/schemas/anvil/mine.ts +52 -0
- package/src/jsonrpc/schemas/anvil/reset.ts +57 -0
- package/src/jsonrpc/schemas/anvil/revert.ts +49 -0
- package/src/jsonrpc/schemas/anvil/setAutomine.ts +45 -0
- package/src/jsonrpc/schemas/anvil/setBalance.ts +50 -0
- package/src/jsonrpc/schemas/anvil/setBlockTimestampInterval.ts +49 -0
- package/src/jsonrpc/schemas/anvil/setCode.ts +50 -0
- package/src/jsonrpc/schemas/anvil/setNextBlockTimestamp.ts +53 -0
- package/src/jsonrpc/schemas/anvil/setNonce.ts +50 -0
- package/src/jsonrpc/schemas/anvil/setStorageAt.ts +56 -0
- package/src/jsonrpc/schemas/anvil/snapshot.ts +49 -0
- package/src/jsonrpc/schemas/anvil/stopImpersonatingAccount.ts +53 -0
- package/src/jsonrpc/schemas/common.ts +450 -0
- package/src/jsonrpc/schemas/eth/accounts.ts +49 -0
- package/src/jsonrpc/schemas/eth/blobBaseFee.ts +49 -0
- package/src/jsonrpc/schemas/eth/blockNumber.ts +49 -0
- package/src/jsonrpc/schemas/eth/call.ts +69 -0
- package/src/jsonrpc/schemas/eth/chainId.ts +49 -0
- package/src/jsonrpc/schemas/eth/coinbase.ts +49 -0
- package/src/jsonrpc/schemas/eth/createAccessList.ts +57 -0
- package/src/jsonrpc/schemas/eth/estimateGas.ts +59 -0
- package/src/jsonrpc/schemas/eth/feeHistory.ts +54 -0
- package/src/jsonrpc/schemas/eth/gasPrice.ts +49 -0
- package/src/jsonrpc/schemas/eth/getBalance.ts +51 -0
- package/src/jsonrpc/schemas/eth/getBlockByHash.ts +54 -0
- package/src/jsonrpc/schemas/eth/getBlockByNumber.ts +54 -0
- package/src/jsonrpc/schemas/eth/getBlockReceipts.ts +54 -0
- package/src/jsonrpc/schemas/eth/getBlockTransactionCountByHash.ts +54 -0
- package/src/jsonrpc/schemas/eth/getBlockTransactionCountByNumber.ts +55 -0
- package/src/jsonrpc/schemas/eth/getCode.ts +51 -0
- package/src/jsonrpc/schemas/eth/getFilterChanges.ts +58 -0
- package/src/jsonrpc/schemas/eth/getFilterLogs.ts +54 -0
- package/src/jsonrpc/schemas/eth/getLogs.ts +50 -0
- package/src/jsonrpc/schemas/eth/getProof.ts +56 -0
- package/src/jsonrpc/schemas/eth/getStorageAt.ts +57 -0
- package/src/jsonrpc/schemas/eth/getTransactionByBlockHashAndIndex.ts +59 -0
- package/src/jsonrpc/schemas/eth/getTransactionByBlockNumberAndIndex.ts +59 -0
- package/src/jsonrpc/schemas/eth/getTransactionByHash.ts +54 -0
- package/src/jsonrpc/schemas/eth/getTransactionCount.ts +58 -0
- package/src/jsonrpc/schemas/eth/getTransactionReceipt.ts +54 -0
- package/src/jsonrpc/schemas/eth/getUncleByBlockHashAndIndex.ts +58 -0
- package/src/jsonrpc/schemas/eth/getUncleByBlockNumberAndIndex.ts +58 -0
- package/src/jsonrpc/schemas/eth/getUncleCountByBlockHash.ts +54 -0
- package/src/jsonrpc/schemas/eth/getUncleCountByBlockNumber.ts +54 -0
- package/src/jsonrpc/schemas/eth/getWork.ts +53 -0
- package/src/jsonrpc/schemas/eth/hashrate.ts +49 -0
- package/src/jsonrpc/schemas/eth/index.ts +178 -0
- package/src/jsonrpc/schemas/eth/maxPriorityFeePerGas.ts +53 -0
- package/src/jsonrpc/schemas/eth/mining.ts +45 -0
- package/src/jsonrpc/schemas/eth/newBlockFilter.ts +53 -0
- package/src/jsonrpc/schemas/eth/newFilter.ts +50 -0
- package/src/jsonrpc/schemas/eth/newPendingTransactionFilter.ts +53 -0
- package/src/jsonrpc/schemas/eth/protocolVersion.ts +49 -0
- package/src/jsonrpc/schemas/eth/sendRawTransaction.ts +54 -0
- package/src/jsonrpc/schemas/eth/sendTransaction.ts +54 -0
- package/src/jsonrpc/schemas/eth/sign.ts +50 -0
- package/src/jsonrpc/schemas/eth/signTransaction.ts +54 -0
- package/src/jsonrpc/schemas/eth/submitHashrate.ts +57 -0
- package/src/jsonrpc/schemas/eth/submitWork.ts +54 -0
- package/src/jsonrpc/schemas/eth/subscribe.ts +86 -0
- package/src/jsonrpc/schemas/eth/syncing.ts +49 -0
- package/src/jsonrpc/schemas/eth/uninstallFilter.ts +53 -0
- package/src/jsonrpc/schemas/eth/unsubscribe.ts +49 -0
- package/src/jsonrpc/schemas/hardhat/dropTransaction.ts +53 -0
- package/src/jsonrpc/schemas/hardhat/impersonateAccount.ts +53 -0
- package/src/jsonrpc/schemas/hardhat/index.ts +60 -0
- package/src/jsonrpc/schemas/hardhat/mine.ts +52 -0
- package/src/jsonrpc/schemas/hardhat/reset.ts +53 -0
- package/src/jsonrpc/schemas/hardhat/setBalance.ts +50 -0
- package/src/jsonrpc/schemas/hardhat/setCode.ts +50 -0
- package/src/jsonrpc/schemas/hardhat/setNonce.ts +50 -0
- package/src/jsonrpc/schemas/hardhat/setStorageAt.ts +56 -0
- package/src/jsonrpc/schemas/hardhat/stopImpersonatingAccount.ts +53 -0
- package/src/jsonrpc/schemas/index.ts +271 -0
- package/src/jsonrpc/schemas/net/index.ts +40 -0
- package/src/jsonrpc/schemas/net/listening.ts +45 -0
- package/src/jsonrpc/schemas/net/peerCount.ts +49 -0
- package/src/jsonrpc/schemas/net/version.ts +45 -0
- package/src/jsonrpc/schemas/schemas.test.ts +563 -0
- package/src/jsonrpc/schemas/txpool/content.ts +70 -0
- package/src/jsonrpc/schemas/txpool/index.ts +40 -0
- package/src/jsonrpc/schemas/txpool/inspect.ts +67 -0
- package/src/jsonrpc/schemas/txpool/status.ts +52 -0
- package/src/jsonrpc/schemas/wallet/addEthereumChain.ts +81 -0
- package/src/jsonrpc/schemas/wallet/getCallsStatus.ts +87 -0
- package/src/jsonrpc/schemas/wallet/getCapabilities.ts +87 -0
- package/src/jsonrpc/schemas/wallet/getPermissions.ts +51 -0
- package/src/jsonrpc/schemas/wallet/index.ts +64 -0
- package/src/jsonrpc/schemas/wallet/registerOnboarding.ts +50 -0
- package/src/jsonrpc/schemas/wallet/requestPermissions.ts +88 -0
- package/src/jsonrpc/schemas/wallet/revokePermissions.ts +62 -0
- package/src/jsonrpc/schemas/wallet/sendCalls.ts +79 -0
- package/src/jsonrpc/schemas/wallet/showCallsStatus.ts +50 -0
- package/src/jsonrpc/schemas/wallet/switchEthereumChain.ts +66 -0
- package/src/jsonrpc/schemas/wallet/watchAsset.ts +75 -0
- package/src/jsonrpc/schemas/web3/clientVersion.ts +49 -0
- package/src/jsonrpc/schemas/web3/index.ts +34 -0
- package/src/jsonrpc/schemas/web3/sha3.ts +50 -0
- package/src/native/CryptoLiveNative.ts +8 -0
- package/src/native/index.ts +14 -0
- package/src/primitives/Abi/Abi.test.ts +967 -0
- package/src/primitives/Abi/AbiSchema.test.ts +382 -0
- package/src/primitives/Abi/AbiSchema.ts +489 -0
- package/src/primitives/Abi/Item/index.ts +17 -0
- package/src/primitives/Abi/constructor/index.ts +5 -0
- package/src/primitives/Abi/decodeError.test.ts +117 -0
- package/src/primitives/Abi/decodeError.ts +103 -0
- package/src/primitives/Abi/decodeEventLog.test.ts +128 -0
- package/src/primitives/Abi/decodeEventLog.ts +164 -0
- package/src/primitives/Abi/decodeFunction.test.ts +91 -0
- package/src/primitives/Abi/decodeFunction.ts +87 -0
- package/src/primitives/Abi/decodeFunctionData.test.ts +158 -0
- package/src/primitives/Abi/decodeFunctionData.ts +116 -0
- package/src/primitives/Abi/decodeFunctionResult.test.ts +197 -0
- package/src/primitives/Abi/decodeFunctionResult.ts +160 -0
- package/src/primitives/Abi/encodeError.test.ts +106 -0
- package/src/primitives/Abi/encodeError.ts +96 -0
- package/src/primitives/Abi/encodeEventLog.test.ts +91 -0
- package/src/primitives/Abi/encodeEventLog.ts +86 -0
- package/src/primitives/Abi/encodeFunction.test.ts +65 -0
- package/src/primitives/Abi/encodeFunction.ts +65 -0
- package/src/primitives/Abi/encodeFunctionData.test.ts +149 -0
- package/src/primitives/Abi/encodeFunctionData.ts +124 -0
- package/src/primitives/Abi/encodeFunctionResult.test.ts +114 -0
- package/src/primitives/Abi/encodeFunctionResult.ts +96 -0
- package/src/primitives/Abi/error/index.ts +11 -0
- package/src/primitives/Abi/error/standards/index.ts +23 -0
- package/src/primitives/Abi/error/wrapped/index.ts +7 -0
- package/src/primitives/Abi/event/index.ts +15 -0
- package/src/primitives/Abi/findError.test.ts +97 -0
- package/src/primitives/Abi/findError.ts +55 -0
- package/src/primitives/Abi/findEvent.test.ts +100 -0
- package/src/primitives/Abi/findEvent.ts +51 -0
- package/src/primitives/Abi/findFunction.test.ts +86 -0
- package/src/primitives/Abi/findFunction.ts +58 -0
- package/src/primitives/Abi/format.test.ts +112 -0
- package/src/primitives/Abi/format.ts +39 -0
- package/src/primitives/Abi/formatWithArgs.test.ts +105 -0
- package/src/primitives/Abi/formatWithArgs.ts +43 -0
- package/src/primitives/Abi/function/errors.ts +69 -0
- package/src/primitives/Abi/function/index.ts +24 -0
- package/src/primitives/Abi/getErrorSignature.test.ts +78 -0
- package/src/primitives/Abi/getErrorSignature.ts +40 -0
- package/src/primitives/Abi/getEvent.test.ts +98 -0
- package/src/primitives/Abi/getEvent.ts +131 -0
- package/src/primitives/Abi/getEventSignature.test.ts +79 -0
- package/src/primitives/Abi/getEventSignature.ts +40 -0
- package/src/primitives/Abi/getFunction.test.ts +116 -0
- package/src/primitives/Abi/getFunction.ts +121 -0
- package/src/primitives/Abi/getFunctionSignature.test.ts +88 -0
- package/src/primitives/Abi/getFunctionSignature.ts +40 -0
- package/src/primitives/Abi/getSelector.test.ts +149 -0
- package/src/primitives/Abi/getSelector.ts +59 -0
- package/src/primitives/Abi/index.ts +53 -0
- package/src/primitives/Abi/interface/index.ts +11 -0
- package/src/primitives/Abi/parameter/index.ts +5 -0
- package/src/primitives/Abi/parse.test.ts +97 -0
- package/src/primitives/Abi/parse.ts +61 -0
- package/src/primitives/Abi/parseItem.test.ts +144 -0
- package/src/primitives/Abi/parseItem.ts +76 -0
- package/src/primitives/Abi/wasm/index.ts +67 -0
- package/src/primitives/AccessList/Rpc.ts +128 -0
- package/src/primitives/AccessList/index.ts +32 -0
- package/src/primitives/AccountState/Struct.ts +214 -0
- package/src/primitives/AccountState/index.ts +60 -0
- package/src/primitives/Address/Address.test.ts +366 -0
- package/src/primitives/Address/AddressSchema.ts +21 -0
- package/src/primitives/Address/Bytes.ts +55 -0
- package/src/primitives/Address/Checksummed.ts +93 -0
- package/src/primitives/Address/Hex.ts +56 -0
- package/src/primitives/Address/clone.ts +26 -0
- package/src/primitives/Address/compare.ts +29 -0
- package/src/primitives/Address/equals.ts +29 -0
- package/src/primitives/Address/greaterThan.ts +29 -0
- package/src/primitives/Address/index.ts +89 -0
- package/src/primitives/Address/isValid.ts +26 -0
- package/src/primitives/Address/isValidChecksum.ts +26 -0
- package/src/primitives/Address/isZero.ts +26 -0
- package/src/primitives/Address/lessThan.ts +29 -0
- package/src/primitives/Address/toAbiEncoded.ts +28 -0
- package/src/primitives/Address/toBytes.ts +26 -0
- package/src/primitives/Address/toLowercase.ts +28 -0
- package/src/primitives/Address/toShortHex.ts +27 -0
- package/src/primitives/Address/toU256.ts +28 -0
- package/src/primitives/Address/toUppercase.ts +28 -0
- package/src/primitives/Authorization/Rpc.ts +148 -0
- package/src/primitives/Authorization/index.ts +38 -0
- package/src/primitives/Balance/BigInt.ts +48 -0
- package/src/primitives/Balance/Number.ts +46 -0
- package/src/primitives/Balance/String.ts +47 -0
- package/src/primitives/Balance/index.ts +44 -0
- package/src/primitives/Base64/Base64Schema.ts +90 -0
- package/src/primitives/Base64/extensions/index.ts +10 -0
- package/src/primitives/Base64/index.ts +28 -0
- package/src/primitives/BaseFeePerGas/BigInt.ts +49 -0
- package/src/primitives/BaseFeePerGas/Gwei.ts +63 -0
- package/src/primitives/BaseFeePerGas/index.ts +47 -0
- package/src/primitives/BaseFeePerGas/toGwei.ts +28 -0
- package/src/primitives/BeaconBlockRoot/Hex.ts +76 -0
- package/src/primitives/BeaconBlockRoot/index.ts +47 -0
- package/src/primitives/BinaryTree/BinaryTreeSchema.ts +34 -0
- package/src/primitives/BinaryTree/get.ts +28 -0
- package/src/primitives/BinaryTree/index.ts +27 -0
- package/src/primitives/BinaryTree/init.ts +23 -0
- package/src/primitives/BinaryTree/rootHash.ts +22 -0
- package/src/primitives/Blob/BlobSchema.ts +87 -0
- package/src/primitives/Blob/index.ts +54 -0
- package/src/primitives/Blob/isValid.ts +22 -0
- package/src/primitives/Blob/toData.ts +23 -0
- package/src/primitives/Block/Block.test.ts +377 -0
- package/src/primitives/Block/BlockSchema.ts +201 -0
- package/src/primitives/Block/Rpc.ts +189 -0
- package/src/primitives/Block/index.ts +55 -0
- package/src/primitives/BlockBody/BlockBody.test.ts +228 -0
- package/src/primitives/BlockBody/BlockBodySchema.ts +85 -0
- package/src/primitives/BlockBody/Rpc.ts +100 -0
- package/src/primitives/BlockBody/index.ts +52 -0
- package/src/primitives/BlockFilter/BlockFilterSchema.ts +39 -0
- package/src/primitives/BlockFilter/index.ts +20 -0
- package/src/primitives/BlockHash/BlockHashTypeSchema.ts +21 -0
- package/src/primitives/BlockHash/Bytes.ts +53 -0
- package/src/primitives/BlockHash/Hex.ts +56 -0
- package/src/primitives/BlockHash/index.ts +55 -0
- package/src/primitives/BlockHeader/BlockHeaderSchema.ts +84 -0
- package/src/primitives/BlockHeader/Rpc.ts +95 -0
- package/src/primitives/BlockHeader/calculateHash.ts +24 -0
- package/src/primitives/BlockHeader/index.ts +61 -0
- package/src/primitives/BlockNumber/BigInt.ts +51 -0
- package/src/primitives/BlockNumber/BlockNumber.test.ts +122 -0
- package/src/primitives/BlockNumber/BlockNumberTypeSchema.ts +21 -0
- package/src/primitives/BlockNumber/Hex.ts +56 -0
- package/src/primitives/BlockNumber/Number.ts +66 -0
- package/src/primitives/BlockNumber/index.ts +60 -0
- package/src/primitives/BloomFilter/BloomFilterSchema.ts +96 -0
- package/src/primitives/BloomFilter/extensions/index.ts +12 -0
- package/src/primitives/BloomFilter/index.ts +64 -0
- package/src/primitives/Brand/Brand.test.ts +192 -0
- package/src/primitives/Brand/index.ts +292 -0
- package/src/primitives/BuilderBid/BuilderBidSchema.ts +116 -0
- package/src/primitives/BuilderBid/index.ts +38 -0
- package/src/primitives/Bundle/BundleSchema.ts +176 -0
- package/src/primitives/Bundle/index.ts +43 -0
- package/src/primitives/BundleHash/Hex.ts +68 -0
- package/src/primitives/BundleHash/index.ts +30 -0
- package/src/primitives/Bundler/BundlerSchema.ts +77 -0
- package/src/primitives/Bundler/index.ts +35 -0
- package/src/primitives/Bytecode/Bytecode.test.ts +49 -0
- package/src/primitives/Bytecode/BytecodeSchema.ts +48 -0
- package/src/primitives/Bytecode/Bytes.ts +60 -0
- package/src/primitives/Bytecode/Hex.ts +61 -0
- package/src/primitives/Bytecode/index.ts +45 -0
- package/src/primitives/Bytes/Bytes.test.ts +402 -0
- package/src/primitives/Bytes/Bytes1/index.ts +18 -0
- package/src/primitives/Bytes/Bytes16/index.ts +23 -0
- package/src/primitives/Bytes/Bytes2/index.ts +17 -0
- package/src/primitives/Bytes/Bytes3/index.ts +17 -0
- package/src/primitives/Bytes/Bytes32/index.ts +28 -0
- package/src/primitives/Bytes/Bytes4/index.ts +17 -0
- package/src/primitives/Bytes/Bytes5/index.ts +17 -0
- package/src/primitives/Bytes/Bytes6/index.ts +17 -0
- package/src/primitives/Bytes/Bytes64/index.ts +23 -0
- package/src/primitives/Bytes/Bytes7/index.ts +17 -0
- package/src/primitives/Bytes/Bytes8/index.ts +17 -0
- package/src/primitives/Bytes/Hex.ts +59 -0
- package/src/primitives/Bytes/concat.ts +23 -0
- package/src/primitives/Bytes/equals.ts +26 -0
- package/src/primitives/Bytes/extensions/index.ts +6 -0
- package/src/primitives/Bytes/index.ts +79 -0
- package/src/primitives/Bytes/isBytes.ts +23 -0
- package/src/primitives/Bytes/random.ts +22 -0
- package/src/primitives/Bytes/size.ts +22 -0
- package/src/primitives/Bytes/toString.ts +24 -0
- package/src/primitives/Bytes32/Bytes.ts +57 -0
- package/src/primitives/Bytes32/Bytes32.test.ts +62 -0
- package/src/primitives/Bytes32/Hex.ts +57 -0
- package/src/primitives/Bytes32/index.ts +80 -0
- package/src/primitives/CallData/CallData.test.ts +35 -0
- package/src/primitives/CallData/Hex.ts +74 -0
- package/src/primitives/CallData/empty.ts +24 -0
- package/src/primitives/CallData/index.ts +50 -0
- package/src/primitives/CallTrace/CallTraceSchema.ts +38 -0
- package/src/primitives/CallTrace/flatten.ts +21 -0
- package/src/primitives/CallTrace/getCalls.ts +20 -0
- package/src/primitives/CallTrace/hasError.ts +22 -0
- package/src/primitives/CallTrace/index.ts +13 -0
- package/src/primitives/Chain/ChainSchema.ts +231 -0
- package/src/primitives/Chain/index.ts +57 -0
- package/src/primitives/ChainHead/ChainHeadSchema.ts +130 -0
- package/src/primitives/ChainHead/index.ts +53 -0
- package/src/primitives/ChainId/BigInt.ts +79 -0
- package/src/primitives/ChainId/Hex.ts +83 -0
- package/src/primitives/ChainId/Number.ts +78 -0
- package/src/primitives/ChainId/index.ts +56 -0
- package/src/primitives/CompilerVersion/CompilerVersionSchema.ts +42 -0
- package/src/primitives/CompilerVersion/index.ts +10 -0
- package/src/primitives/ContractCode/Bytes.ts +63 -0
- package/src/primitives/ContractCode/ContractCode.test.ts +45 -0
- package/src/primitives/ContractCode/Hex.ts +65 -0
- package/src/primitives/ContractCode/index.ts +51 -0
- package/src/primitives/ContractResult/ContractResultSchema.ts +98 -0
- package/src/primitives/ContractResult/index.ts +13 -0
- package/src/primitives/ContractSignature/ContractSignature.test.ts +111 -0
- package/src/primitives/ContractSignature/Struct.ts +67 -0
- package/src/primitives/ContractSignature/index.ts +68 -0
- package/src/primitives/ContractSignature/verifySignature.ts +254 -0
- package/src/primitives/DecodedData/DecodedDataSchema.ts +72 -0
- package/src/primitives/DecodedData/index.ts +11 -0
- package/src/primitives/Denomination/EtherSchema.ts +87 -0
- package/src/primitives/Denomination/GweiSchema.ts +86 -0
- package/src/primitives/Denomination/WeiSchema.ts +87 -0
- package/src/primitives/Denomination/index.ts +49 -0
- package/src/primitives/Domain/Domain.test.ts +80 -0
- package/src/primitives/Domain/Struct.ts +165 -0
- package/src/primitives/Domain/index.ts +62 -0
- package/src/primitives/DomainSeparator/DomainSeparator.test.ts +67 -0
- package/src/primitives/DomainSeparator/Hex.ts +105 -0
- package/src/primitives/DomainSeparator/index.ts +50 -0
- package/src/primitives/EffectiveGasPrice/BigInt.ts +47 -0
- package/src/primitives/EffectiveGasPrice/Gwei.ts +54 -0
- package/src/primitives/EffectiveGasPrice/calculate.ts +39 -0
- package/src/primitives/EffectiveGasPrice/compare.ts +31 -0
- package/src/primitives/EffectiveGasPrice/equals.ts +31 -0
- package/src/primitives/EffectiveGasPrice/index.ts +59 -0
- package/src/primitives/EffectiveGasPrice/toGwei.ts +28 -0
- package/src/primitives/EncodedData/EncodedDataSchema.ts +66 -0
- package/src/primitives/EncodedData/index.ts +11 -0
- package/src/primitives/Ens/String.ts +45 -0
- package/src/primitives/Ens/index.ts +18 -0
- package/src/primitives/EntryPoint/EntryPointSchema.ts +113 -0
- package/src/primitives/EntryPoint/index.ts +47 -0
- package/src/primitives/Epoch/BigInt.ts +46 -0
- package/src/primitives/Epoch/index.ts +18 -0
- package/src/primitives/ErrorSignature/ErrorSignature.test.ts +43 -0
- package/src/primitives/ErrorSignature/String.ts +102 -0
- package/src/primitives/ErrorSignature/index.ts +55 -0
- package/src/primitives/EventLog/EventLog.test.ts +77 -0
- package/src/primitives/EventLog/Rpc.ts +159 -0
- package/src/primitives/EventLog/extensions/index.ts +17 -0
- package/src/primitives/EventLog/extensions/utils.ts +18 -0
- package/src/primitives/EventLog/index.ts +23 -0
- package/src/primitives/EventSignature/EventSignature.test.ts +54 -0
- package/src/primitives/EventSignature/String.ts +102 -0
- package/src/primitives/EventSignature/index.ts +53 -0
- package/src/primitives/FeeMarket/FeeMarketSchema.ts +160 -0
- package/src/primitives/FeeMarket/index.ts +36 -0
- package/src/primitives/FeeOracle/Struct.ts +152 -0
- package/src/primitives/FeeOracle/index.ts +29 -0
- package/src/primitives/FilterId/Hex.ts +97 -0
- package/src/primitives/FilterId/index.ts +57 -0
- package/src/primitives/ForkId/ForkIdSchema.ts +66 -0
- package/src/primitives/ForkId/index.ts +34 -0
- package/src/primitives/ForwardRequest/ForwardRequestSchema.ts +109 -0
- package/src/primitives/ForwardRequest/index.ts +26 -0
- package/src/primitives/FunctionSignature/FunctionSignature.test.ts +34 -0
- package/src/primitives/FunctionSignature/String.ts +77 -0
- package/src/primitives/FunctionSignature/index.ts +41 -0
- package/src/primitives/Gas/BigInt.ts +66 -0
- package/src/primitives/Gas/Hex.ts +66 -0
- package/src/primitives/Gas/Number.ts +74 -0
- package/src/primitives/Gas/index.ts +51 -0
- package/src/primitives/GasConstants/GasConstantsSchema.ts +139 -0
- package/src/primitives/GasConstants/index.ts +33 -0
- package/src/primitives/GasCosts/GasCostsSchema.ts +113 -0
- package/src/primitives/GasCosts/index.ts +24 -0
- package/src/primitives/GasEstimate/BigInt.ts +47 -0
- package/src/primitives/GasEstimate/Number.ts +47 -0
- package/src/primitives/GasEstimate/index.ts +50 -0
- package/src/primitives/GasEstimate/toGasLimit.ts +34 -0
- package/src/primitives/GasEstimate/withBuffer.ts +38 -0
- package/src/primitives/GasPrice/BigInt.ts +67 -0
- package/src/primitives/GasPrice/Gwei.ts +70 -0
- package/src/primitives/GasPrice/Hex.ts +67 -0
- package/src/primitives/GasPrice/Number.ts +71 -0
- package/src/primitives/GasPrice/index.ts +57 -0
- package/src/primitives/GasRefund/BigInt.ts +47 -0
- package/src/primitives/GasRefund/Number.ts +46 -0
- package/src/primitives/GasRefund/cappedRefund.ts +38 -0
- package/src/primitives/GasRefund/index.ts +49 -0
- package/src/primitives/GasUsed/BigInt.ts +47 -0
- package/src/primitives/GasUsed/Number.ts +46 -0
- package/src/primitives/GasUsed/calculateCost.ts +33 -0
- package/src/primitives/GasUsed/index.ts +48 -0
- package/src/primitives/Hardfork/HardforkSchema.ts +47 -0
- package/src/primitives/Hardfork/index.ts +39 -0
- package/src/primitives/Hash/Bytes.ts +71 -0
- package/src/primitives/Hash/Hash.test.ts +630 -0
- package/src/primitives/Hash/Hex.ts +72 -0
- package/src/primitives/Hash/assert.ts +46 -0
- package/src/primitives/Hash/clone.ts +32 -0
- package/src/primitives/Hash/concat.ts +32 -0
- package/src/primitives/Hash/equals.ts +35 -0
- package/src/primitives/Hash/extensions/index.ts +21 -0
- package/src/primitives/Hash/format.ts +38 -0
- package/src/primitives/Hash/index.ts +65 -0
- package/src/primitives/Hash/isValidHex.ts +30 -0
- package/src/primitives/Hash/isZero.ts +32 -0
- package/src/primitives/Hash/keccak256.ts +54 -0
- package/src/primitives/Hash/merkleRoot.ts +32 -0
- package/src/primitives/Hash/random.ts +36 -0
- package/src/primitives/Hash/slice.ts +38 -0
- package/src/primitives/Hash/toBytes.ts +43 -0
- package/src/primitives/Hash/toString.ts +32 -0
- package/src/primitives/Hex/Bytes.ts +67 -0
- package/src/primitives/Hex/Hex.test.ts +478 -0
- package/src/primitives/Hex/String.ts +64 -0
- package/src/primitives/Hex/clone.ts +31 -0
- package/src/primitives/Hex/equals.ts +32 -0
- package/src/primitives/Hex/index.ts +82 -0
- package/src/primitives/Hex/isHex.ts +32 -0
- package/src/primitives/Hex/isSized.ts +34 -0
- package/src/primitives/Hex/random.ts +31 -0
- package/src/primitives/Hex/zero.ts +30 -0
- package/src/primitives/InitCode/Bytes.ts +62 -0
- package/src/primitives/InitCode/Hex.ts +64 -0
- package/src/primitives/InitCode/InitCode.test.ts +46 -0
- package/src/primitives/InitCode/index.ts +50 -0
- package/src/primitives/Int128/BigInt.ts +52 -0
- package/src/primitives/Int128/Int128.test.ts +374 -0
- package/src/primitives/Int128/Int128Schema.ts +13 -0
- package/src/primitives/Int128/Number.ts +53 -0
- package/src/primitives/Int128/String.ts +52 -0
- package/src/primitives/Int128/abs.ts +10 -0
- package/src/primitives/Int128/add.ts +11 -0
- package/src/primitives/Int128/compare.ts +13 -0
- package/src/primitives/Int128/constants.ts +13 -0
- package/src/primitives/Int128/div.ts +11 -0
- package/src/primitives/Int128/equals.ts +11 -0
- package/src/primitives/Int128/index.ts +83 -0
- package/src/primitives/Int128/isNegative.ts +11 -0
- package/src/primitives/Int128/isZero.ts +11 -0
- package/src/primitives/Int128/mul.ts +11 -0
- package/src/primitives/Int128/negate.ts +11 -0
- package/src/primitives/Int128/sub.ts +11 -0
- package/src/primitives/Int16/BigInt.ts +54 -0
- package/src/primitives/Int16/Int16.test.ts +285 -0
- package/src/primitives/Int16/Int16Schema.ts +13 -0
- package/src/primitives/Int16/Number.ts +52 -0
- package/src/primitives/Int16/String.ts +52 -0
- package/src/primitives/Int16/abs.ts +10 -0
- package/src/primitives/Int16/add.ts +11 -0
- package/src/primitives/Int16/compare.ts +13 -0
- package/src/primitives/Int16/constants.ts +10 -0
- package/src/primitives/Int16/div.ts +11 -0
- package/src/primitives/Int16/equals.ts +11 -0
- package/src/primitives/Int16/index.ts +80 -0
- package/src/primitives/Int16/isNegative.ts +11 -0
- package/src/primitives/Int16/isZero.ts +10 -0
- package/src/primitives/Int16/mul.ts +11 -0
- package/src/primitives/Int16/negate.ts +11 -0
- package/src/primitives/Int16/sub.ts +11 -0
- package/src/primitives/Int256/BigInt.ts +53 -0
- package/src/primitives/Int256/Int256.test.ts +499 -0
- package/src/primitives/Int256/Int256Schema.ts +14 -0
- package/src/primitives/Int256/Number.ts +53 -0
- package/src/primitives/Int256/String.ts +53 -0
- package/src/primitives/Int256/abs.ts +10 -0
- package/src/primitives/Int256/add.ts +11 -0
- package/src/primitives/Int256/compare.ts +13 -0
- package/src/primitives/Int256/constants.ts +13 -0
- package/src/primitives/Int256/div.ts +11 -0
- package/src/primitives/Int256/equals.ts +11 -0
- package/src/primitives/Int256/index.ts +87 -0
- package/src/primitives/Int256/isNegative.ts +11 -0
- package/src/primitives/Int256/isZero.ts +11 -0
- package/src/primitives/Int256/mul.ts +11 -0
- package/src/primitives/Int256/negate.ts +11 -0
- package/src/primitives/Int256/sub.ts +11 -0
- package/src/primitives/Int32/BigInt.ts +52 -0
- package/src/primitives/Int32/Int32.test.ts +267 -0
- package/src/primitives/Int32/Int32Schema.ts +13 -0
- package/src/primitives/Int32/Number.ts +52 -0
- package/src/primitives/Int32/String.ts +52 -0
- package/src/primitives/Int32/abs.ts +10 -0
- package/src/primitives/Int32/add.ts +11 -0
- package/src/primitives/Int32/compare.ts +13 -0
- package/src/primitives/Int32/constants.ts +10 -0
- package/src/primitives/Int32/div.ts +11 -0
- package/src/primitives/Int32/equals.ts +11 -0
- package/src/primitives/Int32/index.ts +80 -0
- package/src/primitives/Int32/isNegative.ts +11 -0
- package/src/primitives/Int32/isZero.ts +10 -0
- package/src/primitives/Int32/mul.ts +11 -0
- package/src/primitives/Int32/negate.ts +11 -0
- package/src/primitives/Int32/sub.ts +11 -0
- package/src/primitives/Int64/BigInt.ts +52 -0
- package/src/primitives/Int64/Int64.test.ts +306 -0
- package/src/primitives/Int64/Int64Schema.ts +13 -0
- package/src/primitives/Int64/Number.ts +53 -0
- package/src/primitives/Int64/String.ts +52 -0
- package/src/primitives/Int64/abs.ts +10 -0
- package/src/primitives/Int64/add.ts +11 -0
- package/src/primitives/Int64/compare.ts +13 -0
- package/src/primitives/Int64/constants.ts +10 -0
- package/src/primitives/Int64/div.ts +11 -0
- package/src/primitives/Int64/equals.ts +11 -0
- package/src/primitives/Int64/index.ts +80 -0
- package/src/primitives/Int64/isNegative.ts +11 -0
- package/src/primitives/Int64/isZero.ts +10 -0
- package/src/primitives/Int64/mul.ts +11 -0
- package/src/primitives/Int64/negate.ts +11 -0
- package/src/primitives/Int64/sub.ts +11 -0
- package/src/primitives/Int8/BigInt.ts +60 -0
- package/src/primitives/Int8/Int8.test.ts +477 -0
- package/src/primitives/Int8/Int8Schema.ts +13 -0
- package/src/primitives/Int8/Number.ts +58 -0
- package/src/primitives/Int8/String.ts +58 -0
- package/src/primitives/Int8/abs.ts +10 -0
- package/src/primitives/Int8/add.ts +11 -0
- package/src/primitives/Int8/compare.ts +13 -0
- package/src/primitives/Int8/constants.ts +10 -0
- package/src/primitives/Int8/div.ts +11 -0
- package/src/primitives/Int8/equals.ts +11 -0
- package/src/primitives/Int8/index.ts +80 -0
- package/src/primitives/Int8/isNegative.ts +11 -0
- package/src/primitives/Int8/isZero.ts +10 -0
- package/src/primitives/Int8/mul.ts +11 -0
- package/src/primitives/Int8/negate.ts +10 -0
- package/src/primitives/Int8/sub.ts +11 -0
- package/src/primitives/License/String.ts +57 -0
- package/src/primitives/License/index.ts +22 -0
- package/src/primitives/LogFilter/LogFilter.test.ts +81 -0
- package/src/primitives/LogFilter/Rpc.ts +209 -0
- package/src/primitives/LogFilter/index.ts +36 -0
- package/src/primitives/LogIndex/Number.ts +93 -0
- package/src/primitives/LogIndex/index.ts +38 -0
- package/src/primitives/MaxFeePerGas/BigInt.ts +49 -0
- package/src/primitives/MaxFeePerGas/Gwei.ts +63 -0
- package/src/primitives/MaxFeePerGas/index.ts +47 -0
- package/src/primitives/MaxFeePerGas/toGwei.ts +28 -0
- package/src/primitives/MaxPriorityFeePerGas/BigInt.ts +48 -0
- package/src/primitives/MaxPriorityFeePerGas/Gwei.ts +63 -0
- package/src/primitives/MaxPriorityFeePerGas/index.ts +51 -0
- package/src/primitives/MaxPriorityFeePerGas/toGwei.ts +28 -0
- package/src/primitives/MemoryDump/MemoryDumpSchema.ts +70 -0
- package/src/primitives/MemoryDump/index.ts +22 -0
- package/src/primitives/MerkleTree/MerkleTreeSchema.ts +52 -0
- package/src/primitives/MerkleTree/index.ts +39 -0
- package/src/primitives/Metadata/MetadataSchema.ts +57 -0
- package/src/primitives/Metadata/index.ts +24 -0
- package/src/primitives/MultiTokenId/MultiTokenIdSchema.ts +48 -0
- package/src/primitives/MultiTokenId/index.ts +23 -0
- package/src/primitives/NetworkId/BigInt.ts +79 -0
- package/src/primitives/NetworkId/Hex.ts +86 -0
- package/src/primitives/NetworkId/Number.ts +104 -0
- package/src/primitives/NetworkId/index.ts +60 -0
- package/src/primitives/NodeInfo/NodeInfoSchema.ts +70 -0
- package/src/primitives/NodeInfo/index.ts +39 -0
- package/src/primitives/Nonce/BigInt.ts +66 -0
- package/src/primitives/Nonce/Hex.ts +66 -0
- package/src/primitives/Nonce/Number.ts +74 -0
- package/src/primitives/Nonce/index.ts +56 -0
- package/src/primitives/OpStep/OpStepSchema.ts +118 -0
- package/src/primitives/OpStep/index.ts +29 -0
- package/src/primitives/Opcode/OpcodeSchema.ts +55 -0
- package/src/primitives/Opcode/index.ts +24 -0
- package/src/primitives/PackedUserOperation/PackedUserOperationSchema.ts +203 -0
- package/src/primitives/PackedUserOperation/hash.test.ts +103 -0
- package/src/primitives/PackedUserOperation/hash.ts +128 -0
- package/src/primitives/PackedUserOperation/index.ts +80 -0
- package/src/primitives/PackedUserOperation/unpack.ts +101 -0
- package/src/primitives/Paymaster/PaymasterSchema.ts +194 -0
- package/src/primitives/Paymaster/index.ts +21 -0
- package/src/primitives/PeerId/PeerIdSchema.ts +47 -0
- package/src/primitives/PeerId/index.ts +31 -0
- package/src/primitives/PeerInfo/PeerInfoSchema.ts +61 -0
- package/src/primitives/PeerInfo/index.ts +39 -0
- package/src/primitives/PendingTransactionFilter/Struct.ts +56 -0
- package/src/primitives/PendingTransactionFilter/index.ts +25 -0
- package/src/primitives/Permit/Permit.test.ts +32 -0
- package/src/primitives/Permit/Struct.ts +77 -0
- package/src/primitives/Permit/index.ts +58 -0
- package/src/primitives/PrivateKey/Bytes.ts +59 -0
- package/src/primitives/PrivateKey/Hex.ts +64 -0
- package/src/primitives/PrivateKey/PrivateKey.test.ts +410 -0
- package/src/primitives/PrivateKey/index.ts +62 -0
- package/src/primitives/PrivateKey/isValid.ts +35 -0
- package/src/primitives/PrivateKey/random.ts +27 -0
- package/src/primitives/Proof/Struct.ts +32 -0
- package/src/primitives/Proof/equals.ts +10 -0
- package/src/primitives/Proof/index.ts +37 -0
- package/src/primitives/Proof/verify.ts +11 -0
- package/src/primitives/ProtocolVersion/ProtocolVersionSchema.ts +55 -0
- package/src/primitives/ProtocolVersion/index.ts +32 -0
- package/src/primitives/Proxy/Struct.ts +49 -0
- package/src/primitives/Proxy/index.ts +11 -0
- package/src/primitives/PublicKey/Bytes.ts +68 -0
- package/src/primitives/PublicKey/Compressed.ts +71 -0
- package/src/primitives/PublicKey/Hex.ts +57 -0
- package/src/primitives/PublicKey/PublicKey.test.ts +443 -0
- package/src/primitives/PublicKey/equals.ts +30 -0
- package/src/primitives/PublicKey/index.ts +70 -0
- package/src/primitives/PublicKey/isCompressed.ts +27 -0
- package/src/primitives/PublicKey/isValid.ts +31 -0
- package/src/primitives/PublicKey/toAddress.ts +29 -0
- package/src/primitives/PublicKey/toBytes.ts +27 -0
- package/src/primitives/PublicKey/verify.ts +36 -0
- package/src/primitives/Receipt/ReceiptSchema.test.ts +94 -0
- package/src/primitives/Receipt/ReceiptSchema.ts +492 -0
- package/src/primitives/Receipt/index.ts +65 -0
- package/src/primitives/RelayData/RelayDataSchema.ts +106 -0
- package/src/primitives/RelayData/index.ts +10 -0
- package/src/primitives/ReturnData/Bytes.ts +60 -0
- package/src/primitives/ReturnData/Hex.ts +61 -0
- package/src/primitives/ReturnData/ReturnData.test.ts +43 -0
- package/src/primitives/ReturnData/ReturnDataSchema.ts +50 -0
- package/src/primitives/ReturnData/index.ts +45 -0
- package/src/primitives/RevertReason/Bytes.ts +81 -0
- package/src/primitives/RevertReason/Hex.ts +85 -0
- package/src/primitives/RevertReason/RevertReason.test.ts +42 -0
- package/src/primitives/RevertReason/RevertReasonSchema.ts +108 -0
- package/src/primitives/RevertReason/index.ts +67 -0
- package/src/primitives/RevertReason/toString.ts +28 -0
- package/src/primitives/Rlp/Rlp.test.ts +991 -0
- package/src/primitives/Rlp/RlpSchema.ts +50 -0
- package/src/primitives/Rlp/decode.ts +57 -0
- package/src/primitives/Rlp/decodeArray.ts +48 -0
- package/src/primitives/Rlp/encode.ts +58 -0
- package/src/primitives/Rlp/encodeArray.ts +32 -0
- package/src/primitives/Rlp/encodeBytes.ts +27 -0
- package/src/primitives/Rlp/encodeList.ts +32 -0
- package/src/primitives/Rlp/flatten.ts +38 -0
- package/src/primitives/Rlp/index.ts +74 -0
- package/src/primitives/Rlp/validate.ts +25 -0
- package/src/primitives/RuntimeCode/Bytes.ts +60 -0
- package/src/primitives/RuntimeCode/Hex.ts +61 -0
- package/src/primitives/RuntimeCode/RuntimeCode.test.ts +43 -0
- package/src/primitives/RuntimeCode/RuntimeCodeSchema.ts +49 -0
- package/src/primitives/RuntimeCode/index.ts +46 -0
- package/src/primitives/Selector/Bytes.ts +64 -0
- package/src/primitives/Selector/Hex.ts +69 -0
- package/src/primitives/Selector/Selector.test.ts +258 -0
- package/src/primitives/Selector/SelectorSchema.ts +95 -0
- package/src/primitives/Selector/Signature.ts +65 -0
- package/src/primitives/Selector/equals.ts +33 -0
- package/src/primitives/Selector/index.ts +55 -0
- package/src/primitives/Signature/Bytes.ts +57 -0
- package/src/primitives/Signature/Compact.ts +59 -0
- package/src/primitives/Signature/DER.ts +65 -0
- package/src/primitives/Signature/Hex.ts +56 -0
- package/src/primitives/Signature/Rpc.ts +77 -0
- package/src/primitives/Signature/Signature.test.ts +496 -0
- package/src/primitives/Signature/SignatureSchema.ts +30 -0
- package/src/primitives/Signature/Tuple.ts +75 -0
- package/src/primitives/Signature/equals.ts +25 -0
- package/src/primitives/Signature/getAlgorithm.ts +29 -0
- package/src/primitives/Signature/index.ts +93 -0
- package/src/primitives/Signature/is.ts +26 -0
- package/src/primitives/Signature/isCanonical.ts +28 -0
- package/src/primitives/Signature/isSignature.ts +26 -0
- package/src/primitives/Signature/normalize.ts +24 -0
- package/src/primitives/Signature/toBytes.ts +24 -0
- package/src/primitives/Signature/toCompact.ts +26 -0
- package/src/primitives/SignedData/SignedDataSchema.ts +61 -0
- package/src/primitives/SignedData/index.ts +26 -0
- package/src/primitives/Siwe/Siwe.test.ts +42 -0
- package/src/primitives/Siwe/String.ts +136 -0
- package/src/primitives/Siwe/index.ts +55 -0
- package/src/primitives/Slot/SlotSchema.ts +51 -0
- package/src/primitives/Slot/index.ts +20 -0
- package/src/primitives/SourceMap/Struct.ts +94 -0
- package/src/primitives/SourceMap/index.ts +12 -0
- package/src/primitives/Ssz/SszSchema.ts +49 -0
- package/src/primitives/Ssz/index.ts +29 -0
- package/src/primitives/State/StateSchema.ts +112 -0
- package/src/primitives/State/index.ts +22 -0
- package/src/primitives/StateDiff/StateDiffSchema.ts +251 -0
- package/src/primitives/StateDiff/index.ts +28 -0
- package/src/primitives/StateProof/StateProofSchema.ts +109 -0
- package/src/primitives/StateProof/index.ts +66 -0
- package/src/primitives/StateRoot/StateRootSchema.ts +109 -0
- package/src/primitives/StateRoot/index.ts +78 -0
- package/src/primitives/StealthAddress/Struct.ts +48 -0
- package/src/primitives/StealthAddress/index.ts +6 -0
- package/src/primitives/Storage/StorageSchema.ts +100 -0
- package/src/primitives/Storage/index.ts +53 -0
- package/src/primitives/StorageDiff/StorageDiffSchema.ts +111 -0
- package/src/primitives/StorageDiff/index.ts +59 -0
- package/src/primitives/StorageProof/Struct.ts +93 -0
- package/src/primitives/StorageProof/equals.ts +72 -0
- package/src/primitives/StorageProof/index.ts +67 -0
- package/src/primitives/StorageValue/Hex.ts +109 -0
- package/src/primitives/StorageValue/index.ts +92 -0
- package/src/primitives/StructLog/Struct.ts +101 -0
- package/src/primitives/StructLog/index.ts +28 -0
- package/src/primitives/SyncStatus/SyncStatusSchema.ts +87 -0
- package/src/primitives/SyncStatus/index.ts +36 -0
- package/src/primitives/TokenBalance/Struct.ts +48 -0
- package/src/primitives/TokenBalance/index.ts +23 -0
- package/src/primitives/TokenId/BigInt.ts +50 -0
- package/src/primitives/TokenId/index.ts +36 -0
- package/src/primitives/TopicFilter/Rpc.ts +142 -0
- package/src/primitives/TopicFilter/TopicFilter.test.ts +22 -0
- package/src/primitives/TopicFilter/index.ts +29 -0
- package/src/primitives/TraceConfig/TraceConfigSchema.ts +104 -0
- package/src/primitives/TraceConfig/index.ts +22 -0
- package/src/primitives/TraceResult/TraceResultSchema.ts +96 -0
- package/src/primitives/TraceResult/index.ts +23 -0
- package/src/primitives/Transaction/Authorization/index.ts +5 -0
- package/src/primitives/Transaction/EIP1559/index.ts +17 -0
- package/src/primitives/Transaction/EIP2930/index.ts +16 -0
- package/src/primitives/Transaction/EIP4844/index.ts +18 -0
- package/src/primitives/Transaction/EIP7702/index.ts +17 -0
- package/src/primitives/Transaction/Legacy/index.ts +17 -0
- package/src/primitives/Transaction/Rpc.ts +176 -0
- package/src/primitives/Transaction/Serialized.ts +98 -0
- package/src/primitives/Transaction/Transaction.test.ts +1562 -0
- package/src/primitives/Transaction/TransactionSchema.ts +515 -0
- package/src/primitives/Transaction/index.ts +289 -0
- package/src/primitives/TransactionHash/Bytes.ts +56 -0
- package/src/primitives/TransactionHash/Hex.ts +62 -0
- package/src/primitives/TransactionHash/index.ts +58 -0
- package/src/primitives/TransactionIndex/Number.ts +59 -0
- package/src/primitives/TransactionIndex/index.ts +53 -0
- package/src/primitives/TransactionStatus/TransactionStatusSchema.ts +57 -0
- package/src/primitives/TransactionStatus/index.ts +9 -0
- package/src/primitives/TransactionUrl/TransactionUrlSchema.ts +54 -0
- package/src/primitives/TransactionUrl/index.ts +21 -0
- package/src/primitives/TypedData/Struct.ts +194 -0
- package/src/primitives/TypedData/TypedData.test.ts +63 -0
- package/src/primitives/TypedData/index.ts +54 -0
- package/src/primitives/U256/index.ts +71 -0
- package/src/primitives/Uint/BigInt.ts +60 -0
- package/src/primitives/Uint/Bytes.ts +62 -0
- package/src/primitives/Uint/Hex.ts +61 -0
- package/src/primitives/Uint/Number.ts +61 -0
- package/src/primitives/Uint/String.ts +57 -0
- package/src/primitives/Uint/Uint.test.ts +838 -0
- package/src/primitives/Uint/bitLength.ts +22 -0
- package/src/primitives/Uint/bitwiseAnd.ts +24 -0
- package/src/primitives/Uint/bitwiseNot.ts +23 -0
- package/src/primitives/Uint/bitwiseOr.ts +24 -0
- package/src/primitives/Uint/bitwiseXor.ts +24 -0
- package/src/primitives/Uint/clone.ts +22 -0
- package/src/primitives/Uint/equals.ts +24 -0
- package/src/primitives/Uint/gcd.ts +24 -0
- package/src/primitives/Uint/greaterThan.ts +24 -0
- package/src/primitives/Uint/greaterThanOrEqual.ts +24 -0
- package/src/primitives/Uint/index.ts +85 -0
- package/src/primitives/Uint/isPowerOf2.ts +23 -0
- package/src/primitives/Uint/isZero.ts +22 -0
- package/src/primitives/Uint/lcm.ts +24 -0
- package/src/primitives/Uint/leadingZeros.ts +24 -0
- package/src/primitives/Uint/lessThan.ts +24 -0
- package/src/primitives/Uint/lessThanOrEqual.ts +24 -0
- package/src/primitives/Uint/max.ts +24 -0
- package/src/primitives/Uint/maximum.ts +27 -0
- package/src/primitives/Uint/min.ts +24 -0
- package/src/primitives/Uint/minimum.ts +27 -0
- package/src/primitives/Uint/minus.ts +27 -0
- package/src/primitives/Uint/notEquals.ts +24 -0
- package/src/primitives/Uint/plus.ts +27 -0
- package/src/primitives/Uint/popCount.ts +24 -0
- package/src/primitives/Uint/product.ts +24 -0
- package/src/primitives/Uint/shiftLeft.ts +24 -0
- package/src/primitives/Uint/shiftRight.ts +24 -0
- package/src/primitives/Uint/sum.ts +24 -0
- package/src/primitives/Uint/times.ts +27 -0
- package/src/primitives/Uint/toAbiEncoded.ts +24 -0
- package/src/primitives/Uint/toBigInt.ts +25 -0
- package/src/primitives/Uint/toBytes.ts +25 -0
- package/src/primitives/Uint/toNumber.ts +28 -0
- package/src/primitives/Uint/toPower.ts +29 -0
- package/src/primitives/Uint/toString.ts +31 -0
- package/src/primitives/Uint128/BigInt.ts +54 -0
- package/src/primitives/Uint128/Bytes.ts +56 -0
- package/src/primitives/Uint128/Hex.ts +55 -0
- package/src/primitives/Uint128/Number.ts +59 -0
- package/src/primitives/Uint128/String.ts +55 -0
- package/src/primitives/Uint128/Uint128Schema.ts +119 -0
- package/src/primitives/Uint128/index.ts +71 -0
- package/src/primitives/Uint16/BigInt.ts +57 -0
- package/src/primitives/Uint16/Bytes.ts +55 -0
- package/src/primitives/Uint16/Hex.ts +55 -0
- package/src/primitives/Uint16/Number.ts +55 -0
- package/src/primitives/Uint16/String.ts +55 -0
- package/src/primitives/Uint16/Uint16.test.ts +313 -0
- package/src/primitives/Uint16/Uint16Schema.ts +117 -0
- package/src/primitives/Uint16/index.ts +70 -0
- package/src/primitives/Uint32/BigInt.ts +55 -0
- package/src/primitives/Uint32/Bytes.ts +55 -0
- package/src/primitives/Uint32/Hex.ts +55 -0
- package/src/primitives/Uint32/Number.ts +55 -0
- package/src/primitives/Uint32/String.ts +55 -0
- package/src/primitives/Uint32/Uint32Schema.ts +122 -0
- package/src/primitives/Uint32/index.ts +70 -0
- package/src/primitives/Uint64/BigInt.ts +55 -0
- package/src/primitives/Uint64/Bytes.ts +56 -0
- package/src/primitives/Uint64/Hex.ts +55 -0
- package/src/primitives/Uint64/Number.ts +59 -0
- package/src/primitives/Uint64/String.ts +55 -0
- package/src/primitives/Uint64/Uint64Schema.ts +122 -0
- package/src/primitives/Uint64/index.ts +71 -0
- package/src/primitives/Uint8/BigInt.ts +57 -0
- package/src/primitives/Uint8/Bytes.ts +55 -0
- package/src/primitives/Uint8/Hex.ts +55 -0
- package/src/primitives/Uint8/Number.ts +55 -0
- package/src/primitives/Uint8/String.ts +55 -0
- package/src/primitives/Uint8/Uint8.test.ts +324 -0
- package/src/primitives/Uint8/Uint8Schema.ts +117 -0
- package/src/primitives/Uint8/index.ts +70 -0
- package/src/primitives/Uncle/Rpc.ts +49 -0
- package/src/primitives/Uncle/index.ts +11 -0
- package/src/primitives/UserOperation/UserOperationSchema.ts +213 -0
- package/src/primitives/UserOperation/index.ts +81 -0
- package/src/primitives/ValidatorIndex/ValidatorIndexSchema.ts +44 -0
- package/src/primitives/ValidatorIndex/index.ts +20 -0
- package/src/primitives/Withdrawal/WithdrawalSchema.ts +47 -0
- package/src/primitives/Withdrawal/index.ts +20 -0
- package/src/primitives/WithdrawalIndex/WithdrawalIndexSchema.ts +47 -0
- package/src/primitives/WithdrawalIndex/index.ts +20 -0
- package/src/primitives/errors/index.ts +1 -0
- package/src/primitives/index.ts +143 -0
- package/src/primitives/validation/assertCommon.ts +40 -0
- package/src/primitives/validation/assertInRange.ts +60 -0
- package/src/primitives/validation/assertInt.ts +121 -0
- package/src/primitives/validation/assertSize.ts +68 -0
- package/src/primitives/validation/assertUint.ts +114 -0
- package/src/primitives/validation/index.ts +23 -0
- package/src/services/AbiEncoder/AbiEncoder.test.ts +190 -0
- package/src/services/AbiEncoder/AbiEncoderService.ts +141 -0
- package/src/services/AbiEncoder/DefaultAbiEncoder.ts +186 -0
- package/src/services/AbiEncoder/index.ts +14 -0
- package/src/services/Account/Account.test.ts +756 -0
- package/src/services/Account/AccountService.ts +453 -0
- package/src/services/Account/JsonRpcAccount.ts +347 -0
- package/src/services/Account/LocalAccount.ts +967 -0
- package/src/services/Account/fromMnemonic.test.ts +67 -0
- package/src/services/Account/fromMnemonic.ts +221 -0
- package/src/services/Account/index.ts +65 -0
- package/src/services/Account/toAccount.test.ts +139 -0
- package/src/services/Account/toAccount.ts +185 -0
- package/src/services/BlockStream/BlockStream.test.ts +1246 -0
- package/src/services/BlockStream/BlockStream.ts +125 -0
- package/src/services/BlockStream/BlockStreamError.ts +33 -0
- package/src/services/BlockStream/BlockStreamService.ts +105 -0
- package/src/services/BlockStream/index.ts +32 -0
- package/src/services/Cache/CacheService.ts +102 -0
- package/src/services/Cache/LookupCacheService.test.ts +305 -0
- package/src/services/Cache/LookupCacheService.ts +209 -0
- package/src/services/Cache/MemoryCache.test.ts +154 -0
- package/src/services/Cache/MemoryCache.ts +175 -0
- package/src/services/Cache/NoopCache.test.ts +159 -0
- package/src/services/Cache/NoopCache.ts +81 -0
- package/src/services/Cache/index.ts +176 -0
- package/src/services/Ccip/Ccip.test.ts +569 -0
- package/src/services/Ccip/CcipService.ts +106 -0
- package/src/services/Ccip/DefaultCcip.ts +189 -0
- package/src/services/Ccip/NoopCcip.ts +52 -0
- package/src/services/Ccip/index.ts +20 -0
- package/src/services/Chain/BlockExplorerService.ts +39 -0
- package/src/services/Chain/Chain.test.ts +296 -0
- package/src/services/Chain/ChainService.ts +97 -0
- package/src/services/Chain/ContractsService.ts +46 -0
- package/src/services/Chain/chains/arbitrum.ts +73 -0
- package/src/services/Chain/chains/base.ts +73 -0
- package/src/services/Chain/chains/index.ts +48 -0
- package/src/services/Chain/chains/mainnet.ts +77 -0
- package/src/services/Chain/chains/optimism.ts +73 -0
- package/src/services/Chain/chains/polygon.ts +73 -0
- package/src/services/Chain/chains/sepolia.ts +78 -0
- package/src/services/Chain/index.ts +77 -0
- package/src/services/Chain/rpcUrls.ts +31 -0
- package/src/services/Contract/Contract.test.ts +988 -0
- package/src/services/Contract/Contract.ts +432 -0
- package/src/services/Contract/ContractTypes.ts +412 -0
- package/src/services/Contract/estimateGas.test.ts +124 -0
- package/src/services/Contract/estimateGas.ts +163 -0
- package/src/services/Contract/index.ts +67 -0
- package/src/services/Debug/Debug.ts +121 -0
- package/src/services/Debug/DebugService.ts +89 -0
- package/src/services/Debug/index.ts +13 -0
- package/src/services/EngineApi/EngineApi.ts +95 -0
- package/src/services/EngineApi/EngineApiService.ts +99 -0
- package/src/services/EngineApi/index.ts +9 -0
- package/src/services/Ens/DefaultEns.ts +60 -0
- package/src/services/Ens/EnsService.ts +66 -0
- package/src/services/Ens/index.ts +61 -0
- package/src/services/FeeEstimator/DefaultFeeEstimator.ts +277 -0
- package/src/services/FeeEstimator/FeeEstimator.test.ts +810 -0
- package/src/services/FeeEstimator/FeeEstimatorService.ts +168 -0
- package/src/services/FeeEstimator/index.ts +57 -0
- package/src/services/Formatter/DefaultFormatter.ts +74 -0
- package/src/services/Formatter/Formatter.test.ts +92 -0
- package/src/services/Formatter/FormatterService.ts +137 -0
- package/src/services/Formatter/chains/arbitrum.ts +35 -0
- package/src/services/Formatter/chains/chains.test.ts +102 -0
- package/src/services/Formatter/chains/index.ts +13 -0
- package/src/services/Formatter/chains/optimism.ts +36 -0
- package/src/services/Formatter/chains/zksync.ts +35 -0
- package/src/services/Formatter/index.ts +22 -0
- package/src/services/Kzg/DefaultKzg.ts +111 -0
- package/src/services/Kzg/Kzg.test.ts +320 -0
- package/src/services/Kzg/KzgService.ts +123 -0
- package/src/services/Kzg/NoopKzg.ts +75 -0
- package/src/services/Kzg/index.ts +15 -0
- package/src/services/Multicall/BalanceResolver.ts +182 -0
- package/src/services/Multicall/GetBalance.ts +27 -0
- package/src/services/Multicall/Multicall.test.ts +384 -0
- package/src/services/Multicall/Multicall.ts +241 -0
- package/src/services/Multicall/index.ts +20 -0
- package/src/services/NonceManager/DefaultNonceManager.ts +154 -0
- package/src/services/NonceManager/NonceManager.test.ts +468 -0
- package/src/services/NonceManager/NonceManagerService.ts +191 -0
- package/src/services/NonceManager/index.ts +46 -0
- package/src/services/Provider/Account.ts +33 -0
- package/src/services/Provider/AccountService.ts +84 -0
- package/src/services/Provider/Blocks.ts +32 -0
- package/src/services/Provider/BlocksService.ts +73 -0
- package/src/services/Provider/Events.ts +33 -0
- package/src/services/Provider/EventsService.ts +71 -0
- package/src/services/Provider/Network.ts +41 -0
- package/src/services/Provider/NetworkService.ts +114 -0
- package/src/services/Provider/Provider.test.ts +1723 -0
- package/src/services/Provider/Provider.ts +1193 -0
- package/src/services/Provider/ProviderService.ts +1218 -0
- package/src/services/Provider/REFACTOR_PLAN.md +203 -0
- package/src/services/Provider/Simulation.ts +34 -0
- package/src/services/Provider/SimulationService.ts +161 -0
- package/src/services/Provider/Streaming.ts +30 -0
- package/src/services/Provider/StreamingService.ts +58 -0
- package/src/services/Provider/Transaction.ts +39 -0
- package/src/services/Provider/TransactionService.ts +83 -0
- package/src/services/Provider/actions/index.ts +26 -0
- package/src/services/Provider/actions/multicall.test.ts +716 -0
- package/src/services/Provider/actions/multicall.ts +304 -0
- package/src/services/Provider/actions/readContract.test.ts +808 -0
- package/src/services/Provider/actions/readContract.ts +311 -0
- package/src/services/Provider/actions/simulateContract.test.ts +454 -0
- package/src/services/Provider/actions/simulateContract.ts +189 -0
- package/src/services/Provider/ens/EnsError.ts +38 -0
- package/src/services/Provider/ens/constants.ts +81 -0
- package/src/services/Provider/ens/ens.test.ts +322 -0
- package/src/services/Provider/ens/getEnsAddress.ts +126 -0
- package/src/services/Provider/ens/getEnsAvatar.ts +51 -0
- package/src/services/Provider/ens/getEnsName.ts +124 -0
- package/src/services/Provider/ens/getEnsResolver.ts +82 -0
- package/src/services/Provider/ens/getEnsText.ts +158 -0
- package/src/services/Provider/ens/index.ts +49 -0
- package/src/services/Provider/ens/utils.ts +165 -0
- package/src/services/Provider/filters.ts +91 -0
- package/src/services/Provider/getBlobBaseFee.ts +170 -0
- package/src/services/Provider/index.ts +213 -0
- package/src/services/Provider/simulateCalls.test.ts +127 -0
- package/src/services/Provider/simulateCalls.ts +281 -0
- package/src/services/RateLimiter/DefaultRateLimiter.ts +226 -0
- package/src/services/RateLimiter/RateLimiter.test.ts +181 -0
- package/src/services/RateLimiter/RateLimiterService.ts +208 -0
- package/src/services/RateLimiter/index.ts +54 -0
- package/src/services/RawProvider/ForkProviderTransport.ts +100 -0
- package/src/services/RawProvider/HttpProviderTransport.test.ts +310 -0
- package/src/services/RawProvider/HttpProviderTransport.ts +76 -0
- package/src/services/RawProvider/InMemoryProviderTransport.test.ts +246 -0
- package/src/services/RawProvider/InMemoryProviderTransport.ts +81 -0
- package/src/services/RawProvider/RawProvider.test.ts +454 -0
- package/src/services/RawProvider/RawProviderService.ts +61 -0
- package/src/services/RawProvider/RawProviderTransport.ts +64 -0
- package/src/services/RawProvider/WebSocketProviderTransport.ts +106 -0
- package/src/services/RawProvider/index.ts +31 -0
- package/src/services/RpcBatch/RpcBatch.test.ts +628 -0
- package/src/services/RpcBatch/RpcRequest.ts +227 -0
- package/src/services/RpcBatch/RpcResolver.test.ts +315 -0
- package/src/services/RpcBatch/RpcResolver.ts +362 -0
- package/src/services/RpcBatch/index.ts +88 -0
- package/src/services/Signer/Signer.test.ts +1629 -0
- package/src/services/Signer/Signer.ts +812 -0
- package/src/services/Signer/SignerService.ts +518 -0
- package/src/services/Signer/actions/addChain.test.ts +178 -0
- package/src/services/Signer/actions/addChain.ts +80 -0
- package/src/services/Signer/actions/deployContract.test.ts +523 -0
- package/src/services/Signer/actions/deployContract.ts +165 -0
- package/src/services/Signer/actions/getAddresses.test.ts +118 -0
- package/src/services/Signer/actions/getAddresses.ts +60 -0
- package/src/services/Signer/actions/getPermissions.test.ts +122 -0
- package/src/services/Signer/actions/getPermissions.ts +54 -0
- package/src/services/Signer/actions/index.ts +49 -0
- package/src/services/Signer/actions/prepareAuthorization.test.ts +206 -0
- package/src/services/Signer/actions/prepareAuthorization.ts +92 -0
- package/src/services/Signer/actions/requestPermissions.test.ts +164 -0
- package/src/services/Signer/actions/requestPermissions.ts +66 -0
- package/src/services/Signer/actions/signAuthorization.test.ts +279 -0
- package/src/services/Signer/actions/signAuthorization.ts +127 -0
- package/src/services/Signer/actions/switchChain.test.ts +129 -0
- package/src/services/Signer/actions/switchChain.ts +56 -0
- package/src/services/Signer/actions/watchAsset.test.ts +175 -0
- package/src/services/Signer/actions/watchAsset.ts +110 -0
- package/src/services/Signer/actions/writeContract.test.ts +281 -0
- package/src/services/Signer/actions/writeContract.ts +109 -0
- package/src/services/Signer/index.ts +108 -0
- package/src/services/TransactionSerializer/DefaultTransactionSerializer.ts +110 -0
- package/src/services/TransactionSerializer/TransactionSerializer.test.ts +200 -0
- package/src/services/TransactionSerializer/TransactionSerializerService.ts +114 -0
- package/src/services/TransactionSerializer/index.ts +38 -0
- package/src/services/Transport/BatchScheduler.test.ts +209 -0
- package/src/services/Transport/BatchScheduler.ts +298 -0
- package/src/services/Transport/BrowserTransport.test.ts +354 -0
- package/src/services/Transport/BrowserTransport.ts +209 -0
- package/src/services/Transport/CustomTransport.test.ts +331 -0
- package/src/services/Transport/CustomTransport.ts +355 -0
- package/src/services/Transport/FallbackTransport.test.ts +492 -0
- package/src/services/Transport/FallbackTransport.ts +240 -0
- package/src/services/Transport/HttpTransport.ts +685 -0
- package/src/services/Transport/HttpTransportConfig.test.ts +153 -0
- package/src/services/Transport/HttpTransportConfig.ts +270 -0
- package/src/services/Transport/HttpTransportHooks.test.ts +176 -0
- package/src/services/Transport/IdGenerator.test.ts +117 -0
- package/src/services/Transport/IdGenerator.ts +82 -0
- package/src/services/Transport/IpcTransport.test.ts +222 -0
- package/src/services/Transport/IpcTransport.ts +732 -0
- package/src/services/Transport/RateLimitedTransport.test.ts +118 -0
- package/src/services/Transport/RateLimitedTransport.ts +124 -0
- package/src/services/Transport/RpcRequest.test.ts +266 -0
- package/src/services/Transport/RpcRequest.ts +312 -0
- package/src/services/Transport/RpcResolver.test.ts +280 -0
- package/src/services/Transport/RpcResolver.ts +184 -0
- package/src/services/Transport/TestTransport.ts +175 -0
- package/src/services/Transport/Transport.test.ts +1755 -0
- package/src/services/Transport/TransportConfig.test.ts +224 -0
- package/src/services/Transport/TransportConfig.ts +285 -0
- package/src/services/Transport/TransportError.test.ts +166 -0
- package/src/services/Transport/TransportError.ts +134 -0
- package/src/services/Transport/TransportFiberRef.test.ts +164 -0
- package/src/services/Transport/TransportInterceptor.test.ts +341 -0
- package/src/services/Transport/TransportInterceptor.ts +531 -0
- package/src/services/Transport/TransportService.ts +124 -0
- package/src/services/Transport/WebSocketTransport.test.ts +588 -0
- package/src/services/Transport/WebSocketTransport.ts +765 -0
- package/src/services/Transport/WebSocketTransportConfig.test.ts +185 -0
- package/src/services/Transport/WebSocketTransportConfig.ts +247 -0
- package/src/services/Transport/__testUtils__/mockIpcSocket.ts +106 -0
- package/src/services/Transport/__testUtils__/mockWebSocket.ts +138 -0
- package/src/services/Transport/config.ts +150 -0
- package/src/services/Transport/index.ts +161 -0
- package/src/services/errors.test.ts +570 -0
- package/src/services/index.ts +439 -0
- package/src/services/presets/index.ts +283 -0
- package/src/services/presets/presets.test.ts +88 -0
- package/src/standards/ERC1155.test.ts +324 -0
- package/src/standards/ERC1155.ts +328 -0
- package/src/standards/ERC165.test.ts +216 -0
- package/src/standards/ERC165.ts +87 -0
- package/src/standards/ERC20.test.ts +310 -0
- package/src/standards/ERC20.ts +275 -0
- package/src/standards/ERC721.test.ts +343 -0
- package/src/standards/ERC721.ts +319 -0
- package/src/standards/errors.test.ts +54 -0
- package/src/standards/errors.ts +7 -0
- package/src/standards/index.ts +5 -0
- package/src/stream/index.test.ts +216 -0
- package/src/stream/index.ts +37 -0
- package/src/transaction/TransactionStream.test.ts +887 -0
- package/src/transaction/TransactionStream.ts +142 -0
- package/src/transaction/TransactionStreamError.test.ts +133 -0
- package/src/transaction/TransactionStreamError.ts +35 -0
- package/src/transaction/TransactionStreamService.ts +121 -0
- package/src/transaction/index.ts +35 -0
- package/src/utils/Unit/Unit.test.ts +337 -0
- package/src/utils/Unit/errors.ts +16 -0
- package/src/utils/Unit/formatEther.ts +24 -0
- package/src/utils/Unit/formatGwei.ts +24 -0
- package/src/utils/Unit/formatUnits.ts +55 -0
- package/src/utils/Unit/index.ts +49 -0
- package/src/utils/Unit/parseEther.ts +24 -0
- package/src/utils/Unit/parseGwei.ts +24 -0
- package/src/utils/Unit/parseUnits.ts +68 -0
|
@@ -0,0 +1,1717 @@
|
|
|
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 { HexType } from '@tevm/voltaire/Hex';
|
|
6
|
+
import * as effect_Cause from 'effect/Cause';
|
|
7
|
+
import * as effect_Types from 'effect/Types';
|
|
8
|
+
import { AddressType } from '@tevm/voltaire/Address';
|
|
9
|
+
import { HashType } from '@tevm/voltaire/Hash';
|
|
10
|
+
import { BlockInclude, WatchOptions, BlockStreamEvent, BackfillOptions, BlocksEvent } from '@tevm/voltaire/block';
|
|
11
|
+
import * as Stream from 'effect/Stream';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* @fileoverview Keccak-256 service definition and layer implementations for Effect.
|
|
15
|
+
*
|
|
16
|
+
* @description
|
|
17
|
+
* Provides the KeccakService Effect Tag and both production (KeccakLive) and
|
|
18
|
+
* test (KeccakTest) layer implementations. The service pattern enables
|
|
19
|
+
* dependency injection for testability and flexibility.
|
|
20
|
+
*
|
|
21
|
+
* @module Keccak256/KeccakService
|
|
22
|
+
* @since 0.0.1
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Shape interface for the Keccak-256 hashing service.
|
|
27
|
+
*
|
|
28
|
+
* @description
|
|
29
|
+
* Defines the contract for Keccak-256 hash implementations.
|
|
30
|
+
* Used as the service shape for {@link KeccakService}.
|
|
31
|
+
*
|
|
32
|
+
* @since 0.0.1
|
|
33
|
+
*/
|
|
34
|
+
interface KeccakServiceShape {
|
|
35
|
+
/**
|
|
36
|
+
* Computes the Keccak-256 hash of input data.
|
|
37
|
+
*
|
|
38
|
+
* @param {Uint8Array} data - The input bytes to hash (any length)
|
|
39
|
+
* @returns {Effect.Effect<Keccak256Hash>} Effect containing the 32-byte hash
|
|
40
|
+
*/
|
|
41
|
+
readonly hash: (data: Uint8Array) => Effect.Effect<Keccak256Hash>;
|
|
42
|
+
}
|
|
43
|
+
declare const KeccakService_base: Context.TagClass<KeccakService, "KeccakService", KeccakServiceShape>;
|
|
44
|
+
/**
|
|
45
|
+
* Keccak-256 hashing service for Effect-based applications.
|
|
46
|
+
*
|
|
47
|
+
* @description
|
|
48
|
+
* An Effect Context.Tag that provides the standard Ethereum hashing algorithm
|
|
49
|
+
* used for addresses, signatures, state roots, and more. The service pattern
|
|
50
|
+
* enables swapping implementations for testing or alternative backends.
|
|
51
|
+
*
|
|
52
|
+
* The service exposes a single `hash` method that takes arbitrary bytes and
|
|
53
|
+
* produces a 32-byte Keccak-256 hash.
|
|
54
|
+
*
|
|
55
|
+
* @example Basic usage with Effect.gen
|
|
56
|
+
* ```typescript
|
|
57
|
+
* import { KeccakService, KeccakLive } from 'voltaire-effect/crypto/Keccak256'
|
|
58
|
+
* import * as Effect from 'effect/Effect'
|
|
59
|
+
*
|
|
60
|
+
* const program = Effect.gen(function* () {
|
|
61
|
+
* const keccak = yield* KeccakService
|
|
62
|
+
* return yield* keccak.hash(new Uint8Array([1, 2, 3]))
|
|
63
|
+
* }).pipe(Effect.provide(KeccakLive))
|
|
64
|
+
*
|
|
65
|
+
* const hash = await Effect.runPromise(program)
|
|
66
|
+
* ```
|
|
67
|
+
*
|
|
68
|
+
* @example Chaining multiple hashes
|
|
69
|
+
* ```typescript
|
|
70
|
+
* import { KeccakService, KeccakLive } from 'voltaire-effect/crypto/Keccak256'
|
|
71
|
+
* import * as Effect from 'effect/Effect'
|
|
72
|
+
*
|
|
73
|
+
* const doubleHash = Effect.gen(function* () {
|
|
74
|
+
* const keccak = yield* KeccakService
|
|
75
|
+
* const first = yield* keccak.hash(new Uint8Array([1, 2, 3]))
|
|
76
|
+
* return yield* keccak.hash(first)
|
|
77
|
+
* }).pipe(Effect.provide(KeccakLive))
|
|
78
|
+
* ```
|
|
79
|
+
*
|
|
80
|
+
* @example Composing with other services
|
|
81
|
+
* ```typescript
|
|
82
|
+
* import { KeccakService, KeccakLive } from 'voltaire-effect/crypto/Keccak256'
|
|
83
|
+
* import { Secp256k1Service, Secp256k1Live } from 'voltaire-effect/crypto/Secp256k1'
|
|
84
|
+
* import * as Effect from 'effect/Effect'
|
|
85
|
+
* import * as Layer from 'effect/Layer'
|
|
86
|
+
*
|
|
87
|
+
* const program = Effect.gen(function* () {
|
|
88
|
+
* const keccak = yield* KeccakService
|
|
89
|
+
* const secp = yield* Secp256k1Service
|
|
90
|
+
* const msgHash = yield* keccak.hash(message)
|
|
91
|
+
* return yield* secp.sign(msgHash, privateKey)
|
|
92
|
+
* }).pipe(Effect.provide(Layer.merge(KeccakLive, Secp256k1Live)))
|
|
93
|
+
* ```
|
|
94
|
+
*
|
|
95
|
+
* @see {@link KeccakLive} - Production implementation
|
|
96
|
+
* @see {@link KeccakTest} - Test implementation
|
|
97
|
+
* @see {@link hash} - Standalone hash function
|
|
98
|
+
* @since 0.0.1
|
|
99
|
+
*/
|
|
100
|
+
declare class KeccakService extends KeccakService_base {
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Production layer for KeccakService using native Keccak-256 implementation.
|
|
104
|
+
*
|
|
105
|
+
* @description
|
|
106
|
+
* Provides the real Keccak-256 hash implementation from the voltaire library.
|
|
107
|
+
* Use this layer in production applications for cryptographically secure hashing.
|
|
108
|
+
*
|
|
109
|
+
* The underlying implementation uses optimized native code (Zig/Rust) for
|
|
110
|
+
* high-performance hashing.
|
|
111
|
+
*
|
|
112
|
+
* @example Providing the live layer
|
|
113
|
+
* ```typescript
|
|
114
|
+
* import { KeccakService, KeccakLive } from 'voltaire-effect/crypto/Keccak256'
|
|
115
|
+
* import * as Effect from 'effect/Effect'
|
|
116
|
+
*
|
|
117
|
+
* const program = Effect.gen(function* () {
|
|
118
|
+
* const keccak = yield* KeccakService
|
|
119
|
+
* return yield* keccak.hash(new Uint8Array([0xde, 0xad, 0xbe, 0xef]))
|
|
120
|
+
* })
|
|
121
|
+
*
|
|
122
|
+
* const result = await Effect.runPromise(program.pipe(Effect.provide(KeccakLive)))
|
|
123
|
+
* ```
|
|
124
|
+
*
|
|
125
|
+
* @example Merging with other layers
|
|
126
|
+
* ```typescript
|
|
127
|
+
* import { KeccakLive } from 'voltaire-effect/crypto/Keccak256'
|
|
128
|
+
* import { SHA256Live } from 'voltaire-effect/crypto/SHA256'
|
|
129
|
+
* import * as Layer from 'effect/Layer'
|
|
130
|
+
*
|
|
131
|
+
* const CryptoLive = Layer.merge(KeccakLive, SHA256Live)
|
|
132
|
+
* ```
|
|
133
|
+
*
|
|
134
|
+
* @see {@link KeccakService} - The service tag
|
|
135
|
+
* @see {@link KeccakTest} - Test implementation for unit tests
|
|
136
|
+
* @since 0.0.1
|
|
137
|
+
*/
|
|
138
|
+
declare const KeccakLive: Layer.Layer<KeccakService, never, never>;
|
|
139
|
+
/**
|
|
140
|
+
* Test layer for KeccakService returning deterministic zero-filled hashes.
|
|
141
|
+
*
|
|
142
|
+
* @description
|
|
143
|
+
* Provides a mock Keccak-256 implementation that always returns a 32-byte
|
|
144
|
+
* array filled with zeros. Use for unit testing without cryptographic overhead
|
|
145
|
+
* when the actual hash value doesn't matter for the test.
|
|
146
|
+
*
|
|
147
|
+
* This layer is useful for:
|
|
148
|
+
* - Unit tests that need deterministic output
|
|
149
|
+
* - Performance tests that want to isolate non-crypto logic
|
|
150
|
+
* - Tests where the hash value is not validated
|
|
151
|
+
*
|
|
152
|
+
* @example Using in tests
|
|
153
|
+
* ```typescript
|
|
154
|
+
* import { KeccakService, KeccakTest } from 'voltaire-effect/crypto/Keccak256'
|
|
155
|
+
* import * as Effect from 'effect/Effect'
|
|
156
|
+
* import { describe, it, expect } from 'vitest'
|
|
157
|
+
*
|
|
158
|
+
* describe('MyService', () => {
|
|
159
|
+
* it('should hash data', async () => {
|
|
160
|
+
* const program = Effect.gen(function* () {
|
|
161
|
+
* const keccak = yield* KeccakService
|
|
162
|
+
* return yield* keccak.hash(new Uint8Array([1, 2, 3]))
|
|
163
|
+
* })
|
|
164
|
+
*
|
|
165
|
+
* const result = await Effect.runPromise(program.pipe(Effect.provide(KeccakTest)))
|
|
166
|
+
* expect(result).toEqual(new Uint8Array(32)) // All zeros
|
|
167
|
+
* })
|
|
168
|
+
* })
|
|
169
|
+
* ```
|
|
170
|
+
*
|
|
171
|
+
* @see {@link KeccakService} - The service tag
|
|
172
|
+
* @see {@link KeccakLive} - Production implementation
|
|
173
|
+
* @since 0.0.1
|
|
174
|
+
*/
|
|
175
|
+
declare const KeccakTest: Layer.Layer<KeccakService, never, never>;
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* @fileoverview Transport error class for JSON-RPC communication failures.
|
|
179
|
+
*
|
|
180
|
+
* @module TransportError
|
|
181
|
+
* @since 0.0.1
|
|
182
|
+
*
|
|
183
|
+
* @description
|
|
184
|
+
* Defines the error type used by all transport implementations when JSON-RPC
|
|
185
|
+
* communication fails. The error includes the JSON-RPC error code, message,
|
|
186
|
+
* and optional additional data for debugging.
|
|
187
|
+
*
|
|
188
|
+
* Common JSON-RPC error codes:
|
|
189
|
+
* - -32700: Parse error
|
|
190
|
+
* - -32600: Invalid request
|
|
191
|
+
* - -32601: Method not found
|
|
192
|
+
* - -32602: Invalid params
|
|
193
|
+
* - -32603: Internal error
|
|
194
|
+
* - -32000 to -32099: Server errors (implementation-defined)
|
|
195
|
+
*
|
|
196
|
+
* @see {@link TransportService} - The service that uses this error type
|
|
197
|
+
*/
|
|
198
|
+
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 & {
|
|
199
|
+
readonly _tag: "TransportError";
|
|
200
|
+
} & Readonly<A>;
|
|
201
|
+
/**
|
|
202
|
+
* Error thrown when a transport operation fails.
|
|
203
|
+
*
|
|
204
|
+
* @description
|
|
205
|
+
* Contains JSON-RPC error code and optional data for debugging.
|
|
206
|
+
* This error is thrown by all transport implementations (HttpTransport,
|
|
207
|
+
* WebSocketTransport, BrowserTransport) when a JSON-RPC request fails.
|
|
208
|
+
*
|
|
209
|
+
* The error includes:
|
|
210
|
+
* - `code`: Standard JSON-RPC error code
|
|
211
|
+
* - `message`: Human-readable error description
|
|
212
|
+
* - `data`: Optional additional error data from the provider
|
|
213
|
+
*
|
|
214
|
+
* @since 0.0.1
|
|
215
|
+
*
|
|
216
|
+
* @example Creating a transport error
|
|
217
|
+
* ```typescript
|
|
218
|
+
* const error = new TransportError({
|
|
219
|
+
* code: -32603,
|
|
220
|
+
* message: 'Internal error',
|
|
221
|
+
* data: { details: 'Connection refused' }
|
|
222
|
+
* })
|
|
223
|
+
*
|
|
224
|
+
* console.log(error.code) // -32603
|
|
225
|
+
* console.log(error.message) // 'Internal error'
|
|
226
|
+
* console.log(error.data) // { details: 'Connection refused' }
|
|
227
|
+
* ```
|
|
228
|
+
*
|
|
229
|
+
* @example Handling transport errors in Effect
|
|
230
|
+
* ```typescript
|
|
231
|
+
* import { Effect } from 'effect'
|
|
232
|
+
* import { TransportService, TransportError, HttpTransport } from 'voltaire-effect'
|
|
233
|
+
*
|
|
234
|
+
* const program = Effect.gen(function* () {
|
|
235
|
+
* const transport = yield* TransportService
|
|
236
|
+
* return yield* transport.request<string>('eth_blockNumber')
|
|
237
|
+
* }).pipe(
|
|
238
|
+
* Effect.catchTag('TransportError', (error) => {
|
|
239
|
+
* if (error.code === -32601) {
|
|
240
|
+
* console.log('Method not supported by this node')
|
|
241
|
+
* }
|
|
242
|
+
* return Effect.fail(error)
|
|
243
|
+
* }),
|
|
244
|
+
* Effect.provide(HttpTransport('https://mainnet.infura.io/v3/YOUR_KEY'))
|
|
245
|
+
* )
|
|
246
|
+
* ```
|
|
247
|
+
*
|
|
248
|
+
* @see {@link TransportService} - The service that produces this error
|
|
249
|
+
*/
|
|
250
|
+
declare class TransportError extends TransportError_base<{
|
|
251
|
+
/**
|
|
252
|
+
* The original input that caused the error.
|
|
253
|
+
*/
|
|
254
|
+
readonly input: {
|
|
255
|
+
code: number;
|
|
256
|
+
message: string;
|
|
257
|
+
data?: unknown;
|
|
258
|
+
};
|
|
259
|
+
/**
|
|
260
|
+
* JSON-RPC error code.
|
|
261
|
+
*/
|
|
262
|
+
readonly code: number;
|
|
263
|
+
/**
|
|
264
|
+
* Human-readable error message.
|
|
265
|
+
*/
|
|
266
|
+
readonly message: string;
|
|
267
|
+
/**
|
|
268
|
+
* Additional error data from the JSON-RPC response.
|
|
269
|
+
*
|
|
270
|
+
* @description
|
|
271
|
+
* May contain provider-specific error details such as revert reasons,
|
|
272
|
+
* stack traces, or other debugging information.
|
|
273
|
+
*/
|
|
274
|
+
readonly data?: unknown;
|
|
275
|
+
/**
|
|
276
|
+
* Optional underlying cause.
|
|
277
|
+
*/
|
|
278
|
+
readonly cause?: unknown;
|
|
279
|
+
/**
|
|
280
|
+
* Optional context for debugging.
|
|
281
|
+
*/
|
|
282
|
+
readonly context?: Record<string, unknown>;
|
|
283
|
+
}> {
|
|
284
|
+
/**
|
|
285
|
+
* Creates a new TransportError.
|
|
286
|
+
*
|
|
287
|
+
* @param input - JSON-RPC error response containing code, message, and optional data
|
|
288
|
+
* @param message - Optional override for the error message
|
|
289
|
+
* @param options - Optional error options
|
|
290
|
+
* @param options.cause - Underlying error that caused this failure
|
|
291
|
+
*/
|
|
292
|
+
constructor(input: {
|
|
293
|
+
code: number;
|
|
294
|
+
message: string;
|
|
295
|
+
data?: unknown;
|
|
296
|
+
}, message?: string, options?: {
|
|
297
|
+
cause?: unknown;
|
|
298
|
+
context?: Record<string, unknown>;
|
|
299
|
+
});
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
/**
|
|
303
|
+
* @fileoverview Blocks service definition for block-related JSON-RPC calls.
|
|
304
|
+
*
|
|
305
|
+
* @module BlocksService
|
|
306
|
+
* @since 0.3.0
|
|
307
|
+
*
|
|
308
|
+
* @description
|
|
309
|
+
* The BlocksService provides block and uncle lookup operations split out of
|
|
310
|
+
* ProviderService. This includes block numbers, block bodies, transaction counts,
|
|
311
|
+
* and uncle retrieval/counts.
|
|
312
|
+
*
|
|
313
|
+
* @see {@link ProviderService} - Combined convenience service
|
|
314
|
+
*/
|
|
315
|
+
|
|
316
|
+
/**
|
|
317
|
+
* Shape of the Blocks service.
|
|
318
|
+
*
|
|
319
|
+
* @since 0.3.0
|
|
320
|
+
*/
|
|
321
|
+
type BlocksShape = {
|
|
322
|
+
/** Gets the current block number */
|
|
323
|
+
readonly getBlockNumber: () => Effect.Effect<bigint, GetBlockNumberError>;
|
|
324
|
+
/** Gets a block by tag, hash, or number */
|
|
325
|
+
readonly getBlock: (args?: GetBlockArgs) => Effect.Effect<BlockType, GetBlockError>;
|
|
326
|
+
/** Gets the transaction count in a block */
|
|
327
|
+
readonly getBlockTransactionCount: (args: GetBlockTransactionCountArgs) => Effect.Effect<bigint, GetBlockTransactionCountError>;
|
|
328
|
+
/** Gets all receipts for a block (if supported by the node) */
|
|
329
|
+
readonly getBlockReceipts?: (args?: GetBlockReceiptsArgs) => Effect.Effect<ReceiptType[], GetBlockReceiptsError>;
|
|
330
|
+
/** Gets an uncle block by block identifier and index */
|
|
331
|
+
readonly getUncle: (args: GetUncleArgs, uncleIndex: `0x${string}`) => Effect.Effect<UncleBlockType, GetUncleError>;
|
|
332
|
+
/** Gets the number of uncles in a block (if supported by the node) */
|
|
333
|
+
readonly getUncleCount?: (args: GetUncleCountArgs) => Effect.Effect<bigint, GetUncleCountError>;
|
|
334
|
+
};
|
|
335
|
+
declare const BlocksService_base: Context.TagClass<BlocksService, "BlocksService", BlocksShape>;
|
|
336
|
+
/**
|
|
337
|
+
* Blocks service for block-related JSON-RPC operations.
|
|
338
|
+
*
|
|
339
|
+
* @since 0.3.0
|
|
340
|
+
*/
|
|
341
|
+
declare class BlocksService extends BlocksService_base {
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
/**
|
|
345
|
+
* @fileoverview Events service definition for log/filter JSON-RPC calls.
|
|
346
|
+
*
|
|
347
|
+
* @module EventsService
|
|
348
|
+
* @since 0.3.0
|
|
349
|
+
*/
|
|
350
|
+
|
|
351
|
+
/**
|
|
352
|
+
* Shape of the Events service.
|
|
353
|
+
*
|
|
354
|
+
* @since 0.3.0
|
|
355
|
+
*/
|
|
356
|
+
type EventsShape = {
|
|
357
|
+
/** Gets logs matching the filter */
|
|
358
|
+
readonly getLogs: (filter: LogFilter) => Effect.Effect<LogType[], GetLogsError>;
|
|
359
|
+
/** Creates an event filter (eth_newFilter) */
|
|
360
|
+
readonly createEventFilter: (filter?: EventFilter) => Effect.Effect<FilterId, CreateEventFilterError>;
|
|
361
|
+
/** Creates a new block filter (eth_newBlockFilter) */
|
|
362
|
+
readonly createBlockFilter: () => Effect.Effect<FilterId, CreateBlockFilterError>;
|
|
363
|
+
/** Creates a pending transaction filter (eth_newPendingTransactionFilter) */
|
|
364
|
+
readonly createPendingTransactionFilter: () => Effect.Effect<FilterId, CreatePendingTransactionFilterError>;
|
|
365
|
+
/** Gets changes since last poll for a filter (eth_getFilterChanges) */
|
|
366
|
+
readonly getFilterChanges: (filterId: FilterId) => Effect.Effect<FilterChanges, GetFilterChangesError>;
|
|
367
|
+
/** Gets all logs for a filter (eth_getFilterLogs) */
|
|
368
|
+
readonly getFilterLogs: (filterId: FilterId) => Effect.Effect<LogType[], GetFilterLogsError>;
|
|
369
|
+
/** Uninstalls a filter (eth_uninstallFilter) */
|
|
370
|
+
readonly uninstallFilter: (filterId: FilterId) => Effect.Effect<boolean, UninstallFilterError>;
|
|
371
|
+
};
|
|
372
|
+
declare const EventsService_base: Context.TagClass<EventsService, "EventsService", EventsShape>;
|
|
373
|
+
/**
|
|
374
|
+
* Events service for log and filter JSON-RPC operations.
|
|
375
|
+
*
|
|
376
|
+
* @since 0.3.0
|
|
377
|
+
*/
|
|
378
|
+
declare class EventsService extends EventsService_base {
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
/**
|
|
382
|
+
* @fileoverview Network service definition for network/meta JSON-RPC calls.
|
|
383
|
+
*
|
|
384
|
+
* @module NetworkService
|
|
385
|
+
* @since 0.3.0
|
|
386
|
+
*/
|
|
387
|
+
|
|
388
|
+
/**
|
|
389
|
+
* Syncing status as returned by eth_syncing.
|
|
390
|
+
*
|
|
391
|
+
* @since 0.3.0
|
|
392
|
+
*/
|
|
393
|
+
type SyncingStatus = false | {
|
|
394
|
+
startingBlock: string;
|
|
395
|
+
currentBlock: string;
|
|
396
|
+
highestBlock: string;
|
|
397
|
+
[key: string]: string;
|
|
398
|
+
};
|
|
399
|
+
/**
|
|
400
|
+
* Result tuple for eth_getWork.
|
|
401
|
+
*
|
|
402
|
+
* @since 0.3.0
|
|
403
|
+
*/
|
|
404
|
+
type WorkResult = [`0x${string}`, `0x${string}`, `0x${string}`];
|
|
405
|
+
/**
|
|
406
|
+
* Shape of the Network service.
|
|
407
|
+
*
|
|
408
|
+
* @since 0.3.0
|
|
409
|
+
*/
|
|
410
|
+
type NetworkShape = {
|
|
411
|
+
/** Gets the chain ID */
|
|
412
|
+
readonly getChainId: () => Effect.Effect<number, GetChainIdError>;
|
|
413
|
+
/** Gets the current gas price */
|
|
414
|
+
readonly getGasPrice: () => Effect.Effect<bigint, GetGasPriceError>;
|
|
415
|
+
/** Gets the max priority fee per gas (EIP-1559) */
|
|
416
|
+
readonly getMaxPriorityFeePerGas: () => Effect.Effect<bigint, GetMaxPriorityFeePerGasError>;
|
|
417
|
+
/** Gets fee history for gas estimation */
|
|
418
|
+
readonly getFeeHistory: (blockCount: number, newestBlock: BlockTag, rewardPercentiles: number[]) => Effect.Effect<FeeHistoryType, GetFeeHistoryError>;
|
|
419
|
+
/** Gets the blob base fee (EIP-4844) */
|
|
420
|
+
readonly getBlobBaseFee: () => Effect.Effect<bigint, GetBlobBaseFeeError>;
|
|
421
|
+
/** Gets syncing status (if supported) */
|
|
422
|
+
readonly getSyncing?: () => Effect.Effect<SyncingStatus, GetSyncingError>;
|
|
423
|
+
/** Gets available accounts (if supported) */
|
|
424
|
+
readonly getAccounts?: () => Effect.Effect<`0x${string}`[], GetAccountsError>;
|
|
425
|
+
/** Gets coinbase address (if supported) */
|
|
426
|
+
readonly getCoinbase?: () => Effect.Effect<`0x${string}`, GetCoinbaseError>;
|
|
427
|
+
/** Gets network version (net_version) */
|
|
428
|
+
readonly netVersion?: () => Effect.Effect<string, NetVersionError>;
|
|
429
|
+
/** Gets protocol version (eth_protocolVersion) */
|
|
430
|
+
readonly getProtocolVersion?: () => Effect.Effect<string, GetProtocolVersionError>;
|
|
431
|
+
/** Returns whether the client is mining (eth_mining) */
|
|
432
|
+
readonly getMining?: () => Effect.Effect<boolean, GetMiningError>;
|
|
433
|
+
/** Gets the current hashrate (eth_hashrate) */
|
|
434
|
+
readonly getHashrate?: () => Effect.Effect<bigint, GetHashrateError>;
|
|
435
|
+
/** Gets work package for mining (eth_getWork) */
|
|
436
|
+
readonly getWork?: () => Effect.Effect<WorkResult, GetWorkError>;
|
|
437
|
+
/** Submits a mining solution (eth_submitWork) */
|
|
438
|
+
readonly submitWork?: (nonce: `0x${string}`, powHash: `0x${string}`, mixDigest: `0x${string}`) => Effect.Effect<boolean, SubmitWorkError>;
|
|
439
|
+
/** Submits mining hashrate (eth_submitHashrate) */
|
|
440
|
+
readonly submitHashrate?: (hashrate: `0x${string}`, id: `0x${string}`) => Effect.Effect<boolean, SubmitHashrateError>;
|
|
441
|
+
};
|
|
442
|
+
declare const NetworkService_base: Context.TagClass<NetworkService, "NetworkService", NetworkShape>;
|
|
443
|
+
/**
|
|
444
|
+
* Network service for network/meta JSON-RPC operations.
|
|
445
|
+
*
|
|
446
|
+
* @since 0.3.0
|
|
447
|
+
*/
|
|
448
|
+
declare class NetworkService extends NetworkService_base {
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
/**
|
|
452
|
+
* @fileoverview Simulation service definition for call and simulation JSON-RPC methods.
|
|
453
|
+
*
|
|
454
|
+
* @module SimulationService
|
|
455
|
+
* @since 0.3.0
|
|
456
|
+
*/
|
|
457
|
+
|
|
458
|
+
/**
|
|
459
|
+
* Single block simulation input for eth_simulateV1.
|
|
460
|
+
*
|
|
461
|
+
* @since 0.3.0
|
|
462
|
+
*/
|
|
463
|
+
interface SimulateV1BlockCall {
|
|
464
|
+
/** Optional block overrides applied during the simulation */
|
|
465
|
+
readonly blockOverrides?: BlockOverrides;
|
|
466
|
+
/** Optional state overrides applied during the simulation */
|
|
467
|
+
readonly stateOverrides?: StateOverride;
|
|
468
|
+
/** Calls to execute within the block */
|
|
469
|
+
readonly calls: readonly CallRequest[];
|
|
470
|
+
}
|
|
471
|
+
/**
|
|
472
|
+
* Payload for eth_simulateV1.
|
|
473
|
+
*
|
|
474
|
+
* @since 0.3.0
|
|
475
|
+
*/
|
|
476
|
+
interface SimulateV1Payload {
|
|
477
|
+
/** Sequence of block simulations to execute */
|
|
478
|
+
readonly blockStateCalls: readonly SimulateV1BlockCall[];
|
|
479
|
+
/** Enable transfer tracing (if supported by node) */
|
|
480
|
+
readonly traceTransfers?: boolean;
|
|
481
|
+
/** Enable validation mode (if supported by node) */
|
|
482
|
+
readonly validation?: boolean;
|
|
483
|
+
/** Return full transaction objects (if supported) */
|
|
484
|
+
readonly returnFullTransactions?: boolean;
|
|
485
|
+
}
|
|
486
|
+
/**
|
|
487
|
+
* Call result from eth_simulateV1.
|
|
488
|
+
*
|
|
489
|
+
* @since 0.3.0
|
|
490
|
+
*/
|
|
491
|
+
interface SimulateV1CallResult {
|
|
492
|
+
/** Call execution status (0x1 success, 0x0 revert) */
|
|
493
|
+
readonly status: `0x${string}`;
|
|
494
|
+
/** Return data (hex) */
|
|
495
|
+
readonly returnData: `0x${string}`;
|
|
496
|
+
/** Gas used (hex) */
|
|
497
|
+
readonly gasUsed: `0x${string}`;
|
|
498
|
+
/** Logs emitted by the call */
|
|
499
|
+
readonly logs?: LogType[];
|
|
500
|
+
/** Optional error information */
|
|
501
|
+
readonly error?: {
|
|
502
|
+
code?: number;
|
|
503
|
+
message?: string;
|
|
504
|
+
};
|
|
505
|
+
}
|
|
506
|
+
/**
|
|
507
|
+
* Simulated block result from eth_simulateV1.
|
|
508
|
+
*
|
|
509
|
+
* @since 0.3.0
|
|
510
|
+
*/
|
|
511
|
+
interface SimulateV1BlockResult {
|
|
512
|
+
/** Base fee per gas (hex) */
|
|
513
|
+
readonly baseFeePerGas?: `0x${string}`;
|
|
514
|
+
/** Blob gas used (hex) */
|
|
515
|
+
readonly blobGasUsed?: `0x${string}`;
|
|
516
|
+
/** Calls executed in the block */
|
|
517
|
+
readonly calls: SimulateV1CallResult[];
|
|
518
|
+
/** Gas limit (hex) */
|
|
519
|
+
readonly gasLimit?: `0x${string}`;
|
|
520
|
+
/** Gas used (hex) */
|
|
521
|
+
readonly gasUsed?: `0x${string}`;
|
|
522
|
+
/** Simulated block hash */
|
|
523
|
+
readonly hash?: `0x${string}`;
|
|
524
|
+
/** Simulated block number (hex) */
|
|
525
|
+
readonly number?: `0x${string}`;
|
|
526
|
+
/** Simulated block timestamp (hex) */
|
|
527
|
+
readonly timestamp?: `0x${string}`;
|
|
528
|
+
}
|
|
529
|
+
/**
|
|
530
|
+
* Result type for eth_simulateV1.
|
|
531
|
+
*
|
|
532
|
+
* @since 0.3.0
|
|
533
|
+
*/
|
|
534
|
+
type SimulateV1Result = SimulateV1BlockResult[];
|
|
535
|
+
/**
|
|
536
|
+
* Payload for eth_simulateV2 (draft / evolving).
|
|
537
|
+
*
|
|
538
|
+
* @since 0.3.0
|
|
539
|
+
*/
|
|
540
|
+
type SimulateV2Payload = Record<string, unknown>;
|
|
541
|
+
/**
|
|
542
|
+
* Result type for eth_simulateV2 (draft / evolving).
|
|
543
|
+
*
|
|
544
|
+
* @since 0.3.0
|
|
545
|
+
*/
|
|
546
|
+
type SimulateV2Result = unknown;
|
|
547
|
+
/**
|
|
548
|
+
* Shape of the Simulation service.
|
|
549
|
+
*
|
|
550
|
+
* @since 0.3.0
|
|
551
|
+
*/
|
|
552
|
+
type SimulationShape = {
|
|
553
|
+
/** Executes a call without sending a transaction */
|
|
554
|
+
readonly call: (tx: CallRequest, blockTag?: BlockTag, stateOverride?: StateOverride, blockOverrides?: BlockOverrides) => Effect.Effect<HexType | `0x${string}`, CallError>;
|
|
555
|
+
/** Estimates gas for a transaction */
|
|
556
|
+
readonly estimateGas: (tx: CallRequest, blockTag?: BlockTag, stateOverride?: StateOverride) => Effect.Effect<bigint, EstimateGasError>;
|
|
557
|
+
/** Creates an access list for a transaction */
|
|
558
|
+
readonly createAccessList: (tx: CallRequest) => Effect.Effect<AccessListType, CreateAccessListError>;
|
|
559
|
+
/** Simulates multiple blocks and calls (if supported) */
|
|
560
|
+
readonly simulateV1?: (payload: SimulateV1Payload, blockTag?: BlockTag) => Effect.Effect<SimulateV1Result, SimulateV1Error>;
|
|
561
|
+
/** Simulates with the V2 API (draft / evolving, if supported) */
|
|
562
|
+
readonly simulateV2?: <TResult = SimulateV2Result>(payload: SimulateV2Payload, blockTag?: BlockTag) => Effect.Effect<TResult, SimulateV2Error>;
|
|
563
|
+
};
|
|
564
|
+
declare const SimulationService_base: Context.TagClass<SimulationService, "SimulationService", SimulationShape>;
|
|
565
|
+
/**
|
|
566
|
+
* Simulation service for call/simulation JSON-RPC operations.
|
|
567
|
+
*
|
|
568
|
+
* @since 0.3.0
|
|
569
|
+
*/
|
|
570
|
+
declare class SimulationService extends SimulationService_base {
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
/**
|
|
574
|
+
* @fileoverview Streaming service definition for streaming JSON-RPC calls.
|
|
575
|
+
*
|
|
576
|
+
* @module StreamingService
|
|
577
|
+
* @since 0.3.0
|
|
578
|
+
*/
|
|
579
|
+
|
|
580
|
+
/**
|
|
581
|
+
* Shape of the Streaming service.
|
|
582
|
+
*
|
|
583
|
+
* @since 0.3.0
|
|
584
|
+
*/
|
|
585
|
+
type StreamingShape = {
|
|
586
|
+
/** Watch for new blocks with reorg detection */
|
|
587
|
+
readonly watchBlocks: <TInclude extends BlockInclude = "header">(options?: WatchOptions<TInclude>) => Stream.Stream<BlockStreamEvent<TInclude>, WatchBlocksError>;
|
|
588
|
+
/** Backfill historical blocks */
|
|
589
|
+
readonly backfillBlocks: <TInclude extends BlockInclude = "header">(options: BackfillOptions<TInclude>) => Stream.Stream<BlocksEvent<TInclude>, BackfillBlocksError>;
|
|
590
|
+
/** Subscribes to JSON-RPC streams (eth_subscribe) */
|
|
591
|
+
readonly subscribe?: (subscription: string, params?: readonly unknown[]) => Effect.Effect<`0x${string}`, SubscribeError>;
|
|
592
|
+
/** Unsubscribes from JSON-RPC streams (eth_unsubscribe) */
|
|
593
|
+
readonly unsubscribe?: (subscriptionId: `0x${string}`) => Effect.Effect<boolean, UnsubscribeError>;
|
|
594
|
+
};
|
|
595
|
+
declare const StreamingService_base: Context.TagClass<StreamingService, "StreamingService", StreamingShape>;
|
|
596
|
+
/**
|
|
597
|
+
* Streaming service for block streams and subscriptions.
|
|
598
|
+
*
|
|
599
|
+
* @since 0.3.0
|
|
600
|
+
*/
|
|
601
|
+
declare class StreamingService extends StreamingService_base {
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
/**
|
|
605
|
+
* @fileoverview Transaction service definition for transaction-related JSON-RPC calls.
|
|
606
|
+
*
|
|
607
|
+
* @module TransactionService
|
|
608
|
+
* @since 0.3.0
|
|
609
|
+
*/
|
|
610
|
+
|
|
611
|
+
/**
|
|
612
|
+
* Shape of the Transaction service.
|
|
613
|
+
*
|
|
614
|
+
* @since 0.3.0
|
|
615
|
+
*/
|
|
616
|
+
type TransactionShape = {
|
|
617
|
+
/** Gets a transaction by hash */
|
|
618
|
+
readonly getTransaction: (hash: HashInput) => Effect.Effect<TransactionType, GetTransactionError>;
|
|
619
|
+
/** Gets a transaction receipt */
|
|
620
|
+
readonly getTransactionReceipt: (hash: HashInput) => Effect.Effect<ReceiptType, GetTransactionReceiptError>;
|
|
621
|
+
/** Gets a transaction by block hash and index (if supported) */
|
|
622
|
+
readonly getTransactionByBlockHashAndIndex?: (blockHash: HashInput, index: TransactionIndexInput) => Effect.Effect<TransactionType, GetTransactionByBlockHashAndIndexError>;
|
|
623
|
+
/** Gets a transaction by block number/tag and index (if supported) */
|
|
624
|
+
readonly getTransactionByBlockNumberAndIndex?: (blockTag: BlockTag | bigint, index: TransactionIndexInput) => Effect.Effect<TransactionType, GetTransactionByBlockNumberAndIndexError>;
|
|
625
|
+
/** Sends a signed raw transaction */
|
|
626
|
+
readonly sendRawTransaction: (signedTx: HexType | `0x${string}`) => Effect.Effect<`0x${string}`, SendRawTransactionError>;
|
|
627
|
+
/** Sends a transaction via unlocked JSON-RPC account (if supported) */
|
|
628
|
+
readonly sendTransaction?: (tx: RpcTransactionRequest) => Effect.Effect<`0x${string}`, SendTransactionError>;
|
|
629
|
+
/** Waits for a transaction to be confirmed */
|
|
630
|
+
readonly waitForTransactionReceipt: (hash: HashInput, opts?: {
|
|
631
|
+
confirmations?: number;
|
|
632
|
+
timeout?: number;
|
|
633
|
+
pollingInterval?: number;
|
|
634
|
+
}) => Effect.Effect<ReceiptType, WaitForTransactionReceiptError>;
|
|
635
|
+
/** Gets the number of confirmations for a transaction */
|
|
636
|
+
readonly getTransactionConfirmations: (hash: HashInput) => Effect.Effect<bigint, GetTransactionConfirmationsError>;
|
|
637
|
+
};
|
|
638
|
+
declare const TransactionService_base: Context.TagClass<TransactionService, "TransactionService", TransactionShape>;
|
|
639
|
+
/**
|
|
640
|
+
* Transaction service for transaction-related JSON-RPC operations.
|
|
641
|
+
*
|
|
642
|
+
* @since 0.3.0
|
|
643
|
+
*/
|
|
644
|
+
declare class TransactionService extends TransactionService_base {
|
|
645
|
+
}
|
|
646
|
+
|
|
647
|
+
/**
|
|
648
|
+
* Address input type that accepts both branded AddressType and plain hex strings.
|
|
649
|
+
* Provides flexibility for API consumers while maintaining type safety.
|
|
650
|
+
*/
|
|
651
|
+
type AddressInput = AddressType | `0x${string}`;
|
|
652
|
+
/**
|
|
653
|
+
* Hash input type that accepts both branded HashType and plain hex strings.
|
|
654
|
+
*/
|
|
655
|
+
type HashInput = HashType | `0x${string}`;
|
|
656
|
+
/**
|
|
657
|
+
* Transaction index input type for block transaction lookups.
|
|
658
|
+
*/
|
|
659
|
+
type TransactionIndexInput = number | bigint | `0x${string}`;
|
|
660
|
+
/**
|
|
661
|
+
* Filter identifier returned by eth_newFilter methods.
|
|
662
|
+
*
|
|
663
|
+
* @since 0.0.1
|
|
664
|
+
*/
|
|
665
|
+
type FilterId = `0x${string}`;
|
|
666
|
+
declare const ProviderResponseError_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 & {
|
|
667
|
+
readonly _tag: "ProviderResponseError";
|
|
668
|
+
} & Readonly<A>;
|
|
669
|
+
/**
|
|
670
|
+
* Error thrown when the provider returns an invalid or unexpected response.
|
|
671
|
+
*
|
|
672
|
+
* @since 0.0.1
|
|
673
|
+
*/
|
|
674
|
+
declare class ProviderResponseError extends ProviderResponseError_base<{
|
|
675
|
+
readonly input: unknown;
|
|
676
|
+
readonly message: string;
|
|
677
|
+
readonly cause?: unknown;
|
|
678
|
+
readonly context?: Record<string, unknown>;
|
|
679
|
+
}> {
|
|
680
|
+
constructor(input: unknown, message?: string, options?: {
|
|
681
|
+
cause?: unknown;
|
|
682
|
+
context?: Record<string, unknown>;
|
|
683
|
+
});
|
|
684
|
+
}
|
|
685
|
+
declare const ProviderNotFoundError_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 & {
|
|
686
|
+
readonly _tag: "ProviderNotFoundError";
|
|
687
|
+
} & Readonly<A>;
|
|
688
|
+
/**
|
|
689
|
+
* Error thrown when a requested resource is missing (block, tx, receipt, etc.).
|
|
690
|
+
*
|
|
691
|
+
* @since 0.0.1
|
|
692
|
+
*/
|
|
693
|
+
declare class ProviderNotFoundError extends ProviderNotFoundError_base<{
|
|
694
|
+
readonly input: unknown;
|
|
695
|
+
readonly message: string;
|
|
696
|
+
readonly resource?: string;
|
|
697
|
+
readonly cause?: unknown;
|
|
698
|
+
readonly context?: Record<string, unknown>;
|
|
699
|
+
}> {
|
|
700
|
+
constructor(input: unknown, message?: string, options?: {
|
|
701
|
+
resource?: string;
|
|
702
|
+
cause?: unknown;
|
|
703
|
+
context?: Record<string, unknown>;
|
|
704
|
+
});
|
|
705
|
+
}
|
|
706
|
+
declare const ProviderValidationError_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 & {
|
|
707
|
+
readonly _tag: "ProviderValidationError";
|
|
708
|
+
} & Readonly<A>;
|
|
709
|
+
/**
|
|
710
|
+
* Error thrown when inputs fail validation before an RPC call is made.
|
|
711
|
+
*
|
|
712
|
+
* @since 0.0.1
|
|
713
|
+
*/
|
|
714
|
+
declare class ProviderValidationError extends ProviderValidationError_base<{
|
|
715
|
+
readonly input: unknown;
|
|
716
|
+
readonly message: string;
|
|
717
|
+
readonly cause?: unknown;
|
|
718
|
+
readonly context?: Record<string, unknown>;
|
|
719
|
+
}> {
|
|
720
|
+
constructor(input: unknown, message?: string, options?: {
|
|
721
|
+
cause?: unknown;
|
|
722
|
+
context?: Record<string, unknown>;
|
|
723
|
+
});
|
|
724
|
+
}
|
|
725
|
+
declare const ProviderTimeoutError_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 & {
|
|
726
|
+
readonly _tag: "ProviderTimeoutError";
|
|
727
|
+
} & Readonly<A>;
|
|
728
|
+
/**
|
|
729
|
+
* Error thrown when waiting for a result exceeds a timeout.
|
|
730
|
+
*
|
|
731
|
+
* @since 0.0.1
|
|
732
|
+
*/
|
|
733
|
+
declare class ProviderTimeoutError extends ProviderTimeoutError_base<{
|
|
734
|
+
readonly input: unknown;
|
|
735
|
+
readonly message: string;
|
|
736
|
+
readonly timeoutMs?: number;
|
|
737
|
+
readonly cause?: unknown;
|
|
738
|
+
readonly context?: Record<string, unknown>;
|
|
739
|
+
}> {
|
|
740
|
+
constructor(input: unknown, message?: string, options?: {
|
|
741
|
+
timeoutMs?: number;
|
|
742
|
+
cause?: unknown;
|
|
743
|
+
context?: Record<string, unknown>;
|
|
744
|
+
});
|
|
745
|
+
}
|
|
746
|
+
declare const ProviderStreamError_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 & {
|
|
747
|
+
readonly _tag: "ProviderStreamError";
|
|
748
|
+
} & Readonly<A>;
|
|
749
|
+
/**
|
|
750
|
+
* Error thrown by provider streams (watch/backfill).
|
|
751
|
+
*
|
|
752
|
+
* @since 0.0.1
|
|
753
|
+
*/
|
|
754
|
+
declare class ProviderStreamError extends ProviderStreamError_base<{
|
|
755
|
+
readonly input: unknown;
|
|
756
|
+
readonly message: string;
|
|
757
|
+
readonly cause?: unknown;
|
|
758
|
+
readonly context?: Record<string, unknown>;
|
|
759
|
+
}> {
|
|
760
|
+
constructor(input: unknown, message?: string, options?: {
|
|
761
|
+
cause?: unknown;
|
|
762
|
+
context?: Record<string, unknown>;
|
|
763
|
+
});
|
|
764
|
+
}
|
|
765
|
+
declare const ProviderReceiptPendingError_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 & {
|
|
766
|
+
readonly _tag: "ProviderReceiptPendingError";
|
|
767
|
+
} & Readonly<A>;
|
|
768
|
+
/**
|
|
769
|
+
* Error used internally while waiting for a transaction receipt.
|
|
770
|
+
*
|
|
771
|
+
* @since 0.0.1
|
|
772
|
+
*/
|
|
773
|
+
declare class ProviderReceiptPendingError extends ProviderReceiptPendingError_base<{
|
|
774
|
+
readonly input: unknown;
|
|
775
|
+
readonly message: string;
|
|
776
|
+
readonly cause?: unknown;
|
|
777
|
+
readonly context?: Record<string, unknown>;
|
|
778
|
+
}> {
|
|
779
|
+
constructor(input: unknown, message?: string, options?: {
|
|
780
|
+
cause?: unknown;
|
|
781
|
+
context?: Record<string, unknown>;
|
|
782
|
+
});
|
|
783
|
+
}
|
|
784
|
+
declare const ProviderConfirmationsPendingError_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 & {
|
|
785
|
+
readonly _tag: "ProviderConfirmationsPendingError";
|
|
786
|
+
} & Readonly<A>;
|
|
787
|
+
/**
|
|
788
|
+
* Error used internally while waiting for confirmation depth.
|
|
789
|
+
*
|
|
790
|
+
* @since 0.0.1
|
|
791
|
+
*/
|
|
792
|
+
declare class ProviderConfirmationsPendingError extends ProviderConfirmationsPendingError_base<{
|
|
793
|
+
readonly input: unknown;
|
|
794
|
+
readonly message: string;
|
|
795
|
+
readonly cause?: unknown;
|
|
796
|
+
readonly context?: Record<string, unknown>;
|
|
797
|
+
}> {
|
|
798
|
+
constructor(input: unknown, message?: string, options?: {
|
|
799
|
+
cause?: unknown;
|
|
800
|
+
context?: Record<string, unknown>;
|
|
801
|
+
});
|
|
802
|
+
}
|
|
803
|
+
/**
|
|
804
|
+
* Union of all provider-specific errors (excludes TransportError).
|
|
805
|
+
*
|
|
806
|
+
* @since 0.0.1
|
|
807
|
+
*/
|
|
808
|
+
type ProviderError = ProviderResponseError | ProviderNotFoundError | ProviderValidationError | ProviderTimeoutError | ProviderStreamError | ProviderReceiptPendingError | ProviderConfirmationsPendingError;
|
|
809
|
+
/**
|
|
810
|
+
* Error unions for ProviderService methods.
|
|
811
|
+
*
|
|
812
|
+
* @since 0.0.1
|
|
813
|
+
*/
|
|
814
|
+
type GetBlockNumberError = TransportError | ProviderResponseError;
|
|
815
|
+
type GetBlockError = TransportError | ProviderNotFoundError;
|
|
816
|
+
type GetBlockTransactionCountError = TransportError | ProviderResponseError;
|
|
817
|
+
type GetBalanceError = TransportError | ProviderResponseError;
|
|
818
|
+
type GetTransactionCountError = TransportError | ProviderResponseError;
|
|
819
|
+
type GetCodeError = TransportError;
|
|
820
|
+
type GetStorageAtError = TransportError;
|
|
821
|
+
type GetTransactionError = TransportError | ProviderNotFoundError;
|
|
822
|
+
type GetTransactionReceiptError = TransportError | ProviderNotFoundError;
|
|
823
|
+
type WaitForTransactionReceiptError = TransportError | ProviderValidationError | ProviderTimeoutError | ProviderResponseError | ProviderReceiptPendingError | ProviderConfirmationsPendingError;
|
|
824
|
+
type CallError = TransportError;
|
|
825
|
+
type EstimateGasError = TransportError | ProviderResponseError;
|
|
826
|
+
type CreateAccessListError = TransportError;
|
|
827
|
+
type GetLogsError = TransportError;
|
|
828
|
+
type CreateEventFilterError = TransportError;
|
|
829
|
+
type CreateBlockFilterError = TransportError;
|
|
830
|
+
type CreatePendingTransactionFilterError = TransportError;
|
|
831
|
+
type GetFilterChangesError = TransportError;
|
|
832
|
+
type GetFilterLogsError = TransportError;
|
|
833
|
+
type UninstallFilterError = TransportError;
|
|
834
|
+
type GetChainIdError = TransportError | ProviderResponseError | ProviderValidationError;
|
|
835
|
+
type GetGasPriceError = TransportError | ProviderResponseError;
|
|
836
|
+
type GetMaxPriorityFeePerGasError = TransportError | ProviderResponseError;
|
|
837
|
+
type GetFeeHistoryError = TransportError | ProviderValidationError;
|
|
838
|
+
type WatchBlocksError = TransportError | ProviderStreamError;
|
|
839
|
+
type BackfillBlocksError = TransportError | ProviderStreamError;
|
|
840
|
+
type SendRawTransactionError = TransportError;
|
|
841
|
+
type GetUncleError = TransportError | ProviderNotFoundError;
|
|
842
|
+
type GetProofError = TransportError;
|
|
843
|
+
type GetBlobBaseFeeError = TransportError | ProviderResponseError | ProviderNotFoundError;
|
|
844
|
+
type GetTransactionConfirmationsError = TransportError | ProviderResponseError;
|
|
845
|
+
type GetBlockReceiptsError = TransportError | ProviderNotFoundError;
|
|
846
|
+
type GetUncleCountError = TransportError | ProviderResponseError;
|
|
847
|
+
type GetTransactionByBlockHashAndIndexError = TransportError | ProviderNotFoundError;
|
|
848
|
+
type GetTransactionByBlockNumberAndIndexError = TransportError | ProviderNotFoundError;
|
|
849
|
+
type SendTransactionError = TransportError;
|
|
850
|
+
type SignError = TransportError;
|
|
851
|
+
type SignTransactionError = TransportError;
|
|
852
|
+
type SimulateV1Error = TransportError;
|
|
853
|
+
type SimulateV2Error = TransportError;
|
|
854
|
+
type GetSyncingError = TransportError;
|
|
855
|
+
type GetAccountsError = TransportError;
|
|
856
|
+
type GetCoinbaseError = TransportError;
|
|
857
|
+
type NetVersionError = TransportError;
|
|
858
|
+
type SubscribeError = TransportError;
|
|
859
|
+
type UnsubscribeError = TransportError;
|
|
860
|
+
type GetProtocolVersionError = TransportError;
|
|
861
|
+
type GetMiningError = TransportError;
|
|
862
|
+
type GetHashrateError = TransportError | ProviderResponseError;
|
|
863
|
+
type GetWorkError = TransportError;
|
|
864
|
+
type SubmitWorkError = TransportError;
|
|
865
|
+
type SubmitHashrateError = TransportError;
|
|
866
|
+
/**
|
|
867
|
+
* Block identifier for Ethereum RPC calls.
|
|
868
|
+
*
|
|
869
|
+
* @description
|
|
870
|
+
* Used to specify which block to query for operations like getBalance, getCode, etc.
|
|
871
|
+
* Can be a named tag for special blocks or a hex-encoded block number.
|
|
872
|
+
*
|
|
873
|
+
* Named tags:
|
|
874
|
+
* - `"latest"` - Most recent mined block
|
|
875
|
+
* - `"earliest"` - Genesis block
|
|
876
|
+
* - `"pending"` - Pending block (transactions in mempool)
|
|
877
|
+
* - `"safe"` - Latest safe head block (2/3 attestations)
|
|
878
|
+
* - `"finalized"` - Latest finalized block (cannot be reverted)
|
|
879
|
+
*
|
|
880
|
+
* @since 0.0.1
|
|
881
|
+
*
|
|
882
|
+
* @example
|
|
883
|
+
* ```typescript
|
|
884
|
+
* // Using named tags
|
|
885
|
+
* const balance1 = yield* provider.getBalance(address, 'latest')
|
|
886
|
+
* const balance2 = yield* provider.getBalance(address, 'finalized')
|
|
887
|
+
*
|
|
888
|
+
* // Using hex block number
|
|
889
|
+
* const balance3 = yield* provider.getBalance(address, '0x1234')
|
|
890
|
+
* ```
|
|
891
|
+
*/
|
|
892
|
+
type BlockTag = "latest" | "earliest" | "pending" | "safe" | "finalized" | `0x${string}`;
|
|
893
|
+
/**
|
|
894
|
+
* State override for a single account.
|
|
895
|
+
*
|
|
896
|
+
* @description
|
|
897
|
+
* Allows modifying account state before executing eth_call or eth_estimateGas.
|
|
898
|
+
* Useful for simulating transactions with modified balances, code, or storage.
|
|
899
|
+
*
|
|
900
|
+
* @since 0.0.1
|
|
901
|
+
*
|
|
902
|
+
* @example
|
|
903
|
+
* ```typescript
|
|
904
|
+
* const override: AccountStateOverride = {
|
|
905
|
+
* balance: 1000000000000000000n, // Override balance to 1 ETH
|
|
906
|
+
* nonce: 5n, // Override nonce
|
|
907
|
+
* code: '0x6080604052...', // Replace contract code
|
|
908
|
+
* state: { // Replace entire storage
|
|
909
|
+
* '0x0000...0000': '0x0000...0001'
|
|
910
|
+
* },
|
|
911
|
+
* stateDiff: { // Merge with existing storage
|
|
912
|
+
* '0x0000...0001': '0x0000...0064'
|
|
913
|
+
* }
|
|
914
|
+
* }
|
|
915
|
+
* ```
|
|
916
|
+
*/
|
|
917
|
+
interface AccountStateOverride {
|
|
918
|
+
/** Override balance in wei */
|
|
919
|
+
readonly balance?: bigint;
|
|
920
|
+
/** Override nonce */
|
|
921
|
+
readonly nonce?: bigint;
|
|
922
|
+
/** Override contract bytecode */
|
|
923
|
+
readonly code?: HexType | `0x${string}`;
|
|
924
|
+
/** Replace entire storage with this mapping (slot -> value) */
|
|
925
|
+
readonly state?: Record<`0x${string}`, `0x${string}`>;
|
|
926
|
+
/** Merge these slots with existing storage (slot -> value) */
|
|
927
|
+
readonly stateDiff?: Record<`0x${string}`, `0x${string}`>;
|
|
928
|
+
}
|
|
929
|
+
/**
|
|
930
|
+
* State override set mapping addresses to account overrides.
|
|
931
|
+
*
|
|
932
|
+
* @description
|
|
933
|
+
* Maps account addresses to their state overrides. Each address can have
|
|
934
|
+
* its balance, nonce, code, and storage modified for the duration of the call.
|
|
935
|
+
*
|
|
936
|
+
* @since 0.0.1
|
|
937
|
+
*
|
|
938
|
+
* @example
|
|
939
|
+
* ```typescript
|
|
940
|
+
* const stateOverride: StateOverride = {
|
|
941
|
+
* '0x1234...': { balance: 1000000000000000000n },
|
|
942
|
+
* '0x5678...': { code: '0x6080604052...' }
|
|
943
|
+
* }
|
|
944
|
+
* ```
|
|
945
|
+
*/
|
|
946
|
+
type StateOverride = Record<`0x${string}`, AccountStateOverride>;
|
|
947
|
+
/**
|
|
948
|
+
* Block overrides for call simulation.
|
|
949
|
+
*
|
|
950
|
+
* @description
|
|
951
|
+
* Allows overriding block context during eth_call execution.
|
|
952
|
+
* Useful for simulating calls at different block conditions.
|
|
953
|
+
*
|
|
954
|
+
* @since 0.0.1
|
|
955
|
+
*/
|
|
956
|
+
interface BlockOverrides {
|
|
957
|
+
/** Override block number */
|
|
958
|
+
readonly number?: bigint;
|
|
959
|
+
/** Override block difficulty */
|
|
960
|
+
readonly difficulty?: bigint;
|
|
961
|
+
/** Override block time (unix timestamp) */
|
|
962
|
+
readonly time?: bigint;
|
|
963
|
+
/** Override gas limit */
|
|
964
|
+
readonly gasLimit?: bigint;
|
|
965
|
+
/** Override coinbase/miner address */
|
|
966
|
+
readonly coinbase?: AddressInput;
|
|
967
|
+
/** Override random/prevrandao */
|
|
968
|
+
readonly random?: HashInput;
|
|
969
|
+
/** Override base fee */
|
|
970
|
+
readonly baseFee?: bigint;
|
|
971
|
+
}
|
|
972
|
+
/**
|
|
973
|
+
* Request parameters for eth_call and eth_estimateGas.
|
|
974
|
+
*
|
|
975
|
+
* @description
|
|
976
|
+
* Defines the parameters for simulating a transaction call without
|
|
977
|
+
* actually sending it to the network. Used for reading contract state
|
|
978
|
+
* and estimating gas costs.
|
|
979
|
+
*
|
|
980
|
+
* @since 0.0.1
|
|
981
|
+
*
|
|
982
|
+
* @example
|
|
983
|
+
* ```typescript
|
|
984
|
+
* const callRequest: CallRequest = {
|
|
985
|
+
* to: '0x1234...', // Contract address
|
|
986
|
+
* from: '0x5678...', // Sender address (optional)
|
|
987
|
+
* data: '0x...', // Encoded function call
|
|
988
|
+
* value: 0n, // ETH to send (optional)
|
|
989
|
+
* gas: 100000n // Gas limit (optional)
|
|
990
|
+
* }
|
|
991
|
+
* ```
|
|
992
|
+
*/
|
|
993
|
+
interface CallRequest {
|
|
994
|
+
/** Target contract address to call */
|
|
995
|
+
readonly to?: AddressInput;
|
|
996
|
+
/** Sender address (affects msg.sender in call) */
|
|
997
|
+
readonly from?: AddressInput;
|
|
998
|
+
/** ABI-encoded function call data */
|
|
999
|
+
readonly data?: HexType | `0x${string}`;
|
|
1000
|
+
/** Value in wei to send with the call */
|
|
1001
|
+
readonly value?: bigint;
|
|
1002
|
+
/** Gas limit for the call (defaults to node estimate) */
|
|
1003
|
+
readonly gas?: bigint;
|
|
1004
|
+
}
|
|
1005
|
+
/**
|
|
1006
|
+
* JSON-RPC transaction request for eth_sendTransaction / eth_signTransaction.
|
|
1007
|
+
*
|
|
1008
|
+
* @since 0.3.0
|
|
1009
|
+
*/
|
|
1010
|
+
type RpcTransactionRequest = Omit<CallRequest, "from" | "to"> & {
|
|
1011
|
+
/** Sender address (required for eth_sendTransaction / eth_signTransaction) */
|
|
1012
|
+
readonly from: AddressInput;
|
|
1013
|
+
/** Recipient address (null/undefined for contract deployment) */
|
|
1014
|
+
readonly to?: AddressInput | null;
|
|
1015
|
+
/** Gas price for legacy/EIP-2930 transactions */
|
|
1016
|
+
readonly gasPrice?: bigint;
|
|
1017
|
+
/** Max fee per gas for EIP-1559+ transactions */
|
|
1018
|
+
readonly maxFeePerGas?: bigint;
|
|
1019
|
+
/** Max priority fee per gas for EIP-1559+ transactions */
|
|
1020
|
+
readonly maxPriorityFeePerGas?: bigint;
|
|
1021
|
+
/** Transaction nonce */
|
|
1022
|
+
readonly nonce?: bigint;
|
|
1023
|
+
/** Optional access list (EIP-2930+) */
|
|
1024
|
+
readonly accessList?: AccessListInput;
|
|
1025
|
+
/** Optional chain id */
|
|
1026
|
+
readonly chainId?: bigint;
|
|
1027
|
+
/** Explicit transaction type (0-4) */
|
|
1028
|
+
readonly type?: 0 | 1 | 2 | 3 | 4;
|
|
1029
|
+
/** Max fee per blob gas (EIP-4844) */
|
|
1030
|
+
readonly maxFeePerBlobGas?: bigint;
|
|
1031
|
+
/** Blob versioned hashes (EIP-4844) */
|
|
1032
|
+
readonly blobVersionedHashes?: readonly `0x${string}`[];
|
|
1033
|
+
};
|
|
1034
|
+
/**
|
|
1035
|
+
* Arguments for getBlock - discriminated union to prevent invalid combinations.
|
|
1036
|
+
*
|
|
1037
|
+
* @description
|
|
1038
|
+
* Either query by blockTag OR by blockHash, never both.
|
|
1039
|
+
*
|
|
1040
|
+
* @since 0.0.1
|
|
1041
|
+
*/
|
|
1042
|
+
type GetBlockArgs = {
|
|
1043
|
+
/** Block tag (latest, earliest, pending, safe, finalized, or hex number) */
|
|
1044
|
+
blockTag?: BlockTag;
|
|
1045
|
+
/** Whether to include full transaction objects */
|
|
1046
|
+
includeTransactions?: boolean;
|
|
1047
|
+
blockHash?: never;
|
|
1048
|
+
blockNumber?: never;
|
|
1049
|
+
} | {
|
|
1050
|
+
/** Block hash to query */
|
|
1051
|
+
blockHash: HashInput;
|
|
1052
|
+
/** Whether to include full transaction objects */
|
|
1053
|
+
includeTransactions?: boolean;
|
|
1054
|
+
blockTag?: never;
|
|
1055
|
+
blockNumber?: never;
|
|
1056
|
+
} | {
|
|
1057
|
+
/** Block number as bigint */
|
|
1058
|
+
blockNumber: bigint;
|
|
1059
|
+
/** Whether to include full transaction objects */
|
|
1060
|
+
includeTransactions?: boolean;
|
|
1061
|
+
blockTag?: never;
|
|
1062
|
+
blockHash?: never;
|
|
1063
|
+
};
|
|
1064
|
+
/**
|
|
1065
|
+
* Arguments for getBlockReceipts - block identifier only.
|
|
1066
|
+
*
|
|
1067
|
+
* @since 0.3.0
|
|
1068
|
+
*/
|
|
1069
|
+
type GetBlockReceiptsArgs = {
|
|
1070
|
+
/** Block tag (latest, earliest, pending, safe, finalized, or hex number) */
|
|
1071
|
+
blockTag?: BlockTag;
|
|
1072
|
+
blockHash?: never;
|
|
1073
|
+
blockNumber?: never;
|
|
1074
|
+
} | {
|
|
1075
|
+
/** Block hash to query */
|
|
1076
|
+
blockHash: HashInput;
|
|
1077
|
+
blockTag?: never;
|
|
1078
|
+
blockNumber?: never;
|
|
1079
|
+
} | {
|
|
1080
|
+
/** Block number as bigint */
|
|
1081
|
+
blockNumber: bigint;
|
|
1082
|
+
blockTag?: never;
|
|
1083
|
+
blockHash?: never;
|
|
1084
|
+
};
|
|
1085
|
+
/**
|
|
1086
|
+
* Arguments for getBlockTransactionCount - discriminated union.
|
|
1087
|
+
*
|
|
1088
|
+
* @description
|
|
1089
|
+
* Either query by blockTag OR by blockHash, never both.
|
|
1090
|
+
*
|
|
1091
|
+
* @since 0.0.1
|
|
1092
|
+
*/
|
|
1093
|
+
type GetBlockTransactionCountArgs = {
|
|
1094
|
+
/** Block tag (latest, earliest, pending, safe, finalized, or hex number) */
|
|
1095
|
+
blockTag?: BlockTag;
|
|
1096
|
+
blockHash?: never;
|
|
1097
|
+
} | {
|
|
1098
|
+
/** Block hash to query */
|
|
1099
|
+
blockHash: HashInput;
|
|
1100
|
+
blockTag?: never;
|
|
1101
|
+
};
|
|
1102
|
+
/**
|
|
1103
|
+
* Filter parameters for eth_getLogs - discriminated union.
|
|
1104
|
+
*
|
|
1105
|
+
* @description
|
|
1106
|
+
* Defines the criteria for querying event logs from contracts.
|
|
1107
|
+
* Either use blockHash OR fromBlock/toBlock range, never both.
|
|
1108
|
+
*
|
|
1109
|
+
* @since 0.0.1
|
|
1110
|
+
*
|
|
1111
|
+
* @example
|
|
1112
|
+
* ```typescript
|
|
1113
|
+
* // Get all Transfer events from a token contract by block range
|
|
1114
|
+
* const filter: LogFilter = {
|
|
1115
|
+
* address: '0x1234...',
|
|
1116
|
+
* topics: ['0xddf252ad...'], // Transfer event signature
|
|
1117
|
+
* fromBlock: 'latest',
|
|
1118
|
+
* toBlock: 'latest'
|
|
1119
|
+
* }
|
|
1120
|
+
*
|
|
1121
|
+
* // Get events by block hash
|
|
1122
|
+
* const filter2: LogFilter = {
|
|
1123
|
+
* address: '0x1234...',
|
|
1124
|
+
* blockHash: '0xabc...'
|
|
1125
|
+
* }
|
|
1126
|
+
* ```
|
|
1127
|
+
*/
|
|
1128
|
+
type LogFilter = {
|
|
1129
|
+
/** Specific block hash (mutually exclusive with fromBlock/toBlock) */
|
|
1130
|
+
blockHash: HashInput;
|
|
1131
|
+
fromBlock?: never;
|
|
1132
|
+
toBlock?: never;
|
|
1133
|
+
/** Contract address(es) to filter (single or array) */
|
|
1134
|
+
address?: AddressInput | AddressInput[];
|
|
1135
|
+
/** Topic filters by position (null for wildcard at that position) */
|
|
1136
|
+
topics?: (HashInput | HashInput[] | null)[];
|
|
1137
|
+
} | {
|
|
1138
|
+
blockHash?: never;
|
|
1139
|
+
/** Start block for range query (inclusive) */
|
|
1140
|
+
fromBlock?: BlockTag;
|
|
1141
|
+
/** End block for range query (inclusive) */
|
|
1142
|
+
toBlock?: BlockTag;
|
|
1143
|
+
/** Contract address(es) to filter (single or array) */
|
|
1144
|
+
address?: AddressInput | AddressInput[];
|
|
1145
|
+
/** Topic filters by position (null for wildcard at that position) */
|
|
1146
|
+
topics?: (HashInput | HashInput[] | null)[];
|
|
1147
|
+
};
|
|
1148
|
+
/**
|
|
1149
|
+
* Filter parameters for eth_newFilter.
|
|
1150
|
+
*
|
|
1151
|
+
* @description
|
|
1152
|
+
* Defines the criteria for creating an event log filter.
|
|
1153
|
+
*
|
|
1154
|
+
* @since 0.0.1
|
|
1155
|
+
*/
|
|
1156
|
+
type EventFilter = {
|
|
1157
|
+
/** Contract address(es) to filter (single or array) */
|
|
1158
|
+
readonly address?: AddressInput | AddressInput[];
|
|
1159
|
+
/** Topic filters by position (null for wildcard at that position) */
|
|
1160
|
+
readonly topics?: (HashInput | HashInput[] | null)[];
|
|
1161
|
+
/** Start block for range query (inclusive) */
|
|
1162
|
+
readonly fromBlock?: BlockTag;
|
|
1163
|
+
/** End block for range query (inclusive) */
|
|
1164
|
+
readonly toBlock?: BlockTag;
|
|
1165
|
+
};
|
|
1166
|
+
/**
|
|
1167
|
+
* Ethereum block as returned by JSON-RPC.
|
|
1168
|
+
*
|
|
1169
|
+
* @description
|
|
1170
|
+
* Contains all block header fields and optionally full transaction objects.
|
|
1171
|
+
* All numeric fields are hex-encoded strings.
|
|
1172
|
+
*
|
|
1173
|
+
* @since 0.0.1
|
|
1174
|
+
*/
|
|
1175
|
+
interface BlockType {
|
|
1176
|
+
/** Block number (hex-encoded) - null for pending blocks */
|
|
1177
|
+
number: string | null;
|
|
1178
|
+
/** Block hash - null for pending blocks */
|
|
1179
|
+
hash: string | null;
|
|
1180
|
+
/** Parent block hash */
|
|
1181
|
+
parentHash: string;
|
|
1182
|
+
/** Proof-of-work nonce */
|
|
1183
|
+
nonce: string;
|
|
1184
|
+
/** Hash of uncle blocks */
|
|
1185
|
+
sha3Uncles: string;
|
|
1186
|
+
/** Bloom filter for logs */
|
|
1187
|
+
logsBloom: string;
|
|
1188
|
+
/** Merkle root of transactions */
|
|
1189
|
+
transactionsRoot: string;
|
|
1190
|
+
/** Merkle root of state trie */
|
|
1191
|
+
stateRoot: string;
|
|
1192
|
+
/** Merkle root of receipts */
|
|
1193
|
+
receiptsRoot: string;
|
|
1194
|
+
/** Block miner/validator address */
|
|
1195
|
+
miner: string;
|
|
1196
|
+
/** Block difficulty (legacy PoW) */
|
|
1197
|
+
difficulty: string;
|
|
1198
|
+
/** Cumulative difficulty (legacy PoW) */
|
|
1199
|
+
totalDifficulty: string;
|
|
1200
|
+
/** Extra data included by miner */
|
|
1201
|
+
extraData: string;
|
|
1202
|
+
/** Block size in bytes (hex) */
|
|
1203
|
+
size: string;
|
|
1204
|
+
/** Maximum gas allowed in block (hex) */
|
|
1205
|
+
gasLimit: string;
|
|
1206
|
+
/** Total gas used by transactions (hex) */
|
|
1207
|
+
gasUsed: string;
|
|
1208
|
+
/** Block timestamp (hex, unix seconds) */
|
|
1209
|
+
timestamp: string;
|
|
1210
|
+
/** Transaction hashes or full transaction objects */
|
|
1211
|
+
transactions: string[] | TransactionType[];
|
|
1212
|
+
/** Uncle block hashes */
|
|
1213
|
+
uncles: string[];
|
|
1214
|
+
/** Base fee per gas (EIP-1559, hex) */
|
|
1215
|
+
baseFeePerGas?: string;
|
|
1216
|
+
/** Withdrawals (EIP-4895) */
|
|
1217
|
+
withdrawals?: WithdrawalType[];
|
|
1218
|
+
/** Withdrawals root (EIP-4895) */
|
|
1219
|
+
withdrawalsRoot?: string;
|
|
1220
|
+
/** Blob gas used (EIP-4844, hex) */
|
|
1221
|
+
blobGasUsed?: string;
|
|
1222
|
+
/** Excess blob gas (EIP-4844, hex) */
|
|
1223
|
+
excessBlobGas?: string;
|
|
1224
|
+
/** Parent beacon block root (EIP-4788, hex) */
|
|
1225
|
+
parentBeaconBlockRoot?: string;
|
|
1226
|
+
}
|
|
1227
|
+
/**
|
|
1228
|
+
* Withdrawal object (EIP-4895).
|
|
1229
|
+
*
|
|
1230
|
+
* @since 0.0.1
|
|
1231
|
+
*/
|
|
1232
|
+
interface WithdrawalType {
|
|
1233
|
+
/** Withdrawal index (hex) */
|
|
1234
|
+
index: string;
|
|
1235
|
+
/** Validator index (hex) */
|
|
1236
|
+
validatorIndex: string;
|
|
1237
|
+
/** Recipient address */
|
|
1238
|
+
address: string;
|
|
1239
|
+
/** Amount in Gwei (hex) */
|
|
1240
|
+
amount: string;
|
|
1241
|
+
}
|
|
1242
|
+
/**
|
|
1243
|
+
* Ethereum transaction as returned by JSON-RPC.
|
|
1244
|
+
*
|
|
1245
|
+
* @description
|
|
1246
|
+
* Contains all transaction fields. Type determines which fee fields are present.
|
|
1247
|
+
* All numeric fields are hex-encoded strings.
|
|
1248
|
+
*
|
|
1249
|
+
* @since 0.0.1
|
|
1250
|
+
*/
|
|
1251
|
+
interface TransactionType {
|
|
1252
|
+
/** Transaction hash */
|
|
1253
|
+
hash: string;
|
|
1254
|
+
/** Sender's transaction count at send time (hex) */
|
|
1255
|
+
nonce: string;
|
|
1256
|
+
/** Block hash (null if pending) */
|
|
1257
|
+
blockHash: string | null;
|
|
1258
|
+
/** Block number (hex, null if pending) */
|
|
1259
|
+
blockNumber: string | null;
|
|
1260
|
+
/** Index in block (hex, null if pending) */
|
|
1261
|
+
transactionIndex: string | null;
|
|
1262
|
+
/** Sender address */
|
|
1263
|
+
from: string;
|
|
1264
|
+
/** Recipient address (null for contract creation) */
|
|
1265
|
+
to: string | null;
|
|
1266
|
+
/** Value in wei (hex) */
|
|
1267
|
+
value: string;
|
|
1268
|
+
/** Gas limit (hex) */
|
|
1269
|
+
gas: string;
|
|
1270
|
+
/** Gas price in wei (hex, legacy) */
|
|
1271
|
+
gasPrice?: string;
|
|
1272
|
+
/** Max fee per gas (hex, EIP-1559) */
|
|
1273
|
+
maxFeePerGas?: string;
|
|
1274
|
+
/** Max priority fee per gas (hex, EIP-1559) */
|
|
1275
|
+
maxPriorityFeePerGas?: string;
|
|
1276
|
+
/** Input data (hex) */
|
|
1277
|
+
input: string;
|
|
1278
|
+
/** v component of signature (hex) */
|
|
1279
|
+
v?: string;
|
|
1280
|
+
/** r component of signature (hex) */
|
|
1281
|
+
r?: string;
|
|
1282
|
+
/** s component of signature (hex) */
|
|
1283
|
+
s?: string;
|
|
1284
|
+
/** Transaction type (hex: 0x0=legacy, 0x1=2930, 0x2=1559) */
|
|
1285
|
+
type?: string;
|
|
1286
|
+
/** Access list (EIP-2930) */
|
|
1287
|
+
accessList?: Array<{
|
|
1288
|
+
address: string;
|
|
1289
|
+
storageKeys: string[];
|
|
1290
|
+
}>;
|
|
1291
|
+
/** Chain ID (hex) */
|
|
1292
|
+
chainId?: string;
|
|
1293
|
+
/** Max fee per blob gas (EIP-4844, hex) */
|
|
1294
|
+
maxFeePerBlobGas?: string;
|
|
1295
|
+
/** Blob versioned hashes (EIP-4844) */
|
|
1296
|
+
blobVersionedHashes?: string[];
|
|
1297
|
+
/** y parity for EIP-2930+ (hex) */
|
|
1298
|
+
yParity?: string;
|
|
1299
|
+
}
|
|
1300
|
+
/**
|
|
1301
|
+
* Transaction receipt as returned by JSON-RPC.
|
|
1302
|
+
*
|
|
1303
|
+
* @description
|
|
1304
|
+
* Contains the result of transaction execution including status,
|
|
1305
|
+
* gas used, and generated logs.
|
|
1306
|
+
*
|
|
1307
|
+
* @since 0.0.1
|
|
1308
|
+
*/
|
|
1309
|
+
interface ReceiptType {
|
|
1310
|
+
/** Transaction hash */
|
|
1311
|
+
transactionHash: string;
|
|
1312
|
+
/** Index in block (hex) */
|
|
1313
|
+
transactionIndex: string;
|
|
1314
|
+
/** Block hash */
|
|
1315
|
+
blockHash: string;
|
|
1316
|
+
/** Block number (hex) */
|
|
1317
|
+
blockNumber: string;
|
|
1318
|
+
/** Sender address */
|
|
1319
|
+
from: string;
|
|
1320
|
+
/** Recipient address (null for contract creation) */
|
|
1321
|
+
to: string | null;
|
|
1322
|
+
/** Cumulative gas used in block up to this tx (hex) */
|
|
1323
|
+
cumulativeGasUsed: string;
|
|
1324
|
+
/** Gas used by this transaction (hex) */
|
|
1325
|
+
gasUsed: string;
|
|
1326
|
+
/** Effective gas price paid (hex) */
|
|
1327
|
+
effectiveGasPrice?: string;
|
|
1328
|
+
/** Contract address created (null if not contract creation) */
|
|
1329
|
+
contractAddress: string | null;
|
|
1330
|
+
/** Event logs emitted */
|
|
1331
|
+
logs: LogType[];
|
|
1332
|
+
/** Bloom filter for logs */
|
|
1333
|
+
logsBloom: string;
|
|
1334
|
+
/** Transaction type (hex) */
|
|
1335
|
+
type?: string;
|
|
1336
|
+
/** Success status (hex: 0x1=success, 0x0=failure) */
|
|
1337
|
+
status: string;
|
|
1338
|
+
}
|
|
1339
|
+
/**
|
|
1340
|
+
* Event log as returned by JSON-RPC.
|
|
1341
|
+
*
|
|
1342
|
+
* @description
|
|
1343
|
+
* Represents an event emitted by a smart contract.
|
|
1344
|
+
* Topics contain indexed event parameters.
|
|
1345
|
+
*
|
|
1346
|
+
* @since 0.0.1
|
|
1347
|
+
*/
|
|
1348
|
+
interface LogType {
|
|
1349
|
+
/** Contract that emitted the log */
|
|
1350
|
+
address: string;
|
|
1351
|
+
/** Indexed event parameters (first is event signature) */
|
|
1352
|
+
topics: string[];
|
|
1353
|
+
/** Non-indexed event data (hex) */
|
|
1354
|
+
data: string;
|
|
1355
|
+
/** Block number (hex) */
|
|
1356
|
+
blockNumber: string;
|
|
1357
|
+
/** Transaction hash */
|
|
1358
|
+
transactionHash: string;
|
|
1359
|
+
/** Transaction index in block (hex) */
|
|
1360
|
+
transactionIndex: string;
|
|
1361
|
+
/** Block hash */
|
|
1362
|
+
blockHash: string;
|
|
1363
|
+
/** Log index in block (hex) */
|
|
1364
|
+
logIndex: string;
|
|
1365
|
+
/** True if log was removed due to reorg */
|
|
1366
|
+
removed: boolean;
|
|
1367
|
+
}
|
|
1368
|
+
/**
|
|
1369
|
+
* Result type for eth_getFilterChanges.
|
|
1370
|
+
*
|
|
1371
|
+
* @description
|
|
1372
|
+
* Returns logs for event filters or hashes for block/transaction filters.
|
|
1373
|
+
*
|
|
1374
|
+
* @since 0.0.1
|
|
1375
|
+
*/
|
|
1376
|
+
type FilterChanges = LogType[] | `0x${string}`[];
|
|
1377
|
+
/**
|
|
1378
|
+
* Access list result from eth_createAccessList.
|
|
1379
|
+
*
|
|
1380
|
+
* @description
|
|
1381
|
+
* Contains the generated access list and estimated gas.
|
|
1382
|
+
* Access lists can reduce gas costs for EIP-2930+ transactions.
|
|
1383
|
+
*
|
|
1384
|
+
* @since 0.0.1
|
|
1385
|
+
*/
|
|
1386
|
+
interface AccessListType {
|
|
1387
|
+
/** List of addresses and storage slots accessed */
|
|
1388
|
+
accessList: Array<{
|
|
1389
|
+
address: string;
|
|
1390
|
+
storageKeys: string[];
|
|
1391
|
+
}>;
|
|
1392
|
+
/** Estimated gas with access list (hex) */
|
|
1393
|
+
gasUsed: string;
|
|
1394
|
+
}
|
|
1395
|
+
/**
|
|
1396
|
+
* Access list input for EIP-2930+ transactions.
|
|
1397
|
+
*
|
|
1398
|
+
* @since 0.3.0
|
|
1399
|
+
*/
|
|
1400
|
+
type AccessListInput = Array<{
|
|
1401
|
+
address: AddressInput;
|
|
1402
|
+
storageKeys: Array<`0x${string}`>;
|
|
1403
|
+
}>;
|
|
1404
|
+
/**
|
|
1405
|
+
* Fee history result from eth_feeHistory.
|
|
1406
|
+
*
|
|
1407
|
+
* @description
|
|
1408
|
+
* Historical base fee and priority fee data for gas estimation.
|
|
1409
|
+
* Useful for EIP-1559 transaction fee calculation.
|
|
1410
|
+
*
|
|
1411
|
+
* @since 0.0.1
|
|
1412
|
+
*/
|
|
1413
|
+
interface FeeHistoryType {
|
|
1414
|
+
/** Oldest block in the returned range (hex) */
|
|
1415
|
+
oldestBlock: string;
|
|
1416
|
+
/** Base fee per gas for each block (hex) */
|
|
1417
|
+
baseFeePerGas: string[];
|
|
1418
|
+
/** Ratio of gas used to gas limit per block */
|
|
1419
|
+
gasUsedRatio: number[];
|
|
1420
|
+
/** Priority fee percentiles per block (if requested) */
|
|
1421
|
+
reward?: string[][];
|
|
1422
|
+
}
|
|
1423
|
+
/**
|
|
1424
|
+
* Storage proof for a single slot.
|
|
1425
|
+
*
|
|
1426
|
+
* @since 0.0.1
|
|
1427
|
+
*/
|
|
1428
|
+
interface StorageProofType {
|
|
1429
|
+
/** Storage slot key (hex) */
|
|
1430
|
+
key: string;
|
|
1431
|
+
/** Value at slot (hex) */
|
|
1432
|
+
value: string;
|
|
1433
|
+
/** Merkle proof nodes (array of hex) */
|
|
1434
|
+
proof: string[];
|
|
1435
|
+
}
|
|
1436
|
+
/**
|
|
1437
|
+
* Account proof result from eth_getProof.
|
|
1438
|
+
*
|
|
1439
|
+
* @description
|
|
1440
|
+
* Contains the Merkle-Patricia proof for an account and optional storage slots.
|
|
1441
|
+
* Useful for stateless verification and light client implementations.
|
|
1442
|
+
*
|
|
1443
|
+
* @since 0.0.1
|
|
1444
|
+
*/
|
|
1445
|
+
interface ProofType {
|
|
1446
|
+
/** Account address */
|
|
1447
|
+
address: string;
|
|
1448
|
+
/** Merkle proof nodes for account (array of hex) */
|
|
1449
|
+
accountProof: string[];
|
|
1450
|
+
/** Account balance (hex) */
|
|
1451
|
+
balance: string;
|
|
1452
|
+
/** Account code hash */
|
|
1453
|
+
codeHash: string;
|
|
1454
|
+
/** Account nonce (hex) */
|
|
1455
|
+
nonce: string;
|
|
1456
|
+
/** Storage trie root hash */
|
|
1457
|
+
storageHash: string;
|
|
1458
|
+
/** Storage proofs for requested slots */
|
|
1459
|
+
storageProof: StorageProofType[];
|
|
1460
|
+
}
|
|
1461
|
+
/**
|
|
1462
|
+
* Uncle block type (partial block without transactions).
|
|
1463
|
+
*
|
|
1464
|
+
* @since 0.0.1
|
|
1465
|
+
*/
|
|
1466
|
+
interface UncleBlockType {
|
|
1467
|
+
/** Block number (hex) - null for pending blocks */
|
|
1468
|
+
number: string | null;
|
|
1469
|
+
/** Block hash - null for pending blocks */
|
|
1470
|
+
hash: string | null;
|
|
1471
|
+
/** Parent block hash */
|
|
1472
|
+
parentHash: string;
|
|
1473
|
+
/** Proof-of-work nonce */
|
|
1474
|
+
nonce: string;
|
|
1475
|
+
/** Hash of uncle blocks */
|
|
1476
|
+
sha3Uncles: string;
|
|
1477
|
+
/** Bloom filter for logs */
|
|
1478
|
+
logsBloom: string;
|
|
1479
|
+
/** Merkle root of transactions */
|
|
1480
|
+
transactionsRoot: string;
|
|
1481
|
+
/** Merkle root of state trie */
|
|
1482
|
+
stateRoot: string;
|
|
1483
|
+
/** Merkle root of receipts */
|
|
1484
|
+
receiptsRoot: string;
|
|
1485
|
+
/** Block miner/validator address */
|
|
1486
|
+
miner: string;
|
|
1487
|
+
/** Block difficulty (legacy PoW) */
|
|
1488
|
+
difficulty: string;
|
|
1489
|
+
/** Cumulative difficulty (legacy PoW) */
|
|
1490
|
+
totalDifficulty: string;
|
|
1491
|
+
/** Extra data included by miner */
|
|
1492
|
+
extraData: string;
|
|
1493
|
+
/** Block size in bytes (hex) */
|
|
1494
|
+
size: string;
|
|
1495
|
+
/** Maximum gas allowed in block (hex) */
|
|
1496
|
+
gasLimit: string;
|
|
1497
|
+
/** Total gas used by transactions (hex) */
|
|
1498
|
+
gasUsed: string;
|
|
1499
|
+
/** Block timestamp (hex, unix seconds) */
|
|
1500
|
+
timestamp: string;
|
|
1501
|
+
/** Uncle block hashes */
|
|
1502
|
+
uncles: string[];
|
|
1503
|
+
}
|
|
1504
|
+
/**
|
|
1505
|
+
* Arguments for getUncle - either by block tag or block hash.
|
|
1506
|
+
*
|
|
1507
|
+
* @since 0.0.1
|
|
1508
|
+
*/
|
|
1509
|
+
type GetUncleArgs = {
|
|
1510
|
+
/** Block tag (latest, earliest, pending, safe, finalized, or hex number) */
|
|
1511
|
+
blockTag?: BlockTag;
|
|
1512
|
+
blockHash?: never;
|
|
1513
|
+
} | {
|
|
1514
|
+
/** Block hash to query */
|
|
1515
|
+
blockHash: HashInput;
|
|
1516
|
+
blockTag?: never;
|
|
1517
|
+
};
|
|
1518
|
+
/**
|
|
1519
|
+
* Arguments for getUncleCount - either by block tag or block hash.
|
|
1520
|
+
*
|
|
1521
|
+
* @since 0.3.0
|
|
1522
|
+
*/
|
|
1523
|
+
type GetUncleCountArgs = {
|
|
1524
|
+
/** Block tag (latest, earliest, pending, safe, finalized, or hex number) */
|
|
1525
|
+
blockTag?: BlockTag;
|
|
1526
|
+
blockHash?: never;
|
|
1527
|
+
} | {
|
|
1528
|
+
/** Block hash to query */
|
|
1529
|
+
blockHash: HashInput;
|
|
1530
|
+
blockTag?: never;
|
|
1531
|
+
};
|
|
1532
|
+
/**
|
|
1533
|
+
* Shape of the provider service.
|
|
1534
|
+
*
|
|
1535
|
+
* @description
|
|
1536
|
+
* Composition of the focused provider services (blocks, accounts, transactions,
|
|
1537
|
+
* simulation, events, network, streaming). Each method returns an Effect that may
|
|
1538
|
+
* fail with a method-specific error union (see the Get*Error type aliases), plus
|
|
1539
|
+
* TransportError for RPC failures.
|
|
1540
|
+
*
|
|
1541
|
+
* @since 0.0.1
|
|
1542
|
+
*/
|
|
1543
|
+
type ProviderShape = BlocksShape & AccountShape & TransactionShape & SimulationShape & EventsShape & NetworkShape & StreamingShape;
|
|
1544
|
+
declare const ProviderService_base: Context.TagClass<ProviderService, "ProviderService", ProviderShape>;
|
|
1545
|
+
/**
|
|
1546
|
+
* Provider service for read-only blockchain operations.
|
|
1547
|
+
*
|
|
1548
|
+
* @description
|
|
1549
|
+
* Provides methods for querying blocks, transactions, balances, and more.
|
|
1550
|
+
* This is an Effect Context.Tag that must be provided with a concrete
|
|
1551
|
+
* implementation (Provider layer) before running.
|
|
1552
|
+
*
|
|
1553
|
+
* The service provides all standard Ethereum JSON-RPC read methods:
|
|
1554
|
+
* - Block queries (getBlock, getBlockNumber, getBlockTransactionCount)
|
|
1555
|
+
* - Account queries (getBalance, getTransactionCount, getCode, getStorageAt)
|
|
1556
|
+
* - Transaction queries (getTransaction, getTransactionReceipt, waitForTransactionReceipt)
|
|
1557
|
+
* - Call simulation (call, estimateGas, createAccessList)
|
|
1558
|
+
* - Event queries (getLogs)
|
|
1559
|
+
* - Filter subscriptions (createEventFilter, createBlockFilter, createPendingTransactionFilter, getFilterChanges, getFilterLogs, uninstallFilter)
|
|
1560
|
+
* - Network info (getChainId, getGasPrice, getMaxPriorityFeePerGas, getFeeHistory)
|
|
1561
|
+
*
|
|
1562
|
+
* Requires TransportService to be provided for actual RPC communication.
|
|
1563
|
+
*
|
|
1564
|
+
* @since 0.0.1
|
|
1565
|
+
*
|
|
1566
|
+
* @example Basic usage with HttpTransport
|
|
1567
|
+
* ```typescript
|
|
1568
|
+
* import { Effect } from 'effect'
|
|
1569
|
+
* import { ProviderService, Provider, HttpTransport } from 'voltaire-effect'
|
|
1570
|
+
*
|
|
1571
|
+
* const program = Effect.gen(function* () {
|
|
1572
|
+
* const provider = yield* ProviderService
|
|
1573
|
+
* const blockNum = yield* provider.getBlockNumber()
|
|
1574
|
+
* const balance = yield* provider.getBalance('0x1234...')
|
|
1575
|
+
* return { blockNum, balance }
|
|
1576
|
+
* }).pipe(
|
|
1577
|
+
* Effect.provide(Provider),
|
|
1578
|
+
* Effect.provide(HttpTransport('https://mainnet.infura.io/v3/YOUR_KEY'))
|
|
1579
|
+
* )
|
|
1580
|
+
*
|
|
1581
|
+
* await Effect.runPromise(program)
|
|
1582
|
+
* ```
|
|
1583
|
+
*
|
|
1584
|
+
* @example Querying block and transaction data
|
|
1585
|
+
* ```typescript
|
|
1586
|
+
* import { Effect } from 'effect'
|
|
1587
|
+
* import { ProviderService, Provider, HttpTransport } from 'voltaire-effect'
|
|
1588
|
+
*
|
|
1589
|
+
* const program = Effect.gen(function* () {
|
|
1590
|
+
* const provider = yield* ProviderService
|
|
1591
|
+
*
|
|
1592
|
+
* // Get latest block with full transactions
|
|
1593
|
+
* const block = yield* provider.getBlock({
|
|
1594
|
+
* blockTag: 'latest',
|
|
1595
|
+
* includeTransactions: true
|
|
1596
|
+
* })
|
|
1597
|
+
*
|
|
1598
|
+
* // Get specific transaction
|
|
1599
|
+
* const tx = yield* provider.getTransaction('0x...')
|
|
1600
|
+
*
|
|
1601
|
+
* // Wait for transaction confirmation
|
|
1602
|
+
* const receipt = yield* provider.waitForTransactionReceipt('0x...', {
|
|
1603
|
+
* confirmations: 3,
|
|
1604
|
+
* timeout: 60000
|
|
1605
|
+
* })
|
|
1606
|
+
*
|
|
1607
|
+
* return { block, tx, receipt }
|
|
1608
|
+
* }).pipe(
|
|
1609
|
+
* Effect.provide(Provider),
|
|
1610
|
+
* Effect.provide(HttpTransport('https://...'))
|
|
1611
|
+
* )
|
|
1612
|
+
* ```
|
|
1613
|
+
*
|
|
1614
|
+
* @example Contract interaction (read-only)
|
|
1615
|
+
* ```typescript
|
|
1616
|
+
* import { Effect } from 'effect'
|
|
1617
|
+
* import { ProviderService, Provider, HttpTransport } from 'voltaire-effect'
|
|
1618
|
+
*
|
|
1619
|
+
* const program = Effect.gen(function* () {
|
|
1620
|
+
* const provider = yield* ProviderService
|
|
1621
|
+
*
|
|
1622
|
+
* // Call a view function
|
|
1623
|
+
* const result = yield* provider.call({
|
|
1624
|
+
* to: '0x1234...',
|
|
1625
|
+
* data: '0x...' // encoded function call
|
|
1626
|
+
* })
|
|
1627
|
+
*
|
|
1628
|
+
* // Estimate gas for a transaction
|
|
1629
|
+
* const gasEstimate = yield* provider.estimateGas({
|
|
1630
|
+
* to: '0x1234...',
|
|
1631
|
+
* data: '0x...',
|
|
1632
|
+
* value: 1000000000000000000n // 1 ETH
|
|
1633
|
+
* })
|
|
1634
|
+
*
|
|
1635
|
+
* return { result, gasEstimate }
|
|
1636
|
+
* }).pipe(
|
|
1637
|
+
* Effect.provide(Provider),
|
|
1638
|
+
* Effect.provide(HttpTransport('https://...'))
|
|
1639
|
+
* )
|
|
1640
|
+
* ```
|
|
1641
|
+
*
|
|
1642
|
+
* @example Querying event logs
|
|
1643
|
+
* ```typescript
|
|
1644
|
+
* import { Effect } from 'effect'
|
|
1645
|
+
* import { ProviderService, Provider, HttpTransport } from 'voltaire-effect'
|
|
1646
|
+
*
|
|
1647
|
+
* const program = Effect.gen(function* () {
|
|
1648
|
+
* const provider = yield* ProviderService
|
|
1649
|
+
*
|
|
1650
|
+
* // Get Transfer events from a token contract
|
|
1651
|
+
* const logs = yield* provider.getLogs({
|
|
1652
|
+
* address: '0x1234...',
|
|
1653
|
+
* topics: ['0xddf252ad...'], // Transfer event signature
|
|
1654
|
+
* fromBlock: '0x100000',
|
|
1655
|
+
* toBlock: 'latest'
|
|
1656
|
+
* })
|
|
1657
|
+
*
|
|
1658
|
+
* return logs
|
|
1659
|
+
* }).pipe(
|
|
1660
|
+
* Effect.provide(Provider),
|
|
1661
|
+
* Effect.provide(HttpTransport('https://...'))
|
|
1662
|
+
* )
|
|
1663
|
+
* ```
|
|
1664
|
+
*
|
|
1665
|
+
* @see {@link Provider} - The live implementation layer
|
|
1666
|
+
* @see {@link ProviderShape} - The service interface shape
|
|
1667
|
+
* @see {@link ProviderError} - Union of provider-specific errors
|
|
1668
|
+
* @see {@link TransportError} - Underlying transport failures
|
|
1669
|
+
* @see {@link TransportService} - Required dependency for RPC communication
|
|
1670
|
+
*/
|
|
1671
|
+
declare class ProviderService extends ProviderService_base {
|
|
1672
|
+
}
|
|
1673
|
+
|
|
1674
|
+
/**
|
|
1675
|
+
* @fileoverview Account service definition for account-related JSON-RPC calls.
|
|
1676
|
+
*
|
|
1677
|
+
* @module AccountService
|
|
1678
|
+
* @since 0.3.0
|
|
1679
|
+
*
|
|
1680
|
+
* @description
|
|
1681
|
+
* The AccountService provides account state queries and optional RPC signing
|
|
1682
|
+
* operations (eth_sign, eth_signTransaction) when supported by the node.
|
|
1683
|
+
*
|
|
1684
|
+
* @see {@link ProviderService} - Combined convenience service
|
|
1685
|
+
*/
|
|
1686
|
+
|
|
1687
|
+
/**
|
|
1688
|
+
* Shape of the Account service.
|
|
1689
|
+
*
|
|
1690
|
+
* @since 0.3.0
|
|
1691
|
+
*/
|
|
1692
|
+
type AccountShape = {
|
|
1693
|
+
/** Gets the balance of an address */
|
|
1694
|
+
readonly getBalance: (address: AddressInput, blockTag?: BlockTag) => Effect.Effect<bigint, GetBalanceError>;
|
|
1695
|
+
/** Gets the transaction count (nonce) for an address */
|
|
1696
|
+
readonly getTransactionCount: (address: AddressInput, blockTag?: BlockTag) => Effect.Effect<bigint, GetTransactionCountError>;
|
|
1697
|
+
/** Gets the bytecode at an address */
|
|
1698
|
+
readonly getCode: (address: AddressInput, blockTag?: BlockTag) => Effect.Effect<HexType | `0x${string}`, GetCodeError>;
|
|
1699
|
+
/** Gets storage at a specific slot */
|
|
1700
|
+
readonly getStorageAt: (address: AddressInput, slot: HashInput, blockTag?: BlockTag) => Effect.Effect<HexType | `0x${string}`, GetStorageAtError>;
|
|
1701
|
+
/** Gets Merkle-Patricia proof for an account and storage slots */
|
|
1702
|
+
readonly getProof: (address: AddressInput, storageKeys: (HashInput | `0x${string}`)[], blockTag?: BlockTag) => Effect.Effect<ProofType, GetProofError>;
|
|
1703
|
+
/** Signs arbitrary data with an unlocked account (if supported) */
|
|
1704
|
+
readonly sign?: (address: AddressInput, message: HexType | `0x${string}`) => Effect.Effect<`0x${string}`, SignError>;
|
|
1705
|
+
/** Signs a transaction with an unlocked account (if supported) */
|
|
1706
|
+
readonly signTransaction?: (tx: RpcTransactionRequest) => Effect.Effect<unknown, SignTransactionError>;
|
|
1707
|
+
};
|
|
1708
|
+
declare const AccountService_base: Context.TagClass<AccountService, "AccountService", AccountShape>;
|
|
1709
|
+
/**
|
|
1710
|
+
* Account service for account-related JSON-RPC operations.
|
|
1711
|
+
*
|
|
1712
|
+
* @since 0.3.0
|
|
1713
|
+
*/
|
|
1714
|
+
declare class AccountService extends AccountService_base {
|
|
1715
|
+
}
|
|
1716
|
+
|
|
1717
|
+
export { ProviderStreamError as $, type AccessListType as A, type BackfillBlocksError as B, type CallError as C, type GetLogsError as D, type EstimateGasError as E, type FeeHistoryType as F, type GetBalanceError as G, type GetMaxPriorityFeePerGasError as H, type GetProofError as I, type GetStorageAtError as J, type GetTransactionConfirmationsError as K, type GetTransactionCountError as L, type GetTransactionError as M, type GetTransactionReceiptError as N, type GetUncleError as O, ProviderService as P, type LogFilter as Q, type LogType as R, NetworkService as S, TransactionService as T, type NetworkShape as U, ProviderConfirmationsPendingError as V, type ProviderError as W, ProviderNotFoundError as X, ProviderReceiptPendingError as Y, ProviderResponseError as Z, type ProviderShape as _, AccountService as a, ProviderTimeoutError as a0, ProviderValidationError as a1, type ReceiptType as a2, type SendRawTransactionError as a3, type SimulateV1BlockResult as a4, type SimulateV1CallResult as a5, type SimulateV1Payload as a6, type SimulateV1Result as a7, type SimulateV2Payload as a8, type SimulateV2Result as a9, SimulationService as aa, type SimulationShape as ab, StreamingService as ac, type StreamingShape as ad, type SyncingStatus as ae, type TransactionShape as af, type TransactionType as ag, type UninstallFilterError as ah, type WaitForTransactionReceiptError as ai, type WatchBlocksError as aj, type WorkResult as ak, TransportError as al, KeccakService as am, KeccakLive as an, KeccakTest as ao, type HashInput as ap, type TransactionIndexInput as aq, type AddressInput as ar, type KeccakServiceShape as as, type AccountShape as b, BlocksService as c, type BlocksShape as d, type BlockTag as e, type BlockType as f, type CallRequest as g, type CreateAccessListError as h, type CreateBlockFilterError as i, type CreateEventFilterError as j, type CreatePendingTransactionFilterError as k, type EventFilter as l, EventsService as m, type EventsShape as n, type FilterChanges as o, type FilterId as p, type GetBlobBaseFeeError as q, type GetBlockError as r, type GetBlockNumberError as s, type GetBlockTransactionCountError as t, type GetChainIdError as u, type GetCodeError as v, type GetFeeHistoryError as w, type GetFilterChangesError as x, type GetFilterLogsError as y, type GetGasPriceError as z };
|