diff --git a/src/NWCClient.test.ts b/src/NWCClient.test.ts index c63dd2f..10206a6 100644 --- a/src/NWCClient.test.ts +++ b/src/NWCClient.test.ts @@ -42,3 +42,17 @@ describe("parseWalletConnectUrl", () => { expect(parsed.relayUrl).toBe("wss://relay.getalby.com/v1"); }); }); + +describe("NWCClient", () => { + test("standard protocol", () => { + const nwcClient = new NWCClient({ nostrWalletConnectUrl: exampleNwcUrl }); + expect(nwcClient.walletPubkey).toBe( + "69effe7b49a6dd5cf525bd0905917a5005ffe480b58eeb8e861418cf3ae760d9", + ); + expect(nwcClient.secret).toBe( + "e839faf78693765b3833027fefa5a305c78f6965d0a5d2e47a3fcb25aa7cc45b", + ); + expect(nwcClient.lud16).toBe("hello@getalby.com"); + expect(nwcClient.options.lud16).toBe("hello@getalby.com"); + }); +}); diff --git a/src/NWCClient.ts b/src/NWCClient.ts index e56d7b7..929238b 100644 --- a/src/NWCClient.ts +++ b/src/NWCClient.ts @@ -204,6 +204,7 @@ export class NWCClient { relay: Relay; relayUrl: string; secret: string | undefined; + lud16: string | undefined; walletPubkey: string; options: NWCOptions; @@ -264,6 +265,7 @@ export class NWCClient { : this.options.secret ) as string; } + this.lud16 = this.options.lud16; this.walletPubkey = ( this.options.walletPubkey.toLowerCase().startsWith("npub") ? nip19.decode(this.options.walletPubkey).data