diff --git a/cyberwow/lib/controller/rpc/rpc.dart b/cyberwow/lib/controller/rpc/rpc.dart index d459ab6..4888e65 100644 --- a/cyberwow/lib/controller/rpc/rpc.dart +++ b/cyberwow/lib/controller/rpc/rpc.dart @@ -26,7 +26,6 @@ import 'package:http/http.dart' as http; import 'package:flutter/foundation.dart'; import '../../config.dart' as config; -import 'rpcView.dart' as rpcView; import '../../helper.dart'; import '../../logging.dart'; @@ -93,7 +92,7 @@ Future getInfo() => rpc('get_info'); Future> getInfoSimple() async { final _getInfo = await rpc('get_info').then(asMap); - return cleanKey(rpcView.getInfoView(_getInfo)); + return _getInfo; } Future getInfoString() => rpcString('get_info'); @@ -105,7 +104,7 @@ Future outgoingConnectionsCount() => Future incomingConnectionsCount() => rpc('get_info', field: 'incoming_connections_count').then(asInt); -Future> getConnectionsSimple() async { +Future>> getConnectionsSimple() async { final _connections = await rpc('get_connections', field: 'connections').then(asJsonArray); const minActiveTime = 8; @@ -120,7 +119,7 @@ Future> getConnectionsSimple() async { } ); - return _sortedConn.map(rpcView.getConnectionView).toList(); + return _sortedConn.toList(); } diff --git a/cyberwow/lib/controller/rpc/rpc2.dart b/cyberwow/lib/controller/rpc/rpc2.dart index cadf9b0..4f7d356 100644 --- a/cyberwow/lib/controller/rpc/rpc2.dart +++ b/cyberwow/lib/controller/rpc/rpc2.dart @@ -30,7 +30,6 @@ import 'package:intl/intl.dart'; import '../../config.dart' as config; import '../../helper.dart'; import '../../logging.dart'; -import 'rpc2View.dart' as rpc2View; Future rpc2(final String method) async { final url = 'http://${config.host}:${config.c.port}/${method}'; @@ -101,6 +100,6 @@ Future> getTransactionPoolSimple() async { } ); - return _decodedPool.map(rpc2View.txView).map(cleanKey).toList(); + return _decodedPool.toList(); } } diff --git a/cyberwow/lib/state.dart b/cyberwow/lib/state.dart index 1f32e13..17e52c8 100644 --- a/cyberwow/lib/state.dart +++ b/cyberwow/lib/state.dart @@ -38,6 +38,7 @@ import 'config.dart' as config; import 'logging.dart'; import 'helper.dart'; import 'controller/rpc/rpcView.dart' as rpcView; +import 'controller/rpc/rpc2View.dart' as rpc2View; abstract class AppState { T use @@ -304,24 +305,22 @@ class SyncedState extends HookedState { // log.finer('SyncedState: checkSync loop'); height = await rpc.height(); connected = await daemon.isConnected(); - getInfo = await rpc.getInfoSimple(); + final _getInfo = await rpc.getInfoSimple(); + getInfo = cleanKey(rpcView.getInfoView(_getInfo)); getInfoCache = pretty(getInfo); - final _getConnections = await rpc.getConnectionsSimple(); + final List> _getConnections = await rpc.getConnectionsSimple(); getConnections = _getConnections + .map(rpcView.getConnectionView) .map((x) => rpcView.simpleHeight(height, x)) .map(cleanKey) .toList(); getConnectionsCache = pretty(getConnections); - // getTransactionPool = await rpc.getTransactionPoolString(); - - getTransactionPool = await rpc.getTransactionPoolSimple(); + final List> _getTransactionPool = await rpc.getTransactionPoolSimple(); + getTransactionPool = _getTransactionPool.map(rpc2View.txView).map(cleanKey).toList(); getTransactionPoolCache = pretty(getTransactionPool); - // appendInput('help'); - - // log.fine('getTransactionPool: $getTransactionPool'); syncState(); } }