From 905ea67b5136e484496a050ee21aff51858fb5bb Mon Sep 17 00:00:00 2001 From: fuwa Date: Tue, 26 Nov 2019 03:44:30 +0800 Subject: [PATCH] sort tx --- cyberwow/lib/controller/rpc/rpc2.dart | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/cyberwow/lib/controller/rpc/rpc2.dart b/cyberwow/lib/controller/rpc/rpc2.dart index 4ddb9a7..26e51ca 100644 --- a/cyberwow/lib/controller/rpc/rpc2.dart +++ b/cyberwow/lib/controller/rpc/rpc2.dart @@ -103,7 +103,7 @@ Future> getTransactionPoolSimple() async { // 'blob_size', ]; - return Map.fromIterable + final _tx = Map.fromIterable ( x.keys.where ( @@ -151,8 +151,24 @@ Future> getTransactionPoolSimple() async { return MapEntry(k, v); } } - ) - ; + ); + + final List keys = + [ + 'id', + 'time', + 'fee', + 'in/out', + 'size', + ] + .where((k) => _tx.keys.contains(k)) + .toList(); + + final _sortedTx = { + for (var k in keys) k: _tx[k] + }; + + return _sortedTx; } ).toList(); }