void myaction() {
struct token_transfer {
name from;
name to;
asset quantity;
string memo;
};
// transaction is inside "prop" object (that we get from a eosio.msig table)
eosio::multisig::proposals proptable( "eosio.msig"_n, proposer.value );
auto& prop = proptable.get( proposal_name.value, "proposal not found" );
// get the first action in the transaction, remember transactions can have multiple actions
eosio::action my_action = eosio::unpack<eosio::transaction>( prop.packed_transaction ).actions.front();
// get the data out of the action
token_transfer my_action_data = my_action.data_as<token_transfer>();
const name from = my_action_data.from;
const name to = my_action_data.to;
const asset quantity = my_action_data.quantity;
const string memo = my_action_data.memo;
}
参考
https://eosio.stackexchange.com/questions/4142/how-to-get-data-from-a-packed-transaction
版权属于:区块链中文技术社区 / 转载原创者
本文链接:https://bcskill.com/index.php/archives/851.html
相关技术文章仅限于相关区块链底层技术研究,禁止用于非法用途,后果自负!本站严格遵守一切相关法律政策!