-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathWallet.js
48 lines (37 loc) · 1.59 KB
/
Wallet.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// This has to be the first import, otherwise a "WARNING: Missing strong random number source" is thrown
import useWallet from "./useWallet";
import React, { useState, useEffect } from "react";
import { Button, Text, View, Image } from 'react-native';
import Anchor from "./Anchor";
import CopyableText from "./CopyableText";
import SColumn from "./SColumn";
import WalletConnectWallet from "./WalletConnectWallet";
const { getItem } = require('./Storage');
export default function Wallet({ network, scannedWalletConnectUrl, activeAccountIndex }) {
log("Wallet");
const [walletConnectError, setWalletConnectError] = useState();
const [walletConnectErrorURL, setWalletConnectErrorURL] = useState();
const resetError = () => {
setWalletConnectError();
setWalletConnectErrorURL();
}
const wallet = useWallet(network ? network.rpcUrl : null, activeAccountIndex);
return (
<SColumn>
<CopyableText text={wallet?.address} title={"Public Address:"}/>
<WalletConnectWallet
chainId={network.chainId}
scannedWalletConnectUrl={scannedWalletConnectUrl}
wallet={wallet}
setWalletConnectError={setWalletConnectError}
setWalletConnectErrorURL={setWalletConnectErrorURL}
/>
{walletConnectError && <>
<Text>
Coudn't connect to {walletConnectErrorURL}, something went wrong.
</Text>
<Button title={"OK"} onPress={() => resetError()} />
</>}
</SColumn>
);
}