def eth_sendTransaction(self, to_address=None, from_address=None, gas=None, gas_price=None, value=None, data=None, nonce=None): ''' https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_sendtransaction NEEDS TESTING ''' params = {} params['from'] = from_address or self.eth_coinbase() if to_address is not None: params['to'] = to_address if gas is not None: params['gas'] = clean_hex(gas) if gas_price is not None: params['gasPrice'] = clean_hex(gas_price) #hex(gas_price)[:-1] if value is not None: params['value'] = clean_hex(value) #hex(value)[:-1] if data is not None: params['data'] = data if nonce is not None: params['nonce'] = clean_hex(nonce) return self._call('eth_sendTransaction', [params])
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, str): 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 owt_call(self, to_address, 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#owt_call NEEDS TESTING ''' if isinstance(default_block, basestring): if default_block not in BLOCK_TAGS: raise ValueError obj = {} 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 self._call('owt_call', [obj, default_block])