viem 0.0.0-portable-types-20230522163654 → 0.0.0-tmm-sign-typed-data-types.20230619T221425
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 +12 -0
- package/dist/cjs/actions/ens/getEnsAddress.js +34 -23
- package/dist/cjs/actions/ens/getEnsAddress.js.map +1 -1
- package/dist/cjs/actions/getContract.js +22 -16
- package/dist/cjs/actions/getContract.js.map +1 -1
- package/dist/cjs/actions/public/call.js +1 -1
- package/dist/cjs/actions/public/call.js.map +1 -1
- package/dist/cjs/actions/public/createContractEventFilter.js +2 -1
- package/dist/cjs/actions/public/createContractEventFilter.js.map +1 -1
- package/dist/cjs/actions/public/createEventFilter.js +2 -1
- package/dist/cjs/actions/public/createEventFilter.js.map +1 -1
- package/dist/cjs/actions/public/estimateContractGas.js +1 -1
- package/dist/cjs/actions/public/estimateContractGas.js.map +1 -1
- package/dist/cjs/actions/public/estimateGas.js +3 -2
- package/dist/cjs/actions/public/estimateGas.js.map +1 -1
- package/dist/cjs/actions/public/getBlock.js.map +1 -1
- package/dist/cjs/actions/public/getBlockTransactionCount.js +1 -1
- package/dist/cjs/actions/public/getBlockTransactionCount.js.map +1 -1
- package/dist/cjs/actions/public/getChainId.js +3 -1
- package/dist/cjs/actions/public/getChainId.js.map +1 -1
- package/dist/cjs/actions/public/getFilterChanges.js +15 -3
- package/dist/cjs/actions/public/getFilterChanges.js.map +1 -1
- package/dist/cjs/actions/public/getFilterLogs.js +14 -2
- package/dist/cjs/actions/public/getFilterLogs.js.map +1 -1
- package/dist/cjs/actions/public/getGasPrice.js.map +1 -1
- package/dist/cjs/actions/public/getLogs.js +15 -3
- package/dist/cjs/actions/public/getLogs.js.map +1 -1
- package/dist/cjs/actions/public/getTransactionCount.js.map +1 -1
- package/dist/cjs/actions/public/verifyTypedData.js +6 -1
- package/dist/cjs/actions/public/verifyTypedData.js.map +1 -1
- package/dist/cjs/actions/public/watchContractEvent.js +3 -1
- package/dist/cjs/actions/public/watchContractEvent.js.map +1 -1
- package/dist/cjs/actions/public/watchEvent.js +3 -1
- package/dist/cjs/actions/public/watchEvent.js.map +1 -1
- package/dist/cjs/actions/test/getAutomine.js +4 -0
- package/dist/cjs/actions/test/getAutomine.js.map +1 -1
- package/dist/cjs/actions/test/mine.js +10 -4
- package/dist/cjs/actions/test/mine.js.map +1 -1
- package/dist/cjs/actions/test/sendUnsignedTransaction.js +21 -3
- package/dist/cjs/actions/test/sendUnsignedTransaction.js.map +1 -1
- package/dist/cjs/actions/test/setAutomine.js +11 -4
- package/dist/cjs/actions/test/setAutomine.js.map +1 -1
- package/dist/cjs/actions/test/setBalance.js +10 -4
- package/dist/cjs/actions/test/setBalance.js.map +1 -1
- package/dist/cjs/actions/wallet/sendTransaction.js +1 -1
- package/dist/cjs/actions/wallet/sendTransaction.js.map +1 -1
- package/dist/cjs/actions/wallet/signMessage.js +8 -1
- package/dist/cjs/actions/wallet/signMessage.js.map +1 -1
- package/dist/cjs/chains.js +14 -2
- package/dist/cjs/chains.js.map +1 -1
- package/dist/cjs/clients/createClient.js +1 -1
- package/dist/cjs/clients/createClient.js.map +1 -1
- package/dist/cjs/clients/createPublicClient.js.map +1 -1
- package/dist/cjs/clients/createTestClient.js.map +1 -1
- package/dist/cjs/clients/createWalletClient.js.map +1 -1
- package/dist/cjs/clients/decorators/public.js.map +1 -1
- package/dist/cjs/clients/decorators/test.js.map +1 -1
- package/dist/cjs/clients/transports/createTransport.js.map +1 -1
- package/dist/cjs/clients/transports/custom.js.map +1 -1
- package/dist/cjs/clients/transports/fallback.js.map +1 -1
- package/dist/cjs/clients/transports/http.js +25 -7
- package/dist/cjs/clients/transports/http.js.map +1 -1
- package/dist/cjs/clients/transports/webSocket.js +22 -14
- package/dist/cjs/clients/transports/webSocket.js.map +1 -1
- package/dist/cjs/errors/abi.js +15 -1
- package/dist/cjs/errors/abi.js.map +1 -1
- package/dist/cjs/errors/base.js +4 -11
- package/dist/cjs/errors/base.js.map +1 -1
- package/dist/cjs/errors/request.js.map +1 -1
- package/dist/cjs/errors/rpc.js +8 -2
- package/dist/cjs/errors/rpc.js.map +1 -1
- package/dist/cjs/errors/version.js +1 -1
- package/dist/cjs/errors/version.js.map +1 -1
- package/dist/cjs/index.js +26 -10
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/eip1193.js +3 -3
- package/dist/cjs/types/eip1193.js.map +1 -1
- package/dist/cjs/utils/abi/decodeEventLog.js +33 -19
- package/dist/cjs/utils/abi/decodeEventLog.js.map +1 -1
- package/dist/cjs/utils/abi/encodeEventTopics.js +11 -7
- package/dist/cjs/utils/abi/encodeEventTopics.js.map +1 -1
- package/dist/cjs/utils/abi/getAbiItem.js +2 -0
- package/dist/cjs/utils/abi/getAbiItem.js.map +1 -1
- package/dist/cjs/utils/buildRequest.js.map +1 -1
- package/dist/cjs/utils/encoding/toBytes.js.map +1 -1
- package/dist/cjs/utils/encoding/toHex.js.map +1 -1
- package/dist/cjs/utils/ens/encodeLabelhash.js +8 -0
- package/dist/cjs/utils/ens/encodeLabelhash.js.map +1 -0
- package/dist/cjs/utils/ens/encodedLabelToLabelhash.js +18 -0
- package/dist/cjs/utils/ens/encodedLabelToLabelhash.js.map +1 -0
- package/dist/cjs/utils/ens/labelhash.js +2 -1
- package/dist/cjs/utils/ens/labelhash.js.map +1 -1
- package/dist/cjs/utils/ens/namehash.js +5 -1
- package/dist/cjs/utils/ens/namehash.js.map +1 -1
- package/dist/cjs/utils/ens/packetToBytes.js +10 -9
- package/dist/cjs/utils/ens/packetToBytes.js.map +1 -1
- package/dist/cjs/utils/filters/createFilterRequestScope.js.map +1 -1
- package/dist/cjs/utils/formatters/block.js +3 -1
- package/dist/cjs/utils/formatters/block.js.map +1 -1
- package/dist/cjs/utils/formatters/log.js +2 -2
- package/dist/cjs/utils/formatters/transaction.js +3 -1
- package/dist/cjs/utils/formatters/transaction.js.map +1 -1
- package/dist/cjs/utils/formatters/transactionReceipt.js +1 -1
- package/dist/cjs/utils/formatters/transactionReceipt.js.map +1 -1
- package/dist/cjs/utils/formatters/transactionRequest.js.map +1 -1
- package/dist/cjs/utils/hash/getEventSelector.js +5 -1
- package/dist/cjs/utils/hash/getEventSelector.js.map +1 -1
- package/dist/cjs/utils/hash/getFunctionSelector.js +5 -1
- package/dist/cjs/utils/hash/getFunctionSelector.js.map +1 -1
- package/dist/cjs/utils/hash/hashFunction.js +6 -4
- package/dist/cjs/utils/hash/hashFunction.js.map +1 -1
- package/dist/cjs/utils/index.js.map +1 -1
- package/dist/cjs/utils/observe.js.map +1 -1
- package/dist/cjs/utils/promise/createBatchScheduler.js.map +1 -1
- package/dist/cjs/utils/promise/withCache.js +8 -4
- package/dist/cjs/utils/promise/withCache.js.map +1 -1
- package/dist/cjs/utils/rpc.js +12 -17
- package/dist/cjs/utils/rpc.js.map +1 -1
- package/dist/cjs/utils/signature/hashMessage.js +7 -1
- package/dist/cjs/utils/signature/hashMessage.js.map +1 -1
- package/dist/cjs/utils/transaction/getTransactionType.js.map +1 -1
- package/dist/cjs/utils/transaction/prepareRequest.js +1 -2
- package/dist/cjs/utils/transaction/prepareRequest.js.map +1 -1
- package/dist/cjs/utils/transaction/serializeTransaction.js.map +1 -1
- package/dist/cjs/utils/typedData.js.map +1 -1
- package/dist/cjs/utils/unit/parseUnits.js +13 -3
- package/dist/cjs/utils/unit/parseUnits.js.map +1 -1
- package/dist/esm/accounts/generateMnemonic.js +7 -0
- package/dist/esm/accounts/generateMnemonic.js.map +1 -1
- package/dist/esm/accounts/generatePrivateKey.js +5 -0
- package/dist/esm/accounts/generatePrivateKey.js.map +1 -1
- package/dist/esm/accounts/hdKeyToAccount.js +5 -0
- package/dist/esm/accounts/hdKeyToAccount.js.map +1 -1
- package/dist/esm/accounts/mnemonicToAccount.js +5 -0
- package/dist/esm/accounts/mnemonicToAccount.js.map +1 -1
- package/dist/esm/accounts/privateKeyToAccount.js +5 -0
- package/dist/esm/accounts/privateKeyToAccount.js.map +1 -1
- package/dist/esm/accounts/toAccount.js +5 -0
- package/dist/esm/accounts/toAccount.js.map +1 -1
- package/dist/esm/accounts/utils/publicKeyToAddress.js +7 -0
- package/dist/esm/accounts/utils/publicKeyToAddress.js.map +1 -1
- package/dist/esm/accounts/utils/sign.js +8 -0
- package/dist/esm/accounts/utils/sign.js.map +1 -1
- package/dist/esm/accounts/utils/signMessage.js +6 -0
- package/dist/esm/accounts/utils/signMessage.js.map +1 -1
- package/dist/esm/accounts/utils/signTypedData.js +6 -0
- package/dist/esm/accounts/utils/signTypedData.js.map +1 -1
- package/dist/esm/actions/ens/getEnsAddress.js +62 -23
- package/dist/esm/actions/ens/getEnsAddress.js.map +1 -1
- package/dist/esm/actions/ens/getEnsAvatar.js +28 -0
- package/dist/esm/actions/ens/getEnsAvatar.js.map +1 -1
- package/dist/esm/actions/ens/getEnsName.js +27 -0
- package/dist/esm/actions/ens/getEnsName.js.map +1 -1
- package/dist/esm/actions/ens/getEnsResolver.js +28 -0
- package/dist/esm/actions/ens/getEnsResolver.js.map +1 -1
- package/dist/esm/actions/ens/getEnsText.js +29 -0
- package/dist/esm/actions/ens/getEnsText.js.map +1 -1
- package/dist/esm/actions/getContract.js +58 -16
- package/dist/esm/actions/getContract.js.map +1 -1
- package/dist/esm/actions/public/call.js +32 -1
- package/dist/esm/actions/public/call.js.map +1 -1
- package/dist/esm/actions/public/createBlockFilter.js +21 -0
- package/dist/esm/actions/public/createBlockFilter.js.map +1 -1
- package/dist/esm/actions/public/createContractEventFilter.js +24 -1
- package/dist/esm/actions/public/createContractEventFilter.js.map +1 -1
- package/dist/esm/actions/public/createEventFilter.js +25 -1
- package/dist/esm/actions/public/createEventFilter.js.map +1 -1
- package/dist/esm/actions/public/createPendingTransactionFilter.js +21 -0
- package/dist/esm/actions/public/createPendingTransactionFilter.js.map +1 -1
- package/dist/esm/actions/public/estimateContractGas.js +28 -1
- package/dist/esm/actions/public/estimateContractGas.js.map +1 -1
- package/dist/esm/actions/public/estimateGas.js +29 -2
- package/dist/esm/actions/public/estimateGas.js.map +1 -1
- package/dist/esm/actions/public/getBalance.js +35 -0
- package/dist/esm/actions/public/getBalance.js.map +1 -1
- package/dist/esm/actions/public/getBlock.js +24 -0
- package/dist/esm/actions/public/getBlock.js.map +1 -1
- package/dist/esm/actions/public/getBlockNumber.js +23 -0
- package/dist/esm/actions/public/getBlockNumber.js.map +1 -1
- package/dist/esm/actions/public/getBlockTransactionCount.js +24 -1
- package/dist/esm/actions/public/getBlockTransactionCount.js.map +1 -1
- package/dist/esm/actions/public/getBytecode.js +23 -0
- package/dist/esm/actions/public/getBytecode.js.map +1 -1
- package/dist/esm/actions/public/getChainId.js +24 -1
- package/dist/esm/actions/public/getChainId.js.map +1 -1
- package/dist/esm/actions/public/getFeeHistory.js +24 -0
- package/dist/esm/actions/public/getFeeHistory.js.map +1 -1
- package/dist/esm/actions/public/getFilterChanges.js +99 -3
- package/dist/esm/actions/public/getFilterChanges.js.map +1 -1
- package/dist/esm/actions/public/getFilterLogs.js +43 -2
- package/dist/esm/actions/public/getFilterLogs.js.map +1 -1
- package/dist/esm/actions/public/getGasPrice.js +20 -0
- package/dist/esm/actions/public/getGasPrice.js.map +1 -1
- package/dist/esm/actions/public/getLogs.js +39 -3
- package/dist/esm/actions/public/getLogs.js.map +1 -1
- package/dist/esm/actions/public/getStorageAt.js +24 -0
- package/dist/esm/actions/public/getStorageAt.js.map +1 -1
- package/dist/esm/actions/public/getTransaction.js +24 -0
- package/dist/esm/actions/public/getTransaction.js.map +1 -1
- package/dist/esm/actions/public/getTransactionConfirmations.js +24 -0
- package/dist/esm/actions/public/getTransactionConfirmations.js.map +1 -1
- package/dist/esm/actions/public/getTransactionCount.js +23 -0
- package/dist/esm/actions/public/getTransactionCount.js.map +1 -1
- package/dist/esm/actions/public/getTransactionReceipt.js +24 -0
- package/dist/esm/actions/public/getTransactionReceipt.js.map +1 -1
- package/dist/esm/actions/public/multicall.js +40 -0
- package/dist/esm/actions/public/multicall.js.map +1 -1
- package/dist/esm/actions/public/readContract.js +31 -0
- package/dist/esm/actions/public/readContract.js.map +1 -1
- package/dist/esm/actions/public/simulateContract.js +31 -0
- package/dist/esm/actions/public/simulateContract.js.map +1 -1
- package/dist/esm/actions/public/uninstallFilter.js +24 -0
- package/dist/esm/actions/public/uninstallFilter.js.map +1 -1
- package/dist/esm/actions/public/verifyHash.js +10 -0
- package/dist/esm/actions/public/verifyHash.js.map +1 -1
- package/dist/esm/actions/public/verifyMessage.js +11 -0
- package/dist/esm/actions/public/verifyMessage.js.map +1 -1
- package/dist/esm/actions/public/verifyTypedData.js +16 -2
- package/dist/esm/actions/public/verifyTypedData.js.map +1 -1
- package/dist/esm/actions/public/waitForTransactionReceipt.js +52 -0
- package/dist/esm/actions/public/waitForTransactionReceipt.js.map +1 -1
- package/dist/esm/actions/public/watchBlockNumber.js +31 -0
- package/dist/esm/actions/public/watchBlockNumber.js.map +1 -1
- package/dist/esm/actions/public/watchBlocks.js +35 -1
- package/dist/esm/actions/public/watchBlocks.js.map +1 -1
- package/dist/esm/actions/public/watchContractEvent.js +39 -1
- package/dist/esm/actions/public/watchContractEvent.js.map +1 -1
- package/dist/esm/actions/public/watchEvent.js +41 -1
- package/dist/esm/actions/public/watchEvent.js.map +1 -1
- package/dist/esm/actions/public/watchPendingTransactions.js +29 -0
- package/dist/esm/actions/public/watchPendingTransactions.js.map +1 -1
- package/dist/esm/actions/test/dropTransaction.js +22 -0
- package/dist/esm/actions/test/dropTransaction.js.map +1 -1
- package/dist/esm/actions/test/getAutomine.js +24 -0
- package/dist/esm/actions/test/getAutomine.js.map +1 -1
- package/dist/esm/actions/test/getTxpoolContent.js +20 -0
- package/dist/esm/actions/test/getTxpoolContent.js.map +1 -1
- package/dist/esm/actions/test/getTxpoolStatus.js +20 -0
- package/dist/esm/actions/test/getTxpoolStatus.js.map +1 -1
- package/dist/esm/actions/test/impersonateAccount.js +22 -0
- package/dist/esm/actions/test/impersonateAccount.js.map +1 -1
- package/dist/esm/actions/test/increaseTime.js +22 -0
- package/dist/esm/actions/test/increaseTime.js.map +1 -1
- package/dist/esm/actions/test/inspectTxpool.js +20 -0
- package/dist/esm/actions/test/inspectTxpool.js.map +1 -1
- package/dist/esm/actions/test/mine.js +30 -4
- package/dist/esm/actions/test/mine.js.map +1 -1
- package/dist/esm/actions/test/removeBlockTimestampInterval.js +19 -0
- package/dist/esm/actions/test/removeBlockTimestampInterval.js.map +1 -1
- package/dist/esm/actions/test/reset.js +20 -0
- package/dist/esm/actions/test/reset.js.map +1 -1
- package/dist/esm/actions/test/revert.js +20 -0
- package/dist/esm/actions/test/revert.js.map +1 -1
- package/dist/esm/actions/test/sendUnsignedTransaction.js +48 -4
- package/dist/esm/actions/test/sendUnsignedTransaction.js.map +1 -1
- package/dist/esm/actions/test/setAutomine.js +30 -4
- package/dist/esm/actions/test/setAutomine.js.map +1 -1
- package/dist/esm/actions/test/setBalance.js +33 -4
- package/dist/esm/actions/test/setBalance.js.map +1 -1
- package/dist/esm/actions/test/setBlockGasLimit.js +20 -0
- package/dist/esm/actions/test/setBlockGasLimit.js.map +1 -1
- package/dist/esm/actions/test/setBlockTimestampInterval.js +20 -0
- package/dist/esm/actions/test/setBlockTimestampInterval.js.map +1 -1
- package/dist/esm/actions/test/setCode.js +23 -0
- package/dist/esm/actions/test/setCode.js.map +1 -1
- package/dist/esm/actions/test/setCoinbase.js +22 -0
- package/dist/esm/actions/test/setCoinbase.js.map +1 -1
- package/dist/esm/actions/test/setIntervalMining.js +20 -0
- package/dist/esm/actions/test/setIntervalMining.js.map +1 -1
- package/dist/esm/actions/test/setLoggingEnabled.js +19 -0
- package/dist/esm/actions/test/setLoggingEnabled.js.map +1 -1
- package/dist/esm/actions/test/setMinGasPrice.js +24 -0
- package/dist/esm/actions/test/setMinGasPrice.js.map +1 -1
- package/dist/esm/actions/test/setNextBlockBaseFeePerGas.js +22 -0
- package/dist/esm/actions/test/setNextBlockBaseFeePerGas.js.map +1 -1
- package/dist/esm/actions/test/setNextBlockTimestamp.js +20 -0
- package/dist/esm/actions/test/setNextBlockTimestamp.js.map +1 -1
- package/dist/esm/actions/test/setNonce.js +23 -0
- package/dist/esm/actions/test/setNonce.js.map +1 -1
- package/dist/esm/actions/test/setRpcUrl.js +20 -0
- package/dist/esm/actions/test/setRpcUrl.js.map +1 -1
- package/dist/esm/actions/test/setStorageAt.js +24 -0
- package/dist/esm/actions/test/setStorageAt.js.map +1 -1
- package/dist/esm/actions/test/snapshot.js +19 -0
- package/dist/esm/actions/test/snapshot.js.map +1 -1
- package/dist/esm/actions/test/stopImpersonatingAccount.js +22 -0
- package/dist/esm/actions/test/stopImpersonatingAccount.js.map +1 -1
- package/dist/esm/actions/wallet/addChain.js +19 -0
- package/dist/esm/actions/wallet/addChain.js.map +1 -1
- package/dist/esm/actions/wallet/deployContract.js +27 -0
- package/dist/esm/actions/wallet/deployContract.js.map +1 -1
- package/dist/esm/actions/wallet/getAddresses.js +20 -0
- package/dist/esm/actions/wallet/getAddresses.js.map +1 -1
- package/dist/esm/actions/wallet/getPermissions.js +20 -0
- package/dist/esm/actions/wallet/getPermissions.js.map +1 -1
- package/dist/esm/actions/wallet/requestAddresses.js +24 -0
- package/dist/esm/actions/wallet/requestAddresses.js.map +1 -1
- package/dist/esm/actions/wallet/requestPermissions.js +23 -0
- package/dist/esm/actions/wallet/requestPermissions.js.map +1 -1
- package/dist/esm/actions/wallet/sendTransaction.js +48 -1
- package/dist/esm/actions/wallet/sendTransaction.js.map +1 -1
- package/dist/esm/actions/wallet/signMessage.js +55 -2
- package/dist/esm/actions/wallet/signMessage.js.map +1 -1
- package/dist/esm/actions/wallet/signTypedData.js +100 -0
- package/dist/esm/actions/wallet/signTypedData.js.map +1 -1
- package/dist/esm/actions/wallet/switchChain.js +20 -0
- package/dist/esm/actions/wallet/switchChain.js.map +1 -1
- package/dist/esm/actions/wallet/watchAsset.js +28 -0
- package/dist/esm/actions/wallet/watchAsset.js.map +1 -1
- package/dist/esm/actions/wallet/writeContract.js +50 -0
- package/dist/esm/actions/wallet/writeContract.js.map +1 -1
- package/dist/esm/chains.js +99 -87
- package/dist/esm/chains.js.map +1 -1
- package/dist/esm/clients/createClient.js +4 -1
- package/dist/esm/clients/createClient.js.map +1 -1
- package/dist/esm/clients/createPublicClient.js +19 -0
- package/dist/esm/clients/createPublicClient.js.map +1 -1
- package/dist/esm/clients/createTestClient.js +23 -0
- package/dist/esm/clients/createTestClient.js.map +1 -1
- package/dist/esm/clients/createWalletClient.js +36 -0
- package/dist/esm/clients/createWalletClient.js.map +1 -1
- package/dist/esm/clients/decorators/public.js.map +1 -1
- package/dist/esm/clients/decorators/test.js.map +1 -1
- package/dist/esm/clients/transports/createTransport.js +3 -0
- package/dist/esm/clients/transports/createTransport.js.map +1 -1
- package/dist/esm/clients/transports/custom.js +3 -0
- package/dist/esm/clients/transports/custom.js.map +1 -1
- package/dist/esm/clients/transports/fallback.js +11 -0
- package/dist/esm/clients/transports/fallback.js.map +1 -1
- package/dist/esm/clients/transports/http.js +31 -8
- package/dist/esm/clients/transports/http.js.map +1 -1
- package/dist/esm/clients/transports/webSocket.js +28 -15
- package/dist/esm/clients/transports/webSocket.js.map +1 -1
- package/dist/esm/constants/abis.js +6 -0
- package/dist/esm/constants/abis.js.map +1 -1
- package/dist/esm/constants/solidity.js +1 -0
- package/dist/esm/constants/solidity.js.map +1 -1
- package/dist/esm/contract.js +0 -1
- package/dist/esm/contract.js.map +1 -1
- package/dist/esm/errors/abi.js +15 -1
- package/dist/esm/errors/abi.js.map +1 -1
- package/dist/esm/errors/base.js +4 -11
- package/dist/esm/errors/base.js.map +1 -1
- package/dist/esm/errors/node.js +9 -0
- package/dist/esm/errors/node.js.map +1 -1
- package/dist/esm/errors/request.js.map +1 -1
- package/dist/esm/errors/rpc.js +111 -2
- package/dist/esm/errors/rpc.js.map +1 -1
- package/dist/esm/errors/version.js +1 -1
- package/dist/esm/errors/version.js.map +1 -1
- package/dist/esm/index.js +2 -51
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/package.json +1 -1
- package/dist/esm/types/account.js +1 -1
- package/dist/esm/types/account.js.map +1 -1
- package/dist/esm/types/eip1193.js +3 -1
- package/dist/esm/types/eip1193.js.map +1 -1
- package/dist/esm/utils/abi/decodeAbiParameters.js +29 -0
- package/dist/esm/utils/abi/decodeAbiParameters.js.map +1 -1
- package/dist/esm/utils/abi/decodeEventLog.js +35 -19
- package/dist/esm/utils/abi/decodeEventLog.js.map +1 -1
- package/dist/esm/utils/abi/encodeAbiParameters.js +10 -1
- package/dist/esm/utils/abi/encodeAbiParameters.js.map +1 -1
- package/dist/esm/utils/abi/encodeEventTopics.js +11 -7
- package/dist/esm/utils/abi/encodeEventTopics.js.map +1 -1
- package/dist/esm/utils/abi/getAbiItem.js +9 -0
- package/dist/esm/utils/abi/getAbiItem.js.map +1 -1
- package/dist/esm/utils/accounts.js +3 -0
- package/dist/esm/utils/accounts.js.map +1 -1
- package/dist/esm/utils/buildRequest.js +2 -0
- package/dist/esm/utils/buildRequest.js.map +1 -1
- package/dist/esm/utils/data/size.js +6 -0
- package/dist/esm/utils/data/size.js.map +1 -1
- package/dist/esm/utils/data/slice.js +21 -0
- package/dist/esm/utils/data/slice.js.map +1 -1
- package/dist/esm/utils/encoding/fromBytes.js +79 -0
- package/dist/esm/utils/encoding/fromBytes.js.map +1 -1
- package/dist/esm/utils/encoding/fromHex.js +106 -0
- package/dist/esm/utils/encoding/fromHex.js.map +1 -1
- package/dist/esm/utils/encoding/toBytes.js +102 -1
- package/dist/esm/utils/encoding/toBytes.js.map +1 -1
- package/dist/esm/utils/encoding/toHex.js +108 -2
- package/dist/esm/utils/encoding/toHex.js.map +1 -1
- package/dist/esm/utils/ens/avatar/parseAvatarRecord.js +6 -2
- package/dist/esm/utils/ens/avatar/parseAvatarRecord.js.map +1 -1
- package/dist/esm/utils/ens/avatar/utils.js +10 -0
- package/dist/esm/utils/ens/avatar/utils.js.map +1 -1
- package/dist/esm/utils/ens/encodeLabelhash.js +4 -0
- package/dist/esm/utils/ens/encodeLabelhash.js.map +1 -0
- package/dist/esm/utils/ens/encodedLabelToLabelhash.js +14 -0
- package/dist/esm/utils/ens/encodedLabelToLabelhash.js.map +1 -0
- package/dist/esm/utils/ens/labelhash.js +11 -1
- package/dist/esm/utils/ens/labelhash.js.map +1 -1
- package/dist/esm/utils/ens/namehash.js +18 -2
- package/dist/esm/utils/ens/namehash.js.map +1 -1
- package/dist/esm/utils/ens/normalize.js +10 -0
- package/dist/esm/utils/ens/normalize.js.map +1 -1
- package/dist/esm/utils/ens/packetToBytes.js +16 -9
- package/dist/esm/utils/ens/packetToBytes.js.map +1 -1
- package/dist/esm/utils/filters/createFilterRequestScope.js +5 -0
- package/dist/esm/utils/filters/createFilterRequestScope.js.map +1 -1
- package/dist/esm/utils/formatters/block.js +4 -1
- package/dist/esm/utils/formatters/block.js.map +1 -1
- package/dist/esm/utils/formatters/extract.js +3 -0
- package/dist/esm/utils/formatters/extract.js.map +1 -1
- package/dist/esm/utils/formatters/format.js +3 -0
- package/dist/esm/utils/formatters/format.js.map +1 -1
- package/dist/esm/utils/formatters/log.js +2 -2
- package/dist/esm/utils/formatters/transaction.js +3 -1
- package/dist/esm/utils/formatters/transaction.js.map +1 -1
- package/dist/esm/utils/formatters/transactionReceipt.js +2 -2
- package/dist/esm/utils/formatters/transactionReceipt.js.map +1 -1
- package/dist/esm/utils/formatters/transactionRequest.js +1 -1
- package/dist/esm/utils/formatters/transactionRequest.js.map +1 -1
- package/dist/esm/utils/hash/getEventSelector.js +6 -2
- package/dist/esm/utils/hash/getEventSelector.js.map +1 -1
- package/dist/esm/utils/hash/getFunctionSelector.js +6 -2
- package/dist/esm/utils/hash/getFunctionSelector.js.map +1 -1
- package/dist/esm/utils/hash/hashFunction.js +4 -3
- package/dist/esm/utils/hash/hashFunction.js.map +1 -1
- package/dist/esm/utils/index.js.map +1 -1
- package/dist/esm/utils/observe.js +7 -2
- package/dist/esm/utils/observe.js.map +1 -1
- package/dist/esm/utils/poll.js +3 -0
- package/dist/esm/utils/poll.js.map +1 -1
- package/dist/esm/utils/promise/createBatchScheduler.js +1 -1
- package/dist/esm/utils/promise/createBatchScheduler.js.map +1 -1
- package/dist/esm/utils/promise/withCache.js +23 -6
- package/dist/esm/utils/promise/withCache.js.map +1 -1
- package/dist/esm/utils/regex.js +4 -0
- package/dist/esm/utils/regex.js.map +1 -1
- package/dist/esm/utils/rpc.js +27 -19
- package/dist/esm/utils/rpc.js.map +1 -1
- package/dist/esm/utils/signature/hashMessage.js +8 -2
- package/dist/esm/utils/signature/hashMessage.js.map +1 -1
- package/dist/esm/utils/signature/hashTypedData.js +3 -0
- package/dist/esm/utils/signature/hashTypedData.js.map +1 -1
- package/dist/esm/utils/signature/recoverPublicKey.js +2 -0
- package/dist/esm/utils/signature/recoverPublicKey.js.map +1 -1
- package/dist/esm/utils/signature/verifyMessage.js +12 -0
- package/dist/esm/utils/signature/verifyMessage.js.map +1 -1
- package/dist/esm/utils/signature/verifyTypedData.js +12 -0
- package/dist/esm/utils/signature/verifyTypedData.js.map +1 -1
- package/dist/esm/utils/transaction/getTransactionType.js.map +1 -1
- package/dist/esm/utils/transaction/prepareRequest.js +5 -2
- package/dist/esm/utils/transaction/prepareRequest.js.map +1 -1
- package/dist/esm/utils/transaction/serializeTransaction.js +4 -2
- package/dist/esm/utils/transaction/serializeTransaction.js.map +1 -1
- package/dist/esm/utils/typedData.js +4 -0
- package/dist/esm/utils/typedData.js.map +1 -1
- package/dist/esm/utils/unit/parseUnits.js +15 -3
- package/dist/esm/utils/unit/parseUnits.js.map +1 -1
- package/dist/types/accounts/types.d.ts +3 -5
- package/dist/types/accounts/types.d.ts.map +1 -1
- package/dist/types/accounts/utils/signMessage.d.ts +2 -2
- package/dist/types/accounts/utils/signMessage.d.ts.map +1 -1
- package/dist/types/accounts/utils/signTypedData.d.ts +3 -6
- package/dist/types/accounts/utils/signTypedData.d.ts.map +1 -1
- package/dist/types/actions/ens/getEnsAddress.d.ts.map +1 -1
- package/dist/types/actions/getContract.d.ts +65 -21
- package/dist/types/actions/getContract.d.ts.map +1 -1
- package/dist/types/actions/public/createBlockFilter.d.ts +1 -1
- package/dist/types/actions/public/createContractEventFilter.d.ts +9 -4
- package/dist/types/actions/public/createContractEventFilter.d.ts.map +1 -1
- package/dist/types/actions/public/createEventFilter.d.ts +18 -6
- package/dist/types/actions/public/createEventFilter.d.ts.map +1 -1
- package/dist/types/actions/public/createPendingTransactionFilter.d.ts +1 -1
- package/dist/types/actions/public/estimateContractGas.d.ts +5 -3
- package/dist/types/actions/public/estimateContractGas.d.ts.map +1 -1
- package/dist/types/actions/public/estimateGas.d.ts.map +1 -1
- package/dist/types/actions/public/getBlockNumber.d.ts +2 -2
- package/dist/types/actions/public/getBlockNumber.d.ts.map +1 -1
- package/dist/types/actions/public/getChainId.d.ts.map +1 -1
- package/dist/types/actions/public/getFilterChanges.d.ts +8 -8
- package/dist/types/actions/public/getFilterChanges.d.ts.map +1 -1
- package/dist/types/actions/public/getFilterLogs.d.ts +4 -4
- package/dist/types/actions/public/getFilterLogs.d.ts.map +1 -1
- package/dist/types/actions/public/getLogs.d.ts +10 -4
- package/dist/types/actions/public/getLogs.d.ts.map +1 -1
- package/dist/types/actions/public/getTransaction.d.ts +1 -1
- package/dist/types/actions/public/getTransactionCount.d.ts +1 -1
- package/dist/types/actions/public/getTransactionReceipt.d.ts +1 -1
- package/dist/types/actions/public/multicall.d.ts +1 -1
- package/dist/types/actions/public/readContract.d.ts +2 -2
- package/dist/types/actions/public/readContract.d.ts.map +1 -1
- package/dist/types/actions/public/simulateContract.d.ts +2 -2
- package/dist/types/actions/public/uninstallFilter.d.ts +3 -3
- package/dist/types/actions/public/verifyMessage.d.ts +2 -2
- package/dist/types/actions/public/verifyMessage.d.ts.map +1 -1
- package/dist/types/actions/public/verifyTypedData.d.ts +3 -4
- package/dist/types/actions/public/verifyTypedData.d.ts.map +1 -1
- package/dist/types/actions/public/watchContractEvent.d.ts +11 -6
- package/dist/types/actions/public/watchContractEvent.d.ts.map +1 -1
- package/dist/types/actions/public/watchEvent.d.ts +13 -7
- package/dist/types/actions/public/watchEvent.d.ts.map +1 -1
- package/dist/types/actions/test/getAutomine.d.ts.map +1 -1
- package/dist/types/actions/test/mine.d.ts.map +1 -1
- package/dist/types/actions/test/sendUnsignedTransaction.d.ts +8 -2
- package/dist/types/actions/test/sendUnsignedTransaction.d.ts.map +1 -1
- package/dist/types/actions/test/setAutomine.d.ts.map +1 -1
- package/dist/types/actions/test/setBalance.d.ts.map +1 -1
- package/dist/types/actions/test/setBlockTimestampInterval.d.ts +1 -1
- package/dist/types/actions/test/stopImpersonatingAccount.d.ts +1 -1
- package/dist/types/actions/wallet/deployContract.d.ts +1 -1
- package/dist/types/actions/wallet/signMessage.d.ts +4 -4
- package/dist/types/actions/wallet/signMessage.d.ts.map +1 -1
- package/dist/types/actions/wallet/signTypedData.d.ts +4 -7
- package/dist/types/actions/wallet/signTypedData.d.ts.map +1 -1
- package/dist/types/actions/wallet/writeContract.d.ts +3 -3
- package/dist/types/chains.d.ts +364 -16
- package/dist/types/chains.d.ts.map +1 -1
- package/dist/types/clients/createClient.d.ts +5 -5
- package/dist/types/clients/createClient.d.ts.map +1 -1
- package/dist/types/clients/createPublicClient.d.ts +4 -4
- package/dist/types/clients/createPublicClient.d.ts.map +1 -1
- package/dist/types/clients/createTestClient.d.ts +4 -4
- package/dist/types/clients/createTestClient.d.ts.map +1 -1
- package/dist/types/clients/createWalletClient.d.ts +4 -4
- package/dist/types/clients/createWalletClient.d.ts.map +1 -1
- package/dist/types/clients/decorators/public.d.ts +30 -30
- package/dist/types/clients/decorators/public.d.ts.map +1 -1
- package/dist/types/clients/decorators/test.d.ts +3 -3
- package/dist/types/clients/decorators/test.d.ts.map +1 -1
- package/dist/types/clients/decorators/wallet.d.ts +7 -9
- package/dist/types/clients/decorators/wallet.d.ts.map +1 -1
- package/dist/types/clients/transports/createTransport.d.ts +5 -8
- package/dist/types/clients/transports/createTransport.d.ts.map +1 -1
- package/dist/types/clients/transports/custom.d.ts +2 -2
- package/dist/types/clients/transports/custom.d.ts.map +1 -1
- package/dist/types/clients/transports/http.d.ts +11 -0
- package/dist/types/clients/transports/http.d.ts.map +1 -1
- package/dist/types/clients/transports/webSocket.d.ts.map +1 -1
- package/dist/types/contract.d.ts +1 -1
- package/dist/types/contract.d.ts.map +1 -1
- package/dist/types/errors/abi.d.ts +6 -4
- package/dist/types/errors/abi.d.ts.map +1 -1
- package/dist/types/errors/base.d.ts +0 -1
- package/dist/types/errors/base.d.ts.map +1 -1
- package/dist/types/errors/request.d.ts +16 -8
- package/dist/types/errors/request.d.ts.map +1 -1
- package/dist/types/errors/rpc.d.ts +12 -8
- package/dist/types/errors/rpc.d.ts.map +1 -1
- package/dist/types/errors/version.d.ts +1 -1
- package/dist/types/errors/version.d.ts.map +1 -1
- package/dist/types/index.d.ts +56 -53
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/types/account.d.ts +1 -1
- package/dist/types/types/account.d.ts.map +1 -1
- package/dist/types/types/contract.d.ts +11 -6
- package/dist/types/types/contract.d.ts.map +1 -1
- package/dist/types/types/eip1193.d.ts +1048 -834
- package/dist/types/types/eip1193.d.ts.map +1 -1
- package/dist/types/types/filter.d.ts +12 -3
- package/dist/types/types/filter.d.ts.map +1 -1
- package/dist/types/types/log.d.ts +5 -3
- package/dist/types/types/log.d.ts.map +1 -1
- package/dist/types/types/misc.d.ts +4 -0
- package/dist/types/types/misc.d.ts.map +1 -1
- package/dist/types/types/rpc.d.ts +1 -1
- package/dist/types/types/rpc.d.ts.map +1 -1
- package/dist/types/types/transaction.d.ts +14 -5
- package/dist/types/types/transaction.d.ts.map +1 -1
- package/dist/types/types/typedData.d.ts +17 -29
- package/dist/types/types/typedData.d.ts.map +1 -1
- package/dist/types/types/utils.d.ts +11 -0
- package/dist/types/types/utils.d.ts.map +1 -1
- package/dist/types/utils/abi/decodeEventLog.d.ts +6 -5
- package/dist/types/utils/abi/decodeEventLog.d.ts.map +1 -1
- package/dist/types/utils/abi/encodeEventTopics.d.ts.map +1 -1
- package/dist/types/utils/abi/getAbiItem.d.ts.map +1 -1
- package/dist/types/utils/buildRequest.d.ts.map +1 -1
- package/dist/types/utils/ens/encodeLabelhash.d.ts +3 -0
- package/dist/types/utils/ens/encodeLabelhash.d.ts.map +1 -0
- package/dist/types/utils/ens/encodedLabelToLabelhash.d.ts +3 -0
- package/dist/types/utils/ens/encodedLabelToLabelhash.d.ts.map +1 -0
- package/dist/types/utils/ens/labelhash.d.ts.map +1 -1
- package/dist/types/utils/ens/namehash.d.ts.map +1 -1
- package/dist/types/utils/ens/packetToBytes.d.ts.map +1 -1
- package/dist/types/utils/filters/createFilterRequestScope.d.ts +6 -2
- package/dist/types/utils/filters/createFilterRequestScope.d.ts.map +1 -1
- package/dist/types/utils/formatters/block.d.ts.map +1 -1
- package/dist/types/utils/formatters/transaction.d.ts +1 -1
- package/dist/types/utils/formatters/transaction.d.ts.map +1 -1
- package/dist/types/utils/formatters/transactionReceipt.d.ts.map +1 -1
- package/dist/types/utils/hash/getEventSelector.d.ts +2 -1
- package/dist/types/utils/hash/getEventSelector.d.ts.map +1 -1
- package/dist/types/utils/hash/getFunctionSelector.d.ts +2 -1
- package/dist/types/utils/hash/getFunctionSelector.d.ts.map +1 -1
- package/dist/types/utils/hash/hashFunction.d.ts +2 -0
- package/dist/types/utils/hash/hashFunction.d.ts.map +1 -1
- package/dist/types/utils/index.d.ts +1 -1
- package/dist/types/utils/index.d.ts.map +1 -1
- package/dist/types/utils/observe.d.ts.map +1 -1
- package/dist/types/utils/promise/withCache.d.ts.map +1 -1
- package/dist/types/utils/rpc.d.ts +18 -10
- package/dist/types/utils/rpc.d.ts.map +1 -1
- package/dist/types/utils/signature/hashMessage.d.ts +2 -2
- package/dist/types/utils/signature/hashMessage.d.ts.map +1 -1
- package/dist/types/utils/signature/hashTypedData.d.ts +3 -6
- package/dist/types/utils/signature/hashTypedData.d.ts.map +1 -1
- package/dist/types/utils/signature/recoverMessageAddress.d.ts +2 -2
- package/dist/types/utils/signature/recoverMessageAddress.d.ts.map +1 -1
- package/dist/types/utils/signature/recoverTypedDataAddress.d.ts +3 -6
- package/dist/types/utils/signature/recoverTypedDataAddress.d.ts.map +1 -1
- package/dist/types/utils/signature/verifyTypedData.d.ts +3 -6
- package/dist/types/utils/signature/verifyTypedData.d.ts.map +1 -1
- package/dist/types/utils/transaction/getTransactionType.d.ts +2 -2
- package/dist/types/utils/transaction/getTransactionType.d.ts.map +1 -1
- package/dist/types/utils/transaction/prepareRequest.d.ts +1 -1
- package/dist/types/utils/transaction/prepareRequest.d.ts.map +1 -1
- package/dist/types/utils/typedData.d.ts +2 -3
- package/dist/types/utils/typedData.d.ts.map +1 -1
- package/dist/types/utils/unit/parseUnits.d.ts.map +1 -1
- package/package.json +7 -13
- package/src/accounts/types.ts +4 -4
- package/src/accounts/utils/signMessage.ts +2 -2
- package/src/accounts/utils/signTypedData.ts +4 -4
- package/src/actions/ens/getEnsAddress.ts +37 -22
- package/src/actions/getContract.ts +133 -69
- package/src/actions/public/call.ts +1 -1
- package/src/actions/public/createBlockFilter.ts +1 -1
- package/src/actions/public/createContractEventFilter.ts +22 -5
- package/src/actions/public/createEventFilter.ts +35 -14
- package/src/actions/public/createPendingTransactionFilter.ts +1 -1
- package/src/actions/public/estimateContractGas.ts +11 -5
- package/src/actions/public/estimateGas.ts +4 -3
- package/src/actions/public/getBlock.ts +2 -2
- package/src/actions/public/getBlockTransactionCount.ts +1 -1
- package/src/actions/public/getChainId.ts +3 -1
- package/src/actions/public/getFilterChanges.ts +36 -11
- package/src/actions/public/getFilterLogs.ts +34 -8
- package/src/actions/public/getGasPrice.ts +1 -1
- package/src/actions/public/getLogs.ts +39 -10
- package/src/actions/public/getTransaction.ts +1 -1
- package/src/actions/public/getTransactionCount.ts +2 -2
- package/src/actions/public/getTransactionReceipt.ts +1 -1
- package/src/actions/public/multicall.ts +1 -1
- package/src/actions/public/readContract.ts +2 -2
- package/src/actions/public/simulateContract.ts +2 -2
- package/src/actions/public/uninstallFilter.ts +3 -3
- package/src/actions/public/verifyMessage.ts +2 -2
- package/src/actions/public/verifyTypedData.ts +18 -6
- package/src/actions/public/watchContractEvent.ts +17 -5
- package/src/actions/public/watchEvent.ts +19 -6
- package/src/actions/test/getAutomine.ts +4 -0
- package/src/actions/test/mine.ts +10 -4
- package/src/actions/test/sendUnsignedTransaction.ts +54 -5
- package/src/actions/test/setAutomine.ts +8 -4
- package/src/actions/test/setBalance.ts +10 -4
- package/src/actions/test/setBlockTimestampInterval.ts +1 -1
- package/src/actions/test/stopImpersonatingAccount.ts +1 -1
- package/src/actions/wallet/deployContract.ts +1 -1
- package/src/actions/wallet/sendTransaction.ts +1 -1
- package/src/actions/wallet/signMessage.ts +13 -6
- package/src/actions/wallet/signTypedData.ts +5 -5
- package/src/actions/wallet/writeContract.ts +3 -3
- package/src/chains.ts +123 -88
- package/src/clients/createClient.ts +13 -11
- package/src/clients/createPublicClient.ts +4 -5
- package/src/clients/createTestClient.ts +4 -5
- package/src/clients/createWalletClient.ts +4 -5
- package/src/clients/decorators/public.ts +65 -39
- package/src/clients/decorators/test.ts +6 -5
- package/src/clients/decorators/wallet.ts +8 -8
- package/src/clients/transports/createTransport.ts +5 -9
- package/src/clients/transports/custom.ts +1 -2
- package/src/clients/transports/fallback.ts +1 -1
- package/src/clients/transports/http.ts +44 -7
- package/src/clients/transports/webSocket.ts +23 -15
- package/src/contract.ts +3 -3
- package/src/errors/abi.ts +16 -4
- package/src/errors/base.ts +6 -6
- package/src/errors/request.ts +4 -4
- package/src/errors/rpc.ts +43 -15
- package/src/errors/version.ts +1 -1
- package/src/index.ts +266 -247
- package/src/types/account.ts +9 -9
- package/src/types/contract.ts +33 -15
- package/src/types/eip1193.ts +1093 -839
- package/src/types/filter.ts +15 -3
- package/src/types/log.ts +13 -3
- package/src/types/misc.ts +6 -0
- package/src/types/rpc.ts +1 -1
- package/src/types/transaction.ts +24 -6
- package/src/types/typedData.ts +36 -45
- package/src/types/utils.ts +15 -0
- package/src/utils/abi/decodeEventLog.ts +47 -22
- package/src/utils/abi/encodeEventTopics.ts +16 -11
- package/src/utils/abi/getAbiItem.ts +1 -0
- package/src/utils/buildRequest.ts +5 -1
- package/src/utils/encoding/toBytes.ts +1 -1
- package/src/utils/encoding/toHex.ts +2 -2
- package/src/utils/ens/encodeLabelhash.ts +5 -0
- package/src/utils/ens/encodedLabelToLabelhash.ts +11 -0
- package/src/utils/ens/labelhash.ts +2 -1
- package/src/utils/ens/namehash.ts +6 -2
- package/src/utils/ens/packetToBytes.ts +12 -8
- package/src/utils/filters/createFilterRequestScope.ts +12 -4
- package/src/utils/formatters/block.ts +3 -1
- package/src/utils/formatters/log.ts +2 -2
- package/src/utils/formatters/transaction.ts +3 -1
- package/src/utils/formatters/transactionReceipt.ts +4 -2
- package/src/utils/formatters/transactionRequest.ts +1 -1
- package/src/utils/hash/getEventSelector.ts +6 -2
- package/src/utils/hash/getFunctionSelector.ts +6 -2
- package/src/utils/hash/hashFunction.ts +6 -2
- package/src/utils/index.ts +6 -0
- package/src/utils/observe.ts +2 -2
- package/src/utils/promise/createBatchScheduler.ts +1 -1
- package/src/utils/promise/withCache.ts +13 -11
- package/src/utils/rpc.ts +53 -53
- package/src/utils/signature/hashMessage.ts +8 -4
- package/src/utils/signature/hashTypedData.ts +4 -4
- package/src/utils/signature/recoverMessageAddress.ts +2 -2
- package/src/utils/signature/recoverTypedDataAddress.ts +4 -4
- package/src/utils/signature/verifyTypedData.ts +4 -4
- package/src/utils/transaction/getTransactionType.ts +10 -9
- package/src/utils/transaction/prepareRequest.ts +1 -2
- package/src/utils/transaction/serializeTransaction.ts +3 -3
- package/src/utils/typedData.ts +3 -3
- package/src/utils/unit/parseUnits.ts +15 -5
- package/dist/cjs/adapters/ethers.js +0 -49
- package/dist/cjs/adapters/ethers.js.map +0 -1
- package/dist/cjs/ethers.js +0 -6
- package/dist/cjs/ethers.js.map +0 -1
- package/dist/esm/adapters/ethers.js +0 -45
- package/dist/esm/adapters/ethers.js.map +0 -1
- package/dist/esm/ethers.js +0 -2
- package/dist/esm/ethers.js.map +0 -1
- package/dist/types/adapters/ethers.d.ts +0 -27
- package/dist/types/adapters/ethers.d.ts.map +0 -1
- package/dist/types/ethers.d.ts +0 -2
- package/dist/types/ethers.d.ts.map +0 -1
- package/ethers/package.json +0 -5
- package/src/adapters/ethers.ts +0 -94
- package/src/ethers.ts +0 -1
package/src/types/eip1193.ts
CHANGED
@@ -14,26 +14,25 @@ import type {
|
|
14
14
|
RpcTransactionRequest as TransactionRequest,
|
15
15
|
RpcUncle as Uncle,
|
16
16
|
} from './rpc.js'
|
17
|
+
import type { Prettify } from './utils.js'
|
17
18
|
|
18
19
|
//////////////////////////////////////////////////
|
19
20
|
// Provider
|
20
21
|
|
21
|
-
export type
|
22
|
+
export type EIP1474Methods = [...PublicRpcSchema, ...WalletRpcSchema]
|
23
|
+
|
24
|
+
export type EIP1193Provider = EIP1193Events & {
|
25
|
+
request: EIP1193RequestFn<EIP1474Methods>
|
26
|
+
}
|
22
27
|
|
23
28
|
//////////////////////////////////////////////////
|
24
29
|
// Errors
|
25
30
|
|
26
|
-
|
27
|
-
|
28
|
-
// https://eips.ethereum.org/EIPS/eip-1193#provider-errors
|
29
|
-
| 4_001 | 4_100 | 4_200 | 4_900 | 4_901
|
30
|
-
// https://eips.ethereum.org/EIPS/eip-1474#error-codes
|
31
|
-
| -32700 | -32600 | -32601 | -32602 | -32603 | -32000 | -32001 | -32002 | -32003 | -32004 | -32005 | -32006
|
32
|
-
export class RpcError extends Error {
|
33
|
-
code: RpcErrorCode | (number & {})
|
31
|
+
export class ProviderRpcError extends Error {
|
32
|
+
code: number
|
34
33
|
details: string
|
35
34
|
|
36
|
-
constructor(code:
|
35
|
+
constructor(code: number, message: string) {
|
37
36
|
super(message)
|
38
37
|
this.code = code
|
39
38
|
this.details = message
|
@@ -52,12 +51,12 @@ export type ProviderMessage = {
|
|
52
51
|
data: unknown
|
53
52
|
}
|
54
53
|
|
55
|
-
export type
|
54
|
+
export type EIP1193Events = {
|
56
55
|
on(
|
57
56
|
event: 'connect',
|
58
57
|
listener: (connectInfo: ProviderConnectInfo) => void,
|
59
58
|
): void
|
60
|
-
on(event: 'disconnect', listener: (error:
|
59
|
+
on(event: 'disconnect', listener: (error: ProviderRpcError) => void): void
|
61
60
|
on(event: 'chainChanged', listener: (chainId: string) => void): void
|
62
61
|
on(event: 'accountsChanged', listener: (accounts: string[]) => void): void
|
63
62
|
on(event: 'message', listener: (message: ProviderMessage) => void): void
|
@@ -66,7 +65,10 @@ export type Events = {
|
|
66
65
|
event: 'connect',
|
67
66
|
listener: (connectInfo: ProviderConnectInfo) => void,
|
68
67
|
): void
|
69
|
-
removeListener(
|
68
|
+
removeListener(
|
69
|
+
event: 'disconnect',
|
70
|
+
listener: (error: ProviderRpcError) => void,
|
71
|
+
): void
|
70
72
|
removeListener(
|
71
73
|
event: 'chainChanged',
|
72
74
|
listener: (chainId: string) => void,
|
@@ -84,7 +86,7 @@ export type Events = {
|
|
84
86
|
//////////////////////////////////////////////////
|
85
87
|
// Provider Requests
|
86
88
|
|
87
|
-
export type
|
89
|
+
export type AddEthereumChainParameter = {
|
88
90
|
/** A 0x-prefixed hexadecimal string */
|
89
91
|
chainId: string
|
90
92
|
/** The chain name. */
|
@@ -137,130 +139,153 @@ export type WatchAssetParams = {
|
|
137
139
|
}
|
138
140
|
}
|
139
141
|
|
140
|
-
export type
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
142
|
+
export type PublicRpcSchema = [
|
143
|
+
/**
|
144
|
+
* @description Returns the version of the current client
|
145
|
+
*
|
146
|
+
* @example
|
147
|
+
* provider.request({ method: 'web3_clientVersion' })
|
148
|
+
* // => 'MetaMask/v1.0.0'
|
149
|
+
*/
|
150
|
+
{
|
151
|
+
Method: 'web3_clientVersion'
|
152
|
+
Parameters?: never
|
153
|
+
ReturnType: string
|
154
|
+
},
|
155
|
+
/**
|
156
|
+
* @description Hashes data using the Keccak-256 algorithm
|
157
|
+
*
|
158
|
+
* @example
|
159
|
+
* provider.request({ method: 'web3_sha3', params: ['0x68656c6c6f20776f726c64'] })
|
160
|
+
* // => '0xc94770007dda54cF92009BFF0dE90c06F603a09f'
|
161
|
+
*/
|
162
|
+
{
|
163
|
+
Method: 'web3_sha3'
|
164
|
+
Parameters: [data: Hash]
|
165
|
+
ReturnType: string
|
166
|
+
},
|
167
|
+
/**
|
168
|
+
* @description Determines if this client is listening for new network connections
|
169
|
+
*
|
170
|
+
* @example
|
171
|
+
* provider.request({ method: 'net_listening' })
|
172
|
+
* // => true
|
173
|
+
*/
|
174
|
+
{
|
175
|
+
Method: 'net_listening'
|
176
|
+
Parameters?: never
|
177
|
+
ReturnType: boolean
|
178
|
+
},
|
179
|
+
/**
|
180
|
+
* @description Returns the number of peers currently connected to this client
|
181
|
+
*
|
182
|
+
* @example
|
183
|
+
* provider.request({ method: 'net_peerCount' })
|
184
|
+
* // => '0x1'
|
185
|
+
*/
|
186
|
+
{
|
187
|
+
Method: 'net_peerCount'
|
188
|
+
Parameters?: never
|
189
|
+
ReturnType: Quantity
|
190
|
+
},
|
191
|
+
/**
|
192
|
+
* @description Returns the chain ID associated with the current network
|
193
|
+
*
|
194
|
+
* @example
|
195
|
+
* provider.request({ method: 'net_version' })
|
196
|
+
* // => '1'
|
197
|
+
*/
|
198
|
+
{
|
199
|
+
Method: 'net_version'
|
200
|
+
Parameters?: never
|
201
|
+
ReturnType: Quantity
|
202
|
+
},
|
203
|
+
/**
|
204
|
+
* @description Returns the number of the most recent block seen by this client
|
205
|
+
*
|
206
|
+
* @example
|
207
|
+
* provider.request({ method: 'eth_blockNumber' })
|
208
|
+
* // => '0x1b4'
|
209
|
+
*/
|
210
|
+
{
|
211
|
+
Method: 'eth_blockNumber'
|
212
|
+
Parameters?: never
|
213
|
+
ReturnType: Quantity
|
214
|
+
},
|
215
|
+
/**
|
216
|
+
* @description Executes a new message call immediately without submitting a transaction to the network
|
217
|
+
*
|
218
|
+
* @example
|
219
|
+
* provider.request({ method: 'eth_call', params: [{ to: '0x...', data: '0x...' }] })
|
220
|
+
* // => '0x...'
|
221
|
+
*/
|
222
|
+
{
|
223
|
+
Method: 'eth_call'
|
224
|
+
Parameters:
|
225
|
+
| [transaction: Partial<TransactionRequest>]
|
226
|
+
| [
|
227
|
+
transaction: Partial<TransactionRequest>,
|
228
|
+
block: BlockNumber | BlockTag | BlockIdentifier,
|
229
|
+
]
|
230
|
+
ReturnType: Hex
|
231
|
+
},
|
232
|
+
/**
|
233
|
+
* @description Returns the chain ID associated with the current network
|
234
|
+
* @example
|
235
|
+
* provider.request({ method: 'eth_chainId' })
|
236
|
+
* // => '1'
|
237
|
+
*/
|
238
|
+
{
|
239
|
+
Method: 'eth_chainId'
|
240
|
+
Parameters?: never
|
241
|
+
ReturnType: Quantity
|
242
|
+
},
|
243
|
+
/**
|
244
|
+
* @description Returns the client coinbase address.
|
245
|
+
* @example
|
246
|
+
* provider.request({ method: 'eth_coinbase' })
|
247
|
+
* // => '0x...'
|
248
|
+
*/
|
249
|
+
{
|
250
|
+
Method: 'eth_coinbase'
|
251
|
+
Parameters?: never
|
252
|
+
ReturnType: Address
|
253
|
+
},
|
254
|
+
/**
|
255
|
+
* @description Estimates the gas necessary to complete a transaction without submitting it to the network
|
256
|
+
*
|
257
|
+
* @example
|
258
|
+
* provider.request({
|
259
|
+
* method: 'eth_estimateGas',
|
260
|
+
* params: [{ from: '0x...', to: '0x...', value: '0x...' }]
|
261
|
+
* })
|
262
|
+
* // => '0x5208'
|
263
|
+
*/
|
264
|
+
{
|
265
|
+
Method: 'eth_estimateGas'
|
266
|
+
Parameters:
|
267
|
+
| [transaction: TransactionRequest]
|
268
|
+
| [transaction: TransactionRequest, block: BlockNumber | BlockTag]
|
269
|
+
ReturnType: Quantity
|
270
|
+
},
|
271
|
+
/**
|
272
|
+
* @description Returns a collection of historical gas information
|
273
|
+
*
|
274
|
+
* @example
|
275
|
+
* provider.request({
|
276
|
+
* method: 'eth_feeHistory',
|
277
|
+
* params: ['4', 'latest', ['25', '75']]
|
278
|
+
* })
|
279
|
+
* // => {
|
280
|
+
* // oldestBlock: '0x1',
|
281
|
+
* // baseFeePerGas: ['0x1', '0x2', '0x3', '0x4'],
|
282
|
+
* // gasUsedRatio: ['0x1', '0x2', '0x3', '0x4'],
|
283
|
+
* // reward: [['0x1', '0x2'], ['0x3', '0x4'], ['0x5', '0x6'], ['0x7', '0x8']]
|
284
|
+
* // }
|
285
|
+
* */
|
286
|
+
{
|
287
|
+
Method: 'eth_feeHistory'
|
288
|
+
Parameters: [
|
264
289
|
/** Number of blocks in the requested range. Between 1 and 1024 blocks can be requested in a single query. Less than requested may be returned if not all blocks are available. */
|
265
290
|
blockCount: Quantity,
|
266
291
|
/** Highest number block of the requested range. */
|
@@ -268,137 +293,153 @@ export type PublicRequests = {
|
|
268
293
|
/** A monotonically increasing list of percentile values to sample from each block's effective priority fees per gas in ascending order, weighted by gas used. */
|
269
294
|
rewardPercentiles: number[] | undefined,
|
270
295
|
]
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
296
|
+
ReturnType: FeeHistory
|
297
|
+
},
|
298
|
+
/**
|
299
|
+
* @description Returns the current price of gas expressed in wei
|
300
|
+
*
|
301
|
+
* @example
|
302
|
+
* provider.request({ method: 'eth_gasPrice' })
|
303
|
+
* // => '0x09184e72a000'
|
304
|
+
*/
|
305
|
+
{
|
306
|
+
Method: 'eth_gasPrice'
|
307
|
+
Parameters?: never
|
308
|
+
ReturnType: Quantity
|
309
|
+
},
|
310
|
+
/**
|
311
|
+
* @description Returns the balance of an address in wei
|
312
|
+
*
|
313
|
+
* @example
|
314
|
+
* provider.request({ method: 'eth_getBalance', params: ['0x...', 'latest'] })
|
315
|
+
* // => '0x12a05...'
|
316
|
+
*/
|
317
|
+
{
|
318
|
+
Method: 'eth_getBalance'
|
319
|
+
Parameters: [
|
320
|
+
address: Address,
|
321
|
+
block: BlockNumber | BlockTag | BlockIdentifier,
|
322
|
+
]
|
323
|
+
ReturnType: Quantity
|
324
|
+
},
|
325
|
+
/**
|
326
|
+
* @description Returns information about a block specified by hash
|
327
|
+
* @link https://eips.ethereum.org/EIPS/eip-1474
|
328
|
+
* @example
|
329
|
+
* provider.request({ method: 'eth_getBlockByHash', params: ['0x...', true] })
|
330
|
+
* // => {
|
331
|
+
* // number: '0x1b4',
|
332
|
+
* // hash: '0x...',
|
333
|
+
* // parentHash: '0x...',
|
334
|
+
* // ...
|
335
|
+
* // }
|
336
|
+
*/
|
337
|
+
{
|
338
|
+
Method: 'eth_getBlockByHash'
|
339
|
+
Parameters: [
|
309
340
|
/** hash of a block */
|
310
341
|
hash: Hash,
|
311
342
|
/** true will pull full transaction objects, false will pull transaction hashes */
|
312
343
|
includeTransactionObjects: boolean,
|
313
344
|
]
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
345
|
+
ReturnType: Block | null
|
346
|
+
},
|
347
|
+
/**
|
348
|
+
* @description Returns information about a block specified by number
|
349
|
+
* @link https://eips.ethereum.org/EIPS/eip-1474
|
350
|
+
* @example
|
351
|
+
* provider.request({ method: 'eth_getBlockByNumber', params: ['0x1b4', true] })
|
352
|
+
* // => {
|
353
|
+
* // number: '0x1b4',
|
354
|
+
* // hash: '0x...',
|
355
|
+
* // parentHash: '0x...',
|
356
|
+
* // ...
|
357
|
+
* // }
|
358
|
+
*/
|
359
|
+
{
|
360
|
+
Method: 'eth_getBlockByNumber'
|
361
|
+
Parameters: [
|
330
362
|
/** block number, or one of "latest", "safe", "finalized", "earliest" or "pending" */
|
331
363
|
block: BlockNumber | BlockTag,
|
332
364
|
/** true will pull full transaction objects, false will pull transaction hashes */
|
333
365
|
includeTransactionObjects: boolean,
|
334
366
|
]
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
367
|
+
ReturnType: Block | null
|
368
|
+
},
|
369
|
+
/**
|
370
|
+
* @description Returns the number of transactions in a block specified by block hash
|
371
|
+
* @link https://eips.ethereum.org/EIPS/eip-1474
|
372
|
+
* @example
|
373
|
+
* provider.request({ method: 'eth_getBlockTransactionCountByHash', params: ['0x...'] })
|
374
|
+
* // => '0x1'
|
375
|
+
*/
|
376
|
+
{
|
377
|
+
Method: 'eth_getBlockTransactionCountByHash'
|
378
|
+
Parameters: [hash: Hash]
|
379
|
+
ReturnType: Quantity
|
380
|
+
},
|
381
|
+
/**
|
382
|
+
* @description Returns the number of transactions in a block specified by block number
|
383
|
+
* @link https://eips.ethereum.org/EIPS/eip-1474
|
384
|
+
* @example
|
385
|
+
* provider.request({ method: 'eth_getBlockTransactionCountByNumber', params: ['0x1b4'] })
|
386
|
+
* // => '0x1'
|
387
|
+
*/
|
388
|
+
{
|
389
|
+
Method: 'eth_getBlockTransactionCountByNumber'
|
390
|
+
Parameters: [block: BlockNumber | BlockTag]
|
391
|
+
ReturnType: Quantity
|
392
|
+
},
|
393
|
+
/**
|
394
|
+
* @description Returns the contract code stored at a given address
|
395
|
+
* @link https://eips.ethereum.org/EIPS/eip-1474
|
396
|
+
* @example
|
397
|
+
* provider.request({ method: 'eth_getCode', params: ['0x...', 'latest'] })
|
398
|
+
* // => '0x...'
|
399
|
+
*/
|
400
|
+
{
|
401
|
+
Method: 'eth_getCode'
|
402
|
+
Parameters: [
|
403
|
+
address: Address,
|
404
|
+
block: BlockNumber | BlockTag | BlockIdentifier,
|
405
|
+
]
|
406
|
+
ReturnType: Hex
|
407
|
+
},
|
408
|
+
/**
|
409
|
+
* @description Returns a list of all logs based on filter ID since the last log retrieval
|
410
|
+
* @link https://eips.ethereum.org/EIPS/eip-1474
|
411
|
+
* @example
|
412
|
+
* provider.request({ method: 'eth_getFilterChanges', params: ['0x...'] })
|
413
|
+
* // => [{ ... }, { ... }]
|
414
|
+
*/
|
415
|
+
{
|
416
|
+
Method: 'eth_getFilterChanges'
|
417
|
+
Parameters: [filterId: Quantity]
|
418
|
+
ReturnType: Log[] | Hex[]
|
419
|
+
},
|
420
|
+
/**
|
421
|
+
* @description Returns a list of all logs based on filter ID
|
422
|
+
* @link https://eips.ethereum.org/EIPS/eip-1474
|
423
|
+
* @example
|
424
|
+
* provider.request({ method: 'eth_getFilterLogs', params: ['0x...'] })
|
425
|
+
* // => [{ ... }, { ... }]
|
426
|
+
*/
|
427
|
+
{
|
428
|
+
Method: 'eth_getFilterLogs'
|
429
|
+
Parameters: [filterId: Quantity]
|
430
|
+
ReturnType: Log[]
|
431
|
+
},
|
432
|
+
/**
|
433
|
+
* @description Returns a list of all logs based on a filter object
|
434
|
+
* @link https://eips.ethereum.org/EIPS/eip-1474
|
435
|
+
* @example
|
436
|
+
* provider.request({ method: 'eth_getLogs', params: [{ fromBlock: '0x...', toBlock: '0x...', address: '0x...', topics: ['0x...'] }] })
|
437
|
+
* // => [{ ... }, { ... }]
|
438
|
+
*/
|
439
|
+
{
|
440
|
+
Method: 'eth_getLogs'
|
441
|
+
Parameters: [
|
442
|
+
{
|
402
443
|
address?: Address | Address[]
|
403
444
|
topics?: LogTopic[]
|
404
445
|
} & (
|
@@ -414,142 +455,157 @@ export type PublicRequests = {
|
|
414
455
|
}
|
415
456
|
),
|
416
457
|
]
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
458
|
+
ReturnType: Log[]
|
459
|
+
},
|
460
|
+
/**
|
461
|
+
* @description Returns the value from a storage position at an address
|
462
|
+
* @link https://eips.ethereum.org/EIPS/eip-1474
|
463
|
+
* @example
|
464
|
+
* provider.request({ method: 'eth_getStorageAt', params: ['0x...', '0x...', 'latest'] })
|
465
|
+
* // => '0x...'
|
466
|
+
*/
|
467
|
+
{
|
468
|
+
Method: 'eth_getStorageAt'
|
469
|
+
Parameters: [
|
428
470
|
address: Address,
|
429
471
|
index: Quantity,
|
430
472
|
block: BlockNumber | BlockTag | BlockIdentifier,
|
431
473
|
]
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
|
510
|
-
|
511
|
-
|
512
|
-
|
513
|
-
|
514
|
-
|
515
|
-
|
516
|
-
|
517
|
-
|
518
|
-
|
519
|
-
|
520
|
-
}
|
521
|
-
|
522
|
-
|
523
|
-
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
|
532
|
-
|
533
|
-
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
|
538
|
-
|
539
|
-
|
540
|
-
|
541
|
-
|
542
|
-
|
543
|
-
|
544
|
-
|
545
|
-
|
546
|
-
|
547
|
-
|
548
|
-
|
549
|
-
|
550
|
-
|
551
|
-
|
552
|
-
|
474
|
+
ReturnType: Hex
|
475
|
+
},
|
476
|
+
/**
|
477
|
+
* @description Returns information about a transaction specified by block hash and transaction index
|
478
|
+
* @link https://eips.ethereum.org/EIPS/eip-1474
|
479
|
+
* @example
|
480
|
+
* provider.request({ method: 'eth_getTransactionByBlockHashAndIndex', params: ['0x...', '0x...'] })
|
481
|
+
* // => { ... }
|
482
|
+
*/
|
483
|
+
{
|
484
|
+
Method: 'eth_getTransactionByBlockHashAndIndex'
|
485
|
+
Parameters: [hash: Hash, index: Quantity]
|
486
|
+
ReturnType: Transaction | null
|
487
|
+
},
|
488
|
+
/**
|
489
|
+
* @description Returns information about a transaction specified by block number and transaction index
|
490
|
+
* @link https://eips.ethereum.org/EIPS/eip-1474
|
491
|
+
* @example
|
492
|
+
* provider.request({ method: 'eth_getTransactionByBlockNumberAndIndex', params: ['0x...', '0x...'] })
|
493
|
+
* // => { ... }
|
494
|
+
*/
|
495
|
+
{
|
496
|
+
Method: 'eth_getTransactionByBlockNumberAndIndex'
|
497
|
+
Parameters: [block: BlockNumber | BlockTag, index: Quantity]
|
498
|
+
ReturnType: Transaction | null
|
499
|
+
},
|
500
|
+
/**
|
501
|
+
* @description Returns information about a transaction specified by hash
|
502
|
+
* @link https://eips.ethereum.org/EIPS/eip-1474
|
503
|
+
* @example
|
504
|
+
* provider.request({ method: 'eth_getTransactionByHash', params: ['0x...'] })
|
505
|
+
* // => { ... }
|
506
|
+
*/
|
507
|
+
{
|
508
|
+
Method: 'eth_getTransactionByHash'
|
509
|
+
Parameters: [hash: Hash]
|
510
|
+
ReturnType: Transaction | null
|
511
|
+
},
|
512
|
+
/**
|
513
|
+
* @description Returns the number of transactions sent from an address
|
514
|
+
* @link https://eips.ethereum.org/EIPS/eip-1474
|
515
|
+
* @example
|
516
|
+
* provider.request({ method: 'eth_getTransactionCount', params: ['0x...', 'latest'] })
|
517
|
+
* // => '0x1'
|
518
|
+
*/
|
519
|
+
{
|
520
|
+
Method: 'eth_getTransactionCount'
|
521
|
+
Parameters: [
|
522
|
+
address: Address,
|
523
|
+
block: BlockNumber | BlockTag | BlockIdentifier,
|
524
|
+
]
|
525
|
+
ReturnType: Quantity
|
526
|
+
},
|
527
|
+
/**
|
528
|
+
* @description Returns the receipt of a transaction specified by hash
|
529
|
+
* @link https://eips.ethereum.org/EIPS/eip-1474
|
530
|
+
* @example
|
531
|
+
* provider.request({ method: 'eth_getTransactionReceipt', params: ['0x...'] })
|
532
|
+
* // => { ... }
|
533
|
+
*/
|
534
|
+
{
|
535
|
+
Method: 'eth_getTransactionReceipt'
|
536
|
+
Parameters: [hash: Hash]
|
537
|
+
ReturnType: TransactionReceipt | null
|
538
|
+
},
|
539
|
+
/**
|
540
|
+
* @description Returns information about an uncle specified by block hash and uncle index position
|
541
|
+
* @link https://eips.ethereum.org/EIPS/eip-1474
|
542
|
+
* @example
|
543
|
+
* provider.request({ method: 'eth_getUncleByBlockHashAndIndex', params: ['0x...', '0x...'] })
|
544
|
+
* // => { ... }
|
545
|
+
*/
|
546
|
+
{
|
547
|
+
Method: 'eth_getUncleByBlockHashAndIndex'
|
548
|
+
Parameters: [hash: Hash, index: Quantity]
|
549
|
+
ReturnType: Uncle | null
|
550
|
+
},
|
551
|
+
/**
|
552
|
+
* @description Returns information about an uncle specified by block number and uncle index position
|
553
|
+
* @link https://eips.ethereum.org/EIPS/eip-1474
|
554
|
+
* @example
|
555
|
+
* provider.request({ method: 'eth_getUncleByBlockNumberAndIndex', params: ['0x...', '0x...'] })
|
556
|
+
* // => { ... }
|
557
|
+
*/
|
558
|
+
{
|
559
|
+
Method: 'eth_getUncleByBlockNumberAndIndex'
|
560
|
+
Parameters: [block: BlockNumber | BlockTag, index: Quantity]
|
561
|
+
ReturnType: Uncle | null
|
562
|
+
},
|
563
|
+
/**
|
564
|
+
* @description Returns the number of uncles in a block specified by block hash
|
565
|
+
* @link https://eips.ethereum.org/EIPS/eip-1474
|
566
|
+
* @example
|
567
|
+
* provider.request({ method: 'eth_getUncleCountByBlockHash', params: ['0x...'] })
|
568
|
+
* // => '0x1'
|
569
|
+
*/
|
570
|
+
{
|
571
|
+
Method: 'eth_getUncleCountByBlockHash'
|
572
|
+
Parameters: [hash: Hash]
|
573
|
+
ReturnType: Quantity
|
574
|
+
},
|
575
|
+
/**
|
576
|
+
* @description Returns the number of uncles in a block specified by block number
|
577
|
+
* @link https://eips.ethereum.org/EIPS/eip-1474
|
578
|
+
* @example
|
579
|
+
* provider.request({ method: 'eth_getUncleCountByBlockNumber', params: ['0x...'] })
|
580
|
+
* // => '0x1'
|
581
|
+
*/
|
582
|
+
{
|
583
|
+
Method: 'eth_getUncleCountByBlockNumber'
|
584
|
+
Parameters: [block: BlockNumber | BlockTag]
|
585
|
+
ReturnType: Quantity
|
586
|
+
},
|
587
|
+
/**
|
588
|
+
* @description Creates a filter to listen for new blocks that can be used with `eth_getFilterChanges`
|
589
|
+
* @link https://eips.ethereum.org/EIPS/eip-1474
|
590
|
+
* @example
|
591
|
+
* provider.request({ method: 'eth_newBlockFilter' })
|
592
|
+
* // => '0x1'
|
593
|
+
*/
|
594
|
+
{
|
595
|
+
Method: 'eth_newBlockFilter'
|
596
|
+
Parameters?: never
|
597
|
+
ReturnType: Quantity
|
598
|
+
},
|
599
|
+
/**
|
600
|
+
* @description Creates a filter to listen for specific state changes that can then be used with `eth_getFilterChanges`
|
601
|
+
* @link https://eips.ethereum.org/EIPS/eip-1474
|
602
|
+
* @example
|
603
|
+
* provider.request({ method: 'eth_newFilter', params: [{ fromBlock: '0x...', toBlock: '0x...', address: '0x...', topics: ['0x...'] }] })
|
604
|
+
* // => '0x1'
|
605
|
+
*/
|
606
|
+
{
|
607
|
+
Method: 'eth_newFilter'
|
608
|
+
Parameters: [
|
553
609
|
filter: {
|
554
610
|
fromBlock?: BlockNumber | BlockTag
|
555
611
|
toBlock?: BlockNumber | BlockTag
|
@@ -557,204 +613,222 @@ export type PublicRequests = {
|
|
557
613
|
topics?: LogTopic[]
|
558
614
|
},
|
559
615
|
]
|
560
|
-
|
561
|
-
|
562
|
-
|
563
|
-
|
564
|
-
|
565
|
-
|
566
|
-
|
567
|
-
|
568
|
-
|
569
|
-
|
570
|
-
|
571
|
-
|
572
|
-
|
573
|
-
|
574
|
-
|
575
|
-
|
576
|
-
|
577
|
-
|
578
|
-
|
579
|
-
|
580
|
-
|
581
|
-
|
582
|
-
|
583
|
-
|
584
|
-
|
585
|
-
|
586
|
-
|
587
|
-
|
588
|
-
|
589
|
-
|
590
|
-
|
591
|
-
|
592
|
-
|
593
|
-
|
594
|
-
|
595
|
-
|
596
|
-
|
597
|
-
|
598
|
-
|
599
|
-
|
600
|
-
|
601
|
-
|
602
|
-
|
603
|
-
|
604
|
-
|
605
|
-
|
606
|
-
|
607
|
-
|
608
|
-
|
616
|
+
ReturnType: Quantity
|
617
|
+
},
|
618
|
+
/**
|
619
|
+
* @description Creates a filter to listen for new pending transactions that can be used with `eth_getFilterChanges`
|
620
|
+
* @link https://eips.ethereum.org/EIPS/eip-1474
|
621
|
+
* @example
|
622
|
+
* provider.request({ method: 'eth_newPendingTransactionFilter' })
|
623
|
+
* // => '0x1'
|
624
|
+
*/
|
625
|
+
{
|
626
|
+
Method: 'eth_newPendingTransactionFilter'
|
627
|
+
Parameters?: never
|
628
|
+
ReturnType: Quantity
|
629
|
+
},
|
630
|
+
/**
|
631
|
+
* @description Returns the current Ethereum protocol version
|
632
|
+
* @link https://eips.ethereum.org/EIPS/eip-1474
|
633
|
+
* @example
|
634
|
+
* provider.request({ method: 'eth_protocolVersion' })
|
635
|
+
* // => '54'
|
636
|
+
*/
|
637
|
+
{
|
638
|
+
Method: 'eth_protocolVersion'
|
639
|
+
Parameters?: never
|
640
|
+
ReturnType: string
|
641
|
+
},
|
642
|
+
/**
|
643
|
+
* @description Sends and already-signed transaction to the network
|
644
|
+
* @link https://eips.ethereum.org/EIPS/eip-1474
|
645
|
+
* @example
|
646
|
+
* provider.request({ method: 'eth_sendRawTransaction', params: ['0x...'] })
|
647
|
+
* // => '0x...'
|
648
|
+
*/
|
649
|
+
{
|
650
|
+
Method: 'eth_sendRawTransaction'
|
651
|
+
Parameters: [signedTransaction: Hex]
|
652
|
+
ReturnType: Hash
|
653
|
+
},
|
654
|
+
/**
|
655
|
+
* @description Destroys a filter based on filter ID
|
656
|
+
* @link https://eips.ethereum.org/EIPS/eip-1474
|
657
|
+
* @example
|
658
|
+
* provider.request({ method: 'eth_uninstallFilter', params: ['0x1'] })
|
659
|
+
* // => true
|
660
|
+
*/
|
661
|
+
{
|
662
|
+
Method: 'eth_uninstallFilter'
|
663
|
+
Parameters: [filterId: Quantity]
|
664
|
+
ReturnType: boolean
|
665
|
+
},
|
666
|
+
]
|
609
667
|
|
610
|
-
export type
|
611
|
-
|
612
|
-
|
613
|
-
|
614
|
-
|
615
|
-
|
616
|
-
|
617
|
-
|
618
|
-
|
619
|
-
|
620
|
-
|
621
|
-
|
622
|
-
|
623
|
-
|
624
|
-
|
625
|
-
|
626
|
-
|
627
|
-
|
628
|
-
|
629
|
-
|
630
|
-
|
631
|
-
|
632
|
-
|
633
|
-
|
634
|
-
|
635
|
-
|
636
|
-
|
637
|
-
|
638
|
-
|
639
|
-
|
640
|
-
|
641
|
-
|
642
|
-
|
643
|
-
|
644
|
-
|
645
|
-
|
646
|
-
|
647
|
-
|
648
|
-
|
649
|
-
|
650
|
-
|
651
|
-
|
652
|
-
|
653
|
-
|
654
|
-
|
655
|
-
|
668
|
+
export type TestRpcSchema<TMode extends string> = [
|
669
|
+
/**
|
670
|
+
* @description Add information about compiled contracts
|
671
|
+
* @link https://hardhat.org/hardhat-network/docs/reference#hardhat_addcompilationresult
|
672
|
+
*/
|
673
|
+
{
|
674
|
+
Method: `${TMode}_addCompilationResult`
|
675
|
+
Parameters: any[]
|
676
|
+
ReturnType: any
|
677
|
+
},
|
678
|
+
/**
|
679
|
+
* @description Remove a transaction from the mempool
|
680
|
+
* @link https://hardhat.org/hardhat-network/docs/reference#hardhat_droptransaction
|
681
|
+
*/
|
682
|
+
{
|
683
|
+
Method: `${TMode}_dropTransaction`
|
684
|
+
Parameters: [hash: Hash]
|
685
|
+
ReturnType: void
|
686
|
+
},
|
687
|
+
/**
|
688
|
+
* @description Turn on call traces for transactions that are returned to the user when they execute a transaction (instead of just txhash/receipt).
|
689
|
+
*/
|
690
|
+
{
|
691
|
+
Method: `${TMode}_enableTraces`
|
692
|
+
Parameters?: never
|
693
|
+
ReturnType: void
|
694
|
+
},
|
695
|
+
/**
|
696
|
+
* @description Impersonate an account or contract address.
|
697
|
+
* @link https://hardhat.org/hardhat-network/docs/reference#hardhat_impersonateaccount
|
698
|
+
*/
|
699
|
+
{
|
700
|
+
Method: `${TMode}_impersonateAccount`
|
701
|
+
Parameters: [address: Address]
|
702
|
+
ReturnType: void
|
703
|
+
},
|
704
|
+
/**
|
705
|
+
* @description Returns true if automatic mining is enabled, and false otherwise. See [Mining Modes](https://hardhat.org/hardhat-network/explanation/mining-modes) to learn more.
|
706
|
+
* @link https://hardhat.org/hardhat-network/docs/reference#hardhat_getautomine
|
707
|
+
*/
|
708
|
+
{
|
709
|
+
Method: `${TMode}_getAutomine`
|
710
|
+
Parameters?: never
|
711
|
+
ReturnType: boolean
|
712
|
+
},
|
713
|
+
/**
|
714
|
+
* @description Advance the block number of the network by a certain number of blocks
|
715
|
+
* @link https://hardhat.org/hardhat-network/docs/reference#hardhat_mine
|
716
|
+
*/
|
717
|
+
{
|
718
|
+
Method: `${TMode}_mine`
|
719
|
+
Parameters: [
|
656
720
|
/** Number of blocks to mine. */
|
657
721
|
count: Hex,
|
658
722
|
/** Interval between each block in seconds. */
|
659
723
|
interval: Hex | undefined,
|
660
724
|
]
|
661
|
-
|
662
|
-
|
663
|
-
|
664
|
-
|
665
|
-
|
666
|
-
|
667
|
-
|
668
|
-
|
669
|
-
|
670
|
-
|
671
|
-
|
672
|
-
|
673
|
-
|
674
|
-
|
675
|
-
|
676
|
-
|
725
|
+
ReturnType: void
|
726
|
+
},
|
727
|
+
/**
|
728
|
+
* @description Resets the fork.
|
729
|
+
* @link https://hardhat.org/hardhat-network/docs/reference#hardhat_reset
|
730
|
+
*/
|
731
|
+
{
|
732
|
+
Method: `${TMode}_reset`
|
733
|
+
Parameters: any[]
|
734
|
+
ReturnType: void
|
735
|
+
},
|
736
|
+
/**
|
737
|
+
* @description Modifies the balance of an account.
|
738
|
+
* @link https://hardhat.org/hardhat-network/docs/reference#hardhat_setbalance
|
739
|
+
*/
|
740
|
+
{
|
741
|
+
Method: `${TMode}_setBalance`
|
742
|
+
Parameters: [
|
677
743
|
/** The address of the target account. */
|
678
744
|
address: Address,
|
679
745
|
/** Amount to send in wei. */
|
680
|
-
|
746
|
+
balance: Quantity,
|
681
747
|
]
|
682
|
-
|
683
|
-
|
684
|
-
|
685
|
-
|
686
|
-
|
687
|
-
|
688
|
-
|
689
|
-
|
748
|
+
ReturnType: void
|
749
|
+
},
|
750
|
+
/**
|
751
|
+
* @description Modifies the bytecode stored at an account's address.
|
752
|
+
* @link https://hardhat.org/hardhat-network/docs/reference#hardhat_setcode
|
753
|
+
*/
|
754
|
+
{
|
755
|
+
Method: `${TMode}_setCode`
|
756
|
+
Parameters: [
|
690
757
|
/** The address of the contract. */
|
691
758
|
address: Address,
|
692
759
|
/** Data bytecode. */
|
693
760
|
data: string,
|
694
761
|
]
|
695
|
-
|
696
|
-
|
697
|
-
|
698
|
-
|
699
|
-
|
700
|
-
|
701
|
-
|
702
|
-
|
762
|
+
ReturnType: void
|
763
|
+
},
|
764
|
+
/**
|
765
|
+
* @description Sets the coinbase address to be used in new blocks.
|
766
|
+
* @link https://hardhat.org/hardhat-network/docs/reference#hardhat_setcoinbase
|
767
|
+
*/
|
768
|
+
{
|
769
|
+
Method: `${TMode}_setCoinbase`
|
770
|
+
Parameters: [
|
703
771
|
/** The address to set as the coinbase address. */
|
704
772
|
address: Address,
|
705
773
|
]
|
706
|
-
|
707
|
-
|
708
|
-
|
709
|
-
|
710
|
-
|
711
|
-
|
712
|
-
|
713
|
-
|
714
|
-
|
715
|
-
|
716
|
-
|
717
|
-
|
718
|
-
|
719
|
-
|
720
|
-
|
721
|
-
|
722
|
-
|
723
|
-
|
724
|
-
|
725
|
-
|
726
|
-
|
727
|
-
|
728
|
-
|
729
|
-
|
730
|
-
|
731
|
-
|
732
|
-
|
733
|
-
|
734
|
-
|
735
|
-
|
736
|
-
|
737
|
-
|
774
|
+
ReturnType: void
|
775
|
+
},
|
776
|
+
/**
|
777
|
+
* @description Enable or disable logging on the test node network.
|
778
|
+
* @link https://hardhat.org/hardhat-network/docs/reference#hardhat_setcoinbase
|
779
|
+
*/
|
780
|
+
{
|
781
|
+
Method: `${TMode}_setLoggingEnabled`
|
782
|
+
Parameters: [enabled: boolean]
|
783
|
+
ReturnType: void
|
784
|
+
},
|
785
|
+
/**
|
786
|
+
* @description Change the minimum gas price accepted by the network (in wei).
|
787
|
+
* @link https://hardhat.org/hardhat-network/docs/reference#hardhat_setmingasprice
|
788
|
+
*/
|
789
|
+
{
|
790
|
+
Method: `${TMode}_setMinGasPrice`
|
791
|
+
Parameters: [gasPrice: Quantity]
|
792
|
+
ReturnType: void
|
793
|
+
},
|
794
|
+
/**
|
795
|
+
* @description Sets the base fee of the next block.
|
796
|
+
* @link https://hardhat.org/hardhat-network/docs/reference#hardhat_setnextblockbasefeepergas
|
797
|
+
*/
|
798
|
+
{
|
799
|
+
Method: `${TMode}_setNextBlockBaseFeePerGas`
|
800
|
+
Parameters: [baseFeePerGas: Quantity]
|
801
|
+
ReturnType: void
|
802
|
+
},
|
803
|
+
/**
|
804
|
+
* @description Modifies an account's nonce by overwriting it.
|
805
|
+
* @link https://hardhat.org/hardhat-network/docs/reference#hardhat_setnonce
|
806
|
+
*/
|
807
|
+
{
|
808
|
+
Method: `${TMode}_setNonce`
|
809
|
+
Parameters: [
|
738
810
|
/** The account address. */
|
739
811
|
address: Address,
|
740
812
|
/** The new nonce. */
|
741
813
|
nonce: Quantity,
|
742
814
|
]
|
743
|
-
|
744
|
-
|
745
|
-
|
746
|
-
|
747
|
-
|
748
|
-
|
749
|
-
|
750
|
-
|
751
|
-
|
752
|
-
|
753
|
-
|
754
|
-
|
755
|
-
|
756
|
-
|
757
|
-
|
815
|
+
ReturnType: void
|
816
|
+
},
|
817
|
+
/**
|
818
|
+
* @description Sets the backend RPC URL.
|
819
|
+
*/
|
820
|
+
{
|
821
|
+
Method: `${TMode}_setRpcUrl`
|
822
|
+
Parameters: [url: string]
|
823
|
+
ReturnType: void
|
824
|
+
},
|
825
|
+
/**
|
826
|
+
* @description Writes a single position of an account's storage.
|
827
|
+
* @link https://hardhat.org/hardhat-network/docs/reference#hardhat_setstorageat
|
828
|
+
*/
|
829
|
+
{
|
830
|
+
Method: `${TMode}_setStorageAt`
|
831
|
+
Parameters: [
|
758
832
|
/** The account address. */
|
759
833
|
address: Address,
|
760
834
|
/** The storage position index. */
|
@@ -762,302 +836,482 @@ export type TestRequests<Name extends string> = {
|
|
762
836
|
/** The storage value. */
|
763
837
|
value: Quantity,
|
764
838
|
]
|
765
|
-
|
766
|
-
|
767
|
-
|
768
|
-
|
769
|
-
|
770
|
-
|
771
|
-
|
772
|
-
|
839
|
+
ReturnType: void
|
840
|
+
},
|
841
|
+
/**
|
842
|
+
* @description Use this method to stop impersonating an account after having previously used impersonateAccount.
|
843
|
+
* @link https://hardhat.org/hardhat-network/docs/reference#hardhat_stopimpersonatingaccount
|
844
|
+
*/
|
845
|
+
{
|
846
|
+
Method: `${TMode}_stopImpersonatingAccount`
|
847
|
+
Parameters: [
|
773
848
|
/** The address to stop impersonating. */
|
774
849
|
address: Address,
|
775
850
|
]
|
776
|
-
|
777
|
-
|
778
|
-
|
779
|
-
|
780
|
-
|
781
|
-
|
782
|
-
|
783
|
-
|
784
|
-
|
785
|
-
|
786
|
-
|
787
|
-
|
788
|
-
|
789
|
-
|
790
|
-
|
791
|
-
|
792
|
-
|
793
|
-
|
794
|
-
|
795
|
-
|
796
|
-
|
797
|
-
|
798
|
-
|
799
|
-
|
800
|
-
}
|
801
|
-
|
802
|
-
|
803
|
-
|
804
|
-
|
805
|
-
|
806
|
-
|
807
|
-
|
808
|
-
|
809
|
-
|
810
|
-
|
811
|
-
|
812
|
-
|
813
|
-
|
814
|
-
|
815
|
-
|
816
|
-
|
817
|
-
|
818
|
-
|
819
|
-
|
820
|
-
|
821
|
-
|
822
|
-
|
823
|
-
|
824
|
-
|
825
|
-
|
826
|
-
|
827
|
-
|
828
|
-
|
829
|
-
|
830
|
-
|
831
|
-
|
832
|
-
|
833
|
-
|
834
|
-
|
835
|
-
|
836
|
-
|
837
|
-
|
838
|
-
|
839
|
-
|
840
|
-
|
841
|
-
|
842
|
-
|
843
|
-
|
844
|
-
|
845
|
-
|
846
|
-
|
847
|
-
|
848
|
-
|
849
|
-
|
850
|
-
|
851
|
-
|
852
|
-
|
853
|
-
|
854
|
-
|
855
|
-
|
856
|
-
|
857
|
-
|
858
|
-
|
859
|
-
|
860
|
-
|
861
|
-
|
862
|
-
}
|
863
|
-
|
864
|
-
|
865
|
-
|
866
|
-
|
867
|
-
|
868
|
-
|
869
|
-
|
870
|
-
|
871
|
-
|
872
|
-
|
873
|
-
|
874
|
-
|
875
|
-
|
876
|
-
|
877
|
-
|
878
|
-
|
879
|
-
|
880
|
-
|
881
|
-
|
882
|
-
|
883
|
-
|
884
|
-
|
885
|
-
|
886
|
-
|
887
|
-
|
851
|
+
ReturnType: void
|
852
|
+
},
|
853
|
+
/**
|
854
|
+
* @description Jump forward in time by the given amount of time, in seconds.
|
855
|
+
* @link https://github.com/trufflesuite/ganache/blob/ef1858d5d6f27e4baeb75cccd57fb3dc77a45ae8/src/chains/ethereum/ethereum/RPC-METHODS.md#evm_increasetime
|
856
|
+
*/
|
857
|
+
{
|
858
|
+
Method: `${TMode}_increaseTime`
|
859
|
+
Parameters: [seconds: number]
|
860
|
+
ReturnType: Quantity
|
861
|
+
},
|
862
|
+
/**
|
863
|
+
* @description Modifies the balance of an account.
|
864
|
+
* @link https://ganache.dev/#evm_setAccountBalance
|
865
|
+
*/
|
866
|
+
{
|
867
|
+
Method: `evm_setAccountBalance`
|
868
|
+
Parameters: [
|
869
|
+
/** The address of the target account. */
|
870
|
+
address: Address,
|
871
|
+
/** Amount to send in wei. */
|
872
|
+
value: Quantity,
|
873
|
+
]
|
874
|
+
ReturnType: void
|
875
|
+
},
|
876
|
+
/**
|
877
|
+
* @description Enables or disables, based on the single boolean argument, the automatic mining of new blocks with each new transaction submitted to the network.
|
878
|
+
* @link https://hardhat.org/hardhat-network/docs/reference#evm_setautomine
|
879
|
+
*/
|
880
|
+
{
|
881
|
+
Method: `evm_setAutomine`
|
882
|
+
Parameters: [boolean]
|
883
|
+
ReturnType: void
|
884
|
+
},
|
885
|
+
/**
|
886
|
+
* @description Sets the block's gas limit.
|
887
|
+
* @link https://hardhat.org/hardhat-network/docs/reference#evm_setblockgaslimit
|
888
|
+
*/
|
889
|
+
{
|
890
|
+
Method: 'evm_setBlockGasLimit'
|
891
|
+
Parameters: [gasLimit: Quantity]
|
892
|
+
ReturnType: void
|
893
|
+
},
|
894
|
+
/**
|
895
|
+
* @description Jump forward in time by the given amount of time, in seconds.
|
896
|
+
* @link https://github.com/trufflesuite/ganache/blob/ef1858d5d6f27e4baeb75cccd57fb3dc77a45ae8/src/chains/ethereum/ethereum/RPC-METHODS.md#evm_increasetime
|
897
|
+
*/
|
898
|
+
{
|
899
|
+
Method: `evm_increaseTime`
|
900
|
+
Parameters: [seconds: Quantity]
|
901
|
+
ReturnType: Quantity
|
902
|
+
},
|
903
|
+
/**
|
904
|
+
* @description Similar to `evm_increaseTime` but sets a block timestamp `interval`.
|
905
|
+
* The timestamp of the next block will be computed as `lastBlock_timestamp` + `interval`
|
906
|
+
*/
|
907
|
+
{
|
908
|
+
Method: `${TMode}_setBlockTimestampInterval`
|
909
|
+
Parameters: [seconds: number]
|
910
|
+
ReturnType: void
|
911
|
+
},
|
912
|
+
/**
|
913
|
+
* @description Removes `setBlockTimestampInterval` if it exists
|
914
|
+
*/
|
915
|
+
{
|
916
|
+
Method: `${TMode}_removeBlockTimestampInterval`
|
917
|
+
Parameters?: never
|
918
|
+
ReturnType: void
|
919
|
+
},
|
920
|
+
/**
|
921
|
+
* @description Enables (with a numeric argument greater than 0) or disables (with a numeric argument equal to 0), the automatic mining of blocks at a regular interval of milliseconds, each of which will include all pending transactions.
|
922
|
+
* @link https://hardhat.org/hardhat-network/docs/reference#evm_setintervalmining
|
923
|
+
*/
|
924
|
+
{
|
925
|
+
Method: 'evm_setIntervalMining'
|
926
|
+
Parameters: [number]
|
927
|
+
ReturnType: void
|
928
|
+
},
|
929
|
+
/**
|
930
|
+
* @description Set the timestamp of the next block.
|
931
|
+
* @link https://hardhat.org/hardhat-network/docs/reference#evm_setnextblocktimestamp
|
932
|
+
*/
|
933
|
+
{
|
934
|
+
Method: 'evm_setNextBlockTimestamp'
|
935
|
+
Parameters: [Quantity]
|
936
|
+
ReturnType: void
|
937
|
+
},
|
938
|
+
/**
|
939
|
+
* @description Snapshot the state of the blockchain at the current block. Takes no parameters. Returns the id of the snapshot that was created.
|
940
|
+
* @link https://hardhat.org/hardhat-network/docs/reference#evm_snapshot
|
941
|
+
*/
|
942
|
+
{
|
943
|
+
Method: 'evm_snapshot'
|
944
|
+
Parameters?: never
|
945
|
+
ReturnType: Quantity
|
946
|
+
},
|
947
|
+
/**
|
948
|
+
* @description Revert the state of the blockchain to a previous snapshot. Takes a single parameter, which is the snapshot id to revert to.
|
949
|
+
*/
|
950
|
+
{
|
951
|
+
Method: 'evm_revert'
|
952
|
+
Parameters?: [id: Quantity]
|
953
|
+
ReturnType: void
|
954
|
+
},
|
955
|
+
/**
|
956
|
+
* @description Enables the automatic mining of new blocks with each new transaction submitted to the network.
|
957
|
+
* @link https://ganache.dev/#miner_start
|
958
|
+
*/
|
959
|
+
{
|
960
|
+
Method: 'miner_start'
|
961
|
+
Parameters?: never
|
962
|
+
ReturnType: void
|
963
|
+
},
|
964
|
+
/**
|
965
|
+
* @description Disables the automatic mining of new blocks with each new transaction submitted to the network.
|
966
|
+
* @link https://ganache.dev/#miner_stop
|
967
|
+
*/
|
968
|
+
{
|
969
|
+
Method: 'miner_stop'
|
970
|
+
Parameters?: never
|
971
|
+
ReturnType: void
|
972
|
+
},
|
973
|
+
/**
|
974
|
+
* @link https://geth.ethereum.org/docs/interacting-with-geth/rpc/ns-txpool#txpool-content
|
975
|
+
*/
|
976
|
+
{
|
977
|
+
Method: 'txpool_content'
|
978
|
+
Parameters?: never
|
979
|
+
ReturnType: {
|
980
|
+
pending: Record<Address, Record<string, Transaction>>
|
981
|
+
queued: Record<Address, Record<string, Transaction>>
|
982
|
+
}
|
983
|
+
},
|
984
|
+
/**
|
985
|
+
* @link https://geth.ethereum.org/docs/interacting-with-geth/rpc/ns-txpool#txpool-inspect
|
986
|
+
*/
|
987
|
+
{
|
988
|
+
Method: 'txpool_inspect'
|
989
|
+
Parameters?: never
|
990
|
+
ReturnType: {
|
991
|
+
pending: Record<Address, Record<string, string>>
|
992
|
+
queued: Record<Address, Record<string, string>>
|
993
|
+
}
|
994
|
+
},
|
995
|
+
/**
|
996
|
+
* @link https://geth.ethereum.org/docs/interacting-with-geth/rpc/ns-txpool#txpool-inspect
|
997
|
+
*/
|
998
|
+
{
|
999
|
+
Method: 'txpool_status'
|
1000
|
+
Parameters?: never
|
1001
|
+
ReturnType: {
|
1002
|
+
pending: Quantity
|
1003
|
+
queued: Quantity
|
1004
|
+
}
|
1005
|
+
},
|
1006
|
+
/**
|
1007
|
+
* @description Returns whether the client is actively mining new blocks.
|
1008
|
+
* @link https://eips.ethereum.org/EIPS/eip-1474
|
1009
|
+
* @example
|
1010
|
+
* provider.request({ method: 'eth_mining' })
|
1011
|
+
* // => true
|
1012
|
+
*/
|
1013
|
+
{
|
1014
|
+
Method: 'eth_mining'
|
1015
|
+
Parameters?: never
|
1016
|
+
ReturnType: boolean
|
1017
|
+
},
|
1018
|
+
/**
|
1019
|
+
* @description Advance the block number of the network by a certain number of blocks.
|
1020
|
+
* @link https://ganache.dev/#evm_mine
|
1021
|
+
*/
|
1022
|
+
{
|
1023
|
+
Method: 'evm_mine'
|
1024
|
+
Parameters?: [
|
1025
|
+
{
|
1026
|
+
/** Number of blocks to mine. */
|
1027
|
+
blocks: Hex
|
1028
|
+
},
|
1029
|
+
]
|
1030
|
+
ReturnType: void
|
1031
|
+
},
|
1032
|
+
/**
|
1033
|
+
* @description Creates, signs, and sends a new transaction to the network regardless of the signature.
|
1034
|
+
* @link https://eips.ethereum.org/EIPS/eip-1474
|
1035
|
+
* @example
|
1036
|
+
* provider.request({ method: 'eth_sendTransaction', params: [{ from: '0x...', to: '0x...', value: '0x...' }] })
|
1037
|
+
* // => '0x...'
|
1038
|
+
*/
|
1039
|
+
{
|
1040
|
+
Method: 'eth_sendUnsignedTransaction'
|
1041
|
+
Parameters: [transaction: TransactionRequest]
|
1042
|
+
ReturnType: Hash
|
1043
|
+
},
|
1044
|
+
]
|
888
1045
|
|
889
|
-
export type
|
890
|
-
|
891
|
-
|
892
|
-
|
893
|
-
|
894
|
-
|
895
|
-
|
896
|
-
|
897
|
-
|
898
|
-
|
899
|
-
|
900
|
-
|
901
|
-
|
902
|
-
|
903
|
-
|
904
|
-
|
905
|
-
|
906
|
-
|
907
|
-
|
908
|
-
|
909
|
-
|
910
|
-
|
1046
|
+
export type WalletRpcSchema = [
|
1047
|
+
/**
|
1048
|
+
* @description Returns a list of addresses owned by this client
|
1049
|
+
* @link https://eips.ethereum.org/EIPS/eip-1474
|
1050
|
+
* @example
|
1051
|
+
* provider.request({ method: 'eth_accounts' })
|
1052
|
+
* // => ['0x0fB69...']
|
1053
|
+
*/
|
1054
|
+
{
|
1055
|
+
Method: 'eth_accounts'
|
1056
|
+
Parameters?: never
|
1057
|
+
ReturnType: Address[]
|
1058
|
+
},
|
1059
|
+
/**
|
1060
|
+
* @description Returns the current chain ID associated with the wallet.
|
1061
|
+
* @example
|
1062
|
+
* provider.request({ method: 'eth_chainId' })
|
1063
|
+
* // => '1'
|
1064
|
+
*/
|
1065
|
+
{
|
1066
|
+
Method: 'eth_chainId'
|
1067
|
+
Parameters?: never
|
1068
|
+
ReturnType: Quantity
|
1069
|
+
},
|
1070
|
+
/**
|
1071
|
+
* @description Estimates the gas necessary to complete a transaction without submitting it to the network
|
1072
|
+
*
|
1073
|
+
* @example
|
1074
|
+
* provider.request({
|
1075
|
+
* method: 'eth_estimateGas',
|
1076
|
+
* params: [{ from: '0x...', to: '0x...', value: '0x...' }]
|
1077
|
+
* })
|
1078
|
+
* // => '0x5208'
|
1079
|
+
*/
|
1080
|
+
{
|
1081
|
+
Method: 'eth_estimateGas'
|
1082
|
+
Parameters:
|
1083
|
+
| [transaction: TransactionRequest]
|
1084
|
+
| [transaction: TransactionRequest, block: BlockNumber | BlockTag]
|
1085
|
+
ReturnType: Quantity
|
1086
|
+
},
|
1087
|
+
/**
|
1088
|
+
* @description Requests that the user provides an Ethereum address to be identified by. Typically causes a browser extension popup to appear.
|
1089
|
+
* @link https://eips.ethereum.org/EIPS/eip-1102
|
1090
|
+
* @example
|
1091
|
+
* provider.request({ method: 'eth_requestAccounts' }] })
|
1092
|
+
* // => ['0x...', '0x...']
|
1093
|
+
*/
|
1094
|
+
{
|
1095
|
+
Method: 'eth_requestAccounts'
|
1096
|
+
Parameters?: never
|
1097
|
+
ReturnType: Address[]
|
1098
|
+
},
|
1099
|
+
/**
|
1100
|
+
* @description Creates, signs, and sends a new transaction to the network
|
1101
|
+
* @link https://eips.ethereum.org/EIPS/eip-1474
|
1102
|
+
* @example
|
1103
|
+
* provider.request({ method: 'eth_sendTransaction', params: [{ from: '0x...', to: '0x...', value: '0x...' }] })
|
1104
|
+
* // => '0x...'
|
1105
|
+
*/
|
1106
|
+
{
|
1107
|
+
Method: 'eth_sendTransaction'
|
1108
|
+
Parameters: [transaction: TransactionRequest]
|
1109
|
+
ReturnType: Hash
|
1110
|
+
},
|
1111
|
+
/**
|
1112
|
+
* @description Sends and already-signed transaction to the network
|
1113
|
+
* @link https://eips.ethereum.org/EIPS/eip-1474
|
1114
|
+
* @example
|
1115
|
+
* provider.request({ method: 'eth_sendRawTransaction', params: ['0x...'] })
|
1116
|
+
* // => '0x...'
|
1117
|
+
*/
|
1118
|
+
{
|
1119
|
+
Method: 'eth_sendRawTransaction'
|
1120
|
+
Parameters: [signedTransaction: Hex]
|
1121
|
+
ReturnType: Hash
|
1122
|
+
},
|
1123
|
+
/**
|
1124
|
+
* @description Calculates an Ethereum-specific signature in the form of `keccak256("\x19Ethereum Signed Message:\n" + len(message) + message))`
|
1125
|
+
* @link https://eips.ethereum.org/EIPS/eip-1474
|
1126
|
+
* @example
|
1127
|
+
* provider.request({ method: 'eth_sign', params: ['0x...', '0x...'] })
|
1128
|
+
* // => '0x...'
|
1129
|
+
*/
|
1130
|
+
{
|
1131
|
+
Method: 'eth_sign'
|
1132
|
+
Parameters: [
|
911
1133
|
/** Address to use for signing */
|
912
1134
|
address: Address,
|
913
1135
|
/** Data to sign */
|
914
1136
|
data: Hex,
|
915
1137
|
]
|
916
|
-
|
917
|
-
|
918
|
-
|
919
|
-
|
920
|
-
|
921
|
-
|
922
|
-
|
923
|
-
|
924
|
-
|
925
|
-
|
926
|
-
|
927
|
-
|
928
|
-
|
929
|
-
|
930
|
-
|
931
|
-
|
932
|
-
|
933
|
-
|
934
|
-
|
935
|
-
|
936
|
-
|
937
|
-
|
1138
|
+
ReturnType: Hex
|
1139
|
+
},
|
1140
|
+
/**
|
1141
|
+
* @description Signs a transaction that can be submitted to the network at a later time using with `eth_sendRawTransaction`
|
1142
|
+
* @link https://eips.ethereum.org/EIPS/eip-1474
|
1143
|
+
* @example
|
1144
|
+
* provider.request({ method: 'eth_signTransaction', params: [{ from: '0x...', to: '0x...', value: '0x...' }] })
|
1145
|
+
* // => '0x...'
|
1146
|
+
*/
|
1147
|
+
{
|
1148
|
+
Method: 'eth_signTransaction'
|
1149
|
+
Parameters: [request: TransactionRequest]
|
1150
|
+
ReturnType: Hex
|
1151
|
+
},
|
1152
|
+
/**
|
1153
|
+
* @description Calculates an Ethereum-specific signature in the form of `keccak256("\x19Ethereum Signed Message:\n" + len(message) + message))`
|
1154
|
+
* @link https://eips.ethereum.org/EIPS/eip-1474
|
1155
|
+
* @example
|
1156
|
+
* provider.request({ method: 'eth_signTypedData_v4', params: [{ from: '0x...', data: [{ type: 'string', name: 'message', value: 'hello world' }] }] })
|
1157
|
+
* // => '0x...'
|
1158
|
+
*/
|
1159
|
+
{
|
1160
|
+
Method: 'eth_signTypedData_v4'
|
1161
|
+
Parameters: [
|
938
1162
|
/** Address to use for signing */
|
939
1163
|
address: Address,
|
940
1164
|
/** Message to sign containing type information, a domain separator, and data */
|
941
1165
|
message: string,
|
942
1166
|
]
|
943
|
-
|
944
|
-
|
945
|
-
|
946
|
-
|
947
|
-
|
948
|
-
|
949
|
-
|
950
|
-
|
951
|
-
|
952
|
-
|
953
|
-
|
954
|
-
|
955
|
-
|
956
|
-
|
957
|
-
|
958
|
-
|
959
|
-
|
960
|
-
|
961
|
-
|
962
|
-
|
963
|
-
|
964
|
-
|
1167
|
+
ReturnType: Hex
|
1168
|
+
},
|
1169
|
+
/**
|
1170
|
+
* @description Returns information about the status of this client’s network synchronization
|
1171
|
+
* @link https://eips.ethereum.org/EIPS/eip-1474
|
1172
|
+
* @example
|
1173
|
+
* provider.request({ method: 'eth_syncing' })
|
1174
|
+
* // => { startingBlock: '0x...', currentBlock: '0x...', highestBlock: '0x...' }
|
1175
|
+
*/
|
1176
|
+
{
|
1177
|
+
Method: 'eth_syncing'
|
1178
|
+
Parameters?: never
|
1179
|
+
ReturnType: NetworkSync | false
|
1180
|
+
},
|
1181
|
+
/**
|
1182
|
+
* @description Calculates an Ethereum-specific signature in the form of `keccak256("\x19Ethereum Signed Message:\n" + len(message) + message))`
|
1183
|
+
* @link https://eips.ethereum.org/EIPS/eip-1474
|
1184
|
+
* @example
|
1185
|
+
* provider.request({ method: 'personal_sign', params: ['0x...', '0x...'] })
|
1186
|
+
* // => '0x...'
|
1187
|
+
*/
|
1188
|
+
{
|
1189
|
+
Method: 'personal_sign'
|
1190
|
+
Parameters: [
|
965
1191
|
/** Data to sign */
|
966
1192
|
data: Hex,
|
967
1193
|
/** Address to use for signing */
|
968
1194
|
address: Address,
|
969
1195
|
]
|
970
|
-
|
971
|
-
}
|
972
|
-
|
973
|
-
|
974
|
-
|
975
|
-
|
976
|
-
|
977
|
-
|
978
|
-
|
979
|
-
|
980
|
-
|
981
|
-
|
982
|
-
|
983
|
-
|
984
|
-
|
985
|
-
|
986
|
-
|
987
|
-
|
988
|
-
|
989
|
-
|
990
|
-
|
991
|
-
|
992
|
-
|
993
|
-
|
994
|
-
|
995
|
-
|
996
|
-
|
997
|
-
|
998
|
-
|
999
|
-
|
1000
|
-
|
1001
|
-
|
1002
|
-
|
1003
|
-
|
1004
|
-
|
1005
|
-
|
1006
|
-
|
1007
|
-
|
1008
|
-
|
1009
|
-
|
1010
|
-
|
1011
|
-
|
1012
|
-
|
1013
|
-
|
1014
|
-
|
1015
|
-
|
1016
|
-
|
1017
|
-
|
1018
|
-
|
1019
|
-
|
1020
|
-
* @link https://eips.ethereum.org/EIPS/eip-2255
|
1021
|
-
* @example
|
1022
|
-
* provider.request({ method: 'wallet_getPermissions' })
|
1023
|
-
* // => { ... }
|
1024
|
-
* */
|
1025
|
-
method: 'wallet_getPermissions'
|
1026
|
-
params?: never
|
1027
|
-
}): Promise<WalletPermission[]>
|
1028
|
-
request(args: {
|
1029
|
-
/**
|
1030
|
-
* @description Add an Ethereum chain to the wallet.
|
1031
|
-
* @link https://eips.ethereum.org/EIPS/eip-3085
|
1032
|
-
* @example
|
1033
|
-
* provider.request({ method: 'wallet_addEthereumChain', params: [{ chainId: 1, rpcUrl: 'https://mainnet.infura.io/v3/...' }] })
|
1034
|
-
* // => { ... }
|
1035
|
-
*/
|
1036
|
-
method: 'wallet_addEthereumChain'
|
1037
|
-
params: [chain: Chain]
|
1038
|
-
}): Promise<null>
|
1039
|
-
request(args: {
|
1040
|
-
/**
|
1041
|
-
* @description Switch the wallet to the given Ethereum chain.
|
1042
|
-
* @link https://eips.ethereum.org/EIPS/eip-3326
|
1043
|
-
* @example
|
1044
|
-
* provider.request({ method: 'wallet_switchEthereumChain', params: [{ chainId: '0xf00' }] })
|
1045
|
-
* // => { ... }
|
1046
|
-
* */
|
1047
|
-
method: 'wallet_switchEthereumChain'
|
1048
|
-
params: [chain: { chainId: string }]
|
1049
|
-
}): Promise<null>
|
1196
|
+
ReturnType: Hex
|
1197
|
+
},
|
1198
|
+
/**
|
1199
|
+
* @description Add an Ethereum chain to the wallet.
|
1200
|
+
* @link https://eips.ethereum.org/EIPS/eip-3085
|
1201
|
+
* @example
|
1202
|
+
* provider.request({ method: 'wallet_addEthereumChain', params: [{ chainId: 1, rpcUrl: 'https://mainnet.infura.io/v3/...' }] })
|
1203
|
+
* // => { ... }
|
1204
|
+
*/
|
1205
|
+
{
|
1206
|
+
Method: 'wallet_addEthereumChain'
|
1207
|
+
Parameters: [chain: AddEthereumChainParameter]
|
1208
|
+
ReturnType: null
|
1209
|
+
},
|
1210
|
+
/**
|
1211
|
+
* @description Gets the wallets current permissions.
|
1212
|
+
* @link https://eips.ethereum.org/EIPS/eip-2255
|
1213
|
+
* @example
|
1214
|
+
* provider.request({ method: 'wallet_getPermissions' })
|
1215
|
+
* // => { ... }
|
1216
|
+
*/
|
1217
|
+
{
|
1218
|
+
Method: 'wallet_getPermissions'
|
1219
|
+
Parameters?: never
|
1220
|
+
ReturnType: WalletPermission[]
|
1221
|
+
},
|
1222
|
+
/**
|
1223
|
+
* @description Requests the given permissions from the user.
|
1224
|
+
* @link https://eips.ethereum.org/EIPS/eip-2255
|
1225
|
+
* @example
|
1226
|
+
* provider.request({ method: 'wallet_requestPermissions', params: [{ eth_accounts: {} }] })
|
1227
|
+
* // => { ... }
|
1228
|
+
*/
|
1229
|
+
{
|
1230
|
+
Method: 'wallet_requestPermissions'
|
1231
|
+
Parameters: [permissions: { eth_accounts: Record<string, any> }]
|
1232
|
+
ReturnType: WalletPermission[]
|
1233
|
+
},
|
1234
|
+
/**
|
1235
|
+
* @description Switch the wallet to the given Ethereum chain.
|
1236
|
+
* @link https://eips.ethereum.org/EIPS/eip-3326
|
1237
|
+
* @example
|
1238
|
+
* provider.request({ method: 'wallet_switchEthereumChain', params: [{ chainId: '0xf00' }] })
|
1239
|
+
* // => { ... }
|
1240
|
+
*/
|
1241
|
+
{
|
1242
|
+
Method: 'wallet_switchEthereumChain'
|
1243
|
+
Parameters: [chain: { chainId: string }]
|
1244
|
+
ReturnType: null
|
1245
|
+
},
|
1050
1246
|
/**
|
1051
1247
|
* @description Requests that the user tracks the token in their wallet. Returns a boolean indicating if the token was successfully added.
|
1052
1248
|
* @link https://eips.ethereum.org/EIPS/eip-747
|
1053
1249
|
* @example
|
1054
1250
|
* provider.request({ method: 'wallet_watchAsset' }] })
|
1055
1251
|
* // => true
|
1056
|
-
|
1057
|
-
|
1058
|
-
|
1059
|
-
|
1060
|
-
|
1061
|
-
}
|
1252
|
+
*/
|
1253
|
+
{
|
1254
|
+
Method: 'wallet_watchAsset'
|
1255
|
+
Parameters: WatchAssetParams
|
1256
|
+
ReturnType: boolean
|
1257
|
+
},
|
1258
|
+
]
|
1259
|
+
|
1260
|
+
///////////////////////////////////////////////////////////////////////////
|
1261
|
+
// Utils
|
1262
|
+
|
1263
|
+
export type RpcSchema = readonly {
|
1264
|
+
Method: string
|
1265
|
+
Parameters?: unknown
|
1266
|
+
ReturnType: unknown
|
1267
|
+
}[]
|
1268
|
+
|
1269
|
+
export type RpcSchemaOverride = Omit<RpcSchema[number], 'Method'>
|
1270
|
+
|
1271
|
+
export type EIP1193Parameters<
|
1272
|
+
TRpcSchema extends RpcSchema | undefined = undefined,
|
1273
|
+
> = TRpcSchema extends RpcSchema
|
1274
|
+
? {
|
1275
|
+
[K in keyof TRpcSchema]: Prettify<
|
1276
|
+
{
|
1277
|
+
method: TRpcSchema[K] extends TRpcSchema[number]
|
1278
|
+
? TRpcSchema[K]['Method']
|
1279
|
+
: never
|
1280
|
+
} & (TRpcSchema[K] extends TRpcSchema[number]
|
1281
|
+
? TRpcSchema[K]['Parameters'] extends undefined
|
1282
|
+
? { params?: never }
|
1283
|
+
: { params: TRpcSchema[K]['Parameters'] }
|
1284
|
+
: never)
|
1285
|
+
>
|
1286
|
+
}[number]
|
1287
|
+
: {
|
1288
|
+
method: string
|
1289
|
+
params?: unknown
|
1290
|
+
}
|
1291
|
+
|
1292
|
+
type DerivedRpcSchema<
|
1293
|
+
TRpcSchema extends RpcSchema | undefined,
|
1294
|
+
TRpcSchemaOverride extends RpcSchemaOverride | undefined,
|
1295
|
+
> = TRpcSchemaOverride extends RpcSchemaOverride
|
1296
|
+
? [TRpcSchemaOverride & { Method: string }]
|
1297
|
+
: TRpcSchema
|
1062
1298
|
|
1063
|
-
export type
|
1299
|
+
export type EIP1193RequestFn<
|
1300
|
+
TRpcSchema extends RpcSchema | undefined = undefined,
|
1301
|
+
> = <
|
1302
|
+
TRpcSchemaOverride extends RpcSchemaOverride | undefined = undefined,
|
1303
|
+
TParameters extends EIP1193Parameters<
|
1304
|
+
DerivedRpcSchema<TRpcSchema, TRpcSchemaOverride>
|
1305
|
+
> = EIP1193Parameters<DerivedRpcSchema<TRpcSchema, TRpcSchemaOverride>>,
|
1306
|
+
_ReturnType = DerivedRpcSchema<
|
1307
|
+
TRpcSchema,
|
1308
|
+
TRpcSchemaOverride
|
1309
|
+
> extends RpcSchema
|
1310
|
+
? Extract<
|
1311
|
+
DerivedRpcSchema<TRpcSchema, TRpcSchemaOverride>[number],
|
1312
|
+
{ Method: TParameters['method'] }
|
1313
|
+
>['ReturnType']
|
1314
|
+
: unknown,
|
1315
|
+
>(
|
1316
|
+
args: TParameters,
|
1317
|
+
) => Promise<_ReturnType>
|