nostrdb/block: add bolt11 invoice encoding/decoding

Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
William Casarin
2023-12-23 14:46:00 -08:00
committed by Daniel D’Aquino
parent acaf327a07
commit 373cd71f69
4 changed files with 91 additions and 1 deletions

20
nostrdb/src/invoice.h Normal file
View File

@@ -0,0 +1,20 @@
#ifndef NDB_INVOICE_H
#define NDB_INVOICE_H
struct bolt11;
struct ndb_invoice {
unsigned char version;
uint64_t amount;
uint64_t timestamp;
uint64_t expiry;
char *description;
unsigned char *description_hash;
};
// ENCODING
int ndb_encode_invoice(struct cursor *cur, struct bolt11 *invoice);
int ndb_decode_invoice(struct cursor *cur, struct ndb_invoice *invoice);
#endif /* NDB_INVOICE_H */