Skip to content

Commit

Permalink
fix: keysend raw data typename
Browse files Browse the repository at this point in the history
  • Loading branch information
rolznz committed Nov 18, 2023
1 parent 4fa3cdc commit 582d602
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/lightning-address.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Data as KeySendRawData, parseKeysendResponse } from "./utils/keysend";
import { KeySendRawData, parseKeysendResponse } from "./utils/keysend";
import { isUrl, isValidAmount, parseLnUrlPayResponse } from "./utils/lnurl";
import Invoice from "./invoice";
import {
Expand Down Expand Up @@ -56,7 +56,7 @@ export default class LightningAddress {
}

getWebLN() {
return this.webln || globalThis.webln
return this.webln || globalThis.webln;
}

async fetch() {
Expand Down Expand Up @@ -182,7 +182,7 @@ export default class LightningAddress {
throw new Error("No keysendData available. Please call fetch() first.");
}
const { destination, customKey, customValue } = this.keysendData;
const webln = this.getWebLN()
const webln = this.getWebLN();
if (!webln) {
throw new Error("WebLN not available");
}
Expand Down Expand Up @@ -240,7 +240,7 @@ export default class LightningAddress {
options: ZapOptions = {},
): Promise<SendPaymentResponse> {
const invoice = this.zapInvoice(args, options);
const webln = this.getWebLN()
const webln = this.getWebLN();
if (!webln) {
throw new Error("WebLN not available");
}
Expand Down
4 changes: 2 additions & 2 deletions src/utils/keysend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ import type { KeysendResponse } from "../types";

const TAG_KEYSEND = "keysend";

export type Data = {
export type KeySendRawData = {
tag: string;
status: string;
customData: { customKey: string; customValue: string }[];
pubkey: string;
};

export const parseKeysendResponse = (data: Data): KeysendResponse => {
export const parseKeysendResponse = (data: KeySendRawData): KeysendResponse => {
if (data.tag !== TAG_KEYSEND) throw new Error("Invalid keysend params");
if (data.status !== "OK") throw new Error("Keysend status not OK");

Expand Down

0 comments on commit 582d602

Please sign in to comment.