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
@@ -86,11 +86,12 @@ export async function estimateGas<
|
|
86
86
|
| WalletClient<Transport, TChain, TAccount>,
|
87
87
|
args: EstimateGasParameters<TChain, TAccount>,
|
88
88
|
): Promise<EstimateGasReturnType> {
|
89
|
-
|
89
|
+
const account_ = args.account ?? (client as WalletClient).account
|
90
|
+
if (!account_)
|
90
91
|
throw new AccountNotFoundError({
|
91
92
|
docsPath: '/docs/actions/public/estimateGas',
|
92
93
|
})
|
93
|
-
const account = parseAccount(
|
94
|
+
const account = parseAccount(account_)
|
94
95
|
|
95
96
|
try {
|
96
97
|
const {
|
@@ -134,7 +135,7 @@ export async function estimateGas<
|
|
134
135
|
},
|
135
136
|
)
|
136
137
|
|
137
|
-
const balance = await client.request({
|
138
|
+
const balance = await (client as PublicClient).request({
|
138
139
|
method: 'eth_estimateGas',
|
139
140
|
params: block ? [request, block] : [request],
|
140
141
|
})
|
@@ -89,12 +89,12 @@ export async function getBlock<
|
|
89
89
|
|
90
90
|
let block: RpcBlock | null = null
|
91
91
|
if (blockHash) {
|
92
|
-
block = await client.request({
|
92
|
+
block = await (client as PublicClient).request({
|
93
93
|
method: 'eth_getBlockByHash',
|
94
94
|
params: [blockHash, includeTransactions],
|
95
95
|
})
|
96
96
|
} else {
|
97
|
-
block = await client.request({
|
97
|
+
block = await (client as PublicClient).request({
|
98
98
|
method: 'eth_getBlockByNumber',
|
99
99
|
params: [blockNumberHex || blockTag, includeTransactions],
|
100
100
|
})
|
@@ -65,7 +65,7 @@ export async function getBlockTransactionCount<
|
|
65
65
|
const blockNumberHex =
|
66
66
|
blockNumber !== undefined ? numberToHex(blockNumber) : undefined
|
67
67
|
|
68
|
-
let count: Quantity
|
68
|
+
let count: Quantity
|
69
69
|
if (blockHash) {
|
70
70
|
count = await client.request({
|
71
71
|
method: 'eth_getBlockTransactionCountByHash',
|
@@ -36,6 +36,8 @@ export async function getChainId<
|
|
36
36
|
| PublicClient<Transport, TChain>
|
37
37
|
| WalletClient<Transport, TChain, TAccount>,
|
38
38
|
): Promise<GetChainIdReturnType> {
|
39
|
-
const chainIdHex = await client.request({
|
39
|
+
const chainIdHex = await (client as PublicClient).request({
|
40
|
+
method: 'eth_chainId',
|
41
|
+
})
|
40
42
|
return hexToNumber(chainIdHex)
|
41
43
|
}
|
@@ -2,6 +2,10 @@ import type { Abi, AbiEvent, ExtractAbiEvent } from 'abitype'
|
|
2
2
|
|
3
3
|
import type { PublicClient } from '../../clients/createPublicClient.js'
|
4
4
|
import type { Transport } from '../../clients/transports/createTransport.js'
|
5
|
+
import {
|
6
|
+
DecodeLogDataMismatch,
|
7
|
+
DecodeLogTopicsMismatch,
|
8
|
+
} from '../../errors/abi.js'
|
5
9
|
import type { Chain } from '../../types/chain.js'
|
6
10
|
import type { Filter, FilterType } from '../../types/filter.js'
|
7
11
|
import type { Log } from '../../types/log.js'
|
@@ -13,21 +17,23 @@ export type GetFilterChangesParameters<
|
|
13
17
|
TFilterType extends FilterType = FilterType,
|
14
18
|
TAbi extends Abi | readonly unknown[] = Abi,
|
15
19
|
TEventName extends string | undefined = string,
|
20
|
+
TStrict extends boolean | undefined = undefined,
|
16
21
|
> = {
|
17
|
-
filter: Filter<TFilterType, TAbi, TEventName, any>
|
22
|
+
filter: Filter<TFilterType, TAbi, TEventName, any, TStrict>
|
18
23
|
}
|
19
24
|
|
20
25
|
export type GetFilterChangesReturnType<
|
21
26
|
TFilterType extends FilterType = FilterType,
|
22
27
|
TAbi extends Abi | readonly unknown[] = Abi,
|
23
28
|
TEventName extends string | undefined = string,
|
29
|
+
TStrict extends boolean | undefined = undefined,
|
24
30
|
_AbiEvent extends AbiEvent | undefined = TAbi extends Abi
|
25
31
|
? TEventName extends string
|
26
32
|
? ExtractAbiEvent<TAbi, TEventName>
|
27
33
|
: undefined
|
28
34
|
: undefined,
|
29
35
|
> = TFilterType extends 'event'
|
30
|
-
? Log<bigint, number, _AbiEvent, TAbi, TEventName>[]
|
36
|
+
? Log<bigint, number, _AbiEvent, TStrict, TAbi, TEventName>[]
|
31
37
|
: Hash[]
|
32
38
|
|
33
39
|
/**
|
@@ -38,10 +44,10 @@ export type GetFilterChangesReturnType<
|
|
38
44
|
*
|
39
45
|
* A Filter can be created from the following actions:
|
40
46
|
*
|
41
|
-
* - [`createBlockFilter`](https://viem.sh/docs/actions/public/createBlockFilter)
|
42
|
-
* - [`createContractEventFilter`](https://viem.sh/docs/contract/createContractEventFilter)
|
43
|
-
* - [`createEventFilter`](https://viem.sh/docs/actions/public/createEventFilter)
|
44
|
-
* - [`createPendingTransactionFilter`](https://viem.sh/docs/actions/public/createPendingTransactionFilter)
|
47
|
+
* - [`createBlockFilter`](https://viem.sh/docs/actions/public/createBlockFilter.html)
|
48
|
+
* - [`createContractEventFilter`](https://viem.sh/docs/contract/createContractEventFilter.html)
|
49
|
+
* - [`createEventFilter`](https://viem.sh/docs/actions/public/createEventFilter.html)
|
50
|
+
* - [`createPendingTransactionFilter`](https://viem.sh/docs/actions/public/createPendingTransactionFilter.html)
|
45
51
|
*
|
46
52
|
* Depending on the type of filter, the return value will be different:
|
47
53
|
*
|
@@ -118,10 +124,15 @@ export async function getFilterChanges<
|
|
118
124
|
TFilterType extends FilterType,
|
119
125
|
TAbi extends Abi | readonly unknown[],
|
120
126
|
TEventName extends string | undefined,
|
127
|
+
TStrict extends boolean | undefined = undefined,
|
121
128
|
>(
|
122
129
|
_client: PublicClient<TTransport, TChain>,
|
123
|
-
{
|
130
|
+
{
|
131
|
+
filter,
|
132
|
+
}: GetFilterChangesParameters<TFilterType, TAbi, TEventName, TStrict>,
|
124
133
|
) {
|
134
|
+
const strict = 'strict' in filter && filter.strict
|
135
|
+
|
125
136
|
const logs = await filter.request({
|
126
137
|
method: 'eth_getFilterChanges',
|
127
138
|
params: [filter.id],
|
@@ -136,17 +147,31 @@ export async function getFilterChanges<
|
|
136
147
|
abi: filter.abi,
|
137
148
|
data: log.data,
|
138
149
|
topics: log.topics as any,
|
150
|
+
strict,
|
139
151
|
})
|
140
152
|
: { eventName: undefined, args: undefined }
|
141
153
|
return formatLog(log, { args, eventName })
|
142
|
-
} catch {
|
143
|
-
|
144
|
-
|
154
|
+
} catch (err) {
|
155
|
+
let eventName
|
156
|
+
let isUnnamed
|
157
|
+
if (
|
158
|
+
err instanceof DecodeLogDataMismatch ||
|
159
|
+
err instanceof DecodeLogTopicsMismatch
|
160
|
+
) {
|
161
|
+
// If strict mode is on, and log data/topics do not match event definition, skip.
|
162
|
+
if ('strict' in filter && filter.strict) return
|
163
|
+
eventName = err.abiItem.name
|
164
|
+
isUnnamed = err.abiItem.inputs?.some((x) => !('name' in x && x.name))
|
165
|
+
}
|
166
|
+
|
167
|
+
// Set args undefined if there is an error decoding (e.g. indexed/non-indexed params mismatch).
|
168
|
+
return formatLog(log, { args: isUnnamed ? [] : {}, eventName })
|
145
169
|
}
|
146
170
|
})
|
147
171
|
.filter(Boolean) as GetFilterChangesReturnType<
|
148
172
|
TFilterType,
|
149
173
|
TAbi,
|
150
|
-
TEventName
|
174
|
+
TEventName,
|
175
|
+
TStrict
|
151
176
|
>
|
152
177
|
}
|
@@ -2,6 +2,10 @@ import type { Abi, AbiEvent, ExtractAbiEvent } from 'abitype'
|
|
2
2
|
|
3
3
|
import type { PublicClient } from '../../clients/createPublicClient.js'
|
4
4
|
import type { Transport } from '../../clients/transports/createTransport.js'
|
5
|
+
import {
|
6
|
+
DecodeLogDataMismatch,
|
7
|
+
DecodeLogTopicsMismatch,
|
8
|
+
} from '../../errors/abi.js'
|
5
9
|
import type { Chain } from '../../types/chain.js'
|
6
10
|
import type { Filter } from '../../types/filter.js'
|
7
11
|
import type { Log } from '../../types/log.js'
|
@@ -11,18 +15,20 @@ import { formatLog } from '../../utils/formatters/log.js'
|
|
11
15
|
export type GetFilterLogsParameters<
|
12
16
|
TAbi extends Abi | readonly unknown[] = Abi,
|
13
17
|
TEventName extends string | undefined = string,
|
18
|
+
TStrict extends boolean | undefined = undefined,
|
14
19
|
> = {
|
15
|
-
filter: Filter<'event', TAbi, TEventName, any>
|
20
|
+
filter: Filter<'event', TAbi, TEventName, any, TStrict>
|
16
21
|
}
|
17
22
|
export type GetFilterLogsReturnType<
|
18
23
|
TAbi extends Abi | readonly unknown[] = Abi,
|
19
24
|
TEventName extends string | undefined = string,
|
25
|
+
TStrict extends boolean | undefined = undefined,
|
20
26
|
_AbiEvent extends AbiEvent | undefined = TAbi extends Abi
|
21
27
|
? TEventName extends string
|
22
28
|
? ExtractAbiEvent<TAbi, TEventName>
|
23
29
|
: undefined
|
24
30
|
: undefined,
|
25
|
-
> = Log<bigint, number, _AbiEvent, TAbi, TEventName>[]
|
31
|
+
> = Log<bigint, number, _AbiEvent, TStrict, TAbi, TEventName>[]
|
26
32
|
|
27
33
|
/**
|
28
34
|
* Returns a list of event logs since the filter was created.
|
@@ -55,10 +61,13 @@ export async function getFilterLogs<
|
|
55
61
|
TChain extends Chain | undefined,
|
56
62
|
TAbi extends Abi | readonly unknown[],
|
57
63
|
TEventName extends string | undefined,
|
64
|
+
TStrict extends boolean | undefined = undefined,
|
58
65
|
>(
|
59
66
|
_client: PublicClient<Transport, TChain>,
|
60
|
-
{ filter }: GetFilterLogsParameters<TAbi, TEventName>,
|
61
|
-
): Promise<GetFilterLogsReturnType<TAbi, TEventName>> {
|
67
|
+
{ filter }: GetFilterLogsParameters<TAbi, TEventName, TStrict>,
|
68
|
+
): Promise<GetFilterLogsReturnType<TAbi, TEventName, TStrict>> {
|
69
|
+
const strict = filter.strict ?? false
|
70
|
+
|
62
71
|
const logs = await filter.request({
|
63
72
|
method: 'eth_getFilterLogs',
|
64
73
|
params: [filter.id],
|
@@ -72,13 +81,30 @@ export async function getFilterLogs<
|
|
72
81
|
abi: filter.abi,
|
73
82
|
data: log.data,
|
74
83
|
topics: log.topics as any,
|
84
|
+
strict,
|
75
85
|
})
|
76
86
|
: { eventName: undefined, args: undefined }
|
77
87
|
return formatLog(log, { args, eventName })
|
78
|
-
} catch {
|
79
|
-
|
80
|
-
|
88
|
+
} catch (err) {
|
89
|
+
let eventName
|
90
|
+
let isUnnamed
|
91
|
+
if (
|
92
|
+
err instanceof DecodeLogDataMismatch ||
|
93
|
+
err instanceof DecodeLogTopicsMismatch
|
94
|
+
) {
|
95
|
+
// If strict mode is on, and log data/topics do not match event definition, skip.
|
96
|
+
if ('strict' in filter && filter.strict) return
|
97
|
+
eventName = err.abiItem.name
|
98
|
+
isUnnamed = err.abiItem.inputs?.some((x) => !('name' in x && x.name))
|
99
|
+
}
|
100
|
+
|
101
|
+
// Set args to empty if there is an error decoding (e.g. indexed/non-indexed params mismatch).
|
102
|
+
return formatLog(log, { args: isUnnamed ? [] : {}, eventName })
|
81
103
|
}
|
82
104
|
})
|
83
|
-
.filter(Boolean) as unknown as GetFilterLogsReturnType<
|
105
|
+
.filter(Boolean) as unknown as GetFilterLogsReturnType<
|
106
|
+
TAbi,
|
107
|
+
TEventName,
|
108
|
+
TStrict
|
109
|
+
>
|
84
110
|
}
|
@@ -34,7 +34,7 @@ export async function getGasPrice<
|
|
34
34
|
| PublicClient<Transport, TChain>
|
35
35
|
| WalletClient<Transport, TChain, TAccount>,
|
36
36
|
): Promise<GetGasPriceReturnType> {
|
37
|
-
const gasPrice = await client.request({
|
37
|
+
const gasPrice = await (client as PublicClient).request({
|
38
38
|
method: 'eth_gasPrice',
|
39
39
|
})
|
40
40
|
return BigInt(gasPrice)
|
@@ -2,6 +2,10 @@ import type { AbiEvent, Address, Narrow } from 'abitype'
|
|
2
2
|
|
3
3
|
import type { PublicClient } from '../../clients/createPublicClient.js'
|
4
4
|
import type { Transport } from '../../clients/transports/createTransport.js'
|
5
|
+
import {
|
6
|
+
DecodeLogDataMismatch,
|
7
|
+
DecodeLogTopicsMismatch,
|
8
|
+
} from '../../errors/abi.js'
|
5
9
|
import type { BlockNumber, BlockTag } from '../../types/block.js'
|
6
10
|
import type { Chain } from '../../types/chain.js'
|
7
11
|
import type {
|
@@ -21,18 +25,25 @@ import { formatLog } from '../../utils/formatters/log.js'
|
|
21
25
|
|
22
26
|
export type GetLogsParameters<
|
23
27
|
TAbiEvent extends AbiEvent | undefined = undefined,
|
24
|
-
|
28
|
+
TStrict extends boolean | undefined = undefined,
|
29
|
+
_EventName extends string | undefined = MaybeAbiEventName<TAbiEvent>,
|
25
30
|
> = {
|
26
31
|
/** Address or list of addresses from which logs originated */
|
27
32
|
address?: Address | Address[]
|
28
33
|
} & (
|
29
34
|
| {
|
30
35
|
event: Narrow<TAbiEvent>
|
31
|
-
args?: MaybeExtractEventArgsFromAbi<[TAbiEvent],
|
36
|
+
args?: MaybeExtractEventArgsFromAbi<[TAbiEvent], _EventName>
|
37
|
+
/**
|
38
|
+
* Whether or not the logs must match the indexed/non-indexed arguments on `event`.
|
39
|
+
* @default false
|
40
|
+
*/
|
41
|
+
strict?: TStrict
|
32
42
|
}
|
33
43
|
| {
|
34
44
|
event?: never
|
35
45
|
args?: never
|
46
|
+
strict?: never
|
36
47
|
}
|
37
48
|
) &
|
38
49
|
(
|
@@ -53,8 +64,9 @@ export type GetLogsParameters<
|
|
53
64
|
|
54
65
|
export type GetLogsReturnType<
|
55
66
|
TAbiEvent extends AbiEvent | undefined = undefined,
|
56
|
-
|
57
|
-
|
67
|
+
TStrict extends boolean | undefined = undefined,
|
68
|
+
_EventName extends string | undefined = MaybeAbiEventName<TAbiEvent>,
|
69
|
+
> = Log<bigint, number, TAbiEvent, TStrict, [TAbiEvent], _EventName>[]
|
58
70
|
|
59
71
|
/**
|
60
72
|
* Returns a list of event logs matching the provided parameters.
|
@@ -81,6 +93,7 @@ export type GetLogsReturnType<
|
|
81
93
|
export async function getLogs<
|
82
94
|
TChain extends Chain | undefined,
|
83
95
|
TAbiEvent extends AbiEvent | undefined,
|
96
|
+
TStrict extends boolean | undefined = undefined,
|
84
97
|
>(
|
85
98
|
client: PublicClient<Transport, TChain>,
|
86
99
|
{
|
@@ -90,8 +103,11 @@ export async function getLogs<
|
|
90
103
|
toBlock,
|
91
104
|
event,
|
92
105
|
args,
|
93
|
-
|
94
|
-
|
106
|
+
strict: strict_,
|
107
|
+
}: GetLogsParameters<TAbiEvent, TStrict> = {},
|
108
|
+
): Promise<GetLogsReturnType<TAbiEvent, TStrict>> {
|
109
|
+
const strict = strict_ ?? false
|
110
|
+
|
95
111
|
let topics: LogTopic[] = []
|
96
112
|
if (event)
|
97
113
|
topics = encodeEventTopics({
|
@@ -129,13 +145,26 @@ export async function getLogs<
|
|
129
145
|
abi: [event] as [AbiEvent],
|
130
146
|
data: log.data,
|
131
147
|
topics: log.topics as any,
|
148
|
+
strict,
|
132
149
|
})
|
133
150
|
: { eventName: undefined, args: undefined }
|
134
151
|
return formatLog(log, { args, eventName })
|
135
|
-
} catch {
|
136
|
-
|
137
|
-
|
152
|
+
} catch (err) {
|
153
|
+
let eventName
|
154
|
+
let isUnnamed
|
155
|
+
if (
|
156
|
+
err instanceof DecodeLogDataMismatch ||
|
157
|
+
err instanceof DecodeLogTopicsMismatch
|
158
|
+
) {
|
159
|
+
// If strict mode is on, and log data/topics do not match event definition, skip.
|
160
|
+
if (strict) return
|
161
|
+
eventName = err.abiItem.name
|
162
|
+
isUnnamed = err.abiItem.inputs?.some((x) => !('name' in x && x.name))
|
163
|
+
}
|
164
|
+
|
165
|
+
// Set args to empty if there is an error decoding (e.g. indexed/non-indexed params mismatch).
|
166
|
+
return formatLog(log, { args: isUnnamed ? [] : {}, eventName })
|
138
167
|
}
|
139
168
|
})
|
140
|
-
.filter(Boolean) as unknown as GetLogsReturnType<TAbiEvent>
|
169
|
+
.filter(Boolean) as unknown as GetLogsReturnType<TAbiEvent, TStrict>
|
141
170
|
}
|
@@ -54,7 +54,7 @@ export type GetTransactionReturnType<TChain extends Chain | undefined = Chain> =
|
|
54
54
|
FormattedTransaction<TransactionFormatter<TChain>>
|
55
55
|
|
56
56
|
/**
|
57
|
-
* Returns information about a [Transaction](https://viem.sh/docs/glossary/terms#transaction) given a hash or block identifier.
|
57
|
+
* Returns information about a [Transaction](https://viem.sh/docs/glossary/terms.html#transaction) given a hash or block identifier.
|
58
58
|
*
|
59
59
|
* - Docs: https://viem.sh/docs/actions/public/getTransaction.html
|
60
60
|
* - Example: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/transactions/fetching-transactions
|
@@ -27,7 +27,7 @@ export type GetTransactionCountParameters = {
|
|
27
27
|
export type GetTransactionCountReturnType = number
|
28
28
|
|
29
29
|
/**
|
30
|
-
* Returns the number of [Transactions](https://viem.sh/docs/glossary/terms#transaction) an Account has broadcast / sent.
|
30
|
+
* Returns the number of [Transactions](https://viem.sh/docs/glossary/terms.html#transaction) an Account has broadcast / sent.
|
31
31
|
*
|
32
32
|
* - Docs: https://viem.sh/docs/actions/public/getTransactionCount.html
|
33
33
|
* - JSON-RPC Methods: [`eth_getTransactionCount`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_gettransactioncount)
|
@@ -58,7 +58,7 @@ export async function getTransactionCount<
|
|
58
58
|
| WalletClient<Transport, TChain, TAccount>,
|
59
59
|
{ address, blockTag = 'latest', blockNumber }: GetTransactionCountParameters,
|
60
60
|
): Promise<GetTransactionCountReturnType> {
|
61
|
-
const count = await client.request({
|
61
|
+
const count = await (client as PublicClient).request({
|
62
62
|
method: 'eth_getTransactionCount',
|
63
63
|
params: [address, blockNumber ? numberToHex(blockNumber) : blockTag],
|
64
64
|
})
|
@@ -20,7 +20,7 @@ export type GetTransactionReceiptReturnType<
|
|
20
20
|
> = FormattedTransactionReceipt<TransactionReceiptFormatter<TChain>>
|
21
21
|
|
22
22
|
/**
|
23
|
-
* Returns the [Transaction Receipt](https://viem.sh/docs/glossary/terms#transaction-receipt) given a [Transaction](https://viem.sh/docs/glossary/terms#transaction) hash.
|
23
|
+
* Returns the [Transaction Receipt](https://viem.sh/docs/glossary/terms.html#transaction-receipt) given a [Transaction](https://viem.sh/docs/glossary/terms.html#transaction) hash.
|
24
24
|
*
|
25
25
|
* - Docs: https://viem.sh/docs/actions/public/getTransactionReceipt.html
|
26
26
|
* - Example: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/transactions/fetching-transactions
|
@@ -41,7 +41,7 @@ export type MulticallReturnType<
|
|
41
41
|
> = MulticallResults<TContracts, TAllowFailure>
|
42
42
|
|
43
43
|
/**
|
44
|
-
* Similar to [`readContract`](https://viem.sh/docs/contract/readContract), but batches up multiple functions on a contract in a single RPC call via the [`multicall3` contract](https://github.com/mds1/multicall).
|
44
|
+
* Similar to [`readContract`](https://viem.sh/docs/contract/readContract.html), but batches up multiple functions on a contract in a single RPC call via the [`multicall3` contract](https://github.com/mds1/multicall).
|
45
45
|
*
|
46
46
|
* - Docs: https://viem.sh/docs/contract/multicall.html
|
47
47
|
*
|
@@ -23,7 +23,7 @@ import { type CallParameters, call } from './call.js'
|
|
23
23
|
export type ReadContractParameters<
|
24
24
|
TAbi extends Abi | readonly unknown[] = Abi,
|
25
25
|
TFunctionName extends string = string,
|
26
|
-
> = Pick<CallParameters, 'blockNumber' | 'blockTag'> &
|
26
|
+
> = Pick<CallParameters, 'account' | 'blockNumber' | 'blockTag'> &
|
27
27
|
ContractFunctionConfig<TAbi, TFunctionName, 'view' | 'pure'>
|
28
28
|
|
29
29
|
export type ReadContractReturnType<
|
@@ -39,7 +39,7 @@ export type ReadContractReturnType<
|
|
39
39
|
*
|
40
40
|
* A "read-only" function (constant function) on a Solidity contract is denoted by a `view` or `pure` keyword. They can only read the state of the contract, and cannot make any changes to it. Since read-only methods do not change the state of the contract, they do not require any gas to be executed, and can be called by any user without the need to pay for gas.
|
41
41
|
*
|
42
|
-
* Internally, uses a [Public Client](https://viem.sh/docs/clients/public) to call the [`call` action](https://viem.sh/docs/actions/public/call) with [ABI-encoded `data`](https://viem.sh/docs/contract/encodeFunctionData).
|
42
|
+
* Internally, uses a [Public Client](https://viem.sh/docs/clients/public.html) to call the [`call` action](https://viem.sh/docs/actions/public/call.html) with [ABI-encoded `data`](https://viem.sh/docs/contract/encodeFunctionData.html).
|
43
43
|
*
|
44
44
|
* @param client - Client to use
|
45
45
|
* @param parameters - {@link ReadContractParameters}
|
@@ -68,9 +68,9 @@ export type SimulateContractReturnType<
|
|
68
68
|
* - Docs: https://viem.sh/docs/contract/simulateContract.html
|
69
69
|
* - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/contracts/writing-to-contracts
|
70
70
|
*
|
71
|
-
* This function does not require gas to execute and _**does not**_ change the state of the blockchain. It is almost identical to [`readContract`](https://viem.sh/docs/contract/readContract), but also supports contract write functions.
|
71
|
+
* This function does not require gas to execute and _**does not**_ change the state of the blockchain. It is almost identical to [`readContract`](https://viem.sh/docs/contract/readContract.html), but also supports contract write functions.
|
72
72
|
*
|
73
|
-
* Internally, uses a [Public Client](https://viem.sh/docs/clients/public) to call the [`call` action](https://viem.sh/docs/actions/public/call) with [ABI-encoded `data`](https://viem.sh/docs/contract/encodeFunctionData).
|
73
|
+
* Internally, uses a [Public Client](https://viem.sh/docs/clients/public.html) to call the [`call` action](https://viem.sh/docs/actions/public/call.html) with [ABI-encoded `data`](https://viem.sh/docs/contract/encodeFunctionData.html).
|
74
74
|
*
|
75
75
|
* @param client - Client to use
|
76
76
|
* @param parameters - {@link SimulateContractParameters}
|
@@ -15,9 +15,9 @@ export type UninstallFilterReturnType = boolean
|
|
15
15
|
* - JSON-RPC Methods: [`eth_uninstallFilter`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_uninstallFilter)
|
16
16
|
*
|
17
17
|
* Destroys a Filter that was created from one of the following Actions:
|
18
|
-
* - [`createBlockFilter`](https://viem.sh/docs/actions/public/createBlockFilter)
|
19
|
-
* - [`createEventFilter`](https://viem.sh/docs/actions/public/createEventFilter)
|
20
|
-
* - [`createPendingTransactionFilter`](https://viem.sh/docs/actions/public/createPendingTransactionFilter)
|
18
|
+
* - [`createBlockFilter`](https://viem.sh/docs/actions/public/createBlockFilter.html)
|
19
|
+
* - [`createEventFilter`](https://viem.sh/docs/actions/public/createEventFilter.html)
|
20
|
+
* - [`createPendingTransactionFilter`](https://viem.sh/docs/actions/public/createPendingTransactionFilter.html)
|
21
21
|
*
|
22
22
|
* @param client - Client to use
|
23
23
|
* @param parameters - {@link UninstallFilterParameters}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import type { Chain } from '../../chains.js'
|
2
2
|
import type { PublicClient } from '../../clients/createPublicClient.js'
|
3
3
|
import type { Transport } from '../../clients/transports/createTransport.js'
|
4
|
-
import type { ByteArray, Hex } from '../../types/misc.js'
|
4
|
+
import type { ByteArray, Hex, SignableMessage } from '../../types/misc.js'
|
5
5
|
import { hashMessage } from '../../utils/index.js'
|
6
6
|
import { type VerifyHashParameters, verifyHash } from './verifyHash.js'
|
7
7
|
import type { Address } from 'abitype'
|
@@ -10,7 +10,7 @@ export type VerifyMessageParameters = Omit<VerifyHashParameters, 'hash'> & {
|
|
10
10
|
/** The address that signed the original message. */
|
11
11
|
address: Address
|
12
12
|
/** The message to be verified. */
|
13
|
-
message:
|
13
|
+
message: SignableMessage
|
14
14
|
/** The signature that was generated by signing the message with the address's private key. */
|
15
15
|
signature: Hex | ByteArray
|
16
16
|
}
|
@@ -3,13 +3,16 @@ import type { PublicClient } from '../../clients/createPublicClient.js'
|
|
3
3
|
import type { Transport } from '../../clients/transports/createTransport.js'
|
4
4
|
import type { ByteArray, Hex } from '../../types/misc.js'
|
5
5
|
import type { TypedDataDefinition } from '../../types/typedData.js'
|
6
|
-
import {
|
6
|
+
import {
|
7
|
+
type HashTypedDataParameters,
|
8
|
+
hashTypedData,
|
9
|
+
} from '../../utils/index.js'
|
7
10
|
import { type VerifyHashParameters, verifyHash } from './verifyHash.js'
|
8
11
|
import type { Address, TypedData } from 'abitype'
|
9
12
|
|
10
13
|
export type VerifyTypedDataParameters<
|
11
|
-
TTypedData extends TypedData |
|
12
|
-
TPrimaryType extends
|
14
|
+
TTypedData extends TypedData | Record<string, unknown> = TypedData,
|
15
|
+
TPrimaryType extends keyof TTypedData = keyof TTypedData,
|
13
16
|
> = Omit<VerifyHashParameters, 'hash'> &
|
14
17
|
TypedDataDefinition<TTypedData, TPrimaryType> & {
|
15
18
|
/** The address to verify the typed data for. */
|
@@ -29,7 +32,11 @@ export type VerifyTypedDataReturnType = boolean
|
|
29
32
|
* @param parameters - {@link VerifyTypedDataParameters}
|
30
33
|
* @returns Whether or not the signature is valid. {@link VerifyTypedDataReturnType}
|
31
34
|
*/
|
32
|
-
export async function verifyTypedData<
|
35
|
+
export async function verifyTypedData<
|
36
|
+
const TTypedData extends TypedData | Record<string, unknown>, // `Record<string, unknown>` allows for non-const asserted types
|
37
|
+
TPrimaryType extends keyof TTypedData,
|
38
|
+
TChain extends Chain | undefined,
|
39
|
+
>(
|
33
40
|
client: PublicClient<Transport, TChain>,
|
34
41
|
{
|
35
42
|
address,
|
@@ -39,9 +46,14 @@ export async function verifyTypedData<TChain extends Chain | undefined,>(
|
|
39
46
|
types,
|
40
47
|
domain,
|
41
48
|
...callRequest
|
42
|
-
}: VerifyTypedDataParameters,
|
49
|
+
}: VerifyTypedDataParameters<TTypedData, TPrimaryType>,
|
43
50
|
): Promise<VerifyTypedDataReturnType> {
|
44
|
-
const hash = hashTypedData({
|
51
|
+
const hash = hashTypedData({
|
52
|
+
message,
|
53
|
+
primaryType,
|
54
|
+
types,
|
55
|
+
domain,
|
56
|
+
} as HashTypedDataParameters)
|
45
57
|
return verifyHash(client, {
|
46
58
|
address,
|
47
59
|
hash,
|
@@ -26,17 +26,20 @@ import { uninstallFilter } from './uninstallFilter.js'
|
|
26
26
|
export type OnLogsParameter<
|
27
27
|
TAbi extends Abi | readonly unknown[] = readonly unknown[],
|
28
28
|
TEventName extends string = string,
|
29
|
+
TStrict extends boolean | undefined = undefined,
|
29
30
|
> = TAbi extends Abi
|
30
|
-
? Log<bigint, number, ExtractAbiEvent<TAbi, TEventName
|
31
|
+
? Log<bigint, number, ExtractAbiEvent<TAbi, TEventName>, TStrict>[]
|
31
32
|
: Log[]
|
32
33
|
export type OnLogsFn<
|
33
34
|
TAbi extends Abi | readonly unknown[] = readonly unknown[],
|
34
35
|
TEventName extends string = string,
|
35
|
-
|
36
|
+
TStrict extends boolean | undefined = undefined,
|
37
|
+
> = (logs: OnLogsParameter<TAbi, TEventName, TStrict>) => void
|
36
38
|
|
37
39
|
export type WatchContractEventParameters<
|
38
40
|
TAbi extends Abi | readonly unknown[] = readonly unknown[],
|
39
41
|
TEventName extends string = string,
|
42
|
+
TStrict extends boolean | undefined = undefined,
|
40
43
|
> = {
|
41
44
|
/** The address of the contract. */
|
42
45
|
address?: Address | Address[]
|
@@ -50,9 +53,14 @@ export type WatchContractEventParameters<
|
|
50
53
|
/** The callback to call when an error occurred when trying to get for a new block. */
|
51
54
|
onError?: (error: Error) => void
|
52
55
|
/** The callback to call when new event logs are received. */
|
53
|
-
onLogs: OnLogsFn<TAbi, TEventName>
|
56
|
+
onLogs: OnLogsFn<TAbi, TEventName, TStrict>
|
54
57
|
/** Polling frequency (in ms). Defaults to Client's pollingInterval config. */
|
55
58
|
pollingInterval?: number
|
59
|
+
/**
|
60
|
+
* Whether or not the logs must match the indexed/non-indexed arguments on `event`.
|
61
|
+
* @default false
|
62
|
+
*/
|
63
|
+
strict?: TStrict
|
56
64
|
}
|
57
65
|
|
58
66
|
export type WatchContractEventReturnType = () => void
|
@@ -64,7 +72,7 @@ export type WatchContractEventReturnType = () => void
|
|
64
72
|
*
|
65
73
|
* This Action will batch up all the event logs found within the [`pollingInterval`](https://viem.sh/docs/contract/watchContractEvent.html#pollinginterval-optional), and invoke them via [`onLogs`](https://viem.sh/docs/contract/watchContractEvent.html#onLogs).
|
66
74
|
*
|
67
|
-
* `watchContractEvent` will attempt to create an [Event Filter](https://viem.sh/docs/contract/createContractEventFilter) and listen to changes to the Filter per polling interval, however, if the RPC Provider does not support Filters (e.g. `eth_newFilter`), then `watchContractEvent` will fall back to using [`getLogs`](https://viem.sh/docs/actions/public/getLogs) instead.
|
75
|
+
* `watchContractEvent` will attempt to create an [Event Filter](https://viem.sh/docs/contract/createContractEventFilter.html) and listen to changes to the Filter per polling interval, however, if the RPC Provider does not support Filters (e.g. `eth_newFilter`), then `watchContractEvent` will fall back to using [`getLogs`](https://viem.sh/docs/actions/public/getLogs) instead.
|
68
76
|
*
|
69
77
|
* @param client - Client to use
|
70
78
|
* @param parameters - {@link WatchContractEventParameters}
|
@@ -91,6 +99,7 @@ export function watchContractEvent<
|
|
91
99
|
TChain extends Chain | undefined,
|
92
100
|
TAbi extends Abi | readonly unknown[],
|
93
101
|
TEventName extends string,
|
102
|
+
TStrict extends boolean | undefined = undefined,
|
94
103
|
>(
|
95
104
|
client: PublicClient<Transport, TChain>,
|
96
105
|
{
|
@@ -102,7 +111,8 @@ export function watchContractEvent<
|
|
102
111
|
onError,
|
103
112
|
onLogs,
|
104
113
|
pollingInterval = client.pollingInterval,
|
105
|
-
|
114
|
+
strict: strict_,
|
115
|
+
}: WatchContractEventParameters<TAbi, TEventName, TStrict>,
|
106
116
|
): WatchContractEventReturnType {
|
107
117
|
const observerId = stringify([
|
108
118
|
'watchContractEvent',
|
@@ -113,6 +123,7 @@ export function watchContractEvent<
|
|
113
123
|
eventName,
|
114
124
|
pollingInterval,
|
115
125
|
])
|
126
|
+
const strict = strict_ ?? false
|
116
127
|
|
117
128
|
return observe(observerId, { onLogs, onError }, (emit) => {
|
118
129
|
let previousBlockNumber: bigint
|
@@ -128,6 +139,7 @@ export function watchContractEvent<
|
|
128
139
|
address,
|
129
140
|
args,
|
130
141
|
eventName,
|
142
|
+
strict,
|
131
143
|
} as unknown as CreateContractEventFilterParameters)) as Filter<
|
132
144
|
'event',
|
133
145
|
TAbi,
|