Nostr WoT

Pay invoices and send zaps

Pay invoices and send zaps

Use @nostr-wot/wallet for WebLN zaps, NWC connections and zap receipt validation. The example sends 21 sats to a Lightning Address after WebLN permission, LNURL discovery and signing a kind-9734 zap request.

terminal
$npm install @nostr-wot/wallet@2.0.0 nostr-wot-sdk@3.0.0 nostr-tools

Example

typescript
import { isWebLNAvailable, zapViaWebLN } from "@nostr-wot/wallet";
import { Nip07Signer } from "nostr-wot-sdk/signers";

// Run once after the user confirms recipient and amount.
export async function sendZap(recipientPubkey: string, lightningAddress: string) {
  if (!isWebLNAvailable()) throw new Error("Connect a WebLN wallet first");
  await zapViaWebLN({
    signer: new Nip07Signer(), recipientPubkey,
    recipientLud16: lightningAddress, amountSats: 21,
    relays: ["wss://nos.lol"],
  });
}

Integration notes

Use a real recipient public key and their Lightning Address. Disable the send control while pending. A timeout does not prove payment failed: check wallet history before retrying. NWC connection URIs contain credentials; keep them out of logs, public URLs and analytics. WebLN wallet permission is separate from Nostr signing permission.

Package reference and additional options