0

In an action in my contract, I want to attach some text to it, so that users can see the text in their transaction history using a block explore like eosflare.io.

I see that eosio.token has a "memo" parameter that does exactly what I want, however when I read the source code, it doesn't seem to use the "memo" at all. How does a block explore know it is a memo? How can I also add a "memo" to my action?

1

The block explore uses get actions functionality that lists all the transactions performed in that account. For e.g. when a transfer action is performed between two accounts as shown below

# cleos push action eosiotoken transfer '[user111,user222,"10.0000 SYS",
  "testing transfer"]' -p user111

The get actions of the user111 is as shown below

# cleos get actions user111
#  seq  when                              contract::action => receiver      trx id...   args
#    0   2018-07-03T10:37:28.000      eosiotoken::transfer => user111       14112283... {"from":"eosio","to":"user111","quantity":"100.0000 SYS","me...
#    1   2018-07-03T10:39:39.500      eosiotoken::transfer => eosiotoken    a24f51c5... {"from":"user111","to":"user222","quantity":"10.0000 SYS","m...
#    2   2018-07-03T10:39:39.500      eosiotoken::transfer => user111       a24f51c5... {"from":"user111","to":"user222","quantity":"10.0000 SYS","m...
#    3   2018-07-03T10:39:39.500      eosiotoken::transfer => user222       a24f51c5... {"from":"user111","to":"user222","quantity":"10.0000 SYS","m...

The get actions of user222 is as shown below

# cleos get actions user222
#  seq  when                              contract::action => receiver      trx id...   args
#    0   2018-07-03T10:39:39.500      eosiotoken::transfer => user222       a24f51c5... {"from":"user111","to":"user222","quantity":"10.0000 SYS","m...

As from the above results we get the list of all actions received by that account along with its arguments. The eosflare retrieves memo from the transfer action arguments.

| improve this answer | |

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.