feat: add basic NIP20 response

This commit is contained in:
Vlad Stan 2023-01-31 12:36:59 +02:00
parent 30150c4561
commit fbae6d6c88
2 changed files with 28 additions and 15 deletions

View file

@ -62,6 +62,10 @@ class NostrEvent(BaseModel):
if not valid_signature:
raise ValueError(f"Invalid signature: '{self.sig}' for event '{self.id}'")
def serialize_response(self, subscription_id):
return [NostrEventType.EVENT, subscription_id, dict(self)]
@classmethod
def from_row(cls, row: Row) -> "NostrEvent":
return cls(**dict(row))