Skip to content

Commit

Permalink
Review nostr tags
Browse files Browse the repository at this point in the history
  • Loading branch information
KoalaSat committed Aug 7, 2024
1 parent 3b81b96 commit b515c4e
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions api/nostr.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ async def send_order_event(self, order):
def get_robot_name(self, order):
return order.maker.username

@sync_to_async
def get_robot_currency(self, order):
return order.currency

def generate_tags(self, order, robot_name):
hashed_id = hashlib.md5(
f"{config("COORDINATOR_ALIAS", cast=str)}{order.id}".encode("utf-8")
Expand All @@ -50,21 +54,21 @@ def generate_tags(self, order, robot_name):
["d", uuid.UUID(hashed_id)],
["name", robot_name],
["k", "sell" if order.type == Order.Types.SELL else "buy"],
["f", order.currency],
["f", self.get_robot_currency(order)],
["s", self.get_status_tag(order)],
["amt", "0"],
["fa", order.amount],
["pm", order.payment_method.split(" ")],
["premium", order.premium_percentile * 100],
["premium", order.premium * 100],
[
"source",
f"{config("HOST_NAME")}/{config("COORDINATOR_ALIAS")}/order/{order.id}",
],
["expiration", order.expires_at.timestamp()],
["y", "robosats", config("COORDINATOR_ALIAS", cast=str)],
["n", order.network],
["n", str(config("NETWORK"))],
["layer", self.get_layer_tag(order)],
["bond", order.bond],
["bond", order.bond_size],
["z", "order"],
]

Expand Down

0 comments on commit b515c4e

Please sign in to comment.