From fbd37c591fef5cbee19795d748f34cf748b17dd0 Mon Sep 17 00:00:00 2001 From: hackrush Date: Thu, 31 Aug 2017 19:28:30 +0530 Subject: [PATCH] Expose `include_tip_info` param Goes with lbryio/lbryum#153 Updated changelog and added docs for include_tip_info Added proper doc for Returns of transaction_list Fixed some other docs --- CHANGELOG.md | 5 +--- lbrynet/core/Wallet.py | 10 ++++---- lbrynet/daemon/Daemon.py | 55 ++++++++++++++++++++++++++++++---------- 3 files changed, 48 insertions(+), 22 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 551067245..1d7d05ee8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ at anytime. ### Added * Added option to announce head blob only if seeding * Added option to download by seeking head blob first + * Added `include_tip_info` param to `transaction_list` API call * ### Fixed @@ -29,10 +30,6 @@ at anytime. * * -### Added - * - * - ### Removed * * diff --git a/lbrynet/core/Wallet.py b/lbrynet/core/Wallet.py index 9340a2cd6..b2f162680 100644 --- a/lbrynet/core/Wallet.py +++ b/lbrynet/core/Wallet.py @@ -991,8 +991,8 @@ class Wallet(object): d = self._get_blockhash(height) return d - def get_history(self): - d = self._get_history() + def get_history(self, include_tip_info): + d = self._get_history(include_tip_info) return d def address_is_mine(self, address): @@ -1111,7 +1111,7 @@ class Wallet(object): def _get_balance_for_address(self, address): return defer.fail(NotImplementedError()) - def _get_history(self): + def _get_history(self, include_tip_info): return defer.fail(NotImplementedError()) def _address_is_mine(self, address): @@ -1456,8 +1456,8 @@ class LBRYumWallet(Wallet): def get_nametrie(self): return self._run_cmd_as_defer_to_thread('getclaimtrie') - def _get_history(self): - return self._run_cmd_as_defer_succeed('history') + def _get_history(self, include_tip_info): + return self._run_cmd_as_defer_succeed('history', include_tip_info) def _address_is_mine(self, address): return self._run_cmd_as_defer_succeed('ismine', address) diff --git a/lbrynet/daemon/Daemon.py b/lbrynet/daemon/Daemon.py index 698634e72..d0ad6e43f 100644 --- a/lbrynet/daemon/Daemon.py +++ b/lbrynet/daemon/Daemon.py @@ -1383,9 +1383,9 @@ class Daemon(AuthJSONRPCServer): 'depth': (int) claim depth, 'has_signature': (bool) included if decoded_claim 'name': (str) claim name, - 'supports: (list) list of supports [{'txid': txid, - 'nout': nout, - 'amount': amount}], + 'supports: (list) list of supports [{'txid': (str) txid, + 'nout': (int) nout, + 'amount': (float) amount}], 'txid': (str) claim txid, 'nout': (str) claim nout, 'signature_is_valid': (bool), included if has_signature, @@ -1408,9 +1408,9 @@ class Daemon(AuthJSONRPCServer): 'has_signature': (bool) included if decoded_claim 'name': (str) claim name, 'channel_name': (str) channel name if claim is in a channel - 'supports: (list) list of supports [{'txid': txid, - 'nout': nout, - 'amount': amount}] + 'supports: (list) list of supports [{'txid': (str) txid, + 'nout': (int) nout, + 'amount': (float) amount}] 'txid': (str) claim txid, 'nout': (str) claim nout, 'signature_is_valid': (bool), included if has_signature, @@ -2048,9 +2048,9 @@ class Daemon(AuthJSONRPCServer): 'depth': (int) claim depth, 'has_signature': (bool) included if decoded_claim 'name': (str) claim name, - 'supports: (list) list of supports [{'txid': txid, - 'nout': nout, - 'amount': amount}], + 'supports: (list) list of supports [{'txid': (str) txid, + 'nout': (int) nout, + 'amount': (float) amount}], 'txid': (str) claim txid, 'nout': (str) claim nout, 'signature_is_valid': (bool), included if has_signature, @@ -2097,18 +2097,47 @@ class Daemon(AuthJSONRPCServer): defer.returnValue(response) @AuthJSONRPCServer.auth_required - def jsonrpc_transaction_list(self): + @AuthJSONRPCServer.flags(include_tip_info='-t') + def jsonrpc_transaction_list(self, include_tip_info=False): """ List transactions belonging to wallet Usage: - transaction_list + transaction_list [-t] + + Options: + -t : Include claim tip information Returns: - (list) List of transactions + (list) List of transactions, where is_tip is null by default, + and set to a boolean if include_tip_info is true + + { + "claim_info": (list) claim info if in txn [{"amount": (float) claim amount, + "claim_id": (str) claim id, + "claim_name": (str) claim name, + "nout": (int) nout}], + "confirmations": (int) number of confirmations for the txn, + "date": (str) date and time of txn, + "fee": (float) txn fee, + "support_info": (list) support info if in txn [{"amount": (float) support amount, + "claim_id": (str) claim id, + "claim_name": (str) claim name, + "is_tip": (null) default, + (bool) if include_tip_info is true, + "nout": (int) nout}], + "timestamp": (int) timestamp, + "txid": (str) txn id, + "update_info": (list) update info if in txn [{"amount": (float) updated amount, + "claim_id": (str) claim id, + "claim_name": (str) claim name, + "nout": (int) nout}], + "value": (float) value of txn + } + """ - d = self.session.wallet.get_history() + d = self.session.wallet.get_history(include_tip_info) d.addCallback(lambda r: self._render_response(r)) return d