diff --git a/lib/components/ens-cache-provider.react.js b/lib/components/ens-cache-provider.react.js index eaf268049..d7d04561c 100644 --- a/lib/components/ens-cache-provider.react.js +++ b/lib/components/ens-cache-provider.react.js @@ -1,44 +1,48 @@ // @flow import * as React from 'react'; import type { EthersProvider } from '../types/ethers-types.js'; import { ENSCache } from '../utils/ens-cache.js'; import { getENSNames as baseGetENSNames, type GetENSNames, } from '../utils/ens-helpers.js'; +type BaseUserInfo = { +username?: ?string, ... }; + type ENSCacheContextType = { +ensCache: ?ENSCache, +getENSNames: ?GetENSNames, }; const defaultContext = { ensCache: undefined, getENSNames: undefined, }; const ENSCacheContext: React.Context = React.createContext(defaultContext); type Props = { +provider: ?EthersProvider, +children: React.Node, }; function ENSCacheProvider(props: Props): React.Node { const { provider, children } = props; const context = React.useMemo(() => { if (!provider) { return defaultContext; } const ensCache = new ENSCache(provider); - const getENSNames: GetENSNames = baseGetENSNames.bind(null, ensCache); + const getENSNames: GetENSNames = ( + users: $ReadOnlyArray, + ): Promise => baseGetENSNames(ensCache, users); return { ensCache, getENSNames }; }, [provider]); return ( {children} ); } export { ENSCacheContext, ENSCacheProvider };