0

I wrote an action that has an optional parameter, as something like:

[[eosio::action]] void foo(..., const std::optional<name>& recipient);

Then in the generated .abi, it is represented as:

{"name": "recipient", "type": "name?"}

But I couldn't find a way to specify (or, not specify) the optional parameter for cleos. Itried without specifying the optional parameter, {..., "recipient": ""}, etc., all in vain.
What should I do to specify an optional action parameter for cleos?

0

If you want to specify the value for optional param, just pass value like normal type. For not specifying value, use null.

{..., "recipient": "eosio"} or {..., "recipient": null}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.