0

I am gonna get account name of caller(wallet) in my action of smart contract. I used functions current_receiver(), get_sender(), get_first_receiver(). but I got contract`s account name and empty string.

1 Answer 1

0

To check/verify authorization of an account, pass the account-name as an argument to your ACTION and call require_auth(...) or has_auth(...).

void test::test(name user) {
   check(has_auth(user), "User not authorized");
   ...
}


void test::test(name user) {
   require_auth(user);
   ...
}

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.