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,29 @@
|
|
1
|
+
import type { Account } from '../../accounts/types.js';
|
2
|
+
import type { Client } from '../../clients/createClient.js';
|
3
|
+
import type { Transport } from '../../clients/transports/createTransport.js';
|
4
|
+
import type { Chain } from '../../types/chain.js';
|
5
|
+
export type AddChainParameters = {
|
6
|
+
/** The chain to add to the wallet. */
|
7
|
+
chain: Chain;
|
8
|
+
};
|
9
|
+
/**
|
10
|
+
* Adds an EVM chain to the wallet.
|
11
|
+
*
|
12
|
+
* - Docs: https://viem.sh/docs/actions/wallet/addChain.html
|
13
|
+
* - JSON-RPC Methods: [`eth_addEthereumChain`](https://eips.ethereum.org/EIPS/eip-3085)
|
14
|
+
*
|
15
|
+
* @param client - Client to use
|
16
|
+
* @param parameters - {@link AddChainParameters}
|
17
|
+
*
|
18
|
+
* @example
|
19
|
+
* import { createWalletClient, custom } from 'viem'
|
20
|
+
* import { optimism } from 'viem/chains'
|
21
|
+
* import { addChain } from 'viem/wallet'
|
22
|
+
*
|
23
|
+
* const client = createWalletClient({
|
24
|
+
* transport: custom(window.ethereum),
|
25
|
+
* })
|
26
|
+
* await addChain(client, { chain: optimism })
|
27
|
+
*/
|
28
|
+
export declare function addChain<TChain extends Chain | undefined, TAccount extends Account | undefined>(client: Client<Transport, TChain, TAccount>, { chain }: AddChainParameters): Promise<void>;
|
29
|
+
//# sourceMappingURL=addChain.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"addChain.d.ts","sourceRoot":"","sources":["../../../../src/actions/wallet/addChain.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAA;AACtD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAA;AAC3D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,6CAA6C,CAAA;AAC5E,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAA;AAGjD,MAAM,MAAM,kBAAkB,GAAG;IAC/B,sCAAsC;IACtC,KAAK,EAAE,KAAK,CAAA;CACb,CAAA;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAsB,QAAQ,CAC5B,MAAM,SAAS,KAAK,GAAG,SAAS,EAChC,QAAQ,SAAS,OAAO,GAAG,SAAS,EACpC,MAAM,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,EAAE,KAAK,EAAE,EAAE,kBAAkB,iBAgB3E"}
|
@@ -0,0 +1,44 @@
|
|
1
|
+
import type { Abi } from 'abitype';
|
2
|
+
import type { Account } from '../../accounts/types.js';
|
3
|
+
import type { Client } from '../../clients/createClient.js';
|
4
|
+
import type { Transport } from '../../clients/transports/createTransport.js';
|
5
|
+
import type { Chain } from '../../types/chain.js';
|
6
|
+
import type { GetChain } from '../../types/chain.js';
|
7
|
+
import type { GetConstructorArgs } from '../../types/contract.js';
|
8
|
+
import type { Hex } from '../../types/misc.js';
|
9
|
+
import type { UnionOmit } from '../../types/utils.js';
|
10
|
+
import { type SendTransactionParameters, type SendTransactionReturnType } from './sendTransaction.js';
|
11
|
+
export type DeployContractParameters<TAbi extends Abi | readonly unknown[] = Abi, TChain extends Chain | undefined = Chain | undefined, TAccount extends Account | undefined = Account | undefined, TChainOverride extends Chain | undefined = Chain | undefined> = UnionOmit<SendTransactionParameters<TChain, TAccount, TChainOverride>, 'accessList' | 'chain' | 'to' | 'data'> & {
|
12
|
+
abi: TAbi;
|
13
|
+
bytecode: Hex;
|
14
|
+
} & GetChain<TChain, TChainOverride> & GetConstructorArgs<TAbi>;
|
15
|
+
export type DeployContractReturnType = SendTransactionReturnType;
|
16
|
+
/**
|
17
|
+
* Deploys a contract to the network, given bytecode and constructor arguments.
|
18
|
+
*
|
19
|
+
* - Docs: https://viem.sh/docs/contract/deployContract.html
|
20
|
+
* - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/contracts/deploying-contracts
|
21
|
+
*
|
22
|
+
* @param client - Client to use
|
23
|
+
* @param parameters - {@link DeployContractParameters}
|
24
|
+
* @returns The [Transaction](https://viem.sh/docs/glossary/terms.html#transaction) hash. {@link DeployContractReturnType}
|
25
|
+
*
|
26
|
+
* @example
|
27
|
+
* import { createWalletClient, http } from 'viem'
|
28
|
+
* import { privateKeyToAccount } from 'viem/accounts'
|
29
|
+
* import { mainnet } from 'viem/chains'
|
30
|
+
* import { deployContract } from 'viem/contract'
|
31
|
+
*
|
32
|
+
* const client = createWalletClient({
|
33
|
+
* account: privateKeyToAccount('0x…'),
|
34
|
+
* chain: mainnet,
|
35
|
+
* transport: http(),
|
36
|
+
* })
|
37
|
+
* const hash = await deployContract(client, {
|
38
|
+
* abi: [],
|
39
|
+
* account: '0x…,
|
40
|
+
* bytecode: '0x608060405260405161083e38038061083e833981016040819052610...',
|
41
|
+
* })
|
42
|
+
*/
|
43
|
+
export declare function deployContract<const TAbi extends Abi | readonly unknown[], TChain extends Chain | undefined, TAccount extends Account | undefined, TChainOverride extends Chain | undefined>(walletClient: Client<Transport, TChain, TAccount>, { abi, args, bytecode, ...request }: DeployContractParameters<TAbi, TChain, TAccount, TChainOverride>): Promise<DeployContractReturnType>;
|
44
|
+
//# sourceMappingURL=deployContract.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"deployContract.d.ts","sourceRoot":"","sources":["../../../../src/actions/wallet/deployContract.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,SAAS,CAAA;AAElC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAA;AACtD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAA;AAC3D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,6CAA6C,CAAA;AAC5E,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAA;AACjD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AACpD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AACjE,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,qBAAqB,CAAA;AAC9C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AAGrD,OAAO,EACL,KAAK,yBAAyB,EAC9B,KAAK,yBAAyB,EAE/B,MAAM,sBAAsB,CAAA;AAE7B,MAAM,MAAM,wBAAwB,CAClC,IAAI,SAAS,GAAG,GAAG,SAAS,OAAO,EAAE,GAAG,GAAG,EAC3C,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,yBAAyB,CAAC,MAAM,EAAE,QAAQ,EAAE,cAAc,CAAC,EAC3D,YAAY,GAAG,OAAO,GAAG,IAAI,GAAG,MAAM,CACvC,GAAG;IACF,GAAG,EAAE,IAAI,CAAA;IACT,QAAQ,EAAE,GAAG,CAAA;CACd,GAAG,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC,GAClC,kBAAkB,CAAC,IAAI,CAAC,CAAA;AAE1B,MAAM,MAAM,wBAAwB,GAAG,yBAAyB,CAAA;AAEhE;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,cAAc,CAC5B,KAAK,CAAC,IAAI,SAAS,GAAG,GAAG,SAAS,OAAO,EAAE,EAC3C,MAAM,SAAS,KAAK,GAAG,SAAS,EAChC,QAAQ,SAAS,OAAO,GAAG,SAAS,EACpC,cAAc,SAAS,KAAK,GAAG,SAAS,EAExC,YAAY,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,CAAC,EACjD,EACE,GAAG,EACH,IAAI,EACJ,QAAQ,EACR,GAAG,OAAO,EACX,EAAE,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,cAAc,CAAC,GAClE,OAAO,CAAC,wBAAwB,CAAC,CAenC"}
|
@@ -0,0 +1,28 @@
|
|
1
|
+
import type { Address } from 'abitype';
|
2
|
+
import type { Account } from '../../accounts/types.js';
|
3
|
+
import type { Client } from '../../clients/createClient.js';
|
4
|
+
import type { Transport } from '../../clients/transports/createTransport.js';
|
5
|
+
import type { Chain } from '../../types/chain.js';
|
6
|
+
export type GetAddressesReturnType = Address[];
|
7
|
+
/**
|
8
|
+
* Returns a list of account addresses owned by the wallet or client.
|
9
|
+
*
|
10
|
+
* - Docs: https://viem.sh/docs/actions/wallet/getAddresses.html
|
11
|
+
* - JSON-RPC Methods: [`eth_accounts`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_accounts)
|
12
|
+
*
|
13
|
+
* @param client - Client to use
|
14
|
+
* @returns List of account addresses owned by the wallet or client. {@link GetAddressesReturnType}
|
15
|
+
*
|
16
|
+
* @example
|
17
|
+
* import { createWalletClient, custom } from 'viem'
|
18
|
+
* import { mainnet } from 'viem/chains'
|
19
|
+
* import { getAddresses } from 'viem/wallet'
|
20
|
+
*
|
21
|
+
* const client = createWalletClient({
|
22
|
+
* chain: mainnet,
|
23
|
+
* transport: custom(window.ethereum),
|
24
|
+
* })
|
25
|
+
* const accounts = await getAddresses(client)
|
26
|
+
*/
|
27
|
+
export declare function getAddresses<TChain extends Chain | undefined, TAccount extends Account | undefined = undefined>(client: Client<Transport, TChain, TAccount>): Promise<GetAddressesReturnType>;
|
28
|
+
//# sourceMappingURL=getAddresses.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"getAddresses.d.ts","sourceRoot":"","sources":["../../../../src/actions/wallet/getAddresses.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAEtC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAA;AACtD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAA;AAC3D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,6CAA6C,CAAA;AAC5E,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAA;AAGjD,MAAM,MAAM,sBAAsB,GAAG,OAAO,EAAE,CAAA;AAE9C;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,YAAY,CAChC,MAAM,SAAS,KAAK,GAAG,SAAS,EAChC,QAAQ,SAAS,OAAO,GAAG,SAAS,GAAG,SAAS,EAEhD,MAAM,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,CAAC,GAC1C,OAAO,CAAC,sBAAsB,CAAC,CAGjC"}
|
@@ -0,0 +1,28 @@
|
|
1
|
+
import type { Account } from '../../accounts/types.js';
|
2
|
+
import type { Client } from '../../clients/createClient.js';
|
3
|
+
import type { Transport } from '../../clients/transports/createTransport.js';
|
4
|
+
import type { Chain } from '../../types/chain.js';
|
5
|
+
import type { WalletPermission } from '../../types/eip1193.js';
|
6
|
+
export type GetPermissionsReturnType = WalletPermission[];
|
7
|
+
/**
|
8
|
+
* Gets the wallets current permissions.
|
9
|
+
*
|
10
|
+
* - Docs: https://viem.sh/docs/actions/wallet/getPermissions.html
|
11
|
+
* - JSON-RPC Methods: [`wallet_getPermissions`](https://eips.ethereum.org/EIPS/eip-2255)
|
12
|
+
*
|
13
|
+
* @param client - Client to use
|
14
|
+
* @returns The wallet permissions. {@link GetPermissionsReturnType}
|
15
|
+
*
|
16
|
+
* @example
|
17
|
+
* import { createWalletClient, custom } from 'viem'
|
18
|
+
* import { mainnet } from 'viem/chains'
|
19
|
+
* import { getPermissions } from 'viem/wallet'
|
20
|
+
*
|
21
|
+
* const client = createWalletClient({
|
22
|
+
* chain: mainnet,
|
23
|
+
* transport: custom(window.ethereum),
|
24
|
+
* })
|
25
|
+
* const permissions = await getPermissions(client)
|
26
|
+
*/
|
27
|
+
export declare function getPermissions<TChain extends Chain | undefined, TAccount extends Account | undefined = undefined>(client: Client<Transport, TChain, TAccount>): Promise<WalletPermission[]>;
|
28
|
+
//# sourceMappingURL=getPermissions.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"getPermissions.d.ts","sourceRoot":"","sources":["../../../../src/actions/wallet/getPermissions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAA;AACtD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAA;AAC3D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,6CAA6C,CAAA;AAC5E,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAA;AACjD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AAE9D,MAAM,MAAM,wBAAwB,GAAG,gBAAgB,EAAE,CAAA;AAEzD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,cAAc,CAClC,MAAM,SAAS,KAAK,GAAG,SAAS,EAChC,QAAQ,SAAS,OAAO,GAAG,SAAS,GAAG,SAAS,EAChD,MAAM,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,CAAC,+BAG5C"}
|
@@ -0,0 +1,32 @@
|
|
1
|
+
import type { Address } from 'abitype';
|
2
|
+
import type { Account } from '../../accounts/types.js';
|
3
|
+
import type { Client } from '../../clients/createClient.js';
|
4
|
+
import type { Transport } from '../../clients/transports/createTransport.js';
|
5
|
+
import type { Chain } from '../../types/chain.js';
|
6
|
+
export type RequestAddressesReturnType = Address[];
|
7
|
+
/**
|
8
|
+
* Requests a list of accounts managed by a wallet.
|
9
|
+
*
|
10
|
+
* - Docs: https://viem.sh/docs/actions/wallet/requestAddresses.html
|
11
|
+
* - JSON-RPC Methods: [`eth_requestAccounts`](https://eips.ethereum.org/EIPS/eip-1102)
|
12
|
+
*
|
13
|
+
* 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).
|
14
|
+
*
|
15
|
+
* 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.
|
16
|
+
*
|
17
|
+
* @param client - Client to use
|
18
|
+
* @returns List of accounts managed by a wallet {@link RequestAddressesReturnType}
|
19
|
+
*
|
20
|
+
* @example
|
21
|
+
* import { createWalletClient, custom } from 'viem'
|
22
|
+
* import { mainnet } from 'viem/chains'
|
23
|
+
* import { requestAddresses } from 'viem/wallet'
|
24
|
+
*
|
25
|
+
* const client = createWalletClient({
|
26
|
+
* chain: mainnet,
|
27
|
+
* transport: custom(window.ethereum),
|
28
|
+
* })
|
29
|
+
* const accounts = await requestAddresses(client)
|
30
|
+
*/
|
31
|
+
export declare function requestAddresses<TChain extends Chain | undefined, TAccount extends Account | undefined = undefined>(client: Client<Transport, TChain, TAccount>): Promise<RequestAddressesReturnType>;
|
32
|
+
//# sourceMappingURL=requestAddresses.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"requestAddresses.d.ts","sourceRoot":"","sources":["../../../../src/actions/wallet/requestAddresses.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAEtC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAA;AACtD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAA;AAC3D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,6CAA6C,CAAA;AAC5E,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAA;AAGjD,MAAM,MAAM,0BAA0B,GAAG,OAAO,EAAE,CAAA;AAElD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAsB,gBAAgB,CACpC,MAAM,SAAS,KAAK,GAAG,SAAS,EAChC,QAAQ,SAAS,OAAO,GAAG,SAAS,GAAG,SAAS,EAEhD,MAAM,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,CAAC,GAC1C,OAAO,CAAC,0BAA0B,CAAC,CAGrC"}
|
@@ -0,0 +1,37 @@
|
|
1
|
+
import type { Account } from '../../accounts/types.js';
|
2
|
+
import type { Client } from '../../clients/createClient.js';
|
3
|
+
import type { Transport } from '../../clients/transports/createTransport.js';
|
4
|
+
import type { Chain } from '../../types/chain.js';
|
5
|
+
import type { WalletPermission } from '../../types/eip1193.js';
|
6
|
+
import type { Prettify } from '../../types/utils.js';
|
7
|
+
export type RequestPermissionsParameters = Prettify<{
|
8
|
+
eth_accounts: Record<string, any>;
|
9
|
+
} & {
|
10
|
+
[key: string]: Record<string, any>;
|
11
|
+
}>;
|
12
|
+
export type RequestPermissionsReturnType = WalletPermission[];
|
13
|
+
/**
|
14
|
+
* Requests permissions for a wallet.
|
15
|
+
*
|
16
|
+
* - Docs: https://viem.sh/docs/actions/wallet/requestPermissions.html
|
17
|
+
* - JSON-RPC Methods: [`wallet_requestPermissions`](https://eips.ethereum.org/EIPS/eip-2255)
|
18
|
+
*
|
19
|
+
* @param client - Client to use
|
20
|
+
* @param parameters - {@link RequestPermissionsParameters}
|
21
|
+
* @returns The wallet permissions. {@link RequestPermissionsReturnType}
|
22
|
+
*
|
23
|
+
* @example
|
24
|
+
* import { createWalletClient, custom } from 'viem'
|
25
|
+
* import { mainnet } from 'viem/chains'
|
26
|
+
* import { requestPermissions } from 'viem/wallet'
|
27
|
+
*
|
28
|
+
* const client = createWalletClient({
|
29
|
+
* chain: mainnet,
|
30
|
+
* transport: custom(window.ethereum),
|
31
|
+
* })
|
32
|
+
* const permissions = await requestPermissions(client, {
|
33
|
+
* eth_accounts: {}
|
34
|
+
* })
|
35
|
+
*/
|
36
|
+
export declare function requestPermissions<TChain extends Chain | undefined, TAccount extends Account | undefined = undefined>(client: Client<Transport, TChain, TAccount>, permissions: RequestPermissionsParameters): Promise<WalletPermission[]>;
|
37
|
+
//# sourceMappingURL=requestPermissions.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"requestPermissions.d.ts","sourceRoot":"","sources":["../../../../src/actions/wallet/requestPermissions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAA;AACtD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAA;AAC3D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,6CAA6C,CAAA;AAC5E,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAA;AACjD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AAC9D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AAEpD,MAAM,MAAM,4BAA4B,GAAG,QAAQ,CACjD;IACE,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;CAClC,GAAG;IACF,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;CACnC,CACF,CAAA;AACD,MAAM,MAAM,4BAA4B,GAAG,gBAAgB,EAAE,CAAA;AAE7D;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAsB,kBAAkB,CACtC,MAAM,SAAS,KAAK,GAAG,SAAS,EAChC,QAAQ,SAAS,OAAO,GAAG,SAAS,GAAG,SAAS,EAEhD,MAAM,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,CAAC,EAC3C,WAAW,EAAE,4BAA4B,+BAM1C"}
|
@@ -0,0 +1,58 @@
|
|
1
|
+
import type { Account } from '../../accounts/types.js';
|
2
|
+
import type { Client } from '../../clients/createClient.js';
|
3
|
+
import type { Transport } from '../../clients/transports/createTransport.js';
|
4
|
+
import type { GetAccountParameter } from '../../types/account.js';
|
5
|
+
import type { Chain } from '../../types/chain.js';
|
6
|
+
import type { GetChain } from '../../types/chain.js';
|
7
|
+
import type { Hash } from '../../types/misc.js';
|
8
|
+
import type { UnionOmit } from '../../types/utils.js';
|
9
|
+
import { type FormattedTransactionRequest } from '../../utils/formatters/transactionRequest.js';
|
10
|
+
export type SendTransactionParameters<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>;
|
11
|
+
export type SendTransactionReturnType = Hash;
|
12
|
+
/**
|
13
|
+
* Creates, signs, and sends a new transaction to the network.
|
14
|
+
*
|
15
|
+
* - Docs: https://viem.sh/docs/actions/wallet/sendTransaction.html
|
16
|
+
* - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/transactions/sending-transactions
|
17
|
+
* - JSON-RPC Methods:
|
18
|
+
* - JSON-RPC Accounts: [`eth_sendTransaction`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_sendtransaction)
|
19
|
+
* - Local Accounts: [`eth_sendRawTransaction`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_sendrawtransaction)
|
20
|
+
*
|
21
|
+
* @param client - Client to use
|
22
|
+
* @param parameters - {@link SendTransactionParameters}
|
23
|
+
* @returns The [Transaction](https://viem.sh/docs/glossary/terms.html#transaction) hash. {@link SendTransactionReturnType}
|
24
|
+
*
|
25
|
+
* @example
|
26
|
+
* import { createWalletClient, custom } from 'viem'
|
27
|
+
* import { mainnet } from 'viem/chains'
|
28
|
+
* import { sendTransaction } from 'viem/wallet'
|
29
|
+
*
|
30
|
+
* const client = createWalletClient({
|
31
|
+
* chain: mainnet,
|
32
|
+
* transport: custom(window.ethereum),
|
33
|
+
* })
|
34
|
+
* const hash = await sendTransaction(client, {
|
35
|
+
* account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
|
36
|
+
* to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8',
|
37
|
+
* value: 1000000000000000000n,
|
38
|
+
* })
|
39
|
+
*
|
40
|
+
* @example
|
41
|
+
* // Account Hoisting
|
42
|
+
* import { createWalletClient, http } from 'viem'
|
43
|
+
* import { privateKeyToAccount } from 'viem/accounts'
|
44
|
+
* import { mainnet } from 'viem/chains'
|
45
|
+
* import { sendTransaction } from 'viem/wallet'
|
46
|
+
*
|
47
|
+
* const client = createWalletClient({
|
48
|
+
* account: privateKeyToAccount('0x…'),
|
49
|
+
* chain: mainnet,
|
50
|
+
* transport: http(),
|
51
|
+
* })
|
52
|
+
* const hash = await sendTransaction(client, {
|
53
|
+
* to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8',
|
54
|
+
* value: 1000000000000000000n,
|
55
|
+
* })
|
56
|
+
*/
|
57
|
+
export declare function sendTransaction<TChain extends Chain | undefined, TAccount extends Account | undefined, TChainOverride extends Chain | undefined>(client: Client<Transport, TChain, TAccount>, args: SendTransactionParameters<TChain, TAccount, TChainOverride>): Promise<SendTransactionReturnType>;
|
58
|
+
//# sourceMappingURL=sendTransaction.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"sendTransaction.d.ts","sourceRoot":"","sources":["../../../../src/actions/wallet/sendTransaction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAA;AAEtD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAA;AAC3D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,6CAA6C,CAAA;AAG5E,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,IAAI,EAAE,MAAM,qBAAqB,CAAA;AAK/C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AAIrD,OAAO,EACL,KAAK,2BAA2B,EAEjC,MAAM,8CAA8C,CAAA;AAQrD,MAAM,MAAM,yBAAyB,CACnC,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,yBAAyB,GAAG,IAAI,CAAA;AAE5C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,wBAAsB,eAAe,CACnC,MAAM,SAAS,KAAK,GAAG,SAAS,EAChC,QAAQ,SAAS,OAAO,GAAG,SAAS,EACpC,cAAc,SAAS,KAAK,GAAG,SAAS,EAExC,MAAM,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,CAAC,EAC3C,IAAI,EAAE,yBAAyB,CAAC,MAAM,EAAE,QAAQ,EAAE,cAAc,CAAC,GAChE,OAAO,CAAC,yBAAyB,CAAC,CA8FpC"}
|
@@ -0,0 +1,58 @@
|
|
1
|
+
import type { Account } from '../../accounts/types.js';
|
2
|
+
import type { Client } from '../../clients/createClient.js';
|
3
|
+
import type { Transport } from '../../clients/transports/createTransport.js';
|
4
|
+
import type { GetAccountParameter } from '../../types/account.js';
|
5
|
+
import type { Chain } from '../../types/chain.js';
|
6
|
+
import type { Hex, SignableMessage } from '../../types/misc.js';
|
7
|
+
export type SignMessageParameters<TAccount extends Account | undefined = Account | undefined> = GetAccountParameter<TAccount> & {
|
8
|
+
message: SignableMessage;
|
9
|
+
};
|
10
|
+
export type SignMessageReturnType = Hex;
|
11
|
+
/**
|
12
|
+
* Calculates an Ethereum-specific signature in [EIP-191 format](https://eips.ethereum.org/EIPS/eip-191): `keccak256("\x19Ethereum Signed Message:\n" + len(message) + message))`.
|
13
|
+
*
|
14
|
+
* - Docs: https://viem.sh/docs/actions/wallet/signMessage.html
|
15
|
+
* - JSON-RPC Methods:
|
16
|
+
* - JSON-RPC Accounts: [`personal_sign`](https://docs.metamask.io/guide/signing-data.html#personal-sign)
|
17
|
+
* - Local Accounts: Signs locally. No JSON-RPC request.
|
18
|
+
*
|
19
|
+
* With the calculated signature, you can:
|
20
|
+
* - use [`verifyMessage`](https://viem.sh/docs/utilities/verifyMessage.html) to verify the signature,
|
21
|
+
* - use [`recoverMessageAddress`](https://viem.sh/docs/utilities/recoverMessageAddress.html) to recover the signing address from a signature.
|
22
|
+
*
|
23
|
+
* @param client - Client to use
|
24
|
+
* @param parameters - {@link SignMessageParameters}
|
25
|
+
* @returns The signed message. {@link SignMessageReturnType}
|
26
|
+
*
|
27
|
+
* @example
|
28
|
+
* import { createWalletClient, custom } from 'viem'
|
29
|
+
* import { mainnet } from 'viem/chains'
|
30
|
+
* import { signMessage } from 'viem/wallet'
|
31
|
+
*
|
32
|
+
* const client = createWalletClient({
|
33
|
+
* chain: mainnet,
|
34
|
+
* transport: custom(window.ethereum),
|
35
|
+
* })
|
36
|
+
* const signature = await signMessage(client, {
|
37
|
+
* account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
|
38
|
+
* message: 'hello world',
|
39
|
+
* })
|
40
|
+
*
|
41
|
+
* @example
|
42
|
+
* // Account Hoisting
|
43
|
+
* import { createWalletClient, custom } from 'viem'
|
44
|
+
* import { privateKeyToAccount } from 'viem/accounts'
|
45
|
+
* import { mainnet } from 'viem/chains'
|
46
|
+
* import { signMessage } from 'viem/wallet'
|
47
|
+
*
|
48
|
+
* const client = createWalletClient({
|
49
|
+
* account: privateKeyToAccount('0x…'),
|
50
|
+
* chain: mainnet,
|
51
|
+
* transport: custom(window.ethereum),
|
52
|
+
* })
|
53
|
+
* const signature = await signMessage(client, {
|
54
|
+
* message: 'hello world',
|
55
|
+
* })
|
56
|
+
*/
|
57
|
+
export declare function signMessage<TChain extends Chain | undefined, TAccount extends Account | undefined>(client: Client<Transport, TChain, TAccount>, { account: account_, message, }: SignMessageParameters<TAccount>): Promise<SignMessageReturnType>;
|
58
|
+
//# sourceMappingURL=signMessage.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"signMessage.d.ts","sourceRoot":"","sources":["../../../../src/actions/wallet/signMessage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAA;AAEtD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAA;AAC3D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,6CAA6C,CAAA;AAE5E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAA;AACjE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAA;AACjD,OAAO,KAAK,EAAE,GAAG,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAG/D,MAAM,MAAM,qBAAqB,CAC/B,QAAQ,SAAS,OAAO,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,IACxD,mBAAmB,CAAC,QAAQ,CAAC,GAAG;IAClC,OAAO,EAAE,eAAe,CAAA;CACzB,CAAA;AAED,MAAM,MAAM,qBAAqB,GAAG,GAAG,CAAA;AAEvC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,wBAAsB,WAAW,CAC/B,MAAM,SAAS,KAAK,GAAG,SAAS,EAChC,QAAQ,SAAS,OAAO,GAAG,SAAS,EAEpC,MAAM,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,CAAC,EAC3C,EACE,OAAO,EAAE,QAAyB,EAClC,OAAO,GACR,EAAE,qBAAqB,CAAC,QAAQ,CAAC,GACjC,OAAO,CAAC,qBAAqB,CAAC,CAkBhC"}
|
@@ -0,0 +1,114 @@
|
|
1
|
+
import type { TypedData } from 'abitype';
|
2
|
+
import type { Account } from '../../accounts/types.js';
|
3
|
+
import type { Client } from '../../clients/createClient.js';
|
4
|
+
import type { Transport } from '../../clients/transports/createTransport.js';
|
5
|
+
import type { GetAccountParameter } from '../../types/account.js';
|
6
|
+
import type { Chain } from '../../types/chain.js';
|
7
|
+
import type { Hex } from '../../types/misc.js';
|
8
|
+
import type { TypedDataDefinition } from '../../types/typedData.js';
|
9
|
+
export type SignTypedDataParameters<TTypedData extends TypedData | {
|
10
|
+
[key: string]: unknown;
|
11
|
+
} = TypedData, TPrimaryType extends string = string, TAccount extends Account | undefined = undefined> = GetAccountParameter<TAccount> & TypedDataDefinition<TTypedData, TPrimaryType>;
|
12
|
+
export type SignTypedDataReturnType = Hex;
|
13
|
+
/**
|
14
|
+
* Signs typed data and calculates an Ethereum-specific signature in [https://eips.ethereum.org/EIPS/eip-712](https://eips.ethereum.org/EIPS/eip-712): `sign(keccak256("\x19\x01" ‖ domainSeparator ‖ hashStruct(message)))`
|
15
|
+
*
|
16
|
+
* - Docs: https://viem.sh/docs/actions/wallet/signTypedData.html
|
17
|
+
* - JSON-RPC Methods:
|
18
|
+
* - JSON-RPC Accounts: [`eth_signTypedData_v4`](https://docs.metamask.io/guide/signing-data.html#signtypeddata-v4)
|
19
|
+
* - Local Accounts: Signs locally. No JSON-RPC request.
|
20
|
+
*
|
21
|
+
* @param client - Client to use
|
22
|
+
* @param parameters - {@link SignTypedDataParameters}
|
23
|
+
* @returns The signed data. {@link SignTypedDataReturnType}
|
24
|
+
*
|
25
|
+
* @example
|
26
|
+
* import { createWalletClient, custom } from 'viem'
|
27
|
+
* import { mainnet } from 'viem/chains'
|
28
|
+
* import { signTypedData } from 'viem/wallet'
|
29
|
+
*
|
30
|
+
* const client = createWalletClient({
|
31
|
+
* chain: mainnet,
|
32
|
+
* transport: custom(window.ethereum),
|
33
|
+
* })
|
34
|
+
* const signature = await signTypedData(client, {
|
35
|
+
* account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
|
36
|
+
* domain: {
|
37
|
+
* name: 'Ether Mail',
|
38
|
+
* version: '1',
|
39
|
+
* chainId: 1,
|
40
|
+
* verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC',
|
41
|
+
* },
|
42
|
+
* types: {
|
43
|
+
* Person: [
|
44
|
+
* { name: 'name', type: 'string' },
|
45
|
+
* { name: 'wallet', type: 'address' },
|
46
|
+
* ],
|
47
|
+
* Mail: [
|
48
|
+
* { name: 'from', type: 'Person' },
|
49
|
+
* { name: 'to', type: 'Person' },
|
50
|
+
* { name: 'contents', type: 'string' },
|
51
|
+
* ],
|
52
|
+
* },
|
53
|
+
* primaryType: 'Mail',
|
54
|
+
* message: {
|
55
|
+
* from: {
|
56
|
+
* name: 'Cow',
|
57
|
+
* wallet: '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826',
|
58
|
+
* },
|
59
|
+
* to: {
|
60
|
+
* name: 'Bob',
|
61
|
+
* wallet: '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB',
|
62
|
+
* },
|
63
|
+
* contents: 'Hello, Bob!',
|
64
|
+
* },
|
65
|
+
* })
|
66
|
+
*
|
67
|
+
* @example
|
68
|
+
* // Account Hoisting
|
69
|
+
* import { createWalletClient, http } from 'viem'
|
70
|
+
* import { privateKeyToAccount } from 'viem/accounts'
|
71
|
+
* import { mainnet } from 'viem/chains'
|
72
|
+
* import { signTypedData } from 'viem/wallet'
|
73
|
+
*
|
74
|
+
* const client = createWalletClient({
|
75
|
+
* account: privateKeyToAccount('0x…'),
|
76
|
+
* chain: mainnet,
|
77
|
+
* transport: http(),
|
78
|
+
* })
|
79
|
+
* const signature = await signTypedData(client, {
|
80
|
+
* domain: {
|
81
|
+
* name: 'Ether Mail',
|
82
|
+
* version: '1',
|
83
|
+
* chainId: 1,
|
84
|
+
* verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC',
|
85
|
+
* },
|
86
|
+
* types: {
|
87
|
+
* Person: [
|
88
|
+
* { name: 'name', type: 'string' },
|
89
|
+
* { name: 'wallet', type: 'address' },
|
90
|
+
* ],
|
91
|
+
* Mail: [
|
92
|
+
* { name: 'from', type: 'Person' },
|
93
|
+
* { name: 'to', type: 'Person' },
|
94
|
+
* { name: 'contents', type: 'string' },
|
95
|
+
* ],
|
96
|
+
* },
|
97
|
+
* primaryType: 'Mail',
|
98
|
+
* message: {
|
99
|
+
* from: {
|
100
|
+
* name: 'Cow',
|
101
|
+
* wallet: '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826',
|
102
|
+
* },
|
103
|
+
* to: {
|
104
|
+
* name: 'Bob',
|
105
|
+
* wallet: '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB',
|
106
|
+
* },
|
107
|
+
* contents: 'Hello, Bob!',
|
108
|
+
* },
|
109
|
+
* })
|
110
|
+
*/
|
111
|
+
export declare function signTypedData<const TTypedData extends TypedData | {
|
112
|
+
[key: string]: unknown;
|
113
|
+
}, TPrimaryType extends string, TChain extends Chain | undefined, TAccount extends Account | undefined>(client: Client<Transport, TChain, TAccount>, { account: account_, domain, message, primaryType, types: types_, }: SignTypedDataParameters<TTypedData, TPrimaryType, TAccount>): Promise<SignTypedDataReturnType>;
|
114
|
+
//# sourceMappingURL=signTypedData.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"signTypedData.d.ts","sourceRoot":"","sources":["../../../../src/actions/wallet/signTypedData.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAExC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAA;AAEtD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAA;AAC3D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,6CAA6C,CAAA;AAE5E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAA;AACjE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAA;AACjD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,qBAAqB,CAAA;AAC9C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AAKnE,MAAM,MAAM,uBAAuB,CACjC,UAAU,SAAS,SAAS,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CAAE,GAAG,SAAS,EACrE,YAAY,SAAS,MAAM,GAAG,MAAM,EACpC,QAAQ,SAAS,OAAO,GAAG,SAAS,GAAG,SAAS,IAC9C,mBAAmB,CAAC,QAAQ,CAAC,GAC/B,mBAAmB,CAAC,UAAU,EAAE,YAAY,CAAC,CAAA;AAE/C,MAAM,MAAM,uBAAuB,GAAG,GAAG,CAAA;AAEzC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiGG;AACH,wBAAsB,aAAa,CACjC,KAAK,CAAC,UAAU,SAAS,SAAS,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CAAE,EAC/D,YAAY,SAAS,MAAM,EAC3B,MAAM,SAAS,KAAK,GAAG,SAAS,EAChC,QAAQ,SAAS,OAAO,GAAG,SAAS,EAEpC,MAAM,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,CAAC,EAC3C,EACE,OAAO,EAAE,QAAyB,EAClC,MAAM,EACN,OAAO,EACP,WAAW,EACX,KAAK,EAAE,MAAM,GACd,EAAE,uBAAuB,CAAC,UAAU,EAAE,YAAY,EAAE,QAAQ,CAAC,GAC7D,OAAO,CAAC,uBAAuB,CAAC,CAiDlC"}
|
@@ -0,0 +1,30 @@
|
|
1
|
+
import type { Account } from '../../accounts/types.js';
|
2
|
+
import type { Client } from '../../clients/createClient.js';
|
3
|
+
import type { Transport } from '../../clients/transports/createTransport.js';
|
4
|
+
import type { Chain } from '../../types/chain.js';
|
5
|
+
export type SwitchChainParameters = {
|
6
|
+
/** ID of Chain to switch to */
|
7
|
+
id: Chain['id'];
|
8
|
+
};
|
9
|
+
/**
|
10
|
+
* Switch the target chain in a wallet.
|
11
|
+
*
|
12
|
+
* - Docs: https://viem.sh/docs/actions/wallet/switchChain.html
|
13
|
+
* - JSON-RPC Methods: [`eth_switchEthereumChain`](https://eips.ethereum.org/EIPS/eip-3326)
|
14
|
+
*
|
15
|
+
* @param client - Client to use
|
16
|
+
* @param parameters - {@link SwitchChainParameters}
|
17
|
+
*
|
18
|
+
* @example
|
19
|
+
* import { createWalletClient, custom } from 'viem'
|
20
|
+
* import { mainnet, optimism } from 'viem/chains'
|
21
|
+
* import { switchChain } from 'viem/wallet'
|
22
|
+
*
|
23
|
+
* const client = createWalletClient({
|
24
|
+
* chain: mainnet,
|
25
|
+
* transport: custom(window.ethereum),
|
26
|
+
* })
|
27
|
+
* await switchChain(client, { id: optimism.id })
|
28
|
+
*/
|
29
|
+
export declare function switchChain<TChain extends Chain | undefined, TAccount extends Account | undefined = undefined>(client: Client<Transport, TChain, TAccount>, { id }: SwitchChainParameters): Promise<void>;
|
30
|
+
//# sourceMappingURL=switchChain.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"switchChain.d.ts","sourceRoot":"","sources":["../../../../src/actions/wallet/switchChain.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAA;AACtD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAA;AAC3D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,6CAA6C,CAAA;AAC5E,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAA;AAGjD,MAAM,MAAM,qBAAqB,GAAG;IAClC,+BAA+B;IAC/B,EAAE,EAAE,KAAK,CAAC,IAAI,CAAC,CAAA;CAChB,CAAA;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,WAAW,CAC/B,MAAM,SAAS,KAAK,GAAG,SAAS,EAChC,QAAQ,SAAS,OAAO,GAAG,SAAS,GAAG,SAAS,EAChD,MAAM,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,qBAAqB,iBAS3E"}
|
@@ -0,0 +1,37 @@
|
|
1
|
+
import type { Account } from '../../accounts/types.js';
|
2
|
+
import type { Client } from '../../clients/createClient.js';
|
3
|
+
import type { Transport } from '../../clients/transports/createTransport.js';
|
4
|
+
import type { Chain } from '../../types/chain.js';
|
5
|
+
import type { WatchAssetParams } from '../../types/eip1193.js';
|
6
|
+
export type WatchAssetParameters = WatchAssetParams;
|
7
|
+
export type WatchAssetReturnType = boolean;
|
8
|
+
/**
|
9
|
+
* Adds an EVM chain to the wallet.
|
10
|
+
*
|
11
|
+
* - Docs: https://viem.sh/docs/actions/wallet/watchAsset.html
|
12
|
+
* - JSON-RPC Methods: [`eth_switchEthereumChain`](https://eips.ethereum.org/EIPS/eip-747)
|
13
|
+
*
|
14
|
+
* @param client - Client to use
|
15
|
+
* @param parameters - {@link WatchAssetParameters}
|
16
|
+
* @returns Boolean indicating if the token was successfully added. {@link WatchAssetReturnType}
|
17
|
+
*
|
18
|
+
* @example
|
19
|
+
* import { createWalletClient, custom } from 'viem'
|
20
|
+
* import { mainnet } from 'viem/chains'
|
21
|
+
* import { watchAsset } from 'viem/wallet'
|
22
|
+
*
|
23
|
+
* const client = createWalletClient({
|
24
|
+
* chain: mainnet,
|
25
|
+
* transport: custom(window.ethereum),
|
26
|
+
* })
|
27
|
+
* const success = await watchAsset(client, {
|
28
|
+
* type: 'ERC20',
|
29
|
+
* options: {
|
30
|
+
* address: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
|
31
|
+
* decimals: 18,
|
32
|
+
* symbol: 'WETH',
|
33
|
+
* },
|
34
|
+
* })
|
35
|
+
*/
|
36
|
+
export declare function watchAsset<TChain extends Chain | undefined, TAccount extends Account | undefined = undefined>(client: Client<Transport, TChain, TAccount>, params: WatchAssetParameters): Promise<WatchAssetReturnType>;
|
37
|
+
//# sourceMappingURL=watchAsset.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"watchAsset.d.ts","sourceRoot":"","sources":["../../../../src/actions/wallet/watchAsset.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAA;AACtD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAA;AAC3D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,6CAA6C,CAAA;AAC5E,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAA;AACjD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AAE9D,MAAM,MAAM,oBAAoB,GAAG,gBAAgB,CAAA;AACnD,MAAM,MAAM,oBAAoB,GAAG,OAAO,CAAA;AAE1C;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAsB,UAAU,CAC9B,MAAM,SAAS,KAAK,GAAG,SAAS,EAChC,QAAQ,SAAS,OAAO,GAAG,SAAS,GAAG,SAAS,EAEhD,MAAM,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,CAAC,EAC3C,MAAM,EAAE,oBAAoB,GAC3B,OAAO,CAAC,oBAAoB,CAAC,CAM/B"}
|
@@ -0,0 +1,69 @@
|
|
1
|
+
import type { Abi } from 'abitype';
|
2
|
+
import type { Account } from '../../accounts/types.js';
|
3
|
+
import type { Client } from '../../clients/createClient.js';
|
4
|
+
import type { Transport } from '../../clients/transports/createTransport.js';
|
5
|
+
import type { GetAccountParameter } from '../../types/account.js';
|
6
|
+
import type { Chain } from '../../types/chain.js';
|
7
|
+
import type { GetChain } from '../../types/chain.js';
|
8
|
+
import type { ContractFunctionConfig, GetValue } from '../../types/contract.js';
|
9
|
+
import type { Hex } from '../../types/misc.js';
|
10
|
+
import type { UnionOmit } from '../../types/utils.js';
|
11
|
+
import type { FormattedTransactionRequest } from '../../utils/formatters/transactionRequest.js';
|
12
|
+
import { type SendTransactionParameters, type SendTransactionReturnType } from './sendTransaction.js';
|
13
|
+
export type WriteContractParameters<TAbi extends Abi | readonly unknown[] = Abi, TFunctionName extends string = string, TChain extends Chain | undefined = Chain, TAccount extends Account | undefined = Account | undefined, TChainOverride extends Chain | undefined = Chain | undefined> = ContractFunctionConfig<TAbi, TFunctionName, 'payable' | 'nonpayable'> & GetAccountParameter<TAccount> & GetChain<TChain, TChainOverride> & UnionOmit<FormattedTransactionRequest<TChainOverride extends Chain ? TChainOverride : TChain>, 'from' | 'to' | 'data' | 'value'> & GetValue<TAbi, TFunctionName, SendTransactionParameters<TChain, TAccount, TChainOverride> extends SendTransactionParameters ? SendTransactionParameters<TChain, TAccount, TChainOverride>['value'] : SendTransactionParameters['value']> & {
|
14
|
+
/** Data to append to the end of the calldata. Useful for adding a ["domain" tag](https://opensea.notion.site/opensea/Seaport-Order-Attributions-ec2d69bf455041a5baa490941aad307f). */
|
15
|
+
dataSuffix?: Hex;
|
16
|
+
};
|
17
|
+
export type WriteContractReturnType = SendTransactionReturnType;
|
18
|
+
/**
|
19
|
+
* Executes a write function on a contract.
|
20
|
+
*
|
21
|
+
* - Docs: https://viem.sh/docs/contract/writeContract.html
|
22
|
+
* - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/contracts/writing-to-contracts
|
23
|
+
*
|
24
|
+
* 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.
|
25
|
+
*
|
26
|
+
* 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).
|
27
|
+
*
|
28
|
+
* __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.__
|
29
|
+
*
|
30
|
+
* @param client - Client to use
|
31
|
+
* @param parameters - {@link WriteContractParameters}
|
32
|
+
* @returns A [Transaction Hash](https://viem.sh/docs/glossary/terms.html#hash). {@link WriteContractReturnType}
|
33
|
+
*
|
34
|
+
* @example
|
35
|
+
* import { createWalletClient, custom, parseAbi } from 'viem'
|
36
|
+
* import { mainnet } from 'viem/chains'
|
37
|
+
* import { writeContract } from 'viem/contract'
|
38
|
+
*
|
39
|
+
* const client = createWalletClient({
|
40
|
+
* chain: mainnet,
|
41
|
+
* transport: custom(window.ethereum),
|
42
|
+
* })
|
43
|
+
* const hash = await writeContract(client, {
|
44
|
+
* address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',
|
45
|
+
* abi: parseAbi(['function mint(uint32 tokenId) nonpayable']),
|
46
|
+
* functionName: 'mint',
|
47
|
+
* args: [69420],
|
48
|
+
* })
|
49
|
+
*
|
50
|
+
* @example
|
51
|
+
* // With Validation
|
52
|
+
* import { createWalletClient, http, parseAbi } from 'viem'
|
53
|
+
* import { mainnet } from 'viem/chains'
|
54
|
+
* import { simulateContract, writeContract } from 'viem/contract'
|
55
|
+
*
|
56
|
+
* const client = createWalletClient({
|
57
|
+
* chain: mainnet,
|
58
|
+
* transport: http(),
|
59
|
+
* })
|
60
|
+
* const { request } = await simulateContract(client, {
|
61
|
+
* address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',
|
62
|
+
* abi: parseAbi(['function mint(uint32 tokenId) nonpayable']),
|
63
|
+
* functionName: 'mint',
|
64
|
+
* args: [69420],
|
65
|
+
* }
|
66
|
+
* const hash = await writeContract(client, request)
|
67
|
+
*/
|
68
|
+
export declare function writeContract<TChain extends Chain | undefined, TAccount extends Account | undefined, const TAbi extends Abi | readonly unknown[], TFunctionName extends string, TChainOverride extends Chain | undefined>(client: Client<Transport, TChain, TAccount>, { abi, address, args, dataSuffix, functionName, ...request }: WriteContractParameters<TAbi, TFunctionName, TChain, TAccount, TChainOverride>): Promise<WriteContractReturnType>;
|
69
|
+
//# sourceMappingURL=writeContract.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"writeContract.d.ts","sourceRoot":"","sources":["../../../../src/actions/wallet/writeContract.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,SAAS,CAAA;AAElC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAA;AACtD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAA;AAC3D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,6CAA6C,CAAA;AAC5E,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,sBAAsB,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AAC/E,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,qBAAqB,CAAA;AAC9C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AAKrD,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,8CAA8C,CAAA;AAC/F,OAAO,EACL,KAAK,yBAAyB,EAC9B,KAAK,yBAAyB,EAE/B,MAAM,sBAAsB,CAAA;AAE7B,MAAM,MAAM,uBAAuB,CACjC,IAAI,SAAS,GAAG,GAAG,SAAS,OAAO,EAAE,GAAG,GAAG,EAC3C,aAAa,SAAS,MAAM,GAAG,MAAM,EACrC,MAAM,SAAS,KAAK,GAAG,SAAS,GAAG,KAAK,EACxC,QAAQ,SAAS,OAAO,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,EAC1D,cAAc,SAAS,KAAK,GAAG,SAAS,GAAG,KAAK,GAAG,SAAS,IAC1D,sBAAsB,CAAC,IAAI,EAAE,aAAa,EAAE,SAAS,GAAG,YAAY,CAAC,GACvE,mBAAmB,CAAC,QAAQ,CAAC,GAC7B,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC,GAChC,SAAS,CACP,2BAA2B,CACzB,cAAc,SAAS,KAAK,GAAG,cAAc,GAAG,MAAM,CACvD,EACD,MAAM,GAAG,IAAI,GAAG,MAAM,GAAG,OAAO,CACjC,GACD,QAAQ,CACN,IAAI,EACJ,aAAa,EACb,yBAAyB,CACvB,MAAM,EACN,QAAQ,EACR,cAAc,CACf,SAAS,yBAAyB,GAC/B,yBAAyB,CAAC,MAAM,EAAE,QAAQ,EAAE,cAAc,CAAC,CAAC,OAAO,CAAC,GACpE,yBAAyB,CAAC,OAAO,CAAC,CACvC,GAAG;IACF,sLAAsL;IACtL,UAAU,CAAC,EAAE,GAAG,CAAA;CACjB,CAAA;AAEH,MAAM,MAAM,uBAAuB,GAAG,yBAAyB,CAAA;AAE/D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AACH,wBAAsB,aAAa,CACjC,MAAM,SAAS,KAAK,GAAG,SAAS,EAChC,QAAQ,SAAS,OAAO,GAAG,SAAS,EACpC,KAAK,CAAC,IAAI,SAAS,GAAG,GAAG,SAAS,OAAO,EAAE,EAC3C,aAAa,SAAS,MAAM,EAC5B,cAAc,SAAS,KAAK,GAAG,SAAS,EAExC,MAAM,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,CAAC,EAC3C,EACE,GAAG,EACH,OAAO,EACP,IAAI,EACJ,UAAU,EACV,YAAY,EACZ,GAAG,OAAO,EACX,EAAE,uBAAuB,CACxB,IAAI,EACJ,aAAa,EACb,MAAM,EACN,QAAQ,EACR,cAAc,CACf,GACA,OAAO,CAAC,uBAAuB,CAAC,CAYlC"}
|