Skip to content

Commit

Permalink
chore: add check for webln in boost
Browse files Browse the repository at this point in the history
  • Loading branch information
im-adithya committed Oct 19, 2023
1 parent ff0c032 commit 0e9ad9e
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/lightning-address.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,10 @@ export default class LightningAddress {
throw new Error("No keysendData available. Please call fetch() first.");
}
const { destination, customKey, customValue } = this.keysendData;
const webln = this.getWebLN()
if (!webln) {
throw new Error("WebLN not available");
}
return booster(
{
destination,
Expand All @@ -189,9 +193,7 @@ export default class LightningAddress {
amount,
boost,
},
{
webln: this.getWebLN(),
},
{ webln },
);
}

Expand Down Expand Up @@ -239,7 +241,6 @@ export default class LightningAddress {
const invoice = this.zapInvoice(args, options);
const webln = this.getWebLN()
if (!webln) {
// mainly for TS
throw new Error("WebLN not available");
}
await webln.enable();
Expand Down

0 comments on commit 0e9ad9e

Please sign in to comment.