mirror of
https://github.com/wownero/cyberwow.git
synced 2026-10-21 17:28:44 +02:00
apply hashLengh to info
This commit is contained in:
@@ -86,6 +86,21 @@ Future<dynamic> height() => rpc('sync_info', field: 'height');
|
||||
|
||||
|
||||
Future<http.Response> getInfo() => rpc('get_info');
|
||||
|
||||
Future<Map<String, dynamic>> getInfoSimple() async {
|
||||
final Map<String, dynamic> _getInfo = await rpc('get_info');
|
||||
return _getInfo.map
|
||||
(
|
||||
(k, v) {
|
||||
if (k == 'top_block_hash') {
|
||||
return MapEntry(k, v.substring(0, config.hashLength) + '...');
|
||||
} else {
|
||||
return MapEntry(k, v);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
Future<String> getInfoString() => rpcString('get_info');
|
||||
|
||||
Future<dynamic> offline() => rpc('get_info', field: 'offline');
|
||||
@@ -112,7 +127,7 @@ Future<List<dynamic>> getConnectionsSimple() async {
|
||||
(
|
||||
(k, v) {
|
||||
if (k == 'connection_id') {
|
||||
return MapEntry(k, v.substring(0, 12) + '...');
|
||||
return MapEntry(k, v.substring(0, config.hashLength) + '...');
|
||||
} else {
|
||||
return MapEntry(k, v);
|
||||
}
|
||||
|
||||
@@ -100,7 +100,7 @@ Future<List<dynamic>> getTransactionPoolSimple() async {
|
||||
(
|
||||
(k, v) {
|
||||
if (k == 'id_hash') {
|
||||
return MapEntry(k, v.substring(0, 12) + '...');
|
||||
return MapEntry(k, v.substring(0, config.hashLength) + '...');
|
||||
} else {
|
||||
return MapEntry(k, v);
|
||||
}
|
||||
|
||||
@@ -199,7 +199,7 @@ class SyncedState extends HookedState {
|
||||
Stream<String> processOutput;
|
||||
bool synced = true;
|
||||
bool connected = true;
|
||||
String getInfo = 'getInfo';
|
||||
Map<String, dynamic> getInfo = {};
|
||||
String syncInfo = 'syncInfo';
|
||||
List<dynamic> getConnections = [];
|
||||
List<dynamic> getTransactionPool = [];
|
||||
@@ -229,7 +229,7 @@ class SyncedState extends HookedState {
|
||||
// log.finer('SyncedState: checkSync loop');
|
||||
height = await rpc.height();
|
||||
connected = await daemon.isConnected();
|
||||
getInfo = await rpc.getInfoString();
|
||||
getInfo = await rpc.getInfoSimple();
|
||||
// syncInfo = await rpc.syncInfoString();
|
||||
getConnections = await rpc.getConnectionsSimple();
|
||||
// getTransactionPool = await rpc.getTransactionPoolString();
|
||||
|
||||
@@ -91,7 +91,7 @@ Widget summary(SyncedState state) {
|
||||
);
|
||||
}
|
||||
|
||||
Widget rpcView(String title, String body) {
|
||||
Widget rpcView(String title, dynamic body) {
|
||||
return Container
|
||||
(
|
||||
padding: const EdgeInsets.all(10.0),
|
||||
@@ -137,7 +137,7 @@ Widget rpcView(String title, String body) {
|
||||
),
|
||||
Text
|
||||
(
|
||||
body,
|
||||
pretty(body),
|
||||
style: TextStyle
|
||||
(
|
||||
fontFamily: 'RobotoMono',
|
||||
@@ -156,11 +156,9 @@ Widget rpcView(String title, String body) {
|
||||
}
|
||||
|
||||
Widget getInfo(SyncedState state) => rpcView('info', state.getInfo);
|
||||
Widget getConnections(SyncedState state) =>
|
||||
rpcView('connections', pretty(state.getConnections));
|
||||
Widget getConnections(SyncedState state) => rpcView('connections', state.getConnections);
|
||||
Widget syncInfo(SyncedState state) => rpcView('sync info', state.syncInfo);
|
||||
Widget getTransactionPool(SyncedState state) =>
|
||||
rpcView('tx pool', pretty(state.getTransactionPool));
|
||||
Widget getTransactionPool(SyncedState state) => rpcView('tx pool', state.getTransactionPool);
|
||||
|
||||
Widget pageView (SyncedState state, PageController controller) {
|
||||
return PageView (
|
||||
|
||||
Reference in New Issue
Block a user