viem 0.4.0-main.20230412T220621 → 0.4.0-main.20230413T040554
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/ens/getEnsAddress.js.map +1 -1
- package/dist/cjs/actions/ens/getEnsAvatar.js.map +1 -1
- package/dist/cjs/actions/ens/getEnsName.js.map +1 -1
- package/dist/cjs/actions/ens/getEnsResolver.js.map +1 -1
- package/dist/cjs/actions/ens/getEnsText.js.map +1 -1
- package/dist/cjs/actions/getContract.js.map +1 -1
- package/dist/cjs/actions/public/estimateContractGas.js.map +1 -1
- package/dist/cjs/actions/public/getBalance.js.map +1 -1
- package/dist/cjs/actions/public/getFilterChanges.js.map +1 -1
- package/dist/cjs/actions/public/getFilterLogs.js.map +1 -1
- package/dist/cjs/actions/public/readContract.js.map +1 -1
- package/dist/cjs/actions/public/simulateContract.js.map +1 -1
- package/dist/cjs/actions/public/uninstallFilter.js.map +1 -1
- package/dist/cjs/actions/public/waitForTransactionReceipt.js.map +1 -1
- package/dist/cjs/actions/public/watchContractEvent.js.map +1 -1
- package/dist/cjs/actions/public/watchEvent.js.map +1 -1
- package/dist/cjs/actions/public/watchPendingTransactions.js.map +1 -1
- package/dist/cjs/actions/test/dropTransaction.js.map +1 -1
- package/dist/cjs/actions/test/getAutomine.js.map +1 -1
- package/dist/cjs/actions/test/getTxpoolContent.js.map +1 -1
- package/dist/cjs/actions/test/getTxpoolStatus.js.map +1 -1
- package/dist/cjs/actions/test/impersonateAccount.js.map +1 -1
- package/dist/cjs/actions/test/increaseTime.js.map +1 -1
- package/dist/cjs/actions/test/inspectTxpool.js.map +1 -1
- package/dist/cjs/actions/test/mine.js.map +1 -1
- package/dist/cjs/actions/test/removeBlockTimestampInterval.js.map +1 -1
- package/dist/cjs/actions/test/reset.js.map +1 -1
- package/dist/cjs/actions/test/revert.js.map +1 -1
- package/dist/cjs/actions/test/sendUnsignedTransaction.js.map +1 -1
- package/dist/cjs/actions/test/setAutomine.js.map +1 -1
- package/dist/cjs/actions/test/setBalance.js.map +1 -1
- package/dist/cjs/actions/test/setBlockGasLimit.js.map +1 -1
- package/dist/cjs/actions/test/setBlockTimestampInterval.js.map +1 -1
- package/dist/cjs/actions/test/setCode.js.map +1 -1
- package/dist/cjs/actions/test/setCoinbase.js.map +1 -1
- package/dist/cjs/actions/test/setIntervalMining.js.map +1 -1
- package/dist/cjs/actions/test/setLoggingEnabled.js.map +1 -1
- package/dist/cjs/actions/test/setMinGasPrice.js.map +1 -1
- package/dist/cjs/actions/test/setNextBlockBaseFeePerGas.js.map +1 -1
- package/dist/cjs/actions/test/setNextBlockTimestamp.js.map +1 -1
- package/dist/cjs/actions/test/setNonce.js.map +1 -1
- package/dist/cjs/actions/test/setRpcUrl.js.map +1 -1
- package/dist/cjs/actions/test/setStorageAt.js.map +1 -1
- package/dist/cjs/actions/test/snapshot.js.map +1 -1
- package/dist/cjs/actions/test/stopImpersonatingAccount.js.map +1 -1
- package/dist/cjs/actions/wallet/addChain.js.map +1 -1
- package/dist/cjs/actions/wallet/getAddresses.js.map +1 -1
- package/dist/cjs/actions/wallet/getPermissions.js.map +1 -1
- package/dist/cjs/actions/wallet/requestAddresses.js.map +1 -1
- package/dist/cjs/actions/wallet/requestPermissions.js.map +1 -1
- package/dist/cjs/actions/wallet/sendTransaction.js.map +1 -1
- package/dist/cjs/actions/wallet/signMessage.js.map +1 -1
- package/dist/cjs/actions/wallet/signTypedData.js.map +1 -1
- package/dist/cjs/actions/wallet/switchChain.js.map +1 -1
- package/dist/cjs/actions/wallet/watchAsset.js.map +1 -1
- package/dist/cjs/actions/wallet/writeContract.js.map +1 -1
- package/dist/cjs/clients/createPublicClient.js.map +1 -1
- package/dist/cjs/clients/createTestClient.js.map +1 -1
- package/dist/cjs/clients/createWalletClient.js.map +1 -1
- package/dist/cjs/clients/decorators/test.js.map +1 -1
- package/dist/cjs/clients/decorators/wallet.js.map +1 -1
- package/dist/cjs/errors/version.js +1 -1
- package/dist/esm/actions/ens/getEnsAddress.js.map +1 -1
- package/dist/esm/actions/ens/getEnsAvatar.js.map +1 -1
- package/dist/esm/actions/ens/getEnsName.js.map +1 -1
- package/dist/esm/actions/ens/getEnsResolver.js.map +1 -1
- package/dist/esm/actions/ens/getEnsText.js.map +1 -1
- package/dist/esm/actions/getContract.js.map +1 -1
- package/dist/esm/actions/public/estimateContractGas.js.map +1 -1
- package/dist/esm/actions/public/getBalance.js.map +1 -1
- package/dist/esm/actions/public/getFilterChanges.js.map +1 -1
- package/dist/esm/actions/public/getFilterLogs.js.map +1 -1
- package/dist/esm/actions/public/readContract.js.map +1 -1
- package/dist/esm/actions/public/simulateContract.js.map +1 -1
- package/dist/esm/actions/public/uninstallFilter.js.map +1 -1
- package/dist/esm/actions/public/waitForTransactionReceipt.js.map +1 -1
- package/dist/esm/actions/public/watchContractEvent.js.map +1 -1
- package/dist/esm/actions/public/watchEvent.js.map +1 -1
- package/dist/esm/actions/public/watchPendingTransactions.js.map +1 -1
- package/dist/esm/actions/test/dropTransaction.js.map +1 -1
- package/dist/esm/actions/test/getAutomine.js.map +1 -1
- package/dist/esm/actions/test/getTxpoolContent.js.map +1 -1
- package/dist/esm/actions/test/getTxpoolStatus.js.map +1 -1
- package/dist/esm/actions/test/impersonateAccount.js.map +1 -1
- package/dist/esm/actions/test/increaseTime.js.map +1 -1
- package/dist/esm/actions/test/inspectTxpool.js.map +1 -1
- package/dist/esm/actions/test/mine.js.map +1 -1
- package/dist/esm/actions/test/removeBlockTimestampInterval.js.map +1 -1
- package/dist/esm/actions/test/reset.js.map +1 -1
- package/dist/esm/actions/test/revert.js.map +1 -1
- package/dist/esm/actions/test/sendUnsignedTransaction.js.map +1 -1
- package/dist/esm/actions/test/setAutomine.js.map +1 -1
- package/dist/esm/actions/test/setBalance.js.map +1 -1
- package/dist/esm/actions/test/setBlockGasLimit.js.map +1 -1
- package/dist/esm/actions/test/setBlockTimestampInterval.js.map +1 -1
- package/dist/esm/actions/test/setCode.js.map +1 -1
- package/dist/esm/actions/test/setCoinbase.js.map +1 -1
- package/dist/esm/actions/test/setIntervalMining.js.map +1 -1
- package/dist/esm/actions/test/setLoggingEnabled.js.map +1 -1
- package/dist/esm/actions/test/setMinGasPrice.js.map +1 -1
- package/dist/esm/actions/test/setNextBlockBaseFeePerGas.js.map +1 -1
- package/dist/esm/actions/test/setNextBlockTimestamp.js.map +1 -1
- package/dist/esm/actions/test/setNonce.js.map +1 -1
- package/dist/esm/actions/test/setRpcUrl.js.map +1 -1
- package/dist/esm/actions/test/setStorageAt.js.map +1 -1
- package/dist/esm/actions/test/snapshot.js.map +1 -1
- package/dist/esm/actions/test/stopImpersonatingAccount.js.map +1 -1
- package/dist/esm/actions/wallet/addChain.js.map +1 -1
- package/dist/esm/actions/wallet/getAddresses.js.map +1 -1
- package/dist/esm/actions/wallet/getPermissions.js.map +1 -1
- package/dist/esm/actions/wallet/requestAddresses.js.map +1 -1
- package/dist/esm/actions/wallet/requestPermissions.js.map +1 -1
- package/dist/esm/actions/wallet/sendTransaction.js.map +1 -1
- package/dist/esm/actions/wallet/signMessage.js.map +1 -1
- package/dist/esm/actions/wallet/signTypedData.js.map +1 -1
- package/dist/esm/actions/wallet/switchChain.js.map +1 -1
- package/dist/esm/actions/wallet/watchAsset.js.map +1 -1
- package/dist/esm/actions/wallet/writeContract.js.map +1 -1
- package/dist/esm/clients/createPublicClient.js.map +1 -1
- package/dist/esm/clients/createTestClient.js.map +1 -1
- package/dist/esm/clients/createWalletClient.js.map +1 -1
- package/dist/esm/clients/decorators/test.js.map +1 -1
- package/dist/esm/clients/decorators/wallet.js.map +1 -1
- package/dist/esm/errors/version.js +1 -1
- package/dist/types/actions/ens/getEnsAddress.d.ts +0 -1
- package/dist/types/actions/ens/getEnsAddress.d.ts.map +1 -1
- package/dist/types/actions/ens/getEnsAvatar.d.ts +0 -1
- package/dist/types/actions/ens/getEnsAvatar.d.ts.map +1 -1
- package/dist/types/actions/ens/getEnsName.d.ts +0 -1
- package/dist/types/actions/ens/getEnsName.d.ts.map +1 -1
- package/dist/types/actions/ens/getEnsResolver.d.ts +0 -1
- package/dist/types/actions/ens/getEnsResolver.d.ts.map +1 -1
- package/dist/types/actions/ens/getEnsText.d.ts +0 -1
- package/dist/types/actions/ens/getEnsText.d.ts.map +1 -1
- package/dist/types/actions/getContract.d.ts +104 -2
- package/dist/types/actions/getContract.d.ts.map +1 -1
- package/dist/types/actions/public/estimateContractGas.d.ts +0 -1
- package/dist/types/actions/public/estimateContractGas.d.ts.map +1 -1
- package/dist/types/actions/public/getBalance.d.ts +0 -1
- package/dist/types/actions/public/getBalance.d.ts.map +1 -1
- package/dist/types/actions/public/getFilterChanges.d.ts +0 -1
- package/dist/types/actions/public/getFilterChanges.d.ts.map +1 -1
- package/dist/types/actions/public/getFilterLogs.d.ts +0 -1
- package/dist/types/actions/public/getFilterLogs.d.ts.map +1 -1
- package/dist/types/actions/public/readContract.d.ts +2 -3
- package/dist/types/actions/public/readContract.d.ts.map +1 -1
- package/dist/types/actions/public/simulateContract.d.ts +1 -2
- package/dist/types/actions/public/simulateContract.d.ts.map +1 -1
- package/dist/types/actions/public/uninstallFilter.d.ts +0 -1
- package/dist/types/actions/public/uninstallFilter.d.ts.map +1 -1
- package/dist/types/actions/public/waitForTransactionReceipt.d.ts +0 -1
- package/dist/types/actions/public/waitForTransactionReceipt.d.ts.map +1 -1
- package/dist/types/actions/public/watchContractEvent.d.ts +0 -1
- package/dist/types/actions/public/watchContractEvent.d.ts.map +1 -1
- package/dist/types/actions/public/watchEvent.d.ts +0 -1
- package/dist/types/actions/public/watchEvent.d.ts.map +1 -1
- package/dist/types/actions/public/watchPendingTransactions.d.ts +0 -1
- package/dist/types/actions/public/watchPendingTransactions.d.ts.map +1 -1
- package/dist/types/actions/test/dropTransaction.d.ts +22 -0
- package/dist/types/actions/test/dropTransaction.d.ts.map +1 -1
- package/dist/types/actions/test/getAutomine.d.ts +20 -0
- package/dist/types/actions/test/getAutomine.d.ts.map +1 -1
- package/dist/types/actions/test/getTxpoolContent.d.ts +22 -0
- package/dist/types/actions/test/getTxpoolContent.d.ts.map +1 -1
- package/dist/types/actions/test/getTxpoolStatus.d.ts +20 -0
- package/dist/types/actions/test/getTxpoolStatus.d.ts.map +1 -1
- package/dist/types/actions/test/impersonateAccount.d.ts +22 -0
- package/dist/types/actions/test/impersonateAccount.d.ts.map +1 -1
- package/dist/types/actions/test/increaseTime.d.ts +22 -0
- package/dist/types/actions/test/increaseTime.d.ts.map +1 -1
- package/dist/types/actions/test/inspectTxpool.d.ts +20 -0
- package/dist/types/actions/test/inspectTxpool.d.ts.map +1 -1
- package/dist/types/actions/test/mine.d.ts +20 -0
- package/dist/types/actions/test/mine.d.ts.map +1 -1
- package/dist/types/actions/test/removeBlockTimestampInterval.d.ts +19 -0
- package/dist/types/actions/test/removeBlockTimestampInterval.d.ts.map +1 -1
- package/dist/types/actions/test/reset.d.ts +20 -0
- package/dist/types/actions/test/reset.d.ts.map +1 -1
- package/dist/types/actions/test/revert.d.ts +20 -0
- package/dist/types/actions/test/revert.d.ts.map +1 -1
- package/dist/types/actions/test/sendUnsignedTransaction.d.ts +25 -0
- package/dist/types/actions/test/sendUnsignedTransaction.d.ts.map +1 -1
- package/dist/types/actions/test/setAutomine.d.ts +19 -0
- package/dist/types/actions/test/setAutomine.d.ts.map +1 -1
- package/dist/types/actions/test/setBalance.d.ts +23 -0
- package/dist/types/actions/test/setBalance.d.ts.map +1 -1
- package/dist/types/actions/test/setBlockGasLimit.d.ts +20 -0
- package/dist/types/actions/test/setBlockGasLimit.d.ts.map +1 -1
- package/dist/types/actions/test/setBlockTimestampInterval.d.ts +20 -0
- package/dist/types/actions/test/setBlockTimestampInterval.d.ts.map +1 -1
- package/dist/types/actions/test/setCode.d.ts +23 -0
- package/dist/types/actions/test/setCode.d.ts.map +1 -1
- package/dist/types/actions/test/setCoinbase.d.ts +22 -0
- package/dist/types/actions/test/setCoinbase.d.ts.map +1 -1
- package/dist/types/actions/test/setIntervalMining.d.ts +20 -0
- package/dist/types/actions/test/setIntervalMining.d.ts.map +1 -1
- package/dist/types/actions/test/setLoggingEnabled.d.ts +19 -0
- package/dist/types/actions/test/setLoggingEnabled.d.ts.map +1 -1
- package/dist/types/actions/test/setMinGasPrice.d.ts +24 -0
- package/dist/types/actions/test/setMinGasPrice.d.ts.map +1 -1
- package/dist/types/actions/test/setNextBlockBaseFeePerGas.d.ts +22 -0
- package/dist/types/actions/test/setNextBlockBaseFeePerGas.d.ts.map +1 -1
- package/dist/types/actions/test/setNextBlockTimestamp.d.ts +20 -0
- package/dist/types/actions/test/setNextBlockTimestamp.d.ts.map +1 -1
- package/dist/types/actions/test/setNonce.d.ts +23 -0
- package/dist/types/actions/test/setNonce.d.ts.map +1 -1
- package/dist/types/actions/test/setRpcUrl.d.ts +20 -0
- package/dist/types/actions/test/setRpcUrl.d.ts.map +1 -1
- package/dist/types/actions/test/setStorageAt.d.ts +24 -0
- package/dist/types/actions/test/setStorageAt.d.ts.map +1 -1
- package/dist/types/actions/test/snapshot.d.ts +19 -0
- package/dist/types/actions/test/snapshot.d.ts.map +1 -1
- package/dist/types/actions/test/stopImpersonatingAccount.d.ts +22 -0
- package/dist/types/actions/test/stopImpersonatingAccount.d.ts.map +1 -1
- package/dist/types/actions/wallet/addChain.d.ts +20 -0
- package/dist/types/actions/wallet/addChain.d.ts.map +1 -1
- package/dist/types/actions/wallet/deployContract.d.ts +1 -1
- package/dist/types/actions/wallet/getAddresses.d.ts +20 -0
- package/dist/types/actions/wallet/getAddresses.d.ts.map +1 -1
- package/dist/types/actions/wallet/getPermissions.d.ts +20 -0
- package/dist/types/actions/wallet/getPermissions.d.ts.map +1 -1
- package/dist/types/actions/wallet/requestAddresses.d.ts +24 -0
- package/dist/types/actions/wallet/requestAddresses.d.ts.map +1 -1
- package/dist/types/actions/wallet/requestPermissions.d.ts +26 -3
- package/dist/types/actions/wallet/requestPermissions.d.ts.map +1 -1
- package/dist/types/actions/wallet/sendTransaction.d.ts +45 -0
- package/dist/types/actions/wallet/sendTransaction.d.ts.map +1 -1
- package/dist/types/actions/wallet/signMessage.d.ts +46 -0
- package/dist/types/actions/wallet/signMessage.d.ts.map +1 -1
- package/dist/types/actions/wallet/signTypedData.d.ts +98 -0
- package/dist/types/actions/wallet/signTypedData.d.ts.map +1 -1
- package/dist/types/actions/wallet/switchChain.d.ts +21 -0
- package/dist/types/actions/wallet/switchChain.d.ts.map +1 -1
- package/dist/types/actions/wallet/watchAsset.d.ts +28 -0
- package/dist/types/actions/wallet/watchAsset.d.ts.map +1 -1
- package/dist/types/actions/wallet/writeContract.d.ts +50 -0
- package/dist/types/actions/wallet/writeContract.d.ts.map +1 -1
- package/dist/types/clients/createPublicClient.d.ts +17 -1
- package/dist/types/clients/createPublicClient.d.ts.map +1 -1
- package/dist/types/clients/createTestClient.d.ts +20 -0
- package/dist/types/clients/createTestClient.d.ts.map +1 -1
- package/dist/types/clients/createWalletClient.d.ts +34 -1
- package/dist/types/clients/createWalletClient.d.ts.map +1 -1
- package/dist/types/clients/decorators/public.d.ts +37 -37
- package/dist/types/clients/decorators/test.d.ts +536 -0
- package/dist/types/clients/decorators/test.d.ts.map +1 -1
- package/dist/types/clients/decorators/wallet.d.ts +389 -2
- package/dist/types/clients/decorators/wallet.d.ts.map +1 -1
- package/dist/types/errors/version.d.ts +1 -1
- package/package.json +1 -1
- package/src/actions/ens/getEnsAddress.ts +0 -1
- package/src/actions/ens/getEnsAvatar.ts +0 -1
- package/src/actions/ens/getEnsName.ts +0 -1
- package/src/actions/ens/getEnsResolver.ts +0 -1
- package/src/actions/ens/getEnsText.ts +0 -1
- package/src/actions/getContract.ts +104 -2
- package/src/actions/public/estimateContractGas.ts +0 -1
- package/src/actions/public/getBalance.ts +0 -1
- package/src/actions/public/getFilterChanges.ts +0 -1
- package/src/actions/public/getFilterLogs.ts +0 -1
- package/src/actions/public/readContract.ts +2 -3
- package/src/actions/public/simulateContract.ts +1 -2
- package/src/actions/public/uninstallFilter.ts +0 -1
- package/src/actions/public/waitForTransactionReceipt.ts +0 -1
- package/src/actions/public/watchContractEvent.ts +0 -1
- package/src/actions/public/watchEvent.ts +0 -1
- package/src/actions/public/watchPendingTransactions.ts +0 -1
- package/src/actions/test/dropTransaction.ts +22 -0
- package/src/actions/test/getAutomine.ts +20 -0
- package/src/actions/test/getTxpoolContent.ts +22 -0
- package/src/actions/test/getTxpoolStatus.ts +20 -0
- package/src/actions/test/impersonateAccount.ts +22 -0
- package/src/actions/test/increaseTime.ts +22 -0
- package/src/actions/test/inspectTxpool.ts +20 -0
- package/src/actions/test/mine.ts +20 -0
- package/src/actions/test/removeBlockTimestampInterval.ts +19 -0
- package/src/actions/test/reset.ts +20 -0
- package/src/actions/test/revert.ts +20 -0
- package/src/actions/test/sendUnsignedTransaction.ts +25 -0
- package/src/actions/test/setAutomine.ts +19 -0
- package/src/actions/test/setBalance.ts +23 -0
- package/src/actions/test/setBlockGasLimit.ts +20 -0
- package/src/actions/test/setBlockTimestampInterval.ts +20 -0
- package/src/actions/test/setCode.ts +23 -0
- package/src/actions/test/setCoinbase.ts +22 -0
- package/src/actions/test/setIntervalMining.ts +20 -0
- package/src/actions/test/setLoggingEnabled.ts +19 -0
- package/src/actions/test/setMinGasPrice.ts +24 -0
- package/src/actions/test/setNextBlockBaseFeePerGas.ts +22 -0
- package/src/actions/test/setNextBlockTimestamp.ts +20 -0
- package/src/actions/test/setNonce.ts +23 -0
- package/src/actions/test/setRpcUrl.ts +20 -0
- package/src/actions/test/setStorageAt.ts +24 -0
- package/src/actions/test/snapshot.ts +19 -0
- package/src/actions/test/stopImpersonatingAccount.ts +22 -0
- package/src/actions/wallet/addChain.ts +20 -0
- package/src/actions/wallet/deployContract.ts +1 -1
- package/src/actions/wallet/getAddresses.ts +20 -0
- package/src/actions/wallet/getPermissions.ts +20 -0
- package/src/actions/wallet/requestAddresses.ts +24 -0
- package/src/actions/wallet/requestPermissions.ts +31 -6
- package/src/actions/wallet/sendTransaction.ts +45 -0
- package/src/actions/wallet/signMessage.ts +46 -0
- package/src/actions/wallet/signTypedData.ts +98 -0
- package/src/actions/wallet/switchChain.ts +24 -1
- package/src/actions/wallet/watchAsset.ts +28 -0
- package/src/actions/wallet/writeContract.ts +50 -0
- package/src/clients/createPublicClient.ts +17 -1
- package/src/clients/createTestClient.ts +20 -0
- package/src/clients/createWalletClient.ts +34 -1
- package/src/clients/decorators/public.ts +37 -37
- package/src/clients/decorators/test.ts +536 -0
- package/src/clients/decorators/wallet.ts +389 -2
- package/src/errors/version.ts +1 -1
@@ -31,7 +31,6 @@ export type EstimateContractGasReturnType = bigint
|
|
31
31
|
*
|
32
32
|
* - Docs: https://viem.sh/docs/contract/estimateContractGas.html
|
33
33
|
*
|
34
|
-
* @remarks
|
35
34
|
* Internally, uses a [Public Client](https://viem.sh/docs/clients/public) to call the [`estimateGas` action](https://viem.sh/docs/actions/public/estimateGas) with [ABI-encoded `data`](https://viem.sh/docs/contract/encodeFunctionData).
|
36
35
|
*
|
37
36
|
* @param client - Client to use
|
@@ -26,7 +26,6 @@ export type GetBalanceReturnType = bigint
|
|
26
26
|
* - Docs: https://viem.sh/docs/actions/public/getBalance.html
|
27
27
|
* - JSON-RPC Methods: [`eth_getBalance`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getbalance)
|
28
28
|
*
|
29
|
-
* @remarks
|
30
29
|
* You can convert the balance to ether units with [`formatEther`](https://viem.sh/docs/utilities/formatEther.html).
|
31
30
|
*
|
32
31
|
* ```ts
|
@@ -36,7 +36,6 @@ export type GetFilterChangesReturnType<
|
|
36
36
|
* - Docs: https://viem.sh/docs/actions/public/getFilterChanges.html
|
37
37
|
* - JSON-RPC Methods: [`eth_getFilterChanges`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getfilterchanges)
|
38
38
|
*
|
39
|
-
* @remarks
|
40
39
|
* A Filter can be created from the following actions:
|
41
40
|
*
|
42
41
|
* - [`createBlockFilter`](https://viem.sh/docs/actions/public/createBlockFilter)
|
@@ -29,7 +29,6 @@ export type GetFilterLogsReturnType<
|
|
29
29
|
* - Docs: https://viem.sh/docs/actions/public/getFilterLogs.html
|
30
30
|
* - JSON-RPC Methods: [`eth_getFilterLogs`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getfilterlogs)
|
31
31
|
*
|
32
|
-
* @remarks
|
33
32
|
* `getFilterLogs` is only compatible with **event filters**.
|
34
33
|
*
|
35
34
|
* @param client - Client to use
|
@@ -36,7 +36,6 @@ export type ReadContractReturnType<
|
|
36
36
|
* - Docs: https://viem.sh/docs/contract/readContract.html
|
37
37
|
* - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/contracts/reading-contracts
|
38
38
|
*
|
39
|
-
* @remarks
|
40
39
|
* A "read-only" function (constant function) on a Solidity contract is denoted by a `view` or `pure` keyword. They can only read the state of the contract, and cannot make any changes to it. Since read-only methods do not change the state of the contract, they do not require any gas to be executed, and can be called by any user without the need to pay for gas.
|
41
40
|
*
|
42
41
|
* Internally, uses a [Public Client](https://viem.sh/docs/clients/public) to call the [`call` action](https://viem.sh/docs/actions/public/call) with [ABI-encoded `data`](https://viem.sh/docs/contract/encodeFunctionData).
|
@@ -46,7 +45,7 @@ export type ReadContractReturnType<
|
|
46
45
|
* @returns The response from the contract. Type is inferred. {@link ReadContractReturnType}
|
47
46
|
*
|
48
47
|
* @example
|
49
|
-
* import { createPublicClient, http } from 'viem'
|
48
|
+
* import { createPublicClient, http, parseAbi } from 'viem'
|
50
49
|
* import { mainnet } from 'viem/chains'
|
51
50
|
* import { readContract } from 'viem/contract'
|
52
51
|
*
|
@@ -54,7 +53,7 @@ export type ReadContractReturnType<
|
|
54
53
|
* chain: mainnet,
|
55
54
|
* transport: http(),
|
56
55
|
* })
|
57
|
-
* const
|
56
|
+
* const result = await readContract(client, {
|
58
57
|
* address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',
|
59
58
|
* abi: parseAbi(['function balanceOf(address) view returns (uint256)']),
|
60
59
|
* functionName: 'balanceOf',
|
@@ -63,7 +63,6 @@ export type SimulateContractReturnType<
|
|
63
63
|
* - Docs: https://viem.sh/docs/contract/simulateContract.html
|
64
64
|
* - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/contracts/writing-to-contracts
|
65
65
|
*
|
66
|
-
* @remarks
|
67
66
|
* This function does not require gas to execute and _**does not**_ change the state of the blockchain. It is almost identical to [`readContract`](https://viem.sh/docs/contract/readContract), but also supports contract write functions.
|
68
67
|
*
|
69
68
|
* Internally, uses a [Public Client](https://viem.sh/docs/clients/public) to call the [`call` action](https://viem.sh/docs/actions/public/call) with [ABI-encoded `data`](https://viem.sh/docs/contract/encodeFunctionData).
|
@@ -81,7 +80,7 @@ export type SimulateContractReturnType<
|
|
81
80
|
* chain: mainnet,
|
82
81
|
* transport: http(),
|
83
82
|
* })
|
84
|
-
* const
|
83
|
+
* const result = await simulateContract(client, {
|
85
84
|
* address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',
|
86
85
|
* abi: parseAbi(['function mint(uint32) view returns (uint32)']),
|
87
86
|
* functionName: 'mint',
|
@@ -12,7 +12,6 @@ export type UninstallFilterReturnType = boolean
|
|
12
12
|
* - Docs: https://viem.sh/docs/actions/public/uninstallFilter.html
|
13
13
|
* - JSON-RPC Methods: [`eth_uninstallFilter`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_uninstallFilter)
|
14
14
|
*
|
15
|
-
* @remarks
|
16
15
|
* Destroys a Filter that was created from one of the following Actions:
|
17
16
|
* - [`createBlockFilter`](https://viem.sh/docs/actions/public/createBlockFilter)
|
18
17
|
* - [`createEventFilter`](https://viem.sh/docs/actions/public/createEventFilter)
|
@@ -60,7 +60,6 @@ export type WaitForTransactionReceiptParameters<
|
|
60
60
|
* - Checks if one of the Transactions is a replacement
|
61
61
|
* - If so, calls [`eth_getTransactionReceipt`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getTransactionReceipt).
|
62
62
|
*
|
63
|
-
* @remarks
|
64
63
|
* The `waitForTransactionReceipt` action additionally supports Replacement detection (e.g. sped up Transactions).
|
65
64
|
*
|
66
65
|
* Transactions can be replaced when a user modifies their transaction in their wallet (to speed up or cancel). Transactions are replaced when they are sent from the same nonce.
|
@@ -59,7 +59,6 @@ export type WatchContractEventReturnType = () => void
|
|
59
59
|
*
|
60
60
|
* - Docs: https://viem.sh/docs/contract/watchContractEvent.html
|
61
61
|
*
|
62
|
-
* @remarks
|
63
62
|
* This Action will batch up all the event logs found within the [`pollingInterval`](https://viem.sh/docs/contract/watchContractEvent.html#pollinginterval-optional), and invoke them via [`onLogs`](https://viem.sh/docs/contract/watchContractEvent.html#onLogs).
|
64
63
|
*
|
65
64
|
* `watchContractEvent` will attempt to create an [Event Filter](https://viem.sh/docs/contract/createContractEventFilter) and listen to changes to the Filter per polling interval, however, if the RPC Provider does not support Filters (e.g. `eth_newFilter`), then `watchContractEvent` will fall back to using [`getLogs`](https://viem.sh/docs/actions/public/getLogs) instead.
|
@@ -67,7 +67,6 @@ export type WatchEventReturnType = () => void
|
|
67
67
|
* - **RPC Provider does not support `eth_newFilter`:**
|
68
68
|
* - Calls [`eth_getLogs`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getlogs) for each block between the polling interval.
|
69
69
|
*
|
70
|
-
* @remarks
|
71
70
|
* This Action will batch up all the Event Logs found within the [`pollingInterval`](https://viem.sh/docs/actions/public/watchEvent.html#pollinginterval-optional), and invoke them via [`onLogs`](https://viem.sh/docs/actions/public/watchEvent.html#onLogs).
|
72
71
|
*
|
73
72
|
* `watchEvent` will attempt to create an [Event Filter](https://viem.sh/docs/actions/public/createEventFilter.html) and listen to changes to the Filter per polling interval, however, if the RPC Provider does not support Filters (e.g. `eth_newFilter`), then `watchEvent` will fall back to using [`getLogs`](https://viem.sh/docs/actions/public/getLogs) instead.
|
@@ -68,7 +68,6 @@ export type WatchPendingTransactionsReturnType = () => void
|
|
68
68
|
* - Calls [`eth_getFilterChanges`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getFilterChanges) on a polling interval.
|
69
69
|
* - When `poll: false` & WebSocket Transport, uses a WebSocket subscription via [`eth_subscribe`](https://docs.alchemy.com/reference/eth-subscribe-polygon) and the `"newPendingTransactions"` event.
|
70
70
|
*
|
71
|
-
* @remarks
|
72
71
|
* This Action will batch up all the pending transactions found within the [`pollingInterval`](https://viem.sh/docs/actions/public/watchPendingTransactions.html#pollinginterval-optional), and invoke them via [`onTransactions`](https://viem.sh/docs/actions/public/watchPendingTransactions.html#ontransactions).
|
73
72
|
*
|
74
73
|
* @param client - Client to use
|
@@ -10,6 +10,28 @@ export type DropTransactionParameters = {
|
|
10
10
|
hash: Hash
|
11
11
|
}
|
12
12
|
|
13
|
+
/**
|
14
|
+
* Removes a transaction from the mempool.
|
15
|
+
*
|
16
|
+
* - Docs: https://viem.sh/docs/actions/test/dropTransaction.html
|
17
|
+
*
|
18
|
+
* @param client - Client to use
|
19
|
+
* @param parameters - {@link DropTransactionParameters}
|
20
|
+
*
|
21
|
+
* @example
|
22
|
+
* import { createTestClient, http } from 'viem'
|
23
|
+
* import { foundry } from 'viem/chains'
|
24
|
+
* import { dropTransaction } from 'viem/test'
|
25
|
+
*
|
26
|
+
* const client = createTestClient({
|
27
|
+
* mode: 'anvil',
|
28
|
+
* chain: 'foundry',
|
29
|
+
* transport: http(),
|
30
|
+
* })
|
31
|
+
* await dropTransaction(client, {
|
32
|
+
* hash: '0xe58dceb6b20b03965bb678e27d141e151d7d4efc2334c2d6a49b9fac523f7364'
|
33
|
+
* })
|
34
|
+
*/
|
13
35
|
export async function dropTransaction<TChain extends Chain | undefined>(
|
14
36
|
client: TestClient<TestClientMode, Transport, TChain>,
|
15
37
|
{ hash }: DropTransactionParameters,
|
@@ -7,6 +7,26 @@ import type { Chain } from '../../types/index.js'
|
|
7
7
|
|
8
8
|
export type GetAutomineReturnType = boolean
|
9
9
|
|
10
|
+
/**
|
11
|
+
* Returns the automatic mining status of the node.
|
12
|
+
*
|
13
|
+
* - Docs: https://viem.sh/docs/actions/test/getAutomine.html
|
14
|
+
*
|
15
|
+
* @param client - Client to use
|
16
|
+
* @returns Whether or not the node is auto mining. {@link GetAutomineReturnType}
|
17
|
+
*
|
18
|
+
* @example
|
19
|
+
* import { createTestClient, http } from 'viem'
|
20
|
+
* import { foundry } from 'viem/chains'
|
21
|
+
* import { getAutomine } from 'viem/test'
|
22
|
+
*
|
23
|
+
* const client = createTestClient({
|
24
|
+
* mode: 'anvil',
|
25
|
+
* chain: 'foundry',
|
26
|
+
* transport: http(),
|
27
|
+
* })
|
28
|
+
* const isAutomining = await getAutomine(client)
|
29
|
+
*/
|
10
30
|
export async function getAutomine<TChain extends Chain | undefined>(
|
11
31
|
client: TestClient<TestClientMode, Transport, TChain>,
|
12
32
|
): Promise<GetAutomineReturnType> {
|
@@ -7,10 +7,32 @@ import type {
|
|
7
7
|
import type { Chain, RpcTransaction } from '../../types/index.js'
|
8
8
|
|
9
9
|
export type GetTxpoolContentReturnType = {
|
10
|
+
/** Pending transactions in the pool */
|
10
11
|
pending: Record<Address, Record<string, RpcTransaction>>
|
12
|
+
/** Queued transactions in the pool */
|
11
13
|
queued: Record<Address, Record<string, RpcTransaction>>
|
12
14
|
}
|
13
15
|
|
16
|
+
/**
|
17
|
+
* Returns the details of all transactions currently pending for inclusion in the next block(s), as well as the ones that are being scheduled for future execution only.
|
18
|
+
*
|
19
|
+
* - Docs: https://viem.sh/docs/actions/test/getTxpoolContent.html
|
20
|
+
*
|
21
|
+
* @param client - Client to use
|
22
|
+
* @returns Transaction pool content. {@link GetTxpoolContentReturnType}
|
23
|
+
*
|
24
|
+
* @example
|
25
|
+
* import { createTestClient, http } from 'viem'
|
26
|
+
* import { foundry } from 'viem/chains'
|
27
|
+
* import { getTxpoolContent } from 'viem/test'
|
28
|
+
*
|
29
|
+
* const client = createTestClient({
|
30
|
+
* mode: 'anvil',
|
31
|
+
* chain: 'foundry',
|
32
|
+
* transport: http(),
|
33
|
+
* })
|
34
|
+
* const content = await getTxpoolContent(client)
|
35
|
+
*/
|
14
36
|
export async function getTxpoolContent<TChain extends Chain | undefined>(
|
15
37
|
client: TestClient<TestClientMode, Transport, TChain>,
|
16
38
|
): Promise<GetTxpoolContentReturnType> {
|
@@ -11,6 +11,26 @@ export type GetTxpoolStatusReturnType = {
|
|
11
11
|
queued: number
|
12
12
|
}
|
13
13
|
|
14
|
+
/**
|
15
|
+
* Returns a summary of all the transactions currently pending for inclusion in the next block(s), as well as the ones that are being scheduled for future execution only.
|
16
|
+
*
|
17
|
+
* - Docs: https://viem.sh/docs/actions/test/getTxpoolStatus.html
|
18
|
+
*
|
19
|
+
* @param client - Client to use
|
20
|
+
* @returns Transaction pool status. {@link GetTxpoolStatusReturnType}
|
21
|
+
*
|
22
|
+
* @example
|
23
|
+
* import { createTestClient, http } from 'viem'
|
24
|
+
* import { foundry } from 'viem/chains'
|
25
|
+
* import { getTxpoolStatus } from 'viem/test'
|
26
|
+
*
|
27
|
+
* const client = createTestClient({
|
28
|
+
* mode: 'anvil',
|
29
|
+
* chain: 'foundry',
|
30
|
+
* transport: http(),
|
31
|
+
* })
|
32
|
+
* const status = await getTxpoolStatus(client)
|
33
|
+
*/
|
14
34
|
export async function getTxpoolStatus<TChain extends Chain | undefined>(
|
15
35
|
client: TestClient<TestClientMode, Transport, TChain>,
|
16
36
|
): Promise<GetTxpoolStatusReturnType> {
|
@@ -10,6 +10,28 @@ export type ImpersonateAccountParameters = {
|
|
10
10
|
address: Address
|
11
11
|
}
|
12
12
|
|
13
|
+
/**
|
14
|
+
* Impersonate an account or contract address. This lets you send transactions from that account even if you don't have access to its private key.
|
15
|
+
*
|
16
|
+
* - Docs: https://viem.sh/docs/actions/test/impersonateAccount.html
|
17
|
+
*
|
18
|
+
* @param client - Client to use
|
19
|
+
* @param parameters - {@link ImpersonateAccountParameters}
|
20
|
+
*
|
21
|
+
* @example
|
22
|
+
* import { createTestClient, http } from 'viem'
|
23
|
+
* import { foundry } from 'viem/chains'
|
24
|
+
* import { impersonateAccount } from 'viem/test'
|
25
|
+
*
|
26
|
+
* const client = createTestClient({
|
27
|
+
* mode: 'anvil',
|
28
|
+
* chain: 'foundry',
|
29
|
+
* transport: http(),
|
30
|
+
* })
|
31
|
+
* const content = await impersonateAccount(client, {
|
32
|
+
* address: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
|
33
|
+
* })
|
34
|
+
*/
|
13
35
|
export async function impersonateAccount<TChain extends Chain | undefined>(
|
14
36
|
client: TestClient<TestClientMode, Transport, TChain>,
|
15
37
|
{ address }: ImpersonateAccountParameters,
|
@@ -11,6 +11,28 @@ export type IncreaseTimeParameters = {
|
|
11
11
|
seconds: number
|
12
12
|
}
|
13
13
|
|
14
|
+
/**
|
15
|
+
* Jump forward in time by the given amount of time, in seconds.
|
16
|
+
*
|
17
|
+
* - Docs: https://viem.sh/docs/actions/test/increaseTime.html
|
18
|
+
*
|
19
|
+
* @param client - Client to use
|
20
|
+
* @param parameters – {@link IncreaseTimeParameters}
|
21
|
+
*
|
22
|
+
* @example
|
23
|
+
* import { createTestClient, http } from 'viem'
|
24
|
+
* import { foundry } from 'viem/chains'
|
25
|
+
* import { increaseTime } from 'viem/test'
|
26
|
+
*
|
27
|
+
* const client = createTestClient({
|
28
|
+
* mode: 'anvil',
|
29
|
+
* chain: 'foundry',
|
30
|
+
* transport: http(),
|
31
|
+
* })
|
32
|
+
* await increaseTime(client, {
|
33
|
+
* seconds: 420,
|
34
|
+
* })
|
35
|
+
*/
|
14
36
|
export async function increaseTime<TChain extends Chain | undefined>(
|
15
37
|
client: TestClient<TestClientMode, Transport, TChain>,
|
16
38
|
{ seconds }: IncreaseTimeParameters,
|
@@ -10,6 +10,26 @@ export type InspectTxpoolReturnType = {
|
|
10
10
|
queued: Record<Address, Record<string, string>>
|
11
11
|
}
|
12
12
|
|
13
|
+
/**
|
14
|
+
* Returns a summary of all the transactions currently pending for inclusion in the next block(s), as well as the ones that are being scheduled for future execution only.
|
15
|
+
*
|
16
|
+
* - Docs: https://viem.sh/docs/actions/test/inspectTxpool.html
|
17
|
+
*
|
18
|
+
* @param client - Client to use
|
19
|
+
* @returns Transaction pool inspection data. {@link InspectTxpoolReturnType}
|
20
|
+
*
|
21
|
+
* @example
|
22
|
+
* import { createTestClient, http } from 'viem'
|
23
|
+
* import { foundry } from 'viem/chains'
|
24
|
+
* import { inspectTxpool } from 'viem/test'
|
25
|
+
*
|
26
|
+
* const client = createTestClient({
|
27
|
+
* mode: 'anvil',
|
28
|
+
* chain: 'foundry',
|
29
|
+
* transport: http(),
|
30
|
+
* })
|
31
|
+
* const data = await inspectTxpool(client)
|
32
|
+
*/
|
13
33
|
export async function inspectTxpool<TChain extends Chain | undefined>(
|
14
34
|
client: TestClient<TestClientMode, Transport, TChain>,
|
15
35
|
): Promise<InspectTxpoolReturnType> {
|
package/src/actions/test/mine.ts
CHANGED
@@ -13,6 +13,26 @@ export type MineParameters = {
|
|
13
13
|
interval?: number
|
14
14
|
}
|
15
15
|
|
16
|
+
/**
|
17
|
+
* Mine a specified number of blocks.
|
18
|
+
*
|
19
|
+
* - Docs: https://viem.sh/docs/actions/test/mine.html
|
20
|
+
*
|
21
|
+
* @param client - Client to use
|
22
|
+
* @param parameters – {@link MineParameters}
|
23
|
+
*
|
24
|
+
* @example
|
25
|
+
* import { createTestClient, http } from 'viem'
|
26
|
+
* import { foundry } from 'viem/chains'
|
27
|
+
* import { mine } from 'viem/test'
|
28
|
+
*
|
29
|
+
* const client = createTestClient({
|
30
|
+
* mode: 'anvil',
|
31
|
+
* chain: 'foundry',
|
32
|
+
* transport: http(),
|
33
|
+
* })
|
34
|
+
* await mine(client, { blocks: 1 })
|
35
|
+
*/
|
16
36
|
export async function mine<TChain extends Chain | undefined>(
|
17
37
|
client: TestClient<TestClientMode, Transport, TChain>,
|
18
38
|
{ blocks, interval }: MineParameters,
|
@@ -5,6 +5,25 @@ import type {
|
|
5
5
|
Transport,
|
6
6
|
} from '../../clients/index.js'
|
7
7
|
|
8
|
+
/**
|
9
|
+
* Removes [`setBlockTimestampInterval`](https://viem.sh/docs/actions/test/setBlockTimestampInterval.html) if it exists.
|
10
|
+
*
|
11
|
+
* - Docs: https://viem.sh/docs/actions/test/removeBlockTimestampInterval.html
|
12
|
+
*
|
13
|
+
* @param client - Client to use
|
14
|
+
*
|
15
|
+
* @example
|
16
|
+
* import { createTestClient, http } from 'viem'
|
17
|
+
* import { foundry } from 'viem/chains'
|
18
|
+
* import { removeBlockTimestampInterval } from 'viem/test'
|
19
|
+
*
|
20
|
+
* const client = createTestClient({
|
21
|
+
* mode: 'anvil',
|
22
|
+
* chain: 'foundry',
|
23
|
+
* transport: http(),
|
24
|
+
* })
|
25
|
+
* await removeBlockTimestampInterval(client)
|
26
|
+
*/
|
8
27
|
export async function removeBlockTimestampInterval<
|
9
28
|
TChain extends Chain | undefined,
|
10
29
|
>(client: TestClient<TestClientMode, Transport, TChain>) {
|
@@ -12,6 +12,26 @@ export type ResetParameters = {
|
|
12
12
|
jsonRpcUrl?: string
|
13
13
|
}
|
14
14
|
|
15
|
+
/**
|
16
|
+
* Resets fork back to its original state.
|
17
|
+
*
|
18
|
+
* - Docs: https://viem.sh/docs/actions/test/reset.html
|
19
|
+
*
|
20
|
+
* @param client - Client to use
|
21
|
+
* @param parameters – {@link ResetParameters}
|
22
|
+
*
|
23
|
+
* @example
|
24
|
+
* import { createTestClient, http } from 'viem'
|
25
|
+
* import { foundry } from 'viem/chains'
|
26
|
+
* import { reset } from 'viem/test'
|
27
|
+
*
|
28
|
+
* const client = createTestClient({
|
29
|
+
* mode: 'anvil',
|
30
|
+
* chain: 'foundry',
|
31
|
+
* transport: http(),
|
32
|
+
* })
|
33
|
+
* await reset(client, { blockNumber: 69420n })
|
34
|
+
*/
|
15
35
|
export async function reset<TChain extends Chain | undefined>(
|
16
36
|
client: TestClient<TestClientMode, Transport, TChain>,
|
17
37
|
{ blockNumber, jsonRpcUrl }: ResetParameters = {},
|
@@ -10,6 +10,26 @@ export type RevertParameters = {
|
|
10
10
|
id: Quantity
|
11
11
|
}
|
12
12
|
|
13
|
+
/**
|
14
|
+
* Revert the state of the blockchain at the current block.
|
15
|
+
*
|
16
|
+
* - Docs: https://viem.sh/docs/actions/test/revert.html
|
17
|
+
*
|
18
|
+
* @param client - Client to use
|
19
|
+
* @param parameters – {@link RevertParameters}
|
20
|
+
*
|
21
|
+
* @example
|
22
|
+
* import { createTestClient, http } from 'viem'
|
23
|
+
* import { foundry } from 'viem/chains'
|
24
|
+
* import { revert } from 'viem/test'
|
25
|
+
*
|
26
|
+
* const client = createTestClient({
|
27
|
+
* mode: 'anvil',
|
28
|
+
* chain: 'foundry',
|
29
|
+
* transport: http(),
|
30
|
+
* })
|
31
|
+
* await revert(client, { id: '0x…' })
|
32
|
+
*/
|
13
33
|
export async function revert<TChain extends Chain | undefined>(
|
14
34
|
client: TestClient<TestClientMode, Transport, TChain>,
|
15
35
|
{ id }: RevertParameters,
|
@@ -10,6 +10,31 @@ export type SendUnsignedTransactionParameters = TransactionRequest
|
|
10
10
|
|
11
11
|
export type SendUnsignedTransactionReturnType = Hash
|
12
12
|
|
13
|
+
/**
|
14
|
+
* Returns the details of all transactions currently pending for inclusion in the next block(s), as well as the ones that are being scheduled for future execution only.
|
15
|
+
*
|
16
|
+
* - Docs: https://viem.sh/docs/actions/test/getTxpoolContent.html
|
17
|
+
*
|
18
|
+
* @param client - Client to use
|
19
|
+
* @param parameters – {@link SendUnsignedTransactionParameters}
|
20
|
+
* @returns The transaction hash. {@link SendUnsignedTransactionReturnType}
|
21
|
+
*
|
22
|
+
* @example
|
23
|
+
* import { createTestClient, http } from 'viem'
|
24
|
+
* import { foundry } from 'viem/chains'
|
25
|
+
* import { sendUnsignedTransaction } from 'viem/test'
|
26
|
+
*
|
27
|
+
* const client = createTestClient({
|
28
|
+
* mode: 'anvil',
|
29
|
+
* chain: 'foundry',
|
30
|
+
* transport: http(),
|
31
|
+
* })
|
32
|
+
* const hash = await sendUnsignedTransaction(client, {
|
33
|
+
* from: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266',
|
34
|
+
* to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8',
|
35
|
+
* value: 1000000000000000000n,
|
36
|
+
* })
|
37
|
+
*/
|
13
38
|
export async function sendUnsignedTransaction<
|
14
39
|
TChain extends Chain | undefined,
|
15
40
|
>(
|
@@ -5,6 +5,25 @@ import type {
|
|
5
5
|
} from '../../clients/index.js'
|
6
6
|
import type { Chain } from '../../types/index.js'
|
7
7
|
|
8
|
+
/**
|
9
|
+
* Enables or disables the automatic mining of new blocks with each new transaction submitted to the network.
|
10
|
+
*
|
11
|
+
* - Docs: https://viem.sh/docs/actions/test/setAutomine.html
|
12
|
+
*
|
13
|
+
* @param client - Client to use
|
14
|
+
*
|
15
|
+
* @example
|
16
|
+
* import { createTestClient, http } from 'viem'
|
17
|
+
* import { foundry } from 'viem/chains'
|
18
|
+
* import { setAutomine } from 'viem/test'
|
19
|
+
*
|
20
|
+
* const client = createTestClient({
|
21
|
+
* mode: 'anvil',
|
22
|
+
* chain: 'foundry',
|
23
|
+
* transport: http(),
|
24
|
+
* })
|
25
|
+
* await setAutomine(client)
|
26
|
+
*/
|
8
27
|
export async function setAutomine<TChain extends Chain | undefined>(
|
9
28
|
client: TestClient<TestClientMode, Transport, TChain>,
|
10
29
|
enabled: boolean,
|
@@ -13,6 +13,29 @@ export type SetBalanceParameters = {
|
|
13
13
|
value: bigint
|
14
14
|
}
|
15
15
|
|
16
|
+
/**
|
17
|
+
* Modifies the balance of an account.
|
18
|
+
*
|
19
|
+
* - Docs: https://viem.sh/docs/actions/test/setBalance.html
|
20
|
+
*
|
21
|
+
* @param client - Client to use
|
22
|
+
* @param parameters – {@link SetBalanceParameters}
|
23
|
+
*
|
24
|
+
* @example
|
25
|
+
* import { createTestClient, http, parseEther } from 'viem'
|
26
|
+
* import { foundry } from 'viem/chains'
|
27
|
+
* import { setBalance } from 'viem/test'
|
28
|
+
*
|
29
|
+
* const client = createTestClient({
|
30
|
+
* mode: 'anvil',
|
31
|
+
* chain: 'foundry',
|
32
|
+
* transport: http(),
|
33
|
+
* })
|
34
|
+
* await setBalance(client, {
|
35
|
+
* address: '0xa5cc3c03994DB5b0d9A5eEdD10CabaB0813678AC',
|
36
|
+
* value: parseEther('1'),
|
37
|
+
* })
|
38
|
+
*/
|
16
39
|
export async function setBalance<TChain extends Chain | undefined>(
|
17
40
|
client: TestClient<TestClientMode, Transport, TChain>,
|
18
41
|
{ address, value }: SetBalanceParameters,
|
@@ -11,6 +11,26 @@ export type SetBlockGasLimitParameters = {
|
|
11
11
|
gasLimit: bigint
|
12
12
|
}
|
13
13
|
|
14
|
+
/**
|
15
|
+
* Sets the block's gas limit.
|
16
|
+
*
|
17
|
+
* - Docs: https://viem.sh/docs/actions/test/setBlockGasLimit.html
|
18
|
+
*
|
19
|
+
* @param client - Client to use
|
20
|
+
* @param parameters – {@link SetBlockGasLimitParameters}
|
21
|
+
*
|
22
|
+
* @example
|
23
|
+
* import { createTestClient, http } from 'viem'
|
24
|
+
* import { foundry } from 'viem/chains'
|
25
|
+
* import { setBlockGasLimit } from 'viem/test'
|
26
|
+
*
|
27
|
+
* const client = createTestClient({
|
28
|
+
* mode: 'anvil',
|
29
|
+
* chain: 'foundry',
|
30
|
+
* transport: http(),
|
31
|
+
* })
|
32
|
+
* await setBlockGasLimit(client, { gasLimit: 420_000n })
|
33
|
+
*/
|
14
34
|
export async function setBlockGasLimit<TChain extends Chain | undefined>(
|
15
35
|
client: TestClient<TestClientMode, Transport, TChain>,
|
16
36
|
{ gasLimit }: SetBlockGasLimitParameters,
|
@@ -10,6 +10,26 @@ export type SetBlockTimestampIntervalParameters = {
|
|
10
10
|
interval: number
|
11
11
|
}
|
12
12
|
|
13
|
+
/**
|
14
|
+
* Similar to [`increaseTime`](https://viem.sh/docs/actions/test/increaseTime), but sets a block timestamp `interval`. The timestamp of future blocks will be computed as `lastBlock_timestamp` + `interval`.
|
15
|
+
*
|
16
|
+
* - Docs: https://viem.sh/docs/actions/test/setBlockTimestampInterval.html
|
17
|
+
*
|
18
|
+
* @param client - Client to use
|
19
|
+
* @param parameters – {@link SetBlockTimestampIntervalParameters}
|
20
|
+
*
|
21
|
+
* @example
|
22
|
+
* import { createTestClient, http } from 'viem'
|
23
|
+
* import { foundry } from 'viem/chains'
|
24
|
+
* import { setBlockTimestampInterval } from 'viem/test'
|
25
|
+
*
|
26
|
+
* const client = createTestClient({
|
27
|
+
* mode: 'anvil',
|
28
|
+
* chain: 'foundry',
|
29
|
+
* transport: http(),
|
30
|
+
* })
|
31
|
+
* await setBlockTimestampInterval(client, { interval: 5 })
|
32
|
+
*/
|
13
33
|
export async function setBlockTimestampInterval<
|
14
34
|
TChain extends Chain | undefined,
|
15
35
|
>(
|
@@ -12,6 +12,29 @@ export type SetCodeParameters = {
|
|
12
12
|
bytecode: Hex
|
13
13
|
}
|
14
14
|
|
15
|
+
/**
|
16
|
+
* Modifies the bytecode stored at an account's address.
|
17
|
+
*
|
18
|
+
* - Docs: https://viem.sh/docs/actions/test/setCode.html
|
19
|
+
*
|
20
|
+
* @param client - Client to use
|
21
|
+
* @param parameters – {@link SetCodeParameters}
|
22
|
+
*
|
23
|
+
* @example
|
24
|
+
* import { createTestClient, http } from 'viem'
|
25
|
+
* import { foundry } from 'viem/chains'
|
26
|
+
* import { setCode } from 'viem/test'
|
27
|
+
*
|
28
|
+
* const client = createTestClient({
|
29
|
+
* mode: 'anvil',
|
30
|
+
* chain: 'foundry',
|
31
|
+
* transport: http(),
|
32
|
+
* })
|
33
|
+
* await setCode(client, {
|
34
|
+
* address: '0xe846c6fcf817734ca4527b28ccb4aea2b6663c79',
|
35
|
+
* bytecode: '0x60806040526000600355600019600955600c80546001600160a01b031916737a250d5630b4cf539739df…',
|
36
|
+
* })
|
37
|
+
*/
|
15
38
|
export async function setCode<TChain extends Chain | undefined>(
|
16
39
|
client: TestClient<TestClientMode, Transport, TChain>,
|
17
40
|
{ address, bytecode }: SetCodeParameters,
|
@@ -10,6 +10,28 @@ export type SetCoinbaseParameters = {
|
|
10
10
|
address: Address
|
11
11
|
}
|
12
12
|
|
13
|
+
/**
|
14
|
+
* Sets the coinbase address to be used in new blocks.
|
15
|
+
*
|
16
|
+
* - Docs: https://viem.sh/docs/actions/test/setCoinbase.html
|
17
|
+
*
|
18
|
+
* @param client - Client to use
|
19
|
+
* @param parameters – {@link SetCoinbaseParameters}
|
20
|
+
*
|
21
|
+
* @example
|
22
|
+
* import { createTestClient, http } from 'viem'
|
23
|
+
* import { foundry } from 'viem/chains'
|
24
|
+
* import { setCoinbase } from 'viem/test'
|
25
|
+
*
|
26
|
+
* const client = createTestClient({
|
27
|
+
* mode: 'anvil',
|
28
|
+
* chain: 'foundry',
|
29
|
+
* transport: http(),
|
30
|
+
* })
|
31
|
+
* await setCoinbase(client, {
|
32
|
+
* address: '0xe846c6fcf817734ca4527b28ccb4aea2b6663c79',
|
33
|
+
* })
|
34
|
+
*/
|
13
35
|
export async function setCoinbase<TChain extends Chain | undefined>(
|
14
36
|
client: TestClient<TestClientMode, Transport, TChain>,
|
15
37
|
{ address }: SetCoinbaseParameters,
|