Skip to content

Commit e5a2704

Browse files
committed
fix: siwe login for test app
1 parent edc0066 commit e5a2704

File tree

2 files changed

+15
-11
lines changed

2 files changed

+15
-11
lines changed

apps/customer/components/MoneriumConnect/MoneriumConnect.tsx

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
'use client';
22
import React from 'react';
33
import Image from 'next/image';
4-
import { useSignMessage } from 'wagmi';
4+
import { useChainId, useSignMessage } from 'wagmi';
55
import { useAccount } from 'wagmi';
6+
import { ConnectButton } from '@rainbow-me/rainbowkit';
67
import Alert from '@mui/material/Alert';
78
import Box from '@mui/material/Box';
89
import Button from '@mui/material/Button';
@@ -17,7 +18,7 @@ export const MoneriumConnect = () => {
1718
const { authorize, siwe, error } = useAuth();
1819
const { signMessageAsync } = useSignMessage();
1920
const [open, setOpen] = React.useState(!!(error as Error)?.message);
20-
21+
const chainId = useChainId();
2122
const handleClose = (
2223
event?: React.SyntheticEvent | Event,
2324
reason?: SnackbarCloseReason
@@ -34,7 +35,7 @@ export const MoneriumConnect = () => {
3435
address: `${address}`,
3536
appName: 'SDK TEST APP',
3637
redirectUri: 'http://localhost:3000/dashboard',
37-
chainId: 1,
38+
chainId: chainId,
3839
privacyPolicyUrl: 'https://example.com/privacy-policy',
3940
termsOfServiceUrl: 'https://example.com/terms-of-service',
4041
});
@@ -94,13 +95,16 @@ export const MoneriumConnect = () => {
9495
Connect
9596
</Button>
9697
</Box>
97-
<Button
98-
size="large"
99-
variant="outlined"
100-
onClick={() => signInWithEthereum()}
101-
>
102-
Sign In with Ethereum
103-
</Button>
98+
<div style={{ display: 'flex', gap: '10px', alignItems: 'center' }}>
99+
<ConnectButton />
100+
<Button
101+
size="large"
102+
variant="outlined"
103+
onClick={() => signInWithEthereum()}
104+
>
105+
Sign In with Ethereum
106+
</Button>
107+
</div>
104108
</Box>
105109
</>
106110
);

apps/customer/config/wagmi.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { getDefaultConfig } from '@rainbow-me/rainbowkit';
55
const config = getDefaultConfig({
66
appName: 'Monerium',
77
projectId: 'YOUR_PROJECT_ID', // TODO
8-
chains: [mainnet, sepolia],
8+
chains: [sepolia],
99
ssr: true,
1010
// transports: {
1111
// [mainnet.id]: http("https://eth-mainnet.g.alchemy.com/v2/..."),

0 commit comments

Comments
 (0)