diff --git a/src/app/App.js b/src/app/App.js
index 21aab85..aa94b56 100644
--- a/src/app/App.js
+++ b/src/app/App.js
@@ -1,68 +1,70 @@
-import { useContext } from "react";
+import { useContext, useEffect } from "react";
import { Router } from "react-chrome-extension-router";
+import { getWalletData } from "../background/wallet";
import AppPlug from "./components/AppPlug/AppPlug";
import Header from "./components/Header/Header";
import TokensTabs from "./components/TokensTabs/TokensTabs";
import Wallet from "./components/Wallet/Wallet";
+import { updateWalletConnected, updateWalletData } from "./store/actions";
import { Store } from "./store/store-reducer";
import "./styles/App.scss";
function App() {
const { state, dispatch } = useContext(Store);
- // useEffect(() => {
- // const checkConnection = async () => {
- // // eslint-disable-next-line no-undef
- // if (chrome.runtime.sendMessage) {
- // // eslint-disable-next-line no-undef
- // chrome.runtime.sendMessage(
- // { message: "GET_WALLET_BALANCE" },
- // (response) => {
- // if (response.data) {
- // updateWalletConnected(dispatch, true);
- // } else {
- // updateWalletConnected(dispatch, false);
- // }
- // }
- // );
- // }
- // };
- //
- // const getWalletData = async () => {
- // // eslint-disable-next-line no-undef
- // if (chrome.runtime.sendMessage) {
- // // eslint-disable-next-line no-undef
- // chrome.runtime.sendMessage(
- // { message: "GET_WALLET_DATA" },
- // (response) => {
- // if (response.data) {
- // const { address, balance, transactions, assets } = response.data;
- // updateWalletData(dispatch, {
- // address,
- // alias: "alias",
- // balance,
- // assets,
- // transactions,
- // });
- // console.log("wallet data updated");
- // }
- // }
- // );
- // }
- // };
- //
- // const intervalId = setInterval(async () => {
- // await checkConnection();
- // console.log("connected", state.isConnected);
- // if (state.isConnected) {
- // await getWalletData();
- // }
- // }, 1000);
- //
- // return () => clearInterval(intervalId);
- // }, [dispatch, state.isConnected]);
+ useEffect(() => {
+ const checkConnection = async () => {
+ // eslint-disable-next-line no-undef
+ if (chrome.runtime.sendMessage) {
+ // eslint-disable-next-line no-undef
+ chrome.runtime.sendMessage(
+ { message: "GET_WALLET_BALANCE" },
+ (response) => {
+ if (response.data) {
+ updateWalletConnected(dispatch, true);
+ } else {
+ updateWalletConnected(dispatch, false);
+ }
+ }
+ );
+ }
+ };
- // state.isConnected && setInterval(() => getWalletData(), 1000);
+ const getWalletData = async () => {
+ // eslint-disable-next-line no-undef
+ if (chrome.runtime.sendMessage) {
+ // eslint-disable-next-line no-undef
+ chrome.runtime.sendMessage(
+ { message: "GET_WALLET_DATA" },
+ (response) => {
+ if (response.data) {
+ const { address, balance, transactions, assets } = response.data;
+ updateWalletData(dispatch, {
+ address,
+ alias: "alias",
+ balance,
+ assets,
+ transactions,
+ });
+ console.log("wallet data updated");
+ }
+ }
+ );
+ }
+ };
+
+ const intervalId = setInterval(async () => {
+ await checkConnection();
+ console.log("connected", state.isConnected);
+ if (state.isConnected) {
+ await getWalletData();
+ }
+ }, 1000);
+
+ return () => clearInterval(intervalId);
+ }, [dispatch, state.isConnected]);
+
+ state.isConnected && setInterval(() => getWalletData(), 1000);
return (
diff --git a/src/app/assets/images/failed-round.png b/src/app/assets/images/failed-round.png
new file mode 100644
index 0000000..e9f30bc
Binary files /dev/null and b/src/app/assets/images/failed-round.png differ
diff --git a/src/app/assets/images/success-round.png b/src/app/assets/images/success-round.png
new file mode 100644
index 0000000..d587c49
Binary files /dev/null and b/src/app/assets/images/success-round.png differ
diff --git a/src/app/assets/svg/check-icon.svg b/src/app/assets/svg/check-icon.svg
new file mode 100644
index 0000000..b22bbd8
--- /dev/null
+++ b/src/app/assets/svg/check-icon.svg
@@ -0,0 +1,5 @@
+
diff --git a/src/app/assets/svg/loader.svg b/src/app/assets/svg/loader.svg
new file mode 100644
index 0000000..16ad9b6
--- /dev/null
+++ b/src/app/assets/svg/loader.svg
@@ -0,0 +1,8 @@
+
diff --git a/src/app/assets/svg/plus-icon.svg b/src/app/assets/svg/plus-icon.svg
new file mode 100644
index 0000000..1ca4fe8
--- /dev/null
+++ b/src/app/assets/svg/plus-icon.svg
@@ -0,0 +1,6 @@
+
diff --git a/src/app/assets/svg/send.svg b/src/app/assets/svg/send.svg
index b58285e..8dec5eb 100644
--- a/src/app/assets/svg/send.svg
+++ b/src/app/assets/svg/send.svg
@@ -1,11 +1,11 @@
-