Skip to content

Commit

Permalink
chore: add separate nwc client example for installation
Browse files Browse the repository at this point in the history
  • Loading branch information
im-adithya committed Jul 10, 2024
1 parent f92613d commit 5e1abf7
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ or for use without any build tools:

```html
<script type="module">
import { webln } from "https://esm.sh/@getalby/[email protected]"; // jsdelivr.net, skypack.dev also work
import { nwc } from "https://esm.sh/@getalby/[email protected]"; // jsdelivr.net, skypack.dev also work
(async () => {
const client = new nwc.NWCClient({
Expand All @@ -29,16 +29,24 @@ or for use without any build tools:
const balanceResponse = await client.getBalance();
console.log("Wallet balance", balanceResponse.balance);
client.close();
})();
</script>
```

Alternatively, use `NostrWebLNProvider`

// Alternatively, use NostrWebLNProvider
```html
<script type="module">
import { webln } from "https://esm.sh/@getalby/[email protected]"; // jsdelivr.net, skypack.dev also work
// const nwc = new webln.NostrWebLNProvider({
// nostrWalletConnectUrl: YOUR_NWC_URL,
// });
// await nwc.enable();
// const balanceResponse = await nwc.getBalance();
// console.log("Wallet balance", balanceResponse.balance);
// nwc.close();
(async () => {
const nwc = new webln.NostrWebLNProvider({
nostrWalletConnectUrl: YOUR_NWC_URL,
});
await nwc.enable();
const balanceResponse = await nwc.getBalance();
console.log("Wallet balance", balanceResponse.balance);
nwc.close();
})();
</script>
```
Expand Down

0 comments on commit 5e1abf7

Please sign in to comment.