def add_inputs(self, rawtx, wifs, change_address=None, fee=10000, dont_sign=False): """Add sufficient inputs from given <wifs> to cover <rawtx> outputs and <fee>. If no <change_address> is given, change will be sent to first wif. """ tx = deserialize.tx(rawtx) keys = deserialize.keys(self.testnet, wifs) fee = deserialize.positive_integer(fee) if change_address is not None: change_address = deserialize.address(self.testnet, change_address) tx = control.add_inputs(self.service, self.testnet, tx, keys, change_address=change_address, fee=fee) if not dont_sign: tx = control.sign_tx(self.service, self.testnet, tx, keys) return serialize.tx(tx)
def sign_tx(self, rawtx, wifs): """Sign <rawtx> with given <wifs> as json data. <wifs>: '["privatekey_in_wif_format", ...]' """ tx = deserialize.tx(rawtx) keys = deserialize.keys(self.testnet, wifs) tx = control.sign_tx(self.service, self.testnet, tx, keys) return serialize.tx(tx)
def add_broadcast_message(self, rawtx, message, sender_wif, dust_limit=common.DUST_LIMIT): """TODO add docstring""" tx = deserialize.tx(rawtx) message = deserialize.unicode_str(message) sender_key = deserialize.key(self.testnet, sender_wif) tx = control.add_broadcast_message(self.testnet, tx, message, sender_key, dust_limit=dust_limit) return serialize.tx(tx)
def get_broadcast_message(self, rawtx): """TODO add docstring""" tx = deserialize.tx(rawtx) result = control.get_broadcast_message(self.testnet, tx) result["signature"] = serialize.signature(result["signature"]) return result
def add_data_blob(self, rawtx, hexdata, dust_limit=common.DUST_LIMIT): """TODO add docstring""" tx = deserialize.tx(rawtx) data = deserialize.binary(hexdata) tx = control.add_data_blob(tx, data, dust_limit=dust_limit) return serialize.tx(tx)
def get_data_blob(self, rawtx): """TODO add docstring""" tx = deserialize.tx(rawtx) data = control.get_data_blob(tx) return serialize.data(data)
def get_nulldata(self, rawtx): """Returns nulldata from <rawtx> as hexdata.""" tx = deserialize.tx(rawtx) index, data = control.get_nulldata(tx) return serialize.data(data)