diff --git a/joinmarket/src/App.js b/joinmarket/src/App.js index fb294bfe..5c6ee1c8 100644 --- a/joinmarket/src/App.js +++ b/joinmarket/src/App.js @@ -1,7 +1,4 @@ import './App.css'; -import { Button } from './components/Button'; -import Wallet from './components/Wallet'; -import { BitcoinQR } from '@ibunker/bitcoin-react'; import '@ibunker/bitcoin-react/dist/index.css'; import {useState,useEffect} from 'react' import Wallets from './components/Wallets'; @@ -14,13 +11,12 @@ import DisplayWallet from './components/DisplayWallet' import * as rb from 'react-bootstrap'; import github_logo from './github.svg' import twitter_logo from './twitter.svg' -import { BrowserRouter as Router, Link, Route ,Switch,Redirect} from 'react-router-dom'; import useInterval from './components/utils' +import { BrowserRouter as Router, Route ,Switch} from 'react-router-dom'; + function App() { - // const [currWallet,setCurrWallet] = useState({}) const [walletList,setWalletList] = useState([]) - const listWallets = async()=>{ const res = await fetch('/wallet/all'); @@ -30,15 +26,13 @@ function App() { } useInterval(() => { - // put your interval code here. const sessionClear = async()=>{ try{ - const res = await fetch('/session',{ - method:"GET", - + method:"GET", }); + const data = await res.json(); if(data[0].session===false){ console.log("no wallet in backend") @@ -46,7 +40,6 @@ function App() { return; } console.log("backend alive and wallet loaded") - } catch(e){ @@ -54,11 +47,9 @@ function App() { alert("Lost connection to backend! Please restart the backend server."); sessionStorage.clear(); } - } sessionClear(); - }, 1000 * 5); useEffect(()=>{ @@ -78,12 +69,12 @@ function App() { let authData =JSON.parse(sessionStorage.getItem('auth')); console.log(authData) - //if unlcoking same wallet + //if unlocking same wallet if(authData && authData.login===true && authData.name===name){ alert(name+" is aldready unlocked") return; } - //if unlocking other wallet while one unlocked + //if unlocking another wallet while one is already unlocked else if(authData && authData.login===true && authData.name!==name){ alert(authData.name+" is currently in use,please lock it first"); return; @@ -117,12 +108,7 @@ function App() { } } - - - - - - } + } const lockWallet = async(name)=>{ let authData =JSON.parse(sessionStorage.getItem('auth')); @@ -206,10 +192,6 @@ function App() { wallet_info[mix_depths[4].account] = mix_depths[4].account_balance console.log(wallet_info) return wallet_info; - - window.alert("Wallet Name: " + wallet_name + "\n" + "Total balance: " + balance); - window.alert(mix_depths[0].account + " " + mix_depths[0].account_balance + "\n" + mix_depths[1].account + " " + mix_depths[1].account_balance + "\n" + mix_depths[2].account + " " + mix_depths[2].account_balance + "\n" + mix_depths[3].account + " " + mix_depths[3].account_balance + "\n" + mix_depths[4].account + " " + mix_depths[4].account_balance); - } const createWallet = async(name,password)=>{ @@ -237,8 +219,8 @@ function App() { })) } catch(e){ - //but what if some other error where wallet not created - alert("UNexpected error!PLease try again") + //some other error occurs where wallet is not created + alert("Unexpected error! PLease try again") } } else{ @@ -379,16 +361,9 @@ function App() { catch(e){ alert("Error while stopping service!") - } - - - - - + } } - - const getUTXOs = async()=>{ try{ let authData =JSON.parse(sessionStorage.getItem('auth')); @@ -405,8 +380,6 @@ function App() { }); const data = await res.json(); return JSON.parse(data[0].transactions); - - } catch(e){ @@ -422,38 +395,38 @@ function App() { - - Joinmarket - - - - Docs - Features - About - - - - github logo - - - twitter logo - - - - - + + Joinmarket + + + + Docs + Features + About + + + + github logo + + + twitter logo + + + + +

diff --git a/joinmarket/src/components/CreateWallet.jsx b/joinmarket/src/components/CreateWallet.jsx index 34dc284a..1a422134 100644 --- a/joinmarket/src/components/CreateWallet.jsx +++ b/joinmarket/src/components/CreateWallet.jsx @@ -15,15 +15,10 @@ const CreateWallet = ({onCreate}) => { alert('Please add details') return; } - console.log("okay") - //maybe add await here - // let wallet =JSON.parse(sessionStorage.getItem('auth')).name; - // onPayment(wallet,mixdepth,amount,destination) + onCreate(wallet,password) setWallet('') setPassword('') - - } return ( diff --git a/joinmarket/src/components/DisplayMixdepth.jsx b/joinmarket/src/components/DisplayMixdepth.jsx index c5387c5d..4edc98d7 100644 --- a/joinmarket/src/components/DisplayMixdepth.jsx +++ b/joinmarket/src/components/DisplayMixdepth.jsx @@ -6,19 +6,13 @@ import * as rb from 'react-bootstrap' const DisplayMixdepth = ({walletInfo}) => { - console.log(walletInfo) - const accounts = [] for (const account_info of walletInfo.accounts){ accounts.push(account_info) } - - console.log(accounts) return ( - -
Total Balance: {walletInfo.total_balance} BTC

diff --git a/joinmarket/src/components/DisplayUTXOs.jsx b/joinmarket/src/components/DisplayUTXOs.jsx index 3238ea99..c06eced2 100644 --- a/joinmarket/src/components/DisplayUTXOs.jsx +++ b/joinmarket/src/components/DisplayUTXOs.jsx @@ -4,9 +4,7 @@ const DisplayUTXOs = ({utxoID,utxo}) => { return (

-

- {/* Transaction ID: {transactionID} */}

Address: {utxo.address}

diff --git a/joinmarket/src/components/DisplayWallet.jsx b/joinmarket/src/components/DisplayWallet.jsx index 5208698f..caf05996 100644 --- a/joinmarket/src/components/DisplayWallet.jsx +++ b/joinmarket/src/components/DisplayWallet.jsx @@ -3,6 +3,7 @@ import {useState,useEffect} from 'react' import { Button } from './Button' import DisplayMixdepth from './DisplayMixdepth' import DisplayUTXOs from './DisplayUTXOs' + const DisplayWallet = ({listWalletInfo,onSend,listUTXOs}) => { const [wallet_info,setWalletInfo] = useState([]) const [UTXOHistory,setUTXOHistory] = useState({}) @@ -39,18 +40,12 @@ const DisplayWallet = ({listWalletInfo,onSend,listUTXOs}) => { { showUTXO? - - Object.entries(UTXOHistory).map(([key, val])=> - //
{key}:{val.address}
- ) + ) : "" - } - - - + }
) } diff --git a/joinmarket/src/components/Homepage.css b/joinmarket/src/components/Homepage.css index 748abc82..84e696b9 100644 --- a/joinmarket/src/components/Homepage.css +++ b/joinmarket/src/components/Homepage.css @@ -1,6 +1,4 @@ - .container1{ - /* background-color: rgb(223, 29, 29); */ height: 100vh; padding-top: 100px; } diff --git a/joinmarket/src/components/Maker.jsx b/joinmarket/src/components/Maker.jsx index a140c60c..eb0b5e9e 100644 --- a/joinmarket/src/components/Maker.jsx +++ b/joinmarket/src/components/Maker.jsx @@ -2,8 +2,6 @@ import React from 'react' import { useState } from 'react' const Maker = ({onStart,onStop}) => { - - const [txFee,setTxFee] = useState('') const [cjfeeAbs,setCjfeeabs] = useState('') const [cjfeeRel,setCjfeerel] = useState('') diff --git a/joinmarket/src/components/Payment.jsx b/joinmarket/src/components/Payment.jsx index 1aa953d1..e68c8362 100644 --- a/joinmarket/src/components/Payment.jsx +++ b/joinmarket/src/components/Payment.jsx @@ -3,6 +3,7 @@ import { useState } from 'react' import { useLocation } from "react-router-dom" import './payment.css' import * as rb from 'react-bootstrap' + const Payment = ({onPayment,onCoinjoin}) => { const location = useLocation() const [destination, setDestination] = useState('') @@ -52,7 +53,7 @@ const Payment = ({onPayment,onCoinjoin}) => { return (
-

+

Send Payment
@@ -127,48 +128,6 @@ const Payment = ({onPayment,onCoinjoin}) => { - - - {/*

Make Payment

-
- -

- -

- -

- Do you want to do a coinjoin? -

- Yes setisCoinjoin(true)} /> -

- No setisCoinjoin(false)}/> -

- - - { - isCoinjoin? -
- Counterparties - setcounterparties(e.target.value)}/> -
- : - - "" - } -

- - - -
*/}
) } diff --git a/joinmarket/src/components/Receive.jsx b/joinmarket/src/components/Receive.jsx index 918da2fb..b0ea8b00 100644 --- a/joinmarket/src/components/Receive.jsx +++ b/joinmarket/src/components/Receive.jsx @@ -40,8 +40,6 @@ const Receive = ({onReceive}) => { getNewAddress(location.state.account_no); },[]) - //getNewAddress('0') - //const [address, setAddress] = useState('') const [temp_address, setTempAddress] = useState('') const [amount, setAmount] = useState('') @@ -53,19 +51,14 @@ const Receive = ({onReceive}) => { return } - setTempAddress(new_address) - //maybe add await here - // let wallet =JSON.parse(sessionStorage.getItem('auth')).name; - // onRecieve(wallet,mixdepth,amount,message) - - + setTempAddress(new_address) } return (
-

+

Recieve Funds
@@ -98,48 +91,19 @@ const Receive = ({onReceive}) => { {temp_address.length > 0? ( - ):("")} + ):("")} - - - - {/*

Receive funds

-
- -

*/} - {/* -

- {/* -

- - - -
*/} - - - - -
) } diff --git a/joinmarket/src/components/Wallet.jsx b/joinmarket/src/components/Wallet.jsx index 9f919f36..cb13d2fc 100644 --- a/joinmarket/src/components/Wallet.jsx +++ b/joinmarket/src/components/Wallet.jsx @@ -15,11 +15,6 @@ const Wallet = ({name,onUnlock,onLock,onDisplay}) => { onLock(name)}>Lock - {/*

{name}

- - - Open - */}
) } diff --git a/joinmarket/src/components/Wallets.jsx b/joinmarket/src/components/Wallets.jsx index 2b737833..d7821bcc 100644 --- a/joinmarket/src/components/Wallets.jsx +++ b/joinmarket/src/components/Wallets.jsx @@ -1,15 +1,10 @@ import React from 'react' import Wallet from './Wallet' -import { BrowserRouter as Router, Link, Route ,Switch} from 'react-router-dom'; const Wallets = ({walletList,onUnlock,onLock,onDisplay}) => { return ( <>

- {/* Maker Service -

- Receive -

*/} {walletList.map((wallet,index)=>{ return })} diff --git a/joinmarket/src/components/homepage.jsx b/joinmarket/src/components/homepage.jsx index c981cc01..05661323 100644 --- a/joinmarket/src/components/homepage.jsx +++ b/joinmarket/src/components/homepage.jsx @@ -2,8 +2,6 @@ import React from 'react' import * as rb from 'react-bootstrap' import './Homepage.css' import { BrowserRouter as Router, Link, Route ,Switch} from 'react-router-dom'; -import {BeautifulQuestions,SunnyMorning,SignalNoise,Thursday} from 'moving-letters' - const Homepage = () => { diff --git a/joinmarket/src/components/utils.jsx b/joinmarket/src/components/utils.jsx index 77663f2d..a1dd9861 100644 --- a/joinmarket/src/components/utils.jsx +++ b/joinmarket/src/components/utils.jsx @@ -1,5 +1,3 @@ -// utils.js - import React, { useState, useEffect, useRef } from 'react'; const useInterval = (callback, delay) => {