diff --git a/package.json b/package.json index e1af426f9..97aa365aa 100644 --- a/package.json +++ b/package.json @@ -68,7 +68,7 @@ "nanoid": "^5.0.4", "ngeohash": "^0.6.3", "nostr-idb": "^2.1.4", - "nostr-tools": "2.5.2", + "nostr-tools": "^2.7.1", "nostr-wasm": "^0.1.0", "prettier": "^3.2.5", "react": "^18.2.0", @@ -117,7 +117,8 @@ "@types/zen-observable": "^0.8.7", "@vitejs/plugin-react": "^4.2.1", "camelcase": "^8.0.0", - "typescript": "^5.3.3", + "eventemitter3": "^5.0.1", + "typescript": "^5.5.3", "vite": "^5.2.10", "vite-plugin-pwa": "^0.19.8", "workbox-build": "^7.0.0", diff --git a/src/app.tsx b/src/app.tsx index 18027264f..d1505eeeb 100644 --- a/src/app.tsx +++ b/src/app.tsx @@ -76,6 +76,7 @@ import MailboxesView from "./views/relays/mailboxes"; import MediaServersView from "./views/relays/media-servers"; import NIP05RelaysView from "./views/relays/nip05"; import ContactListRelaysView from "./views/relays/contact-list"; +import WebRtcRelaysView from "./views/relays/webrtc"; import UserDMsTab from "./views/user/dms"; import LoginNostrConnectView from "./views/signin/nostr-connect"; import ThreadsNotificationsView from "./views/notifications/threads"; @@ -291,6 +292,7 @@ const router = createHashRouter([ { path: "media-servers", element: }, { path: "nip05", element: }, { path: "contacts", element: }, + { path: "webrtc", element: }, { path: "sets", element: }, { path: ":id", element: }, ], diff --git a/src/classes/batch-event-loader.ts b/src/classes/batch-event-loader.ts index f8c7f79d8..5ca457d10 100644 --- a/src/classes/batch-event-loader.ts +++ b/src/classes/batch-event-loader.ts @@ -1,4 +1,5 @@ -import { NostrEvent, AbstractRelay } from "nostr-tools"; +import { NostrEvent } from "nostr-tools"; +import { AbstractRelay } from "nostr-tools/abstract-relay"; import _throttle from "lodash.throttle"; import debug, { Debugger } from "debug"; diff --git a/src/classes/batch-identifier-loader.ts b/src/classes/batch-identifier-loader.ts index e44cd1e59..fa26fdaec 100644 --- a/src/classes/batch-identifier-loader.ts +++ b/src/classes/batch-identifier-loader.ts @@ -1,4 +1,5 @@ -import { NostrEvent, AbstractRelay } from "nostr-tools"; +import { NostrEvent } from "nostr-tools"; +import { AbstractRelay } from "nostr-tools/abstract-relay"; import _throttle from "lodash.throttle"; import debug, { Debugger } from "debug"; import { getEventUID } from "nostr-idb"; diff --git a/src/classes/batch-kind-pubkey-loader.ts b/src/classes/batch-kind-pubkey-loader.ts index 0f462aa5c..626ba72b3 100644 --- a/src/classes/batch-kind-pubkey-loader.ts +++ b/src/classes/batch-kind-pubkey-loader.ts @@ -1,4 +1,5 @@ -import { Filter, NostrEvent, AbstractRelay } from "nostr-tools"; +import { Filter, NostrEvent } from "nostr-tools"; +import { AbstractRelay } from "nostr-tools/abstract-relay"; import _throttle from "lodash.throttle"; import debug, { Debugger } from "debug"; diff --git a/src/classes/batch-relation-loader.ts b/src/classes/batch-relation-loader.ts index 55566308e..f8a95261e 100644 --- a/src/classes/batch-relation-loader.ts +++ b/src/classes/batch-relation-loader.ts @@ -1,4 +1,5 @@ -import { NostrEvent, AbstractRelay } from "nostr-tools"; +import { NostrEvent } from "nostr-tools"; +import { AbstractRelay } from "nostr-tools/abstract-relay"; import _throttle from "lodash.throttle"; import debug, { Debugger } from "debug"; diff --git a/src/classes/chunked-request.ts b/src/classes/chunked-request.ts index 1c0cba8b4..56b3a8cc2 100644 --- a/src/classes/chunked-request.ts +++ b/src/classes/chunked-request.ts @@ -1,5 +1,6 @@ import { Debugger } from "debug"; -import { AbstractRelay, Filter, NostrEvent, matchFilters } from "nostr-tools"; +import { Filter, NostrEvent, matchFilters } from "nostr-tools"; +import { AbstractRelay } from "nostr-tools/abstract-relay"; import { SimpleRelay } from "nostr-idb"; import _throttle from "lodash.throttle"; import { nanoid } from "nanoid"; diff --git a/src/classes/multi-subscription.ts b/src/classes/multi-subscription.ts index 0d5128dee..fa39cff6d 100644 --- a/src/classes/multi-subscription.ts +++ b/src/classes/multi-subscription.ts @@ -1,10 +1,11 @@ import { nanoid } from "nanoid"; +import { Filter } from "nostr-tools"; +import { AbstractRelay } from "nostr-tools/abstract-relay"; import { NostrEvent } from "../types/nostr-event"; import relayPoolService from "../services/relay-pool"; import { isFilterEqual } from "../helpers/nostr/filter"; import ControlledObservable from "./controlled-observable"; -import { AbstractRelay, Filter } from "nostr-tools"; import { offlineMode } from "../services/offline-mode"; import PersistentSubscription from "./persistent-subscription"; import Process from "./process"; diff --git a/src/classes/nostr-publish-action.ts b/src/classes/nostr-publish-action.ts index d19eda4ae..c31902598 100644 --- a/src/classes/nostr-publish-action.ts +++ b/src/classes/nostr-publish-action.ts @@ -1,5 +1,6 @@ import { nanoid } from "nanoid"; -import { NostrEvent, AbstractRelay } from "nostr-tools"; +import { NostrEvent } from "nostr-tools"; +import { AbstractRelay } from "nostr-tools/abstract-relay"; import relayPoolService from "../services/relay-pool"; import createDefer from "./deferred"; diff --git a/src/classes/nostr-subscription.ts b/src/classes/nostr-subscription.ts index 08d0c7483..6ce6eeb93 100644 --- a/src/classes/nostr-subscription.ts +++ b/src/classes/nostr-subscription.ts @@ -1,5 +1,6 @@ import { nanoid } from "nanoid"; -import { Filter, NostrEvent, Relay, Subscription } from "nostr-tools"; +import { Filter, NostrEvent, Relay } from "nostr-tools"; +import { Subscription } from "nostr-tools/abstract-relay"; import relayPoolService from "../services/relay-pool"; import ControlledObservable from "./controlled-observable"; diff --git a/src/classes/persistent-subscription.ts b/src/classes/persistent-subscription.ts index ee44bb740..26451dc9a 100644 --- a/src/classes/persistent-subscription.ts +++ b/src/classes/persistent-subscription.ts @@ -1,5 +1,6 @@ import { nanoid } from "nanoid"; -import { AbstractRelay, Filter, Relay, Subscription, SubscriptionParams } from "nostr-tools"; +import { Filter, Relay } from "nostr-tools"; +import { AbstractRelay, Subscription, SubscriptionParams } from "nostr-tools/abstract-relay"; import relayPoolService from "../services/relay-pool"; import Process from "./process"; diff --git a/src/classes/process.ts b/src/classes/process.ts index 0c438587b..8ffef1e0a 100644 --- a/src/classes/process.ts +++ b/src/classes/process.ts @@ -1,6 +1,6 @@ import { ComponentWithAs, IconProps } from "@chakra-ui/react"; import { SimpleRelay } from "nostr-idb"; -import { AbstractRelay } from "nostr-tools"; +import { AbstractRelay } from "nostr-tools/abstract-relay"; let lastId = 0; export default class Process { diff --git a/src/classes/relay-pool.ts b/src/classes/relay-pool.ts index 685dc12ac..c8a31c807 100644 --- a/src/classes/relay-pool.ts +++ b/src/classes/relay-pool.ts @@ -1,4 +1,4 @@ -import { AbstractRelay } from "nostr-tools"; +import { AbstractRelay } from "nostr-tools/abstract-relay"; import dayjs from "dayjs"; import { logger } from "../helpers/debug"; diff --git a/src/classes/timeline-loader.ts b/src/classes/timeline-loader.ts index d5b3c113b..2650a3f3f 100644 --- a/src/classes/timeline-loader.ts +++ b/src/classes/timeline-loader.ts @@ -1,6 +1,7 @@ import dayjs from "dayjs"; import { Debugger } from "debug"; -import { AbstractRelay, Filter, NostrEvent } from "nostr-tools"; +import { Filter, NostrEvent } from "nostr-tools"; +import { AbstractRelay } from "nostr-tools/abstract-relay"; import _throttle from "lodash.throttle"; import MultiSubscription from "./multi-subscription"; diff --git a/src/components/embed-event/index.tsx b/src/components/embed-event/index.tsx index 9ceb32895..24f225a10 100644 --- a/src/components/embed-event/index.tsx +++ b/src/components/embed-event/index.tsx @@ -1,5 +1,5 @@ import { Suspense, lazy } from "react"; -import type { DecodeResult } from "nostr-tools/lib/types/nip19"; +import type { DecodeResult } from "nostr-tools/nip19"; import { CardProps, Spinner } from "@chakra-ui/react"; import { kinds } from "nostr-tools"; diff --git a/src/components/note/timeline-note/components/repost-modal.tsx b/src/components/note/timeline-note/components/repost-modal.tsx index 8bee0e8ac..39e7911cd 100644 --- a/src/components/note/timeline-note/components/repost-modal.tsx +++ b/src/components/note/timeline-note/components/repost-modal.tsx @@ -14,7 +14,7 @@ import { } from "@chakra-ui/react"; import { EventTemplate, NostrEvent, kinds } from "nostr-tools"; import dayjs from "dayjs"; -import type { AddressPointer } from "nostr-tools/lib/types/nip19"; +import type { AddressPointer } from "nostr-tools/nip19"; import { ChevronDownIcon, ChevronUpIcon, ExternalLinkIcon } from "../../../icons"; import relayHintService from "../../../../services/event-relay-hint"; diff --git a/src/components/post-modal/community-select.tsx b/src/components/post-modal/community-select.tsx index 44b729840..6019643ec 100644 --- a/src/components/post-modal/community-select.tsx +++ b/src/components/post-modal/community-select.tsx @@ -4,7 +4,7 @@ import { Select, SelectProps } from "@chakra-ui/react"; import useUserCommunitiesList from "../../hooks/use-user-communities-list"; import useCurrentAccount from "../../hooks/use-current-account"; import { getCommunityName } from "../../helpers/nostr/communities"; -import { AddressPointer } from "nostr-tools/lib/types/nip19"; +import { AddressPointer } from "nostr-tools/nip19"; import useReplaceableEvent from "../../hooks/use-replaceable-event"; import { getEventCoordinate } from "../../helpers/nostr/event"; diff --git a/src/components/relays/relay-auth-button.tsx b/src/components/relays/relay-auth-button.tsx index 55c3ba3be..ecb2ea879 100644 --- a/src/components/relays/relay-auth-button.tsx +++ b/src/components/relays/relay-auth-button.tsx @@ -1,14 +1,6 @@ import { useCallback, useState } from "react"; -import { - Button, - ButtonProps, - IconButton, - IconButtonProps, - useForceUpdate, - useInterval, - useToast, -} from "@chakra-ui/react"; -import { AbstractRelay } from "nostr-tools"; +import { IconButton, IconButtonProps, useForceUpdate, useInterval, useToast } from "@chakra-ui/react"; +import { type AbstractRelay } from "nostr-tools/abstract-relay"; import relayPoolService from "../../services/relay-pool"; import { useSigningContext } from "../../providers/global/signing-provider"; diff --git a/src/components/relays/relay-connect-switch.tsx b/src/components/relays/relay-connect-switch.tsx index c0c270092..c9e10ccb5 100644 --- a/src/components/relays/relay-connect-switch.tsx +++ b/src/components/relays/relay-connect-switch.tsx @@ -1,6 +1,6 @@ import { ChangeEventHandler } from "react"; import { Switch, useForceUpdate, useInterval, useToast } from "@chakra-ui/react"; -import { AbstractRelay } from "nostr-tools"; +import { type AbstractRelay } from "nostr-tools/abstract-relay"; import relayPoolService from "../../services/relay-pool"; import useSubject from "../../hooks/use-subject"; diff --git a/src/components/relays/relay-status.tsx b/src/components/relays/relay-status.tsx index 94d910829..2be5514d2 100644 --- a/src/components/relays/relay-status.tsx +++ b/src/components/relays/relay-status.tsx @@ -1,8 +1,8 @@ import { Badge, useForceUpdate } from "@chakra-ui/react"; import { useInterval } from "react-use"; +import { AbstractRelay } from "nostr-tools/abstract-relay"; import relayPoolService from "../../services/relay-pool"; -import { AbstractRelay } from "nostr-tools"; import useSubject from "../../hooks/use-subject"; const getStatusText = (relay: AbstractRelay, connecting = false) => { diff --git a/src/helpers/nostr/event.ts b/src/helpers/nostr/event.ts index 09065cf76..80f63d29f 100644 --- a/src/helpers/nostr/event.ts +++ b/src/helpers/nostr/event.ts @@ -5,7 +5,7 @@ import { nanoid } from "nanoid"; import { ATag, DraftNostrEvent, ETag, isATag, isDTag, isETag, isPTag, NostrEvent, Tag } from "../../types/nostr-event"; import { getMatchNostrLink } from "../regexp"; -import { AddressPointer, DecodeResult, EventPointer } from "nostr-tools/lib/types/nip19"; +import { AddressPointer, DecodeResult, EventPointer } from "nostr-tools/nip19"; import { safeJson } from "../parse"; import { safeDecode } from "../nip19"; import { safeRelayUrl, safeRelayUrls } from "../relay"; diff --git a/src/helpers/nostr/goal.ts b/src/helpers/nostr/goal.ts index fe3c12992..271319e42 100644 --- a/src/helpers/nostr/goal.ts +++ b/src/helpers/nostr/goal.ts @@ -1,6 +1,6 @@ import dayjs from "dayjs"; import { NostrEvent, isRTag } from "../../types/nostr-event"; -import { DecodeResult } from "nostr-tools/lib/types/nip19"; +import { DecodeResult } from "nostr-tools/nip19"; import { getPointerFromTag } from "../nip19"; export const GOAL_KIND = 9041; diff --git a/src/helpers/relay.ts b/src/helpers/relay.ts index e0e22352f..5c7684129 100644 --- a/src/helpers/relay.ts +++ b/src/helpers/relay.ts @@ -1,4 +1,6 @@ -import { AbstractRelay, Filter, SubCloser, SubscribeManyParams, Subscription } from "nostr-tools"; +import { Filter } from "nostr-tools"; +import { SubCloser, SubscribeManyParams } from "nostr-tools/abstract-pool"; +import { AbstractRelay, Subscription } from "nostr-tools/abstract-relay"; // NOTE: only use this for equality checks and querying export function getRelayVariations(relay: string) { diff --git a/src/hooks/use-dvm-metadata.ts b/src/hooks/use-dvm-metadata.ts index 60b3d20b4..23589c916 100644 --- a/src/hooks/use-dvm-metadata.ts +++ b/src/hooks/use-dvm-metadata.ts @@ -1,5 +1,5 @@ import { useMemo } from "react"; -import type { AddressPointer } from "nostr-tools/lib/types/nip19"; +import type { AddressPointer } from "nostr-tools/nip19"; import useReplaceableEvent from "./use-replaceable-event"; import { parseDVMMetadata } from "../helpers/nostr/dvm"; diff --git a/src/hooks/use-params-address-pointer.ts b/src/hooks/use-params-address-pointer.ts index 478d9f9eb..4f534f64b 100644 --- a/src/hooks/use-params-address-pointer.ts +++ b/src/hooks/use-params-address-pointer.ts @@ -1,6 +1,6 @@ import { useParams } from "react-router-dom"; import { nip19 } from "nostr-tools"; -import type { AddressPointer } from "nostr-tools/lib/types/nip19"; +import type { AddressPointer } from "nostr-tools/nip19"; import { CustomAddressPointer, parseCoordinate } from "../helpers/nostr/event"; diff --git a/src/hooks/use-params-event-pointer.ts b/src/hooks/use-params-event-pointer.ts index 1d648ed7b..d429bc840 100644 --- a/src/hooks/use-params-event-pointer.ts +++ b/src/hooks/use-params-event-pointer.ts @@ -1,6 +1,6 @@ import { useParams } from "react-router-dom"; import { nip19 } from "nostr-tools"; -import type { EventPointer } from "nostr-tools/lib/types/nip19"; +import type { EventPointer } from "nostr-tools/nip19"; import { isHexKey } from "../helpers/nip19"; diff --git a/src/hooks/use-params-pubkey-pointer.ts b/src/hooks/use-params-pubkey-pointer.ts index 774ef5f18..9a29b18e9 100644 --- a/src/hooks/use-params-pubkey-pointer.ts +++ b/src/hooks/use-params-pubkey-pointer.ts @@ -1,6 +1,6 @@ import { useParams } from "react-router-dom"; import { nip19 } from "nostr-tools"; -import type { ProfilePointer } from "nostr-tools/lib/types/nip19"; +import type { ProfilePointer } from "nostr-tools/nip19"; import { isHexKey } from "../helpers/nip19"; export default function useParamsProfilePointer(key: string = "pubkey"): ProfilePointer { diff --git a/src/services/dictionary.ts b/src/services/dictionary.ts index 4b892fcec..726d70897 100644 --- a/src/services/dictionary.ts +++ b/src/services/dictionary.ts @@ -1,4 +1,5 @@ -import { AbstractRelay, NostrEvent } from "nostr-tools"; +import { NostrEvent } from "nostr-tools"; +import { AbstractRelay } from "nostr-tools/abstract-relay"; import { WIKI_PAGE_KIND } from "../helpers/nostr/wiki"; import { logger } from "../helpers/debug"; diff --git a/src/services/event-reactions.ts b/src/services/event-reactions.ts index cc5cf50d2..172902574 100644 --- a/src/services/event-reactions.ts +++ b/src/services/event-reactions.ts @@ -1,5 +1,6 @@ -import { AbstractRelay, kinds } from "nostr-tools"; +import { kinds } from "nostr-tools"; import _throttle from "lodash.throttle"; +import { AbstractRelay } from "nostr-tools/abstract-relay"; import Subject from "../classes/subject"; import SuperMap from "../classes/super-map"; diff --git a/src/services/event-relay-hint.ts b/src/services/event-relay-hint.ts index b5cd81078..e0cf652f8 100644 --- a/src/services/event-relay-hint.ts +++ b/src/services/event-relay-hint.ts @@ -1,5 +1,5 @@ import { nip19 } from "nostr-tools"; -import type { AddressPointer, EventPointer } from "nostr-tools/lib/types/nip19"; +import type { AddressPointer, EventPointer } from "nostr-tools/nip19"; import { NostrEvent, isDTag } from "../types/nostr-event"; import relayScoreboardService from "./relay-scoreboard"; diff --git a/src/services/event-zaps.ts b/src/services/event-zaps.ts index 5c3b52fc4..98cd53f1a 100644 --- a/src/services/event-zaps.ts +++ b/src/services/event-zaps.ts @@ -1,5 +1,6 @@ -import { AbstractRelay, kinds } from "nostr-tools"; +import { kinds } from "nostr-tools"; import _throttle from "lodash.throttle"; +import { AbstractRelay } from "nostr-tools/abstract-relay"; import Subject from "../classes/subject"; import SuperMap from "../classes/super-map"; diff --git a/src/services/local-relay.ts b/src/services/local-relay.ts index 19fa2643d..e0b1d8caa 100644 --- a/src/services/local-relay.ts +++ b/src/services/local-relay.ts @@ -1,5 +1,6 @@ import { CacheRelay, openDB } from "nostr-idb"; -import { AbstractRelay } from "nostr-tools"; +import { AbstractRelay } from "nostr-tools/abstract-relay"; + import { logger } from "../helpers/debug"; import { safeRelayUrl } from "../helpers/relay"; import WasmRelay from "./wasm-relay"; diff --git a/src/services/process-manager.ts b/src/services/process-manager.ts index c17d7dd77..d2224a779 100644 --- a/src/services/process-manager.ts +++ b/src/services/process-manager.ts @@ -1,4 +1,4 @@ -import { AbstractRelay } from "nostr-tools"; +import { AbstractRelay } from "nostr-tools/abstract-relay"; import Process from "../classes/process"; import relayPoolService from "./relay-pool"; diff --git a/src/services/replaceable-events.ts b/src/services/replaceable-events.ts index aac7f03e7..92b67e84f 100644 --- a/src/services/replaceable-events.ts +++ b/src/services/replaceable-events.ts @@ -1,4 +1,5 @@ -import { AbstractRelay, NostrEvent } from "nostr-tools"; +import { NostrEvent } from "nostr-tools"; +import { AbstractRelay } from "nostr-tools/abstract-relay"; import _throttle from "lodash.throttle"; import SuperMap from "../classes/super-map"; diff --git a/src/services/signing.tsx b/src/services/signing.tsx index 3162fad4a..748793c9a 100644 --- a/src/services/signing.tsx +++ b/src/services/signing.tsx @@ -1,7 +1,7 @@ -import { nip04, getPublicKey, finalizeEvent } from "nostr-tools"; +import { nip04, getPublicKey, finalizeEvent, EventTemplate } from "nostr-tools"; import { hexToBytes } from "@noble/hashes/utils"; -import { DraftNostrEvent, NostrEvent } from "../types/nostr-event"; +import { NostrEvent } from "../types/nostr-event"; import { Account } from "./account"; import db from "./db"; import serialPortService from "./serial-port"; @@ -96,7 +96,7 @@ class SigningService { return await p; } - async requestSignature(draft: DraftNostrEvent, account: Account) { + async requestSignature(draft: EventTemplate, account: Account) { const checkSig = (signed: NostrEvent) => { if (signed.pubkey !== account.pubkey) throw new Error("Signed with the wrong pubkey"); }; diff --git a/src/services/single-event.ts b/src/services/single-event.ts index 67203aedc..17a0ab57b 100644 --- a/src/services/single-event.ts +++ b/src/services/single-event.ts @@ -1,4 +1,5 @@ import _throttle from "lodash.throttle"; +import { AbstractRelay } from "nostr-tools/abstract-relay"; import SuperMap from "../classes/super-map"; import { NostrEvent } from "../types/nostr-event"; @@ -7,7 +8,6 @@ import { logger } from "../helpers/debug"; import Subject from "../classes/subject"; import relayPoolService from "./relay-pool"; import Process from "../classes/process"; -import { AbstractRelay } from "nostr-tools"; import processManager from "./process-manager"; import Code02 from "../components/icons/code-02"; import BatchEventLoader from "../classes/batch-event-loader"; diff --git a/src/types/nostr-extensions.d.ts b/src/types/nostr-extensions.d.ts index 955c7c97b..bdc0be761 100644 --- a/src/types/nostr-extensions.d.ts +++ b/src/types/nostr-extensions.d.ts @@ -1,15 +1,19 @@ -import { DraftNostrEvent, NostrEvent } from "./nostr-event"; +import { EventTemplate, NostrEvent, UnsignedEvent } from "nostr-tools"; declare global { interface Window { nostr?: { getPublicKey: () => Promise | string; - signEvent: (event: DraftNostrEvent) => Promise | NostrEvent; + signEvent: (event: EventTemplate) => Promise | NostrEvent; getRelays?: () => Record | string[]; nip04?: { encrypt: (pubkey: string, plaintext: string) => Promise | string; decrypt: (pubkey: string, ciphertext: string) => Promise | string; }; + nip44?: { + encrypt: (pubkey: string, plaintext: string) => Promise | string; + decrypt: (pubkey: string, ciphertext: string) => Promise | string; + }; }; } } diff --git a/src/types/nostr-tools-wasm.d.ts b/src/types/nostr-tools-wasm.d.ts deleted file mode 100644 index dd28c4d78..000000000 --- a/src/types/nostr-tools-wasm.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -declare module "nostr-tools/wasm" { - export * from "nostr-tools/lib/types/wasm.d.ts"; -} diff --git a/src/views/bookmarks/index.tsx b/src/views/bookmarks/index.tsx index b50ddfba5..f1b35d2a4 100644 --- a/src/views/bookmarks/index.tsx +++ b/src/views/bookmarks/index.tsx @@ -1,4 +1,4 @@ -import { AddressPointer, EventPointer } from "nostr-tools/lib/types/nip19"; +import { AddressPointer, EventPointer } from "nostr-tools/nip19"; import { Button, ButtonGroup, Flex, Heading, SkeletonText, Spinner } from "@chakra-ui/react"; import { useParams } from "react-router-dom"; diff --git a/src/views/channels/components/channel-card.tsx b/src/views/channels/components/channel-card.tsx index 18f6cf078..8b56fbbd4 100644 --- a/src/views/channels/components/channel-card.tsx +++ b/src/views/channels/components/channel-card.tsx @@ -1,6 +1,6 @@ import { Link as RouterLink } from "react-router-dom"; import { nip19 } from "nostr-tools"; -import { EventPointer } from "nostr-tools/lib/types/nip19"; +import { EventPointer } from "nostr-tools/nip19"; import { Box, Card, diff --git a/src/views/communities/components/community-card.tsx b/src/views/communities/components/community-card.tsx index ac230a115..af5e55c72 100644 --- a/src/views/communities/components/community-card.tsx +++ b/src/views/communities/components/community-card.tsx @@ -23,7 +23,7 @@ import useCountCommunityMembers from "../../../hooks/use-count-community-members import { readablizeSats } from "../../../helpers/bolt11"; import User01 from "../../../components/icons/user-01"; import useReplaceableEvent from "../../../hooks/use-replaceable-event"; -import { AddressPointer } from "nostr-tools/lib/types/nip19"; +import { AddressPointer } from "nostr-tools/nip19"; import useEventIntersectionRef from "../../../hooks/use-event-intersection-ref"; function CommunityCard({ community, ...props }: Omit & { community: NostrEvent }) { diff --git a/src/views/communities/explore.tsx b/src/views/communities/explore.tsx index 6d09b5e9b..ea8ac4a96 100644 --- a/src/views/communities/explore.tsx +++ b/src/views/communities/explore.tsx @@ -15,7 +15,7 @@ import { useNavigate } from "react-router-dom"; import { ChevronLeftIcon } from "../../components/icons"; import { parseCoordinate } from "../../helpers/nostr/event"; import UserAvatarLink from "../../components/user/user-avatar-link"; -import { AddressPointer } from "nostr-tools/lib/types/nip19"; +import { AddressPointer } from "nostr-tools/nip19"; export function useUsersJoinedCommunitiesLists(pubkeys: string[], additionalRelays?: Iterable) { const readRelays = useReadRelays(additionalRelays); diff --git a/src/views/dvm-feed/components/dvm-avatar.tsx b/src/views/dvm-feed/components/dvm-avatar.tsx index 9208d0bee..d678253e1 100644 --- a/src/views/dvm-feed/components/dvm-avatar.tsx +++ b/src/views/dvm-feed/components/dvm-avatar.tsx @@ -5,7 +5,7 @@ import { Box, BoxProps } from "@chakra-ui/react"; import useUserMetadata from "../../../hooks/use-user-metadata"; -import { AddressPointer } from "nostr-tools/lib/types/nip19"; +import { AddressPointer } from "nostr-tools/nip19"; import useDVMMetadata from "../../../hooks/use-dvm-metadata"; type DVMAvatarProps = { diff --git a/src/views/dvm-feed/components/dvm-card.tsx b/src/views/dvm-feed/components/dvm-card.tsx index 6eabacde9..336ebca85 100644 --- a/src/views/dvm-feed/components/dvm-card.tsx +++ b/src/views/dvm-feed/components/dvm-card.tsx @@ -1,7 +1,7 @@ import { Card, CardProps, Heading, LinkBox, LinkOverlayProps, Text } from "@chakra-ui/react"; import { Link as RouterLink, To } from "react-router-dom"; import { useMemo } from "react"; -import { AddressPointer } from "nostr-tools/lib/types/nip19"; +import { AddressPointer } from "nostr-tools/nip19"; import { NostrEvent } from "../../../types/nostr-event"; import HoverLinkOverlay from "../../../components/hover-link-overlay"; diff --git a/src/views/dvm-feed/components/dvm-name.tsx b/src/views/dvm-feed/components/dvm-name.tsx index 4f9142170..257483674 100644 --- a/src/views/dvm-feed/components/dvm-name.tsx +++ b/src/views/dvm-feed/components/dvm-name.tsx @@ -4,7 +4,7 @@ import { nip19 } from "nostr-tools"; import useUserMetadata from "../../../hooks/use-user-metadata"; import { getDisplayName } from "../../../helpers/nostr/user-metadata"; -import { AddressPointer } from "nostr-tools/lib/types/nip19"; +import { AddressPointer } from "nostr-tools/nip19"; import useDVMMetadata from "../../../hooks/use-dvm-metadata"; export function DVMName({ diff --git a/src/views/dvm-feed/components/dvm-params.tsx b/src/views/dvm-feed/components/dvm-params.tsx index 29f7eb11f..436451be1 100644 --- a/src/views/dvm-feed/components/dvm-params.tsx +++ b/src/views/dvm-feed/components/dvm-params.tsx @@ -1,4 +1,4 @@ -import { AddressPointer } from "nostr-tools/lib/types/nip19"; +import { AddressPointer } from "nostr-tools/nip19"; import useDVMMetadata from "../../../hooks/use-dvm-metadata"; import { Select } from "@chakra-ui/react"; diff --git a/src/views/dvm-feed/components/feed-status.tsx b/src/views/dvm-feed/components/feed-status.tsx index e615165b7..2c3e99c10 100644 --- a/src/views/dvm-feed/components/feed-status.tsx +++ b/src/views/dvm-feed/components/feed-status.tsx @@ -26,7 +26,7 @@ import { DraftNostrEvent } from "../../../types/nostr-event"; import { useReadRelays } from "../../../hooks/use-client-relays"; import { DVMAvatarLink } from "./dvm-avatar"; import DVMLink from "./dvm-name"; -import { AddressPointer } from "nostr-tools/lib/types/nip19"; +import { AddressPointer } from "nostr-tools/nip19"; import useUserMailboxes from "../../../hooks/use-user-mailboxes"; import { usePublishEvent } from "../../../providers/global/publish-provider"; diff --git a/src/views/dvm-feed/components/feed.tsx b/src/views/dvm-feed/components/feed.tsx index 988038860..7add0ed2b 100644 --- a/src/views/dvm-feed/components/feed.tsx +++ b/src/views/dvm-feed/components/feed.tsx @@ -1,6 +1,6 @@ import { ChainedDVMJob, getEventIdsFromJobs } from "../../../helpers/nostr/dvm"; import FeedStatus from "./feed-status"; -import { AddressPointer } from "nostr-tools/lib/types/nip19"; +import { AddressPointer } from "nostr-tools/nip19"; import useSingleEvents from "../../../hooks/use-single-events"; import TimelineItem from "../../../components/timeline-page/generic-note-timeline/timeline-item"; diff --git a/src/views/dvm-feed/feed.tsx b/src/views/dvm-feed/feed.tsx index 465615e73..1d4fd97c2 100644 --- a/src/views/dvm-feed/feed.tsx +++ b/src/views/dvm-feed/feed.tsx @@ -33,7 +33,7 @@ import RequireCurrentAccount from "../../providers/route/require-current-account import { CodeIcon } from "../../components/icons"; import DebugChains from "./components/debug-chains"; import Feed from "./components/feed"; -import { AddressPointer } from "nostr-tools/lib/types/nip19"; +import { AddressPointer } from "nostr-tools/nip19"; import useParamsAddressPointer from "../../hooks/use-params-address-pointer"; import DVMParams from "./components/dvm-params"; import useUserMailboxes from "../../hooks/use-user-mailboxes"; diff --git a/src/views/lists/list/index.tsx b/src/views/lists/list/index.tsx index 6f9bb9dc3..072b1cf0f 100644 --- a/src/views/lists/list/index.tsx +++ b/src/views/lists/list/index.tsx @@ -1,6 +1,6 @@ import { useNavigate } from "react-router-dom"; import { kinds, nip19 } from "nostr-tools"; -import type { DecodeResult } from "nostr-tools/lib/types/nip19"; +import type { DecodeResult } from "nostr-tools/nip19"; import { Box, Button, Flex, Heading, SimpleGrid, Spacer, Spinner, Text } from "@chakra-ui/react"; import UserLink from "../../../components/user/user-link"; diff --git a/src/views/relays/index.tsx b/src/views/relays/index.tsx index d19e06916..4f584c839 100644 --- a/src/views/relays/index.tsx +++ b/src/views/relays/index.tsx @@ -12,6 +12,7 @@ import { useUserDNSIdentity } from "../../hooks/use-user-dns-identity"; import useUserContactRelays from "../../hooks/use-user-contact-relays"; import UserSquare from "../../components/icons/user-square"; import Image01 from "../../components/icons/image-01"; +import Server05 from "../../components/icons/server-05"; export default function RelaysView() { const account = useCurrentAccount(); @@ -69,6 +70,15 @@ export default function RelaysView() { )} + {/* */} {nip05?.exists && ( + + + + + {/* + These relays cant be modified by noStrudel, they must be set manually on your + */} + + ); +} diff --git a/src/views/task-manager/relays/index.tsx b/src/views/task-manager/relays/index.tsx index 4a7352403..24f3da599 100644 --- a/src/views/task-manager/relays/index.tsx +++ b/src/views/task-manager/relays/index.tsx @@ -18,8 +18,8 @@ import { useInterval, } from "@chakra-ui/react"; import { Link as RouterLink } from "react-router-dom"; -import { AbstractRelay } from "nostr-tools"; import { useLocalStorage } from "react-use"; +import { AbstractRelay } from "nostr-tools/abstract-relay"; import relayPoolService from "../../../services/relay-pool"; import { RelayFavicon } from "../../../components/relay-favicon"; diff --git a/src/views/tools/event-console/index.tsx b/src/views/tools/event-console/index.tsx index 145a5204d..599946f86 100644 --- a/src/views/tools/event-console/index.tsx +++ b/src/views/tools/event-console/index.tsx @@ -15,7 +15,8 @@ import { Text, useDisclosure, } from "@chakra-ui/react"; -import { AbstractRelay, NostrEvent, Subscription } from "nostr-tools"; +import { NostrEvent } from "nostr-tools"; +import { AbstractRelay, Subscription } from "nostr-tools/abstract-relay"; import { useLocalStorage } from "react-use"; import { Subscription as IDBSubscription } from "nostr-idb"; import _throttle from "lodash.throttle"; @@ -93,7 +94,7 @@ export default function EventConsoleView() { if (!relay || relay.url !== url.toString()) { r = await relayPoolService.requestRelay(url); await relayPoolService.requestConnect(r); - setRelay(r); + setRelay(r as AbstractRelay); } else r = relay; } else { if (relay) setRelay(null); diff --git a/tsconfig.json b/tsconfig.json index f807c7fda..044df74f3 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -10,7 +10,7 @@ "strict": true, "forceConsistentCasingInFileNames": true, "module": "ESNext", - "moduleResolution": "node", + "moduleResolution": "Bundler", "resolveJsonModule": true, "isolatedModules": true, "noEmit": true, diff --git a/yarn.lock b/yarn.lock index 5f6c11c1c..e26e86548 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6218,20 +6218,6 @@ nostr-idb@^2.1.4: idb "^8.0.0" nostr-tools "^2.1.3" -nostr-tools@2.5.2: - version "2.5.2" - resolved "https://registry.yarnpkg.com/nostr-tools/-/nostr-tools-2.5.2.tgz#54b445380ac2a7740ad90ed3b044bca93ecf23bd" - integrity sha512-Ls2FKh694eudBye6q89yJ5JhXjQle1MWp1yD2sBZ5j9M3IOBEW8ia9IED5W6daSAjlT/Z/pV77yTkdF45c1Rbg== - dependencies: - "@noble/ciphers" "^0.5.1" - "@noble/curves" "1.2.0" - "@noble/hashes" "1.3.1" - "@scure/base" "1.1.1" - "@scure/bip32" "1.3.1" - "@scure/bip39" "1.2.1" - optionalDependencies: - nostr-wasm v0.1.0 - nostr-tools@^1.17.0: version "1.17.0" resolved "https://registry.yarnpkg.com/nostr-tools/-/nostr-tools-1.17.0.tgz#b6f62e32fedfd9e68ec0a7ce57f74c44fc768e8c" @@ -6272,6 +6258,20 @@ nostr-tools@^2.3.2: optionalDependencies: nostr-wasm v0.1.0 +nostr-tools@^2.7.1: + version "2.7.1" + resolved "https://registry.yarnpkg.com/nostr-tools/-/nostr-tools-2.7.1.tgz#cfedfe6c7ebf7f127f3ac32a5b57c7e570c35f67" + integrity sha512-4qAvlHSqBAA8lQMwRWE6dalSNdQT77Xut9lPiJZgEcb9RAlR69wR2+KVBAgnZVaabVYH7FJ7gOQXLw/jQBAYBg== + dependencies: + "@noble/ciphers" "^0.5.1" + "@noble/curves" "1.2.0" + "@noble/hashes" "1.3.1" + "@scure/base" "1.1.1" + "@scure/bip32" "1.3.1" + "@scure/bip39" "1.2.1" + optionalDependencies: + nostr-wasm v0.1.0 + nostr-wasm@^0.1.0, nostr-wasm@v0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/nostr-wasm/-/nostr-wasm-0.1.0.tgz#17af486745feb2b7dd29503fdd81613a24058d94" @@ -7773,10 +7773,10 @@ typed-array-length@^1.0.4: for-each "^0.3.3" is-typed-array "^1.1.9" -typescript@^5.3.3: - version "5.3.3" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.3.3.tgz#b3ce6ba258e72e6305ba66f5c9b452aaee3ffe37" - integrity sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw== +typescript@^5.5.3: + version "5.5.3" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.5.3.tgz#e1b0a3c394190838a0b168e771b0ad56a0af0faa" + integrity sha512-/hreyEujaB0w76zKo6717l3L0o/qEUtRgdvUBvlkhoWeOVMjMuHNHk0BRBzikzuGDqNmPQbg5ifMEqsHLiIUcQ== typo-js@*: version "1.2.4"