@@ -25,7 +25,7 @@ import {
25
25
LookupInvoiceResponse ,
26
26
} from "@webbtc/webln-types" ;
27
27
import { GetInfoResponse } from "@webbtc/webln-types" ;
28
- import { GetNWCAuthorizationUrlOptions } from "../types" ;
28
+ import { NWCAuthorizationUrlOptions } from "../types" ;
29
29
30
30
const NWCs : Record < string , NostrWebLNOptions > = {
31
31
alby : {
@@ -439,13 +439,13 @@ export class NostrWebLNProvider implements WebLNProvider, Nip07Provider {
439
439
throw new Error ( "Method not implemented." ) ;
440
440
}
441
441
442
- getAuthorizationUrl ( options ?: GetNWCAuthorizationUrlOptions ) {
442
+ getAuthorizationUrl ( options ?: NWCAuthorizationUrlOptions ) {
443
443
if ( ! this . options . authorizationUrl ) {
444
444
throw new Error ( "Missing authorizationUrl option" ) ;
445
445
}
446
446
const url = new URL ( this . options . authorizationUrl ) ;
447
447
if ( options ?. name ) {
448
- url . searchParams . set ( "c " , options ?. name ) ;
448
+ url . searchParams . set ( "name " , options ?. name ) ;
449
449
}
450
450
url . searchParams . set ( "pubkey" , this . publicKey ) ;
451
451
if ( options ?. returnTo ) {
@@ -468,10 +468,14 @@ export class NostrWebLNProvider implements WebLNProvider, Nip07Provider {
468
468
url . searchParams . set ( "editable" , options . editable . toString ( ) ) ;
469
469
}
470
470
471
+ if ( options ?. requestMethods ) {
472
+ url . searchParams . set ( "request_methods" , options . requestMethods . join ( " " ) ) ;
473
+ }
474
+
471
475
return url ;
472
476
}
473
477
474
- initNWC ( options : GetNWCAuthorizationUrlOptions = { } ) {
478
+ initNWC ( options : NWCAuthorizationUrlOptions = { } ) {
475
479
// here we assume an browser context and window/document is available
476
480
// we set the location.host as a default name if none is given
477
481
if ( ! options . name ) {
@@ -585,13 +589,14 @@ export class NostrWebLNProvider implements WebLNProvider, Nip07Provider {
585
589
const replyTimeoutCheck = setTimeout ( replyTimeout , 60000 ) ;
586
590
587
591
sub . on ( "event" , async ( event ) => {
588
- //console.log(`Received reply event: `, event);
592
+ // console.log(`Received reply event: `, event);
589
593
clearTimeout ( replyTimeoutCheck ) ;
590
594
sub . unsub ( ) ;
591
595
const decryptedContent = await this . decrypt (
592
596
this . walletPubkey ,
593
597
event . content ,
594
598
) ;
599
+ // console.log(`Decrypted content: `, decryptedContent);
595
600
let response ;
596
601
try {
597
602
response = JSON . parse ( decryptedContent ) ;
0 commit comments