migrate to ndk

This commit is contained in:
Ren Amamiya
2023-06-08 18:09:36 +07:00
parent 75a33d205a
commit 0ba9877785
53 changed files with 2749 additions and 930 deletions

View File

@@ -1,16 +1,10 @@
import { FULL_RELAYS } from "@stores/constants";
import { RelayPool } from "nostr-relaypool";
import { initNDK } from "@libs/ndk";
import NDK from "@nostr-dev-kit/ndk";
import { createContext } from "react";
export const RelayContext = createContext({});
const pool = new RelayPool(FULL_RELAYS, {
useEventCache: false,
subscriptionCache: true,
logErrorsAndNotices: false,
logSubscriptions: false,
});
export const RelayContext = createContext<NDK>(null);
const ndk = await initNDK();
export function RelayProvider({ children }: { children: React.ReactNode }) {
return <RelayContext.Provider value={pool}>{children}</RelayContext.Provider>;
return <RelayContext.Provider value={ndk}>{children}</RelayContext.Provider>;
}