Skip to content

Latest commit

 

History

History
39 lines (29 loc) · 682 Bytes

README.md

File metadata and controls

39 lines (29 loc) · 682 Bytes

nutjar.js

The easiest way to receive permissionless Lightning donations on a website!

Usage

Check out dev.ts for a full example

import { Nutjar } from "./src/main";

const jar = new Nutjar(
  "https://testnut.cashu.space",
  "npub1mhcr4j594hsrnen594d7700n2t03n8gdx83zhxzculk6sh9nhwlq7uc226",
  ["wss://relay.damus.io"],
);

jar.tip(21, "Test tip!", {
  onInvoice: (i) => {
    console.log(i);
  },
  onSuccess: () => {
    console.log("Donation sent!");
  },
  onError: (e: Error) => {
    console.error(e);
  },
});

Installation

nutjar can be installed using a package manager or by loading the bundled version from a CDN

npm

npm i nutjar