update code to be consistent with field renames

This commit is contained in:
Jeffrey Picard 2021-07-23 10:53:04 -04:00 committed by Victor Shyba
parent 8e5b4d4b6f
commit 7834520e54

View file

@ -173,13 +173,13 @@ def paginate_list(items: List, page: Optional[int], page_size: Optional[int]):
def fix_kwargs_for_hub(**kwargs):
repeated_fields = {"name", "claim_name", "normalized", "reposted_claim_id", "_id", "public_key_hash",
repeated_fields = {"name", "claim_name", "normalized_name", "reposted_claim_id", "_id", "public_key_id",
"public_key_bytes", "signature_digest", "signature", "tx_id", "channel_id",
"fee_currency", "media_type", "stream_type", "claim_type", "description", "author", "title",
"canonical_url", "short_url", "claim_id"}
value_fields = {"offset", "limit", "has_channel_signature", "has_source", "has_no_source",
"limit_claims_per_channel", "tx_nout", "remove_duplicates",
"signature_valid", "is_controlling", "amount_order", "no_totals"}
"is_signature_valid", "is_controlling", "amount_order", "no_totals"}
ops = {'<=': 'lte', '>=': 'gte', '<': 'lt', '>': 'gt'}
for key in list(kwargs.keys()):
value = kwargs[key]
@ -191,11 +191,11 @@ def fix_kwargs_for_hub(**kwargs):
kwargs["tx_nout"] = kwargs.pop("nout")
key = "tx_nout"
if key == "valid_channel_signature":
kwargs["signature_valid"] = kwargs.pop("valid_channel_signature")
kwargs["is_signature_valid"] = kwargs.pop("valid_channel_signature")
if key == "invalid_channel_signature":
kwargs["signature_valid"] = not kwargs.pop("invalid_channel_signature")
kwargs["is_signature_valid"] = not kwargs.pop("invalid_channel_signature")
if key in {"valid_channel_signature", "invalid_channel_signature"}:
key = "signature_valid"
key = "is_signature_valid"
value = kwargs[key]
if key == "has_no_source":
kwargs["has_source"] = not kwargs.pop("has_no_source")
@ -2498,7 +2498,7 @@ class Daemon(metaclass=JSONRPCServerType):
[--new_sdk_server=<new_sdk_server>]
Options:
--name=<name> : (str) claim name (normalized)
--name=<name> : (str) claim name (normalized_name)
--text=<text> : (str) full text search
--claim_id=<claim_id> : (str) full or partial claim id
--claim_ids=<claim_ids> : (list) list of full claim ids