fix publish output
This commit is contained in:
parent
3c60b35e2e
commit
9e7b69f4a0
3 changed files with 29 additions and 8 deletions
|
@ -609,7 +609,21 @@ class Wallet(object):
|
|||
meta_for_return[k] = new_metadata[k]
|
||||
return defer.succeed(Metadata(meta_for_return))
|
||||
|
||||
"""
|
||||
Claim a name, update if name already claimed by user
|
||||
@param name: name to claim
|
||||
|
||||
@param bid: bid amount
|
||||
|
||||
@param m: metadata
|
||||
|
||||
@return: Deferred which returns a dict containing below items
|
||||
txid - txid of the resulting transaction
|
||||
nout - nout of the resulting claim
|
||||
fee - transaction fee paid to make claim
|
||||
claim_id - claim id of the claim
|
||||
|
||||
"""
|
||||
def claim_name(self, name, bid, m):
|
||||
def _save_metadata(claim_out, metadata):
|
||||
if not claim_out['success']:
|
||||
|
@ -635,6 +649,7 @@ class Wallet(object):
|
|||
lambda new_metadata: self._send_name_claim_update(name, claim['claim_id'],
|
||||
claim_outpoint,
|
||||
new_metadata, _bid))
|
||||
d.addCallback(lambda claim_out: claim_out.update({'claim_id':claim['claim_id']}))
|
||||
return d
|
||||
|
||||
meta = Metadata(m)
|
||||
|
|
|
@ -1686,7 +1686,7 @@ class Daemon(AuthJSONRPCServer):
|
|||
'txid' : txid of resulting transaction if succesful
|
||||
'nout' : nout of the resulting support claim if succesful
|
||||
'fee' : fee paid for the claim transaction if succesful
|
||||
'claimid' : claimid of the resulting transaction
|
||||
'claim_id' : claimid of the resulting transaction
|
||||
"""
|
||||
|
||||
def _set_address(address, currency, m):
|
||||
|
|
|
@ -30,6 +30,8 @@ class Publisher(object):
|
|||
self.lbry_file = None
|
||||
self.txid = None
|
||||
self.nout = None
|
||||
self.claim_id = None
|
||||
self.fee = None
|
||||
self.stream_hash = None
|
||||
# TODO: this needs to be passed into the constructor
|
||||
reflector_server = random.choice(conf.settings.reflector_servers)
|
||||
|
@ -44,6 +46,8 @@ class Publisher(object):
|
|||
out = {}
|
||||
out['nout'] = self.nout
|
||||
out['txid'] = self.txid
|
||||
out['claim_id'] = self.claim_id
|
||||
out['fee'] = self.fee
|
||||
return defer.succeed(out)
|
||||
|
||||
self.publish_name = name
|
||||
|
@ -136,15 +140,17 @@ class Publisher(object):
|
|||
self._update_metadata()
|
||||
m = Metadata(self.metadata)
|
||||
|
||||
def set_txid_nout(claim_out):
|
||||
txid = claim_out['txid']
|
||||
nout = claim_out['nout']
|
||||
log.debug('Name claimed using txid: %s, nout: %d', txid, nout)
|
||||
self.txid = txid
|
||||
self.nout = nout
|
||||
def set_claim_out(claim_out):
|
||||
log.debug('Name claimed using txid: %s, nout: %d, claim_id: %s, fee :%f',
|
||||
claim_out['txid'], claim_out['nout'],
|
||||
claim_out['claim_id'], claim_out['fee'])
|
||||
self.txid = claim_out['txid']
|
||||
self.nout = claim_out['nout']
|
||||
self.claim_id = claim_out['claim_id']
|
||||
self.fee = claim_out['fee']
|
||||
|
||||
d = self.wallet.claim_name(self.publish_name, self.bid_amount, m)
|
||||
d.addCallback(set_txid_nout)
|
||||
d.addCallback(set_claim_out)
|
||||
return d
|
||||
|
||||
def _update_metadata(self):
|
||||
|
|
Loading…
Add table
Reference in a new issue