migrate to ndk
This commit is contained in:
@@ -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>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user