4

Is there a way to get the account of the caller within an action?

If not, I would need to add an extra parameter to the action containing the action name and then do some verification. It would be nicer to not have the extra parameter.

In that context what is the current_receiver (is it the contract) and how differs this from self (the contract)?

2 Answers 2

2

The caller of the action (which is simlar to msg.sender in ETH) is not available in the action itself. As actions can be called with several user permissions at the same time there is no unique caller.

If you require a particular user permission you need to provide that as an extra parameter and call require_auth(user)

current_receiver is the account name that the contract belongs to.

0

Update, it's just called "receiver" now. According to the latest docs:

"receiver" is the account that is currently processing the action. "code" is the account that authorized the contract.

Your Answer

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

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