LCOV - code coverage report
Current view: top level - lib/src/messages - ethereum_filter.dart (source / functions) Hit Total Coverage
Test: coverage.lcov Lines: 14 14 100.0 %
Date: 2018-01-19 11:13:13 Functions: 0 0 -

          Line data    Source code
       1             : /*
       2             :  * Package : Ethereum
       3             :  * Author : S. Hamblett <steve.hamblett@linux.com>
       4             :  * Date   : 08/01/2017
       5             :  * Copyright :  S.Hamblett
       6             :  *
       7             :  * A JSON RPC 2.0 client for Ethereum
       8             :  */
       9             : 
      10             : part of ethereum;
      11             : 
      12             : /// Filter message
      13             : /// For filters created with newBlockFilter the object contains block hashes.
      14             : /// For filters created with pendingTransactionFilter the class contains transaction hashes.
      15             : /// For filters created with newFilter or getFilterChanges the class contains logs
      16             : /// which are are EthereumLog objects.
      17             : class EthereumFilter {
      18           1 :   EthereumFilter();
      19             : 
      20           1 :   EthereumFilter.fromMap(Map result) {
      21           1 :     construct(result);
      22             :   }
      23             : 
      24             :   /// Hashes, block or transaction
      25             :   List<BigInteger> _hashes;
      26             : 
      27           1 :   List<BigInteger> get hashes => _hashes;
      28             : 
      29             :   /// Logs
      30             :   List<EthereumLog> _logs;
      31             : 
      32           1 :   List<EthereumLog> get logs => _logs;
      33             : 
      34             :   /// Ethereum log objects, returned by
      35             :   /// Construct from the supplied Map, only check for the keys we need.
      36             :   void construct(Map data) {
      37           1 :     if (data[ethResultKey] == null) {
      38             :       return;
      39             :     }
      40           2 :     if (data[ethResultKey].isNotEmpty) {
      41           3 :       if (data[ethResultKey][0] is String) {
      42             :         // Hashes
      43           3 :         _hashes = EthereumUtilities.hexToBigIntegerList(data[ethResultKey]);
      44             :       } else {
      45             :         // Logs
      46           2 :         _logs = new List<EthereumLog>();
      47           3 :         for (Map log in data[ethResultKey]) {
      48           1 :           final Map buildLog = {ethResultKey: log};
      49           1 :           final EthereumLog entry = new EthereumLog.fromMap(buildLog);
      50           2 :           _logs.add(entry);
      51             :         }
      52             :       }
      53             :     }
      54             :   }
      55             : }

Generated by: LCOV version 1.12