add timeout to daemon, update getaddressbalance
[electrum-nvc.git] / lib / commands.py
index da6c4ba..64f2c69 100644 (file)
@@ -79,8 +79,8 @@ register_command('help',                 0, 1, False, False, False, 'Prints this
 register_command('history',              0, 0, True,  True,  False, 'Returns the transaction history of your wallet')
 register_command('importprivkey',        1, 1, False, True,  True,  'Import a private key', 'importprivkey <privatekey>')
 register_command('listaddresses',        2, 2, False, True,  False, 'Returns your list of addresses.', '', listaddr_options)
-register_command('listunspent',          0, 0, True,  False, False, 'Returns the list of unspent inputs in your wallet.')
-register_command('getaddressunspent',    1, 1, True,  False, False, 'Returns the list of unspent inputs in your wallet.')
+register_command('listunspent',          0, 0, True,  True,  False, 'Returns the list of unspent inputs in your wallet.')
+register_command('getaddressunspent',    1, 1, True,  False, False, 'Returns the list of unspent inputs for an address.')
 register_command('mktx',                 5, 5, False, True,  True,  'Create a signed transaction', 'mktx <recipient> <amount> [label]', payto_options)
 register_command('mksendmanytx',         4, 4, False, True,  True,  'Create a signed transaction', mksendmany_syntax, payto_options)
 register_command('payto',                5, 5, True,  True,  True,  'Create and broadcast a transaction.', payto_syntax, payto_options)
@@ -227,8 +227,11 @@ class Commands:
         return out
 
     def getaddressbalance(self, addr):
-        b = self.network.synchronous_get([ ('blockchain.address.get_balance',[addr]) ])[0]
-        return str(Decimal(b)/100000000)
+        out = self.network.synchronous_get([ ('blockchain.address.get_balance',[addr]) ])[0]
+        out["confirmed"] =  str(Decimal(out["confirmed"])/100000000)
+        out["unconfirmed"] =  str(Decimal(out["unconfirmed"])/100000000)
+        return out
+
 
     def getproof(self, addr):
         p = self.network.synchronous_get([ ('blockchain.address.get_proof',[addr]) ])[0]