From 5d32bfe24068480f016fa9eb58ff64d489ee39e0 Mon Sep 17 00:00:00 2001 From: Velenir Date: Tue, 2 Jun 2020 12:30:35 +0300 Subject: [PATCH 1/2] Document defaultBlock in methods.myMethod.call --- docs/web3-eth-contract.rst | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/web3-eth-contract.rst b/docs/web3-eth-contract.rst index 4006d4b7bb0..ee87b03efac 100644 --- a/docs/web3-eth-contract.rst +++ b/docs/web3-eth-contract.rst @@ -737,7 +737,7 @@ methods.myMethod.call .. code-block:: javascript - myContract.methods.myMethod([param1[, param2[, ...]]]).call(options[, callback]) + myContract.methods.myMethod([param1[, param2[, ...]]]).call(options [, defaultBlock] [, callback]) Will call a "constant" method and execute its smart contract method in the EVM without sending any transaction. Note calling cannot alter the smart contract state. @@ -749,7 +749,8 @@ Parameters * ``from`` - ``String`` (optional): The address the call "transaction" should be made from. For calls the ``from`` property is optional however it is highly recommended to explicitly set it or it may default to `address(0)` depending on your node or provider. * ``gasPrice`` - ``String`` (optional): The gas price in wei to use for this call "transaction". * ``gas`` - ``Number`` (optional): The maximum gas provided for this call "transaction" (gas limit). -2. ``callback`` - ``Function`` (optional): This callback will be fired with the result of the smart contract method execution as the second argument, or with an error object as the first argument. +2. ``Number|String|BN|BigNumber`` - (optional) If you pass this parameter it will not use the default block set with :ref:`contract.defaultBlock `. Pre-defined block numbers as ``"latest"``, ``"earliest"``, ``"pending"``, and ``"genesis"`` can also be used. +3. ``callback`` - ``Function`` (optional): This callback will be fired with the result of the smart contract method execution as the second argument, or with an error object as the first argument. ------- Returns From 2943f6bf7c8330bc3e86df50c3756ec371abd1bd Mon Sep 17 00:00:00 2001 From: cgewecke Date: Tue, 2 Jun 2020 07:08:57 -0700 Subject: [PATCH 2/2] Add use case explanation --- docs/web3-eth-contract.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/web3-eth-contract.rst b/docs/web3-eth-contract.rst index ee87b03efac..2456271092c 100644 --- a/docs/web3-eth-contract.rst +++ b/docs/web3-eth-contract.rst @@ -749,7 +749,7 @@ Parameters * ``from`` - ``String`` (optional): The address the call "transaction" should be made from. For calls the ``from`` property is optional however it is highly recommended to explicitly set it or it may default to `address(0)` depending on your node or provider. * ``gasPrice`` - ``String`` (optional): The gas price in wei to use for this call "transaction". * ``gas`` - ``Number`` (optional): The maximum gas provided for this call "transaction" (gas limit). -2. ``Number|String|BN|BigNumber`` - (optional) If you pass this parameter it will not use the default block set with :ref:`contract.defaultBlock `. Pre-defined block numbers as ``"latest"``, ``"earliest"``, ``"pending"``, and ``"genesis"`` can also be used. +``Number|String|BN|BigNumber`` - (optional) If you pass this parameter it will not use the default block set with :ref:`contract.defaultBlock `. Pre-defined block numbers as ``"latest"``, ``"earliest"``, ``"pending"``, and ``"genesis"`` can also be used. Useful for requesting data from or replaying transactions in past blocks. 3. ``callback`` - ``Function`` (optional): This callback will be fired with the result of the smart contract method execution as the second argument, or with an error object as the first argument. -------