Sometimes when you are interacting with a contract method, you want to be able to specify that a user can optionally send ETH. To do this with DappHero we have the option to either hardcode the ETH amount (for example if a contract requires exactly 1 ETH to do some task) or allow users to optionally input the amount themselves.
This example is in the process of being deprecated. Please try to use
In the case that you wish to hard-code the amount of ETH that should be sent upon interacting with a contract method, you should define the amount in the method instance object with a data-dh-property-eth-value tag.
The value for this tag is the amount of ETH to send
Here is an example of how it could be used in a Method Instance:
In this example, when this method is invoked, 1.5 ETH will be added to the transaction and if the user approves the transaction, this ETH will be sent to the smart contract.
In the case that you want to allow your users to specify the amount of ETH they would like to send to a smart contract method, you can attach a data-dh-property-input-name="EthValue" tag directly to an input element.
Input fields can also be used for sending Hard coded amounts of ETH. Rather than the deprecated method above use the following tags. To hide the input from the user, use style="display: none;" as an additional tag.
An example of this for an input element would look like this:
In this example, when the method is invoked, the amount of ETH to be sent along with the transaction will be defined by the amount in the input data-dh-property-input-name="EthValue" is attached.