Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

cleos to display pushed actions' return values #9375

Merged
merged 13 commits into from
Aug 12, 2020
18 changes: 16 additions & 2 deletions programs/cleos/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,20 @@ void print_action( const fc::variant& at ) {
*/
if( args.size() > 100 ) args = args.substr(0,100) + "...";
cout << "#" << std::setw(14) << right << receiver << " <= " << std::setw(28) << std::left << (code +"::" + func) << " " << args << "\n";

std::string return_value, return_value_prefix{"return value: "};
try {
return_value = fc::json::to_string(at["return_value_data"], fc::time_point::maximum());
} catch (...) {
Max-B1 marked this conversation as resolved.
Show resolved Hide resolved
return_value = at["return_value_hex_data"].as_string();
return_value_prefix = "return value (hex): ";
}
if( !return_value.empty() ) {
if( return_value.size() > 100 ) {
return_value = return_value.substr(0, 100) + "...";
}
cout << "=>" << std::setw(46) << std::right << return_value_prefix << return_value << "\n";
}
if( console.size() ) {
std::stringstream ss(console);
string line;
Expand Down Expand Up @@ -1137,7 +1151,7 @@ struct create_account_subcommand {

if( active_key_str.empty() ) {
active = owner;
} else if ( active_key_str.find('{') != string::npos ) {
} else if ( active_key_str.find('{') != string::npos ) {
try{
active = parse_json_authority_or_key(active_key_str);
} EOS_RETHROW_EXCEPTIONS( explained_exception, "Invalid active authority: ${authority}", ("authority", owner_key_str) )
Expand Down Expand Up @@ -2622,7 +2636,7 @@ int main( int argc, char** argv ) {
});

// validate subcommand
auto validate = app.add_subcommand("validate", localized("Validate transactions"));
auto validate = app.add_subcommand("validate", localized("Validate transactions"));
validate->require_subcommand();

// validate signatures
Expand Down