1
0

read command line arguments from stdin if '-' is passed

This commit is contained in:
ThomasV
2015-08-16 16:11:52 +02:00
parent 5686499eae
commit 02e81a3655
2 changed files with 34 additions and 20 deletions

View File

@@ -239,8 +239,11 @@ class Commands:
@command('wp')
def getprivatekeys(self, address):
"""Get the private keys of an address. Address must be in wallet."""
return self.wallet.get_private_key(address, self.password)
"""Get the private keys of a wallet address, or list of wallet addresses."""
is_list = type(address) is list
domain = address if is_list else [address]
out = [self.wallet.get_private_key(address, self.password) for address in domain]
return out if is_list else out[0]
@command('w')
def ismine(self, address):
@@ -248,10 +251,9 @@ class Commands:
return self.wallet.is_mine(address)
@command('wp')
def dumpprivkeys(self, domain=None):
def dumpprivkeys(self):
"""Dump private keys from your wallet"""
if domain is None:
domain = self.wallet.addresses(True)
domain = self.wallet.addresses(True)
return [self.wallet.get_private_key(address, self.password) for address in domain]
@command('')
@@ -353,15 +355,16 @@ class Commands:
@command('n')
def sweep(self, privkey, destination, tx_fee=None, nocheck=False):
"""Sweep private key. Returns a transaction that spends UTXOs from
"""Sweep private keys. Returns a transaction that spends UTXOs from
privkey to a destination address. The transaction is not
broadcasted."""
privkeys = privkey if type(privkey) is list else [privkey]
self.nocheck = nocheck
dest = self._resolver(destination)
if tx_fee is None:
tx_fee = 0.0001
fee = int(Decimal(tx_fee)*COIN)
return Transaction.sweep([privkey], self.network, dest, fee)
return Transaction.sweep(privkeys, self.network, dest, fee)
@command('wp')
def signmessage(self, address, message):