Skip to content

Commit f2f0c1c

Browse files
authored
Merge branch 'master' into fix/make_invoice_msat
2 parents c733b36 + c2e4762 commit f2f0c1c

File tree

5 files changed

+178
-120
lines changed

5 files changed

+178
-120
lines changed

examples/nwc/lookup-invoice.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import * as crypto from "node:crypto"; // required in node.js
2+
global.crypto = crypto; // required in node.js
3+
import "websocket-polyfill"; // required in node.js
4+
5+
import * as readline from "node:readline/promises";
6+
import { stdin as input, stdout as output } from "node:process";
7+
8+
import { webln as providers } from "../../dist/index.module.js";
9+
10+
const rl = readline.createInterface({ input, output });
11+
12+
const nwcUrl = await rl.question(
13+
"Nostr Wallet Connect URL (nostrwalletconnect://...): ",
14+
);
15+
rl.close();
16+
17+
const webln = new providers.NostrWebLNProvider({
18+
nostrWalletConnectUrl: nwcUrl,
19+
});
20+
await webln.enable();
21+
const response = await webln.lookupInvoice({
22+
// provide one of the below
23+
//invoice: 'lnbc10n1pjwxschpp5hg0pw234n9ww9q4uy25pnvu8y4jzpznysasyf7m9fka36t7fahysdqufet5xgzhv43ycn3qv4uxzmtsd3jscqzzsxqyz5vqsp5uw023qhxuxqfj69rvj9yns5gufczad5gqw4uer5cgqhw90slkavs9qyyssqvv2tw6c30ssgtpejc3zk7ns0svuj8547d8wxj0e36hltljx5a8x4qj59mk2y7qlt6qazf2j38fzc8uag3887nslxz6fe3vnyvg0f2xqqnlvcu2',
24+
payment_hash:
25+
"ba1e172a35995ce282bc22a819b3872564208a64876044fb654dbb1d2fc9edc9",
26+
});
27+
28+
console.info(response);
29+
30+
webln.close();

examples/nwc/make-invoice.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ const webln = new providers.NostrWebLNProvider({
1919
});
2020
await webln.enable();
2121
const response = await webln.makeInvoice({
22-
amount: 100,
22+
amount: 1, // in sats
2323
defaultMemo: "NWC WebLN example",
2424
});
2525

26-
console.log(response);
26+
console.info(response);
2727

2828
webln.close();

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@getalby/sdk",
3-
"version": "2.2.3",
3+
"version": "2.3.0",
44
"description": "The SDK to integrate with Nostr Wallet Connect and the Alby API",
55
"repository": "https://github.com/getAlby/js-sdk.git",
66
"bugs": "https://github.com/getAlby/js-sdk/issues",
@@ -51,7 +51,7 @@
5151
"@types/node": "^18.11.0",
5252
"@typescript-eslint/eslint-plugin": "^6.3.0",
5353
"@typescript-eslint/parser": "^6.3.0",
54-
"@webbtc/webln-types": "^1.0.11",
54+
"@webbtc/webln-types": "^2.0.0",
5555
"browserify": "^17.0.0",
5656
"eslint": "^8.46.0",
5757
"eslint-config-prettier": "^9.0.0",

0 commit comments

Comments
 (0)