remove --broadcast option for payto, and parse transactions from json 'hex' field
This commit is contained in:
@@ -412,26 +412,18 @@ class Commands:
|
||||
return tx
|
||||
|
||||
@command('wp')
|
||||
def payto(self, destination, amount, tx_fee=None, from_addr=None, change_addr=None, nocheck=False, unsigned=False, deserialized=False, broadcast=False):
|
||||
def payto(self, destination, amount, tx_fee=None, from_addr=None, change_addr=None, nocheck=False, unsigned=False, deserialized=False):
|
||||
"""Create a transaction. """
|
||||
domain = [from_addr] if from_addr else None
|
||||
tx = self._mktx([(destination, amount)], tx_fee, change_addr, domain, nocheck, unsigned)
|
||||
if broadcast:
|
||||
r, h = self.wallet.sendtx(tx)
|
||||
return h
|
||||
else:
|
||||
return tx.deserialize() if deserialized else tx
|
||||
return tx.deserialize() if deserialized else tx
|
||||
|
||||
@command('wp')
|
||||
def paytomany(self, outputs, tx_fee=None, from_addr=None, change_addr=None, nocheck=False, unsigned=False, deserialized=False, broadcast=False):
|
||||
def paytomany(self, outputs, tx_fee=None, from_addr=None, change_addr=None, nocheck=False, unsigned=False, deserialized=False):
|
||||
"""Create a multi-output transaction. """
|
||||
domain = [from_addr] if from_addr else None
|
||||
tx = self._mktx(outputs, tx_fee, change_addr, domain, nocheck, unsigned)
|
||||
if broadcast:
|
||||
r, h = self.wallet.sendtx(tx)
|
||||
return h
|
||||
else:
|
||||
return tx.deserialize() if deserialized else tx
|
||||
return tx.deserialize() if deserialized else tx
|
||||
|
||||
@command('wn')
|
||||
def history(self):
|
||||
@@ -620,7 +612,6 @@ param_descriptions = {
|
||||
}
|
||||
|
||||
command_options = {
|
||||
'broadcast': (None, "--broadcast", "Broadcast the transaction to the Bitcoin network"),
|
||||
'password': ("-W", "--password", "Password"),
|
||||
'concealed': ("-C", "--concealed", "Don't echo seed to console when restoring"),
|
||||
'receiving': (None, "--receiving", "Show only receiving addresses"),
|
||||
|
||||
@@ -470,7 +470,14 @@ class Transaction:
|
||||
return self.raw
|
||||
|
||||
def __init__(self, raw):
|
||||
self.raw = raw.strip() if raw else None
|
||||
if raw is None:
|
||||
self.raw = None
|
||||
elif type(raw) in [str, unicode]:
|
||||
self.raw = raw.strip() if raw else None
|
||||
elif type(raw) is dict:
|
||||
self.raw = raw['hex']
|
||||
else:
|
||||
raise BaseException("cannot initialize transaction", raw)
|
||||
self.inputs = None
|
||||
|
||||
def update(self, raw):
|
||||
|
||||
Reference in New Issue
Block a user