wip: migrated to nostr-relaypool

This commit is contained in:
Ren Amamiya
2023-02-26 18:01:28 +07:00
parent 3fbe6b3986
commit f3da53f098
6 changed files with 106 additions and 44 deletions

11
src/stores/context.tsx Normal file
View File

@@ -0,0 +1,11 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import { RelayPool } from 'nostr-relaypool';
import { createContext, useMemo } from 'react';
export const RelayContext = createContext({});
export default function RelayProvider({ relays, children }: { relays: any; children: React.ReactNode }) {
const value = useMemo(() => new RelayPool(relays, { useEventCache: true }), [relays]);
return <RelayContext.Provider value={value}>{children}</RelayContext.Provider>;
}