@getalby/lightning-tools
Version:
Collection of helpful building blocks and tools to develop Bitcoin Lightning web apps
33 lines (30 loc) • 933 B
JavaScript
;
const sendBoostagram = async (args, options) => {
const { boost } = args;
if (!options) {
options = {};
}
const webln = options.webln || globalThis.webln;
if (!webln) {
throw new Error("WebLN not available");
}
if (!webln.keysend) {
throw new Error("Keysend not available in current WebLN provider");
}
const amount = args.amount || Math.floor(boost.value_msat / 1000);
const weblnParams = {
destination: args.destination,
amount: amount,
customRecords: {
"7629169": JSON.stringify(boost),
},
};
if (args.customKey && args.customValue) {
weblnParams.customRecords[args.customKey] = args.customValue;
}
await webln.enable();
const response = await webln.keysend(weblnParams);
return response;
};
exports.sendBoostagram = sendBoostagram;
//# sourceMappingURL=podcasting2.cjs.map