mirror of
https://github.com/RoboSats/robosats.git
synced 2025-01-31 02:21:35 +00:00
Review nostr tags
This commit is contained in:
parent
af3a03c891
commit
032a48a4b2
48
api/nostr.py
48
api/nostr.py
@ -33,9 +33,7 @@ class Nostr:
|
|||||||
|
|
||||||
event = (
|
event = (
|
||||||
EventBuilder(
|
EventBuilder(
|
||||||
Kind(38383),
|
Kind(38383), "", self.generate_tags(order, robot_name, currency)
|
||||||
"",
|
|
||||||
Tag.parse(self.generate_tags(order, robot_name, currency)),
|
|
||||||
)
|
)
|
||||||
.custom_created_at(order.created_at.timestamp())
|
.custom_created_at(order.created_at.timestamp())
|
||||||
.to_event(keys)
|
.to_event(keys)
|
||||||
@ -57,29 +55,33 @@ class Nostr:
|
|||||||
).hexdigest()
|
).hexdigest()
|
||||||
|
|
||||||
tags = [
|
tags = [
|
||||||
["d", str(uuid.UUID(hashed_id))],
|
Tag.parse(["d", str(uuid.UUID(hashed_id))]),
|
||||||
["name", robot_name],
|
Tag.parse(["name", robot_name]),
|
||||||
["k", "sell" if order.type == Order.Types.SELL else "buy"],
|
Tag.parse(["k", "sell" if order.type == Order.Types.SELL else "buy"]),
|
||||||
["f", currency],
|
Tag.parse(["f", currency]),
|
||||||
["s", self.get_status_tag(order)],
|
Tag.parse(["s", self.get_status_tag(order)]),
|
||||||
["amt", "0"],
|
Tag.parse(["amt", "0"]),
|
||||||
["fa", str(order.amount)],
|
Tag.parse(["fa", str(order.amount)]),
|
||||||
["pm"] + order.payment_method.split(" "),
|
Tag.parse(["pm"] + order.payment_method.split(" ")),
|
||||||
["premium", str(order.premium)],
|
Tag.parse(["premium", str(order.premium)]),
|
||||||
[
|
Tag.parse(
|
||||||
"source",
|
[
|
||||||
f"http://{config("HOST_NAME")}/{config("COORDINATOR_ALIAS")}/order/{order.id}",
|
"source",
|
||||||
],
|
f"http://{config("HOST_NAME")}/{config("COORDINATOR_ALIAS")}/order/{order.id}",
|
||||||
["expiration", int(order.expires_at.timestamp())],
|
]
|
||||||
["y", "robosats", config("COORDINATOR_ALIAS", cast=str)],
|
),
|
||||||
["n", str(config("NETWORK"))],
|
Tag.parse(["expiration", int(order.expires_at.timestamp())]),
|
||||||
["layer"] + self.get_layer_tag(order),
|
Tag.parse(["y", "robosats", config("COORDINATOR_ALIAS", cast=str)]),
|
||||||
["bond", str(order.bond_size)],
|
Tag.parse(["n", str(config("NETWORK"))]),
|
||||||
["z", "order"],
|
Tag.parse(["layer"] + self.get_layer_tag(order)),
|
||||||
|
Tag.parse(["bond", str(order.bond_size)]),
|
||||||
|
Tag.parse(["z", "order"]),
|
||||||
]
|
]
|
||||||
print(tags)
|
print(tags)
|
||||||
if order.latitude and order.longitude:
|
if order.latitude and order.longitude:
|
||||||
tags.extend([["g", pygeohash.encode(order.latitude, order.longitude)]])
|
tags.extend(
|
||||||
|
[Tag.parse(["g", pygeohash.encode(order.latitude, order.longitude)])]
|
||||||
|
)
|
||||||
|
|
||||||
return tags
|
return tags
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user