pagination method fixes and not showing fee for recieved TX in get_history

This commit is contained in:
Lex Berezhny 2018-10-09 14:46:44 -04:00
parent bc8251696e
commit 55bcc520e4
3 changed files with 16 additions and 11 deletions

View file

@ -1532,7 +1532,7 @@ class Daemon(AuthJSONRPCServer):
}
return {
"list": (yield self.ledger.db.get_addresses(**constraints)),
"size": (yield self.ledger.db.get_addresses_count(**constraints)),
"size": (yield self.ledger.db.get_address_count(**constraints)),
"offset": offset,
"limit": limit
}
@ -2079,7 +2079,7 @@ class Daemon(AuthJSONRPCServer):
}
return {
"list": (yield self.ledger.db.get_channels(**constraints)),
"size": (yield self.ledger.db.get_channels_count(**constraints)),
"size": (yield self.ledger.db.get_channel_count(**constraints)),
"offset": offset,
"limit": limit
}
@ -2523,7 +2523,7 @@ class Daemon(AuthJSONRPCServer):
}
return {
"list": (yield self.ledger.db.get_claims(**constraints)),
"size": (yield self.ledger.db.get_claims_count(**constraints)),
"size": (yield self.ledger.db.get_claim_count(**constraints)),
"offset": offset,
"limit": limit
}
@ -2728,7 +2728,7 @@ class Daemon(AuthJSONRPCServer):
return {
"list": (yield self.wallet_manager.get_history(
account=account, **constraints)),
"size": (yield self.ledger.db.get_transactions_count(
"size": (yield self.ledger.db.get_transaction_count(
account=account, **constraints)),
"offset": offset,
"limit": limit

View file

@ -82,7 +82,7 @@ class WalletDatabase(BaseDatabase):
self.constrain_claims(constraints)
return self.get_utxos(**constraints)
def get_claims_count(self, **constraints):
def get_claim_count(self, **constraints):
self.constrain_claims(constraints)
return self.get_utxo_count(**constraints)
@ -95,9 +95,9 @@ class WalletDatabase(BaseDatabase):
self.constrain_channels(constraints)
return self.get_claims(**constraints)
def get_channels_count(self, **constraints):
def get_channel_count(self, **constraints):
self.constrain_channels(constraints)
return self.get_claims_count(**constraints)
return self.get_claim_count(**constraints)
@defer.inlineCallbacks
def get_certificates(self, private_key_accounts, exclude_without_key=False, **constraints):

View file

@ -294,7 +294,7 @@ class LbryWalletManager(BaseWalletManager):
history = []
for tx in txs:
ts = headers[tx.height]['timestamp']
history.append({
item = {
'txid': tx.id,
'timestamp': ts,
'value': dewies_to_lbc(tx.net_account_balance),
@ -319,11 +319,11 @@ class LbryWalletManager(BaseWalletManager):
} for txo in tx.my_update_outputs],
'support_info': [{
'address': txo.get_address(account.ledger),
'balance_delta': dewies_to_lbc(-txo.amount),
'balance_delta': dewies_to_lbc(txo.amount),
'amount': dewies_to_lbc(txo.amount),
'claim_id': txo.claim_id,
'claim_name': txo.claim_name,
'is_tip': False, # TODO: need to add lookup
'is_tip': not txo.is_my_account,
'nout': txo.position
} for txo in tx.my_support_outputs],
'abandon_info': [{
@ -334,7 +334,12 @@ class LbryWalletManager(BaseWalletManager):
'claim_name': txo.claim_name,
'nout': txo.position
} for txo in tx.my_abandon_outputs],
})
}
if all([txi.txo_ref.txo is not None for txi in tx.inputs]):
item['fee'] = dewies_to_lbc(tx.fee)
else:
item['fee'] = '0' # can't calculate fee without all input txos
history.append(item)
return history
@staticmethod