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,1218 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Provider service definition for blockchain JSON-RPC operations.
|
|
3
|
+
*
|
|
4
|
+
* @module ProviderService
|
|
5
|
+
* @since 0.0.1
|
|
6
|
+
*
|
|
7
|
+
* @description
|
|
8
|
+
* The ProviderService provides a high-level interface for querying Ethereum
|
|
9
|
+
* blockchain data and invoking optional node-exposed signing/transaction
|
|
10
|
+
* submission methods. It abstracts away the underlying JSON-RPC details and
|
|
11
|
+
* provides type-safe methods for common operations like getting balances,
|
|
12
|
+
* blocks, and transactions.
|
|
13
|
+
*
|
|
14
|
+
* Most methods are read-only and do not require wallet access. For wallet-backed
|
|
15
|
+
* signing and transaction composition, use SignerService.
|
|
16
|
+
*
|
|
17
|
+
* The service requires a TransportService to be provided for actual RPC communication.
|
|
18
|
+
*
|
|
19
|
+
* @see {@link Provider} - The live implementation layer
|
|
20
|
+
* @see {@link SignerService} - For write operations
|
|
21
|
+
* @see {@link TransportService} - The underlying transport layer
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
import type { AddressType } from "@tevm/voltaire/Address";
|
|
25
|
+
import type { HashType } from "@tevm/voltaire/Hash";
|
|
26
|
+
import type { HexType } from "@tevm/voltaire/Hex";
|
|
27
|
+
import * as Context from "effect/Context";
|
|
28
|
+
import * as Data from "effect/Data";
|
|
29
|
+
import type { TransportError } from "../Transport/TransportError.js";
|
|
30
|
+
import type { AccountShape } from "./AccountService.js";
|
|
31
|
+
import type { BlocksShape } from "./BlocksService.js";
|
|
32
|
+
import type { EventsShape } from "./EventsService.js";
|
|
33
|
+
import type { NetworkShape } from "./NetworkService.js";
|
|
34
|
+
import type { SimulationShape } from "./SimulationService.js";
|
|
35
|
+
import type { StreamingShape } from "./StreamingService.js";
|
|
36
|
+
import type { TransactionShape } from "./TransactionService.js";
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Address input type that accepts both branded AddressType and plain hex strings.
|
|
40
|
+
* Provides flexibility for API consumers while maintaining type safety.
|
|
41
|
+
*/
|
|
42
|
+
export type AddressInput = AddressType | `0x${string}`;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Hash input type that accepts both branded HashType and plain hex strings.
|
|
46
|
+
*/
|
|
47
|
+
export type HashInput = HashType | `0x${string}`;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Transaction index input type for block transaction lookups.
|
|
51
|
+
*/
|
|
52
|
+
export type TransactionIndexInput = number | bigint | `0x${string}`;
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Filter identifier returned by eth_newFilter methods.
|
|
56
|
+
*
|
|
57
|
+
* @since 0.0.1
|
|
58
|
+
*/
|
|
59
|
+
export type FilterId = `0x${string}`;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Error thrown when the provider returns an invalid or unexpected response.
|
|
63
|
+
*
|
|
64
|
+
* @since 0.0.1
|
|
65
|
+
*/
|
|
66
|
+
export class ProviderResponseError extends Data.TaggedError(
|
|
67
|
+
"ProviderResponseError",
|
|
68
|
+
)<{
|
|
69
|
+
readonly input: unknown;
|
|
70
|
+
readonly message: string;
|
|
71
|
+
readonly cause?: unknown;
|
|
72
|
+
readonly context?: Record<string, unknown>;
|
|
73
|
+
}> {
|
|
74
|
+
constructor(
|
|
75
|
+
input: unknown,
|
|
76
|
+
message?: string,
|
|
77
|
+
options?: { cause?: unknown; context?: Record<string, unknown> },
|
|
78
|
+
) {
|
|
79
|
+
super({
|
|
80
|
+
input,
|
|
81
|
+
message:
|
|
82
|
+
message ??
|
|
83
|
+
(options?.cause instanceof Error ? options.cause.message : undefined) ??
|
|
84
|
+
"Invalid provider response",
|
|
85
|
+
cause: options?.cause,
|
|
86
|
+
context: options?.context,
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Error thrown when a requested resource is missing (block, tx, receipt, etc.).
|
|
93
|
+
*
|
|
94
|
+
* @since 0.0.1
|
|
95
|
+
*/
|
|
96
|
+
export class ProviderNotFoundError extends Data.TaggedError(
|
|
97
|
+
"ProviderNotFoundError",
|
|
98
|
+
)<{
|
|
99
|
+
readonly input: unknown;
|
|
100
|
+
readonly message: string;
|
|
101
|
+
readonly resource?: string;
|
|
102
|
+
readonly cause?: unknown;
|
|
103
|
+
readonly context?: Record<string, unknown>;
|
|
104
|
+
}> {
|
|
105
|
+
constructor(
|
|
106
|
+
input: unknown,
|
|
107
|
+
message?: string,
|
|
108
|
+
options?: {
|
|
109
|
+
resource?: string;
|
|
110
|
+
cause?: unknown;
|
|
111
|
+
context?: Record<string, unknown>;
|
|
112
|
+
},
|
|
113
|
+
) {
|
|
114
|
+
super({
|
|
115
|
+
input,
|
|
116
|
+
message: message ?? "Resource not found",
|
|
117
|
+
resource: options?.resource,
|
|
118
|
+
cause: options?.cause,
|
|
119
|
+
context: options?.context,
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Error thrown when inputs fail validation before an RPC call is made.
|
|
126
|
+
*
|
|
127
|
+
* @since 0.0.1
|
|
128
|
+
*/
|
|
129
|
+
export class ProviderValidationError extends Data.TaggedError(
|
|
130
|
+
"ProviderValidationError",
|
|
131
|
+
)<{
|
|
132
|
+
readonly input: unknown;
|
|
133
|
+
readonly message: string;
|
|
134
|
+
readonly cause?: unknown;
|
|
135
|
+
readonly context?: Record<string, unknown>;
|
|
136
|
+
}> {
|
|
137
|
+
constructor(
|
|
138
|
+
input: unknown,
|
|
139
|
+
message?: string,
|
|
140
|
+
options?: { cause?: unknown; context?: Record<string, unknown> },
|
|
141
|
+
) {
|
|
142
|
+
super({
|
|
143
|
+
input,
|
|
144
|
+
message:
|
|
145
|
+
message ??
|
|
146
|
+
(options?.cause instanceof Error ? options.cause.message : undefined) ??
|
|
147
|
+
"Invalid provider input",
|
|
148
|
+
cause: options?.cause,
|
|
149
|
+
context: options?.context,
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Error thrown when waiting for a result exceeds a timeout.
|
|
156
|
+
*
|
|
157
|
+
* @since 0.0.1
|
|
158
|
+
*/
|
|
159
|
+
export class ProviderTimeoutError extends Data.TaggedError(
|
|
160
|
+
"ProviderTimeoutError",
|
|
161
|
+
)<{
|
|
162
|
+
readonly input: unknown;
|
|
163
|
+
readonly message: string;
|
|
164
|
+
readonly timeoutMs?: number;
|
|
165
|
+
readonly cause?: unknown;
|
|
166
|
+
readonly context?: Record<string, unknown>;
|
|
167
|
+
}> {
|
|
168
|
+
constructor(
|
|
169
|
+
input: unknown,
|
|
170
|
+
message?: string,
|
|
171
|
+
options?: {
|
|
172
|
+
timeoutMs?: number;
|
|
173
|
+
cause?: unknown;
|
|
174
|
+
context?: Record<string, unknown>;
|
|
175
|
+
},
|
|
176
|
+
) {
|
|
177
|
+
super({
|
|
178
|
+
input,
|
|
179
|
+
message: message ?? "Provider operation timed out",
|
|
180
|
+
timeoutMs: options?.timeoutMs,
|
|
181
|
+
cause: options?.cause,
|
|
182
|
+
context: options?.context,
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* Error thrown by provider streams (watch/backfill).
|
|
189
|
+
*
|
|
190
|
+
* @since 0.0.1
|
|
191
|
+
*/
|
|
192
|
+
export class ProviderStreamError extends Data.TaggedError(
|
|
193
|
+
"ProviderStreamError",
|
|
194
|
+
)<{
|
|
195
|
+
readonly input: unknown;
|
|
196
|
+
readonly message: string;
|
|
197
|
+
readonly cause?: unknown;
|
|
198
|
+
readonly context?: Record<string, unknown>;
|
|
199
|
+
}> {
|
|
200
|
+
constructor(
|
|
201
|
+
input: unknown,
|
|
202
|
+
message?: string,
|
|
203
|
+
options?: { cause?: unknown; context?: Record<string, unknown> },
|
|
204
|
+
) {
|
|
205
|
+
super({
|
|
206
|
+
input,
|
|
207
|
+
message:
|
|
208
|
+
message ??
|
|
209
|
+
(options?.cause instanceof Error ? options.cause.message : undefined) ??
|
|
210
|
+
"Provider stream error",
|
|
211
|
+
cause: options?.cause,
|
|
212
|
+
context: options?.context,
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* Error used internally while waiting for a transaction receipt.
|
|
219
|
+
*
|
|
220
|
+
* @since 0.0.1
|
|
221
|
+
*/
|
|
222
|
+
export class ProviderReceiptPendingError extends Data.TaggedError(
|
|
223
|
+
"ProviderReceiptPendingError",
|
|
224
|
+
)<{
|
|
225
|
+
readonly input: unknown;
|
|
226
|
+
readonly message: string;
|
|
227
|
+
readonly cause?: unknown;
|
|
228
|
+
readonly context?: Record<string, unknown>;
|
|
229
|
+
}> {
|
|
230
|
+
constructor(
|
|
231
|
+
input: unknown,
|
|
232
|
+
message?: string,
|
|
233
|
+
options?: { cause?: unknown; context?: Record<string, unknown> },
|
|
234
|
+
) {
|
|
235
|
+
super({
|
|
236
|
+
input,
|
|
237
|
+
message: message ?? "Transaction pending",
|
|
238
|
+
cause: options?.cause,
|
|
239
|
+
context: options?.context,
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* Error used internally while waiting for confirmation depth.
|
|
246
|
+
*
|
|
247
|
+
* @since 0.0.1
|
|
248
|
+
*/
|
|
249
|
+
export class ProviderConfirmationsPendingError extends Data.TaggedError(
|
|
250
|
+
"ProviderConfirmationsPendingError",
|
|
251
|
+
)<{
|
|
252
|
+
readonly input: unknown;
|
|
253
|
+
readonly message: string;
|
|
254
|
+
readonly cause?: unknown;
|
|
255
|
+
readonly context?: Record<string, unknown>;
|
|
256
|
+
}> {
|
|
257
|
+
constructor(
|
|
258
|
+
input: unknown,
|
|
259
|
+
message?: string,
|
|
260
|
+
options?: { cause?: unknown; context?: Record<string, unknown> },
|
|
261
|
+
) {
|
|
262
|
+
super({
|
|
263
|
+
input,
|
|
264
|
+
message: message ?? "Waiting for confirmations",
|
|
265
|
+
cause: options?.cause,
|
|
266
|
+
context: options?.context,
|
|
267
|
+
});
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
/**
|
|
272
|
+
* Union of all provider-specific errors (excludes TransportError).
|
|
273
|
+
*
|
|
274
|
+
* @since 0.0.1
|
|
275
|
+
*/
|
|
276
|
+
export type ProviderError =
|
|
277
|
+
| ProviderResponseError
|
|
278
|
+
| ProviderNotFoundError
|
|
279
|
+
| ProviderValidationError
|
|
280
|
+
| ProviderTimeoutError
|
|
281
|
+
| ProviderStreamError
|
|
282
|
+
| ProviderReceiptPendingError
|
|
283
|
+
| ProviderConfirmationsPendingError;
|
|
284
|
+
|
|
285
|
+
/**
|
|
286
|
+
* Error unions for ProviderService methods.
|
|
287
|
+
*
|
|
288
|
+
* @since 0.0.1
|
|
289
|
+
*/
|
|
290
|
+
export type GetBlockNumberError = TransportError | ProviderResponseError;
|
|
291
|
+
export type GetBlockError = TransportError | ProviderNotFoundError;
|
|
292
|
+
export type GetBlockTransactionCountError =
|
|
293
|
+
| TransportError
|
|
294
|
+
| ProviderResponseError;
|
|
295
|
+
export type GetBalanceError = TransportError | ProviderResponseError;
|
|
296
|
+
export type GetTransactionCountError = TransportError | ProviderResponseError;
|
|
297
|
+
export type GetCodeError = TransportError;
|
|
298
|
+
export type GetStorageAtError = TransportError;
|
|
299
|
+
export type GetTransactionError = TransportError | ProviderNotFoundError;
|
|
300
|
+
export type GetTransactionReceiptError = TransportError | ProviderNotFoundError;
|
|
301
|
+
export type WaitForTransactionReceiptError =
|
|
302
|
+
| TransportError
|
|
303
|
+
| ProviderValidationError
|
|
304
|
+
| ProviderTimeoutError
|
|
305
|
+
| ProviderResponseError
|
|
306
|
+
| ProviderReceiptPendingError
|
|
307
|
+
| ProviderConfirmationsPendingError;
|
|
308
|
+
export type CallError = TransportError;
|
|
309
|
+
export type EstimateGasError = TransportError | ProviderResponseError;
|
|
310
|
+
export type CreateAccessListError = TransportError;
|
|
311
|
+
export type GetLogsError = TransportError;
|
|
312
|
+
export type CreateEventFilterError = TransportError;
|
|
313
|
+
export type CreateBlockFilterError = TransportError;
|
|
314
|
+
export type CreatePendingTransactionFilterError = TransportError;
|
|
315
|
+
export type GetFilterChangesError = TransportError;
|
|
316
|
+
export type GetFilterLogsError = TransportError;
|
|
317
|
+
export type UninstallFilterError = TransportError;
|
|
318
|
+
export type GetChainIdError =
|
|
319
|
+
| TransportError
|
|
320
|
+
| ProviderResponseError
|
|
321
|
+
| ProviderValidationError;
|
|
322
|
+
export type GetGasPriceError = TransportError | ProviderResponseError;
|
|
323
|
+
export type GetMaxPriorityFeePerGasError =
|
|
324
|
+
| TransportError
|
|
325
|
+
| ProviderResponseError;
|
|
326
|
+
export type GetFeeHistoryError = TransportError | ProviderValidationError;
|
|
327
|
+
export type WatchBlocksError = TransportError | ProviderStreamError;
|
|
328
|
+
export type BackfillBlocksError = TransportError | ProviderStreamError;
|
|
329
|
+
export type SendRawTransactionError = TransportError;
|
|
330
|
+
export type GetUncleError = TransportError | ProviderNotFoundError;
|
|
331
|
+
export type GetProofError = TransportError;
|
|
332
|
+
export type GetBlobBaseFeeError =
|
|
333
|
+
| TransportError
|
|
334
|
+
| ProviderResponseError
|
|
335
|
+
| ProviderNotFoundError;
|
|
336
|
+
export type GetTransactionConfirmationsError =
|
|
337
|
+
| TransportError
|
|
338
|
+
| ProviderResponseError;
|
|
339
|
+
export type GetBlockReceiptsError = TransportError | ProviderNotFoundError;
|
|
340
|
+
export type GetUncleCountError = TransportError | ProviderResponseError;
|
|
341
|
+
export type GetTransactionByBlockHashAndIndexError =
|
|
342
|
+
| TransportError
|
|
343
|
+
| ProviderNotFoundError;
|
|
344
|
+
export type GetTransactionByBlockNumberAndIndexError =
|
|
345
|
+
| TransportError
|
|
346
|
+
| ProviderNotFoundError;
|
|
347
|
+
export type SendTransactionError = TransportError;
|
|
348
|
+
export type SignError = TransportError;
|
|
349
|
+
export type SignTransactionError = TransportError;
|
|
350
|
+
export type SimulateV1Error = TransportError;
|
|
351
|
+
export type SimulateV2Error = TransportError;
|
|
352
|
+
export type GetSyncingError = TransportError;
|
|
353
|
+
export type GetAccountsError = TransportError;
|
|
354
|
+
export type GetCoinbaseError = TransportError;
|
|
355
|
+
export type NetVersionError = TransportError;
|
|
356
|
+
export type SubscribeError = TransportError;
|
|
357
|
+
export type UnsubscribeError = TransportError;
|
|
358
|
+
export type GetProtocolVersionError = TransportError;
|
|
359
|
+
export type GetMiningError = TransportError;
|
|
360
|
+
export type GetHashrateError = TransportError | ProviderResponseError;
|
|
361
|
+
export type GetWorkError = TransportError;
|
|
362
|
+
export type SubmitWorkError = TransportError;
|
|
363
|
+
export type SubmitHashrateError = TransportError;
|
|
364
|
+
|
|
365
|
+
/**
|
|
366
|
+
* Block identifier for Ethereum RPC calls.
|
|
367
|
+
*
|
|
368
|
+
* @description
|
|
369
|
+
* Used to specify which block to query for operations like getBalance, getCode, etc.
|
|
370
|
+
* Can be a named tag for special blocks or a hex-encoded block number.
|
|
371
|
+
*
|
|
372
|
+
* Named tags:
|
|
373
|
+
* - `"latest"` - Most recent mined block
|
|
374
|
+
* - `"earliest"` - Genesis block
|
|
375
|
+
* - `"pending"` - Pending block (transactions in mempool)
|
|
376
|
+
* - `"safe"` - Latest safe head block (2/3 attestations)
|
|
377
|
+
* - `"finalized"` - Latest finalized block (cannot be reverted)
|
|
378
|
+
*
|
|
379
|
+
* @since 0.0.1
|
|
380
|
+
*
|
|
381
|
+
* @example
|
|
382
|
+
* ```typescript
|
|
383
|
+
* // Using named tags
|
|
384
|
+
* const balance1 = yield* provider.getBalance(address, 'latest')
|
|
385
|
+
* const balance2 = yield* provider.getBalance(address, 'finalized')
|
|
386
|
+
*
|
|
387
|
+
* // Using hex block number
|
|
388
|
+
* const balance3 = yield* provider.getBalance(address, '0x1234')
|
|
389
|
+
* ```
|
|
390
|
+
*/
|
|
391
|
+
export type BlockTag =
|
|
392
|
+
| "latest"
|
|
393
|
+
| "earliest"
|
|
394
|
+
| "pending"
|
|
395
|
+
| "safe"
|
|
396
|
+
| "finalized"
|
|
397
|
+
| `0x${string}`;
|
|
398
|
+
|
|
399
|
+
/**
|
|
400
|
+
* State override for a single account.
|
|
401
|
+
*
|
|
402
|
+
* @description
|
|
403
|
+
* Allows modifying account state before executing eth_call or eth_estimateGas.
|
|
404
|
+
* Useful for simulating transactions with modified balances, code, or storage.
|
|
405
|
+
*
|
|
406
|
+
* @since 0.0.1
|
|
407
|
+
*
|
|
408
|
+
* @example
|
|
409
|
+
* ```typescript
|
|
410
|
+
* const override: AccountStateOverride = {
|
|
411
|
+
* balance: 1000000000000000000n, // Override balance to 1 ETH
|
|
412
|
+
* nonce: 5n, // Override nonce
|
|
413
|
+
* code: '0x6080604052...', // Replace contract code
|
|
414
|
+
* state: { // Replace entire storage
|
|
415
|
+
* '0x0000...0000': '0x0000...0001'
|
|
416
|
+
* },
|
|
417
|
+
* stateDiff: { // Merge with existing storage
|
|
418
|
+
* '0x0000...0001': '0x0000...0064'
|
|
419
|
+
* }
|
|
420
|
+
* }
|
|
421
|
+
* ```
|
|
422
|
+
*/
|
|
423
|
+
export interface AccountStateOverride {
|
|
424
|
+
/** Override balance in wei */
|
|
425
|
+
readonly balance?: bigint;
|
|
426
|
+
/** Override nonce */
|
|
427
|
+
readonly nonce?: bigint;
|
|
428
|
+
/** Override contract bytecode */
|
|
429
|
+
readonly code?: HexType | `0x${string}`;
|
|
430
|
+
/** Replace entire storage with this mapping (slot -> value) */
|
|
431
|
+
readonly state?: Record<`0x${string}`, `0x${string}`>;
|
|
432
|
+
/** Merge these slots with existing storage (slot -> value) */
|
|
433
|
+
readonly stateDiff?: Record<`0x${string}`, `0x${string}`>;
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
/**
|
|
437
|
+
* State override set mapping addresses to account overrides.
|
|
438
|
+
*
|
|
439
|
+
* @description
|
|
440
|
+
* Maps account addresses to their state overrides. Each address can have
|
|
441
|
+
* its balance, nonce, code, and storage modified for the duration of the call.
|
|
442
|
+
*
|
|
443
|
+
* @since 0.0.1
|
|
444
|
+
*
|
|
445
|
+
* @example
|
|
446
|
+
* ```typescript
|
|
447
|
+
* const stateOverride: StateOverride = {
|
|
448
|
+
* '0x1234...': { balance: 1000000000000000000n },
|
|
449
|
+
* '0x5678...': { code: '0x6080604052...' }
|
|
450
|
+
* }
|
|
451
|
+
* ```
|
|
452
|
+
*/
|
|
453
|
+
export type StateOverride = Record<`0x${string}`, AccountStateOverride>;
|
|
454
|
+
|
|
455
|
+
/**
|
|
456
|
+
* Block overrides for call simulation.
|
|
457
|
+
*
|
|
458
|
+
* @description
|
|
459
|
+
* Allows overriding block context during eth_call execution.
|
|
460
|
+
* Useful for simulating calls at different block conditions.
|
|
461
|
+
*
|
|
462
|
+
* @since 0.0.1
|
|
463
|
+
*/
|
|
464
|
+
export interface BlockOverrides {
|
|
465
|
+
/** Override block number */
|
|
466
|
+
readonly number?: bigint;
|
|
467
|
+
/** Override block difficulty */
|
|
468
|
+
readonly difficulty?: bigint;
|
|
469
|
+
/** Override block time (unix timestamp) */
|
|
470
|
+
readonly time?: bigint;
|
|
471
|
+
/** Override gas limit */
|
|
472
|
+
readonly gasLimit?: bigint;
|
|
473
|
+
/** Override coinbase/miner address */
|
|
474
|
+
readonly coinbase?: AddressInput;
|
|
475
|
+
/** Override random/prevrandao */
|
|
476
|
+
readonly random?: HashInput;
|
|
477
|
+
/** Override base fee */
|
|
478
|
+
readonly baseFee?: bigint;
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
/**
|
|
482
|
+
* Request parameters for eth_call and eth_estimateGas.
|
|
483
|
+
*
|
|
484
|
+
* @description
|
|
485
|
+
* Defines the parameters for simulating a transaction call without
|
|
486
|
+
* actually sending it to the network. Used for reading contract state
|
|
487
|
+
* and estimating gas costs.
|
|
488
|
+
*
|
|
489
|
+
* @since 0.0.1
|
|
490
|
+
*
|
|
491
|
+
* @example
|
|
492
|
+
* ```typescript
|
|
493
|
+
* const callRequest: CallRequest = {
|
|
494
|
+
* to: '0x1234...', // Contract address
|
|
495
|
+
* from: '0x5678...', // Sender address (optional)
|
|
496
|
+
* data: '0x...', // Encoded function call
|
|
497
|
+
* value: 0n, // ETH to send (optional)
|
|
498
|
+
* gas: 100000n // Gas limit (optional)
|
|
499
|
+
* }
|
|
500
|
+
* ```
|
|
501
|
+
*/
|
|
502
|
+
export interface CallRequest {
|
|
503
|
+
/** Target contract address to call */
|
|
504
|
+
readonly to?: AddressInput;
|
|
505
|
+
/** Sender address (affects msg.sender in call) */
|
|
506
|
+
readonly from?: AddressInput;
|
|
507
|
+
/** ABI-encoded function call data */
|
|
508
|
+
readonly data?: HexType | `0x${string}`;
|
|
509
|
+
/** Value in wei to send with the call */
|
|
510
|
+
readonly value?: bigint;
|
|
511
|
+
/** Gas limit for the call (defaults to node estimate) */
|
|
512
|
+
readonly gas?: bigint;
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
/**
|
|
516
|
+
* JSON-RPC transaction request for eth_sendTransaction / eth_signTransaction.
|
|
517
|
+
*
|
|
518
|
+
* @since 0.3.0
|
|
519
|
+
*/
|
|
520
|
+
export type RpcTransactionRequest = Omit<CallRequest, "from" | "to"> & {
|
|
521
|
+
/** Sender address (required for eth_sendTransaction / eth_signTransaction) */
|
|
522
|
+
readonly from: AddressInput;
|
|
523
|
+
/** Recipient address (null/undefined for contract deployment) */
|
|
524
|
+
readonly to?: AddressInput | null;
|
|
525
|
+
/** Gas price for legacy/EIP-2930 transactions */
|
|
526
|
+
readonly gasPrice?: bigint;
|
|
527
|
+
/** Max fee per gas for EIP-1559+ transactions */
|
|
528
|
+
readonly maxFeePerGas?: bigint;
|
|
529
|
+
/** Max priority fee per gas for EIP-1559+ transactions */
|
|
530
|
+
readonly maxPriorityFeePerGas?: bigint;
|
|
531
|
+
/** Transaction nonce */
|
|
532
|
+
readonly nonce?: bigint;
|
|
533
|
+
/** Optional access list (EIP-2930+) */
|
|
534
|
+
readonly accessList?: AccessListInput;
|
|
535
|
+
/** Optional chain id */
|
|
536
|
+
readonly chainId?: bigint;
|
|
537
|
+
/** Explicit transaction type (0-4) */
|
|
538
|
+
readonly type?: 0 | 1 | 2 | 3 | 4;
|
|
539
|
+
/** Max fee per blob gas (EIP-4844) */
|
|
540
|
+
readonly maxFeePerBlobGas?: bigint;
|
|
541
|
+
/** Blob versioned hashes (EIP-4844) */
|
|
542
|
+
readonly blobVersionedHashes?: readonly `0x${string}`[];
|
|
543
|
+
};
|
|
544
|
+
|
|
545
|
+
/**
|
|
546
|
+
* Arguments for getBlock - discriminated union to prevent invalid combinations.
|
|
547
|
+
*
|
|
548
|
+
* @description
|
|
549
|
+
* Either query by blockTag OR by blockHash, never both.
|
|
550
|
+
*
|
|
551
|
+
* @since 0.0.1
|
|
552
|
+
*/
|
|
553
|
+
export type GetBlockArgs =
|
|
554
|
+
| {
|
|
555
|
+
/** Block tag (latest, earliest, pending, safe, finalized, or hex number) */
|
|
556
|
+
blockTag?: BlockTag;
|
|
557
|
+
/** Whether to include full transaction objects */
|
|
558
|
+
includeTransactions?: boolean;
|
|
559
|
+
blockHash?: never;
|
|
560
|
+
blockNumber?: never;
|
|
561
|
+
}
|
|
562
|
+
| {
|
|
563
|
+
/** Block hash to query */
|
|
564
|
+
blockHash: HashInput;
|
|
565
|
+
/** Whether to include full transaction objects */
|
|
566
|
+
includeTransactions?: boolean;
|
|
567
|
+
blockTag?: never;
|
|
568
|
+
blockNumber?: never;
|
|
569
|
+
}
|
|
570
|
+
| {
|
|
571
|
+
/** Block number as bigint */
|
|
572
|
+
blockNumber: bigint;
|
|
573
|
+
/** Whether to include full transaction objects */
|
|
574
|
+
includeTransactions?: boolean;
|
|
575
|
+
blockTag?: never;
|
|
576
|
+
blockHash?: never;
|
|
577
|
+
};
|
|
578
|
+
|
|
579
|
+
/**
|
|
580
|
+
* Arguments for getBlockReceipts - block identifier only.
|
|
581
|
+
*
|
|
582
|
+
* @since 0.3.0
|
|
583
|
+
*/
|
|
584
|
+
export type GetBlockReceiptsArgs =
|
|
585
|
+
| {
|
|
586
|
+
/** Block tag (latest, earliest, pending, safe, finalized, or hex number) */
|
|
587
|
+
blockTag?: BlockTag;
|
|
588
|
+
blockHash?: never;
|
|
589
|
+
blockNumber?: never;
|
|
590
|
+
}
|
|
591
|
+
| {
|
|
592
|
+
/** Block hash to query */
|
|
593
|
+
blockHash: HashInput;
|
|
594
|
+
blockTag?: never;
|
|
595
|
+
blockNumber?: never;
|
|
596
|
+
}
|
|
597
|
+
| {
|
|
598
|
+
/** Block number as bigint */
|
|
599
|
+
blockNumber: bigint;
|
|
600
|
+
blockTag?: never;
|
|
601
|
+
blockHash?: never;
|
|
602
|
+
};
|
|
603
|
+
|
|
604
|
+
/**
|
|
605
|
+
* Arguments for getBlockTransactionCount - discriminated union.
|
|
606
|
+
*
|
|
607
|
+
* @description
|
|
608
|
+
* Either query by blockTag OR by blockHash, never both.
|
|
609
|
+
*
|
|
610
|
+
* @since 0.0.1
|
|
611
|
+
*/
|
|
612
|
+
export type GetBlockTransactionCountArgs =
|
|
613
|
+
| {
|
|
614
|
+
/** Block tag (latest, earliest, pending, safe, finalized, or hex number) */
|
|
615
|
+
blockTag?: BlockTag;
|
|
616
|
+
blockHash?: never;
|
|
617
|
+
}
|
|
618
|
+
| {
|
|
619
|
+
/** Block hash to query */
|
|
620
|
+
blockHash: HashInput;
|
|
621
|
+
blockTag?: never;
|
|
622
|
+
};
|
|
623
|
+
|
|
624
|
+
/**
|
|
625
|
+
* Filter parameters for eth_getLogs - discriminated union.
|
|
626
|
+
*
|
|
627
|
+
* @description
|
|
628
|
+
* Defines the criteria for querying event logs from contracts.
|
|
629
|
+
* Either use blockHash OR fromBlock/toBlock range, never both.
|
|
630
|
+
*
|
|
631
|
+
* @since 0.0.1
|
|
632
|
+
*
|
|
633
|
+
* @example
|
|
634
|
+
* ```typescript
|
|
635
|
+
* // Get all Transfer events from a token contract by block range
|
|
636
|
+
* const filter: LogFilter = {
|
|
637
|
+
* address: '0x1234...',
|
|
638
|
+
* topics: ['0xddf252ad...'], // Transfer event signature
|
|
639
|
+
* fromBlock: 'latest',
|
|
640
|
+
* toBlock: 'latest'
|
|
641
|
+
* }
|
|
642
|
+
*
|
|
643
|
+
* // Get events by block hash
|
|
644
|
+
* const filter2: LogFilter = {
|
|
645
|
+
* address: '0x1234...',
|
|
646
|
+
* blockHash: '0xabc...'
|
|
647
|
+
* }
|
|
648
|
+
* ```
|
|
649
|
+
*/
|
|
650
|
+
export type LogFilter =
|
|
651
|
+
| {
|
|
652
|
+
/** Specific block hash (mutually exclusive with fromBlock/toBlock) */
|
|
653
|
+
blockHash: HashInput;
|
|
654
|
+
fromBlock?: never;
|
|
655
|
+
toBlock?: never;
|
|
656
|
+
/** Contract address(es) to filter (single or array) */
|
|
657
|
+
address?: AddressInput | AddressInput[];
|
|
658
|
+
/** Topic filters by position (null for wildcard at that position) */
|
|
659
|
+
topics?: (HashInput | HashInput[] | null)[];
|
|
660
|
+
}
|
|
661
|
+
| {
|
|
662
|
+
blockHash?: never;
|
|
663
|
+
/** Start block for range query (inclusive) */
|
|
664
|
+
fromBlock?: BlockTag;
|
|
665
|
+
/** End block for range query (inclusive) */
|
|
666
|
+
toBlock?: BlockTag;
|
|
667
|
+
/** Contract address(es) to filter (single or array) */
|
|
668
|
+
address?: AddressInput | AddressInput[];
|
|
669
|
+
/** Topic filters by position (null for wildcard at that position) */
|
|
670
|
+
topics?: (HashInput | HashInput[] | null)[];
|
|
671
|
+
};
|
|
672
|
+
|
|
673
|
+
/**
|
|
674
|
+
* Filter parameters for eth_newFilter.
|
|
675
|
+
*
|
|
676
|
+
* @description
|
|
677
|
+
* Defines the criteria for creating an event log filter.
|
|
678
|
+
*
|
|
679
|
+
* @since 0.0.1
|
|
680
|
+
*/
|
|
681
|
+
export type EventFilter = {
|
|
682
|
+
/** Contract address(es) to filter (single or array) */
|
|
683
|
+
readonly address?: AddressInput | AddressInput[];
|
|
684
|
+
/** Topic filters by position (null for wildcard at that position) */
|
|
685
|
+
readonly topics?: (HashInput | HashInput[] | null)[];
|
|
686
|
+
/** Start block for range query (inclusive) */
|
|
687
|
+
readonly fromBlock?: BlockTag;
|
|
688
|
+
/** End block for range query (inclusive) */
|
|
689
|
+
readonly toBlock?: BlockTag;
|
|
690
|
+
};
|
|
691
|
+
|
|
692
|
+
/**
|
|
693
|
+
* Ethereum block as returned by JSON-RPC.
|
|
694
|
+
*
|
|
695
|
+
* @description
|
|
696
|
+
* Contains all block header fields and optionally full transaction objects.
|
|
697
|
+
* All numeric fields are hex-encoded strings.
|
|
698
|
+
*
|
|
699
|
+
* @since 0.0.1
|
|
700
|
+
*/
|
|
701
|
+
export interface BlockType {
|
|
702
|
+
/** Block number (hex-encoded) - null for pending blocks */
|
|
703
|
+
number: string | null;
|
|
704
|
+
/** Block hash - null for pending blocks */
|
|
705
|
+
hash: string | null;
|
|
706
|
+
/** Parent block hash */
|
|
707
|
+
parentHash: string;
|
|
708
|
+
/** Proof-of-work nonce */
|
|
709
|
+
nonce: string;
|
|
710
|
+
/** Hash of uncle blocks */
|
|
711
|
+
sha3Uncles: string;
|
|
712
|
+
/** Bloom filter for logs */
|
|
713
|
+
logsBloom: string;
|
|
714
|
+
/** Merkle root of transactions */
|
|
715
|
+
transactionsRoot: string;
|
|
716
|
+
/** Merkle root of state trie */
|
|
717
|
+
stateRoot: string;
|
|
718
|
+
/** Merkle root of receipts */
|
|
719
|
+
receiptsRoot: string;
|
|
720
|
+
/** Block miner/validator address */
|
|
721
|
+
miner: string;
|
|
722
|
+
/** Block difficulty (legacy PoW) */
|
|
723
|
+
difficulty: string;
|
|
724
|
+
/** Cumulative difficulty (legacy PoW) */
|
|
725
|
+
totalDifficulty: string;
|
|
726
|
+
/** Extra data included by miner */
|
|
727
|
+
extraData: string;
|
|
728
|
+
/** Block size in bytes (hex) */
|
|
729
|
+
size: string;
|
|
730
|
+
/** Maximum gas allowed in block (hex) */
|
|
731
|
+
gasLimit: string;
|
|
732
|
+
/** Total gas used by transactions (hex) */
|
|
733
|
+
gasUsed: string;
|
|
734
|
+
/** Block timestamp (hex, unix seconds) */
|
|
735
|
+
timestamp: string;
|
|
736
|
+
/** Transaction hashes or full transaction objects */
|
|
737
|
+
transactions: string[] | TransactionType[];
|
|
738
|
+
/** Uncle block hashes */
|
|
739
|
+
uncles: string[];
|
|
740
|
+
/** Base fee per gas (EIP-1559, hex) */
|
|
741
|
+
baseFeePerGas?: string;
|
|
742
|
+
/** Withdrawals (EIP-4895) */
|
|
743
|
+
withdrawals?: WithdrawalType[];
|
|
744
|
+
/** Withdrawals root (EIP-4895) */
|
|
745
|
+
withdrawalsRoot?: string;
|
|
746
|
+
/** Blob gas used (EIP-4844, hex) */
|
|
747
|
+
blobGasUsed?: string;
|
|
748
|
+
/** Excess blob gas (EIP-4844, hex) */
|
|
749
|
+
excessBlobGas?: string;
|
|
750
|
+
/** Parent beacon block root (EIP-4788, hex) */
|
|
751
|
+
parentBeaconBlockRoot?: string;
|
|
752
|
+
}
|
|
753
|
+
|
|
754
|
+
/**
|
|
755
|
+
* Withdrawal object (EIP-4895).
|
|
756
|
+
*
|
|
757
|
+
* @since 0.0.1
|
|
758
|
+
*/
|
|
759
|
+
export interface WithdrawalType {
|
|
760
|
+
/** Withdrawal index (hex) */
|
|
761
|
+
index: string;
|
|
762
|
+
/** Validator index (hex) */
|
|
763
|
+
validatorIndex: string;
|
|
764
|
+
/** Recipient address */
|
|
765
|
+
address: string;
|
|
766
|
+
/** Amount in Gwei (hex) */
|
|
767
|
+
amount: string;
|
|
768
|
+
}
|
|
769
|
+
|
|
770
|
+
/**
|
|
771
|
+
* Ethereum transaction as returned by JSON-RPC.
|
|
772
|
+
*
|
|
773
|
+
* @description
|
|
774
|
+
* Contains all transaction fields. Type determines which fee fields are present.
|
|
775
|
+
* All numeric fields are hex-encoded strings.
|
|
776
|
+
*
|
|
777
|
+
* @since 0.0.1
|
|
778
|
+
*/
|
|
779
|
+
export interface TransactionType {
|
|
780
|
+
/** Transaction hash */
|
|
781
|
+
hash: string;
|
|
782
|
+
/** Sender's transaction count at send time (hex) */
|
|
783
|
+
nonce: string;
|
|
784
|
+
/** Block hash (null if pending) */
|
|
785
|
+
blockHash: string | null;
|
|
786
|
+
/** Block number (hex, null if pending) */
|
|
787
|
+
blockNumber: string | null;
|
|
788
|
+
/** Index in block (hex, null if pending) */
|
|
789
|
+
transactionIndex: string | null;
|
|
790
|
+
/** Sender address */
|
|
791
|
+
from: string;
|
|
792
|
+
/** Recipient address (null for contract creation) */
|
|
793
|
+
to: string | null;
|
|
794
|
+
/** Value in wei (hex) */
|
|
795
|
+
value: string;
|
|
796
|
+
/** Gas limit (hex) */
|
|
797
|
+
gas: string;
|
|
798
|
+
/** Gas price in wei (hex, legacy) */
|
|
799
|
+
gasPrice?: string;
|
|
800
|
+
/** Max fee per gas (hex, EIP-1559) */
|
|
801
|
+
maxFeePerGas?: string;
|
|
802
|
+
/** Max priority fee per gas (hex, EIP-1559) */
|
|
803
|
+
maxPriorityFeePerGas?: string;
|
|
804
|
+
/** Input data (hex) */
|
|
805
|
+
input: string;
|
|
806
|
+
/** v component of signature (hex) */
|
|
807
|
+
v?: string;
|
|
808
|
+
/** r component of signature (hex) */
|
|
809
|
+
r?: string;
|
|
810
|
+
/** s component of signature (hex) */
|
|
811
|
+
s?: string;
|
|
812
|
+
/** Transaction type (hex: 0x0=legacy, 0x1=2930, 0x2=1559) */
|
|
813
|
+
type?: string;
|
|
814
|
+
/** Access list (EIP-2930) */
|
|
815
|
+
accessList?: Array<{ address: string; storageKeys: string[] }>;
|
|
816
|
+
/** Chain ID (hex) */
|
|
817
|
+
chainId?: string;
|
|
818
|
+
/** Max fee per blob gas (EIP-4844, hex) */
|
|
819
|
+
maxFeePerBlobGas?: string;
|
|
820
|
+
/** Blob versioned hashes (EIP-4844) */
|
|
821
|
+
blobVersionedHashes?: string[];
|
|
822
|
+
/** y parity for EIP-2930+ (hex) */
|
|
823
|
+
yParity?: string;
|
|
824
|
+
}
|
|
825
|
+
|
|
826
|
+
/**
|
|
827
|
+
* Transaction receipt as returned by JSON-RPC.
|
|
828
|
+
*
|
|
829
|
+
* @description
|
|
830
|
+
* Contains the result of transaction execution including status,
|
|
831
|
+
* gas used, and generated logs.
|
|
832
|
+
*
|
|
833
|
+
* @since 0.0.1
|
|
834
|
+
*/
|
|
835
|
+
export interface ReceiptType {
|
|
836
|
+
/** Transaction hash */
|
|
837
|
+
transactionHash: string;
|
|
838
|
+
/** Index in block (hex) */
|
|
839
|
+
transactionIndex: string;
|
|
840
|
+
/** Block hash */
|
|
841
|
+
blockHash: string;
|
|
842
|
+
/** Block number (hex) */
|
|
843
|
+
blockNumber: string;
|
|
844
|
+
/** Sender address */
|
|
845
|
+
from: string;
|
|
846
|
+
/** Recipient address (null for contract creation) */
|
|
847
|
+
to: string | null;
|
|
848
|
+
/** Cumulative gas used in block up to this tx (hex) */
|
|
849
|
+
cumulativeGasUsed: string;
|
|
850
|
+
/** Gas used by this transaction (hex) */
|
|
851
|
+
gasUsed: string;
|
|
852
|
+
/** Effective gas price paid (hex) */
|
|
853
|
+
effectiveGasPrice?: string;
|
|
854
|
+
/** Contract address created (null if not contract creation) */
|
|
855
|
+
contractAddress: string | null;
|
|
856
|
+
/** Event logs emitted */
|
|
857
|
+
logs: LogType[];
|
|
858
|
+
/** Bloom filter for logs */
|
|
859
|
+
logsBloom: string;
|
|
860
|
+
/** Transaction type (hex) */
|
|
861
|
+
type?: string;
|
|
862
|
+
/** Success status (hex: 0x1=success, 0x0=failure) */
|
|
863
|
+
status: string;
|
|
864
|
+
}
|
|
865
|
+
|
|
866
|
+
/**
|
|
867
|
+
* Event log as returned by JSON-RPC.
|
|
868
|
+
*
|
|
869
|
+
* @description
|
|
870
|
+
* Represents an event emitted by a smart contract.
|
|
871
|
+
* Topics contain indexed event parameters.
|
|
872
|
+
*
|
|
873
|
+
* @since 0.0.1
|
|
874
|
+
*/
|
|
875
|
+
export interface LogType {
|
|
876
|
+
/** Contract that emitted the log */
|
|
877
|
+
address: string;
|
|
878
|
+
/** Indexed event parameters (first is event signature) */
|
|
879
|
+
topics: string[];
|
|
880
|
+
/** Non-indexed event data (hex) */
|
|
881
|
+
data: string;
|
|
882
|
+
/** Block number (hex) */
|
|
883
|
+
blockNumber: string;
|
|
884
|
+
/** Transaction hash */
|
|
885
|
+
transactionHash: string;
|
|
886
|
+
/** Transaction index in block (hex) */
|
|
887
|
+
transactionIndex: string;
|
|
888
|
+
/** Block hash */
|
|
889
|
+
blockHash: string;
|
|
890
|
+
/** Log index in block (hex) */
|
|
891
|
+
logIndex: string;
|
|
892
|
+
/** True if log was removed due to reorg */
|
|
893
|
+
removed: boolean;
|
|
894
|
+
}
|
|
895
|
+
|
|
896
|
+
/**
|
|
897
|
+
* Result type for eth_getFilterChanges.
|
|
898
|
+
*
|
|
899
|
+
* @description
|
|
900
|
+
* Returns logs for event filters or hashes for block/transaction filters.
|
|
901
|
+
*
|
|
902
|
+
* @since 0.0.1
|
|
903
|
+
*/
|
|
904
|
+
export type FilterChanges = LogType[] | `0x${string}`[];
|
|
905
|
+
|
|
906
|
+
/**
|
|
907
|
+
* Access list result from eth_createAccessList.
|
|
908
|
+
*
|
|
909
|
+
* @description
|
|
910
|
+
* Contains the generated access list and estimated gas.
|
|
911
|
+
* Access lists can reduce gas costs for EIP-2930+ transactions.
|
|
912
|
+
*
|
|
913
|
+
* @since 0.0.1
|
|
914
|
+
*/
|
|
915
|
+
export interface AccessListType {
|
|
916
|
+
/** List of addresses and storage slots accessed */
|
|
917
|
+
accessList: Array<{ address: string; storageKeys: string[] }>;
|
|
918
|
+
/** Estimated gas with access list (hex) */
|
|
919
|
+
gasUsed: string;
|
|
920
|
+
}
|
|
921
|
+
|
|
922
|
+
/**
|
|
923
|
+
* Access list input for EIP-2930+ transactions.
|
|
924
|
+
*
|
|
925
|
+
* @since 0.3.0
|
|
926
|
+
*/
|
|
927
|
+
export type AccessListInput = Array<{
|
|
928
|
+
address: AddressInput;
|
|
929
|
+
storageKeys: Array<`0x${string}`>;
|
|
930
|
+
}>;
|
|
931
|
+
|
|
932
|
+
/**
|
|
933
|
+
* Fee history result from eth_feeHistory.
|
|
934
|
+
*
|
|
935
|
+
* @description
|
|
936
|
+
* Historical base fee and priority fee data for gas estimation.
|
|
937
|
+
* Useful for EIP-1559 transaction fee calculation.
|
|
938
|
+
*
|
|
939
|
+
* @since 0.0.1
|
|
940
|
+
*/
|
|
941
|
+
export interface FeeHistoryType {
|
|
942
|
+
/** Oldest block in the returned range (hex) */
|
|
943
|
+
oldestBlock: string;
|
|
944
|
+
/** Base fee per gas for each block (hex) */
|
|
945
|
+
baseFeePerGas: string[];
|
|
946
|
+
/** Ratio of gas used to gas limit per block */
|
|
947
|
+
gasUsedRatio: number[];
|
|
948
|
+
/** Priority fee percentiles per block (if requested) */
|
|
949
|
+
reward?: string[][];
|
|
950
|
+
}
|
|
951
|
+
|
|
952
|
+
/**
|
|
953
|
+
* Storage proof for a single slot.
|
|
954
|
+
*
|
|
955
|
+
* @since 0.0.1
|
|
956
|
+
*/
|
|
957
|
+
export interface StorageProofType {
|
|
958
|
+
/** Storage slot key (hex) */
|
|
959
|
+
key: string;
|
|
960
|
+
/** Value at slot (hex) */
|
|
961
|
+
value: string;
|
|
962
|
+
/** Merkle proof nodes (array of hex) */
|
|
963
|
+
proof: string[];
|
|
964
|
+
}
|
|
965
|
+
|
|
966
|
+
/**
|
|
967
|
+
* Account proof result from eth_getProof.
|
|
968
|
+
*
|
|
969
|
+
* @description
|
|
970
|
+
* Contains the Merkle-Patricia proof for an account and optional storage slots.
|
|
971
|
+
* Useful for stateless verification and light client implementations.
|
|
972
|
+
*
|
|
973
|
+
* @since 0.0.1
|
|
974
|
+
*/
|
|
975
|
+
export interface ProofType {
|
|
976
|
+
/** Account address */
|
|
977
|
+
address: string;
|
|
978
|
+
/** Merkle proof nodes for account (array of hex) */
|
|
979
|
+
accountProof: string[];
|
|
980
|
+
/** Account balance (hex) */
|
|
981
|
+
balance: string;
|
|
982
|
+
/** Account code hash */
|
|
983
|
+
codeHash: string;
|
|
984
|
+
/** Account nonce (hex) */
|
|
985
|
+
nonce: string;
|
|
986
|
+
/** Storage trie root hash */
|
|
987
|
+
storageHash: string;
|
|
988
|
+
/** Storage proofs for requested slots */
|
|
989
|
+
storageProof: StorageProofType[];
|
|
990
|
+
}
|
|
991
|
+
|
|
992
|
+
/**
|
|
993
|
+
* Uncle block type (partial block without transactions).
|
|
994
|
+
*
|
|
995
|
+
* @since 0.0.1
|
|
996
|
+
*/
|
|
997
|
+
export interface UncleBlockType {
|
|
998
|
+
/** Block number (hex) - null for pending blocks */
|
|
999
|
+
number: string | null;
|
|
1000
|
+
/** Block hash - null for pending blocks */
|
|
1001
|
+
hash: string | null;
|
|
1002
|
+
/** Parent block hash */
|
|
1003
|
+
parentHash: string;
|
|
1004
|
+
/** Proof-of-work nonce */
|
|
1005
|
+
nonce: string;
|
|
1006
|
+
/** Hash of uncle blocks */
|
|
1007
|
+
sha3Uncles: string;
|
|
1008
|
+
/** Bloom filter for logs */
|
|
1009
|
+
logsBloom: string;
|
|
1010
|
+
/** Merkle root of transactions */
|
|
1011
|
+
transactionsRoot: string;
|
|
1012
|
+
/** Merkle root of state trie */
|
|
1013
|
+
stateRoot: string;
|
|
1014
|
+
/** Merkle root of receipts */
|
|
1015
|
+
receiptsRoot: string;
|
|
1016
|
+
/** Block miner/validator address */
|
|
1017
|
+
miner: string;
|
|
1018
|
+
/** Block difficulty (legacy PoW) */
|
|
1019
|
+
difficulty: string;
|
|
1020
|
+
/** Cumulative difficulty (legacy PoW) */
|
|
1021
|
+
totalDifficulty: string;
|
|
1022
|
+
/** Extra data included by miner */
|
|
1023
|
+
extraData: string;
|
|
1024
|
+
/** Block size in bytes (hex) */
|
|
1025
|
+
size: string;
|
|
1026
|
+
/** Maximum gas allowed in block (hex) */
|
|
1027
|
+
gasLimit: string;
|
|
1028
|
+
/** Total gas used by transactions (hex) */
|
|
1029
|
+
gasUsed: string;
|
|
1030
|
+
/** Block timestamp (hex, unix seconds) */
|
|
1031
|
+
timestamp: string;
|
|
1032
|
+
/** Uncle block hashes */
|
|
1033
|
+
uncles: string[];
|
|
1034
|
+
}
|
|
1035
|
+
|
|
1036
|
+
/**
|
|
1037
|
+
* Arguments for getUncle - either by block tag or block hash.
|
|
1038
|
+
*
|
|
1039
|
+
* @since 0.0.1
|
|
1040
|
+
*/
|
|
1041
|
+
export type GetUncleArgs =
|
|
1042
|
+
| {
|
|
1043
|
+
/** Block tag (latest, earliest, pending, safe, finalized, or hex number) */
|
|
1044
|
+
blockTag?: BlockTag;
|
|
1045
|
+
blockHash?: never;
|
|
1046
|
+
}
|
|
1047
|
+
| {
|
|
1048
|
+
/** Block hash to query */
|
|
1049
|
+
blockHash: HashInput;
|
|
1050
|
+
blockTag?: never;
|
|
1051
|
+
};
|
|
1052
|
+
|
|
1053
|
+
/**
|
|
1054
|
+
* Arguments for getUncleCount - either by block tag or block hash.
|
|
1055
|
+
*
|
|
1056
|
+
* @since 0.3.0
|
|
1057
|
+
*/
|
|
1058
|
+
export type GetUncleCountArgs =
|
|
1059
|
+
| {
|
|
1060
|
+
/** Block tag (latest, earliest, pending, safe, finalized, or hex number) */
|
|
1061
|
+
blockTag?: BlockTag;
|
|
1062
|
+
blockHash?: never;
|
|
1063
|
+
}
|
|
1064
|
+
| {
|
|
1065
|
+
/** Block hash to query */
|
|
1066
|
+
blockHash: HashInput;
|
|
1067
|
+
blockTag?: never;
|
|
1068
|
+
};
|
|
1069
|
+
|
|
1070
|
+
/**
|
|
1071
|
+
* Shape of the provider service.
|
|
1072
|
+
*
|
|
1073
|
+
* @description
|
|
1074
|
+
* Composition of the focused provider services (blocks, accounts, transactions,
|
|
1075
|
+
* simulation, events, network, streaming). Each method returns an Effect that may
|
|
1076
|
+
* fail with a method-specific error union (see the Get*Error type aliases), plus
|
|
1077
|
+
* TransportError for RPC failures.
|
|
1078
|
+
*
|
|
1079
|
+
* @since 0.0.1
|
|
1080
|
+
*/
|
|
1081
|
+
export type ProviderShape = BlocksShape &
|
|
1082
|
+
AccountShape &
|
|
1083
|
+
TransactionShape &
|
|
1084
|
+
SimulationShape &
|
|
1085
|
+
EventsShape &
|
|
1086
|
+
NetworkShape &
|
|
1087
|
+
StreamingShape;
|
|
1088
|
+
|
|
1089
|
+
/**
|
|
1090
|
+
* Provider service for read-only blockchain operations.
|
|
1091
|
+
*
|
|
1092
|
+
* @description
|
|
1093
|
+
* Provides methods for querying blocks, transactions, balances, and more.
|
|
1094
|
+
* This is an Effect Context.Tag that must be provided with a concrete
|
|
1095
|
+
* implementation (Provider layer) before running.
|
|
1096
|
+
*
|
|
1097
|
+
* The service provides all standard Ethereum JSON-RPC read methods:
|
|
1098
|
+
* - Block queries (getBlock, getBlockNumber, getBlockTransactionCount)
|
|
1099
|
+
* - Account queries (getBalance, getTransactionCount, getCode, getStorageAt)
|
|
1100
|
+
* - Transaction queries (getTransaction, getTransactionReceipt, waitForTransactionReceipt)
|
|
1101
|
+
* - Call simulation (call, estimateGas, createAccessList)
|
|
1102
|
+
* - Event queries (getLogs)
|
|
1103
|
+
* - Filter subscriptions (createEventFilter, createBlockFilter, createPendingTransactionFilter, getFilterChanges, getFilterLogs, uninstallFilter)
|
|
1104
|
+
* - Network info (getChainId, getGasPrice, getMaxPriorityFeePerGas, getFeeHistory)
|
|
1105
|
+
*
|
|
1106
|
+
* Requires TransportService to be provided for actual RPC communication.
|
|
1107
|
+
*
|
|
1108
|
+
* @since 0.0.1
|
|
1109
|
+
*
|
|
1110
|
+
* @example Basic usage with HttpTransport
|
|
1111
|
+
* ```typescript
|
|
1112
|
+
* import { Effect } from 'effect'
|
|
1113
|
+
* import { ProviderService, Provider, HttpTransport } from 'voltaire-effect'
|
|
1114
|
+
*
|
|
1115
|
+
* const program = Effect.gen(function* () {
|
|
1116
|
+
* const provider = yield* ProviderService
|
|
1117
|
+
* const blockNum = yield* provider.getBlockNumber()
|
|
1118
|
+
* const balance = yield* provider.getBalance('0x1234...')
|
|
1119
|
+
* return { blockNum, balance }
|
|
1120
|
+
* }).pipe(
|
|
1121
|
+
* Effect.provide(Provider),
|
|
1122
|
+
* Effect.provide(HttpTransport('https://mainnet.infura.io/v3/YOUR_KEY'))
|
|
1123
|
+
* )
|
|
1124
|
+
*
|
|
1125
|
+
* await Effect.runPromise(program)
|
|
1126
|
+
* ```
|
|
1127
|
+
*
|
|
1128
|
+
* @example Querying block and transaction data
|
|
1129
|
+
* ```typescript
|
|
1130
|
+
* import { Effect } from 'effect'
|
|
1131
|
+
* import { ProviderService, Provider, HttpTransport } from 'voltaire-effect'
|
|
1132
|
+
*
|
|
1133
|
+
* const program = Effect.gen(function* () {
|
|
1134
|
+
* const provider = yield* ProviderService
|
|
1135
|
+
*
|
|
1136
|
+
* // Get latest block with full transactions
|
|
1137
|
+
* const block = yield* provider.getBlock({
|
|
1138
|
+
* blockTag: 'latest',
|
|
1139
|
+
* includeTransactions: true
|
|
1140
|
+
* })
|
|
1141
|
+
*
|
|
1142
|
+
* // Get specific transaction
|
|
1143
|
+
* const tx = yield* provider.getTransaction('0x...')
|
|
1144
|
+
*
|
|
1145
|
+
* // Wait for transaction confirmation
|
|
1146
|
+
* const receipt = yield* provider.waitForTransactionReceipt('0x...', {
|
|
1147
|
+
* confirmations: 3,
|
|
1148
|
+
* timeout: 60000
|
|
1149
|
+
* })
|
|
1150
|
+
*
|
|
1151
|
+
* return { block, tx, receipt }
|
|
1152
|
+
* }).pipe(
|
|
1153
|
+
* Effect.provide(Provider),
|
|
1154
|
+
* Effect.provide(HttpTransport('https://...'))
|
|
1155
|
+
* )
|
|
1156
|
+
* ```
|
|
1157
|
+
*
|
|
1158
|
+
* @example Contract interaction (read-only)
|
|
1159
|
+
* ```typescript
|
|
1160
|
+
* import { Effect } from 'effect'
|
|
1161
|
+
* import { ProviderService, Provider, HttpTransport } from 'voltaire-effect'
|
|
1162
|
+
*
|
|
1163
|
+
* const program = Effect.gen(function* () {
|
|
1164
|
+
* const provider = yield* ProviderService
|
|
1165
|
+
*
|
|
1166
|
+
* // Call a view function
|
|
1167
|
+
* const result = yield* provider.call({
|
|
1168
|
+
* to: '0x1234...',
|
|
1169
|
+
* data: '0x...' // encoded function call
|
|
1170
|
+
* })
|
|
1171
|
+
*
|
|
1172
|
+
* // Estimate gas for a transaction
|
|
1173
|
+
* const gasEstimate = yield* provider.estimateGas({
|
|
1174
|
+
* to: '0x1234...',
|
|
1175
|
+
* data: '0x...',
|
|
1176
|
+
* value: 1000000000000000000n // 1 ETH
|
|
1177
|
+
* })
|
|
1178
|
+
*
|
|
1179
|
+
* return { result, gasEstimate }
|
|
1180
|
+
* }).pipe(
|
|
1181
|
+
* Effect.provide(Provider),
|
|
1182
|
+
* Effect.provide(HttpTransport('https://...'))
|
|
1183
|
+
* )
|
|
1184
|
+
* ```
|
|
1185
|
+
*
|
|
1186
|
+
* @example Querying event logs
|
|
1187
|
+
* ```typescript
|
|
1188
|
+
* import { Effect } from 'effect'
|
|
1189
|
+
* import { ProviderService, Provider, HttpTransport } from 'voltaire-effect'
|
|
1190
|
+
*
|
|
1191
|
+
* const program = Effect.gen(function* () {
|
|
1192
|
+
* const provider = yield* ProviderService
|
|
1193
|
+
*
|
|
1194
|
+
* // Get Transfer events from a token contract
|
|
1195
|
+
* const logs = yield* provider.getLogs({
|
|
1196
|
+
* address: '0x1234...',
|
|
1197
|
+
* topics: ['0xddf252ad...'], // Transfer event signature
|
|
1198
|
+
* fromBlock: '0x100000',
|
|
1199
|
+
* toBlock: 'latest'
|
|
1200
|
+
* })
|
|
1201
|
+
*
|
|
1202
|
+
* return logs
|
|
1203
|
+
* }).pipe(
|
|
1204
|
+
* Effect.provide(Provider),
|
|
1205
|
+
* Effect.provide(HttpTransport('https://...'))
|
|
1206
|
+
* )
|
|
1207
|
+
* ```
|
|
1208
|
+
*
|
|
1209
|
+
* @see {@link Provider} - The live implementation layer
|
|
1210
|
+
* @see {@link ProviderShape} - The service interface shape
|
|
1211
|
+
* @see {@link ProviderError} - Union of provider-specific errors
|
|
1212
|
+
* @see {@link TransportError} - Underlying transport failures
|
|
1213
|
+
* @see {@link TransportService} - Required dependency for RPC communication
|
|
1214
|
+
*/
|
|
1215
|
+
export class ProviderService extends Context.Tag("ProviderService")<
|
|
1216
|
+
ProviderService,
|
|
1217
|
+
ProviderShape
|
|
1218
|
+
>() {}
|