Defines type-safe C++ wrappers for querying action and sending action. More...

Classes

Type Name
struct eosio::permission_level
Packed representation of a permission level (Authorization)
struct eosio::action
Packed representation of an action.

Functions

Defines

Detailed Description

Note:

There are some methods from the actioncapi that can be used directly from C++

Additional documentation for group

Functions Documentation

function unpack_action_data

template<typename T>
T eosio::unpack_action_data()

Interpret the action body as type T.

This method unpacks the current action at type T.

Returns:

Unpacked action data casted as T.

Example:

struct dummy_action {
  char a; //1
  unsigned long long b; //8
  int  c; //4

  EOSLIB_SERIALIZE( dummy_action, (a)(b)(c) )
};
dummy_action msg = unpack_action_data<dummy_action>();

function require_recipient

void eosio::require_recipient(
    name notify_account
)

Add the specified account to set of accounts to be notified.

Add the specified account to set of accounts to be notified

Parameters:

  • notify_account - name of the account to be verified

function require_recipient

template<typename... accounts>
void eosio::require_recipient(
    name notify_account,
    accounts... remaining_accounts
)

Notify an account for this action.

All of the listed accounts will be added to the set of accounts to be notified This helper method enables you to add multiple accounts to accounts to be notified list with a single call rather than having to call the similar C API multiple times.

Note:

action.code is also considered as part of the set of notified accounts

Parameters:

  • notify_account account to be notified
  • remaining_accounts accounts to be notified

Example:

require_recipient("Account1"_n, "Account2"_n, "Account3"_n); // throws exception if any of them not in set.

function require_auth

void eosio::require_auth(
    name n
)

Verify specified account exists in the set of provided auths.

Verifies that name exists in the set of provided auths on a action. Fails if not found.

Parameters:

  • name - name of the account to be verified

function require_auth

void eosio::require_auth(
    const permission_level & level
)

Require the specified authorization for this action.

Require the specified authorization for this action. If this action doesn't contain the specified auth, it will fail.

Parameters:

  • level - Authorization to be required

function has_auth

bool eosio::has_auth(
    name n
)

Verifies that n has auth.

Verifies that n has auth.

Parameters:

  • n - name of the account to be verified

function is_account

bool eosio::is_account(
    name n
)

Verifies that n is an existing account.

Verifies that n is an existing account.

Parameters:

  • n - name of the account to check

Defines Documentation

define SEND_INLINE_ACTION

#define SEND_INLINE_ACTION(CONTRACT, NAME, ...)\
INLINE_ACTION_SENDER(std::decay_t<decltype(CONTRACT)>, NAME)( (CONTRACT).get_self(),\
BOOST_PP_TUPLE_ENUM(BOOST_PP_VARIADIC_SIZE(__VA_ARGS__), BOOST_PP_VARIADIC_TO_TUPLE(__VA_ARGS__)) );

Send inline action.

Send inline action

Parameters:

  • CONTRACT - The account this action is intended for
  • NAME - The name of the action
  • ... - The member of the action specified as ("action_member1_name", action_member1_value)("action_member2_name", action_member2_value)