You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
to | String | required - The address of the recipient account
from | String | optional - Address of the tx sender. Defaults to current active account of the sender app
value | Number | optional - Amount of ETH to send. Measured in wei. Defaults to 0.
gas | Number | optional - Recommended amount of gas. Defaults to 21000.
These are the only parameters needed for this use-case.
For the other use-cases, the mode field allows for defining the structure of the resulting JSON. The URI scheme to invoke the contract's function uses JSON to encode the parameters specified.
Possible inputs for the mode field:
contract_function
erc20__transfer
erc20__approve
erc20__transferFrom
These are explored in more detail below.
2. Invoke function of a contract
That mode is utilized by specifying "mode: "contract_function".
Example of the transfer method using an ERC20 token:
functionSignature | Object | required - Object that defines signature of invoked function. It is used only if "mode" == "function"
name | String | required - Name of the invoked function
payable | Boolean | required - Defines whether function is able to receive ETH or not. (value should be zero if false)
args | Array | optional - Contains list of function`s arguments. If this parameter is present - it must contain at least one element. If this parameter is not present - we assume that function do not have arguments.
type | String | required - Type of the argument: uint, uint8, int32, address, bool and so on.
name | String | required - Name of the argument. Used to generate GUI for the transaction.
In fact, argument of Solidity function can be unnamed - this is OK if you develop a smart contract.
But QR codes are used to pass tx details between different wallets and GUI must be nice.
Therefore unnamed input fields in GUI are not possible. Therefore this parameter is required.
argsDefaults | Array | optional - Array with default values for function arguments. If this parameter is present - it must contain at least one element. We do not require to provide defaults of all args.
name | String | required - Name of the argument. Should be equal to the name of one of arguments from functionSignature
value | Any | required - Default value for the function argument
3. Template for ERC20 tokens
The 3 extra subtypes were added since ERC20 tokens are very popular.
To make it easier to send tokens between accounts we predefine function signatures for the methods from ERC20 specification:
"mode": "erc20__transfer" will result in function transfer(address to, uint value) returns (bool success)
Originally posted by @mezrin in #67
The text was updated successfully, but these errors were encountered: