Ignore unknown coin types in getCachedWalletsInfo

This commit is contained in:
tecnovert
2024-12-27 16:31:07 +02:00
parent 7ad92b1bbd
commit 54f56e0e2c
2 changed files with 64 additions and 25 deletions

View File

@@ -250,7 +250,8 @@ def js_offers(self, url_split, post_string, is_json, sent=False) -> bytes:
"is_expired": o.expire_at <= swap_client.getTime(),
"is_own_offer": o.was_sent,
"is_revoked": True if o.active_ind == 2 else False,
"is_public": o.addr_to == swap_client.network_addr or o.addr_to.strip() == "",
"is_public": o.addr_to == swap_client.network_addr
or o.addr_to.strip() == "",
}
if with_extra_info:
offer_data["amount_negotiable"] = o.amount_negotiable
@@ -660,17 +661,50 @@ def js_identities(self, url_split, post_string: str, is_json: bool) -> bytes:
address = url_split[3]
identity = swap_client.getIdentity(address)
if identity:
return bytes(json.dumps({
"label": identity.label if identity.label is not None else "",
"note": identity.note if identity.note is not None else "",
"automation_override": identity.automation_override if identity.automation_override is not None else 0,
"num_sent_bids_successful": identity.num_sent_bids_successful if identity.num_sent_bids_successful is not None else 0,
"num_recv_bids_successful": identity.num_recv_bids_successful if identity.num_recv_bids_successful is not None else 0,
"num_sent_bids_rejected": identity.num_sent_bids_rejected if identity.num_sent_bids_rejected is not None else 0,
"num_recv_bids_rejected": identity.num_recv_bids_rejected if identity.num_recv_bids_rejected is not None else 0,
"num_sent_bids_failed": identity.num_sent_bids_failed if identity.num_sent_bids_failed is not None else 0,
"num_recv_bids_failed": identity.num_recv_bids_failed if identity.num_recv_bids_failed is not None else 0
}), "UTF-8")
return bytes(
json.dumps(
{
"label": identity.label if identity.label is not None else "",
"note": identity.note if identity.note is not None else "",
"automation_override": (
identity.automation_override
if identity.automation_override is not None
else 0
),
"num_sent_bids_successful": (
identity.num_sent_bids_successful
if identity.num_sent_bids_successful is not None
else 0
),
"num_recv_bids_successful": (
identity.num_recv_bids_successful
if identity.num_recv_bids_successful is not None
else 0
),
"num_sent_bids_rejected": (
identity.num_sent_bids_rejected
if identity.num_sent_bids_rejected is not None
else 0
),
"num_recv_bids_rejected": (
identity.num_recv_bids_rejected
if identity.num_recv_bids_rejected is not None
else 0
),
"num_sent_bids_failed": (
identity.num_sent_bids_failed
if identity.num_sent_bids_failed is not None
else 0
),
"num_recv_bids_failed": (
identity.num_recv_bids_failed
if identity.num_recv_bids_failed is not None
else 0
),
}
),
"UTF-8",
)
return bytes(json.dumps({}), "UTF-8")
filters = {