File tree Expand file tree Collapse file tree 3 files changed +44
-0
lines changed Expand file tree Collapse file tree 3 files changed +44
-0
lines changed Original file line number Diff line number Diff line change @@ -2155,6 +2155,21 @@ char *rpc::get_block::get_cmd()
2155
2155
return &ibuf_[0 ];
2156
2156
}
2157
2157
2158
+ bool rpc::get_block::get_is_tx_err () const
2159
+ {
2160
+ return is_tx_err_;
2161
+ }
2162
+
2163
+ uint64_t rpc::get_block::get_tx_fee () const
2164
+ {
2165
+ return fee_;
2166
+ }
2167
+
2168
+ str rpc::get_block::get_tx_err () const
2169
+ {
2170
+ return tx_err_;
2171
+ }
2172
+
2158
2173
bool rpc::get_block::get_is_end () const
2159
2174
{
2160
2175
return is_end_;
@@ -2182,6 +2197,18 @@ void rpc::get_block::response( const jtree& jt )
2182
2197
}
2183
2198
}
2184
2199
if ( !found ) continue ;
2200
+ // get meta-data
2201
+ is_tx_err_ = false ;
2202
+ fee_ = 0UL ;
2203
+ uint32_t mx = jt.find_val ( it, " meta" );
2204
+ if ( mx && jt.get_type ( mx ) == jtree::e_obj ) {
2205
+ fee_ = jt.get_uint ( jt.find_val ( mx, " fee" ) );
2206
+ uint32_t ex = jt.find_val ( mx, " err" );
2207
+ if ( ex && jt.get_type ( ex ) == jtree::e_obj ) {
2208
+ is_tx_err_ = true ;
2209
+ tx_err_ = jt.get_str ( jt.get_key ( jt.get_first ( ex ) ) );
2210
+ }
2211
+ }
2185
2212
// get transaction details
2186
2213
uint32_t ix = jt.find_val ( ms, " instructions" );
2187
2214
str idata = jt.get_str ( jt.find_val ( jt.get_first ( ix ), " data" ) );
Original file line number Diff line number Diff line change @@ -850,6 +850,10 @@ namespace pc
850
850
void set_program ( pub_key * );
851
851
void request ( json_wtr& ) override ;
852
852
void response ( const jtree& ) override ;
853
+ uint64_t get_fee () const ;
854
+ bool get_is_tx_err () const ;
855
+ str get_tx_err () const ;
856
+ uint64_t get_tx_fee () const ;
853
857
unsigned get_num_key () const ;
854
858
pub_key *get_key ( unsigned i );
855
859
char *get_cmd ();
@@ -863,7 +867,10 @@ namespace pc
863
867
pub_key *gkey_;
864
868
key_vec_t kvec_;
865
869
ins_vec_t ibuf_;
870
+ uint64_t fee_;
871
+ str tx_err_;
866
872
bool is_end_;
873
+ bool is_tx_err_;
867
874
};
868
875
869
876
// set new component price
Original file line number Diff line number Diff line change @@ -1246,6 +1246,12 @@ class get_block_print : public get_block
1246
1246
std::cout << cmd->conf_ << std::endl;
1247
1247
print ( " pub_slot" , 2 );
1248
1248
std::cout << cmd->pub_slot_ << std::endl;
1249
+ print ( " tx_fee" , 2 );
1250
+ std::cout << res->get_tx_fee () << std::endl;
1251
+ if ( res->get_is_tx_err () ) {
1252
+ print ( " tx_error" , 2 );
1253
+ std::cout << res->get_tx_err ().as_string () << std::endl;
1254
+ }
1249
1255
std::cout << std::endl;
1250
1256
}
1251
1257
void on_response ( rpc::get_block *res ) override {
@@ -1288,6 +1294,10 @@ class get_block_json : public get_block
1288
1294
wtr_.add_key ( " price" , cmd->price_ );
1289
1295
wtr_.add_key ( " conf" , cmd->conf_ );
1290
1296
wtr_.add_key ( " pub_slot" , cmd->pub_slot_ );
1297
+ wtr_.add_key ( " tx_fee" , res->get_tx_fee () );
1298
+ if ( res->get_is_tx_err () ) {
1299
+ wtr_.add_key ( " tx_error" , res->get_tx_err () );
1300
+ }
1291
1301
wtr_.pop ();
1292
1302
}
1293
1303
void on_response ( rpc::get_block *res ) override {
You can’t perform that action at this time.
0 commit comments