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
This commit is contained in:
hackrush 2017-08-31 19:28:30 +05:30
parent 2254e3507a
commit fbd37c591f
3 changed files with 48 additions and 22 deletions

View file

@ -15,6 +15,7 @@ at anytime.
### Added ### Added
* Added option to announce head blob only if seeding * Added option to announce head blob only if seeding
* Added option to download by seeking head blob first * Added option to download by seeking head blob first
* Added `include_tip_info` param to `transaction_list` API call
* *
### Fixed ### Fixed
@ -29,10 +30,6 @@ at anytime.
* *
* *
### Added
*
*
### Removed ### Removed
* *
* *

View file

@ -991,8 +991,8 @@ class Wallet(object):
d = self._get_blockhash(height) d = self._get_blockhash(height)
return d return d
def get_history(self): def get_history(self, include_tip_info):
d = self._get_history() d = self._get_history(include_tip_info)
return d return d
def address_is_mine(self, address): def address_is_mine(self, address):
@ -1111,7 +1111,7 @@ class Wallet(object):
def _get_balance_for_address(self, address): def _get_balance_for_address(self, address):
return defer.fail(NotImplementedError()) return defer.fail(NotImplementedError())
def _get_history(self): def _get_history(self, include_tip_info):
return defer.fail(NotImplementedError()) return defer.fail(NotImplementedError())
def _address_is_mine(self, address): def _address_is_mine(self, address):
@ -1456,8 +1456,8 @@ class LBRYumWallet(Wallet):
def get_nametrie(self): def get_nametrie(self):
return self._run_cmd_as_defer_to_thread('getclaimtrie') return self._run_cmd_as_defer_to_thread('getclaimtrie')
def _get_history(self): def _get_history(self, include_tip_info):
return self._run_cmd_as_defer_succeed('history') return self._run_cmd_as_defer_succeed('history', include_tip_info)
def _address_is_mine(self, address): def _address_is_mine(self, address):
return self._run_cmd_as_defer_succeed('ismine', address) return self._run_cmd_as_defer_succeed('ismine', address)

View file

@ -1383,9 +1383,9 @@ class Daemon(AuthJSONRPCServer):
'depth': (int) claim depth, 'depth': (int) claim depth,
'has_signature': (bool) included if decoded_claim 'has_signature': (bool) included if decoded_claim
'name': (str) claim name, 'name': (str) claim name,
'supports: (list) list of supports [{'txid': txid, 'supports: (list) list of supports [{'txid': (str) txid,
'nout': nout, 'nout': (int) nout,
'amount': amount}], 'amount': (float) amount}],
'txid': (str) claim txid, 'txid': (str) claim txid,
'nout': (str) claim nout, 'nout': (str) claim nout,
'signature_is_valid': (bool), included if has_signature, 'signature_is_valid': (bool), included if has_signature,
@ -1408,9 +1408,9 @@ class Daemon(AuthJSONRPCServer):
'has_signature': (bool) included if decoded_claim 'has_signature': (bool) included if decoded_claim
'name': (str) claim name, 'name': (str) claim name,
'channel_name': (str) channel name if claim is in a channel 'channel_name': (str) channel name if claim is in a channel
'supports: (list) list of supports [{'txid': txid, 'supports: (list) list of supports [{'txid': (str) txid,
'nout': nout, 'nout': (int) nout,
'amount': amount}] 'amount': (float) amount}]
'txid': (str) claim txid, 'txid': (str) claim txid,
'nout': (str) claim nout, 'nout': (str) claim nout,
'signature_is_valid': (bool), included if has_signature, 'signature_is_valid': (bool), included if has_signature,
@ -2048,9 +2048,9 @@ class Daemon(AuthJSONRPCServer):
'depth': (int) claim depth, 'depth': (int) claim depth,
'has_signature': (bool) included if decoded_claim 'has_signature': (bool) included if decoded_claim
'name': (str) claim name, 'name': (str) claim name,
'supports: (list) list of supports [{'txid': txid, 'supports: (list) list of supports [{'txid': (str) txid,
'nout': nout, 'nout': (int) nout,
'amount': amount}], 'amount': (float) amount}],
'txid': (str) claim txid, 'txid': (str) claim txid,
'nout': (str) claim nout, 'nout': (str) claim nout,
'signature_is_valid': (bool), included if has_signature, 'signature_is_valid': (bool), included if has_signature,
@ -2097,18 +2097,47 @@ class Daemon(AuthJSONRPCServer):
defer.returnValue(response) defer.returnValue(response)
@AuthJSONRPCServer.auth_required @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 List transactions belonging to wallet
Usage: Usage:
transaction_list transaction_list [-t]
Options:
-t : Include claim tip information
Returns: 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)) d.addCallback(lambda r: self._render_response(r))
return d return d