TransWikia.com

addressbook example. Where is the message used in the notify action?

EOS.IO Asked on August 20, 2021

Section 2.6 of the EOSIO developer docs https://developers.eos.io/welcome/latest/getting-started/smart-contract-development/adding-inline-actions describes how send an inline action. It all works fine but I can’t see how the message argument is used in the action code. The code for action is as follows:

[[eosio::action]]
  void notify(name user, std::string msg) {
    require_auth(get_self());
    require_recipient(user);
  }

Can anyone explain how the msg parameter is used within this action/function?

One Answer

The action constructor passes a data payload (including the message) to the action. To confirm, I used the read_action_data function to examine the data passed to the action. As expected, it does contain the message. Furthermore, the require_recipient call must make use of the 2nd element of the data tuple (the message string) when passing the receipt back to the recipient.

I'm therefore guessing that the msg parameter is passed in to the notify action/function in case I need to make use of it in the future.

Answered by tommccann on August 20, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP