viem 1.6.6 → 1.6.7
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/chains/dist/cjs/celo/formatters.js +58 -0
- package/chains/dist/cjs/celo/parsers.js +72 -0
- package/chains/dist/cjs/celo/serializers.js +75 -0
- package/chains/dist/cjs/celo/types.js +3 -0
- package/chains/dist/cjs/index.js +135 -0
- package/chains/dist/cjs/optimism/fees.js +7 -0
- package/chains/dist/cjs/optimism/formatters.js +52 -0
- package/chains/dist/cjs/optimism/types.js +3 -0
- package/chains/dist/cjs/types.js +3 -0
- package/chains/dist/cjs/utils.js +49 -0
- package/chains/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/cjs/errors/version.js +1 -1
- package/dist/esm/errors/version.js +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/estimateGas.d.ts +49 -0
- package/dist/types/actions/public/estimateGas.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 +43 -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 +57 -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 +68 -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 +1087 -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/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 +211 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/public.d.ts +31 -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 +62 -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 +1216 -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 +29 -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 +20 -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/errors/version.ts +1 -1
@@ -0,0 +1,449 @@
|
|
1
|
+
import type { Abi, TypedData } from 'abitype';
|
2
|
+
import type { Account } from '../../accounts/types.js';
|
3
|
+
import { type GetChainIdReturnType } from '../../actions/public/getChainId.js';
|
4
|
+
import { type AddChainParameters } from '../../actions/wallet/addChain.js';
|
5
|
+
import { type DeployContractParameters, type DeployContractReturnType } from '../../actions/wallet/deployContract.js';
|
6
|
+
import { type GetAddressesReturnType } from '../../actions/wallet/getAddresses.js';
|
7
|
+
import { type GetPermissionsReturnType } from '../../actions/wallet/getPermissions.js';
|
8
|
+
import { type RequestAddressesReturnType } from '../../actions/wallet/requestAddresses.js';
|
9
|
+
import { type RequestPermissionsParameters, type RequestPermissionsReturnType } from '../../actions/wallet/requestPermissions.js';
|
10
|
+
import { type SendTransactionParameters, type SendTransactionReturnType } from '../../actions/wallet/sendTransaction.js';
|
11
|
+
import { type SignMessageParameters, type SignMessageReturnType } from '../../actions/wallet/signMessage.js';
|
12
|
+
import { type SignTypedDataParameters, type SignTypedDataReturnType } from '../../actions/wallet/signTypedData.js';
|
13
|
+
import { type SwitchChainParameters } from '../../actions/wallet/switchChain.js';
|
14
|
+
import { type WatchAssetParameters, type WatchAssetReturnType } from '../../actions/wallet/watchAsset.js';
|
15
|
+
import { type WriteContractParameters, type WriteContractReturnType } from '../../actions/wallet/writeContract.js';
|
16
|
+
import type { Chain } from '../../types/chain.js';
|
17
|
+
import type { Client } from '../createClient.js';
|
18
|
+
import type { Transport } from '../transports/createTransport.js';
|
19
|
+
export type WalletActions<TChain extends Chain | undefined = Chain | undefined, TAccount extends Account | undefined = Account | undefined> = {
|
20
|
+
/**
|
21
|
+
* Adds an EVM chain to the wallet.
|
22
|
+
*
|
23
|
+
* - Docs: https://viem.sh/docs/actions/wallet/addChain.html
|
24
|
+
* - JSON-RPC Methods: [`eth_addEthereumChain`](https://eips.ethereum.org/EIPS/eip-3085)
|
25
|
+
*
|
26
|
+
* @param args - {@link AddChainParameters}
|
27
|
+
*
|
28
|
+
* @example
|
29
|
+
* import { createWalletClient, custom } from 'viem'
|
30
|
+
* import { optimism } from 'viem/chains'
|
31
|
+
*
|
32
|
+
* const client = createWalletClient({
|
33
|
+
* transport: custom(window.ethereum),
|
34
|
+
* })
|
35
|
+
* await client.addChain({ chain: optimism })
|
36
|
+
*/
|
37
|
+
addChain: (args: AddChainParameters) => Promise<void>;
|
38
|
+
/**
|
39
|
+
* Deploys a contract to the network, given bytecode and constructor arguments.
|
40
|
+
*
|
41
|
+
* - Docs: https://viem.sh/docs/contract/deployContract.html
|
42
|
+
* - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/contracts/deploying-contracts
|
43
|
+
*
|
44
|
+
* @param args - {@link DeployContractParameters}
|
45
|
+
* @returns The [Transaction](https://viem.sh/docs/glossary/terms.html#transaction) hash. {@link DeployContractReturnType}
|
46
|
+
*
|
47
|
+
* @example
|
48
|
+
* import { createWalletClient, http } from 'viem'
|
49
|
+
* import { privateKeyToAccount } from 'viem/accounts'
|
50
|
+
* import { mainnet } from 'viem/chains'
|
51
|
+
*
|
52
|
+
* const client = createWalletClient({
|
53
|
+
* account: privateKeyToAccount('0x…'),
|
54
|
+
* chain: mainnet,
|
55
|
+
* transport: http(),
|
56
|
+
* })
|
57
|
+
* const hash = await client.deployContract({
|
58
|
+
* abi: [],
|
59
|
+
* account: '0x…,
|
60
|
+
* bytecode: '0x608060405260405161083e38038061083e833981016040819052610...',
|
61
|
+
* })
|
62
|
+
*/
|
63
|
+
deployContract: <const TAbi extends Abi | readonly unknown[], TChainOverride extends Chain | undefined>(args: DeployContractParameters<TAbi, TChain, TAccount, TChainOverride>) => Promise<DeployContractReturnType>;
|
64
|
+
/**
|
65
|
+
* Returns a list of account addresses owned by the wallet or client.
|
66
|
+
*
|
67
|
+
* - Docs: https://viem.sh/docs/actions/wallet/getAddresses.html
|
68
|
+
* - JSON-RPC Methods: [`eth_accounts`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_accounts)
|
69
|
+
*
|
70
|
+
* @returns List of account addresses owned by the wallet or client. {@link GetAddressesReturnType}
|
71
|
+
*
|
72
|
+
* @example
|
73
|
+
* import { createWalletClient, custom } from 'viem'
|
74
|
+
* import { mainnet } from 'viem/chains'
|
75
|
+
*
|
76
|
+
* const client = createWalletClient({
|
77
|
+
* chain: mainnet,
|
78
|
+
* transport: custom(window.ethereum),
|
79
|
+
* })
|
80
|
+
* const accounts = await client.getAddresses()
|
81
|
+
*/
|
82
|
+
getAddresses: () => Promise<GetAddressesReturnType>;
|
83
|
+
/**
|
84
|
+
* Returns the chain ID associated with the current network.
|
85
|
+
*
|
86
|
+
* - Docs: https://viem.sh/docs/actions/public/getChainId.html
|
87
|
+
* - JSON-RPC Methods: [`eth_chainId`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_chainid)
|
88
|
+
*
|
89
|
+
* @returns The current chain ID. {@link GetChainIdReturnType}
|
90
|
+
*
|
91
|
+
* @example
|
92
|
+
* import { createWalletClient, http } from 'viem'
|
93
|
+
* import { mainnet } from 'viem/chains'
|
94
|
+
*
|
95
|
+
* const client = createWalletClient({
|
96
|
+
* chain: mainnet,
|
97
|
+
* transport: custom(window.ethereum),
|
98
|
+
* })
|
99
|
+
* const chainId = await client.getChainId()
|
100
|
+
* // 1
|
101
|
+
*/
|
102
|
+
getChainId: () => Promise<GetChainIdReturnType>;
|
103
|
+
/**
|
104
|
+
* Gets the wallets current permissions.
|
105
|
+
*
|
106
|
+
* - Docs: https://viem.sh/docs/actions/wallet/getPermissions.html
|
107
|
+
* - JSON-RPC Methods: [`wallet_getPermissions`](https://eips.ethereum.org/EIPS/eip-2255)
|
108
|
+
*
|
109
|
+
* @returns The wallet permissions. {@link GetPermissionsReturnType}
|
110
|
+
*
|
111
|
+
* @example
|
112
|
+
* import { createWalletClient, custom } from 'viem'
|
113
|
+
* import { mainnet } from 'viem/chains'
|
114
|
+
*
|
115
|
+
* const client = createWalletClient({
|
116
|
+
* chain: mainnet,
|
117
|
+
* transport: custom(window.ethereum),
|
118
|
+
* })
|
119
|
+
* const permissions = await client.getPermissions()
|
120
|
+
*/
|
121
|
+
getPermissions: () => Promise<GetPermissionsReturnType>;
|
122
|
+
/**
|
123
|
+
* Requests a list of accounts managed by a wallet.
|
124
|
+
*
|
125
|
+
* - Docs: https://viem.sh/docs/actions/wallet/requestAddresses.html
|
126
|
+
* - JSON-RPC Methods: [`eth_requestAccounts`](https://eips.ethereum.org/EIPS/eip-1102)
|
127
|
+
*
|
128
|
+
* Sends a request to the wallet, asking for permission to access the user's accounts. After the user accepts the request, it will return a list of accounts (addresses).
|
129
|
+
*
|
130
|
+
* This API can be useful for dapps that need to access the user's accounts in order to execute transactions or interact with smart contracts.
|
131
|
+
*
|
132
|
+
* @returns List of accounts managed by a wallet {@link RequestAddressesReturnType}
|
133
|
+
*
|
134
|
+
* @example
|
135
|
+
* import { createWalletClient, custom } from 'viem'
|
136
|
+
* import { mainnet } from 'viem/chains'
|
137
|
+
*
|
138
|
+
* const client = createWalletClient({
|
139
|
+
* chain: mainnet,
|
140
|
+
* transport: custom(window.ethereum),
|
141
|
+
* })
|
142
|
+
* const accounts = await client.requestAddresses()
|
143
|
+
*/
|
144
|
+
requestAddresses: () => Promise<RequestAddressesReturnType>;
|
145
|
+
/**
|
146
|
+
* Requests permissions for a wallet.
|
147
|
+
*
|
148
|
+
* - Docs: https://viem.sh/docs/actions/wallet/requestPermissions.html
|
149
|
+
* - JSON-RPC Methods: [`wallet_requestPermissions`](https://eips.ethereum.org/EIPS/eip-2255)
|
150
|
+
*
|
151
|
+
* @param args - {@link RequestPermissionsParameters}
|
152
|
+
* @returns The wallet permissions. {@link RequestPermissionsReturnType}
|
153
|
+
*
|
154
|
+
* @example
|
155
|
+
* import { createWalletClient, custom } from 'viem'
|
156
|
+
* import { mainnet } from 'viem/chains'
|
157
|
+
*
|
158
|
+
* const client = createWalletClient({
|
159
|
+
* chain: mainnet,
|
160
|
+
* transport: custom(window.ethereum),
|
161
|
+
* })
|
162
|
+
* const permissions = await client.requestPermissions({
|
163
|
+
* eth_accounts: {}
|
164
|
+
* })
|
165
|
+
*/
|
166
|
+
requestPermissions: (args: RequestPermissionsParameters) => Promise<RequestPermissionsReturnType>;
|
167
|
+
/**
|
168
|
+
* Creates, signs, and sends a new transaction to the network.
|
169
|
+
*
|
170
|
+
* - Docs: https://viem.sh/docs/actions/wallet/sendTransaction.html
|
171
|
+
* - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/transactions/sending-transactions
|
172
|
+
* - JSON-RPC Methods:
|
173
|
+
* - JSON-RPC Accounts: [`eth_sendTransaction`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_sendtransaction)
|
174
|
+
* - Local Accounts: [`eth_sendRawTransaction`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_sendrawtransaction)
|
175
|
+
*
|
176
|
+
* @param args - {@link SendTransactionParameters}
|
177
|
+
* @returns The [Transaction](https://viem.sh/docs/glossary/terms.html#transaction) hash. {@link SendTransactionReturnType}
|
178
|
+
*
|
179
|
+
* @example
|
180
|
+
* import { createWalletClient, custom } from 'viem'
|
181
|
+
* import { mainnet } from 'viem/chains'
|
182
|
+
*
|
183
|
+
* const client = createWalletClient({
|
184
|
+
* chain: mainnet,
|
185
|
+
* transport: custom(window.ethereum),
|
186
|
+
* })
|
187
|
+
* const hash = await client.sendTransaction({
|
188
|
+
* account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
|
189
|
+
* to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8',
|
190
|
+
* value: 1000000000000000000n,
|
191
|
+
* })
|
192
|
+
*
|
193
|
+
* @example
|
194
|
+
* // Account Hoisting
|
195
|
+
* import { createWalletClient, http } from 'viem'
|
196
|
+
* import { privateKeyToAccount } from 'viem/accounts'
|
197
|
+
* import { mainnet } from 'viem/chains'
|
198
|
+
*
|
199
|
+
* const client = createWalletClient({
|
200
|
+
* account: privateKeyToAccount('0x…'),
|
201
|
+
* chain: mainnet,
|
202
|
+
* transport: http(),
|
203
|
+
* })
|
204
|
+
* const hash = await client.sendTransaction({
|
205
|
+
* to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8',
|
206
|
+
* value: 1000000000000000000n,
|
207
|
+
* })
|
208
|
+
*/
|
209
|
+
sendTransaction: <TChainOverride extends Chain | undefined>(args: SendTransactionParameters<TChain, TAccount, TChainOverride>) => Promise<SendTransactionReturnType>;
|
210
|
+
/**
|
211
|
+
* Calculates an Ethereum-specific signature in [EIP-191 format](https://eips.ethereum.org/EIPS/eip-191): `keccak256("\x19Ethereum Signed Message:\n" + len(message) + message))`.
|
212
|
+
*
|
213
|
+
* - Docs: https://viem.sh/docs/actions/wallet/signMessage.html
|
214
|
+
* - JSON-RPC Methods:
|
215
|
+
* - JSON-RPC Accounts: [`personal_sign`](https://docs.metamask.io/guide/signing-data.html#personal-sign)
|
216
|
+
* - Local Accounts: Signs locally. No JSON-RPC request.
|
217
|
+
*
|
218
|
+
* With the calculated signature, you can:
|
219
|
+
* - use [`verifyMessage`](https://viem.sh/docs/utilities/verifyMessage.html) to verify the signature,
|
220
|
+
* - use [`recoverMessageAddress`](https://viem.sh/docs/utilities/recoverMessageAddress.html) to recover the signing address from a signature.
|
221
|
+
*
|
222
|
+
* @param args - {@link SignMessageParameters}
|
223
|
+
* @returns The signed message. {@link SignMessageReturnType}
|
224
|
+
*
|
225
|
+
* @example
|
226
|
+
* import { createWalletClient, custom } from 'viem'
|
227
|
+
* import { mainnet } from 'viem/chains'
|
228
|
+
*
|
229
|
+
* const client = createWalletClient({
|
230
|
+
* chain: mainnet,
|
231
|
+
* transport: custom(window.ethereum),
|
232
|
+
* })
|
233
|
+
* const signature = await client.signMessage({
|
234
|
+
* account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
|
235
|
+
* message: 'hello world',
|
236
|
+
* })
|
237
|
+
*
|
238
|
+
* @example
|
239
|
+
* // Account Hoisting
|
240
|
+
* import { createWalletClient, http } from 'viem'
|
241
|
+
* import { privateKeyToAccount } from 'viem/accounts'
|
242
|
+
* import { mainnet } from 'viem/chains'
|
243
|
+
*
|
244
|
+
* const client = createWalletClient({
|
245
|
+
* account: privateKeyToAccount('0x…'),
|
246
|
+
* chain: mainnet,
|
247
|
+
* transport: http(),
|
248
|
+
* })
|
249
|
+
* const signature = await client.signMessage({
|
250
|
+
* message: 'hello world',
|
251
|
+
* })
|
252
|
+
*/
|
253
|
+
signMessage: (args: SignMessageParameters<TAccount>) => Promise<SignMessageReturnType>;
|
254
|
+
/**
|
255
|
+
* Signs typed data and calculates an Ethereum-specific signature in [EIP-191 format](https://eips.ethereum.org/EIPS/eip-191): `keccak256("\x19Ethereum Signed Message:\n" + len(message) + message))`.
|
256
|
+
*
|
257
|
+
* - Docs: https://viem.sh/docs/actions/wallet/signTypedData.html
|
258
|
+
* - JSON-RPC Methods:
|
259
|
+
* - JSON-RPC Accounts: [`eth_signTypedData_v4`](https://docs.metamask.io/guide/signing-data.html#signtypeddata-v4)
|
260
|
+
* - Local Accounts: Signs locally. No JSON-RPC request.
|
261
|
+
*
|
262
|
+
* @param client - Client to use
|
263
|
+
* @param args - {@link SignTypedDataParameters}
|
264
|
+
* @returns The signed data. {@link SignTypedDataReturnType}
|
265
|
+
*
|
266
|
+
* @example
|
267
|
+
* import { createWalletClient, custom } from 'viem'
|
268
|
+
* import { mainnet } from 'viem/chains'
|
269
|
+
*
|
270
|
+
* const client = createWalletClient({
|
271
|
+
* chain: mainnet,
|
272
|
+
* transport: custom(window.ethereum),
|
273
|
+
* })
|
274
|
+
* const signature = await client.signTypedData({
|
275
|
+
* account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
|
276
|
+
* domain: {
|
277
|
+
* name: 'Ether Mail',
|
278
|
+
* version: '1',
|
279
|
+
* chainId: 1,
|
280
|
+
* verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC',
|
281
|
+
* },
|
282
|
+
* types: {
|
283
|
+
* Person: [
|
284
|
+
* { name: 'name', type: 'string' },
|
285
|
+
* { name: 'wallet', type: 'address' },
|
286
|
+
* ],
|
287
|
+
* Mail: [
|
288
|
+
* { name: 'from', type: 'Person' },
|
289
|
+
* { name: 'to', type: 'Person' },
|
290
|
+
* { name: 'contents', type: 'string' },
|
291
|
+
* ],
|
292
|
+
* },
|
293
|
+
* primaryType: 'Mail',
|
294
|
+
* message: {
|
295
|
+
* from: {
|
296
|
+
* name: 'Cow',
|
297
|
+
* wallet: '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826',
|
298
|
+
* },
|
299
|
+
* to: {
|
300
|
+
* name: 'Bob',
|
301
|
+
* wallet: '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB',
|
302
|
+
* },
|
303
|
+
* contents: 'Hello, Bob!',
|
304
|
+
* },
|
305
|
+
* })
|
306
|
+
*
|
307
|
+
* @example
|
308
|
+
* // Account Hoisting
|
309
|
+
* import { createWalletClient, http } from 'viem'
|
310
|
+
* import { privateKeyToAccount } from 'viem/accounts'
|
311
|
+
* import { mainnet } from 'viem/chains'
|
312
|
+
*
|
313
|
+
* const client = createWalletClient({
|
314
|
+
* account: privateKeyToAccount('0x…'),
|
315
|
+
* chain: mainnet,
|
316
|
+
* transport: http(),
|
317
|
+
* })
|
318
|
+
* const signature = await client.signTypedData({
|
319
|
+
* domain: {
|
320
|
+
* name: 'Ether Mail',
|
321
|
+
* version: '1',
|
322
|
+
* chainId: 1,
|
323
|
+
* verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC',
|
324
|
+
* },
|
325
|
+
* types: {
|
326
|
+
* Person: [
|
327
|
+
* { name: 'name', type: 'string' },
|
328
|
+
* { name: 'wallet', type: 'address' },
|
329
|
+
* ],
|
330
|
+
* Mail: [
|
331
|
+
* { name: 'from', type: 'Person' },
|
332
|
+
* { name: 'to', type: 'Person' },
|
333
|
+
* { name: 'contents', type: 'string' },
|
334
|
+
* ],
|
335
|
+
* },
|
336
|
+
* primaryType: 'Mail',
|
337
|
+
* message: {
|
338
|
+
* from: {
|
339
|
+
* name: 'Cow',
|
340
|
+
* wallet: '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826',
|
341
|
+
* },
|
342
|
+
* to: {
|
343
|
+
* name: 'Bob',
|
344
|
+
* wallet: '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB',
|
345
|
+
* },
|
346
|
+
* contents: 'Hello, Bob!',
|
347
|
+
* },
|
348
|
+
* })
|
349
|
+
*/
|
350
|
+
signTypedData: <const TTypedData extends TypedData | {
|
351
|
+
[key: string]: unknown;
|
352
|
+
}, TPrimaryType extends string>(args: SignTypedDataParameters<TTypedData, TPrimaryType, TAccount>) => Promise<SignTypedDataReturnType>;
|
353
|
+
/**
|
354
|
+
* Switch the target chain in a wallet.
|
355
|
+
*
|
356
|
+
* - Docs: https://viem.sh/docs/actions/wallet/switchChain.html
|
357
|
+
* - JSON-RPC Methods: [`eth_switchEthereumChain`](https://eips.ethereum.org/EIPS/eip-3326)
|
358
|
+
*
|
359
|
+
* @param args - {@link SwitchChainParameters}
|
360
|
+
*
|
361
|
+
* @example
|
362
|
+
* import { createWalletClient, custom } from 'viem'
|
363
|
+
* import { mainnet, optimism } from 'viem/chains'
|
364
|
+
*
|
365
|
+
* const client = createWalletClient({
|
366
|
+
* chain: mainnet,
|
367
|
+
* transport: custom(window.ethereum),
|
368
|
+
* })
|
369
|
+
* await client.switchChain({ id: optimism.id })
|
370
|
+
*/
|
371
|
+
switchChain: (args: SwitchChainParameters) => Promise<void>;
|
372
|
+
/**
|
373
|
+
* Adds an EVM chain to the wallet.
|
374
|
+
*
|
375
|
+
* - Docs: https://viem.sh/docs/actions/wallet/watchAsset.html
|
376
|
+
* - JSON-RPC Methods: [`eth_switchEthereumChain`](https://eips.ethereum.org/EIPS/eip-747)
|
377
|
+
*
|
378
|
+
* @param args - {@link WatchAssetParameters}
|
379
|
+
* @returns Boolean indicating if the token was successfully added. {@link WatchAssetReturnType}
|
380
|
+
*
|
381
|
+
* @example
|
382
|
+
* import { createWalletClient, custom } from 'viem'
|
383
|
+
* import { mainnet } from 'viem/chains'
|
384
|
+
*
|
385
|
+
* const client = createWalletClient({
|
386
|
+
* chain: mainnet,
|
387
|
+
* transport: custom(window.ethereum),
|
388
|
+
* })
|
389
|
+
* const success = await client.watchAsset({
|
390
|
+
* type: 'ERC20',
|
391
|
+
* options: {
|
392
|
+
* address: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
|
393
|
+
* decimals: 18,
|
394
|
+
* symbol: 'WETH',
|
395
|
+
* },
|
396
|
+
* })
|
397
|
+
*/
|
398
|
+
watchAsset: (args: WatchAssetParameters) => Promise<WatchAssetReturnType>;
|
399
|
+
/**
|
400
|
+
* Executes a write function on a contract.
|
401
|
+
*
|
402
|
+
* - Docs: https://viem.sh/docs/contract/writeContract.html
|
403
|
+
* - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/contracts/writing-to-contracts
|
404
|
+
*
|
405
|
+
* A "write" function on a Solidity contract modifies the state of the blockchain. These types of functions require gas to be executed, and hence a [Transaction](https://viem.sh/docs/glossary/terms.html) is needed to be broadcast in order to change the state.
|
406
|
+
*
|
407
|
+
* Internally, uses a [Wallet Client](https://viem.sh/docs/clients/wallet.html) to call the [`sendTransaction` action](https://viem.sh/docs/actions/wallet/sendTransaction.html) with [ABI-encoded `data`](https://viem.sh/docs/contract/encodeFunctionData.html).
|
408
|
+
*
|
409
|
+
* __Warning: The `write` internally sends a transaction – it does not validate if the contract write will succeed (the contract may throw an error). It is highly recommended to [simulate the contract write with `contract.simulate`](https://viem.sh/docs/contract/writeContract.html#usage) before you execute it.__
|
410
|
+
*
|
411
|
+
* @param args - {@link WriteContractParameters}
|
412
|
+
* @returns A [Transaction Hash](https://viem.sh/docs/glossary/terms.html#hash). {@link WriteContractReturnType}
|
413
|
+
*
|
414
|
+
* @example
|
415
|
+
* import { createWalletClient, custom, parseAbi } from 'viem'
|
416
|
+
* import { mainnet } from 'viem/chains'
|
417
|
+
*
|
418
|
+
* const client = createWalletClient({
|
419
|
+
* chain: mainnet,
|
420
|
+
* transport: custom(window.ethereum),
|
421
|
+
* })
|
422
|
+
* const hash = await client.writeContract({
|
423
|
+
* address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',
|
424
|
+
* abi: parseAbi(['function mint(uint32 tokenId) nonpayable']),
|
425
|
+
* functionName: 'mint',
|
426
|
+
* args: [69420],
|
427
|
+
* })
|
428
|
+
*
|
429
|
+
* @example
|
430
|
+
* // With Validation
|
431
|
+
* import { createWalletClient, custom, parseAbi } from 'viem'
|
432
|
+
* import { mainnet } from 'viem/chains'
|
433
|
+
*
|
434
|
+
* const client = createWalletClient({
|
435
|
+
* chain: mainnet,
|
436
|
+
* transport: custom(window.ethereum),
|
437
|
+
* })
|
438
|
+
* const { request } = await client.simulateContract({
|
439
|
+
* address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',
|
440
|
+
* abi: parseAbi(['function mint(uint32 tokenId) nonpayable']),
|
441
|
+
* functionName: 'mint',
|
442
|
+
* args: [69420],
|
443
|
+
* }
|
444
|
+
* const hash = await client.writeContract(request)
|
445
|
+
*/
|
446
|
+
writeContract: <const TAbi extends Abi | readonly unknown[], TFunctionName extends string, TChainOverride extends Chain | undefined>(args: WriteContractParameters<TAbi, TFunctionName, TChain, TAccount, TChainOverride>) => Promise<WriteContractReturnType>;
|
447
|
+
};
|
448
|
+
export declare function walletActions<TTransport extends Transport, TChain extends Chain | undefined = Chain | undefined, TAccount extends Account | undefined = Account | undefined>(client: Client<TTransport, TChain, TAccount>): WalletActions<TChain, TAccount>;
|
449
|
+
//# sourceMappingURL=wallet.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"wallet.d.ts","sourceRoot":"","sources":["../../../../src/clients/decorators/wallet.ts"],"names":[],"mappings":"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"}
|
@@ -0,0 +1,34 @@
|
|
1
|
+
import type { Chain } from '../../types/chain.js';
|
2
|
+
import type { EIP1193RequestFn } from '../../types/eip1193.js';
|
3
|
+
import type { ClientConfig } from '../createClient.js';
|
4
|
+
export type TransportConfig<TType extends string = string, TEIP1193RequestFn extends EIP1193RequestFn = EIP1193RequestFn> = {
|
5
|
+
/** The name of the transport. */
|
6
|
+
name: string;
|
7
|
+
/** The key of the transport. */
|
8
|
+
key: string;
|
9
|
+
/** The JSON-RPC request function that matches the EIP-1193 request spec. */
|
10
|
+
request: TEIP1193RequestFn;
|
11
|
+
/** The base delay (in ms) between retries. */
|
12
|
+
retryDelay?: number;
|
13
|
+
/** The max number of times to retry. */
|
14
|
+
retryCount?: number;
|
15
|
+
/** The timeout (in ms) for requests. */
|
16
|
+
timeout?: number;
|
17
|
+
/** The type of the transport. */
|
18
|
+
type: TType;
|
19
|
+
};
|
20
|
+
export type Transport<TType extends string = string, TRpcAttributes = Record<string, any>, TEIP1193RequestFn extends EIP1193RequestFn = EIP1193RequestFn> = <TChain extends Chain | undefined = Chain>({ chain, }: {
|
21
|
+
chain?: TChain;
|
22
|
+
pollingInterval?: ClientConfig['pollingInterval'];
|
23
|
+
retryCount?: TransportConfig['retryCount'];
|
24
|
+
timeout?: TransportConfig['timeout'];
|
25
|
+
}) => {
|
26
|
+
config: TransportConfig<TType>;
|
27
|
+
request: TEIP1193RequestFn;
|
28
|
+
value?: TRpcAttributes;
|
29
|
+
};
|
30
|
+
/**
|
31
|
+
* @description Creates an transport intended to be used with a client.
|
32
|
+
*/
|
33
|
+
export declare function createTransport<TType extends string, TRpcAttributes extends Record<string, any>>({ key, name, request, retryCount, retryDelay, timeout, type, }: TransportConfig<TType>, value?: TRpcAttributes): ReturnType<Transport<TType, TRpcAttributes>>;
|
34
|
+
//# sourceMappingURL=createTransport.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"createTransport.d.ts","sourceRoot":"","sources":["../../../../src/clients/transports/createTransport.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAA;AACjD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AAE9D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAEtD,MAAM,MAAM,eAAe,CACzB,KAAK,SAAS,MAAM,GAAG,MAAM,EAC7B,iBAAiB,SAAS,gBAAgB,GAAG,gBAAgB,IAC3D;IACF,iCAAiC;IACjC,IAAI,EAAE,MAAM,CAAA;IACZ,gCAAgC;IAChC,GAAG,EAAE,MAAM,CAAA;IACX,4EAA4E;IAC5E,OAAO,EAAE,iBAAiB,CAAA;IAC1B,8CAA8C;IAC9C,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,wCAAwC;IACxC,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,wCAAwC;IACxC,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,iCAAiC;IACjC,IAAI,EAAE,KAAK,CAAA;CACZ,CAAA;AAED,MAAM,MAAM,SAAS,CACnB,KAAK,SAAS,MAAM,GAAG,MAAM,EAC7B,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACpC,iBAAiB,SAAS,gBAAgB,GAAG,gBAAgB,IAC3D,CAAC,MAAM,SAAS,KAAK,GAAG,SAAS,GAAG,KAAK,EAAE,EAC7C,KAAK,GACN,EAAE;IACD,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,eAAe,CAAC,EAAE,YAAY,CAAC,iBAAiB,CAAC,CAAA;IACjD,UAAU,CAAC,EAAE,eAAe,CAAC,YAAY,CAAC,CAAA;IAC1C,OAAO,CAAC,EAAE,eAAe,CAAC,SAAS,CAAC,CAAA;CACrC,KAAK;IACJ,MAAM,EAAE,eAAe,CAAC,KAAK,CAAC,CAAA;IAC9B,OAAO,EAAE,iBAAiB,CAAA;IAC1B,KAAK,CAAC,EAAE,cAAc,CAAA;CACvB,CAAA;AAED;;GAEG;AACH,wBAAgB,eAAe,CAC7B,KAAK,SAAS,MAAM,EACpB,cAAc,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAE1C,EACE,GAAG,EACH,IAAI,EACJ,OAAO,EACP,UAAc,EACd,UAAgB,EAChB,OAAO,EACP,IAAI,GACL,EAAE,eAAe,CAAC,KAAK,CAAC,EACzB,KAAK,CAAC,EAAE,cAAc,GACrB,UAAU,CAAC,SAAS,CAAC,KAAK,EAAE,cAAc,CAAC,CAAC,CAM9C"}
|
@@ -0,0 +1,21 @@
|
|
1
|
+
import { type Transport, type TransportConfig } from './createTransport.js';
|
2
|
+
type EthereumProvider = {
|
3
|
+
request(...args: any): Promise<any>;
|
4
|
+
};
|
5
|
+
export type CustomTransportConfig = {
|
6
|
+
/** The key of the transport. */
|
7
|
+
key?: TransportConfig['key'];
|
8
|
+
/** The name of the transport. */
|
9
|
+
name?: TransportConfig['name'];
|
10
|
+
/** The max number of times to retry. */
|
11
|
+
retryCount?: TransportConfig['retryCount'];
|
12
|
+
/** The base delay (in ms) between retries. */
|
13
|
+
retryDelay?: TransportConfig['retryDelay'];
|
14
|
+
};
|
15
|
+
export type CustomTransport = Transport<'custom', {}, EthereumProvider['request']>;
|
16
|
+
/**
|
17
|
+
* @description Creates a custom transport given an EIP-1193 compliant `request` attribute.
|
18
|
+
*/
|
19
|
+
export declare function custom<TProvider extends EthereumProvider>(provider: TProvider, config?: CustomTransportConfig): CustomTransport;
|
20
|
+
export {};
|
21
|
+
//# sourceMappingURL=custom.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"custom.d.ts","sourceRoot":"","sources":["../../../../src/clients/transports/custom.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,SAAS,EACd,KAAK,eAAe,EAErB,MAAM,sBAAsB,CAAA;AAE7B,KAAK,gBAAgB,GAAG;IAAE,OAAO,CAAC,GAAG,IAAI,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,CAAA;CAAE,CAAA;AAE/D,MAAM,MAAM,qBAAqB,GAAG;IAClC,gCAAgC;IAChC,GAAG,CAAC,EAAE,eAAe,CAAC,KAAK,CAAC,CAAA;IAC5B,iCAAiC;IACjC,IAAI,CAAC,EAAE,eAAe,CAAC,MAAM,CAAC,CAAA;IAC9B,wCAAwC;IACxC,UAAU,CAAC,EAAE,eAAe,CAAC,YAAY,CAAC,CAAA;IAC1C,8CAA8C;IAC9C,UAAU,CAAC,EAAE,eAAe,CAAC,YAAY,CAAC,CAAA;CAC3C,CAAA;AAED,MAAM,MAAM,eAAe,GAAG,SAAS,CACrC,QAAQ,EACR,EAAE,EACF,gBAAgB,CAAC,SAAS,CAAC,CAC5B,CAAA;AAED;;GAEG;AACH,wBAAgB,MAAM,CAAC,SAAS,SAAS,gBAAgB,EACvD,QAAQ,EAAE,SAAS,EACnB,MAAM,GAAE,qBAA0B,GACjC,eAAe,CAWjB"}
|
@@ -0,0 +1,75 @@
|
|
1
|
+
import type { Chain } from '../../types/chain.js';
|
2
|
+
import { type Transport, type TransportConfig } from './createTransport.js';
|
3
|
+
export type OnResponseFn = (args: {
|
4
|
+
method: string;
|
5
|
+
params: unknown[];
|
6
|
+
transport: ReturnType<Transport>;
|
7
|
+
} & ({
|
8
|
+
error?: never;
|
9
|
+
response: unknown;
|
10
|
+
status: 'success';
|
11
|
+
} | {
|
12
|
+
error: Error;
|
13
|
+
response?: never;
|
14
|
+
status: 'error';
|
15
|
+
})) => void;
|
16
|
+
type RankOptions = {
|
17
|
+
/**
|
18
|
+
* The polling interval (in ms) at which the ranker should ping the RPC URL.
|
19
|
+
* @default client.pollingInterval
|
20
|
+
*/
|
21
|
+
interval?: number;
|
22
|
+
/**
|
23
|
+
* The number of previous samples to perform ranking on.
|
24
|
+
* @default 10
|
25
|
+
*/
|
26
|
+
sampleCount?: number;
|
27
|
+
/**
|
28
|
+
* Timeout when sampling transports.
|
29
|
+
* @default 1_000
|
30
|
+
*/
|
31
|
+
timeout?: number;
|
32
|
+
/**
|
33
|
+
* Weights to apply to the scores. Weight values are proportional.
|
34
|
+
*/
|
35
|
+
weights?: {
|
36
|
+
/**
|
37
|
+
* The weight to apply to the latency score.
|
38
|
+
* @default 0.3
|
39
|
+
*/
|
40
|
+
latency?: number;
|
41
|
+
/**
|
42
|
+
* The weight to apply to the stability score.
|
43
|
+
* @default 0.7
|
44
|
+
*/
|
45
|
+
stability?: number;
|
46
|
+
};
|
47
|
+
};
|
48
|
+
export type FallbackTransportConfig = {
|
49
|
+
/** The key of the Fallback transport. */
|
50
|
+
key?: TransportConfig['key'];
|
51
|
+
/** The name of the Fallback transport. */
|
52
|
+
name?: TransportConfig['name'];
|
53
|
+
/** Toggle to enable ranking, or rank options. */
|
54
|
+
rank?: boolean | RankOptions;
|
55
|
+
/** The max number of times to retry. */
|
56
|
+
retryCount?: TransportConfig['retryCount'];
|
57
|
+
/** The base delay (in ms) between retries. */
|
58
|
+
retryDelay?: TransportConfig['retryDelay'];
|
59
|
+
};
|
60
|
+
export type FallbackTransport = Transport<'fallback', {
|
61
|
+
onResponse: (fn: OnResponseFn) => void;
|
62
|
+
transports: ReturnType<Transport>[];
|
63
|
+
}>;
|
64
|
+
export declare function fallback(transports_: Transport[], config?: FallbackTransportConfig): FallbackTransport;
|
65
|
+
export declare function rankTransports({ chain, interval, onTransports, sampleCount, timeout, transports, weights, }: {
|
66
|
+
chain?: Chain;
|
67
|
+
interval: RankOptions['interval'];
|
68
|
+
onTransports: (transports: Transport[]) => void;
|
69
|
+
sampleCount?: RankOptions['sampleCount'];
|
70
|
+
timeout?: RankOptions['timeout'];
|
71
|
+
transports: Transport[];
|
72
|
+
weights?: RankOptions['weights'];
|
73
|
+
}): void;
|
74
|
+
export {};
|
75
|
+
//# sourceMappingURL=fallback.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"fallback.d.ts","sourceRoot":"","sources":["../../../../src/clients/transports/fallback.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAA;AAIjD,OAAO,EACL,KAAK,SAAS,EACd,KAAK,eAAe,EAErB,MAAM,sBAAsB,CAAA;AAE7B,MAAM,MAAM,YAAY,GAAG,CACzB,IAAI,EAAE;IACJ,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,OAAO,EAAE,CAAA;IACjB,SAAS,EAAE,UAAU,CAAC,SAAS,CAAC,CAAA;CACjC,GAAG,CACA;IACE,KAAK,CAAC,EAAE,KAAK,CAAA;IACb,QAAQ,EAAE,OAAO,CAAA;IACjB,MAAM,EAAE,SAAS,CAAA;CAClB,GACD;IACE,KAAK,EAAE,KAAK,CAAA;IACZ,QAAQ,CAAC,EAAE,KAAK,CAAA;IAChB,MAAM,EAAE,OAAO,CAAA;CAChB,CACJ,KACE,IAAI,CAAA;AAET,KAAK,WAAW,GAAG;IACjB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB;;OAEG;IACH,OAAO,CAAC,EAAE;QACR;;;WAGG;QACH,OAAO,CAAC,EAAE,MAAM,CAAA;QAChB;;;WAGG;QACH,SAAS,CAAC,EAAE,MAAM,CAAA;KACnB,CAAA;CACF,CAAA;AAED,MAAM,MAAM,uBAAuB,GAAG;IACpC,yCAAyC;IACzC,GAAG,CAAC,EAAE,eAAe,CAAC,KAAK,CAAC,CAAA;IAC5B,0CAA0C;IAC1C,IAAI,CAAC,EAAE,eAAe,CAAC,MAAM,CAAC,CAAA;IAC9B,iDAAiD;IACjD,IAAI,CAAC,EAAE,OAAO,GAAG,WAAW,CAAA;IAC5B,wCAAwC;IACxC,UAAU,CAAC,EAAE,eAAe,CAAC,YAAY,CAAC,CAAA;IAC1C,8CAA8C;IAC9C,UAAU,CAAC,EAAE,eAAe,CAAC,YAAY,CAAC,CAAA;CAC3C,CAAA;AAED,MAAM,MAAM,iBAAiB,GAAG,SAAS,CACvC,UAAU,EACV;IACE,UAAU,EAAE,CAAC,EAAE,EAAE,YAAY,KAAK,IAAI,CAAA;IACtC,UAAU,EAAE,UAAU,CAAC,SAAS,CAAC,EAAE,CAAA;CACpC,CACF,CAAA;AAED,wBAAgB,QAAQ,CACtB,WAAW,EAAE,SAAS,EAAE,EACxB,MAAM,GAAE,uBAA4B,GACnC,iBAAiB,CAiFnB;AAED,wBAAgB,cAAc,CAAC,EAC7B,KAAK,EACL,QAAgB,EAChB,YAAY,EACZ,WAAgB,EAChB,OAAe,EACf,UAAU,EACV,OAAY,GACb,EAAE;IACD,KAAK,CAAC,EAAE,KAAK,CAAA;IACb,QAAQ,EAAE,WAAW,CAAC,UAAU,CAAC,CAAA;IACjC,YAAY,EAAE,CAAC,UAAU,EAAE,SAAS,EAAE,KAAK,IAAI,CAAA;IAC/C,WAAW,CAAC,EAAE,WAAW,CAAC,aAAa,CAAC,CAAA;IACxC,OAAO,CAAC,EAAE,WAAW,CAAC,SAAS,CAAC,CAAA;IAChC,UAAU,EAAE,SAAS,EAAE,CAAA;IACvB,OAAO,CAAC,EAAE,WAAW,CAAC,SAAS,CAAC,CAAA;CACjC,QAwEA"}
|
@@ -0,0 +1,40 @@
|
|
1
|
+
import { type HttpOptions } from '../../utils/rpc.js';
|
2
|
+
import { type Transport, type TransportConfig } from './createTransport.js';
|
3
|
+
export type BatchOptions = {
|
4
|
+
/** The maximum number of JSON-RPC requests to send in a batch. @default 1_000 */
|
5
|
+
batchSize?: number;
|
6
|
+
/** The maximum number of milliseconds to wait before sending a batch. @default 0 */
|
7
|
+
wait?: number;
|
8
|
+
};
|
9
|
+
export type HttpTransportConfig = {
|
10
|
+
/**
|
11
|
+
* Whether to enable Batch JSON-RPC.
|
12
|
+
* @link https://www.jsonrpc.org/specification#batch
|
13
|
+
*/
|
14
|
+
batch?: boolean | BatchOptions;
|
15
|
+
/**
|
16
|
+
* Request configuration to pass to `fetch`.
|
17
|
+
* @link https://developer.mozilla.org/en-US/docs/Web/API/fetch
|
18
|
+
*/
|
19
|
+
fetchOptions?: HttpOptions['fetchOptions'];
|
20
|
+
/** The key of the HTTP transport. */
|
21
|
+
key?: TransportConfig['key'];
|
22
|
+
/** The name of the HTTP transport. */
|
23
|
+
name?: TransportConfig['name'];
|
24
|
+
/** The max number of times to retry. */
|
25
|
+
retryCount?: TransportConfig['retryCount'];
|
26
|
+
/** The base delay (in ms) between retries. */
|
27
|
+
retryDelay?: TransportConfig['retryDelay'];
|
28
|
+
/** The timeout (in ms) for the HTTP request. Default: 10_000 */
|
29
|
+
timeout?: TransportConfig['timeout'];
|
30
|
+
};
|
31
|
+
export type HttpTransport = Transport<'http', {
|
32
|
+
url?: string;
|
33
|
+
}>;
|
34
|
+
/**
|
35
|
+
* @description Creates a HTTP transport that connects to a JSON-RPC API.
|
36
|
+
*/
|
37
|
+
export declare function http(
|
38
|
+
/** URL of the JSON-RPC API. Defaults to the chain's public RPC URL. */
|
39
|
+
url?: string, config?: HttpTransportConfig): HttpTransport;
|
40
|
+
//# sourceMappingURL=http.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../../../src/clients/transports/http.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,WAAW,EAAwB,MAAM,oBAAoB,CAAA;AAE3E,OAAO,EACL,KAAK,SAAS,EACd,KAAK,eAAe,EAErB,MAAM,sBAAsB,CAAA;AAE7B,MAAM,MAAM,YAAY,GAAG;IACzB,iFAAiF;IACjF,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,oFAAoF;IACpF,IAAI,CAAC,EAAE,MAAM,CAAA;CACd,CAAA;AAED,MAAM,MAAM,mBAAmB,GAAG;IAChC;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,GAAG,YAAY,CAAA;IAC9B;;;OAGG;IACH,YAAY,CAAC,EAAE,WAAW,CAAC,cAAc,CAAC,CAAA;IAC1C,qCAAqC;IACrC,GAAG,CAAC,EAAE,eAAe,CAAC,KAAK,CAAC,CAAA;IAC5B,sCAAsC;IACtC,IAAI,CAAC,EAAE,eAAe,CAAC,MAAM,CAAC,CAAA;IAC9B,wCAAwC;IACxC,UAAU,CAAC,EAAE,eAAe,CAAC,YAAY,CAAC,CAAA;IAC1C,8CAA8C;IAC9C,UAAU,CAAC,EAAE,eAAe,CAAC,YAAY,CAAC,CAAA;IAC1C,gEAAgE;IAChE,OAAO,CAAC,EAAE,eAAe,CAAC,SAAS,CAAC,CAAA;CACrC,CAAA;AAED,MAAM,MAAM,aAAa,GAAG,SAAS,CACnC,MAAM,EACN;IACE,GAAG,CAAC,EAAE,MAAM,CAAA;CACb,CACF,CAAA;AAED;;GAEG;AACH,wBAAgB,IAAI;AAClB,uEAAuE;AACvE,GAAG,CAAC,EAAE,MAAM,EACZ,MAAM,GAAE,mBAAwB,GAC/B,aAAa,CA4Df"}
|