From 073d1577cf6f1ecde7cef45d33912e42ac1ceb3c Mon Sep 17 00:00:00 2001 From: Roland Bewick Date: Tue, 9 Dec 2025 00:45:37 +0700 Subject: [PATCH] chore: add missing typings to hold invoice example --- examples/nwc/client/hold-invoice.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/nwc/client/hold-invoice.ts b/examples/nwc/client/hold-invoice.ts index 9eb0a939..84dba0f1 100644 --- a/examples/nwc/client/hold-invoice.ts +++ b/examples/nwc/client/hold-invoice.ts @@ -3,7 +3,7 @@ import "websocket-polyfill"; // required in node.js import * as readline from "node:readline/promises"; import { stdin as input, stdout as output } from "node:process"; -import { NWCClient } from "@getalby/sdk/nwc"; +import { Nip47Notification, NWCClient } from "@getalby/sdk/nwc"; const rl = readline.createInterface({ input, output }); @@ -21,7 +21,7 @@ const client = new NWCClient({ nostrWalletConnectUrl: nwcUrl, }); -const toHexString = (bytes) => +const toHexString = (bytes: Uint8Array) => bytes.reduce((str, byte) => str + byte.toString(16).padStart(2, "0"), ""); const preimageBytes = crypto.getRandomValues(new Uint8Array(32)); @@ -41,7 +41,7 @@ const response = await client.makeHoldInvoice({ console.info(response.invoice); -const onNotification = async (notification) => { +const onNotification = async (notification: Nip47Notification) => { if (notification.notification.payment_hash !== paymentHash) { console.info("Skipping unrelated notification", notification); return;