chore: code clean-up
This commit is contained in:
parent
accf627836
commit
482961a2ef
3 changed files with 0 additions and 8 deletions
|
|
@ -61,7 +61,6 @@ def test_decrypt_encrypt(encoded_message: str, encryption_key):
|
||||||
assert (
|
assert (
|
||||||
encoded_message == ecrypted_msg
|
encoded_message == ecrypted_msg
|
||||||
), f"expected '{encoded_message}', but got '{ecrypted_msg}'"
|
), f"expected '{encoded_message}', but got '{ecrypted_msg}'"
|
||||||
print("### test_decrypt_encrypt", encoded_message == ecrypted_msg)
|
|
||||||
|
|
||||||
|
|
||||||
ffi = FFI()
|
ffi = FFI()
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,6 @@ class NostrClient:
|
||||||
logger.info("Connected to 'nostrclient' websocket")
|
logger.info("Connected to 'nostrclient' websocket")
|
||||||
|
|
||||||
def on_message(_, message):
|
def on_message(_, message):
|
||||||
# print("### on_message", message)
|
|
||||||
self.recieve_event_queue.put_nowait(message)
|
self.recieve_event_queue.put_nowait(message)
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
|
|
@ -66,7 +65,6 @@ class NostrClient:
|
||||||
await asyncio.sleep(5)
|
await asyncio.sleep(5)
|
||||||
|
|
||||||
async def publish_nostr_event(self, e: NostrEvent):
|
async def publish_nostr_event(self, e: NostrEvent):
|
||||||
print("### publish_nostr_event", e.dict())
|
|
||||||
await self.send_req_queue.put(["EVENT", e.dict()])
|
await self.send_req_queue.put(["EVENT", e.dict()])
|
||||||
|
|
||||||
async def subscribe_to_direct_messages(self, public_key: str, since: int):
|
async def subscribe_to_direct_messages(self, public_key: str, since: int):
|
||||||
|
|
@ -75,8 +73,6 @@ class NostrClient:
|
||||||
if since != 0:
|
if since != 0:
|
||||||
in_messages_filter["since"] = since
|
in_messages_filter["since"] = since
|
||||||
out_messages_filter["since"] = since
|
out_messages_filter["since"] = since
|
||||||
print("### in_messages_filter", in_messages_filter)
|
|
||||||
print("### out_messages_filter", out_messages_filter)
|
|
||||||
|
|
||||||
await self.send_req_queue.put(
|
await self.send_req_queue.put(
|
||||||
["REQ", f"direct-messages-in:{public_key}", in_messages_filter]
|
["REQ", f"direct-messages-in:{public_key}", in_messages_filter]
|
||||||
|
|
|
||||||
|
|
@ -191,7 +191,6 @@ async def process_nostr_message(msg: str):
|
||||||
await _handle_nip04_message(merchant_public_key, event)
|
await _handle_nip04_message(merchant_public_key, event)
|
||||||
return
|
return
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
print("####### bad message", msg)
|
|
||||||
logger.warning(ex)
|
logger.warning(ex)
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -199,7 +198,6 @@ async def _handle_nip04_message(merchant_public_key: str, event: NostrEvent):
|
||||||
merchant = await get_merchant_by_pubkey(merchant_public_key)
|
merchant = await get_merchant_by_pubkey(merchant_public_key)
|
||||||
assert merchant, f"Merchant not found for public key '{merchant_public_key}'"
|
assert merchant, f"Merchant not found for public key '{merchant_public_key}'"
|
||||||
|
|
||||||
# print("### clear_text_msg", subscription_name, clear_text_msg)
|
|
||||||
if event.pubkey == merchant_public_key:
|
if event.pubkey == merchant_public_key:
|
||||||
assert len(event.tag_values("p")) != 0, "Outgong message has no 'p' tag"
|
assert len(event.tag_values("p")) != 0, "Outgong message has no 'p' tag"
|
||||||
clear_text_msg = merchant.decrypt_message(
|
clear_text_msg = merchant.decrypt_message(
|
||||||
|
|
@ -260,7 +258,6 @@ async def _handle_dirrect_message(
|
||||||
order["event_created_at"] = event_created_at
|
order["event_created_at"] = event_created_at
|
||||||
return await _handle_new_order(PartialOrder(**order))
|
return await _handle_new_order(PartialOrder(**order))
|
||||||
else:
|
else:
|
||||||
# print("### text_msg", text_msg, event_created_at, event_id)
|
|
||||||
dm = PartialDirectMessage(
|
dm = PartialDirectMessage(
|
||||||
event_id=event_id,
|
event_id=event_id,
|
||||||
event_created_at=event_created_at,
|
event_created_at=event_created_at,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue