mirror of
https://github.com/RoboSats/robosats.git
synced 2025-01-29 17:41:46 +00:00
Testing
This commit is contained in:
parent
6635722a96
commit
a6c2130846
@ -175,3 +175,6 @@ SLASHED_BOND_REWARD_SPLIT = 0.5
|
||||
|
||||
# Username for HTLCs escrows
|
||||
ESCROW_USERNAME = 'admin'
|
||||
|
||||
#Social
|
||||
NOSTR_NSEC = 'nsec1vxhs2zc4kqe0dhz4z2gfrdyjsrwf8pg3neeqx6w4nl8djfzdp0dqwd6rxh'
|
||||
|
11
api/nostr.py
11
api/nostr.py
@ -12,10 +12,13 @@ class Nostr:
|
||||
async def send_order_event(self, order):
|
||||
"""Creates the event and sends it to the coordinator relay"""
|
||||
|
||||
if config("NOSTR_NSEC", cast=str, default="") == "":
|
||||
return
|
||||
|
||||
print("Sending nostr event")
|
||||
|
||||
# Initialize with coordinator Keys
|
||||
keys = Keys.generate()
|
||||
keys = Keys.parse(config("NOSTR_NSEC", cast=str))
|
||||
signer = NostrSigner.keys(keys)
|
||||
client = Client(signer)
|
||||
|
||||
@ -24,6 +27,7 @@ class Nostr:
|
||||
await client.connect()
|
||||
|
||||
event = EventBuilder(38383, "", self.generate_tags(order)).to_event(keys)
|
||||
event.custom_created_at(order.created_at.timestamp())
|
||||
output = await client.send_event(event)
|
||||
print(f"Nostr event sent: {output}")
|
||||
|
||||
@ -38,7 +42,7 @@ class Nostr:
|
||||
["k", order.type.lower()],
|
||||
["f", order.currency],
|
||||
["s", self.get_status_tag(order)],
|
||||
["amt", order.last_satoshis],
|
||||
["amt", "0"],
|
||||
["fa", order.amount],
|
||||
["pm", order.payment_method.split(" ")],
|
||||
["premium", order.premium_percentile],
|
||||
@ -47,13 +51,12 @@ class Nostr:
|
||||
f"{config("HOST_NAME")}/{config("COORDINATOR_ALIAS")}/order/{order.id}",
|
||||
],
|
||||
["expiration", order.expires_at.timestamp()],
|
||||
["y", "robosats"],
|
||||
["y", "robosats", config("COORDINATOR_ALIAS", cast=str)],
|
||||
["n", order.network],
|
||||
["layer", "lightning"],
|
||||
["g", pygeohash.encode(order.latitude, order.longitude)],
|
||||
["bond", order.bond],
|
||||
["z", "order"],
|
||||
["coordinator", config("COORDINATOR_ALIAS", cast=str)],
|
||||
]
|
||||
|
||||
def get_status_tag(self, order):
|
||||
|
@ -41,7 +41,7 @@ events {
|
||||
|
||||
relay {
|
||||
# Interface to listen on. Use 0.0.0.0 to listen on all interfaces (restart required)
|
||||
bind = "127.0.0.1"
|
||||
bind = "0.0.0.0"
|
||||
|
||||
# Port to open for the nostr websocket protocol (restart required)
|
||||
port = 7777
|
||||
|
Loading…
Reference in New Issue
Block a user