reuse relayprovider

This commit is contained in:
Ren Amamiya
2023-04-29 10:25:40 +07:00
parent be8b40c86d
commit 3f06193c59
27 changed files with 151 additions and 156 deletions

View File

@@ -0,0 +1,17 @@
import { FULL_RELAYS } from '@lume/stores/constants';
import { RelayPool } from 'nostr-relaypool';
import { createContext } from 'react';
export const RelayContext = createContext({});
const pool = new RelayPool(FULL_RELAYS, {
useEventCache: false,
subscriptionCache: true,
logErrorsAndNotices: false,
logSubscriptions: false,
});
export default function RelayProvider({ children }: { children: React.ReactNode }) {
return <RelayContext.Provider value={pool}>{children}</RelayContext.Provider>;
}