diff --git a/landing/siwe.react.js b/landing/siwe.react.js index 93f9d00ba..12d855a27 100644 --- a/landing/siwe.react.js +++ b/landing/siwe.react.js @@ -1,97 +1,97 @@ // @flow import { ConnectButton, getDefaultWallets, RainbowKitProvider, } from '@rainbow-me/rainbowkit'; import * as React from 'react'; import { SiweMessage } from 'siwe'; import '@rainbow-me/rainbowkit/dist/index.css'; import { useAccount, useSigner, chain, configureChains, createClient, WagmiConfig, } from 'wagmi'; import { publicProvider } from 'wagmi/providers/public'; import css from './siwe.css'; // details can be found https://wagmi.sh/docs/providers/configuring-chains const { chains, provider } = configureChains( [chain.mainnet], [publicProvider()], ); const { connectors } = getDefaultWallets({ appName: 'comm', chains, }); const wagmiClient = createClient({ autoConnect: true, connectors, provider, }); function createSiweMessage(address, statement) { const domain = window.location.host; const origin = window.location.origin; const message = new SiweMessage({ domain, address, statement, uri: origin, version: '1', chainId: '1', }); return message.prepareMessage(); } async function signInWithEthereum(address, signer) { const message = createSiweMessage(address, 'Sign in to Comm with Ethereum'); - const signedMessage = await signer.signMessage(message); - const messageToPost = JSON.stringify({ address, signer }); + const signature = await signer.signMessage(message); + const messageToPost = JSON.stringify({ address, signature }); window.ReactNativeWebView?.postMessage?.(messageToPost); - return signedMessage; + return signature; } function SIWE(): React.Node { const { data } = useAccount(); const { address } = data || {}; const { data: signer } = useSigner(); const onClick = React.useCallback(() => signInWithEthereum(address, signer), [ address, signer, ]); const SignInButton = !signer ? null : (