-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
112 additions
and
18 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 |
---|---|---|
|
@@ -12,21 +12,19 @@ const rl = readline.createInterface({ input, output }); | |
const nwcUrl = | ||
process.env.NWC_URL || | ||
(await rl.question("Nostr Wallet Connect URL (nostr+walletconnect://...): ")); | ||
const destination = | ||
(await rl.question("Enter destination pubkey: ")) || | ||
"030a58b8653d32b99200a2334cfe913e51dc7d155aa0116c176657a4f1722677a3"; | ||
const amount = await rl.question("Enter amount: "); | ||
|
||
rl.close(); | ||
|
||
const webln = new providers.NostrWebLNProvider({ | ||
nostrWalletConnectUrl: nwcUrl, | ||
}); | ||
await webln.enable(); | ||
const response = await webln.keysend({ | ||
amount, | ||
destination, | ||
amount: 1, | ||
destination: | ||
"030a58b8653d32b99200a2334cfe913e51dc7d155aa0116c176657a4f1722677a3", | ||
customRecords: { | ||
696969: "1KOZHzhLs2U7JIx3BmEY", | ||
696969: "017rsl75kNnSke4mMHYE", // [email protected] | ||
}, | ||
}); | ||
|
||
|
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 |
---|---|---|
@@ -0,0 +1,48 @@ | ||
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 { webln as providers } 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 webln = new providers.NostrWebLNProvider({ | ||
nostrWalletConnectUrl: nwcUrl, | ||
}); | ||
await webln.enable(); | ||
|
||
const keysends = [ | ||
{ | ||
destination: | ||
"030a58b8653d32b99200a2334cfe913e51dc7d155aa0116c176657a4f1722677a3", | ||
amount: 1, | ||
customRecords: { | ||
696969: "017rsl75kNnSke4mMHYE", // [email protected] | ||
}, | ||
}, | ||
{ | ||
destination: | ||
"030a58b8653d32b99200a2334cfe913e51dc7d155aa0116c176657a4f1722677a3", | ||
amount: 1, | ||
customRecords: { | ||
696969: "1KOZHzhLs2U7JIx3BmEY", // another Alby account | ||
}, | ||
}, | ||
]; | ||
|
||
try { | ||
const response = await webln.multiKeysend(keysends); | ||
console.info(response); | ||
} catch (error) { | ||
console.error("multiKeysend failed", error); | ||
} | ||
|
||
webln.close(); |
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