0

I've created a table within a contract where I want to store user information. the .emplace() method's first parameter specifies the "scope" (I guess) for data to be stored and thus the user account

when I create the transaction I pass in the account that has permission via -p. something like:

cleos push action MyContract MyAction "[]" -p UserAccount@active

so within my code I need a way to refer to the UserAccount. _self seems to refer to the account that owns the contract

how can that be done?

2 Answers 2

1

The .emplace() method's first parameter specifies the "payer" not the "scope" for data to be stored, the payer who pay for the RAM.

The multi_index table's defination specify the "code" and "scope".

To get the sender see this: Account of caller of action

3
  • so I guess the answer is no, it can't be done, though the statement "As actions can be called with several user permissions at the same time there is no unique caller." doesn't make much sense. if an action can be called with several user permissions (what for?) then an array of those permissions could be made available to the developer. this is important information without which developers are forced to pass in parameters that are redundant and could be erroneous
    – ekkis
    Jan 18, 2019 at 2:49
  • and thanks for the clarification with respect to "payer"
    – ekkis
    Jan 18, 2019 at 2:51
  • I now still have the same thoughts as you do on the sender question, so I just paste the link. I also check the system contract and see they usually pass the sender in.
    – Reason Lee
    Jan 18, 2019 at 3:22
-1

I just put the UserAccount as one of the arguments of the action

1
  • I understand I can do that, but since a authoritative account is required, that information should be available to me internally. I'm asking whether/how it is
    – ekkis
    Jan 18, 2019 at 1:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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