cli_wallet: Print operation results

This commit is contained in:
theoreticalbts 2015-10-23 14:42:59 -04:00
parent 0d55541682
commit 4fa0f182ec

View file

@ -73,6 +73,19 @@ namespace graphene { namespace wallet {
namespace detail {
struct operation_result_printer
{
public:
operation_result_printer( const wallet_api_impl& w )
: _wallet(w) {}
const wallet_api_impl& _wallet;
typedef std::string result_type;
std::string operator()(const void_result& x) const;
std::string operator()(const object_id_type& oid);
std::string operator()(const asset& a);
};
// BLOCK TRX OP VOP
struct operation_printer
{
@ -2396,7 +2409,13 @@ std::string operation_printer::operator()(const T& op)const
op_name.erase(0, op_name.find_last_of(':')+1);
out << op_name <<" ";
// out << "balance delta: " << fc::json::to_string(acc.balance) <<" ";
out << payer.name << " fee: " << a.amount_to_pretty_string( op.fee );
out << payer.name << " fee: " << a.amount_to_pretty_string( op.fee );
operation_result_printer rprinter(wallet);
std::string str_result = result.visit(rprinter);
if( str_result != "" )
{
out << " result: " << str_result;
}
return "";
}
std::string operation_printer::operator()(const transfer_from_blind_operation& op)const
@ -2470,6 +2489,21 @@ std::string operation_printer::operator()(const asset_create_operation& op) cons
return fee(op.fee);
}
std::string operation_result_printer::operator()(const void_result& x) const
{
return "";
}
std::string operation_result_printer::operator()(const object_id_type& oid)
{
return std::string(oid);
}
std::string operation_result_printer::operator()(const asset& a)
{
return _wallet.get_asset(a.asset_id).amount_to_pretty_string(a);
}
}}}