forked from LBRYCommunity/lbry-sdk
Review Fixes
This commit is contained in:
parent
2878716381
commit
e47ef741f7
3 changed files with 20 additions and 10 deletions
|
@ -1080,7 +1080,7 @@ class Daemon(AuthJSONRPCServer):
|
|||
result = yield self.wallet_manager.send_points_to_address(reserved_points, amount)
|
||||
self.analytics_manager.send_credits_sent()
|
||||
else:
|
||||
log.info("This command is deprecated for sending tips, please use the newer tip_claim command")
|
||||
log.info("This command is deprecated for sending tips, please use the newer claim_tip command")
|
||||
result = yield self.jsonrpc_claim_tip(claim_id, amount)
|
||||
return result
|
||||
|
||||
|
@ -2392,6 +2392,7 @@ class Daemon(AuthJSONRPCServer):
|
|||
}
|
||||
"""
|
||||
|
||||
account = self.default_account
|
||||
if account_id is not None:
|
||||
account = self.get_account_or_error("account_id", account_id, lbc_only=True)
|
||||
|
||||
|
@ -2404,7 +2405,7 @@ class Daemon(AuthJSONRPCServer):
|
|||
@defer.inlineCallbacks
|
||||
def jsonrpc_claim_tip(self, claim_id, amount, account_id=None):
|
||||
"""
|
||||
Tip a claim
|
||||
Tip the owner of the claim
|
||||
|
||||
Usage:
|
||||
claim_tip (<claim_id> | --claim_id=<claim_id>) (<amount> | --amount=<amount>) [--account_id=<account_id>]
|
||||
|
@ -2427,6 +2428,7 @@ class Daemon(AuthJSONRPCServer):
|
|||
}
|
||||
"""
|
||||
|
||||
account = self.default_account
|
||||
if account_id is not None:
|
||||
account = self.get_account_or_error("account_id", account_id, lbc_only=True)
|
||||
|
||||
|
|
|
@ -246,18 +246,14 @@ class LbryWalletManager(BaseWalletManager):
|
|||
}
|
||||
|
||||
@defer.inlineCallbacks
|
||||
def support_claim(self, claim_name, claim_id, amount, account=None):
|
||||
if account is None:
|
||||
account = self.default_account
|
||||
def support_claim(self, claim_name, claim_id, amount, account):
|
||||
holding_address = yield account.receiving.get_or_create_usable_address()
|
||||
tx = yield Transaction.support(claim_name, claim_id, amount, holding_address, [account], account)
|
||||
yield account.ledger.broadcast(tx)
|
||||
return tx
|
||||
|
||||
@defer.inlineCallbacks
|
||||
def tip_claim(self, amount, claim_id, account=None):
|
||||
if account is None:
|
||||
account = self.default_account
|
||||
def tip_claim(self, amount, claim_id, account):
|
||||
claim_to_tip = yield self.get_claim_by_claim_id(claim_id)
|
||||
tx = yield Transaction.support(
|
||||
claim_to_tip['name'], claim_id, amount, claim_to_tip['address'], [account], account
|
||||
|
|
|
@ -350,7 +350,7 @@ class EpicAdventuresOfChris45(CommandTestCase):
|
|||
# And voila, and bravo and encore! His Best Friend Ramsey read the story and immediately knew this was a hit
|
||||
# Now to keep this claim winning on the lbry blockchain he immediately supports the claim
|
||||
tx = yield self.out(self.daemon.jsonrpc_claim_new_support(
|
||||
'fresh-start', claim3['claim_id'], '0.2', account_id=ramsey_account_id
|
||||
'fresh-start', claim3['claim_id'], 0.2, account_id=ramsey_account_id
|
||||
))
|
||||
yield self.d_confirm_tx(tx['txid'])
|
||||
|
||||
|
@ -364,7 +364,7 @@ class EpicAdventuresOfChris45(CommandTestCase):
|
|||
# Now he also wanted to support the original creator of the Award Winning Novel
|
||||
# So he quickly decides to send a tip to him
|
||||
tx = yield self.out(
|
||||
self.daemon.jsonrpc_claim_tip(claim3['claim_id'], '0.3', account_id=ramsey_account_id))
|
||||
self.daemon.jsonrpc_claim_tip(claim3['claim_id'], 0.3, account_id=ramsey_account_id))
|
||||
yield self.d_confirm_tx(tx['txid'])
|
||||
|
||||
# And again checks if it went to the just right place
|
||||
|
@ -372,6 +372,18 @@ class EpicAdventuresOfChris45(CommandTestCase):
|
|||
# Which it obviously did. Because....?????
|
||||
self.assertEqual(resolve_result[uri]['claim']['supports'][1]['amount'], 0.3)
|
||||
self.assertEqual(resolve_result[uri]['claim']['supports'][1]['txid'], tx['txid'])
|
||||
yield self.d_generate(5)
|
||||
|
||||
# Seeing the ravishing success of his novel Chris adds support to his claim too
|
||||
tx = yield self.out(self.daemon.jsonrpc_claim_new_support('fresh-start', claim3['claim_id'], 0.4))
|
||||
yield self.d_confirm_tx(tx['txid'])
|
||||
|
||||
# And check if his support showed up
|
||||
resolve_result = yield self.out(self.daemon.jsonrpc_resolve(uri=uri))
|
||||
# It did!
|
||||
self.assertEqual(resolve_result[uri]['claim']['supports'][2]['amount'], 0.4)
|
||||
self.assertEqual(resolve_result[uri]['claim']['supports'][2]['txid'], tx['txid'])
|
||||
yield self.d_generate(5)
|
||||
|
||||
|
||||
class AccountManagement(CommandTestCase):
|
||||
|
|
Loading…
Reference in a new issue