diff --git a/landing/landing-ssr.react.js b/landing/landing-ssr.react.js --- a/landing/landing-ssr.react.js +++ b/landing/landing-ssr.react.js @@ -4,7 +4,7 @@ import { StaticRouter } from 'react-router'; import Landing from './landing.react'; -import { SIWENonceContext } from './siwe-nonce-context'; +import { SIWEContext } from './siwe-context.js'; export type LandingSSRProps = { +url: string, @@ -14,7 +14,7 @@ function LandingSSR(props: LandingSSRProps): React.Node { const { url, basename, siweNonce } = props; - const siweNonceContextValue = React.useMemo( + const siweContextValue = React.useMemo( () => ({ siweNonce, }), @@ -23,9 +23,9 @@ const routerContext = React.useMemo(() => ({}), []); return ( - + - + ); } diff --git a/landing/root.js b/landing/root.js --- a/landing/root.js +++ b/landing/root.js @@ -4,13 +4,13 @@ import { BrowserRouter } from 'react-router-dom'; import Landing from './landing.react'; -import { SIWENonceContext } from './siwe-nonce-context.js'; +import { SIWEContext } from './siwe-context.js'; declare var routerBasename: string; declare var siweNonce: ?string; function RootComponent(): React.Node { - const siweNonceContextValue = React.useMemo( + const siweContextValue = React.useMemo( () => ({ siweNonce, }), @@ -18,9 +18,9 @@ ); return ( - + - + ); } diff --git a/landing/siwe-context.js b/landing/siwe-context.js new file mode 100644 --- /dev/null +++ b/landing/siwe-context.js @@ -0,0 +1,13 @@ +// @flow + +import * as React from 'react'; + +export type SIWEContextType = { + +siweNonce: ?string, +}; + +const SIWEContext: React.Context = React.createContext({ + siweNonce: null, +}); + +export { SIWEContext }; diff --git a/landing/siwe-nonce-context.js b/landing/siwe-nonce-context.js deleted file mode 100644 --- a/landing/siwe-nonce-context.js +++ /dev/null @@ -1,15 +0,0 @@ -// @flow - -import * as React from 'react'; - -export type SIWENonceContextType = { - +siweNonce: ?string, -}; - -const SIWENonceContext: React.Context = React.createContext( - { - siweNonce: null, - }, -); - -export { SIWENonceContext }; diff --git a/landing/siwe.react.js b/landing/siwe.react.js --- a/landing/siwe.react.js +++ b/landing/siwe.react.js @@ -27,7 +27,7 @@ import type { SIWEWebViewMessage } from 'lib/types/siwe-types'; import { siweStatement } from 'lib/utils/siwe-utils.js'; -import { SIWENonceContext } from './siwe-nonce-context.js'; +import { SIWEContext } from './siwe-context.js'; import css from './siwe.css'; // details can be found https://0.6.x.wagmi.sh/docs/providers/configuring-chains @@ -85,7 +85,7 @@ function SIWE(): React.Node { const { address } = useAccount(); const { data: signer } = useSigner(); - const { siweNonce } = React.useContext(SIWENonceContext); + const { siweNonce } = React.useContext(SIWEContext); const onClick = React.useCallback(() => { invariant(siweNonce, 'nonce must be present during SIWE attempt'); signInWithEthereum(address, signer, siweNonce);