LCOV - code coverage report
Current view: top level - lib/src - ethereum_rpc_client.dart (source / functions) Hit Total Coverage
Test: coverage.lcov Lines: 12 13 92.3 %
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   : 06/11/2017
       5             :  * Copyright :  S.Hamblett
       6             :  *
       7             :  * A JSON RPC 2.0 client for Ethereum
       8             :  */
       9             : 
      10             : part of ethereum;
      11             : 
      12             : class EthereumRpcClient {
      13             :   static const String jsonRPpcVersion = '2.0';
      14             : 
      15           2 :   EthereumRpcClient(this._adapter);
      16             : 
      17             :   /// The HTTP adapter
      18             :   EthereumINetworkAdapter _adapter;
      19             : 
      20             :   /// The transmission id
      21             :   int _id = 0;
      22             : 
      23           2 :   int get id => _id;
      24             : 
      25             :   /// The Uri
      26             :   Uri _uri;
      27             : 
      28           0 :   Uri get uri => _uri;
      29             : 
      30           2 :   set uri(Uri uri) => _uri = uri;
      31             : 
      32             :   /// The request method
      33             :   Future<Map> request(String method, [dynamic parameters]) {
      34           1 :     final Map packet = new Map();
      35           1 :     packet['jsonrpc'] = jsonRPpcVersion;
      36           1 :     packet['method'] = method;
      37             :     if (parameters != null) {
      38           1 :       packet['params'] = parameters;
      39             :     }
      40           2 :     packet['id'] = id;
      41           2 :     _id++;
      42           3 :     return _adapter.httpRequest(_uri, packet);
      43             :   }
      44             : 
      45             :   /// Reset the transmission id
      46             :   void resetTransmissionId([int value]) {
      47             :     if (value == null) {
      48           1 :       _id = 0;
      49             :     } else {
      50           1 :       _id = value;
      51             :     }
      52             :   }
      53             : }

Generated by: LCOV version 1.12