add claim field containing a Claim to File api responses

This commit is contained in:
Jack Robison 2019-06-11 13:57:37 -04:00
parent 399ac561c4
commit 69e7566eaa
No known key found for this signature in database
GPG key ID: DF25C68FE0239BB2
2 changed files with 6 additions and 0 deletions

View file

@ -94,6 +94,7 @@ def encode_file_doc():
'txid': '(str) None if claim is not found else the transaction id',
'nout': '(int) None if claim is not found else the transaction output index',
'outpoint': '(str) None if claim is not found else the tx and output',
'claim': '(Claim) None if claim is not found',
'metadata': '(dict) None if claim is not found else the claim metadata',
'protobuf': '(str) hex encoded Stream protobuf',
'channel_claim_id': '(str) None if claim is not found or not signed',
@ -276,6 +277,7 @@ class JSONResponseEncoder(JSONEncoder):
'txid': managed_stream.txid,
'nout': managed_stream.nout,
'outpoint': managed_stream.outpoint,
'claim': managed_stream.claim,
'metadata': managed_stream.metadata,
'protobuf': managed_stream.metadata_protobuf,
'channel_claim_id': managed_stream.channel_claim_id,

View file

@ -166,6 +166,10 @@ class ManagedStream:
def claim_name(self) -> typing.Optional[str]:
return None if not self.stream_claim_info else self.stream_claim_info.claim_name
@property
def claim(self) -> typing.Optional['Claim']:
return None if not self.stream_claim_info else self.stream_claim_info.claim
@property
def metadata(self) -> typing.Optional[typing.Dict]:
return None if not self.stream_claim_info else self.stream_claim_info.claim.stream.to_dict()