@@ -36,8 +36,18 @@ const NWCs: Record<string, NostrWebLNOptions> = {
36
36
} ,
37
37
} ;
38
38
39
- // TODO: move to webln-types package
40
- export interface ListTransactionsArgs {
39
+ // TODO: review fields (replace with camelCase) and consider move to webln-types package
40
+ export type Transaction = Nip47Transaction ;
41
+
42
+ // TODO: consider moving to webln-types package
43
+ export type ListTransactionsResponse = {
44
+ transactions : Transaction [ ] ;
45
+ } ;
46
+
47
+ // TODO: consider moving to webln-types package
48
+ export type ListTransactionsArgs = Nip47ListTransactionsArgs ;
49
+
50
+ interface Nip47ListTransactionsArgs {
41
51
from ?: number ;
42
52
until ?: number ;
43
53
limit ?: number ;
@@ -46,8 +56,11 @@ export interface ListTransactionsArgs {
46
56
type ?: "incoming" | "outgoing" ;
47
57
}
48
58
49
- // TODO: move to webln-types package
50
- export interface Transaction {
59
+ type Nip47ListTransactionsResponse = {
60
+ transactions : Nip47Transaction [ ] ;
61
+ } ;
62
+
63
+ type Nip47Transaction = {
51
64
type : string ;
52
65
invoice : string ;
53
66
description : string ;
@@ -60,12 +73,7 @@ export interface Transaction {
60
73
created_at : number ;
61
74
expires_at : number ;
62
75
metadata ?: Record < string , unknown > ;
63
- }
64
-
65
- // TODO: move to webln-types package
66
- export interface ListTransactionsResponse {
67
- transactions : Transaction [ ] ;
68
- }
76
+ } ;
69
77
70
78
interface NostrWebLNOptions {
71
79
authorizationUrl ?: string ; // the URL to the NWC interface for the user to confirm the session
@@ -89,11 +97,6 @@ type Nip47GetInfoResponse = {
89
97
methods : string [ ] ;
90
98
} ;
91
99
92
- type Nip47ListTransactionsResponse = {
93
- transactions : Nip47Transaction [ ] ;
94
- } ;
95
- type Nip47Transaction = Transaction ;
96
-
97
100
type Nip47PayResponse = {
98
101
preimage : string ;
99
102
} ;
@@ -392,9 +395,13 @@ export class NostrWebLNProvider implements WebLNProvider, Nip07Provider {
392
395
393
396
return this . executeNip47Request < LookupInvoiceResponse , Nip47Transaction > (
394
397
"lookup_invoice" ,
395
- args ,
398
+ {
399
+ invoice : args . paymentRequest ,
400
+ payment_hash : args . paymentHash ,
401
+ } ,
396
402
( result ) => ! ! result . invoice ,
397
403
( result ) => ( {
404
+ preimage : result . preimage ,
398
405
paymentRequest : result . invoice ,
399
406
paid : ! ! result . settled_at ,
400
407
} ) ,
0 commit comments