From 79d2333cc77567f34e9e208e6b7667ac56a56f92 Mon Sep 17 00:00:00 2001 From: Pablo Fernandez Date: Wed, 31 Jul 2024 10:12:40 +0100 Subject: [PATCH] lint --- docs/internals/subscriptions.md | 2 +- ndk/src/cache/index.ts | 2 +- ndk/src/dvm/schedule.ts | 4 ++-- ndk/src/events/fetch-tagged-event.ts | 6 ++--- ndk/src/events/kinds/article.ts | 2 +- ndk/src/events/kinds/drafts.ts | 9 +++---- ndk/src/events/kinds/dvm/request.ts | 7 +++--- ndk/src/events/kinds/nutzap/mint-list.ts | 5 ++-- ndk/src/events/kinds/simple-group/index.ts | 11 +++++---- .../events/kinds/simple-group/member-list.ts | 11 +++++---- .../events/kinds/simple-group/meta-data.ts | 5 ++-- ndk/src/events/kinds/subscriptions/amount.ts | 2 +- ndk/src/events/kinds/subscriptions/receipt.ts | 7 +++--- .../kinds/subscriptions/subscription-start.ts | 8 ++++--- ndk/src/events/kinds/subscriptions/tier.ts | 5 ++-- ndk/src/events/kinds/video.ts | 7 +++--- ndk/src/events/signature.ts | 4 ++-- ndk/src/ndk/active-user.ts | 12 +++++----- ndk/src/ndk/fetch-event-from-tag.test.ts | 3 ++- ndk/src/ndk/fetch-event-from-tag.ts | 24 +++++++++---------- ndk/src/ndk/index.ts | 17 +++++++------ ndk/src/nwc/get_info.ts | 2 +- ndk/src/outbox/index.ts | 6 ++--- ndk/src/outbox/read/with-authors.ts | 4 ++-- ndk/src/outbox/relay-ranking.ts | 6 ++--- ndk/src/outbox/tracker.ts | 4 ++-- ndk/src/outbox/write.ts | 4 ++-- ndk/src/relay/connectivity.ts | 2 +- ndk/src/relay/index.ts | 6 ++--- ndk/src/relay/pool/index.ts | 2 +- ndk/src/relay/sets/calculate.test.ts | 11 +++++---- ndk/src/relay/sets/calculate.ts | 2 +- ndk/src/relay/sub-manager.ts | 11 +++++---- ndk/src/relay/subscription.test.ts | 3 ++- ndk/src/relay/subscription.ts | 15 +++++++----- ndk/src/signers/index.ts | 4 ++-- ndk/src/signers/nip07/index.ts | 2 +- ndk/src/signers/nip46/index.ts | 5 ++-- ndk/src/subscription/index.ts | 7 +++--- ndk/src/subscription/manager.ts | 8 +++---- ndk/src/subscription/utils.ts | 4 ++-- ndk/src/thread/index.test.ts | 3 ++- ndk/src/thread/index.ts | 6 ++--- ndk/src/user/index.ts | 5 ++-- ndk/src/user/nip05.ts | 3 ++- ndk/src/user/pin.ts | 5 ++-- ndk/src/utils/get-users-relay-list.ts | 8 +++---- ndk/src/zap/index.test.ts | 4 ++-- ndk/src/zap/index.ts | 4 ++-- ndk/src/zapper/index.test.ts | 7 +++--- ndk/src/zapper/index.ts | 13 ++++++---- ndk/src/zapper/ln.ts | 4 ++-- 52 files changed, 177 insertions(+), 146 deletions(-) diff --git a/docs/internals/subscriptions.md b/docs/internals/subscriptions.md index cb7bb210..c07e5d95 100644 --- a/docs/internals/subscriptions.md +++ b/docs/internals/subscriptions.md @@ -39,7 +39,7 @@ This is an important aspect to consider: > `NDKSubscription` have a different lifecycle than `NDKRelaySubscription`. For example, a subscription that is set to close after EOSE might still be active within the `NDKSubscription` lifecycle, but it might have been already been closed within the `NDKRelaySubscription` lifecycle. ## NDKRelaySubscription -Most NDK subscriptions (at least by default) are set to be executed with a grouping delay. Will cover what this looks like in practice later, but for now, let's understand than when the `NDKRelaySubscriptionManager` receives an order, it might not execute it right away. +Most NDK subscriptions (by default) are set to be executed with a grouping delay. Will cover what this looks like in practice later, but for now, let's understand than when the `NDKRelaySubscriptionManager` receives an order, it might not execute it right away. Once the filter is executed diff --git a/ndk/src/cache/index.ts b/ndk/src/cache/index.ts index 4f198eca..69d1e594 100644 --- a/ndk/src/cache/index.ts +++ b/ndk/src/cache/index.ts @@ -3,7 +3,7 @@ import type { NDKRelay } from "../relay/index.js"; import type { NDKFilter, NDKSubscription } from "../subscription/index.js"; import type { Hexpubkey, ProfilePointer } from "../user/index.js"; import type { NDKUserProfile } from "../user/profile.js"; -import { NDKLnUrlData } from "../zapper/index.js"; +import type { NDKLnUrlData } from "../zapper/index.js"; export interface NDKCacheAdapter { /** diff --git a/ndk/src/dvm/schedule.ts b/ndk/src/dvm/schedule.ts index 01d7d6fb..6821581f 100644 --- a/ndk/src/dvm/schedule.ts +++ b/ndk/src/dvm/schedule.ts @@ -1,7 +1,7 @@ -import { NDKEvent, NostrEvent } from "../events"; +import type { NDKEvent, NostrEvent } from "../events"; import { type NDKUser } from "../user"; import { NDKKind } from "../events/kinds"; -import { NDKSubscription } from "../subscription"; +import type { NDKSubscription } from "../subscription"; import { NDKDVMRequest } from "../events/kinds/dvm/request"; import { NDKDVMJobFeedback } from "../events/kinds/dvm"; diff --git a/ndk/src/events/fetch-tagged-event.ts b/ndk/src/events/fetch-tagged-event.ts index 9affa2b3..66cfa8fa 100644 --- a/ndk/src/events/fetch-tagged-event.ts +++ b/ndk/src/events/fetch-tagged-event.ts @@ -1,5 +1,5 @@ -import { NDKEvent } from "."; -import { NDKSubscriptionOptions } from "../subscription"; +import type { NDKEvent } from "."; +import type { NDKSubscriptionOptions } from "../subscription"; import { getReplyTag, getRootTag } from "../thread"; export async function fetchTaggedEvent( @@ -18,7 +18,7 @@ export async function fetchTaggedEvent( let relay; //= hint !== "" ? this.ndk.pool.getRelay(hint) : undefined; // if we have a relay, attempt to use that first - let event = await this.ndk.fetchEvent(id, {}, relay); + const event = await this.ndk.fetchEvent(id, {}, relay); return event; } diff --git a/ndk/src/events/kinds/article.ts b/ndk/src/events/kinds/article.ts index 673945df..e68cc69b 100644 --- a/ndk/src/events/kinds/article.ts +++ b/ndk/src/events/kinds/article.ts @@ -1,5 +1,5 @@ import type { NDK } from "../../ndk/index.js"; -import { ContentTag } from "../content-tagger.js"; +import type { ContentTag } from "../content-tagger.js"; import { NDKEvent, type NostrEvent } from "../index.js"; import { NDKKind } from "./index.js"; diff --git a/ndk/src/events/kinds/drafts.ts b/ndk/src/events/kinds/drafts.ts index 4504b15f..8bb03891 100644 --- a/ndk/src/events/kinds/drafts.ts +++ b/ndk/src/events/kinds/drafts.ts @@ -1,7 +1,8 @@ -import { NDK } from "../../ndk/index.js"; -import { NDKRelaySet } from "../../relay/sets/index.js"; -import { NDKSigner } from "../../signers/index.js"; -import { NDKEvent, NostrEvent } from "../index.js"; +import type { NDK } from "../../ndk/index.js"; +import type { NDKRelaySet } from "../../relay/sets/index.js"; +import type { NDKSigner } from "../../signers/index.js"; +import type { NostrEvent } from "../index.js"; +import { NDKEvent } from "../index.js"; import { NDKKind } from "./index.js"; /** diff --git a/ndk/src/events/kinds/dvm/request.ts b/ndk/src/events/kinds/dvm/request.ts index 58a9f199..c7d462a5 100644 --- a/ndk/src/events/kinds/dvm/request.ts +++ b/ndk/src/events/kinds/dvm/request.ts @@ -1,9 +1,10 @@ import type { NDK } from "../../../ndk/index.js"; -import { NDKSigner } from "../../../signers/index.js"; -import { NDKUser } from "../../../user/index.js"; +import type { NDKSigner } from "../../../signers/index.js"; +import type { NDKUser } from "../../../user/index.js"; import type { NDKTag, NostrEvent } from "../../index.js"; import { NDKEvent } from "../../index.js"; -import { NDKDVMJobFeedback, NDKDvmJobFeedbackStatus } from "./feedback.js"; +import type { NDKDvmJobFeedbackStatus } from "./feedback.js"; +import { NDKDVMJobFeedback } from "./feedback.js"; // import type { NDKDvmJobFeedbackStatus } from "./NDKDVMJobFeedback.js"; // import { NDKDVMJobFeedback } from "./NDKDVMJobFeedback.js"; // import { NDKDVMJobResult } from "./NDKDVMJobResult.js"; diff --git a/ndk/src/events/kinds/nutzap/mint-list.ts b/ndk/src/events/kinds/nutzap/mint-list.ts index e1b1f802..005cb5a5 100644 --- a/ndk/src/events/kinds/nutzap/mint-list.ts +++ b/ndk/src/events/kinds/nutzap/mint-list.ts @@ -1,6 +1,7 @@ -import { NDK } from "../../../ndk/index.js"; +import type { NDK } from "../../../ndk/index.js"; import { NDKRelaySet } from "../../../relay/sets/index.js"; -import { NDKEvent, NostrEvent } from "../../index.js"; +import type { NostrEvent } from "../../index.js"; +import { NDKEvent } from "../../index.js"; import { NDKKind } from "../index.js"; export class NDKCashuMintList extends NDKEvent { diff --git a/ndk/src/events/kinds/simple-group/index.ts b/ndk/src/events/kinds/simple-group/index.ts index d9acdd8e..737ff5a2 100644 --- a/ndk/src/events/kinds/simple-group/index.ts +++ b/ndk/src/events/kinds/simple-group/index.ts @@ -1,9 +1,10 @@ import { NDKKind } from ".."; -import { NDKEvent, NDKTag, NostrEvent } from "../.."; -import { NDK } from "../../../ndk"; -import { NDKRelaySet } from "../../../relay/sets"; -import { NDKSigner } from "../../../signers"; -import { Hexpubkey, NDKUser } from "../../../user"; +import type { NDKTag, NostrEvent } from "../.."; +import { NDKEvent } from "../.."; +import type { NDK } from "../../../ndk"; +import type { NDKRelaySet } from "../../../relay/sets"; +import type { NDKSigner } from "../../../signers"; +import type { Hexpubkey, NDKUser } from "../../../user"; import { NDKSimpleGroupMemberList } from "./member-list"; import { NDKSimpleGroupMetadata } from "./meta-data"; diff --git a/ndk/src/events/kinds/simple-group/member-list.ts b/ndk/src/events/kinds/simple-group/member-list.ts index c5c46aa1..4dbdc92f 100644 --- a/ndk/src/events/kinds/simple-group/member-list.ts +++ b/ndk/src/events/kinds/simple-group/member-list.ts @@ -1,9 +1,10 @@ import { NDKKind } from "../index.js"; -import { NDKEvent, NostrEvent } from "../../index.js"; -import { NDK } from "../../../ndk/index.js"; -import { NDKRelaySet } from "../../../relay/sets/index.js"; -import { NDKRelay } from "../../../relay/index.js"; -import { Hexpubkey } from "../../../user/index.js"; +import type { NostrEvent } from "../../index.js"; +import { NDKEvent } from "../../index.js"; +import type { NDK } from "../../../ndk/index.js"; +import type { NDKRelaySet } from "../../../relay/sets/index.js"; +import type { NDKRelay } from "../../../relay/index.js"; +import type { Hexpubkey } from "../../../user/index.js"; export class NDKSimpleGroupMemberList extends NDKEvent { public relaySet: NDKRelaySet | undefined; diff --git a/ndk/src/events/kinds/simple-group/meta-data.ts b/ndk/src/events/kinds/simple-group/meta-data.ts index 13be6e9e..ad832f5e 100644 --- a/ndk/src/events/kinds/simple-group/meta-data.ts +++ b/ndk/src/events/kinds/simple-group/meta-data.ts @@ -1,6 +1,7 @@ import { NDKKind } from "../index.js"; -import { NDKEvent, NostrEvent } from "../../index.js"; -import { NDK } from "../../../ndk/index.js"; +import type { NostrEvent } from "../../index.js"; +import { NDKEvent } from "../../index.js"; +import type { NDK } from "../../../ndk/index.js"; export class NDKSimpleGroupMetadata extends NDKEvent { static kind = NDKKind.GroupMetadata; diff --git a/ndk/src/events/kinds/subscriptions/amount.ts b/ndk/src/events/kinds/subscriptions/amount.ts index 83ce90fd..ca9e96b8 100644 --- a/ndk/src/events/kinds/subscriptions/amount.ts +++ b/ndk/src/events/kinds/subscriptions/amount.ts @@ -1,4 +1,4 @@ -import { NDKTag } from "../.."; +import type { NDKTag } from "../.."; export type NDKIntervalFrequency = "daily" | "weekly" | "monthly" | "quarterly" | "yearly"; diff --git a/ndk/src/events/kinds/subscriptions/receipt.ts b/ndk/src/events/kinds/subscriptions/receipt.ts index 52fbd5f5..127ca19f 100644 --- a/ndk/src/events/kinds/subscriptions/receipt.ts +++ b/ndk/src/events/kinds/subscriptions/receipt.ts @@ -1,8 +1,9 @@ import debug from "debug"; import { NDKKind } from ".."; -import { NDKEvent, NDKTag, NostrEvent } from "../.."; -import { NDK } from "../../../ndk"; -import { NDKSubscriptionStart } from "./subscription-start"; +import type { NostrEvent } from "../.."; +import { NDKEvent, NDKTag } from "../.."; +import type { NDK } from "../../../ndk"; +import type { NDKSubscriptionStart } from "./subscription-start"; import { NDKUser } from "../../../user"; type ValidPeriod = { start: Date; end: Date }; diff --git a/ndk/src/events/kinds/subscriptions/subscription-start.ts b/ndk/src/events/kinds/subscriptions/subscription-start.ts index fa837004..5d7e73fe 100644 --- a/ndk/src/events/kinds/subscriptions/subscription-start.ts +++ b/ndk/src/events/kinds/subscriptions/subscription-start.ts @@ -1,9 +1,11 @@ import debug from "debug"; import { NDKKind } from ".."; -import { NDKEvent, NostrEvent } from "../.."; -import { NDK } from "../../../ndk"; +import type { NostrEvent } from "../.."; +import { NDKEvent } from "../.."; +import type { NDK } from "../../../ndk"; import { NDKUser } from "../../../user"; -import { NDKSubscriptionAmount, newAmount, parseTagToSubscriptionAmount } from "./amount.js"; +import type { NDKSubscriptionAmount} from "./amount.js"; +import { newAmount, parseTagToSubscriptionAmount } from "./amount.js"; import { NDKSubscriptionTier } from "./tier"; /** diff --git a/ndk/src/events/kinds/subscriptions/tier.ts b/ndk/src/events/kinds/subscriptions/tier.ts index 6297e098..73c0846c 100644 --- a/ndk/src/events/kinds/subscriptions/tier.ts +++ b/ndk/src/events/kinds/subscriptions/tier.ts @@ -3,9 +3,10 @@ import { type NostrEvent } from "../../index.js"; import type { NDKEvent, NDKTag } from "../../index.js"; import { NDKKind } from "../index.js"; import { NDKArticle } from "../article.js"; -import { +import type { NDKIntervalFrequency, - NDKSubscriptionAmount, + NDKSubscriptionAmount} from "./amount.js"; +import { newAmount, parseTagToSubscriptionAmount, } from "./amount.js"; diff --git a/ndk/src/events/kinds/video.ts b/ndk/src/events/kinds/video.ts index 6627ad19..f231415c 100644 --- a/ndk/src/events/kinds/video.ts +++ b/ndk/src/events/kinds/video.ts @@ -1,7 +1,8 @@ import { NDKKind } from "."; -import { NDKEvent, NostrEvent } from ".."; -import { NDK } from "../../ndk"; -import { ContentTag } from "../content-tagger"; +import type { NostrEvent } from ".."; +import { NDKEvent } from ".."; +import type { NDK } from "../../ndk"; +import type { ContentTag } from "../content-tagger"; /** * Represents a horizontal or vertical video. diff --git a/ndk/src/events/signature.ts b/ndk/src/events/signature.ts index df8edbf5..abdd37fc 100644 --- a/ndk/src/events/signature.ts +++ b/ndk/src/events/signature.ts @@ -1,8 +1,8 @@ -import { NDKEvent, NDKEventId } from "./index.js"; +import type { NDKEvent, NDKEventId } from "./index.js"; let worker: Worker | undefined; -let processingQueue: Record< +const processingQueue: Record< NDKEventId, { event: NDKEvent; resolves: ((result: boolean) => void)[] } > = {}; diff --git a/ndk/src/ndk/active-user.ts b/ndk/src/ndk/active-user.ts index e72a701c..3d6cccdc 100644 --- a/ndk/src/ndk/active-user.ts +++ b/ndk/src/ndk/active-user.ts @@ -1,10 +1,10 @@ -import { NDK } from "./index.js"; -import { NDKRelayList } from "../events/kinds/NDKRelayList.js"; -import { NDKUser } from "../user/index.js"; +import type { NDK } from "./index.js"; +import type { NDKRelayList } from "../events/kinds/NDKRelayList.js"; +import type { NDKUser } from "../user/index.js"; import createDebug from "debug"; -import { NDKFilter } from "../subscription/index.js"; +import type { NDKFilter } from "../subscription/index.js"; import { NDKKind } from "../events/kinds/index.js"; -import { NDKEvent } from "../events/index.js"; +import type { NDKEvent } from "../events/index.js"; import NDKList from "../events/kinds/lists/index.js"; import { NDKRelay } from "../relay/index.js"; import { getRelayListForUser } from "../utils/get-users-relay-list.js"; @@ -63,7 +63,7 @@ async function setActiveUserConnected(this: NDK, user: NDKUser) { false ); - let events: Map = new Map(); + const events: Map = new Map(); // Collect most recent version of these events sub.on("event", (event) => { diff --git a/ndk/src/ndk/fetch-event-from-tag.test.ts b/ndk/src/ndk/fetch-event-from-tag.test.ts index 40800637..bb833ee7 100644 --- a/ndk/src/ndk/fetch-event-from-tag.test.ts +++ b/ndk/src/ndk/fetch-event-from-tag.test.ts @@ -1,6 +1,7 @@ import { NDK } from "."; import { NDKEvent } from "../events"; -import { NDKSubscriptionCacheUsage, NDKSubscriptionOptions } from "../subscription"; +import type { NDKSubscriptionOptions } from "../subscription"; +import { NDKSubscriptionCacheUsage } from "../subscription"; const ndk = new NDK(); diff --git a/ndk/src/ndk/fetch-event-from-tag.ts b/ndk/src/ndk/fetch-event-from-tag.ts index e000525c..5a8cf2f4 100644 --- a/ndk/src/ndk/fetch-event-from-tag.ts +++ b/ndk/src/ndk/fetch-event-from-tag.ts @@ -1,9 +1,9 @@ -import { NDK } from "."; -import { NDKEvent, NDKTag } from "../events"; +import type { NDK } from "."; +import type { NDKEvent, NDKTag } from "../events"; import { getRelaysForSync } from "../outbox/write"; import { NDKRelaySet } from "../relay/sets"; import { calculateRelaySetsFromFilters } from "../relay/sets/calculate"; -import { NDKSubscriptionOptions } from "../subscription"; +import type { NDKSubscriptionOptions } from "../subscription"; /** * Options on how to handle when a relay hint doesn't respond @@ -93,7 +93,7 @@ export async function fetchEventFromTag( if (authorRelays && authorRelays.size > 0) { d("fetching event from author relays %o", Array.from(authorRelays)); const relaySet = NDKRelaySet.fromRelayUrls(Array.from(authorRelays), this); - let event = await this.fetchEvent(id, subOpts, relaySet); + const event = await this.fetchEvent(id, subOpts, relaySet); if (event) return event; } else { d("no author relays found for %s", originalEvent.pubkey, originalEvent); @@ -102,12 +102,12 @@ export async function fetchEventFromTag( // Attempt without relay hint on whatever NDK calculates const relaySet = calculateRelaySetsFromFilters(this, [{ ids: [id] }], this.pool); d("fetching event without relay hint", relaySet); - let event = await this.fetchEvent(id, subOpts); + const event = await this.fetchEvent(id, subOpts); if (event) return event; // If we didn't get the event, try to fetch in the relay hint if (hint && hint !== "") { - let event = await this.fetchEvent( + const event = await this.fetchEvent( id, subOpts, this.pool.getRelay(hint, true, true, [{ ids: [id] }]) @@ -117,7 +117,7 @@ export async function fetchEventFromTag( let result: NDKEvent | null | undefined = undefined; - let relay = isValidHint(hint) + const relay = isValidHint(hint) ? this.pool.getRelay(hint, false, true, [{ ids: [id] }]) : undefined; @@ -133,11 +133,11 @@ export async function fetchEventFromTag( /** * Fallback fetch promise. */ - let fallbackFetchPromise = new Promise(async (resolve) => { - let fallbackRelaySet = fallback.relaySet; + const fallbackFetchPromise = new Promise(async (resolve) => { + const fallbackRelaySet = fallback.relaySet; - let timeout = fallback.timeout ?? 1500; - let timeoutPromise = new Promise((resolve) => setTimeout(resolve, timeout)); + const timeout = fallback.timeout ?? 1500; + const timeoutPromise = new Promise((resolve) => setTimeout(resolve, timeout)); // if this is a timeout fallback, we need to wait for the timeout to resolve if (fallback.type === "timeout") await timeoutPromise; @@ -146,7 +146,7 @@ export async function fetchEventFromTag( resolve(result); } else { d("fallback fetch triggered"); - let fallbackEvent = await this.fetchEvent(id, subOpts, fallbackRelaySet); + const fallbackEvent = await this.fetchEvent(id, subOpts, fallbackRelaySet); resolve(fallbackEvent); } }); diff --git a/ndk/src/ndk/index.ts b/ndk/src/ndk/index.ts index 1a8d0f11..9125608d 100644 --- a/ndk/src/ndk/index.ts +++ b/ndk/src/ndk/index.ts @@ -3,11 +3,13 @@ import { EventEmitter } from "tseep"; import type { NDKCacheAdapter } from "../cache/index.js"; import dedupEvent from "../events/dedup.js"; -import { NDKEvent, NDKEventId, NDKTag } from "../events/index.js"; +import type { NDKEventId, NDKTag } from "../events/index.js"; +import { NDKEvent } from "../events/index.js"; import { OutboxTracker } from "../outbox/tracker.js"; import { NDKRelay } from "../relay/index.js"; import { NDKPool } from "../relay/pool/index.js"; -import { NDKRelaySet, NDKPublishError } from "../relay/sets/index.js"; +import type { NDKPublishError } from "../relay/sets/index.js"; +import { NDKRelaySet } from "../relay/sets/index.js"; import { correctRelaySet } from "../relay/sets/utils.js"; import type { NDKSigner } from "../signers/index.js"; import type { NDKFilter, NDKSubscriptionOptions } from "../subscription/index.js"; @@ -16,22 +18,23 @@ import { filterFromId, isNip33AValue, relaysFromBech32 } from "../subscription/u import type { Hexpubkey, NDKUserParams, ProfilePointer } from "../user/index.js"; import { NDKUser } from "../user/index.js"; import { fetchEventFromTag } from "./fetch-event-from-tag.js"; -import { NDKAuthPolicy } from "../relay/auth-policies.js"; +import type { NDKAuthPolicy } from "../relay/auth-policies.js"; import { Nip96 } from "../media/index.js"; import { NDKNwc } from "../nwc/index.js"; import { Queue } from "./queue/index.js"; import { signatureVerificationInit } from "../events/signature.js"; import { NDKSubscriptionManager } from "../subscription/manager.js"; import { setActiveUser } from "./active-user.js"; -import { +import type { LnPaymentInfo, NDKLnUrlData, NDKZapConfirmation, NDKZapDetails, - NDKZapper, - NutPaymentInfo, + NutPaymentInfo} from "../zapper/index.js"; +import { + NDKZapper } from "../zapper/index.js"; -import { NostrEvent } from "nostr-tools"; +import type { NostrEvent } from "nostr-tools"; export type NDKValidationRatioFn = ( relay: NDKRelay, diff --git a/ndk/src/nwc/get_info.ts b/ndk/src/nwc/get_info.ts index 04def932..305a241f 100644 --- a/ndk/src/nwc/get_info.ts +++ b/ndk/src/nwc/get_info.ts @@ -1,4 +1,4 @@ -import { NDKNWcCommands, NDKNwc, NDKNwcResponse } from "."; +import type { NDKNWcCommands, NDKNwc, NDKNwcResponse } from "."; export interface GetInfoResponse { alias?: string; diff --git a/ndk/src/outbox/index.ts b/ndk/src/outbox/index.ts index 647c9580..740ae800 100644 --- a/ndk/src/outbox/index.ts +++ b/ndk/src/outbox/index.ts @@ -1,6 +1,6 @@ -import { NDK } from "../ndk"; -import { NDKRelay } from "../relay"; -import { Hexpubkey } from "../user"; +import type { NDK } from "../ndk"; +import type { NDKRelay } from "../relay"; +import type { Hexpubkey } from "../user"; import { getTopRelaysForAuthors } from "./relay-ranking"; import { getRelaysForSync } from "./write"; diff --git a/ndk/src/outbox/read/with-authors.ts b/ndk/src/outbox/read/with-authors.ts index ba5646ab..a77fcb13 100644 --- a/ndk/src/outbox/read/with-authors.ts +++ b/ndk/src/outbox/read/with-authors.ts @@ -1,8 +1,8 @@ import { chooseRelayCombinationForPubkeys, getAllRelaysForAllPubkeys } from ".."; -import { NDK } from "../../ndk"; +import type { NDK } from "../../ndk"; import { NDKRelay } from "../../relay"; import { NDKPool } from "../../relay/pool"; -import { Hexpubkey } from "../../user"; +import type { Hexpubkey } from "../../user"; import { getTopRelaysForAuthors } from "../relay-ranking"; import { getWriteRelaysFor, getRelaysForSync } from "../write"; diff --git a/ndk/src/outbox/relay-ranking.ts b/ndk/src/outbox/relay-ranking.ts index 4e263fe2..bd85de00 100644 --- a/ndk/src/outbox/relay-ranking.ts +++ b/ndk/src/outbox/relay-ranking.ts @@ -1,5 +1,5 @@ -import { NDK } from "../ndk"; -import { Hexpubkey } from "../user"; +import type { NDK } from "../ndk"; +import type { Hexpubkey } from "../user"; import { getRelaysForSync } from "./write"; export function getTopRelaysForAuthors(ndk: NDK, authors: Hexpubkey[]): WebSocket["url"][] { @@ -21,7 +21,7 @@ export function getTopRelaysForAuthors(ndk: NDK, authors: Hexpubkey[]): WebSocke */ // Sort the relays by the number of authors that write to them - let sortedRelays = Array.from(relaysWithCount.entries()).sort((a, b) => b[1] - a[1]); + const sortedRelays = Array.from(relaysWithCount.entries()).sort((a, b) => b[1] - a[1]); return sortedRelays.map((entry) => entry[0]); } diff --git a/ndk/src/outbox/tracker.ts b/ndk/src/outbox/tracker.ts index 503df9ca..fb109de3 100644 --- a/ndk/src/outbox/tracker.ts +++ b/ndk/src/outbox/tracker.ts @@ -1,7 +1,7 @@ import { EventEmitter } from "tseep"; import { LRUCache } from "typescript-lru-cache"; -import { NDKRelayList } from "../events/kinds/NDKRelayList.js"; +import type { NDKRelayList } from "../events/kinds/NDKRelayList.js"; import { getRelayListForUsers } from "../utils/get-users-relay-list.js"; import type { NDK } from "../ndk/index.js"; import type { Hexpubkey } from "../user/index.js"; @@ -75,7 +75,7 @@ export class OutboxTracker extends EventEmitter { for (let i = 0; i < items.length; i += 400) { const slice = items.slice(i, i + 400); - let pubkeys = slice + const pubkeys = slice .map((item) => getKeyFromItem(item)) .filter((pubkey) => !this.data.has(pubkey)); // filter out items that are already being tracked diff --git a/ndk/src/outbox/write.ts b/ndk/src/outbox/write.ts index f4a95307..64824f47 100644 --- a/ndk/src/outbox/write.ts +++ b/ndk/src/outbox/write.ts @@ -1,5 +1,5 @@ -import { NDK } from "../ndk"; -import { Hexpubkey } from "../user"; +import type { NDK } from "../ndk"; +import type { Hexpubkey } from "../user"; /** * Gets write relays for a given pubkey as tracked by the outbox tracker. diff --git a/ndk/src/relay/connectivity.ts b/ndk/src/relay/connectivity.ts index 11b49848..59645899 100644 --- a/ndk/src/relay/connectivity.ts +++ b/ndk/src/relay/connectivity.ts @@ -5,7 +5,7 @@ import type { NDK } from "../ndk/index.js"; import type { NostrEvent } from "../events/index.js"; import type { NDKFilter } from "../subscription"; import { NDKKind } from "../events/kinds"; -import { NDKRelaySubscription } from "./subscription"; +import type { NDKRelaySubscription } from "./subscription"; const MAX_RECONNECT_ATTEMPTS = 5; const FLAPPING_THRESHOLD_MS = 1000; diff --git a/ndk/src/relay/index.ts b/ndk/src/relay/index.ts index 60cdb6b8..1208978f 100644 --- a/ndk/src/relay/index.ts +++ b/ndk/src/relay/index.ts @@ -8,10 +8,10 @@ import { NDKRelayConnectivity } from "./connectivity.js"; import { NDKRelayPublisher } from "./publisher.js"; import type { NDKRelayScore } from "./score.js"; import { NDKRelaySubscriptionManager } from "./sub-manager.js"; -import { NDKAuthPolicy } from "./auth-policies.js"; +import type { NDKAuthPolicy } from "./auth-policies.js"; import { normalizeRelayUrl } from "../utils/normalize-url.js"; -import { NDK } from "../ndk/index.js"; -import { NDKRelaySubscription } from "./subscription.js"; +import type { NDK } from "../ndk/index.js"; +import type { NDKRelaySubscription } from "./subscription.js"; /** @deprecated Use `WebSocket['url']` instead. */ export type NDKRelayUrl = WebSocket["url"]; diff --git a/ndk/src/relay/pool/index.ts b/ndk/src/relay/pool/index.ts index 6f79eee0..e252c2f3 100644 --- a/ndk/src/relay/pool/index.ts +++ b/ndk/src/relay/pool/index.ts @@ -3,7 +3,7 @@ import { EventEmitter } from "tseep"; import type { NDK } from "../../ndk/index.js"; import { NDKRelay, NDKRelayStatus } from "../index.js"; -import { NDKFilter } from "../../subscription/index.js"; +import type { NDKFilter } from "../../subscription/index.js"; import { normalizeRelayUrl } from "../../utils/normalize-url.js"; export type NDKPoolStats = { diff --git a/ndk/src/relay/sets/calculate.test.ts b/ndk/src/relay/sets/calculate.test.ts index 29713f4a..95fa8437 100644 --- a/ndk/src/relay/sets/calculate.test.ts +++ b/ndk/src/relay/sets/calculate.test.ts @@ -1,8 +1,9 @@ -import { NDKEvent, NostrEvent } from "../../events/index.js"; +import type { NostrEvent } from "../../events/index.js"; +import { NDKEvent } from "../../events/index.js"; import { NDKRelayList } from "../../events/kinds/NDKRelayList.js"; import { NDK } from "../../ndk/index.js"; import { NDKPrivateKeySigner } from "../../signers/private-key/index.js"; -import { Hexpubkey, NDKUser } from "../../user/index.js"; +import type { Hexpubkey, NDKUser } from "../../user/index.js"; import { calculateRelaySetFromEvent, calculateRelaySetsFromFilters } from "./calculate.js"; const explicitRelayUrl = "wss://explicit-relay.com/"; @@ -16,9 +17,9 @@ const signers = [ ]; let ndk: NDK; -let users: NDKUser[] = []; -let readRelays: string[][] = []; -let writeRelays: string[][] = []; +const users: NDKUser[] = []; +const readRelays: string[][] = []; +const writeRelays: string[][] = []; beforeEach(() => { ndk = new NDK({ diff --git a/ndk/src/relay/sets/calculate.ts b/ndk/src/relay/sets/calculate.ts index 4f00f609..3d6ea5c4 100644 --- a/ndk/src/relay/sets/calculate.ts +++ b/ndk/src/relay/sets/calculate.ts @@ -7,7 +7,7 @@ import type { NDKFilter } from "../../subscription/index.js"; import type { Hexpubkey } from "../../user/index.js"; import { normalizeRelayUrl } from "../../utils/normalize-url.js"; import type { NDKRelay } from "../index.js"; -import { NDKPool } from "../pool/index.js"; +import type { NDKPool } from "../pool/index.js"; import { NDKRelaySet } from "./index.js"; import createDebug from "debug"; diff --git a/ndk/src/relay/sub-manager.ts b/ndk/src/relay/sub-manager.ts index 9203db05..35b65c55 100644 --- a/ndk/src/relay/sub-manager.ts +++ b/ndk/src/relay/sub-manager.ts @@ -1,9 +1,10 @@ import { NDKRelaySubscription } from "./subscription"; -import { NDKSubscription } from "../subscription/index.js"; -import { NDKFilter } from "../subscription/index.js"; -import { filterFingerprint, NDKFilterFingerprint } from "../subscription/grouping.js"; -import { NDKRelay } from "."; -import { NDKSubscriptionManager } from "../subscription/manager"; +import type { NDKSubscription } from "../subscription/index.js"; +import type { NDKFilter } from "../subscription/index.js"; +import type { NDKFilterFingerprint } from "../subscription/grouping.js"; +import { filterFingerprint } from "../subscription/grouping.js"; +import type { NDKRelay } from "."; +import type { NDKSubscriptionManager } from "../subscription/manager"; /** * The subscription manager of an NDKRelay is in charge of orchestrating the subscriptions diff --git a/ndk/src/relay/subscription.test.ts b/ndk/src/relay/subscription.test.ts index 5f46b6aa..14d80230 100644 --- a/ndk/src/relay/subscription.test.ts +++ b/ndk/src/relay/subscription.test.ts @@ -1,7 +1,8 @@ // NDKRelaySubscription.test.ts import { NDKRelaySubscription, NDKRelaySubscriptionStatus } from "./subscription.js"; -import { NDKSubscription, NDKFilter, NDKSubscriptionInternalId } from "../subscription/index.js"; +import type { NDKFilter, NDKSubscriptionInternalId } from "../subscription/index.js"; +import { NDKSubscription } from "../subscription/index.js"; import debug from "debug"; import { NDK } from "../ndk/index.js"; import { NDKRelay } from "../index.js"; diff --git a/ndk/src/relay/subscription.ts b/ndk/src/relay/subscription.ts index d8279dac..8a32e2b2 100644 --- a/ndk/src/relay/subscription.ts +++ b/ndk/src/relay/subscription.ts @@ -1,14 +1,17 @@ -import { Event, matchFilters } from "nostr-tools"; -import { NDKRelay, NDKRelayStatus } from "."; -import { NDKEventId, NostrEvent } from "../events"; -import { +import type { Event} from "nostr-tools"; +import { matchFilters } from "nostr-tools"; +import type { NDKRelay} from "."; +import { NDKRelayStatus } from "."; +import type { NDKEventId, NostrEvent } from "../events"; +import type { NDKFilter, NDKSubscription, NDKSubscriptionDelayedType, NDKSubscriptionInternalId, } from "../subscription"; -import { mergeFilters, NDKFilterFingerprint } from "../subscription/grouping"; -import { NDKSubscriptionManager } from "../subscription/manager"; +import type { NDKFilterFingerprint } from "../subscription/grouping"; +import { mergeFilters } from "../subscription/grouping"; +import type { NDKSubscriptionManager } from "../subscription/manager"; type Item = { subscription: NDKSubscription; diff --git a/ndk/src/signers/index.ts b/ndk/src/signers/index.ts index 6cec95ad..a1a28492 100644 --- a/ndk/src/signers/index.ts +++ b/ndk/src/signers/index.ts @@ -1,6 +1,6 @@ import type { NostrEvent } from "../events/index.js"; -import { NDK } from "../ndk/index.js"; -import { NDKRelay } from "../relay/index.js"; +import type { NDK } from "../ndk/index.js"; +import type { NDKRelay } from "../relay/index.js"; import type { NDKUser } from "../user"; /** diff --git a/ndk/src/signers/nip07/index.ts b/ndk/src/signers/nip07/index.ts index 90eadb9e..cfe85897 100644 --- a/ndk/src/signers/nip07/index.ts +++ b/ndk/src/signers/nip07/index.ts @@ -4,7 +4,7 @@ import type { NostrEvent } from "../../events/index.js"; import { NDKUser } from "../../user/index.js"; import type { NDKSigner } from "../index.js"; import { NDKRelay } from "../../relay/index.js"; -import { NDK } from "../../ndk/index.js"; +import type { NDK } from "../../ndk/index.js"; type Nip04QueueItem = { type: "encrypt" | "decrypt"; diff --git a/ndk/src/signers/nip46/index.ts b/ndk/src/signers/nip46/index.ts index 8c29a190..8fcf758f 100644 --- a/ndk/src/signers/nip46/index.ts +++ b/ndk/src/signers/nip46/index.ts @@ -1,13 +1,14 @@ import { EventEmitter } from "tseep"; import type { NostrEvent } from "../../events/index.js"; import type { NDK } from "../../ndk/index.js"; -import { Hexpubkey, NDKUser } from "../../user/index.js"; +import type { Hexpubkey} from "../../user/index.js"; +import { NDKUser } from "../../user/index.js"; import type { NDKSigner } from "../index.js"; import { NDKPrivateKeySigner } from "../private-key/index.js"; import type { NDKRpcResponse } from "./rpc.js"; import { NDKNostrRpc } from "./rpc.js"; import { NDKKind } from "../../events/kinds/index.js"; -import { NDKSubscription } from "../../subscription/index.js"; +import type { NDKSubscription } from "../../subscription/index.js"; /** * This NDKSigner implements NIP-46, which allows remote signing of events. diff --git a/ndk/src/subscription/index.ts b/ndk/src/subscription/index.ts index b0ea3d6f..402303e3 100644 --- a/ndk/src/subscription/index.ts +++ b/ndk/src/subscription/index.ts @@ -1,13 +1,14 @@ import { EventEmitter } from "tseep"; -import { NDKEvent, NDKEventId, NostrEvent } from "../events/index.js"; +import type { NDKEventId, NostrEvent } from "../events/index.js"; +import { NDKEvent } from "../events/index.js"; import type { NDK } from "../ndk/index.js"; import type { NDKRelay } from "../relay"; import type { NDKPool } from "../relay/pool/index.js"; import { calculateRelaySetsFromFilters } from "../relay/sets/calculate"; import type { NDKRelaySet } from "../relay/sets/index.js"; import { queryFullyFilled } from "./utils.js"; -import { NDKKind } from "../events/kinds/index.js"; +import type { NDKKind } from "../events/kinds/index.js"; import { verifiedSignatures } from "../events/validation.js"; export type NDKSubscriptionInternalId = string; @@ -527,7 +528,7 @@ export class NDKSubscription extends EventEmitter<{ const connectedRelays = new Set(this.pool.connectedRelays().map((r) => r.url)); - let connectedRelaysWithFilters = Array.from(this.relayFilters.keys()).filter((url) => + const connectedRelaysWithFilters = Array.from(this.relayFilters.keys()).filter((url) => connectedRelays.has(url) ); diff --git a/ndk/src/subscription/manager.ts b/ndk/src/subscription/manager.ts index 03b68902..f20fc1f2 100644 --- a/ndk/src/subscription/manager.ts +++ b/ndk/src/subscription/manager.ts @@ -1,7 +1,7 @@ -import { NDKEventId } from "../events/index.js"; -import { NDKRelay } from "../relay/index.js"; -import { NDKSubscription } from "./index.js"; -import debug from "debug"; +import type { NDKEventId } from "../events/index.js"; +import type { NDKRelay } from "../relay/index.js"; +import type { NDKSubscription } from "./index.js"; +import type debug from "debug"; export type NDKSubscriptionId = string; diff --git a/ndk/src/subscription/utils.ts b/ndk/src/subscription/utils.ts index 021b5416..ff6af939 100644 --- a/ndk/src/subscription/utils.ts +++ b/ndk/src/subscription/utils.ts @@ -2,8 +2,8 @@ import { nip19 } from "nostr-tools"; import { NDKRelay } from "../relay/index.js"; import type { NDKFilter, NDKSubscription } from "./index.js"; -import { EventPointer } from "../user/index.js"; -import { NDK } from "../ndk/index.js"; +import type { EventPointer } from "../user/index.js"; +import type { NDK } from "../ndk/index.js"; /** * Don't generate subscription Ids longer than this amount of characters diff --git a/ndk/src/thread/index.test.ts b/ndk/src/thread/index.test.ts index b0c88719..fc9accc2 100644 --- a/ndk/src/thread/index.test.ts +++ b/ndk/src/thread/index.test.ts @@ -6,7 +6,8 @@ import { getReplyTag, getRootTag, } from "."; -import { NDKEvent, NDKEventId } from "../events"; +import type { NDKEventId } from "../events"; +import { NDKEvent } from "../events"; const op = new NDKEvent(undefined, { id: "op", diff --git a/ndk/src/thread/index.ts b/ndk/src/thread/index.ts index 71ab809e..2f4cf409 100644 --- a/ndk/src/thread/index.ts +++ b/ndk/src/thread/index.ts @@ -1,4 +1,4 @@ -import { NDKEvent, NDKEventId, NDKTag } from "../events"; +import type { NDKEvent, NDKEventId, NDKTag } from "../events"; export function eventsBySameAuthor(op: NDKEvent, events: NDKEvent[]) { const eventsByAuthor = new Map(); @@ -106,7 +106,7 @@ export function eventThreads(op: NDKEvent, events: NDKEvent[]) { export function getEventReplyIds(event: NDKEvent): NDKEventId[] { if (hasMarkers(event, event.tagType())) { let rootTag: NDKTag | undefined; - let replyTags: NDKTag[] = []; + const replyTags: NDKTag[] = []; event.getMatchingTags(event.tagType()).forEach((tag) => { if (tag[3] === "root") rootTag = tag; @@ -196,7 +196,7 @@ export function getRootEventId(event: NDKEvent, searchTag?: string): NDKEventId */ export function getRootTag(event: NDKEvent, searchTag?: string): NDKTag | undefined { searchTag ??= event.tagType(); - let rootEventTag = event.tags.find((tag) => tag[3] === "root"); + const rootEventTag = event.tags.find((tag) => tag[3] === "root"); if (!rootEventTag) { // If we don't have an explicit root marer, this event has no other e-tag markers diff --git a/ndk/src/user/index.ts b/ndk/src/user/index.ts index 017e53f5..40d4effe 100644 --- a/ndk/src/user/index.ts +++ b/ndk/src/user/index.ts @@ -7,7 +7,8 @@ import { NDKSubscriptionCacheUsage, type NDKSubscriptionOptions } from "../subsc import { follows } from "./follows.js"; import { type NDKUserProfile, profileFromEvent, serializeProfile } from "./profile.js"; import { getNip05For } from "./nip05.js"; -import { NDKLnUrlData, NDKRelay, NDKZap, NDKZapMethod, NDKZapMethodInfo } from "../index.js"; +import type { NDKLnUrlData, NDKRelay, NDKZapMethod, NDKZapMethodInfo } from "../index.js"; +import { NDKZap } from "../index.js"; import { NDKCashuMintList } from "../events/kinds/nutzap/mint-list.js"; import { getNip57ZapSpecFromLud } from "../zapper/ln.js"; @@ -267,7 +268,7 @@ export class NDKUser { ): Promise { if (!ndk) throw new Error("No NDK instance found"); - let opts: RequestInit = {}; + const opts: RequestInit = {}; if (skipCache) opts.cache = "no-cache"; const profile = await getNip05For(ndk, nip05Id, ndk?.httpFetch, opts); diff --git a/ndk/src/user/nip05.ts b/ndk/src/user/nip05.ts index af23d6fa..9f9e242d 100644 --- a/ndk/src/user/nip05.ts +++ b/ndk/src/user/nip05.ts @@ -1,4 +1,5 @@ -import { Hexpubkey, NDKUser, ProfilePointer } from "."; +import type { Hexpubkey, ProfilePointer } from "."; +import { NDKUser } from "."; import type { NDK } from "../ndk"; export const NIP05_REGEX = /^(?:([\w.+-]+)@)?([\w.-]+)$/; diff --git a/ndk/src/user/pin.ts b/ndk/src/user/pin.ts index 9c250788..1cb0470f 100644 --- a/ndk/src/user/pin.ts +++ b/ndk/src/user/pin.ts @@ -1,5 +1,6 @@ -import { NDKUser } from "."; -import { NDKEvent, NostrEvent } from "../events"; +import type { NDKUser } from "."; +import type { NostrEvent } from "../events"; +import { NDKEvent } from "../events"; import { NDKKind } from "../events/kinds"; import NDKList from "../events/kinds/lists"; import { NDKSubscriptionCacheUsage } from "../subscription"; diff --git a/ndk/src/utils/get-users-relay-list.ts b/ndk/src/utils/get-users-relay-list.ts index c08bca2f..719efa54 100644 --- a/ndk/src/utils/get-users-relay-list.ts +++ b/ndk/src/utils/get-users-relay-list.ts @@ -1,11 +1,11 @@ -import { NDKEvent } from "../events/index.js"; +import type { NDKEvent } from "../events/index.js"; import { NDKKind } from "../events/kinds/index.js"; import { NDKRelayList, relayListFromKind3 } from "../events/kinds/NDKRelayList.js"; -import { NDK } from "../ndk/index.js"; -import { NDKRelay } from "../relay/index.js"; +import type { NDK } from "../ndk/index.js"; +import type { NDKRelay } from "../relay/index.js"; import { NDKRelaySet } from "../relay/sets/index.js"; import { NDKSubscriptionCacheUsage } from "../subscription/index.js"; -import { Hexpubkey } from "../user/index.js"; +import type { Hexpubkey } from "../user/index.js"; export async function getRelayListForUser(pubkey: Hexpubkey, ndk: NDK): Promise { const list = await getRelayListForUsers([pubkey], ndk); diff --git a/ndk/src/zap/index.test.ts b/ndk/src/zap/index.test.ts index da8314b5..bd999e6a 100644 --- a/ndk/src/zap/index.test.ts +++ b/ndk/src/zap/index.test.ts @@ -1,7 +1,7 @@ import { NDKZap } from "."; -import { NDKEvent } from "../events/index.js"; +import type { NDKEvent } from "../events/index.js"; import { NDK } from "../ndk/index.js"; -import { Hexpubkey } from "../user"; +import type { Hexpubkey } from "../user"; import { NDKRelayList } from "../events/kinds/NDKRelayList.js"; const ndk = new NDK(); diff --git a/ndk/src/zap/index.ts b/ndk/src/zap/index.ts index d0afac37..d04cc315 100644 --- a/ndk/src/zap/index.ts +++ b/ndk/src/zap/index.ts @@ -1,10 +1,10 @@ import { EventEmitter } from "tseep"; -import { NDKEvent } from "../events/index.js"; +import type { NDKEvent } from "../events/index.js"; import type { NDK } from "../ndk/index.js"; import type { Hexpubkey, NDKUser } from "../user/index.js"; import createDebug from "debug"; -import { NDKLnUrlData } from "../zapper/index.js"; +import type { NDKLnUrlData } from "../zapper/index.js"; const debug = createDebug("ndk:zap"); diff --git a/ndk/src/zapper/index.test.ts b/ndk/src/zapper/index.test.ts index b9068ef4..d067a197 100644 --- a/ndk/src/zapper/index.test.ts +++ b/ndk/src/zapper/index.test.ts @@ -1,10 +1,11 @@ -import { NostrEvent } from "nostr-tools"; -import { NDKZapConfirmation, NDKZapPaymentDetails, NDKZapper, NutPaymentInfo } from "."; +import type { NostrEvent } from "nostr-tools"; +import type { NDKZapConfirmation, NDKZapPaymentDetails, NutPaymentInfo } from "."; +import { NDKZapper } from "."; import { NDKEvent } from "../events"; import { NDKCashuMintList } from "../events/kinds/nutzap/mint-list"; import { NDK } from "../ndk"; import { NDKPrivateKeySigner } from "../signers/private-key"; -import { NDKUser } from "../user"; +import type { NDKUser } from "../user"; jest.mock("./ln.js", () => ({ getNip57ZapSpecFromLud: jest.fn(async () => { diff --git a/ndk/src/zapper/index.ts b/ndk/src/zapper/index.ts index 8e41acf4..e143f954 100644 --- a/ndk/src/zapper/index.ts +++ b/ndk/src/zapper/index.ts @@ -1,10 +1,13 @@ -import { NDK } from "../ndk"; -import { NDKEvent, NDKTag } from "../events"; -import { Hexpubkey, NDKUser } from "../user"; -import { NDKSigner } from "../signers"; +import type { NDK } from "../ndk"; +import type { NDKTag } from "../events"; +import { NDKEvent } from "../events"; +import type { Hexpubkey} from "../user"; +import { NDKUser } from "../user"; +import type { NDKSigner } from "../signers"; import createDebug from "debug"; -import { nip57, NostrEvent } from "nostr-tools"; +import type { NostrEvent } from "nostr-tools"; +import { nip57 } from "nostr-tools"; import { getRelayListForUsers } from "../utils/get-users-relay-list"; import { EventEmitter } from "tseep"; diff --git a/ndk/src/zapper/ln.ts b/ndk/src/zapper/ln.ts index c6f65134..0fe39c5a 100644 --- a/ndk/src/zapper/ln.ts +++ b/ndk/src/zapper/ln.ts @@ -1,6 +1,6 @@ import { bech32 } from "@scure/base"; -import { NDKLnUrlData } from "."; -import { NDK } from "../ndk"; +import type { NDKLnUrlData } from "."; +import type { NDK } from "../ndk"; import createDebug from "debug"; const d = createDebug("ndk:zapper:ln");