Merge pull request #542 from lbryio/wallet-list

add wallet_list
This commit is contained in:
Alex Grin 2017-03-20 15:31:45 -04:00 committed by GitHub
commit 4027733f2c
3 changed files with 20 additions and 1 deletions

View file

@ -9,7 +9,7 @@ at anytime.
## [Unreleased] ## [Unreleased]
### Added ### Added
* * Add `wallet_list` command
* *
* *

View file

@ -1106,6 +1106,9 @@ class LBRYumWallet(Wallet):
def get_pub_keys(self, address): def get_pub_keys(self, address):
return self._run_cmd_as_defer_succeed('getpubkeys', address) return self._run_cmd_as_defer_succeed('getpubkeys', address)
def list_addresses(self):
return self._run_cmd_as_defer_succeed('listaddresses')
def _save_wallet(self, val): def _save_wallet(self, val):
self.wallet.storage.write() self.wallet.storage.write()
return defer.succeed(val) return defer.succeed(val)

View file

@ -2067,6 +2067,22 @@ class Daemon(AuthJSONRPCServer):
d.addCallback(lambda r: self._render_response(r)) d.addCallback(lambda r: self._render_response(r))
return d return d
@AuthJSONRPCServer.auth_required
@defer.inlineCallbacks
def jsonrpc_wallet_list(self):
"""
List wallet addresses
Args:
None
Returns:
List of wallet addresses
"""
addresses = yield self.session.wallet.list_addresses()
response = yield self._render_response(addresses)
defer.returnValue(response)
@AuthJSONRPCServer.auth_required @AuthJSONRPCServer.auth_required
def jsonrpc_get_new_address(self): def jsonrpc_get_new_address(self):
""" """