mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-09-01 09:45:18 +00:00
Added for_broadcast argument to payto/paytomany (#6532)
The payto command now takes a flag "addtransaction" whether the returned transaction should be added to the wallet history. Previously payto did not have a side-effect, and as the flag is opt-in, that will stay the default. closes #6529
This commit is contained in:
parent
2c7da6afde
commit
ba649fa8ab
1 changed files with 12 additions and 4 deletions
|
@ -592,7 +592,7 @@ class Commands:
|
||||||
|
|
||||||
@command('wp')
|
@command('wp')
|
||||||
async def payto(self, destination, amount, fee=None, feerate=None, from_addr=None, from_coins=None, change_addr=None,
|
async def payto(self, destination, amount, fee=None, feerate=None, from_addr=None, from_coins=None, change_addr=None,
|
||||||
nocheck=False, unsigned=False, rbf=None, password=None, locktime=None, wallet: Abstract_Wallet = None):
|
nocheck=False, unsigned=False, rbf=None, password=None, locktime=None, addtransaction=False, wallet: Abstract_Wallet = None):
|
||||||
"""Create a transaction. """
|
"""Create a transaction. """
|
||||||
self.nocheck = nocheck
|
self.nocheck = nocheck
|
||||||
tx_fee = satoshis(fee)
|
tx_fee = satoshis(fee)
|
||||||
|
@ -613,11 +613,14 @@ class Commands:
|
||||||
rbf=rbf,
|
rbf=rbf,
|
||||||
password=password,
|
password=password,
|
||||||
locktime=locktime)
|
locktime=locktime)
|
||||||
return tx.serialize()
|
result = tx.serialize()
|
||||||
|
if addtransaction:
|
||||||
|
await self.addtransaction(result, wallet=wallet)
|
||||||
|
return result
|
||||||
|
|
||||||
@command('wp')
|
@command('wp')
|
||||||
async def paytomany(self, outputs, fee=None, feerate=None, from_addr=None, from_coins=None, change_addr=None,
|
async def paytomany(self, outputs, fee=None, feerate=None, from_addr=None, from_coins=None, change_addr=None,
|
||||||
nocheck=False, unsigned=False, rbf=None, password=None, locktime=None, wallet: Abstract_Wallet = None):
|
nocheck=False, unsigned=False, rbf=None, password=None, locktime=None, addtransaction=False, wallet: Abstract_Wallet = None):
|
||||||
"""Create a multi-output transaction. """
|
"""Create a multi-output transaction. """
|
||||||
self.nocheck = nocheck
|
self.nocheck = nocheck
|
||||||
tx_fee = satoshis(fee)
|
tx_fee = satoshis(fee)
|
||||||
|
@ -641,7 +644,10 @@ class Commands:
|
||||||
rbf=rbf,
|
rbf=rbf,
|
||||||
password=password,
|
password=password,
|
||||||
locktime=locktime)
|
locktime=locktime)
|
||||||
return tx.serialize()
|
result = tx.serialize()
|
||||||
|
if addtransaction:
|
||||||
|
await self.addtransaction(result, wallet=wallet)
|
||||||
|
return result
|
||||||
|
|
||||||
@command('w')
|
@command('w')
|
||||||
async def onchain_history(self, year=None, show_addresses=False, show_fiat=False, wallet: Abstract_Wallet = None):
|
async def onchain_history(self, year=None, show_addresses=False, show_fiat=False, wallet: Abstract_Wallet = None):
|
||||||
|
@ -1208,6 +1214,7 @@ command_options = {
|
||||||
'unsigned': ("-u", "Do not sign transaction"),
|
'unsigned': ("-u", "Do not sign transaction"),
|
||||||
'rbf': (None, "Whether to signal opt-in Replace-By-Fee in the transaction (true/false)"),
|
'rbf': (None, "Whether to signal opt-in Replace-By-Fee in the transaction (true/false)"),
|
||||||
'locktime': (None, "Set locktime block number"),
|
'locktime': (None, "Set locktime block number"),
|
||||||
|
'addtransaction': (None,'Whether transaction is to be used for broadcasting afterwards. Adds transaction to the wallet'),
|
||||||
'domain': ("-D", "List of addresses"),
|
'domain': ("-D", "List of addresses"),
|
||||||
'memo': ("-m", "Description of the request"),
|
'memo': ("-m", "Description of the request"),
|
||||||
'expiration': (None, "Time in seconds"),
|
'expiration': (None, "Time in seconds"),
|
||||||
|
@ -1249,6 +1256,7 @@ arg_types = {
|
||||||
'fee': lambda x: str(Decimal(x)) if x is not None else None,
|
'fee': lambda x: str(Decimal(x)) if x is not None else None,
|
||||||
'amount': lambda x: str(Decimal(x)) if x != '!' else '!',
|
'amount': lambda x: str(Decimal(x)) if x != '!' else '!',
|
||||||
'locktime': int,
|
'locktime': int,
|
||||||
|
'addtransaction': eval_bool,
|
||||||
'fee_method': str,
|
'fee_method': str,
|
||||||
'fee_level': json_loads,
|
'fee_level': json_loads,
|
||||||
'encrypt_file': eval_bool,
|
'encrypt_file': eval_bool,
|
||||||
|
|
Loading…
Add table
Reference in a new issue