From 582d602ed8da24d94e8be706feffb7924f149622 Mon Sep 17 00:00:00 2001 From: Roland Bewick Date: Sat, 18 Nov 2023 22:09:14 +0700 Subject: [PATCH] fix: keysend raw data typename --- src/lightning-address.ts | 8 ++++---- src/utils/keysend.ts | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/lightning-address.ts b/src/lightning-address.ts index 127bc38..02eabf1 100644 --- a/src/lightning-address.ts +++ b/src/lightning-address.ts @@ -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 { @@ -56,7 +56,7 @@ export default class LightningAddress { } getWebLN() { - return this.webln || globalThis.webln + return this.webln || globalThis.webln; } async fetch() { @@ -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"); } @@ -240,7 +240,7 @@ export default class LightningAddress { options: ZapOptions = {}, ): Promise { const invoice = this.zapInvoice(args, options); - const webln = this.getWebLN() + const webln = this.getWebLN(); if (!webln) { throw new Error("WebLN not available"); } diff --git a/src/utils/keysend.ts b/src/utils/keysend.ts index 627d403..ebde7b7 100644 --- a/src/utils/keysend.ts +++ b/src/utils/keysend.ts @@ -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");