def eth_newPendingTransactionFilter(self): ''' https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_newpendingtransactionfilter TESTED ''' return hex_to_dec(self._call('eth_newPendingTransactionFilter'))
def eth_blockNumber(self): ''' https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_blocknumber TESTED ''' return hex_to_dec(self._call('eth_blockNumber'))
def eth_estimateGas(self, to_address=None, from_address=None, gas=None, gas_price=None, value=None, data=None, default_block=BLOCK_TAG_LATEST): ''' https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_estimategas NEEDS TESTING ''' if isinstance(default_block, basestring): if default_block not in BLOCK_TAGS: raise ValueError obj = {} if to_address is not None: obj['to'] = to_address if from_address is not None: obj['from'] = from_address if gas is not None: obj['gas'] = hex(gas) if gas_price is not None: obj['gasPrice'] = clean_hex(gas_price) if value is not None: obj['value'] = value if data is not None: obj['data'] = data return hex_to_dec(self._call('eth_estimateGas', [obj, default_block]))
def eth_gasPrice(self): ''' https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_gasprice TESTED ''' return hex_to_dec(self._call('eth_gasPrice'))
def eth_hashrate(self): ''' https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_hashrate TESTED ''' return hex_to_dec(self._call('eth_hashrate'))
def net_peerCount(self): ''' https://github.com/ethereum/wiki/wiki/JSON-RPC#net_peercount TESTED ''' return hex_to_dec(self._call('net_peerCount'))
def eth_getUncleCountByBlockHash(self, block_hash): ''' https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getunclecountbyblockhash TESTED ''' return hex_to_dec( self._call('eth_getUncleCountByBlockHash', [block_hash]))
def eth_getBlockTransactionCountByHash(self, block_hash): ''' https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getblocktransactioncountbyhash TESTED ''' return hex_to_dec( self._call('eth_getBlockTransactionCountByHash', [block_hash]))
def eth_getUncleCountByBlockNumber(self, block=BLOCK_TAG_LATEST): ''' https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getunclecountbyblocknumber TESTED ''' block = validate_block(block) return hex_to_dec(self._call('eth_getUncleCountByBlockNumber', [block]))
def eth_getBlockTransactionCountByNumber(self, block=BLOCK_TAG_LATEST): ''' https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getblocktransactioncountbynumber TESTED ''' block = validate_block(block) return hex_to_dec( self._call('eth_getBlockTransactionCountByNumber', [block]))
def eth_getTransactionCount(self, address, block=BLOCK_TAG_LATEST): ''' https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_gettransactioncount TESTED ''' block = validate_block(block) return hex_to_dec( self._call('eth_getTransactionCount', [address, block]))
def eth_getBalance(self, address=None, block=BLOCK_TAG_LATEST): ''' https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getbalance TESTED ''' address = address or self.eth_coinbase() block = validate_block(block) return hex_to_dec(self._call('eth_getBalance', [address, block]))