wip: restructure

This commit is contained in:
Ren Amamiya
2023-04-27 13:27:11 +07:00
parent 6918660a5c
commit 98a37d4618
102 changed files with 997 additions and 1041 deletions

View File

@@ -0,0 +1,17 @@
import { READONLY_RELAYS } from '@lume/stores/constants';
import { RelayPool } from 'nostr-relaypool';
import { createContext, useMemo } from 'react';
export const RelayContext = createContext({});
export default function RelayProvider({ children }: { children: React.ReactNode }) {
const pool = useMemo(() => {
if (typeof window !== 'undefined') {
return new RelayPool(READONLY_RELAYS, { useEventCache: false, logSubscriptions: false });
} else {
return null;
}
}, []);
return <RelayContext.Provider value={pool}>{children}</RelayContext.Provider>;
}