fix transaction rpc

pull/2/head
fuwa 5 years ago
parent 0b23a15642
commit e7f8ee17f9

@ -58,7 +58,7 @@ Future<http.Response> rpc(String method) async {
} }
Future<String> rpcString(String method, {String field}) async { Future<String> rpcString(String method, {String field}) async {
var response = await rpc(method); final response = await rpc(method);
if (response == null) return ''; if (response == null) return '';
@ -77,7 +77,7 @@ Future<http.Response> syncInfo() async => rpc('sync_info');
Future<String> syncInfoString() async => rpcString('sync_info'); Future<String> syncInfoString() async => rpcString('sync_info');
Future<int> targetHeight() async { Future<int> targetHeight() async {
var response = await syncInfo(); final response = await syncInfo();
if (response == null) return -1; if (response == null) return -1;
@ -91,7 +91,7 @@ Future<int> targetHeight() async {
} }
Future<int> height() async { Future<int> height() async {
var response = await syncInfo(); final response = await syncInfo();
if (response == null) return -1; if (response == null) return -1;
@ -109,7 +109,7 @@ Future<http.Response> getInfo() async => rpc('get_info');
Future<String> getInfoString() async => rpcString('get_info'); Future<String> getInfoString() async => rpcString('get_info');
Future<bool> offline() async { Future<bool> offline() async {
var response = await getInfo(); final response = await getInfo();
if (response == null) return true; if (response == null) return true;
@ -123,7 +123,7 @@ Future<bool> offline() async {
} }
Future<int> outgoingConnectionsCount() async { Future<int> outgoingConnectionsCount() async {
var response = await getInfo(); final response = await getInfo();
if (response == null) return -1; if (response == null) return -1;
@ -137,7 +137,7 @@ Future<int> outgoingConnectionsCount() async {
} }
Future<int> incomingConnectionsCount() async { Future<int> incomingConnectionsCount() async {
var response = await getInfo(); final response = await getInfo();
if (response == null) return -1; if (response == null) return -1;
@ -170,7 +170,7 @@ Future<http.Response> rpcOther(String method) async {
} }
Future<String> rpcOtherString(String method, {String field}) async { Future<String> rpcOtherString(String method, {String field}) async {
var response = await rpcOther(method); final response = await rpcOther(method);
if (response == null) return ''; if (response == null) return '';
@ -188,9 +188,10 @@ Future<String> rpcOtherString(String method, {String field}) async {
// Future<String> getTransactionPoolString() async => rpcOtherString('get_transaction_pool'); // Future<String> getTransactionPoolString() async => rpcOtherString('get_transaction_pool');
Future<http.Response> getTransactionPool() async => rpc('get_transaction_pool'); Future<http.Response> getTransactionPool() async => rpcOther('get_transaction_pool');
Future<Map<String, dynamic>> getTransactionPoolSimple() async { Future<Map<String, dynamic>> getTransactionPoolSimple() async {
var response = await getTransactionPool(); final response = await getTransactionPool();
log.finer('getTransactionPoolSimple response: $response');
if (response == null) return {}; if (response == null) return {};

@ -231,6 +231,10 @@ class SyncedState extends HookedState {
// syncInfo = await rpc.syncInfoString(); // syncInfo = await rpc.syncInfoString();
getConnections = await rpc.getConnectionsString(); getConnections = await rpc.getConnectionsString();
// getTransactionPool = await rpc.getTransactionPoolString(); // getTransactionPool = await rpc.getTransactionPoolString();
final getTransactionPool = await rpc.getTransactionPoolSimple();
log.fine('getTransactionPool: $getTransactionPool');
syncState(); syncState();
} }
} }