Skip to content

Commit

Permalink
feat: split nwc client from nostr webln provider (WIP)
Browse files Browse the repository at this point in the history
rolznz committed Feb 4, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent dc6faf8 commit 4593715
Showing 4 changed files with 993 additions and 666 deletions.
24 changes: 24 additions & 0 deletions examples/nwc/client/get-info.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import * as crypto from "node:crypto"; // required in node.js
global.crypto = crypto; // required in node.js
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 { nwc } from "../../../dist/index.module.js";

const rl = readline.createInterface({ input, output });

const nwcUrl =
process.env.NWC_URL ||
(await rl.question("Nostr Wallet Connect URL (nostr+walletconnect://...): "));
rl.close();

const client = new nwc.NWCClient({
nostrWalletConnectUrl: nwcUrl,
});
const response = await client.getInfo();

console.info(response);

client.close();
767 changes: 767 additions & 0 deletions src/NWCClient.ts

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -2,3 +2,4 @@ export * as auth from "./auth";
export * as types from "./types";
export * as webln from "./webln";
export { Client } from "./client";
export * as nwc from "./NWCClient";
867 changes: 201 additions & 666 deletions src/webln/NostrWeblnProvider.ts

Large diffs are not rendered by default.

0 comments on commit 4593715

Please sign in to comment.