-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add separate nwc client example for installation
- Loading branch information
1 parent
f92613d
commit 5e1abf7
Showing
1 changed file
with
17 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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({ | ||
|
@@ -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> | ||
``` | ||
|