No need for a wallet to send messages

This commit is contained in:
Franck Royer 2021-08-12 15:15:56 +10:00
parent a1218c1223
commit 6038007d40
No known key found for this signature in database
GPG Key ID: A82ED75A8DFC50A4
2 changed files with 8 additions and 22 deletions

View File

@ -76,13 +76,6 @@ function App() {
);
const [messages, setMessages] = useState<Message[]>([]);
const [address, setAddress] = useState<string>();
const [peerStats, setPeerStats] = useState<{
relayPeers: number;
lightPushPeers: number;
}>({
relayPeers: 0,
lightPushPeers: 0,
});
const classes = useStyles();
@ -101,7 +94,6 @@ function App() {
useEffect(() => {
if (!waku) return;
if (!address) return;
const observerPublicKeyMessage = handlePublicKeyMessage.bind(
{},
@ -155,17 +147,12 @@ function App() {
};
}, [waku, address, EncryptionKeyPair]);
useEffect(() => {
if (!waku) return;
const interval = setInterval(() => {
setPeerStats({
relayPeers: waku.relay.getPeers().size,
lightPushPeers: waku.lightPush.peers.length,
});
}, 1000);
return () => clearInterval(interval);
}, [waku]);
let relayPeers = 0;
let lightPushPeers = 0;
if (waku) {
relayPeers = waku.relay.getPeers().size;
lightPushPeers = waku.lightPush.peers.length;
}
let addressDisplay = '';
if (address) {
@ -189,8 +176,7 @@ function App() {
/>
</IconButton>
<Typography className={classes.peers} aria-label="connected-peers">
Peers: {peerStats.relayPeers} relay, {peerStats.lightPushPeers}{' '}
light push
Peers: {relayPeers} relay, {lightPushPeers} light push
</Typography>
<Typography variant="h6" className={classes.title}>
Ethereum Direct Message

View File

@ -33,7 +33,7 @@ export async function initWaku(): Promise<Waku> {
}
export function handlePublicKeyMessage(
myAddress: string,
myAddress: string | undefined,
setter: Dispatch<SetStateAction<Map<string, Uint8Array>>>,
msg: WakuMessage
) {