File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -9,17 +9,14 @@ use crate::utils::hex_to_u64;
99
1010#[ no_mangle]
1111pub extern "C" fn fetch_transactions ( rpc_url : * const c_char ) -> * mut c_char {
12- // Pretvaranje C stringa u Rust string
1312 let c_str = unsafe { std:: ffi:: CStr :: from_ptr ( rpc_url) } ;
1413 let rpc_url_str = c_str. to_str ( ) . unwrap ( ) ;
15- // Pozivanje fetch_latest_block funkcije za dobijanje najnovijeg bloka
16- let future = tokio:: runtime:: Runtime :: new ( )
17- . unwrap ( )
18- . block_on ( fetch_latest_block ( rpc_url_str, true ) ) ;
1914
20- // Prikupljanje transakcija iz rezultata
15+ let runtime = tokio:: runtime:: Runtime :: new ( ) . unwrap ( ) ;
16+ let latest_block = runtime. block_on ( fetch_latest_block ( rpc_url_str, true ) ) ;
17+
2118 let mut transaction_data = String :: new ( ) ;
22- for tx in & future . transactions {
19+ for tx in & latest_block . transactions {
2320 transaction_data. push_str ( & format ! (
2421 "Tx hash: {}\n From: {}\n To: {}\n Value: {}\n Gas: {}\n \n " ,
2522 tx. hash,
You can’t perform that action at this time.
0 commit comments