4#include "ArduinoJson.h"
11#include <initializer_list>
40 std::vector<TLVRecords>
tlv;
187 const std::vector<TLVRecords> &tlv);
188 SignedNostrEvent
multiPayKeySend(std::initializer_list<KeySend> keySends);
189 SignedNostrEvent
multiPayKeySend(
const std::vector<KeySend> &keySends);
193 SignedNostrEvent
listTransactions(
unsigned long from = 0,
unsigned long until = 0,
int limit = 0,
int offset = 0,
bool unpaid =
false,
NostrString type =
"");
197 void parseResponse(SignedNostrEvent *response, Nip47Response<PayInvoiceResponse> &out);
198 void parseResponse(SignedNostrEvent *response, Nip47Response<MultiPayInvoiceResponse> &out);
199 void parseResponse(SignedNostrEvent *response, Nip47Response<PayKeySendResponse> &out);
200 void parseResponse(SignedNostrEvent *response, Nip47Response<MultiPayKeySendResponse> &out);
201 void parseResponse(SignedNostrEvent *response, Nip47Response<MakeInvoiceResponse> &out);
202 void parseResponse(SignedNostrEvent *response, Nip47Response<LookUpInvoiceResponse> &out);
203 void parseResponse(SignedNostrEvent *response, Nip47Response<ListTransactionsResponse> &out);
204 void parseResponse(SignedNostrEvent *response, Nip47Response<GetBalanceResponse> &out);
205 void parseResponse(SignedNostrEvent *response, Nip47Response<GetInfoResponse> &out);
206 void parseResponse(SignedNostrEvent *response, Nip47Response<NotificationResponse> &out);
215 bool includeEncryptionTag =
false;
216 SignedNostrEvent createEvent(
NostrString method, JsonDocument doc);
219 bool parseResponseEnvelope(SignedNostrEvent *response,
const char *expectedResultType,
220 JsonDocument &document, JsonObjectConst &result,
#define NostrString
Definition NostrString.h:10
NostrString errorMessage
Definition Nip47.h:50
Nip47Response(NostrString errorCode, NostrString errorMessage, NostrString resultType, T result)
Definition Nip47.h:48
T result
Definition Nip47.h:52
Nip47Response()
Definition Nip47.h:46
NostrString errorCode
Definition Nip47.h:49
NostrString resultType
Definition Nip47.h:51
SignedNostrEvent makeInvoice(MilliSats amount, NostrString description="", NostrString descriptionHash="", unsigned long expiry=0)
Definition Nip47.cpp:180
SignedNostrEvent getBalance()
Definition Nip47.cpp:211
static bool parseNWC(NostrString, NWCData &)
Definition Nip47.cpp:565
void parseResponse(SignedNostrEvent *response, Nip47Response< PayInvoiceResponse > &out)
Definition Nip47.cpp:323
SignedNostrEvent multiPayKeySend(std::initializer_list< KeySend > keySends)
Definition Nip47.cpp:269
SignedNostrEvent lookUpPaymentHash(NostrString paymentHash)
Definition Nip47.cpp:197
SignedNostrEvent multiPayInvoice(std::initializer_list< Invoice > invoices)
Definition Nip47.cpp:223
SignedNostrEvent lookUpInvoice(NostrString invoice)
Definition Nip47.cpp:204
Nip47Encryption getEncryption() const
Definition Nip47.h:181
Nip47()
Definition Nip47.h:178
SignedNostrEvent payKeySend(NostrString pubkey, MilliSats amount, NostrString preimage="", std::initializer_list< TLVRecords > tlv={})
Definition Nip47.cpp:244
void setEncryption(Nip47Encryption encryption, bool includeEncryptionTag=true)
Definition Nip47.cpp:104
SignedNostrEvent listTransactions(unsigned long from=0, unsigned long until=0, int limit=0, int offset=0, bool unpaid=false, NostrString type="")
Definition Nip47.cpp:301
SignedNostrEvent payInvoice(NostrString invoice, MilliSats amount=MILLISATS_UNSPECIFIED)
Definition Nip47.cpp:169
SignedNostrEvent getInfo()
Definition Nip47.cpp:217
Nip47(Nip04 nip04, NostrString servicePubKey, NostrString userPrivKey)
Definition Nip47.h:179
Definition NostrEvent.h:130
Definition CryptoLock.h:6
struct nostr::s_MultiPayInvoiceResponse MultiPayInvoiceResponse
struct nostr::s_KeySend KeySend
struct nostr::s_Transaction Transaction
struct nostr::s_GetBalanceResponse GetBalanceResponse
struct nostr::s_ListTransactionsResponse ListTransactionsResponse
struct nostr::s_PayKeySendResponse PayKeySendResponse
struct nostr::s_MakeInvoiceResponse MakeInvoiceResponse
struct nostr::s_LookUpInvoiceResponse LookUpInvoiceResponse
Nip47Encryption
Definition Nip47.h:15
struct nostr::s_PayInvoiceResponse PayInvoiceResponse
struct nostr::s_Invoice Invoice
int64_t MilliSats
Definition NostrAmount.h:26
struct nostr::s_NWCData NWCData
struct nostr::s_TLVRecords TLVRecords
struct nostr::s_Nip47Notification Nip47Notification
struct nostr::s_NotificationResponse NotificationResponse
struct nostr::s_GetInfoResponse GetInfoResponse
struct nostr::s_MultiPayKeySendResponse MultiPayKeySendResponse
MilliSats balance
Definition Nip47.h:131
NostrString blockHash
Definition Nip47.h:140
unsigned long long blockHeight
Definition Nip47.h:139
NostrString alias
Definition Nip47.h:135
NostrString pubkey
Definition Nip47.h:137
NostrString color
Definition Nip47.h:136
std::vector< NostrString > notifications
Definition Nip47.h:142
std::vector< NostrString > methods
Definition Nip47.h:141
std::vector< NostrString > extensions
Definition Nip47.h:143
NostrString network
Definition Nip47.h:138
NostrString invoice
Definition Nip47.h:21
NostrString id
Definition Nip47.h:23
MilliSats amount
Definition Nip47.h:22
s_Invoice(NostrString invoice, MilliSats amount=MILLISATS_UNSPECIFIED, NostrString id="")
Definition Nip47.h:26
s_Invoice()
Definition Nip47.h:25
NostrString preimage
Definition Nip47.h:39
std::vector< TLVRecords > tlv
Definition Nip47.h:40
MilliSats amount
Definition Nip47.h:38
NostrString id
Definition Nip47.h:41
NostrString pubkey
Definition Nip47.h:37
std::vector< Transaction > transactions
Definition Nip47.h:127
NostrString state
Definition Nip47.h:93
unsigned long long createdAt
Definition Nip47.h:101
unsigned long long settledAt
Definition Nip47.h:103
NostrString paymentHash
Definition Nip47.h:98
NostrString type
Definition Nip47.h:92
NostrString description
Definition Nip47.h:95
JsonDocument metadata
Definition Nip47.h:105
MilliSats feesPaid
Definition Nip47.h:100
MilliSats amount
Definition Nip47.h:99
unsigned long long expiresAt
Definition Nip47.h:102
NostrString descriptionHash
Definition Nip47.h:96
NostrString preimage
Definition Nip47.h:97
NostrString invoice
Definition Nip47.h:94
unsigned long long expiresAt
Definition Nip47.h:87
MilliSats amount
Definition Nip47.h:84
NostrString type
Definition Nip47.h:77
NostrString preimage
Definition Nip47.h:82
NostrString state
Definition Nip47.h:78
MilliSats feesPaid
Definition Nip47.h:85
NostrString paymentHash
Definition Nip47.h:83
NostrString invoice
Definition Nip47.h:79
NostrString description
Definition Nip47.h:80
NostrString descriptionHash
Definition Nip47.h:81
unsigned long long createdAt
Definition Nip47.h:86
JsonDocument metadata
Definition Nip47.h:88
NostrString d
Definition Nip47.h:62
NostrString preimage
Definition Nip47.h:61
NostrString d
Definition Nip47.h:72
NostrString preimage
Definition Nip47.h:71
std::vector< NostrString > relays
Definition Nip47.h:148
NostrString pubkey
Definition Nip47.h:149
NostrString relay
Definition Nip47.h:147
NostrString secret
Definition Nip47.h:150
JsonDocument metadata
Definition Nip47.h:168
NostrString description
Definition Nip47.h:159
unsigned long long createdAt
Definition Nip47.h:165
NostrString state
Definition Nip47.h:157
NostrString preimage
Definition Nip47.h:161
NostrString paymentHash
Definition Nip47.h:162
unsigned long long settledAt
Definition Nip47.h:167
NostrString invoice
Definition Nip47.h:158
NostrString descriptionHash
Definition Nip47.h:160
NostrString notificationType
Definition Nip47.h:155
MilliSats feesPaid
Definition Nip47.h:164
NostrString type
Definition Nip47.h:156
unsigned long long expiresAt
Definition Nip47.h:166
MilliSats amount
Definition Nip47.h:163
Nip47Notification notification
Definition Nip47.h:172
MilliSats feesPaid
Definition Nip47.h:57
NostrString preimage
Definition Nip47.h:56
NostrString preimage
Definition Nip47.h:66
MilliSats feesPaid
Definition Nip47.h:67
NostrString value
Definition Nip47.h:33
uint64_t type
Definition Nip47.h:32
MilliSats feesPaid
Definition Nip47.h:117
NostrString state
Definition Nip47.h:110
unsigned long long expiresAt
Definition Nip47.h:119
MilliSats amount
Definition Nip47.h:116
NostrString type
Definition Nip47.h:109
NostrString description
Definition Nip47.h:112
NostrString descriptionHash
Definition Nip47.h:113
NostrString paymentHash
Definition Nip47.h:115
unsigned long long createdAt
Definition Nip47.h:118
NostrString preimage
Definition Nip47.h:114
JsonDocument metadata
Definition Nip47.h:122
unsigned long long settledAt
Definition Nip47.h:120
NostrString invoice
Definition Nip47.h:111