Some NIP fixes

This commit is contained in:
koalasat 2024-07-21 19:59:30 +02:00
parent 9b7240e3dd
commit c28ba4afc8
No known key found for this signature in database
GPG Key ID: 2F7F61C6146AB157

View File

@ -36,7 +36,7 @@ class Nostr:
f"{config("COORDINATOR_ALIAS", cast=str)}{order.id}".encode("utf-8") f"{config("COORDINATOR_ALIAS", cast=str)}{order.id}".encode("utf-8")
).hexdigest() ).hexdigest()
return [ tags = [
["d", uuid.UUID(hashed_id)], ["d", uuid.UUID(hashed_id)],
["name", order.maker.robot_name], ["name", order.maker.robot_name],
["k", order.type.lower()], ["k", order.type.lower()],
@ -45,7 +45,7 @@ class Nostr:
["amt", "0"], ["amt", "0"],
["fa", order.amount], ["fa", order.amount],
["pm", order.payment_method.split(" ")], ["pm", order.payment_method.split(" ")],
["premium", order.premium_percentile], ["premium", order.premium_percentile * 100],
[ [
"source", "source",
f"{config("HOST_NAME")}/{config("COORDINATOR_ALIAS")}/order/{order.id}", f"{config("HOST_NAME")}/{config("COORDINATOR_ALIAS")}/order/{order.id}",
@ -54,11 +54,15 @@ class Nostr:
["y", "robosats", config("COORDINATOR_ALIAS", cast=str)], ["y", "robosats", config("COORDINATOR_ALIAS", cast=str)],
["n", order.network], ["n", order.network],
["layer", self.get_layer_tag(order)], ["layer", self.get_layer_tag(order)],
["g", pygeohash.encode(order.latitude, order.longitude)],
["bond", order.bond], ["bond", order.bond],
["z", "order"], ["z", "order"],
] ]
if order.latitude and order.longitude:
tags.extend([["g", pygeohash.encode(order.latitude, order.longitude)]])
return tags
def get_status_tag(self, order): def get_status_tag(self, order):
if order.status == Order.Status.PUB: if order.status == Order.Status.PUB:
return "pending" return "pending"