mirror of https://github.com/waku-org/js-waku.git
Remove dead code
This commit is contained in:
parent
a8b29a2fac
commit
16b79306d5
|
@ -3,7 +3,6 @@ import '@ethersproject/shims';
|
|||
import React, { useEffect, useState } from 'react';
|
||||
import './App.css';
|
||||
import { Waku } from 'js-waku';
|
||||
import { Signer } from '@ethersproject/abstract-signer';
|
||||
import { Message } from './messaging/Messages';
|
||||
import 'fontsource-roboto';
|
||||
import { AppBar, IconButton, Toolbar, Typography } from '@material-ui/core';
|
||||
|
@ -67,7 +66,6 @@ const useStyles = makeStyles({
|
|||
|
||||
function App() {
|
||||
const [waku, setWaku] = useState<Waku>();
|
||||
const [signer, setSigner] = useState<Signer>();
|
||||
const [provider, setProvider] = useState<Web3Provider>();
|
||||
const [encPublicKey, setEncPublicKey] = useState<Uint8Array>();
|
||||
const [publicKeys, setPublicKeys] = useState<Map<string, Uint8Array>>(
|
||||
|
@ -193,7 +191,6 @@ function App() {
|
|||
<ConnectWallet
|
||||
setProvider={setProvider}
|
||||
setAddress={setAddress}
|
||||
setSigner={setSigner}
|
||||
/>
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
|
@ -204,7 +201,6 @@ function App() {
|
|||
address={address}
|
||||
/>
|
||||
<BroadcastPublicKey
|
||||
signer={signer}
|
||||
address={address}
|
||||
encryptionPublicKey={encPublicKey}
|
||||
waku={waku}
|
||||
|
|
|
@ -3,13 +3,11 @@ import React from 'react';
|
|||
import { createPublicKeyMessage } from './crypto';
|
||||
import { PublicKeyMessage } from './messaging/wire';
|
||||
import { WakuMessage, Waku } from 'js-waku';
|
||||
import { Signer } from '@ethersproject/abstract-signer';
|
||||
import { PublicKeyContentTopic } from './waku';
|
||||
|
||||
interface Props {
|
||||
encryptionPublicKey: Uint8Array | undefined;
|
||||
waku: Waku | undefined;
|
||||
signer: Signer | undefined;
|
||||
address: string | undefined;
|
||||
providerRequest:
|
||||
| ((request: { method: string; params?: Array<any> }) => Promise<any>)
|
||||
|
@ -17,7 +15,6 @@ interface Props {
|
|||
}
|
||||
|
||||
export default function BroadcastPublicKey({
|
||||
signer,
|
||||
encryptionPublicKey,
|
||||
address,
|
||||
waku,
|
||||
|
@ -25,18 +22,12 @@ export default function BroadcastPublicKey({
|
|||
}: Props) {
|
||||
const broadcastPublicKey = () => {
|
||||
if (!encryptionPublicKey) return;
|
||||
if (!signer) return;
|
||||
if (!address) return;
|
||||
if (!waku) return;
|
||||
if (!providerRequest) return;
|
||||
|
||||
console.log('Creating Public Key Message');
|
||||
createPublicKeyMessage(
|
||||
signer,
|
||||
address,
|
||||
encryptionPublicKey,
|
||||
providerRequest
|
||||
)
|
||||
createPublicKeyMessage(address, encryptionPublicKey, providerRequest)
|
||||
.then((msg) => {
|
||||
console.log('Public Key Message created');
|
||||
encodePublicKeyWakuMessage(msg)
|
||||
|
@ -63,7 +54,7 @@ export default function BroadcastPublicKey({
|
|||
variant="contained"
|
||||
color="primary"
|
||||
onClick={broadcastPublicKey}
|
||||
disabled={!encryptionPublicKey || !waku || !signer}
|
||||
disabled={!encryptionPublicKey || !waku || !address || !providerRequest}
|
||||
>
|
||||
Broadcast Encryption Public Key
|
||||
</Button>
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import { Button } from '@material-ui/core';
|
||||
import React from 'react';
|
||||
import { Signer } from '@ethersproject/abstract-signer';
|
||||
import { ethers } from 'ethers';
|
||||
import { Web3Provider } from '@ethersproject/providers/src.ts/web3-provider';
|
||||
|
||||
|
@ -8,15 +7,10 @@ declare let window: any;
|
|||
|
||||
interface Props {
|
||||
setAddress: (address: string) => void;
|
||||
setSigner: (signer: Signer) => void;
|
||||
setProvider: (provider: Web3Provider) => void;
|
||||
}
|
||||
|
||||
export default function ConnectWallet({
|
||||
setAddress,
|
||||
setSigner,
|
||||
setProvider,
|
||||
}: Props) {
|
||||
export default function ConnectWallet({ setAddress, setProvider }: Props) {
|
||||
const connectWallet = () => {
|
||||
try {
|
||||
window.ethereum
|
||||
|
@ -25,7 +19,6 @@ export default function ConnectWallet({
|
|||
const _provider = new ethers.providers.Web3Provider(window.ethereum);
|
||||
setAddress(accounts[0]);
|
||||
setProvider(_provider);
|
||||
setSigner(_provider.getSigner());
|
||||
});
|
||||
} catch (e) {
|
||||
console.error('No web3 provider available');
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import '@ethersproject/shims';
|
||||
|
||||
import { Signer } from '@ethersproject/abstract-signer';
|
||||
import { PublicKeyMessage } from './messaging/wire';
|
||||
import { hexToBuf, equalByteArrays, bufToHex } from 'js-waku/lib/utils';
|
||||
import * as sigUtil from 'eth-sig-util';
|
||||
|
@ -11,7 +10,6 @@ import * as sigUtil from 'eth-sig-util';
|
|||
* Ethereum Address holder.
|
||||
*/
|
||||
export async function createPublicKeyMessage(
|
||||
web3Signer: Signer,
|
||||
address: string,
|
||||
encryptionPublicKey: Uint8Array,
|
||||
providerRequest: (request: {
|
||||
|
|
Loading…
Reference in New Issue