viem 1.6.6 → 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/actions/public/estimateFeesPerGas.js +59 -0
- package/dist/cjs/actions/public/estimateFeesPerGas.js.map +1 -0
- package/dist/cjs/actions/public/estimateMaxPriorityFeePerGas.js +44 -0
- package/dist/cjs/actions/public/estimateMaxPriorityFeePerGas.js.map +1 -0
- package/dist/cjs/actions/public/verifyHash.js.map +1 -1
- package/dist/cjs/actions/public/verifyMessage.js.map +1 -1
- package/dist/cjs/actions/public/verifyTypedData.js.map +1 -1
- package/dist/cjs/actions/wallet/deployContract.js.map +1 -1
- package/dist/cjs/actions/wallet/sendTransaction.js.map +1 -1
- package/dist/cjs/actions/wallet/writeContract.js.map +1 -1
- package/dist/cjs/clients/createTestClient.js.map +1 -1
- package/dist/cjs/clients/decorators/public.js +4 -0
- package/dist/cjs/clients/decorators/public.js.map +1 -1
- package/dist/cjs/errors/fee.js +42 -0
- package/dist/cjs/errors/fee.js.map +1 -0
- package/dist/cjs/errors/version.js +1 -1
- package/dist/cjs/index.js +8 -4
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/public.js +5 -1
- package/dist/cjs/public.js.map +1 -1
- package/dist/cjs/utils/transaction/prepareRequest.js +26 -29
- package/dist/cjs/utils/transaction/prepareRequest.js.map +1 -1
- package/dist/esm/actions/public/estimateFeesPerGas.js +77 -0
- package/dist/esm/actions/public/estimateFeesPerGas.js.map +1 -0
- package/dist/esm/actions/public/estimateMaxPriorityFeePerGas.js +64 -0
- package/dist/esm/actions/public/estimateMaxPriorityFeePerGas.js.map +1 -0
- package/dist/esm/actions/public/verifyHash.js.map +1 -1
- package/dist/esm/actions/public/verifyMessage.js.map +1 -1
- package/dist/esm/actions/public/verifyTypedData.js.map +1 -1
- package/dist/esm/actions/wallet/deployContract.js.map +1 -1
- package/dist/esm/actions/wallet/sendTransaction.js.map +1 -1
- package/dist/esm/actions/wallet/writeContract.js.map +1 -1
- package/dist/esm/clients/createTestClient.js.map +1 -1
- package/dist/esm/clients/decorators/public.js +4 -0
- package/dist/esm/clients/decorators/public.js.map +1 -1
- package/dist/esm/errors/fee.js +36 -0
- package/dist/esm/errors/fee.js.map +1 -0
- package/dist/esm/errors/version.js +1 -1
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/public.js +2 -0
- package/dist/esm/public.js.map +1 -1
- package/dist/esm/utils/transaction/prepareRequest.js +27 -31
- package/dist/esm/utils/transaction/prepareRequest.js.map +1 -1
- package/dist/types/abi.d.ts +6 -0
- package/dist/types/abi.d.ts.map +1 -0
- package/dist/types/accounts/generateMnemonic.d.ts +9 -0
- package/dist/types/accounts/generateMnemonic.d.ts.map +1 -0
- package/dist/types/accounts/generatePrivateKey.d.ts +8 -0
- package/dist/types/accounts/generatePrivateKey.d.ts.map +1 -0
- package/dist/types/accounts/hdKeyToAccount.d.ts +9 -0
- package/dist/types/accounts/hdKeyToAccount.d.ts.map +1 -0
- package/dist/types/accounts/index.d.ts +27 -0
- package/dist/types/accounts/index.d.ts.map +1 -0
- package/dist/types/accounts/mnemonicToAccount.d.ts +8 -0
- package/dist/types/accounts/mnemonicToAccount.d.ts.map +1 -0
- package/dist/types/accounts/privateKeyToAccount.d.ts +9 -0
- package/dist/types/accounts/privateKeyToAccount.d.ts.map +1 -0
- package/dist/types/accounts/toAccount.d.ts +11 -0
- package/dist/types/accounts/toAccount.d.ts.map +1 -0
- package/dist/types/accounts/types.d.ts +52 -0
- package/dist/types/accounts/types.d.ts.map +1 -0
- package/dist/types/accounts/utils/parseAccount.d.ts +4 -0
- package/dist/types/accounts/utils/parseAccount.d.ts.map +1 -0
- package/dist/types/accounts/utils/privateKeyToAddress.d.ts +11 -0
- package/dist/types/accounts/utils/privateKeyToAddress.d.ts.map +1 -0
- package/dist/types/accounts/utils/publicKeyToAddress.d.ts +11 -0
- package/dist/types/accounts/utils/publicKeyToAddress.d.ts.map +1 -0
- package/dist/types/accounts/utils/sign.d.ts +16 -0
- package/dist/types/accounts/utils/sign.d.ts.map +1 -0
- package/dist/types/accounts/utils/signMessage.d.ts +16 -0
- package/dist/types/accounts/utils/signMessage.d.ts.map +1 -0
- package/dist/types/accounts/utils/signTransaction.d.ts +12 -0
- package/dist/types/accounts/utils/signTransaction.d.ts.map +1 -0
- package/dist/types/accounts/utils/signTypedData.d.ts +20 -0
- package/dist/types/accounts/utils/signTypedData.d.ts.map +1 -0
- package/dist/types/accounts/wordlists/czech.d.ts +2 -0
- package/dist/types/accounts/wordlists/czech.d.ts.map +1 -0
- package/dist/types/accounts/wordlists/english.d.ts +2 -0
- package/dist/types/accounts/wordlists/english.d.ts.map +1 -0
- package/dist/types/accounts/wordlists/french.d.ts +2 -0
- package/dist/types/accounts/wordlists/french.d.ts.map +1 -0
- package/dist/types/accounts/wordlists/italian.d.ts +2 -0
- package/dist/types/accounts/wordlists/italian.d.ts.map +1 -0
- package/dist/types/accounts/wordlists/japanese.d.ts +2 -0
- package/dist/types/accounts/wordlists/japanese.d.ts.map +1 -0
- package/dist/types/accounts/wordlists/korean.d.ts +2 -0
- package/dist/types/accounts/wordlists/korean.d.ts.map +1 -0
- package/dist/types/accounts/wordlists/simplifiedChinese.d.ts +2 -0
- package/dist/types/accounts/wordlists/simplifiedChinese.d.ts.map +1 -0
- package/dist/types/accounts/wordlists/spanish.d.ts +2 -0
- package/dist/types/accounts/wordlists/spanish.d.ts.map +1 -0
- package/dist/types/accounts/wordlists/traditionalChinese.d.ts +2 -0
- package/dist/types/accounts/wordlists/traditionalChinese.d.ts.map +1 -0
- package/dist/types/actions/ens/getEnsAddress.d.ts +45 -0
- package/dist/types/actions/ens/getEnsAddress.d.ts.map +1 -0
- package/dist/types/actions/ens/getEnsAvatar.d.ts +41 -0
- package/dist/types/actions/ens/getEnsAvatar.d.ts.map +1 -0
- package/dist/types/actions/ens/getEnsName.d.ts +41 -0
- package/dist/types/actions/ens/getEnsName.d.ts.map +1 -0
- package/dist/types/actions/ens/getEnsResolver.d.ts +43 -0
- package/dist/types/actions/ens/getEnsResolver.d.ts.map +1 -0
- package/dist/types/actions/ens/getEnsText.d.ts +46 -0
- package/dist/types/actions/ens/getEnsText.d.ts.map +1 -0
- package/dist/types/actions/getContract.d.ts +314 -0
- package/dist/types/actions/getContract.d.ts.map +1 -0
- package/dist/types/actions/index.d.ts +80 -0
- package/dist/types/actions/index.d.ts.map +1 -0
- package/dist/types/actions/public/call.d.ts +56 -0
- package/dist/types/actions/public/call.d.ts.map +1 -0
- package/dist/types/actions/public/createBlockFilter.d.ts +28 -0
- package/dist/types/actions/public/createBlockFilter.d.ts.map +1 -0
- package/dist/types/actions/public/createContractEventFilter.d.ts +50 -0
- package/dist/types/actions/public/createContractEventFilter.d.ts.map +1 -0
- package/dist/types/actions/public/createEventFilter.d.ts +76 -0
- package/dist/types/actions/public/createEventFilter.d.ts.map +1 -0
- package/dist/types/actions/public/createPendingTransactionFilter.d.ts +28 -0
- package/dist/types/actions/public/createPendingTransactionFilter.d.ts.map +1 -0
- package/dist/types/actions/public/estimateContractGas.d.ts +39 -0
- package/dist/types/actions/public/estimateContractGas.d.ts.map +1 -0
- package/dist/types/actions/public/estimateFeesPerGas.d.ts +48 -0
- package/dist/types/actions/public/estimateFeesPerGas.d.ts.map +1 -0
- package/dist/types/actions/public/estimateGas.d.ts +49 -0
- package/dist/types/actions/public/estimateGas.d.ts.map +1 -0
- package/dist/types/actions/public/estimateMaxPriorityFeePerGas.d.ts +35 -0
- package/dist/types/actions/public/estimateMaxPriorityFeePerGas.d.ts.map +1 -0
- package/dist/types/actions/public/getBalance.d.ts +55 -0
- package/dist/types/actions/public/getBalance.d.ts.map +1 -0
- package/dist/types/actions/public/getBlock.d.ts +56 -0
- package/dist/types/actions/public/getBlock.d.ts.map +1 -0
- package/dist/types/actions/public/getBlockNumber.d.ts +57 -0
- package/dist/types/actions/public/getBlockNumber.d.ts.map +1 -0
- package/dist/types/actions/public/getBlockTransactionCount.d.ts +47 -0
- package/dist/types/actions/public/getBlockTransactionCount.d.ts.map +1 -0
- package/dist/types/actions/public/getBytecode.d.ts +41 -0
- package/dist/types/actions/public/getBytecode.d.ts.map +1 -0
- package/dist/types/actions/public/getChainId.d.ts +28 -0
- package/dist/types/actions/public/getChainId.d.ts.map +1 -0
- package/dist/types/actions/public/getFeeHistory.d.ts +53 -0
- package/dist/types/actions/public/getFeeHistory.d.ts.map +1 -0
- package/dist/types/actions/public/getFilterChanges.d.ts +96 -0
- package/dist/types/actions/public/getFilterChanges.d.ts.map +1 -0
- package/dist/types/actions/public/getFilterLogs.d.ts +40 -0
- package/dist/types/actions/public/getFilterLogs.d.ts.map +1 -0
- package/dist/types/actions/public/getGasPrice.d.ts +27 -0
- package/dist/types/actions/public/getGasPrice.d.ts.map +1 -0
- package/dist/types/actions/public/getLogs.d.ts +71 -0
- package/dist/types/actions/public/getLogs.d.ts.map +1 -0
- package/dist/types/actions/public/getStorageAt.d.ts +43 -0
- package/dist/types/actions/public/getStorageAt.d.ts.map +1 -0
- package/dist/types/actions/public/getTransaction.d.ts +65 -0
- package/dist/types/actions/public/getTransaction.d.ts.map +1 -0
- package/dist/types/actions/public/getTransactionConfirmations.d.ts +41 -0
- package/dist/types/actions/public/getTransactionConfirmations.d.ts.map +1 -0
- package/dist/types/actions/public/getTransactionCount.d.ts +44 -0
- package/dist/types/actions/public/getTransactionCount.d.ts.map +1 -0
- package/dist/types/actions/public/getTransactionReceipt.d.ts +36 -0
- package/dist/types/actions/public/getTransactionReceipt.d.ts.map +1 -0
- package/dist/types/actions/public/multicall.d.ts +56 -0
- package/dist/types/actions/public/multicall.d.ts.map +1 -0
- package/dist/types/actions/public/readContract.d.ts +41 -0
- package/dist/types/actions/public/readContract.d.ts.map +1 -0
- package/dist/types/actions/public/simulateContract.d.ts +54 -0
- package/dist/types/actions/public/simulateContract.d.ts.map +1 -0
- package/dist/types/actions/public/uninstallFilter.d.ts +34 -0
- package/dist/types/actions/public/uninstallFilter.d.ts.map +1 -0
- package/dist/types/actions/public/verifyHash.d.ts +24 -0
- package/dist/types/actions/public/verifyHash.d.ts.map +1 -0
- package/dist/types/actions/public/verifyMessage.d.ts +28 -0
- package/dist/types/actions/public/verifyMessage.d.ts.map +1 -0
- package/dist/types/actions/public/verifyTypedData.d.ts +27 -0
- package/dist/types/actions/public/verifyTypedData.d.ts.map +1 -0
- package/dist/types/actions/public/waitForTransactionReceipt.d.ts +72 -0
- package/dist/types/actions/public/waitForTransactionReceipt.d.ts.map +1 -0
- package/dist/types/actions/public/watchBlockNumber.d.ts +59 -0
- package/dist/types/actions/public/watchBlockNumber.d.ts.map +1 -0
- package/dist/types/actions/public/watchBlocks.d.ts +67 -0
- package/dist/types/actions/public/watchBlocks.d.ts.map +1 -0
- package/dist/types/actions/public/watchContractEvent.d.ts +89 -0
- package/dist/types/actions/public/watchContractEvent.d.ts.map +1 -0
- package/dist/types/actions/public/watchEvent.d.ts +104 -0
- package/dist/types/actions/public/watchEvent.d.ts.map +1 -0
- package/dist/types/actions/public/watchPendingTransactions.d.ts +74 -0
- package/dist/types/actions/public/watchPendingTransactions.d.ts.map +1 -0
- package/dist/types/actions/test/dropTransaction.d.ts +33 -0
- package/dist/types/actions/test/dropTransaction.d.ts.map +1 -0
- package/dist/types/actions/test/getAutomine.d.ts +27 -0
- package/dist/types/actions/test/getAutomine.d.ts.map +1 -0
- package/dist/types/actions/test/getTxpoolContent.d.ts +34 -0
- package/dist/types/actions/test/getTxpoolContent.d.ts.map +1 -0
- package/dist/types/actions/test/getTxpoolStatus.d.ts +30 -0
- package/dist/types/actions/test/getTxpoolStatus.d.ts.map +1 -0
- package/dist/types/actions/test/impersonateAccount.d.ts +33 -0
- package/dist/types/actions/test/impersonateAccount.d.ts.map +1 -0
- package/dist/types/actions/test/increaseTime.d.ts +32 -0
- package/dist/types/actions/test/increaseTime.d.ts.map +1 -0
- package/dist/types/actions/test/inspectTxpool.d.ts +31 -0
- package/dist/types/actions/test/inspectTxpool.d.ts.map +1 -0
- package/dist/types/actions/test/mine.d.ts +32 -0
- package/dist/types/actions/test/mine.d.ts.map +1 -0
- package/dist/types/actions/test/removeBlockTimestampInterval.d.ts +25 -0
- package/dist/types/actions/test/removeBlockTimestampInterval.d.ts.map +1 -0
- package/dist/types/actions/test/reset.d.ts +32 -0
- package/dist/types/actions/test/reset.d.ts.map +1 -0
- package/dist/types/actions/test/revert.d.ts +31 -0
- package/dist/types/actions/test/revert.d.ts.map +1 -0
- package/dist/types/actions/test/sendUnsignedTransaction.d.ts +35 -0
- package/dist/types/actions/test/sendUnsignedTransaction.d.ts.map +1 -0
- package/dist/types/actions/test/setAutomine.d.ts +25 -0
- package/dist/types/actions/test/setAutomine.d.ts.map +1 -0
- package/dist/types/actions/test/setBalance.d.ts +36 -0
- package/dist/types/actions/test/setBalance.d.ts.map +1 -0
- package/dist/types/actions/test/setBlockGasLimit.d.ts +30 -0
- package/dist/types/actions/test/setBlockGasLimit.d.ts.map +1 -0
- package/dist/types/actions/test/setBlockTimestampInterval.d.ts +30 -0
- package/dist/types/actions/test/setBlockTimestampInterval.d.ts.map +1 -0
- package/dist/types/actions/test/setCode.d.ts +37 -0
- package/dist/types/actions/test/setCode.d.ts.map +1 -0
- package/dist/types/actions/test/setCoinbase.d.ts +33 -0
- package/dist/types/actions/test/setCoinbase.d.ts.map +1 -0
- package/dist/types/actions/test/setIntervalMining.d.ts +30 -0
- package/dist/types/actions/test/setIntervalMining.d.ts.map +1 -0
- package/dist/types/actions/test/setLoggingEnabled.d.ts +25 -0
- package/dist/types/actions/test/setLoggingEnabled.d.ts.map +1 -0
- package/dist/types/actions/test/setMinGasPrice.d.ts +34 -0
- package/dist/types/actions/test/setMinGasPrice.d.ts.map +1 -0
- package/dist/types/actions/test/setNextBlockBaseFeePerGas.d.ts +32 -0
- package/dist/types/actions/test/setNextBlockBaseFeePerGas.d.ts.map +1 -0
- package/dist/types/actions/test/setNextBlockTimestamp.d.ts +30 -0
- package/dist/types/actions/test/setNextBlockTimestamp.d.ts.map +1 -0
- package/dist/types/actions/test/setNonce.d.ts +36 -0
- package/dist/types/actions/test/setNonce.d.ts.map +1 -0
- package/dist/types/actions/test/setRpcUrl.d.ts +26 -0
- package/dist/types/actions/test/setRpcUrl.d.ts.map +1 -0
- package/dist/types/actions/test/setStorageAt.d.ts +40 -0
- package/dist/types/actions/test/setStorageAt.d.ts.map +1 -0
- package/dist/types/actions/test/snapshot.d.ts +25 -0
- package/dist/types/actions/test/snapshot.d.ts.map +1 -0
- package/dist/types/actions/test/stopImpersonatingAccount.d.ts +33 -0
- package/dist/types/actions/test/stopImpersonatingAccount.d.ts.map +1 -0
- package/dist/types/actions/wallet/addChain.d.ts +29 -0
- package/dist/types/actions/wallet/addChain.d.ts.map +1 -0
- package/dist/types/actions/wallet/deployContract.d.ts +44 -0
- package/dist/types/actions/wallet/deployContract.d.ts.map +1 -0
- package/dist/types/actions/wallet/getAddresses.d.ts +28 -0
- package/dist/types/actions/wallet/getAddresses.d.ts.map +1 -0
- package/dist/types/actions/wallet/getPermissions.d.ts +28 -0
- package/dist/types/actions/wallet/getPermissions.d.ts.map +1 -0
- package/dist/types/actions/wallet/requestAddresses.d.ts +32 -0
- package/dist/types/actions/wallet/requestAddresses.d.ts.map +1 -0
- package/dist/types/actions/wallet/requestPermissions.d.ts +37 -0
- package/dist/types/actions/wallet/requestPermissions.d.ts.map +1 -0
- package/dist/types/actions/wallet/sendTransaction.d.ts +58 -0
- package/dist/types/actions/wallet/sendTransaction.d.ts.map +1 -0
- package/dist/types/actions/wallet/signMessage.d.ts +58 -0
- package/dist/types/actions/wallet/signMessage.d.ts.map +1 -0
- package/dist/types/actions/wallet/signTypedData.d.ts +114 -0
- package/dist/types/actions/wallet/signTypedData.d.ts.map +1 -0
- package/dist/types/actions/wallet/switchChain.d.ts +30 -0
- package/dist/types/actions/wallet/switchChain.d.ts.map +1 -0
- package/dist/types/actions/wallet/watchAsset.d.ts +37 -0
- package/dist/types/actions/wallet/watchAsset.d.ts.map +1 -0
- package/dist/types/actions/wallet/writeContract.d.ts +69 -0
- package/dist/types/actions/wallet/writeContract.d.ts.map +1 -0
- package/dist/types/chains/celo/formatters.d.ts +195 -0
- package/dist/types/chains/celo/formatters.d.ts.map +1 -0
- package/dist/types/chains/celo/parsers.d.ts +6 -0
- package/dist/types/chains/celo/parsers.d.ts.map +1 -0
- package/dist/types/chains/celo/serializers.d.ts +9 -0
- package/dist/types/chains/celo/serializers.d.ts.map +1 -0
- package/dist/types/chains/celo/types.d.ts +74 -0
- package/dist/types/chains/celo/types.d.ts.map +1 -0
- package/dist/types/chains/index.d.ts +5329 -0
- package/dist/types/chains/index.d.ts.map +1 -0
- package/dist/types/chains/optimism/fees.d.ts +4 -0
- package/dist/types/chains/optimism/fees.d.ts.map +1 -0
- package/dist/types/chains/optimism/formatters.d.ts +299 -0
- package/dist/types/chains/optimism/formatters.d.ts.map +1 -0
- package/dist/types/chains/optimism/types.d.ts +53 -0
- package/dist/types/chains/optimism/types.d.ts.map +1 -0
- package/dist/types/chains/utils.d.ts +7 -0
- package/dist/types/chains/utils.d.ts.map +1 -0
- package/dist/types/clients/createClient.d.ts +79 -0
- package/dist/types/clients/createClient.d.ts.map +1 -0
- package/dist/types/clients/createPublicClient.d.ts +29 -0
- package/dist/types/clients/createPublicClient.d.ts.map +1 -0
- package/dist/types/clients/createTestClient.d.ts +43 -0
- package/dist/types/clients/createTestClient.d.ts.map +1 -0
- package/dist/types/clients/createWalletClient.d.ts +49 -0
- package/dist/types/clients/createWalletClient.d.ts.map +1 -0
- package/dist/types/clients/decorators/public.d.ts +1133 -0
- package/dist/types/clients/decorators/public.d.ts.map +1 -0
- package/dist/types/clients/decorators/test.d.ts +599 -0
- package/dist/types/clients/decorators/test.d.ts.map +1 -0
- package/dist/types/clients/decorators/wallet.d.ts +449 -0
- package/dist/types/clients/decorators/wallet.d.ts.map +1 -0
- package/dist/types/clients/transports/createTransport.d.ts +34 -0
- package/dist/types/clients/transports/createTransport.d.ts.map +1 -0
- package/dist/types/clients/transports/custom.d.ts +21 -0
- package/dist/types/clients/transports/custom.d.ts.map +1 -0
- package/dist/types/clients/transports/fallback.d.ts +75 -0
- package/dist/types/clients/transports/fallback.d.ts.map +1 -0
- package/dist/types/clients/transports/http.d.ts +40 -0
- package/dist/types/clients/transports/http.d.ts.map +1 -0
- package/dist/types/clients/transports/webSocket.d.ts +46 -0
- package/dist/types/clients/transports/webSocket.d.ts.map +1 -0
- package/dist/types/constants/abis.d.ts +165 -0
- package/dist/types/constants/abis.d.ts.map +1 -0
- package/dist/types/constants/address.d.ts +2 -0
- package/dist/types/constants/address.d.ts.map +1 -0
- package/dist/types/constants/contract.d.ts +2 -0
- package/dist/types/constants/contract.d.ts.map +1 -0
- package/dist/types/constants/contracts.d.ts +2 -0
- package/dist/types/constants/contracts.d.ts.map +1 -0
- package/dist/types/constants/number.d.ts +97 -0
- package/dist/types/constants/number.d.ts.map +1 -0
- package/dist/types/constants/solidity.d.ts +15 -0
- package/dist/types/constants/solidity.d.ts.map +1 -0
- package/dist/types/constants/unit.d.ts +13 -0
- package/dist/types/constants/unit.d.ts.map +1 -0
- package/dist/types/contract.d.ts +30 -0
- package/dist/types/contract.d.ts.map +1 -0
- package/dist/types/ens.d.ts +9 -0
- package/dist/types/ens.d.ts.map +1 -0
- package/dist/types/errors/abi.d.ts +169 -0
- package/dist/types/errors/abi.d.ts.map +1 -0
- package/dist/types/errors/account.d.ts +8 -0
- package/dist/types/errors/account.d.ts.map +1 -0
- package/dist/types/errors/address.d.ts +8 -0
- package/dist/types/errors/address.d.ts.map +1 -0
- package/dist/types/errors/base.d.ts +24 -0
- package/dist/types/errors/base.d.ts.map +1 -0
- package/dist/types/errors/block.d.ts +10 -0
- package/dist/types/errors/block.d.ts.map +1 -0
- package/dist/types/errors/ccip.d.ts +29 -0
- package/dist/types/errors/ccip.d.ts.map +1 -0
- package/dist/types/errors/chain.d.ts +35 -0
- package/dist/types/errors/chain.d.ts.map +1 -0
- package/dist/types/errors/contract.d.ts +64 -0
- package/dist/types/errors/contract.d.ts.map +1 -0
- package/dist/types/errors/data.d.ts +18 -0
- package/dist/types/errors/data.d.ts.map +1 -0
- package/dist/types/errors/encoding.d.ts +53 -0
- package/dist/types/errors/encoding.d.ts.map +1 -0
- package/dist/types/errors/ens.d.ts +26 -0
- package/dist/types/errors/ens.d.ts.map +1 -0
- package/dist/types/errors/estimateGas.d.ts +14 -0
- package/dist/types/errors/estimateGas.d.ts.map +1 -0
- package/dist/types/errors/fee.d.ts +16 -0
- package/dist/types/errors/fee.d.ts.map +1 -0
- package/dist/types/errors/log.d.ts +6 -0
- package/dist/types/errors/log.d.ts.map +1 -0
- package/dist/types/errors/node.d.ts +105 -0
- package/dist/types/errors/node.d.ts.map +1 -0
- package/dist/types/errors/request.d.ts +61 -0
- package/dist/types/errors/request.d.ts.map +1 -0
- package/dist/types/errors/rpc.d.ts +221 -0
- package/dist/types/errors/rpc.d.ts.map +1 -0
- package/dist/types/errors/transaction.d.ts +79 -0
- package/dist/types/errors/transaction.d.ts.map +1 -0
- package/dist/types/errors/transport.d.ts +5 -0
- package/dist/types/errors/transport.d.ts.map +1 -0
- package/dist/types/errors/utils.d.ts +5 -0
- package/dist/types/errors/utils.d.ts.map +1 -0
- package/dist/types/errors/version.d.ts +2 -0
- package/dist/types/errors/version.d.ts.map +1 -0
- package/dist/types/index.d.ts +215 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/public.d.ts +33 -0
- package/dist/types/public.d.ts.map +1 -0
- package/dist/types/test.d.ts +29 -0
- package/dist/types/test.d.ts.map +1 -0
- package/dist/types/types/account.d.ts +12 -0
- package/dist/types/types/account.d.ts.map +1 -0
- package/dist/types/types/block.d.ts +62 -0
- package/dist/types/types/block.d.ts.map +1 -0
- package/dist/types/types/chain.d.ts +115 -0
- package/dist/types/types/chain.d.ts.map +1 -0
- package/dist/types/types/contract.d.ts +138 -0
- package/dist/types/types/contract.d.ts.map +1 -0
- package/dist/types/types/eip1193.d.ts +1228 -0
- package/dist/types/types/eip1193.d.ts.map +1 -0
- package/dist/types/types/ens.d.ts +5 -0
- package/dist/types/types/ens.d.ts.map +1 -0
- package/dist/types/types/fee.d.ts +30 -0
- package/dist/types/types/fee.d.ts.map +1 -0
- package/dist/types/types/filter.d.ts +40 -0
- package/dist/types/types/filter.d.ts.map +1 -0
- package/dist/types/types/log.d.ts +55 -0
- package/dist/types/types/log.d.ts.map +1 -0
- package/dist/types/types/misc.d.ts +14 -0
- package/dist/types/types/misc.d.ts.map +1 -0
- package/dist/types/types/multicall.d.ts +48 -0
- package/dist/types/types/multicall.d.ts.map +1 -0
- package/dist/types/types/rpc.d.ts +20 -0
- package/dist/types/types/rpc.d.ts.map +1 -0
- package/dist/types/types/transaction.d.ts +147 -0
- package/dist/types/types/transaction.d.ts.map +1 -0
- package/dist/types/types/transport.d.ts +3 -0
- package/dist/types/types/transport.d.ts.map +1 -0
- package/dist/types/types/typedData.d.ts +47 -0
- package/dist/types/types/typedData.d.ts.map +1 -0
- package/dist/types/types/utils.d.ts +188 -0
- package/dist/types/types/utils.d.ts.map +1 -0
- package/dist/types/types/window.d.ts +7 -0
- package/dist/types/types/window.d.ts.map +1 -0
- package/dist/types/utils/abi/decodeAbiParameters.d.ts +5 -0
- package/dist/types/utils/abi/decodeAbiParameters.d.ts.map +1 -0
- package/dist/types/utils/abi/decodeDeployData.d.ts +13 -0
- package/dist/types/utils/abi/decodeDeployData.d.ts.map +1 -0
- package/dist/types/utils/abi/decodeErrorResult.d.ts +16 -0
- package/dist/types/utils/abi/decodeErrorResult.d.ts.map +1 -0
- package/dist/types/utils/abi/decodeEventLog.d.ts +20 -0
- package/dist/types/utils/abi/decodeEventLog.d.ts.map +1 -0
- package/dist/types/utils/abi/decodeFunctionData.d.ts +15 -0
- package/dist/types/utils/abi/decodeFunctionData.d.ts.map +1 -0
- package/dist/types/utils/abi/decodeFunctionResult.d.ts +14 -0
- package/dist/types/utils/abi/decodeFunctionResult.d.ts.map +1 -0
- package/dist/types/utils/abi/encodeAbiParameters.d.ts +9 -0
- package/dist/types/utils/abi/encodeAbiParameters.d.ts.map +1 -0
- package/dist/types/utils/abi/encodeDeployData.d.ts +9 -0
- package/dist/types/utils/abi/encodeDeployData.d.ts.map +1 -0
- package/dist/types/utils/abi/encodeErrorResult.d.ts +11 -0
- package/dist/types/utils/abi/encodeErrorResult.d.ts.map +1 -0
- package/dist/types/utils/abi/encodeEventTopics.d.ts +13 -0
- package/dist/types/utils/abi/encodeEventTopics.d.ts.map +1 -0
- package/dist/types/utils/abi/encodeFunctionData.d.ts +11 -0
- package/dist/types/utils/abi/encodeFunctionData.d.ts.map +1 -0
- package/dist/types/utils/abi/encodeFunctionResult.d.ts +13 -0
- package/dist/types/utils/abi/encodeFunctionResult.d.ts.map +1 -0
- package/dist/types/utils/abi/encodePacked.d.ts +11 -0
- package/dist/types/utils/abi/encodePacked.d.ts.map +1 -0
- package/dist/types/utils/abi/formatAbiItem.d.ts +9 -0
- package/dist/types/utils/abi/formatAbiItem.d.ts.map +1 -0
- package/dist/types/utils/abi/formatAbiItemWithArgs.d.ts +8 -0
- package/dist/types/utils/abi/formatAbiItemWithArgs.d.ts.map +1 -0
- package/dist/types/utils/abi/getAbiItem.d.ts +12 -0
- package/dist/types/utils/abi/getAbiItem.d.ts.map +1 -0
- package/dist/types/utils/accounts.d.ts +3 -0
- package/dist/types/utils/accounts.d.ts.map +1 -0
- package/dist/types/utils/address/getAddress.d.ts +4 -0
- package/dist/types/utils/address/getAddress.d.ts.map +1 -0
- package/dist/types/utils/address/getContractAddress.d.ts +20 -0
- package/dist/types/utils/address/getContractAddress.d.ts.map +1 -0
- package/dist/types/utils/address/isAddress.d.ts +3 -0
- package/dist/types/utils/address/isAddress.d.ts.map +1 -0
- package/dist/types/utils/address/isAddressEqual.d.ts +3 -0
- package/dist/types/utils/address/isAddressEqual.d.ts.map +1 -0
- package/dist/types/utils/buildRequest.d.ts +6 -0
- package/dist/types/utils/buildRequest.d.ts.map +1 -0
- package/dist/types/utils/ccip.d.ts +37 -0
- package/dist/types/utils/ccip.d.ts.map +1 -0
- package/dist/types/utils/chain.d.ts +14 -0
- package/dist/types/utils/chain.d.ts.map +1 -0
- package/dist/types/utils/contract/extractFunctionParts.d.ts +13 -0
- package/dist/types/utils/contract/extractFunctionParts.d.ts.map +1 -0
- package/dist/types/utils/data/concat.d.ts +6 -0
- package/dist/types/utils/data/concat.d.ts.map +1 -0
- package/dist/types/utils/data/isBytes.d.ts +3 -0
- package/dist/types/utils/data/isBytes.d.ts.map +1 -0
- package/dist/types/utils/data/isBytesEqual.d.ts +3 -0
- package/dist/types/utils/data/isBytesEqual.d.ts.map +1 -0
- package/dist/types/utils/data/isHex.d.ts +5 -0
- package/dist/types/utils/data/isHex.d.ts.map +1 -0
- package/dist/types/utils/data/pad.d.ts +11 -0
- package/dist/types/utils/data/pad.d.ts.map +1 -0
- package/dist/types/utils/data/size.d.ts +9 -0
- package/dist/types/utils/data/size.d.ts.map +1 -0
- package/dist/types/utils/data/slice.d.ts +33 -0
- package/dist/types/utils/data/slice.d.ts.map +1 -0
- package/dist/types/utils/data/trim.d.ts +8 -0
- package/dist/types/utils/data/trim.d.ts.map +1 -0
- package/dist/types/utils/encoding/fromBytes.d.ts +109 -0
- package/dist/types/utils/encoding/fromBytes.d.ts.map +1 -0
- package/dist/types/utils/encoding/fromHex.d.ts +138 -0
- package/dist/types/utils/encoding/fromHex.d.ts.map +1 -0
- package/dist/types/utils/encoding/fromRlp.d.ts +6 -0
- package/dist/types/utils/encoding/fromRlp.d.ts.map +1 -0
- package/dist/types/utils/encoding/toBytes.d.ts +125 -0
- package/dist/types/utils/encoding/toBytes.d.ts.map +1 -0
- package/dist/types/utils/encoding/toHex.d.ts +139 -0
- package/dist/types/utils/encoding/toHex.d.ts.map +1 -0
- package/dist/types/utils/encoding/toRlp.d.ts +8 -0
- package/dist/types/utils/encoding/toRlp.d.ts.map +1 -0
- package/dist/types/utils/ens/avatar/parseAvatarRecord.d.ts +9 -0
- package/dist/types/utils/ens/avatar/parseAvatarRecord.d.ts.map +1 -0
- package/dist/types/utils/ens/avatar/utils.d.ts +37 -0
- package/dist/types/utils/ens/avatar/utils.d.ts.map +1 -0
- 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/errors.d.ts +2 -0
- package/dist/types/utils/ens/errors.d.ts.map +1 -0
- package/dist/types/utils/ens/labelhash.d.ts +11 -0
- package/dist/types/utils/ens/labelhash.d.ts.map +1 -0
- package/dist/types/utils/ens/namehash.d.ts +13 -0
- package/dist/types/utils/ens/namehash.d.ts.map +1 -0
- package/dist/types/utils/ens/normalize.d.ts +12 -0
- package/dist/types/utils/ens/normalize.d.ts.map +1 -0
- package/dist/types/utils/ens/packetToBytes.d.ts +3 -0
- package/dist/types/utils/ens/packetToBytes.d.ts.map +1 -0
- package/dist/types/utils/errors/getCallError.d.ts +9 -0
- package/dist/types/utils/errors/getCallError.d.ts.map +1 -0
- package/dist/types/utils/errors/getContractError.d.ts +12 -0
- package/dist/types/utils/errors/getContractError.d.ts.map +1 -0
- package/dist/types/utils/errors/getEstimateGasError.d.ts +11 -0
- package/dist/types/utils/errors/getEstimateGasError.d.ts.map +1 -0
- package/dist/types/utils/errors/getNodeError.d.ts +7 -0
- package/dist/types/utils/errors/getNodeError.d.ts.map +1 -0
- package/dist/types/utils/errors/getTransactionError.d.ts +12 -0
- package/dist/types/utils/errors/getTransactionError.d.ts.map +1 -0
- package/dist/types/utils/filters/createFilterRequestScope.d.ts +22 -0
- package/dist/types/utils/filters/createFilterRequestScope.d.ts.map +1 -0
- package/dist/types/utils/formatters/block.d.ts +28 -0
- package/dist/types/utils/formatters/block.d.ts.map +1 -0
- package/dist/types/utils/formatters/extract.d.ts +8 -0
- package/dist/types/utils/formatters/extract.d.ts.map +1 -0
- package/dist/types/utils/formatters/feeHistory.d.ts +4 -0
- package/dist/types/utils/formatters/feeHistory.d.ts.map +1 -0
- package/dist/types/utils/formatters/formatter.d.ts +10 -0
- package/dist/types/utils/formatters/formatter.d.ts.map +1 -0
- package/dist/types/utils/formatters/log.d.ts +7 -0
- package/dist/types/utils/formatters/log.d.ts.map +1 -0
- package/dist/types/utils/formatters/transaction.d.ts +30 -0
- package/dist/types/utils/formatters/transaction.d.ts.map +1 -0
- package/dist/types/utils/formatters/transactionReceipt.d.ts +14 -0
- package/dist/types/utils/formatters/transactionReceipt.d.ts.map +1 -0
- package/dist/types/utils/formatters/transactionRequest.d.ts +14 -0
- package/dist/types/utils/formatters/transactionRequest.d.ts.map +1 -0
- package/dist/types/utils/hash/getEventSelector.d.ts +4 -0
- package/dist/types/utils/hash/getEventSelector.d.ts.map +1 -0
- package/dist/types/utils/hash/getFunctionSelector.d.ts +3 -0
- package/dist/types/utils/hash/getFunctionSelector.d.ts.map +1 -0
- package/dist/types/utils/hash/hashFunction.d.ts +4 -0
- package/dist/types/utils/hash/hashFunction.d.ts.map +1 -0
- package/dist/types/utils/hash/isHash.d.ts +3 -0
- package/dist/types/utils/hash/isHash.d.ts.map +1 -0
- package/dist/types/utils/hash/keccak256.d.ts +6 -0
- package/dist/types/utils/hash/keccak256.d.ts.map +1 -0
- package/dist/types/utils/index.d.ts +82 -0
- package/dist/types/utils/index.d.ts.map +1 -0
- package/dist/types/utils/observe.d.ts +17 -0
- package/dist/types/utils/observe.d.ts.map +1 -0
- package/dist/types/utils/poll.d.ts +13 -0
- package/dist/types/utils/poll.d.ts.map +1 -0
- package/dist/types/utils/promise/createBatchScheduler.d.ts +17 -0
- package/dist/types/utils/promise/createBatchScheduler.d.ts.map +1 -0
- package/dist/types/utils/promise/withCache.d.ts +36 -0
- package/dist/types/utils/promise/withCache.d.ts.map +1 -0
- package/dist/types/utils/promise/withRetry.d.ts +12 -0
- package/dist/types/utils/promise/withRetry.d.ts.map +1 -0
- package/dist/types/utils/promise/withTimeout.d.ts +8 -0
- package/dist/types/utils/promise/withTimeout.d.ts.map +1 -0
- package/dist/types/utils/regex.d.ts +4 -0
- package/dist/types/utils/regex.d.ts.map +1 -0
- package/dist/types/utils/rpc.d.ts +72 -0
- package/dist/types/utils/rpc.d.ts.map +1 -0
- package/dist/types/utils/signature/hashMessage.d.ts +6 -0
- package/dist/types/utils/signature/hashMessage.d.ts.map +1 -0
- package/dist/types/utils/signature/hashTypedData.d.ts +11 -0
- package/dist/types/utils/signature/hashTypedData.d.ts.map +1 -0
- package/dist/types/utils/signature/hexToSignature.d.ts +13 -0
- package/dist/types/utils/signature/hexToSignature.d.ts.map +1 -0
- package/dist/types/utils/signature/recoverAddress.d.ts +9 -0
- package/dist/types/utils/signature/recoverAddress.d.ts.map +1 -0
- package/dist/types/utils/signature/recoverMessageAddress.d.ts +9 -0
- package/dist/types/utils/signature/recoverMessageAddress.d.ts.map +1 -0
- package/dist/types/utils/signature/recoverPublicKey.d.ts +8 -0
- package/dist/types/utils/signature/recoverPublicKey.d.ts.map +1 -0
- package/dist/types/utils/signature/recoverTypedDataAddress.d.ts +13 -0
- package/dist/types/utils/signature/recoverTypedDataAddress.d.ts.map +1 -0
- package/dist/types/utils/signature/signatureToHex.d.ts +17 -0
- package/dist/types/utils/signature/signatureToHex.d.ts.map +1 -0
- package/dist/types/utils/signature/verifyMessage.d.ts +25 -0
- package/dist/types/utils/signature/verifyMessage.d.ts.map +1 -0
- package/dist/types/utils/signature/verifyTypedData.d.ts +28 -0
- package/dist/types/utils/signature/verifyTypedData.d.ts.map +1 -0
- package/dist/types/utils/stringify.d.ts +2 -0
- package/dist/types/utils/stringify.d.ts.map +1 -0
- package/dist/types/utils/transaction/assertRequest.d.ts +5 -0
- package/dist/types/utils/transaction/assertRequest.d.ts.map +1 -0
- package/dist/types/utils/transaction/assertTransaction.d.ts +5 -0
- package/dist/types/utils/transaction/assertTransaction.d.ts.map +1 -0
- package/dist/types/utils/transaction/getSerializedTransactionType.d.ts +4 -0
- package/dist/types/utils/transaction/getSerializedTransactionType.d.ts.map +1 -0
- package/dist/types/utils/transaction/getTransactionType.d.ts +4 -0
- package/dist/types/utils/transaction/getTransactionType.d.ts.map +1 -0
- package/dist/types/utils/transaction/parseTransaction.d.ts +9 -0
- package/dist/types/utils/transaction/parseTransaction.d.ts.map +1 -0
- package/dist/types/utils/transaction/prepareRequest.d.ts +21 -0
- package/dist/types/utils/transaction/prepareRequest.d.ts.map +1 -0
- package/dist/types/utils/transaction/serializeAccessList.d.ts +5 -0
- package/dist/types/utils/transaction/serializeAccessList.d.ts.map +1 -0
- package/dist/types/utils/transaction/serializeTransaction.d.ts +7 -0
- package/dist/types/utils/transaction/serializeTransaction.d.ts.map +1 -0
- package/dist/types/utils/typedData.d.ts +6 -0
- package/dist/types/utils/typedData.d.ts.map +1 -0
- package/dist/types/utils/uid.d.ts +2 -0
- package/dist/types/utils/uid.d.ts.map +1 -0
- package/dist/types/utils/unit/formatEther.d.ts +2 -0
- package/dist/types/utils/unit/formatEther.d.ts.map +1 -0
- package/dist/types/utils/unit/formatGwei.d.ts +2 -0
- package/dist/types/utils/unit/formatGwei.d.ts.map +1 -0
- package/dist/types/utils/unit/formatUnits.d.ts +2 -0
- package/dist/types/utils/unit/formatUnits.d.ts.map +1 -0
- package/dist/types/utils/unit/parseEther.d.ts +2 -0
- package/dist/types/utils/unit/parseEther.d.ts.map +1 -0
- package/dist/types/utils/unit/parseGwei.d.ts +2 -0
- package/dist/types/utils/unit/parseGwei.d.ts.map +1 -0
- package/dist/types/utils/unit/parseUnits.d.ts +2 -0
- package/dist/types/utils/unit/parseUnits.d.ts.map +1 -0
- package/dist/types/utils/wait.d.ts +2 -0
- package/dist/types/utils/wait.d.ts.map +1 -0
- package/dist/types/wallet.d.ts +11 -0
- package/dist/types/wallet.d.ts.map +1 -0
- package/dist/types/window.d.ts +2 -0
- package/dist/types/window.d.ts.map +1 -0
- package/package.json +1 -1
- package/src/actions/public/estimateFeesPerGas.ts +152 -0
- package/src/actions/public/estimateMaxPriorityFeePerGas.ts +96 -0
- package/src/actions/public/verifyHash.ts +1 -1
- package/src/actions/public/verifyMessage.ts +3 -2
- package/src/actions/public/verifyTypedData.ts +3 -2
- package/src/actions/wallet/deployContract.ts +2 -1
- package/src/actions/wallet/sendTransaction.ts +2 -1
- package/src/actions/wallet/writeContract.ts +2 -1
- package/src/clients/createTestClient.ts +2 -1
- package/src/clients/decorators/public.ts +64 -0
- package/src/errors/fee.ts +27 -0
- package/src/errors/version.ts +1 -1
- package/src/index.ts +38 -24
- package/src/public.ts +10 -0
- package/src/types/chain.ts +80 -12
- package/src/types/eip1193.ts +12 -0
- package/src/types/fee.ts +2 -0
- package/src/utils/transaction/prepareRequest.ts +37 -45
- package/chains/dist/cjs/celo/formatters.js.map +0 -1
- package/chains/dist/cjs/celo/parsers.js.map +0 -1
- package/chains/dist/cjs/celo/serializers.js.map +0 -1
- package/chains/dist/cjs/celo/types.js.map +0 -1
- package/chains/dist/cjs/index.js.map +0 -1
- package/chains/dist/cjs/optimism/fees.js.map +0 -1
- package/chains/dist/cjs/optimism/formatters.js.map +0 -1
- package/chains/dist/cjs/optimism/types.js.map +0 -1
- package/chains/dist/cjs/types.js.map +0 -1
- package/chains/dist/cjs/utils.js.map +0 -1
- package/chains/dist/tsconfig.build.tsbuildinfo +0 -1
- package/chains/node_modules/.bin/tsc +0 -17
- package/chains/node_modules/.bin/tsserver +0 -17
- package/chains/tsconfig.tsbuildinfo +0 -1
@@ -0,0 +1,4 @@
|
|
1
|
+
import type { TransactionSerializable, TransactionSerializableEIP1559, TransactionSerializableEIP2930, TransactionSerializableGeneric, TransactionSerializableLegacy } from '../../types/transaction.js';
|
2
|
+
export type GetTransactionType<TTransactionSerializable extends TransactionSerializable = TransactionSerializable> = (TTransactionSerializable extends TransactionSerializableLegacy ? 'legacy' : never) | (TTransactionSerializable extends TransactionSerializableEIP1559 ? 'eip1559' : never) | (TTransactionSerializable extends TransactionSerializableEIP2930 ? 'eip2930' : never) | (TTransactionSerializable extends TransactionSerializableGeneric ? TTransactionSerializable['type'] : never);
|
3
|
+
export declare function getTransactionType<TTransactionSerializable extends TransactionSerializable>(transaction: TTransactionSerializable): GetTransactionType<TTransactionSerializable>;
|
4
|
+
//# sourceMappingURL=getTransactionType.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"getTransactionType.d.ts","sourceRoot":"","sources":["../../../../src/utils/transaction/getTransactionType.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,uBAAuB,EACvB,8BAA8B,EAC9B,8BAA8B,EAC9B,8BAA8B,EAC9B,6BAA6B,EAC9B,MAAM,4BAA4B,CAAA;AAEnC,MAAM,MAAM,kBAAkB,CAC5B,wBAAwB,SAAS,uBAAuB,GAAG,uBAAuB,IAEhF,CAAC,wBAAwB,SAAS,6BAA6B,GAC3D,QAAQ,GACR,KAAK,CAAC,GACV,CAAC,wBAAwB,SAAS,8BAA8B,GAC5D,SAAS,GACT,KAAK,CAAC,GACV,CAAC,wBAAwB,SAAS,8BAA8B,GAC5D,SAAS,GACT,KAAK,CAAC,GACV,CAAC,wBAAwB,SAAS,8BAA8B,GAC5D,wBAAwB,CAAC,MAAM,CAAC,GAChC,KAAK,CAAC,CAAA;AAEd,wBAAgB,kBAAkB,CAChC,wBAAwB,SAAS,uBAAuB,EAExD,WAAW,EAAE,wBAAwB,GACpC,kBAAkB,CAAC,wBAAwB,CAAC,CAiB9C"}
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import type { Hex } from '../../types/misc.js';
|
2
|
+
import type { AccessList, TransactionSerializableEIP1559, TransactionSerializableEIP2930, TransactionSerializableLegacy, TransactionSerialized, TransactionType } from '../../types/transaction.js';
|
3
|
+
import type { RecursiveArray } from '../encoding/toRlp.js';
|
4
|
+
import { type GetSerializedTransactionType } from './getSerializedTransactionType.js';
|
5
|
+
export type ParseTransactionReturnType<TSerialized extends TransactionSerialized = TransactionSerialized, TType extends TransactionType = GetSerializedTransactionType<TSerialized>> = (TType extends 'eip1559' ? TransactionSerializableEIP1559 : never) | (TType extends 'eip2930' ? TransactionSerializableEIP2930 : never) | (TType extends 'legacy' ? TransactionSerializableLegacy : never);
|
6
|
+
export declare function parseTransaction<TSerialized extends TransactionSerialized>(serializedTransaction: TSerialized): ParseTransactionReturnType<TSerialized>;
|
7
|
+
export declare function toTransactionArray(serializedTransaction: string): RecursiveArray<`0x${string}`>;
|
8
|
+
export declare function parseAccessList(accessList_: RecursiveArray<Hex>): AccessList;
|
9
|
+
//# sourceMappingURL=parseTransaction.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"parseTransaction.d.ts","sourceRoot":"","sources":["../../../../src/utils/transaction/parseTransaction.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,GAAG,EAAa,MAAM,qBAAqB,CAAA;AACzD,OAAO,KAAK,EACV,UAAU,EAGV,8BAA8B,EAC9B,8BAA8B,EAC9B,6BAA6B,EAC7B,qBAAqB,EAGrB,eAAe,EAChB,MAAM,4BAA4B,CAAA;AAOnC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAQ1D,OAAO,EACL,KAAK,4BAA4B,EAElC,MAAM,mCAAmC,CAAA;AAE1C,MAAM,MAAM,0BAA0B,CACpC,WAAW,SAAS,qBAAqB,GAAG,qBAAqB,EACjE,KAAK,SAAS,eAAe,GAAG,4BAA4B,CAAC,WAAW,CAAC,IAEvE,CAAC,KAAK,SAAS,SAAS,GAAG,8BAA8B,GAAG,KAAK,CAAC,GAClE,CAAC,KAAK,SAAS,SAAS,GAAG,8BAA8B,GAAG,KAAK,CAAC,GAClE,CAAC,KAAK,SAAS,QAAQ,GAAG,6BAA6B,GAAG,KAAK,CAAC,CAAA;AAEpE,wBAAgB,gBAAgB,CAAC,WAAW,SAAS,qBAAqB,EACxE,qBAAqB,EAAE,WAAW,GACjC,0BAA0B,CAAC,WAAW,CAAC,CAgBzC;AAoMD,wBAAgB,kBAAkB,CAAC,qBAAqB,EAAE,MAAM,iCAE/D;AAED,wBAAgB,eAAe,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,CAAC,GAAG,UAAU,CAa5E"}
|
@@ -0,0 +1,21 @@
|
|
1
|
+
import type { Address } from 'abitype';
|
2
|
+
import type { Account } from '../../accounts/types.js';
|
3
|
+
import type { SendTransactionParameters } from '../../actions/wallet/sendTransaction.js';
|
4
|
+
import type { Client } from '../../clients/createClient.js';
|
5
|
+
import type { Transport } from '../../clients/transports/createTransport.js';
|
6
|
+
import type { GetAccountParameter } from '../../types/account.js';
|
7
|
+
import type { Chain } from '../../types/chain.js';
|
8
|
+
import type { GetChain } from '../../types/chain.js';
|
9
|
+
import type { UnionOmit } from '../../types/utils.js';
|
10
|
+
import { type FormattedTransactionRequest } from '../index.js';
|
11
|
+
export type PrepareRequestParameters<TChain extends Chain | undefined = Chain | undefined, TAccount extends Account | undefined = Account | undefined, TChainOverride extends Chain | undefined = Chain | undefined> = UnionOmit<FormattedTransactionRequest<TChainOverride extends Chain ? TChainOverride : TChain>, 'from'> & GetAccountParameter<TAccount> & GetChain<TChain, TChainOverride>;
|
12
|
+
export type PrepareRequestReturnType<TChain extends Chain | undefined = Chain | undefined, TAccount extends Account | undefined = Account | undefined, TChainOverride extends Chain | undefined = Chain | undefined, TArgs extends PrepareRequestParameters<TChain, TAccount, TChainOverride> = PrepareRequestParameters<TChain, TAccount, TChainOverride>> = TArgs & {
|
13
|
+
from: Address;
|
14
|
+
gas: SendTransactionParameters['gas'];
|
15
|
+
gasPrice?: SendTransactionParameters['gasPrice'];
|
16
|
+
maxFeePerGas?: SendTransactionParameters['maxFeePerGas'];
|
17
|
+
maxPriorityFeePerGas?: SendTransactionParameters['maxPriorityFeePerGas'];
|
18
|
+
nonce: SendTransactionParameters['nonce'];
|
19
|
+
};
|
20
|
+
export declare function prepareRequest<TChain extends Chain | undefined, TAccount extends Account | undefined, TChainOverride extends Chain | undefined, TArgs extends PrepareRequestParameters<TChain, TAccount, TChainOverride>>(client: Client<Transport, TChain, TAccount>, args: TArgs): Promise<PrepareRequestReturnType<TChain, TAccount, TChainOverride, TArgs>>;
|
21
|
+
//# sourceMappingURL=prepareRequest.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"prepareRequest.d.ts","sourceRoot":"","sources":["../../../../src/utils/transaction/prepareRequest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAEtC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAA;AAStD,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,yCAAyC,CAAA;AACxF,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAA;AAC3D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,6CAA6C,CAAA;AAM5E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAA;AACjE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAA;AACjD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AACpD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AACrD,OAAO,EAAE,KAAK,2BAA2B,EAAE,MAAM,aAAa,CAAA;AAG9D,MAAM,MAAM,wBAAwB,CAClC,MAAM,SAAS,KAAK,GAAG,SAAS,GAAG,KAAK,GAAG,SAAS,EACpD,QAAQ,SAAS,OAAO,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,EAC1D,cAAc,SAAS,KAAK,GAAG,SAAS,GAAG,KAAK,GAAG,SAAS,IAC1D,SAAS,CACX,2BAA2B,CACzB,cAAc,SAAS,KAAK,GAAG,cAAc,GAAG,MAAM,CACvD,EACD,MAAM,CACP,GACC,mBAAmB,CAAC,QAAQ,CAAC,GAC7B,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC,CAAA;AAElC,MAAM,MAAM,wBAAwB,CAClC,MAAM,SAAS,KAAK,GAAG,SAAS,GAAG,KAAK,GAAG,SAAS,EACpD,QAAQ,SAAS,OAAO,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,EAC1D,cAAc,SAAS,KAAK,GAAG,SAAS,GAAG,KAAK,GAAG,SAAS,EAC5D,KAAK,SAAS,wBAAwB,CACpC,MAAM,EACN,QAAQ,EACR,cAAc,CACf,GAAG,wBAAwB,CAAC,MAAM,EAAE,QAAQ,EAAE,cAAc,CAAC,IAC5D,KAAK,GAAG;IACV,IAAI,EAAE,OAAO,CAAA;IACb,GAAG,EAAE,yBAAyB,CAAC,KAAK,CAAC,CAAA;IACrC,QAAQ,CAAC,EAAE,yBAAyB,CAAC,UAAU,CAAC,CAAA;IAChD,YAAY,CAAC,EAAE,yBAAyB,CAAC,cAAc,CAAC,CAAA;IACxD,oBAAoB,CAAC,EAAE,yBAAyB,CAAC,sBAAsB,CAAC,CAAA;IACxE,KAAK,EAAE,yBAAyB,CAAC,OAAO,CAAC,CAAA;CAC1C,CAAA;AAED,wBAAsB,cAAc,CAClC,MAAM,SAAS,KAAK,GAAG,SAAS,EAChC,QAAQ,SAAS,OAAO,GAAG,SAAS,EACpC,cAAc,SAAS,KAAK,GAAG,SAAS,EACxC,KAAK,SAAS,wBAAwB,CAAC,MAAM,EAAE,QAAQ,EAAE,cAAc,CAAC,EAExE,MAAM,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,CAAC,EAC3C,IAAI,EAAE,KAAK,GACV,OAAO,CAAC,wBAAwB,CAAC,MAAM,EAAE,QAAQ,EAAE,cAAc,EAAE,KAAK,CAAC,CAAC,CAqE5E"}
|
@@ -0,0 +1,5 @@
|
|
1
|
+
import type { Hex } from '../../types/misc.js';
|
2
|
+
import type { AccessList } from '../../types/transaction.js';
|
3
|
+
import { type RecursiveArray } from '../encoding/toRlp.js';
|
4
|
+
export declare function serializeAccessList(accessList?: AccessList): RecursiveArray<Hex>;
|
5
|
+
//# sourceMappingURL=serializeAccessList.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"serializeAccessList.d.ts","sourceRoot":"","sources":["../../../../src/utils/transaction/serializeAccessList.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,qBAAqB,CAAA;AAC9C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAA;AAE5D,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAW1D,wBAAgB,mBAAmB,CACjC,UAAU,CAAC,EAAE,UAAU,GACtB,cAAc,CAAC,GAAG,CAAC,CAoBrB"}
|
@@ -0,0 +1,7 @@
|
|
1
|
+
import type { Signature } from '../../types/misc.js';
|
2
|
+
import type { TransactionSerializable, TransactionSerialized, TransactionType } from '../../types/transaction.js';
|
3
|
+
import { type GetTransactionType } from './getTransactionType.js';
|
4
|
+
export type SerializedTransactionReturnType<TTransactionSerializable extends TransactionSerializable = TransactionSerializable, TTransactionType extends TransactionType = GetTransactionType<TTransactionSerializable>> = TransactionSerialized<TTransactionType>;
|
5
|
+
export type SerializeTransactionFn<TTransactionSerializable extends TransactionSerializable = TransactionSerializable> = typeof serializeTransaction<TTransactionSerializable>;
|
6
|
+
export declare function serializeTransaction<TTransactionSerializable extends TransactionSerializable>(transaction: TTransactionSerializable, signature?: Signature): SerializedTransactionReturnType<TTransactionSerializable>;
|
7
|
+
//# sourceMappingURL=serializeTransaction.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"serializeTransaction.d.ts","sourceRoot":"","sources":["../../../../src/utils/transaction/serializeTransaction.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AACpD,OAAO,KAAK,EACV,uBAAuB,EAIvB,qBAAqB,EAIrB,eAAe,EAChB,MAAM,4BAA4B,CAAA;AAWnC,OAAO,EACL,KAAK,kBAAkB,EAExB,MAAM,yBAAyB,CAAA;AAGhC,MAAM,MAAM,+BAA+B,CACzC,wBAAwB,SAAS,uBAAuB,GAAG,uBAAuB,EAClF,gBAAgB,SAAS,eAAe,GAAG,kBAAkB,CAAC,wBAAwB,CAAC,IACrF,qBAAqB,CAAC,gBAAgB,CAAC,CAAA;AAE3C,MAAM,MAAM,sBAAsB,CAChC,wBAAwB,SAAS,uBAAuB,GAAG,uBAAuB,IAChF,OAAO,oBAAoB,CAAC,wBAAwB,CAAC,CAAA;AAEzD,wBAAgB,oBAAoB,CAClC,wBAAwB,SAAS,uBAAuB,EAExD,WAAW,EAAE,wBAAwB,EACrC,SAAS,CAAC,EAAE,SAAS,GACpB,+BAA+B,CAAC,wBAAwB,CAAC,CAmB3D"}
|
@@ -0,0 +1,6 @@
|
|
1
|
+
import type { TypedData } from 'abitype';
|
2
|
+
import type { TypedDataDefinition } from '../types/typedData.js';
|
3
|
+
export declare function validateTypedData<const TTypedData extends TypedData | {
|
4
|
+
[key: string]: unknown;
|
5
|
+
}, TPrimaryType extends string = string>({ domain, message, primaryType, types: types_, }: TypedDataDefinition<TTypedData, TPrimaryType>): void;
|
6
|
+
//# sourceMappingURL=typedData.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"typedData.d.ts","sourceRoot":"","sources":["../../../src/utils/typedData.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAqC,MAAM,SAAS,CAAA;AAK3E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAOhE,wBAAgB,iBAAiB,CAC/B,KAAK,CAAC,UAAU,SAAS,SAAS,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CAAE,EAC/D,YAAY,SAAS,MAAM,GAAG,MAAM,EACpC,EACA,MAAM,EACN,OAAO,EACP,WAAW,EACX,KAAK,EAAE,MAAM,GACd,EAAE,mBAAmB,CAAC,UAAU,EAAE,YAAY,CAAC,QAoD/C"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"uid.d.ts","sourceRoot":"","sources":["../../../src/utils/uid.ts"],"names":[],"mappings":"AAIA,wBAAgB,GAAG,CAAC,MAAM,SAAK,UAS9B"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"formatEther.d.ts","sourceRoot":"","sources":["../../../../src/utils/unit/formatEther.ts"],"names":[],"mappings":"AAIA,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,GAAE,KAAK,GAAG,MAAc,UAEpE"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"formatGwei.d.ts","sourceRoot":"","sources":["../../../../src/utils/unit/formatGwei.ts"],"names":[],"mappings":"AAIA,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,GAAE,KAAa,UAE1D"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"formatUnits.d.ts","sourceRoot":"","sources":["../../../../src/utils/unit/formatUnits.ts"],"names":[],"mappings":"AAAA,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,UAgB1D"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"parseEther.d.ts","sourceRoot":"","sources":["../../../../src/utils/unit/parseEther.ts"],"names":[],"mappings":"AAIA,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,GAAE,KAAK,GAAG,MAAc,UAErE"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"parseGwei.d.ts","sourceRoot":"","sources":["../../../../src/utils/unit/parseGwei.ts"],"names":[],"mappings":"AAIA,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,GAAE,KAAa,UAE3D"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"parseUnits.d.ts","sourceRoot":"","sources":["../../../../src/utils/unit/parseUnits.ts"],"names":[],"mappings":"AAAA,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,UAqCzD"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"wait.d.ts","sourceRoot":"","sources":["../../../src/utils/wait.ts"],"names":[],"mappings":"AAAA,wBAAsB,IAAI,CAAC,IAAI,EAAE,MAAM,oBAEtC"}
|
@@ -0,0 +1,11 @@
|
|
1
|
+
export { addChain, type AddChainParameters } from './actions/wallet/addChain.js';
|
2
|
+
export { getAddresses, type GetAddressesReturnType, } from './actions/wallet/getAddresses.js';
|
3
|
+
export { getPermissions, type GetPermissionsReturnType, } from './actions/wallet/getPermissions.js';
|
4
|
+
export { requestAddresses, type RequestAddressesReturnType, } from './actions/wallet/requestAddresses.js';
|
5
|
+
export { requestPermissions, type RequestPermissionsReturnType, } from './actions/wallet/requestPermissions.js';
|
6
|
+
export { sendTransaction, type SendTransactionParameters, type SendTransactionReturnType, } from './actions/wallet/sendTransaction.js';
|
7
|
+
export { signMessage, type SignMessageParameters, type SignMessageReturnType, } from './actions/wallet/signMessage.js';
|
8
|
+
export { signTypedData, type SignTypedDataParameters, type SignTypedDataReturnType, } from './actions/wallet/signTypedData.js';
|
9
|
+
export { switchChain, type SwitchChainParameters, } from './actions/wallet/switchChain.js';
|
10
|
+
export { watchAsset, type WatchAssetParameters, type WatchAssetReturnType, } from './actions/wallet/watchAsset.js';
|
11
|
+
//# sourceMappingURL=wallet.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"wallet.d.ts","sourceRoot":"","sources":["../../src/wallet.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,KAAK,kBAAkB,EAAE,MAAM,8BAA8B,CAAA;AAChF,OAAO,EACL,YAAY,EACZ,KAAK,sBAAsB,GAC5B,MAAM,kCAAkC,CAAA;AACzC,OAAO,EACL,cAAc,EACd,KAAK,wBAAwB,GAC9B,MAAM,oCAAoC,CAAA;AAC3C,OAAO,EACL,gBAAgB,EAChB,KAAK,0BAA0B,GAChC,MAAM,sCAAsC,CAAA;AAC7C,OAAO,EACL,kBAAkB,EAClB,KAAK,4BAA4B,GAClC,MAAM,wCAAwC,CAAA;AAC/C,OAAO,EACL,eAAe,EACf,KAAK,yBAAyB,EAC9B,KAAK,yBAAyB,GAC/B,MAAM,qCAAqC,CAAA;AAC5C,OAAO,EACL,WAAW,EACX,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,GAC3B,MAAM,iCAAiC,CAAA;AACxC,OAAO,EACL,aAAa,EACb,KAAK,uBAAuB,EAC5B,KAAK,uBAAuB,GAC7B,MAAM,mCAAmC,CAAA;AAC1C,OAAO,EACL,WAAW,EACX,KAAK,qBAAqB,GAC3B,MAAM,iCAAiC,CAAA;AACxC,OAAO,EACL,UAAU,EACV,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,GAC1B,MAAM,gCAAgC,CAAA"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"window.d.ts","sourceRoot":"","sources":["../../src/window.ts"],"names":[],"mappings":"AAAA,OAAO,mBAAmB,CAAA"}
|
package/package.json
CHANGED
@@ -0,0 +1,152 @@
|
|
1
|
+
import type { Client } from '../../clients/createClient.js'
|
2
|
+
import type { Transport } from '../../clients/transports/createTransport.js'
|
3
|
+
import {
|
4
|
+
BaseFeeScalarError,
|
5
|
+
Eip1559FeesNotSupportedError,
|
6
|
+
} from '../../errors/fee.js'
|
7
|
+
import type { Block } from '../../types/block.js'
|
8
|
+
import type {
|
9
|
+
Chain,
|
10
|
+
ChainEstimateFeesPerGasFnParameters,
|
11
|
+
ChainFeesFnParameters,
|
12
|
+
} from '../../types/chain.js'
|
13
|
+
import type { GetChain } from '../../types/chain.js'
|
14
|
+
import type {
|
15
|
+
FeeValuesEIP1559,
|
16
|
+
FeeValuesLegacy,
|
17
|
+
FeeValuesType,
|
18
|
+
} from '../../types/fee.js'
|
19
|
+
import type { PrepareRequestParameters } from '../../utils/transaction/prepareRequest.js'
|
20
|
+
import { internal_estimateMaxPriorityFeePerGas } from './estimateMaxPriorityFeePerGas.js'
|
21
|
+
import { getBlock } from './getBlock.js'
|
22
|
+
import { getGasPrice } from './getGasPrice.js'
|
23
|
+
|
24
|
+
export type EstimateFeesPerGasParameters<
|
25
|
+
chain extends Chain | undefined = Chain | undefined,
|
26
|
+
chainOverride extends Chain | undefined = Chain | undefined,
|
27
|
+
type extends FeeValuesType = FeeValuesType,
|
28
|
+
> = {
|
29
|
+
/**
|
30
|
+
* The type of fee values to return.
|
31
|
+
*
|
32
|
+
* - `legacy`: Returns the legacy gas price.
|
33
|
+
* - `eip1559`: Returns the max fee per gas and max priority fee per gas.
|
34
|
+
*
|
35
|
+
* @default 'eip1559'
|
36
|
+
*/
|
37
|
+
type?: type | FeeValuesType
|
38
|
+
} & GetChain<chain, chainOverride>
|
39
|
+
|
40
|
+
export type EstimateFeesPerGasReturnType<
|
41
|
+
type extends FeeValuesType = FeeValuesType,
|
42
|
+
> =
|
43
|
+
| (type extends 'legacy' ? FeeValuesLegacy : never)
|
44
|
+
| (type extends 'eip1559' ? FeeValuesEIP1559 : never)
|
45
|
+
|
46
|
+
/**
|
47
|
+
* Returns an estimate for the fees per gas (in wei) for a
|
48
|
+
* transaction to be likely included in the next block.
|
49
|
+
* Defaults to [`chain.fees.estimateFeesPerGas`](/docs/clients/chains.html#fees-estimatefeespergas) if set.
|
50
|
+
*
|
51
|
+
* - Docs: https://viem.sh/docs/actions/public/estimateFeesPerGas.html
|
52
|
+
*
|
53
|
+
* @param client - Client to use
|
54
|
+
* @param parameters - {@link EstimateFeesPerGasParameters}
|
55
|
+
* @returns An estimate (in wei) for the fees per gas. {@link EstimateFeesPerGasReturnType}
|
56
|
+
*
|
57
|
+
* @example
|
58
|
+
* import { createPublicClient, http } from 'viem'
|
59
|
+
* import { mainnet } from 'viem/chains'
|
60
|
+
* import { estimateFeesPerGas } from 'viem/actions'
|
61
|
+
*
|
62
|
+
* const client = createPublicClient({
|
63
|
+
* chain: mainnet,
|
64
|
+
* transport: http(),
|
65
|
+
* })
|
66
|
+
* const maxPriorityFeePerGas = await estimateFeesPerGas(client)
|
67
|
+
* // { maxFeePerGas: ..., maxPriorityFeePerGas: ... }
|
68
|
+
*/
|
69
|
+
export async function estimateFeesPerGas<
|
70
|
+
chain extends Chain | undefined,
|
71
|
+
chainOverride extends Chain | undefined,
|
72
|
+
type extends FeeValuesType = 'eip1559',
|
73
|
+
>(
|
74
|
+
client: Client<Transport, chain>,
|
75
|
+
args?: EstimateFeesPerGasParameters<chain, chainOverride, type>,
|
76
|
+
): Promise<EstimateFeesPerGasReturnType<type>> {
|
77
|
+
return internal_estimateFeesPerGas(client, args as any)
|
78
|
+
}
|
79
|
+
|
80
|
+
export async function internal_estimateFeesPerGas<
|
81
|
+
chain extends Chain | undefined,
|
82
|
+
chainOverride extends Chain | undefined,
|
83
|
+
type extends FeeValuesType = 'eip1559',
|
84
|
+
>(
|
85
|
+
client: Client<Transport, chain>,
|
86
|
+
args: EstimateFeesPerGasParameters<chain, chainOverride, type> & {
|
87
|
+
block?: Block
|
88
|
+
request?: PrepareRequestParameters
|
89
|
+
},
|
90
|
+
): Promise<EstimateFeesPerGasReturnType<type>> {
|
91
|
+
const {
|
92
|
+
block: block_,
|
93
|
+
chain = client.chain,
|
94
|
+
request,
|
95
|
+
type = 'eip1559',
|
96
|
+
} = args || {}
|
97
|
+
|
98
|
+
const baseFeeMultiplier = await (async () => {
|
99
|
+
if (typeof chain?.fees?.baseFeeMultiplier === 'function')
|
100
|
+
return chain.fees.baseFeeMultiplier({
|
101
|
+
block: block_ as Block,
|
102
|
+
client,
|
103
|
+
request,
|
104
|
+
} as ChainFeesFnParameters)
|
105
|
+
return chain?.fees?.baseFeeMultiplier ?? 1.2
|
106
|
+
})()
|
107
|
+
if (baseFeeMultiplier < 1) throw new BaseFeeScalarError()
|
108
|
+
|
109
|
+
const decimals = baseFeeMultiplier.toString().split('.')[1].length
|
110
|
+
const denominator = 10 ** decimals
|
111
|
+
const multiply = (base: bigint) =>
|
112
|
+
(base * BigInt(baseFeeMultiplier * denominator)) / BigInt(denominator)
|
113
|
+
|
114
|
+
const block = block_ ? block_ : await getBlock(client)
|
115
|
+
|
116
|
+
if (typeof chain?.fees?.estimateFeesPerGas === 'function')
|
117
|
+
return chain.fees.estimateFeesPerGas({
|
118
|
+
block: block_ as Block,
|
119
|
+
client,
|
120
|
+
multiply,
|
121
|
+
request,
|
122
|
+
type,
|
123
|
+
} as ChainEstimateFeesPerGasFnParameters) as unknown as EstimateFeesPerGasReturnType<type>
|
124
|
+
|
125
|
+
if (type === 'eip1559') {
|
126
|
+
if (typeof block.baseFeePerGas !== 'bigint')
|
127
|
+
throw new Eip1559FeesNotSupportedError()
|
128
|
+
|
129
|
+
const maxPriorityFeePerGas = request?.maxPriorityFeePerGas
|
130
|
+
? request.maxPriorityFeePerGas
|
131
|
+
: await internal_estimateMaxPriorityFeePerGas(
|
132
|
+
client as Client<Transport, Chain>,
|
133
|
+
{
|
134
|
+
chain,
|
135
|
+
request,
|
136
|
+
},
|
137
|
+
)
|
138
|
+
|
139
|
+
const baseFeePerGas = multiply(block.baseFeePerGas)
|
140
|
+
const maxFeePerGas = baseFeePerGas + maxPriorityFeePerGas
|
141
|
+
|
142
|
+
return {
|
143
|
+
maxFeePerGas,
|
144
|
+
maxPriorityFeePerGas,
|
145
|
+
} as EstimateFeesPerGasReturnType<type>
|
146
|
+
}
|
147
|
+
|
148
|
+
const gasPrice = multiply(await getGasPrice(client))
|
149
|
+
return {
|
150
|
+
gasPrice,
|
151
|
+
} as EstimateFeesPerGasReturnType<type>
|
152
|
+
}
|
@@ -0,0 +1,96 @@
|
|
1
|
+
import type { Client } from '../../clients/createClient.js'
|
2
|
+
import type { Transport } from '../../clients/transports/createTransport.js'
|
3
|
+
import { Eip1559FeesNotSupportedError } from '../../errors/fee.js'
|
4
|
+
import type { Account } from '../../types/account.js'
|
5
|
+
import type { Chain, ChainFeesFnParameters } from '../../types/chain.js'
|
6
|
+
import type { GetChain } from '../../types/chain.js'
|
7
|
+
import { hexToBigInt } from '../../utils/encoding/fromHex.js'
|
8
|
+
import type { PrepareRequestParameters } from '../../utils/transaction/prepareRequest.js'
|
9
|
+
import { getBlock } from './getBlock.js'
|
10
|
+
import { getGasPrice } from './getGasPrice.js'
|
11
|
+
|
12
|
+
export type EstimateMaxPriorityFeePerGasParameters<
|
13
|
+
chain extends Chain | undefined = Chain | undefined,
|
14
|
+
chainOverride extends Chain | undefined = Chain | undefined,
|
15
|
+
> = GetChain<chain, chainOverride>
|
16
|
+
export type EstimateMaxPriorityFeePerGasReturnType = bigint
|
17
|
+
|
18
|
+
/**
|
19
|
+
* Returns an estimate for the max priority fee per gas (in wei) for a
|
20
|
+
* transaction to be likely included in the next block.
|
21
|
+
* Defaults to [`chain.fees.defaultPriorityFee`](/docs/clients/chains.html#fees-defaultpriorityfee) if set.
|
22
|
+
*
|
23
|
+
* - Docs: https://viem.sh/docs/actions/public/estimateMaxPriorityFeePerGas.html
|
24
|
+
*
|
25
|
+
* @param client - Client to use
|
26
|
+
* @returns An estimate (in wei) for the max priority fee per gas. {@link EstimateMaxPriorityFeePerGasReturnType}
|
27
|
+
*
|
28
|
+
* @example
|
29
|
+
* import { createPublicClient, http } from 'viem'
|
30
|
+
* import { mainnet } from 'viem/chains'
|
31
|
+
* import { estimateMaxPriorityFeePerGas } from 'viem/actions'
|
32
|
+
*
|
33
|
+
* const client = createPublicClient({
|
34
|
+
* chain: mainnet,
|
35
|
+
* transport: http(),
|
36
|
+
* })
|
37
|
+
* const maxPriorityFeePerGas = await estimateMaxPriorityFeePerGas(client)
|
38
|
+
* // 10000000n
|
39
|
+
*/
|
40
|
+
export async function estimateMaxPriorityFeePerGas<
|
41
|
+
chain extends Chain | undefined,
|
42
|
+
chainOverride extends Chain | undefined,
|
43
|
+
>(
|
44
|
+
client: Client<Transport, chain>,
|
45
|
+
args?: EstimateMaxPriorityFeePerGasParameters<chain, chainOverride>,
|
46
|
+
): Promise<EstimateMaxPriorityFeePerGasReturnType> {
|
47
|
+
return internal_estimateMaxPriorityFeePerGas(client, args as any)
|
48
|
+
}
|
49
|
+
|
50
|
+
export async function internal_estimateMaxPriorityFeePerGas<
|
51
|
+
chain extends Chain | undefined,
|
52
|
+
chainOverride extends Chain | undefined,
|
53
|
+
>(
|
54
|
+
client: Client<Transport, chain>,
|
55
|
+
args: EstimateMaxPriorityFeePerGasParameters<chain, chainOverride> & {
|
56
|
+
request?: PrepareRequestParameters<
|
57
|
+
chain,
|
58
|
+
Account | undefined,
|
59
|
+
chainOverride
|
60
|
+
>
|
61
|
+
},
|
62
|
+
): Promise<EstimateMaxPriorityFeePerGasReturnType> {
|
63
|
+
const { chain = client.chain, request } = args || {}
|
64
|
+
if (typeof chain?.fees?.defaultPriorityFee === 'function') {
|
65
|
+
const block = await getBlock(client)
|
66
|
+
return chain.fees.defaultPriorityFee({
|
67
|
+
block,
|
68
|
+
client,
|
69
|
+
request,
|
70
|
+
} as ChainFeesFnParameters)
|
71
|
+
} else if (chain?.fees?.defaultPriorityFee)
|
72
|
+
return chain?.fees?.defaultPriorityFee
|
73
|
+
|
74
|
+
try {
|
75
|
+
const maxPriorityFeePerGasHex = await client.request({
|
76
|
+
method: 'eth_maxPriorityFeePerGas',
|
77
|
+
})
|
78
|
+
return hexToBigInt(maxPriorityFeePerGasHex)
|
79
|
+
} catch {
|
80
|
+
// If the RPC Provider does not support `eth_maxPriorityFeePerGas`
|
81
|
+
// fall back to calculating it manually via `gasPrice - baseFeePerGas`.
|
82
|
+
// See: https://github.com/ethereum/pm/issues/328#:~:text=eth_maxPriorityFeePerGas%20after%20London%20will%20effectively%20return%20eth_gasPrice%20%2D%20baseFee
|
83
|
+
const [block, gasPrice] = await Promise.all([
|
84
|
+
getBlock(client),
|
85
|
+
getGasPrice(client),
|
86
|
+
])
|
87
|
+
|
88
|
+
if (typeof block.baseFeePerGas !== 'bigint')
|
89
|
+
throw new Eip1559FeesNotSupportedError()
|
90
|
+
|
91
|
+
const maxPriorityFeePerGas = gasPrice - block.baseFeePerGas
|
92
|
+
|
93
|
+
if (maxPriorityFeePerGas < 0n) return 0n
|
94
|
+
return maxPriorityFeePerGas
|
95
|
+
}
|
96
|
+
}
|
@@ -1,11 +1,11 @@
|
|
1
1
|
import type { Address } from 'abitype'
|
2
2
|
|
3
|
-
import type { Chain } from '../../chains/index.js'
|
4
3
|
import type { Client } from '../../clients/createClient.js'
|
5
4
|
import type { Transport } from '../../clients/transports/createTransport.js'
|
6
5
|
import { universalSignatureValidatorAbi } from '../../constants/abis.js'
|
7
6
|
import { universalSignatureValidatorByteCode } from '../../constants/contracts.js'
|
8
7
|
import { CallExecutionError } from '../../errors/contract.js'
|
8
|
+
import type { Chain } from '../../types/chain.js'
|
9
9
|
import type { ByteArray, Hex } from '../../types/misc.js'
|
10
10
|
import { isBytesEqual } from '../../utils/data/isBytesEqual.js'
|
11
11
|
import { encodeDeployData, isHex, toHex } from '../../utils/index.js'
|
@@ -1,10 +1,11 @@
|
|
1
|
-
import type {
|
1
|
+
import type { Address } from 'abitype'
|
2
|
+
|
2
3
|
import type { Client } from '../../clients/createClient.js'
|
3
4
|
import type { Transport } from '../../clients/transports/createTransport.js'
|
5
|
+
import type { Chain } from '../../types/chain.js'
|
4
6
|
import type { ByteArray, Hex, SignableMessage } from '../../types/misc.js'
|
5
7
|
import { hashMessage } from '../../utils/index.js'
|
6
8
|
import { type VerifyHashParameters, verifyHash } from './verifyHash.js'
|
7
|
-
import type { Address } from 'abitype'
|
8
9
|
|
9
10
|
export type VerifyMessageParameters = Omit<VerifyHashParameters, 'hash'> & {
|
10
11
|
/** The address that signed the original message. */
|
@@ -1,11 +1,12 @@
|
|
1
|
-
import type {
|
1
|
+
import type { Address, TypedData } from 'abitype'
|
2
|
+
|
2
3
|
import type { Client } from '../../clients/createClient.js'
|
3
4
|
import type { Transport } from '../../clients/transports/createTransport.js'
|
5
|
+
import type { Chain } from '../../types/chain.js'
|
4
6
|
import type { ByteArray, Hex } from '../../types/misc.js'
|
5
7
|
import type { TypedDataDefinition } from '../../types/typedData.js'
|
6
8
|
import { hashTypedData } from '../../utils/signature/hashTypedData.js'
|
7
9
|
import { type VerifyHashParameters, verifyHash } from './verifyHash.js'
|
8
|
-
import type { Address, TypedData } from 'abitype'
|
9
10
|
|
10
11
|
export type VerifyTypedDataParameters<
|
11
12
|
TTypedData extends TypedData | { [key: string]: unknown } = TypedData,
|
@@ -3,7 +3,8 @@ import type { Abi } from 'abitype'
|
|
3
3
|
import type { Account } from '../../accounts/types.js'
|
4
4
|
import type { Client } from '../../clients/createClient.js'
|
5
5
|
import type { Transport } from '../../clients/transports/createTransport.js'
|
6
|
-
import type { Chain
|
6
|
+
import type { Chain } from '../../types/chain.js'
|
7
|
+
import type { GetChain } from '../../types/chain.js'
|
7
8
|
import type { GetConstructorArgs } from '../../types/contract.js'
|
8
9
|
import type { Hex } from '../../types/misc.js'
|
9
10
|
import type { UnionOmit } from '../../types/utils.js'
|
@@ -5,7 +5,8 @@ import type { Transport } from '../../clients/transports/createTransport.js'
|
|
5
5
|
import { AccountNotFoundError } from '../../errors/account.js'
|
6
6
|
import type { BaseError } from '../../errors/base.js'
|
7
7
|
import type { GetAccountParameter } from '../../types/account.js'
|
8
|
-
import type { Chain
|
8
|
+
import type { Chain } from '../../types/chain.js'
|
9
|
+
import type { GetChain } from '../../types/chain.js'
|
9
10
|
import type { Hash } from '../../types/misc.js'
|
10
11
|
import type {
|
11
12
|
TransactionRequest,
|
@@ -4,7 +4,8 @@ import type { Account } from '../../accounts/types.js'
|
|
4
4
|
import type { Client } from '../../clients/createClient.js'
|
5
5
|
import type { Transport } from '../../clients/transports/createTransport.js'
|
6
6
|
import type { GetAccountParameter } from '../../types/account.js'
|
7
|
-
import type { Chain
|
7
|
+
import type { Chain } from '../../types/chain.js'
|
8
|
+
import type { GetChain } from '../../types/chain.js'
|
8
9
|
import type { ContractFunctionConfig, GetValue } from '../../types/contract.js'
|
9
10
|
import type { Hex } from '../../types/misc.js'
|
10
11
|
import type { UnionOmit } from '../../types/utils.js'
|
@@ -1,3 +1,5 @@
|
|
1
|
+
import type { Address } from 'abitype'
|
2
|
+
|
1
3
|
import type { Account } from '../accounts/types.js'
|
2
4
|
import type { ParseAccount } from '../types/account.js'
|
3
5
|
import type { Chain } from '../types/chain.js'
|
@@ -6,7 +8,6 @@ import type { Prettify } from '../types/utils.js'
|
|
6
8
|
import { type Client, type ClientConfig, createClient } from './createClient.js'
|
7
9
|
import { type TestActions, testActions } from './decorators/test.js'
|
8
10
|
import type { Transport } from './transports/createTransport.js'
|
9
|
-
import type { Address } from 'abitype'
|
10
11
|
|
11
12
|
export type TestClientMode = 'anvil' | 'hardhat' | 'ganache'
|
12
13
|
|