From a3cc136e4d6737c94bae758d63069a3769f7677c Mon Sep 17 00:00:00 2001 From: Flash Date: Fri, 19 Jul 2019 13:14:46 +0200 Subject: [PATCH 001/425] Added alert context --- client/src/context/alert/AlertContext.js | 5 +++ client/src/context/alert/AlertReducer.js | 12 +++++++ client/src/context/alert/AlertState.js | 40 ++++++++++++++++++++++++ client/src/context/types.js | 3 ++ 4 files changed, 60 insertions(+) create mode 100644 client/src/context/alert/AlertContext.js create mode 100644 client/src/context/alert/AlertReducer.js create mode 100644 client/src/context/alert/AlertState.js create mode 100644 client/src/context/types.js diff --git a/client/src/context/alert/AlertContext.js b/client/src/context/alert/AlertContext.js new file mode 100644 index 0000000..8751654 --- /dev/null +++ b/client/src/context/alert/AlertContext.js @@ -0,0 +1,5 @@ +import { createContext } from "react"; + +const AlertContext = createContext(); + +export default AlertContext; diff --git a/client/src/context/alert/AlertReducer.js b/client/src/context/alert/AlertReducer.js new file mode 100644 index 0000000..459f5b3 --- /dev/null +++ b/client/src/context/alert/AlertReducer.js @@ -0,0 +1,12 @@ +import { SET_ALERT, REMOVE_ALERT } from "../types"; + +export default (state, action) => { + switch (action.type) { + case SET_ALERT: + return [...state, action.payload]; + case REMOVE_ALERT: + return state.filter(alert => alert.id !== action.payload); + default: + return state; + } +}; diff --git a/client/src/context/alert/AlertState.js b/client/src/context/alert/AlertState.js new file mode 100644 index 0000000..c42d0d4 --- /dev/null +++ b/client/src/context/alert/AlertState.js @@ -0,0 +1,40 @@ +import React, { useReducer } from "react"; +import uuid from "uuid"; + +import { SET_ALERT, REMOVE_ALERT } from "../types"; + +import AlertContext from "./AlertContext"; +import AlertReducer from "./AlertReducer"; + +const AlertState = () => { + const initialState = []; + + const [state, dispatch] = useReducer(AlertReducer, initialState); + + /* + * Actions + */ + + const setAlert = (msg, type, timeout = 5000) => { + const id = uuid.v4(); + + dispatch({ + type: SET_ALERT, + payload: { msg, type, id } + }); + + setTimeout(() => dispatch({ type: REMOVE_ALERT, payload: id }), timeout); + }; + + return ( + + {props.children} + + ); +}; +export default AlertState; diff --git a/client/src/context/types.js b/client/src/context/types.js new file mode 100644 index 0000000..b5f5828 --- /dev/null +++ b/client/src/context/types.js @@ -0,0 +1,3 @@ +// Alerts +export const SET_ALERT = "SET_ALERT"; +export const REMOVE_ALERT = "REMOVE_ALERT"; From c88c7336916354c2a7b16f6ff2740910542a3729 Mon Sep 17 00:00:00 2001 From: Flash Date: Fri, 19 Jul 2019 18:30:36 +0200 Subject: [PATCH 002/425] Added alerts --- client/src/components/layout/Alerts.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 client/src/components/layout/Alerts.js diff --git a/client/src/components/layout/Alerts.js b/client/src/components/layout/Alerts.js new file mode 100644 index 0000000..92edf1d --- /dev/null +++ b/client/src/components/layout/Alerts.js @@ -0,0 +1,20 @@ +import React, { useContext } from "react"; +import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; + +import AlertContext from "../../context/alert/AlertContext"; + +const Alerts = () => { + const alertContext = useContext(AlertContext); + + return ( + alertContext.alerts.length > 0 && + alertContext.alerts.map(alert => ( +
+ + {alert.msg} +
+ )) + ); +}; + +export default Alerts; From 6ae5ba6d2af41700a39ff08fad4cef75409b95f9 Mon Sep 17 00:00:00 2001 From: Flash Date: Sat, 20 Jul 2019 00:49:04 +0200 Subject: [PATCH 003/425] Updated dependencies --- client/package-lock.json | 127 +++++++++++++++++++++++++++++++++++++-- client/package.json | 1 + 2 files changed, 123 insertions(+), 5 deletions(-) diff --git a/client/package-lock.json b/client/package-lock.json index f376497..b18eb09 100644 --- a/client/package-lock.json +++ b/client/package-lock.json @@ -7041,6 +7041,11 @@ "resolved": "https://registry.npmjs.org/growly/-/growly-1.3.0.tgz", "integrity": "sha1-8QdIy+dq+WS3yWyTxrzCivEgwIE=" }, + "gud": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/gud/-/gud-1.0.0.tgz", + "integrity": "sha512-zGEOVKFM5sVPPrYs7J5/hYEw2Pof8KCyOwyhG8sAF26mCAeUFAcYPu1mwB7hhpIP29zOIBaDqwuHdLp0jvZXjw==" + }, "gzip-size": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/gzip-size/-/gzip-size-5.0.0.tgz", @@ -7241,6 +7246,19 @@ "resolved": "https://registry.npmjs.org/hex-color-regex/-/hex-color-regex-1.1.0.tgz", "integrity": "sha512-l9sfDFsuqtOqKDsQdqrMRk0U85RZc0RtOR9yPI7mRVOa4FsR/BVnZ0shmQRM96Ji99kYZP/7hn1cedc1+ApsTQ==" }, + "history": { + "version": "4.9.0", + "resolved": "https://registry.npmjs.org/history/-/history-4.9.0.tgz", + "integrity": "sha512-H2DkjCjXf0Op9OAr6nJ56fcRkTSNrUiv41vNJ6IswJjif6wlpZK0BTfFbi7qK9dXLSYZxkq5lBsj3vUjlYBYZA==", + "requires": { + "@babel/runtime": "^7.1.2", + "loose-envify": "^1.2.0", + "resolve-pathname": "^2.2.0", + "tiny-invariant": "^1.0.2", + "tiny-warning": "^1.0.0", + "value-equal": "^0.4.0" + } + }, "hmac-drbg": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", @@ -7256,6 +7274,14 @@ "resolved": "http://registry.npmjs.org/hoek/-/hoek-4.2.1.tgz", "integrity": "sha512-QLg82fGkfnJ/4iy1xZ81/9SIJiq1NGFUMGs6ParyjBZr6jW2Ufj/snDqTHixNlHdPNwN2RLVD0Pi3igeK9+JfA==" }, + "hoist-non-react-statics": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/hoist-non-react-statics/-/hoist-non-react-statics-3.3.0.tgz", + "integrity": "sha512-0XsbTXxgiaCDYDIWFcwkmerZPSwywfUqYmwT4jzewKTQSWoE6FCMoUVOeBJWK3E/CrWbxRG3m5GzY4lnIwGRBA==", + "requires": { + "react-is": "^16.7.0" + } + }, "home-or-tmp": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/home-or-tmp/-/home-or-tmp-2.0.0.tgz", @@ -9205,9 +9231,9 @@ } }, "lodash": { - "version": "4.17.11", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz", - "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==" + "version": "4.17.15", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", + "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==" }, "lodash._reinterpolate": { "version": "3.0.0", @@ -9531,6 +9557,31 @@ "dom-walk": "^0.1.0" } }, + "mini-create-react-context": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/mini-create-react-context/-/mini-create-react-context-0.3.2.tgz", + "integrity": "sha512-2v+OeetEyliMt5VHMXsBhABoJ0/M4RCe7fatd/fBy6SMiKazUSEt3gxxypfnk2SHMkdBYvorHRoQxuGoiwbzAw==", + "requires": { + "@babel/runtime": "^7.4.0", + "gud": "^1.0.0", + "tiny-warning": "^1.0.2" + }, + "dependencies": { + "@babel/runtime": { + "version": "7.5.5", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.5.5.tgz", + "integrity": "sha512-28QvEGyQyNkB0/m2B4FU7IEZGK2NUrcMtT6BZEFALTguLk+AUT6ofsHtPk5QyjAdUkpMJ+/Em+quwz4HOt30AQ==", + "requires": { + "regenerator-runtime": "^0.13.2" + } + }, + "regenerator-runtime": { + "version": "0.13.3", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.3.tgz", + "integrity": "sha512-naKIZz2GQ8JWh///G7L3X6LaQUAMp2lvb1rvwwsURe/VXwD6VMfr+/1NuNw3ag8v2kY1aQ/go5SNn79O9JU7yw==" + } + } + }, "mini-css-extract-plugin": { "version": "0.5.0", "resolved": "https://registry.npmjs.org/mini-css-extract-plugin/-/mini-css-extract-plugin-0.5.0.tgz", @@ -13227,6 +13278,52 @@ "resolved": "https://registry.npmjs.org/react-lifecycles-compat/-/react-lifecycles-compat-3.0.4.tgz", "integrity": "sha512-fBASbA6LnOU9dOU2eW7aQ8xmYBSXUIWr+UmF9b1efZBazGNO+rcXT/icdKnYm2pTwcRylVUYwW7H1PHfLekVzA==" }, + "react-router": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/react-router/-/react-router-5.0.1.tgz", + "integrity": "sha512-EM7suCPNKb1NxcTZ2LEOWFtQBQRQXecLxVpdsP4DW4PbbqYWeRiLyV/Tt1SdCrvT2jcyXAXmVTmzvSzrPR63Bg==", + "requires": { + "@babel/runtime": "^7.1.2", + "history": "^4.9.0", + "hoist-non-react-statics": "^3.1.0", + "loose-envify": "^1.3.1", + "mini-create-react-context": "^0.3.0", + "path-to-regexp": "^1.7.0", + "prop-types": "^15.6.2", + "react-is": "^16.6.0", + "tiny-invariant": "^1.0.2", + "tiny-warning": "^1.0.0" + }, + "dependencies": { + "isarray": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", + "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=" + }, + "path-to-regexp": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-1.7.0.tgz", + "integrity": "sha1-Wf3g9DW62suhA6hOnTvGTpa5k30=", + "requires": { + "isarray": "0.0.1" + } + } + } + }, + "react-router-dom": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-5.0.1.tgz", + "integrity": "sha512-zaVHSy7NN0G91/Bz9GD4owex5+eop+KvgbxXsP/O+iW1/Ln+BrJ8QiIR5a6xNPtrdTvLkxqlDClx13QO1uB8CA==", + "requires": { + "@babel/runtime": "^7.1.2", + "history": "^4.9.0", + "loose-envify": "^1.3.1", + "prop-types": "^15.6.2", + "react-router": "5.0.1", + "tiny-invariant": "^1.0.2", + "tiny-warning": "^1.0.0" + } + }, "react-scripts": { "version": "2.1.8", "resolved": "https://registry.npmjs.org/react-scripts/-/react-scripts-2.1.8.tgz", @@ -14389,6 +14486,11 @@ "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-3.0.0.tgz", "integrity": "sha1-six699nWiBvItuZTM17rywoYh0g=" }, + "resolve-pathname": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/resolve-pathname/-/resolve-pathname-2.2.0.tgz", + "integrity": "sha512-bAFz9ld18RzJfddgrO2e/0S2O81710++chRMUxHjXOYKF6jTAMrUNZrEZ1PvV0zlhfjidm08iRPdTLPno1FuRg==" + }, "resolve-url": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/resolve-url/-/resolve-url-0.2.1.tgz", @@ -15705,7 +15807,7 @@ }, "strip-ansi": { "version": "3.0.1", - "resolved": "http://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", "requires": { "ansi-regex": "^2.0.0" @@ -16150,6 +16252,16 @@ "resolved": "https://registry.npmjs.org/timsort/-/timsort-0.3.0.tgz", "integrity": "sha1-QFQRqOfmM5/mTbmiNN4R3DHgK9Q=" }, + "tiny-invariant": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/tiny-invariant/-/tiny-invariant-1.0.6.tgz", + "integrity": "sha512-FOyLWWVjG+aC0UqG76V53yAWdXfH8bO6FNmyZOuUrzDzK8DI3/JRY25UD7+g49JWM1LXwymsKERB+DzI0dTEQA==" + }, + "tiny-warning": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/tiny-warning/-/tiny-warning-1.0.3.tgz", + "integrity": "sha512-lBN9zLN/oAf68o3zNXYrdCt1kP8WsiGW8Oo2ka41b2IM5JL/S1CTyX1rW0mb/zSuJun0ZUrDxx4sqvYS2FWzPA==" + }, "tmp": { "version": "0.0.33", "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", @@ -16650,6 +16762,11 @@ "spdx-expression-parse": "^3.0.0" } }, + "value-equal": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/value-equal/-/value-equal-0.4.0.tgz", + "integrity": "sha512-x+cYdNnaA3CxvMaTX0INdTCN8m8aF2uY9BvEqmxuYp8bL09cs/kWVQPVGcA35fMktdOsP69IgU7wFj/61dJHEw==" + }, "vary": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", @@ -18493,7 +18610,7 @@ }, "yargs": { "version": "11.1.0", - "resolved": "http://registry.npmjs.org/yargs/-/yargs-11.1.0.tgz", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-11.1.0.tgz", "integrity": "sha512-NwW69J42EsCSanF8kyn5upxvjp5ds+t3+udGBeTbFnERA+lF541DDpMawzo4z6W/QrzNM18D+BPMiOBibnFV5A==", "requires": { "cliui": "^4.0.0", diff --git a/client/package.json b/client/package.json index 4701953..3eb5166 100644 --- a/client/package.json +++ b/client/package.json @@ -13,6 +13,7 @@ "ethereum-ens": "^0.7.7", "react": "^16.8.6", "react-dom": "^16.8.6", + "react-router-dom": "^5.0.1", "react-scripts": "^2.1.8", "react-transition-group": "^2.9.0", "uuid": "^3.3.2", From dc0209b3c17e69f5bd2d85a169bffe18a4d01a7c Mon Sep 17 00:00:00 2001 From: Flash Date: Sat, 20 Jul 2019 02:58:58 +0200 Subject: [PATCH 004/425] Added trade context --- client/src/context/trade/TradeContext.js | 5 +++ client/src/context/trade/TradeReducer.js | 18 ++++++++++ client/src/context/trade/TradeState.js | 45 ++++++++++++++++++++++++ 3 files changed, 68 insertions(+) create mode 100644 client/src/context/trade/TradeContext.js create mode 100644 client/src/context/trade/TradeReducer.js create mode 100644 client/src/context/trade/TradeState.js diff --git a/client/src/context/trade/TradeContext.js b/client/src/context/trade/TradeContext.js new file mode 100644 index 0000000..b81cc34 --- /dev/null +++ b/client/src/context/trade/TradeContext.js @@ -0,0 +1,5 @@ +import { createContext } from "react"; + +const TradeContext = createContext(); + +export default TradeContext; diff --git a/client/src/context/trade/TradeReducer.js b/client/src/context/trade/TradeReducer.js new file mode 100644 index 0000000..c366555 --- /dev/null +++ b/client/src/context/trade/TradeReducer.js @@ -0,0 +1,18 @@ +import { ADD_TRADE_ITEM, REMOVE_TRADE_ITEM } from "../types"; + +export default (state, action) => { + switch (action.type) { + case ADD_TRADE_ITEM: + return { + ...state, + tradeItems: [...state.tradeItems, action.payload] + }; + case REMOVE_TRADE_ITEM: + return { + ...state, + tradeItems: state.tradeItems.filter(item => item.id !== action.payload) + }; + default: + return state; + } +}; diff --git a/client/src/context/trade/TradeState.js b/client/src/context/trade/TradeState.js new file mode 100644 index 0000000..d4c3af8 --- /dev/null +++ b/client/src/context/trade/TradeState.js @@ -0,0 +1,45 @@ +import React, { useReducer } from "react"; + +import { ADD_TRADE_ITEM, REMOVE_TRADE_ITEM } from "../types"; + +import TradeContext from "./TradeContext"; +import TradeReducer from "./TradeReducer"; + +const TradeState = () => { + const initialState = { + tradeItems: [] + }; + + const [state, dispatch] = useReducer(TradeReducer, initialState); + + /* + * Actions + */ + + const addTradeItem = tradeItem => { + dispatch({ + type: ADD_TRADE_ITEM, + payload: tradeItem + }); + }; + + const removeTradeItem = id => { + dispatch({ + type: REMOVE_TRADE_ITEM, + payload: id + }); + }; + + return ( + + {props.children} + + ); +}; +export default TradeState; From 60bdb94b25f006681ae64118a4db76999f5c5597 Mon Sep 17 00:00:00 2001 From: Flash Date: Sat, 20 Jul 2019 02:59:10 +0200 Subject: [PATCH 005/425] Added trade items --- client/src/context/types.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/client/src/context/types.js b/client/src/context/types.js index b5f5828..c865350 100644 --- a/client/src/context/types.js +++ b/client/src/context/types.js @@ -1,3 +1,7 @@ // Alerts export const SET_ALERT = "SET_ALERT"; export const REMOVE_ALERT = "REMOVE_ALERT"; + +//Trade Items +export const ADD_TRADE_ITEM = "ADD_TRADE_ITEM"; +export const REMOVE_TRADE_ITEM = "REMOVE_TRADE_ITEM"; From f19720c549764d42f8ce7f8f5ca3ebd5bcddff78 Mon Sep 17 00:00:00 2001 From: Flash Date: Sat, 20 Jul 2019 03:00:01 +0200 Subject: [PATCH 006/425] Updated navbar --- client/src/components/layout/Navbar.js | 93 ++++++++++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 client/src/components/layout/Navbar.js diff --git a/client/src/components/layout/Navbar.js b/client/src/components/layout/Navbar.js new file mode 100644 index 0000000..7490bd0 --- /dev/null +++ b/client/src/components/layout/Navbar.js @@ -0,0 +1,93 @@ +import React from "react"; +//import makeBlockie from "ethereum-blockies-base64"; +import PropTypes from "prop-types"; + +import { colours } from "../Static"; + +const Navbar = () => { + const connected = true; + const network = 1; + + const networkText = network => { + switch (network) { + case 1: + return "LIVE"; + case 4: + return "RINKEBY"; + case 5: + return "GOERLI"; + default: + return "NETWORK"; + } + }; + + return ( +
+
+
+
+

A R C A

+
+
+ {!connected ? "Network" : networkText(network)} +
+
+
+ ); +}; + +const headerStyle = { + display: "flex", + flexDirection: "row", + justifyContent: "space-between", + textAlign: "center", + width: "100%", + backgroundColor: colours.Primary, + boxShadow: "0px 0px 10px 0px rgba(0,0,0,0.3)", + marginBottom: "1rem" +}; + +const textStyle = { + display: "flex", + flexDirection: "row", + justifyContent: "center", + textAlign: "center", + color: colours.Secondary, + letterSpacing: "15px", + padding: "0", + margin: "0" +}; + +const leftStyle = { + width: "0", + minWidth: "0", + letterSpacing: "7px" +}; + +const h1Style = { + minWidth: "15rem", + padding: "0.45rem", + margin: "0.6rem", + marginBottom: "1rem" +}; + +const networkStyle = { + alignSelf: "center", + justifySelf: "center", + letterSpacing: "7px", + padding: "0.6rem", + paddingRight: "1.8rem", + paddingLeft: "0", + margin: "0rem" +}; + +/*const blockyStyle = { + marginTop:"0.72em", + border:"solid 1px", + boxShadow: "0px 10px 15px 0px rgba(0,0,0,0.5)" +}*/ + +//PropTypes +Navbar.propTypes = {}; + +export default Navbar; From fce0ef79f2b9f7c7f0928b5aa642aadf93b28395 Mon Sep 17 00:00:00 2001 From: Flash Date: Sat, 20 Jul 2019 03:06:35 +0200 Subject: [PATCH 007/425] Added current item --- client/src/context/trade/TradeReducer.js | 12 +++++++++- client/src/context/trade/TradeState.js | 30 ++++++++++++++++++++---- client/src/context/types.js | 2 ++ 3 files changed, 39 insertions(+), 5 deletions(-) diff --git a/client/src/context/trade/TradeReducer.js b/client/src/context/trade/TradeReducer.js index c366555..abfa47a 100644 --- a/client/src/context/trade/TradeReducer.js +++ b/client/src/context/trade/TradeReducer.js @@ -1,4 +1,4 @@ -import { ADD_TRADE_ITEM, REMOVE_TRADE_ITEM } from "../types"; +import { ADD_TRADE_ITEM, REMOVE_TRADE_ITEM, SET_CURRENT_ITEM } from "../types"; export default (state, action) => { switch (action.type) { @@ -12,6 +12,16 @@ export default (state, action) => { ...state, tradeItems: state.tradeItems.filter(item => item.id !== action.payload) }; + case SET_CURRENT_ITEM: + return { + ...state, + currentItem: action.payload + }; + case CLEAR_CURRENT_ITEM: + return { + ...state, + currentItem: null + }; default: return state; } diff --git a/client/src/context/trade/TradeState.js b/client/src/context/trade/TradeState.js index d4c3af8..e7e3626 100644 --- a/client/src/context/trade/TradeState.js +++ b/client/src/context/trade/TradeState.js @@ -1,13 +1,19 @@ import React, { useReducer } from "react"; -import { ADD_TRADE_ITEM, REMOVE_TRADE_ITEM } from "../types"; - import TradeContext from "./TradeContext"; import TradeReducer from "./TradeReducer"; +import { + ADD_TRADE_ITEM, + REMOVE_TRADE_ITEM, + SET_CURRENT_ITEM, + CLEAR_CURRENT_ITEM +} from "../types"; + const TradeState = () => { const initialState = { - tradeItems: [] + tradeItems: [], + currentItem: null }; const [state, dispatch] = useReducer(TradeReducer, initialState); @@ -30,12 +36,28 @@ const TradeState = () => { }); }; + const setCurrentItem = tradeItem => { + dispatch({ + type: SET_CURRENT_ITEM, + payload: tradeItem + }); + }; + + const clearCurrentItem = () => { + dispatch({ + type: CLEAR_CURRENT_ITEM + }); + }; + return ( {props.children} diff --git a/client/src/context/types.js b/client/src/context/types.js index c865350..ebb1fc3 100644 --- a/client/src/context/types.js +++ b/client/src/context/types.js @@ -5,3 +5,5 @@ export const REMOVE_ALERT = "REMOVE_ALERT"; //Trade Items export const ADD_TRADE_ITEM = "ADD_TRADE_ITEM"; export const REMOVE_TRADE_ITEM = "REMOVE_TRADE_ITEM"; +export const SET_CURRENT_ITEM = "SET_CURRENT_ITEM"; +export const CLEAR_CURRENT_ITEM = "CLEAR_CURRENT_ITEM"; From 552db949d409d931250c1bc2c01b0580b268fd10 Mon Sep 17 00:00:00 2001 From: Flash Date: Sat, 20 Jul 2019 04:13:37 +0200 Subject: [PATCH 008/425] Added user context --- client/src/context/types.js | 8 ++- client/src/context/user/UserContext.js | 5 ++ client/src/context/user/UserReducer.js | 8 +++ client/src/context/user/UserState.js | 90 ++++++++++++++++++++++++++ 4 files changed, 110 insertions(+), 1 deletion(-) create mode 100644 client/src/context/user/UserContext.js create mode 100644 client/src/context/user/UserReducer.js create mode 100644 client/src/context/user/UserState.js diff --git a/client/src/context/types.js b/client/src/context/types.js index ebb1fc3..89e065d 100644 --- a/client/src/context/types.js +++ b/client/src/context/types.js @@ -2,8 +2,14 @@ export const SET_ALERT = "SET_ALERT"; export const REMOVE_ALERT = "REMOVE_ALERT"; -//Trade Items +// Trade Items export const ADD_TRADE_ITEM = "ADD_TRADE_ITEM"; export const REMOVE_TRADE_ITEM = "REMOVE_TRADE_ITEM"; export const SET_CURRENT_ITEM = "SET_CURRENT_ITEM"; export const CLEAR_CURRENT_ITEM = "CLEAR_CURRENT_ITEM"; + +// User +export const SET_USER = "SET_USER"; +export const SET_TRADE_PARTNER = "SET_TRADE_PARTNER"; +export const CLEAR_USER = "CLEAR_USER"; +export const CLEAR_TRADE_PARTNER = "CLEAR_TRADE_PARTNER"; diff --git a/client/src/context/user/UserContext.js b/client/src/context/user/UserContext.js new file mode 100644 index 0000000..c7f70c1 --- /dev/null +++ b/client/src/context/user/UserContext.js @@ -0,0 +1,5 @@ +import { createContext } from "react"; + +const UserContext = createContext(); + +export default UserContext; diff --git a/client/src/context/user/UserReducer.js b/client/src/context/user/UserReducer.js new file mode 100644 index 0000000..4ab3e80 --- /dev/null +++ b/client/src/context/user/UserReducer.js @@ -0,0 +1,8 @@ +import {} from "../types"; + +export default (state, action) => { + switch (action.type) { + default: + return state; + } +}; diff --git a/client/src/context/user/UserState.js b/client/src/context/user/UserState.js new file mode 100644 index 0000000..a9432e1 --- /dev/null +++ b/client/src/context/user/UserState.js @@ -0,0 +1,90 @@ +import React, { useReducer } from "react"; + +import UserContext from "./UserContext"; +import UserReducer from "./UserReducer"; + +import { + SET_USER, + SET_TRADE_PARTNER, + CLEAR_USER, + CLEAR_TRADE_PARTNER +} from "../types"; + +const UserState = () => { + const initialState = { + user: { + address: "", + ens: null, + balance: null, + ownedTokens: { + erc20Tokens: [], + erc721Tokens: [] + }, + requestedTokens: { + erc20Tokens: [], + erc721Tokens: [] + } + }, + tradePartner: { + address: "", + ens: null, + balance: null, + ownedTokens: { + erc20Tokens: [], + erc721Tokens: [] + }, + requestedTokens: { + erc20Tokens: [], + erc721Tokens: [] + } + } + }; + + const [state, dispatch] = useReducer(UserReducer, initialState); + + /* + * Actions + */ + + const setUser = user => { + dispatch({ + type: SET_USER, + payload: user + }); + }; + + const setTradePartner = tradePartner => { + dispatch({ + type: SET_TRADE_PARTNER, + payload: tradePartner + }); + }; + + const clearUser = () => { + dispatch({ + type: CLEAR_USER + }); + }; + + const clearTradePartner = () => { + dispatch({ + type: CLEAR_TRADE_PARTNER + }); + }; + + return ( + + {props.children} + + ); +}; +export default UserState; From 5e9c3ce31002b633c19491d169a92b15adbd031b Mon Sep 17 00:00:00 2001 From: Flash Date: Sat, 20 Jul 2019 13:16:40 +0200 Subject: [PATCH 009/425] Added default header if token --- client/src/utils/setAuthToken.js | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 client/src/utils/setAuthToken.js diff --git a/client/src/utils/setAuthToken.js b/client/src/utils/setAuthToken.js new file mode 100644 index 0000000..dbbd198 --- /dev/null +++ b/client/src/utils/setAuthToken.js @@ -0,0 +1,11 @@ +import axios from "axios"; + +const setAuthToken = token => { + if (token) { + axios.defaults.headers.common["x-auth-token"] = token; + } else { + delete axios.defaults.headers.common["x-auth-token"]; + } +}; + +export default setAuthToken; From 5be1f062af47e760cb10d0c63148dae59d7131ba Mon Sep 17 00:00:00 2001 From: Flash Date: Sat, 20 Jul 2019 13:22:47 +0200 Subject: [PATCH 010/425] Rewrote css --- client/src/App.css | 219 +++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 201 insertions(+), 18 deletions(-) diff --git a/client/src/App.css b/client/src/App.css index f07ef6c..3cdcb43 100644 --- a/client/src/App.css +++ b/client/src/App.css @@ -1,22 +1,205 @@ -html { - background-color: #EBEBEB; - background-image: radial-gradient(#E0E0E0, #EBEBEB, #DADADA); - - background-repeat: no-repeat; - background-size: auto; - min-width: 100%; - min-height: 100%; +/* Global Styles */ +:root { + --primary-color: #003699; + --dark-color: #333333; + --light-color: #f4f4f4; + --danger-color: #dc3545; + --success-color: #28a745; } -body { - background-color: #EBEBEB; - min-height: 100%; - min-width: 100%; +* { + box-sizing: border-box; margin: 0; padding: 0; - font-size: 1em; - font-weight: 400; - line-height: 1em; - scroll-behavior: smooth; - font-family: arial, sans-serif; -} \ No newline at end of file +} + +body { + font-family: "Roboto", sans-serif; + font-size: 1rem; + line-height: 1.6; + background-color: #fff; + color: #333; +} + +a { + color: var(--primary-color); + text-decoration: none; +} + +a:hover { + color: #666; +} + +ul { + list-style: none; +} + +img { + width: 100%; +} + +/* Text Styles*/ +.x-large { + font-size: 4rem; + line-height: 1.2; + margin-bottom: 1rem; +} + +.large { + font-size: 3rem; + line-height: 1.2; + margin-bottom: 1rem; +} + +.lead { + font-size: 1.5rem; + margin-bottom: 1rem; +} + +.text-center { + text-align: center; +} + +.text-primary { + color: var(--primary-color); +} + +.text-dark { + color: var(--dark-color); +} + +.text-center { + text-align: center; +} + +.text-right { + text-align: right; +} + +.text-left { + text-align: left; +} + +/* Padding */ +.p { + padding: 0.5rem; +} +.p-1 { + padding: 1rem; +} +.p-2 { + padding: 2rem; +} +.p-3 { + padding: 3rem; +} +.py { + padding: 0.5rem 0; +} +.py-1 { + padding: 1rem 0; +} +.py-2 { + padding: 2rem 0; +} +.py-3 { + padding: 3rem 0; +} + +/* Margin */ +.m { + margin: 0.5rem; +} +.m-1 { + margin: 1rem; +} +.m-2 { + margin: 2rem; +} +.m-3 { + margin: 3rem; +} +.my { + margin: 0.5rem 0; +} +.my-1 { + margin: 1rem 0; +} +.my-2 { + margin: 2rem 0; +} +.my-3 { + margin: 3rem 0; +} + +/* Navbar */ +.navbar { + display: flex; + justify-content: space-between; + align-items: center; + padding: 0.7rem 2rem; + z-index: 1; + width: 100%; + border-bottom: solid 1px var(--primary-color); + opacity: 0.9; + margin-bottom: 1rem; +} + +.navbar ul { + display: flex; +} + +.navbar a { + color: #fff; + padding: 0.45rem; + margin: 0 0.25rem; +} + +.navbar a:hover { + color: var(--light-color); +} + +.navbar .welcome span { + margin-right: 0.6rem; +} + +/* Mobile Styles */ +@media (max-width: 700px) { + .hide-sm { + display: none; + } + + .grid-2, + .grid-3, + .grid-4 { + grid-template-columns: 1fr; + } + + /* Text Styles */ + .x-large { + font-size: 3rem; + } + + .large { + font-size: 2rem; + } + + .lead { + font-size: 1rem; + } + + /* Navbar */ + .navbar { + display: block; + text-align: center; + } + + .navbar h1 { + margin-bottom: 0.6rem; + } + + .navbar ul { + text-align: center; + justify-content: center; + } +} From 42d904a3fc154d2a666ed126b54eeb5b9b1e6d43 Mon Sep 17 00:00:00 2001 From: Flash Date: Sat, 20 Jul 2019 13:26:17 +0200 Subject: [PATCH 011/425] Added 404 page --- client/src/components/pages/NotFound.js | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 client/src/components/pages/NotFound.js diff --git a/client/src/components/pages/NotFound.js b/client/src/components/pages/NotFound.js new file mode 100644 index 0000000..7f6337e --- /dev/null +++ b/client/src/components/pages/NotFound.js @@ -0,0 +1,10 @@ +import React from "react"; + +const NotFound = () => ( +
+

Not Found

+

The page you are looking for does not exist.

+
+); + +export default NotFound; From 268c20ebd52f2d10f642f1a4fc9974deb41d4289 Mon Sep 17 00:00:00 2001 From: Flash Date: Sat, 20 Jul 2019 13:27:21 +0200 Subject: [PATCH 012/425] Added about page --- client/src/components/pages/About.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 client/src/components/pages/About.js diff --git a/client/src/components/pages/About.js b/client/src/components/pages/About.js new file mode 100644 index 0000000..a883502 --- /dev/null +++ b/client/src/components/pages/About.js @@ -0,0 +1,13 @@ +import React, { Fragment } from "react"; + +const About = () => ( + +

About

+

Ethereum Application

+

+ Version: 1.0.0 +

+
+); + +export default About; From 2a8bf5f9c090fb55dde7e7e512b36465cf131e6a Mon Sep 17 00:00:00 2001 From: Flash Date: Sat, 20 Jul 2019 15:01:18 +0200 Subject: [PATCH 013/425] Added container --- client/src/App.css | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/client/src/App.css b/client/src/App.css index 3cdcb43..2da4daa 100644 --- a/client/src/App.css +++ b/client/src/App.css @@ -38,6 +38,14 @@ img { width: 100%; } +/* Utilities */ +.container { + max-width: 1100px; + margin: auto; + overflow: hidden; + padding: 0 2rem; +} + /* Text Styles*/ .x-large { font-size: 4rem; From f07ce775b9ed4e89f00b481a1afc3e1f303c2fa9 Mon Sep 17 00:00:00 2001 From: Flash Date: Sat, 20 Jul 2019 15:08:16 +0200 Subject: [PATCH 014/425] Rewrote app.js --- client/src/App.js | 220 +++++++++------------------------------------- 1 file changed, 40 insertions(+), 180 deletions(-) diff --git a/client/src/App.js b/client/src/App.js index 9e7761a..88c8085 100644 --- a/client/src/App.js +++ b/client/src/App.js @@ -1,186 +1,46 @@ -import React, { Component } from "react"; -import Web3 from "web3"; +import React, { Fragment, useContext, useEffect } from "react"; +import { BrowserRouter as Router, Switch, Route } from "react-router-dom"; -import Header from "./components/Header"; -import Sidebar from "./components/Sidebar"; -import TradeWindow from "./components/TradeWindow"; -import PreTrade from "./components/PreTrade"; -import Footer from "./components/Footer"; -import { SetENS } from "./components/ENS"; +import { library } from "@fortawesome/fontawesome-svg-core"; -import { userBoxStatus } from "./Static"; -import "./App.css"; -class App extends Component { - - constructor(props) { - super(props); - this.state = { - connected: false, - counter: 0, - addresses: ["", ""], - ensAdds: ["", ""], - erc: { contractAdd: "", type: "" }, - userBox: userBoxStatus.NO_BOX, - width: window.innerWidth - } - this.handleWindowSizeChange = this.handleWindowSizeChange.bind(this); - this.checkConnection = this.checkConnection.bind(this); - this.enableWeb3 = this.enableWeb3.bind(this); - this.setAddresses = this.setAddresses.bind(this); - this.addErc = this.addErc.bind(this); - } - - componentWillMount() { - setInterval(() => this.updateStuff(), 15000); - window.addEventListener("resize", this.handleWindowSizeChange); - } - - componentWillUnmount() { - window.removeEventListener("resize", this.handleWindowSizeChange); - } - - handleWindowSizeChange() { - this.setState({ width: window.innerWidth }); - }; - - updateStuff() { - // eslint-disable-next-line - const counter = ++this.state.counter; - this.setState({ counter }); - } - - checkConnection() { - try{ - //Check if user's window has a window.ethereum currently available - if(typeof window.ethereum === "undefined"){ - alert("Please use a Web3 enabled browser (install MetaMask)"); - this.setState({ connected: false }); - return 2; - } - - if(window.ethereum.networkVersion === undefined){ - alert("Please refresh the page"); - this.setState({ connected: false }); - return 2; - } - - //Check whether the user is on the correct network - if(window.ethereum.networkVersion !== "1" && window.ethereum.networkVersion !== "4" && window.ethereum.networkVersion !== "5"){ - console.log("Current network: " + window.ethereum.networkVersion); - alert("The Ethereum contract is currently only running on the main, rinkeby and goerli test networks."); - this.setState({ connected: false }); - return 2; - } - - if(!window.web3.utils.isAddress(window.ethereum.selectedAddress)){ - this.setState({ connected: false }); - return 1; - } - }catch(e){ - this.setState({ connected: false }); - return 1; - } - return 0; - } +import Alerts from "./components/layout/Alerts"; +import Navbar from "./components/layout/Navbar"; +import Home from "./components/pages/Home"; +import About from "./components/pages/About"; +import NotFound from "./components/pages/NotFound"; - enableWeb3() { - const connection = this.checkConnection(); - if(connection === 0){ - return this.setState({ connected: true }); - } - if(connection === 2){ - return new Error("No connection"); - } - - //Attempt to open a connection to the Ethereum blockchain - window.web3 = new Web3(window.ethereum); - return new Promise((resolve, reject) => { - window.ethereum.enable() - .then(acc => { - if(this.checkConnection() === 0){ - Promise.all([SetENS(), this.setState({ connected: true })]) - .then(() => resolve()) - .catch(e => reject()); - }else{ - console.log("Failed to attempt to enable web3"); - alert("Please sign yourself into MetaMask"); - reject("Failed to attempt to enable web3"); - } - }) - .catch(e => { - this.setState({ connected: false }); - alert("There was an issue signing you in."); - reject(e); - }); - }); - } +import AlertState from "./context/alert/AlertState"; +import TradeState from "./context/trade/TradeState"; +import UserState from "./context/user/UserState"; - setAddresses(addresses, ensAdds) { - this.setState({ addresses }, () => { - if(this.state.addresses[0].toUpperCase() === window.ethereum.selectedAddress.toUpperCase()){ - this.setState({ userBox: userBoxStatus.FIRST_BOX }); - } else if(this.state.addresses[1].toUpperCase() === window.ethereum.selectedAddress.toUpperCase()){ - this.setState({ userBox: userBoxStatus.SECOND_BOX }); - } else{ - this.setState({ userBox: userBoxStatus.NO_BOX }); - } - }); - this.setState({ ensAdds }); - } +import setAuthToken from "./utils/setAuthToken.js"; - addErc(erc) { - this.setState({ erc }); - } - - render() { - return( -
-
-
-
- - -
-
- -
-
-
-
- ); - } -} - -const pageStyle = { - display: "flex", - flexDirection: "column", - justifyContent: "space-around", - minHeight: "100vh" -} - -const mainStyle = { - display: "flex", - flexWrap: "nowrap", - flexDirection: "row", - justifyContent: "center", - textAlign: "center" -} - -const leftStyle = { - display: "flex", - flexDirection: "column", - minWidth: "10rem", - width: "55rem", - margin: "auto" -} - -const rightStyle = { - display: "flex", - flexDirection: "column", - maxHeight: "100%" -} +import "./App.css"; -export default App; \ No newline at end of file +library.add(); + +localStorage.token && setAuthToken(localStorage.token); + +const App = () => ( + + + + + + +
+ + + + + + +
+
+
+
+
+
+); + +export default App; From 53110fae7885a863f915726e742ec50d828f886e Mon Sep 17 00:00:00 2001 From: Flash Date: Sat, 20 Jul 2019 15:08:28 +0200 Subject: [PATCH 015/425] Added home page --- client/src/components/pages/Home.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 client/src/components/pages/Home.js diff --git a/client/src/components/pages/Home.js b/client/src/components/pages/Home.js new file mode 100644 index 0000000..0758c13 --- /dev/null +++ b/client/src/components/pages/Home.js @@ -0,0 +1,17 @@ +import React, { useEffect } from "react"; + +import TradeBox from "../tradeBox/Box"; + +const Home = () => { + useEffect(() => { + //eslint-disable-next-line + }, []); + + return ( +
+ +
+ ); +}; + +export default Home; From 737d74911935f40f78b73b14ee22941932e7e837 Mon Sep 17 00:00:00 2001 From: Flash Date: Sat, 20 Jul 2019 15:08:45 +0200 Subject: [PATCH 016/425] Fixed import --- client/src/components/layout/Navbar.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/src/components/layout/Navbar.js b/client/src/components/layout/Navbar.js index 7490bd0..6797d68 100644 --- a/client/src/components/layout/Navbar.js +++ b/client/src/components/layout/Navbar.js @@ -2,7 +2,7 @@ import React from "react"; //import makeBlockie from "ethereum-blockies-base64"; import PropTypes from "prop-types"; -import { colours } from "../Static"; +import { colours } from "../../Static"; const Navbar = () => { const connected = true; From b6e95cbecf25cf64a42726389598f61ff20fffce Mon Sep 17 00:00:00 2001 From: Flash Date: Sat, 20 Jul 2019 15:09:30 +0200 Subject: [PATCH 017/425] Added props --- client/src/context/alert/AlertState.js | 3 ++- client/src/context/trade/TradeState.js | 2 +- client/src/context/user/UserState.js | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/client/src/context/alert/AlertState.js b/client/src/context/alert/AlertState.js index c42d0d4..87cd3b1 100644 --- a/client/src/context/alert/AlertState.js +++ b/client/src/context/alert/AlertState.js @@ -6,7 +6,7 @@ import { SET_ALERT, REMOVE_ALERT } from "../types"; import AlertContext from "./AlertContext"; import AlertReducer from "./AlertReducer"; -const AlertState = () => { +const AlertState = props => { const initialState = []; const [state, dispatch] = useReducer(AlertReducer, initialState); @@ -37,4 +37,5 @@ const AlertState = () => { ); }; + export default AlertState; diff --git a/client/src/context/trade/TradeState.js b/client/src/context/trade/TradeState.js index e7e3626..b32e3d9 100644 --- a/client/src/context/trade/TradeState.js +++ b/client/src/context/trade/TradeState.js @@ -10,7 +10,7 @@ import { CLEAR_CURRENT_ITEM } from "../types"; -const TradeState = () => { +const TradeState = props => { const initialState = { tradeItems: [], currentItem: null diff --git a/client/src/context/user/UserState.js b/client/src/context/user/UserState.js index a9432e1..b8ebad5 100644 --- a/client/src/context/user/UserState.js +++ b/client/src/context/user/UserState.js @@ -10,7 +10,7 @@ import { CLEAR_TRADE_PARTNER } from "../types"; -const UserState = () => { +const UserState = props => { const initialState = { user: { address: "", From 37bc40a2b30752fbe7f0924a133a9a51d413b96a Mon Sep 17 00:00:00 2001 From: Flash Date: Sat, 20 Jul 2019 15:09:46 +0200 Subject: [PATCH 018/425] Added clear current item --- client/src/context/trade/TradeReducer.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/client/src/context/trade/TradeReducer.js b/client/src/context/trade/TradeReducer.js index abfa47a..53f9e61 100644 --- a/client/src/context/trade/TradeReducer.js +++ b/client/src/context/trade/TradeReducer.js @@ -1,4 +1,9 @@ -import { ADD_TRADE_ITEM, REMOVE_TRADE_ITEM, SET_CURRENT_ITEM } from "../types"; +import { + ADD_TRADE_ITEM, + REMOVE_TRADE_ITEM, + SET_CURRENT_ITEM, + CLEAR_CURRENT_ITEM +} from "../types"; export default (state, action) => { switch (action.type) { From 4881e74c06c485c414c6c56406a894bc83610a23 Mon Sep 17 00:00:00 2001 From: Flash Date: Sat, 20 Jul 2019 15:12:44 +0200 Subject: [PATCH 019/425] Added Spinner --- client/src/components/layout/Spinner.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 client/src/components/layout/Spinner.js diff --git a/client/src/components/layout/Spinner.js b/client/src/components/layout/Spinner.js new file mode 100644 index 0000000..83f4f37 --- /dev/null +++ b/client/src/components/layout/Spinner.js @@ -0,0 +1,14 @@ +import React, { Fragment } from "react"; +import spinner from "./spinner.gif"; + +const Spinner = () => ( + + Loading... + +); + +export default Spinner; From 89ca0e9820428a105a87972d3095198df423571d Mon Sep 17 00:00:00 2001 From: Flash Date: Sat, 20 Jul 2019 16:28:00 +0200 Subject: [PATCH 020/425] Added bg classes --- client/src/App.css | 72 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) diff --git a/client/src/App.css b/client/src/App.css index 2da4daa..ea6334b 100644 --- a/client/src/App.css +++ b/client/src/App.css @@ -140,6 +140,78 @@ img { margin: 3rem 0; } +/**/ + +.alert { + padding: 0.7rem; + margin: 1rem 0; + opacity: 0.9; + background: var(--light-color); + color: #333; +} + +.btn-primary, +.bg-primary, +.badge-primary, +.alert-primary { + background: var(--primary-color); + color: #fff; +} + +.btn-light, +.bg-light, +.badge-light, +.alert-light { + background: var(--light-color); + color: #333; +} + +.btn-dark, +.bg-dark, +.badge-dark, +.alert-dark { + background: var(--dark-color); + color: #fff; +} + +.btn-danger, +.bg-danger, +.badge-danger, +.alert-danger { + background: var(--danger-color); + color: #fff; +} + +.btn-success, +.bg-success, +.badge-success, +.alert-success { + background: var(--success-color); + color: #fff; +} + +.btn-white, +.bg-white, +.badge-white, +.alert-white { + background: #fff; + color: #333; + border: #ccc solid 1px; +} + +.btn:hover { + opacity: 0.8; +} + +.bg-light, +.badge-light { + border: #ccc solid 1px; +} + +.round-img { + border-radius: 50%; +} + /* Navbar */ .navbar { display: flex; From f21e48b0f26fa9a20f30066cb1a8d7eb86625be2 Mon Sep 17 00:00:00 2001 From: Flash Date: Sat, 20 Jul 2019 16:28:22 +0200 Subject: [PATCH 021/425] Added open box icon --- client/src/App.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/client/src/App.js b/client/src/App.js index 88c8085..8d06745 100644 --- a/client/src/App.js +++ b/client/src/App.js @@ -1,7 +1,8 @@ -import React, { Fragment, useContext, useEffect } from "react"; +import React, { Fragment } from "react"; import { BrowserRouter as Router, Switch, Route } from "react-router-dom"; import { library } from "@fortawesome/fontawesome-svg-core"; +import { faBoxOpen } from "@fortawesome/free-solid-svg-icons"; import Alerts from "./components/layout/Alerts"; import Navbar from "./components/layout/Navbar"; @@ -17,7 +18,7 @@ import setAuthToken from "./utils/setAuthToken.js"; import "./App.css"; -library.add(); +library.add(faBoxOpen); localStorage.token && setAuthToken(localStorage.token); From 7b9742d9b0d580b4830c6fb0c030acee1c4957db Mon Sep 17 00:00:00 2001 From: Flash Date: Sat, 20 Jul 2019 16:28:46 +0200 Subject: [PATCH 022/425] Added web3 to user context --- client/src/context/types.js | 1 + client/src/context/user/UserState.js | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/client/src/context/types.js b/client/src/context/types.js index 89e065d..cac820c 100644 --- a/client/src/context/types.js +++ b/client/src/context/types.js @@ -9,6 +9,7 @@ export const SET_CURRENT_ITEM = "SET_CURRENT_ITEM"; export const CLEAR_CURRENT_ITEM = "CLEAR_CURRENT_ITEM"; // User +export const SET_WEB3 = "SET_WEB3"; export const SET_USER = "SET_USER"; export const SET_TRADE_PARTNER = "SET_TRADE_PARTNER"; export const CLEAR_USER = "CLEAR_USER"; diff --git a/client/src/context/user/UserState.js b/client/src/context/user/UserState.js index b8ebad5..5371f63 100644 --- a/client/src/context/user/UserState.js +++ b/client/src/context/user/UserState.js @@ -4,6 +4,7 @@ import UserContext from "./UserContext"; import UserReducer from "./UserReducer"; import { + SET_WEB3, SET_USER, SET_TRADE_PARTNER, CLEAR_USER, @@ -37,6 +38,9 @@ const UserState = props => { erc20Tokens: [], erc721Tokens: [] } + }, + web3: { + connected: false } }; @@ -46,6 +50,13 @@ const UserState = props => { * Actions */ + const setWeb3 = web3 => { + dispatch({ + type: SET_WEB3, + payload: web3 + }); + }; + const setUser = user => { dispatch({ type: SET_USER, @@ -75,8 +86,10 @@ const UserState = props => { return ( Date: Sat, 20 Jul 2019 16:31:04 +0200 Subject: [PATCH 023/425] Refactored navbar --- client/src/components/layout/Navbar.js | 104 ++++++++----------------- 1 file changed, 33 insertions(+), 71 deletions(-) diff --git a/client/src/components/layout/Navbar.js b/client/src/components/layout/Navbar.js index 6797d68..e17ca12 100644 --- a/client/src/components/layout/Navbar.js +++ b/client/src/components/layout/Navbar.js @@ -1,93 +1,55 @@ -import React from "react"; -//import makeBlockie from "ethereum-blockies-base64"; -import PropTypes from "prop-types"; +import React, { Fragment, useContext } from "react"; +import { Link } from "react-router-dom"; +import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; -import { colours } from "../../Static"; +import PropTypes from "prop-types"; -const Navbar = () => { +const Navbar = ({ title, icon }) => { const connected = true; const network = 1; - const networkText = network => { + const networkText = () => { switch (network) { case 1: - return "LIVE"; + return "Network: LIVE"; case 4: - return "RINKEBY"; + return "Network: RINKEBY"; case 5: - return "GOERLI"; + return "Network: GOERLI"; default: - return "NETWORK"; + return "Network: UNSUPPORTED"; } }; return ( -
-
-
-
-

A R C A

-
-
- {!connected ? "Network" : networkText(network)} -
-
-
+ ); }; -const headerStyle = { - display: "flex", - flexDirection: "row", - justifyContent: "space-between", - textAlign: "center", - width: "100%", - backgroundColor: colours.Primary, - boxShadow: "0px 0px 10px 0px rgba(0,0,0,0.3)", - marginBottom: "1rem" -}; - -const textStyle = { - display: "flex", - flexDirection: "row", - justifyContent: "center", - textAlign: "center", - color: colours.Secondary, - letterSpacing: "15px", - padding: "0", - margin: "0" -}; - -const leftStyle = { - width: "0", - minWidth: "0", - letterSpacing: "7px" -}; - -const h1Style = { - minWidth: "15rem", - padding: "0.45rem", - margin: "0.6rem", - marginBottom: "1rem" +Navbar.defaultProps = { + title: "A R C A", + icon: ["fas", "box-open"] }; -const networkStyle = { - alignSelf: "center", - justifySelf: "center", - letterSpacing: "7px", - padding: "0.6rem", - paddingRight: "1.8rem", - paddingLeft: "0", - margin: "0rem" +Navbar.propTypes = { + title: PropTypes.string.isRequired, + icon: PropTypes.array.isRequired }; -/*const blockyStyle = { - marginTop:"0.72em", - border:"solid 1px", - boxShadow: "0px 10px 15px 0px rgba(0,0,0,0.5)" -}*/ - -//PropTypes -Navbar.propTypes = {}; - export default Navbar; From 85bb51c67418910dfb70322951e7cc33eed461cf Mon Sep 17 00:00:00 2001 From: Flash Date: Sat, 20 Jul 2019 16:53:08 +0200 Subject: [PATCH 024/425] Added user context --- client/src/components/layout/Navbar.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/client/src/components/layout/Navbar.js b/client/src/components/layout/Navbar.js index e17ca12..729e580 100644 --- a/client/src/components/layout/Navbar.js +++ b/client/src/components/layout/Navbar.js @@ -4,20 +4,23 @@ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import PropTypes from "prop-types"; +import UserContext from "../../context/user/UserContext"; + const Navbar = ({ title, icon }) => { - const connected = true; - const network = 1; + const userContext = useContext(UserContext); + + const { connected, network } = userContext.web3; const networkText = () => { switch (network) { case 1: - return "Network: LIVE"; + return LIVE; case 4: - return "Network: RINKEBY"; + return RINKEBY; case 5: - return "Network: GOERLI"; + return GOERLI; default: - return "Network: UNSUPPORTED"; + return UNSUPPORTED; } }; From f8e22e5e8bb3a9da490a5119a66eb6aad91a207a Mon Sep 17 00:00:00 2001 From: Flash Date: Sat, 20 Jul 2019 16:53:20 +0200 Subject: [PATCH 025/425] Added network --- client/src/context/user/UserState.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/client/src/context/user/UserState.js b/client/src/context/user/UserState.js index 5371f63..79e0008 100644 --- a/client/src/context/user/UserState.js +++ b/client/src/context/user/UserState.js @@ -40,7 +40,8 @@ const UserState = props => { } }, web3: { - connected: false + connected: false, + network: null } }; From 7456387c301da2b2cab00c4f6c8a43bfb63faa0e Mon Sep 17 00:00:00 2001 From: Flash Date: Sat, 20 Jul 2019 17:15:13 +0200 Subject: [PATCH 026/425] Outlined new sidebar component --- client/src/components/layout/Sidebar.js | 32 +++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 client/src/components/layout/Sidebar.js diff --git a/client/src/components/layout/Sidebar.js b/client/src/components/layout/Sidebar.js new file mode 100644 index 0000000..0eb582e --- /dev/null +++ b/client/src/components/layout/Sidebar.js @@ -0,0 +1,32 @@ +import React from "react"; + +import UserContext from "../../context/user/UserContext"; + +const Sidebar = () => { + const userContext = useContext(UserContext); + + const { settings, user } = userContext; + const { connected } = userContext.web3; + + const tokens = () => ( +
    +

    Erc20s

    + {user.ownedTokens.erc20Tokens.map(token => ( +
  • {token.name}
  • + ))} +

    Erc20s

    + {user.ownedTokens.erc20Tokens.map(token => ( +
  • {token.name}
  • + ))} +
+ ); + + return ( +
+

{settings.nickname && settings.nickname}

+
{connected ?

Not Connected

: tokens()}
+
+ ); +}; + +export default Sidebar; From 2e35d3f1154e0c6a01f55e11f5cf8433fcf1843d Mon Sep 17 00:00:00 2001 From: Flash Date: Sat, 20 Jul 2019 17:15:29 +0200 Subject: [PATCH 027/425] Added settings --- client/src/context/user/UserState.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/client/src/context/user/UserState.js b/client/src/context/user/UserState.js index 79e0008..662819a 100644 --- a/client/src/context/user/UserState.js +++ b/client/src/context/user/UserState.js @@ -42,6 +42,9 @@ const UserState = props => { web3: { connected: false, network: null + }, + settings: { + nickname: null } }; From 4b1635a1ff60a62d75a5f7b117aa4b954daffd94 Mon Sep 17 00:00:00 2001 From: Flash Date: Sat, 20 Jul 2019 17:30:12 +0200 Subject: [PATCH 028/425] Added erc721s --- client/src/components/layout/Sidebar.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/src/components/layout/Sidebar.js b/client/src/components/layout/Sidebar.js index 0eb582e..9f091f1 100644 --- a/client/src/components/layout/Sidebar.js +++ b/client/src/components/layout/Sidebar.js @@ -1,4 +1,4 @@ -import React from "react"; +import React, { useContext } from "react"; import UserContext from "../../context/user/UserContext"; @@ -15,7 +15,7 @@ const Sidebar = () => {
  • {token.name}
  • ))}

    Erc20s

    - {user.ownedTokens.erc20Tokens.map(token => ( + {user.ownedTokens.erc721Tokens.map(token => (
  • {token.name}
  • ))} From 401aa33336b32154afa56754d0b1eac7ab015676 Mon Sep 17 00:00:00 2001 From: Flash Date: Sat, 20 Jul 2019 17:43:27 +0200 Subject: [PATCH 029/425] Added sidebar --- client/src/App.css | 29 +++++++++++++++++++++++++ client/src/components/layout/Sidebar.js | 9 ++++---- 2 files changed, 34 insertions(+), 4 deletions(-) diff --git a/client/src/App.css b/client/src/App.css index ea6334b..2a9b2f6 100644 --- a/client/src/App.css +++ b/client/src/App.css @@ -243,6 +243,35 @@ img { margin-right: 0.6rem; } +/* Sidebar */ +.sidebar { + float: right; + display: flex; + /* flex-direction: column; */ + align-items: left; + padding: 0.7rem 2rem; + z-index: 1; + height: 100%; + border-left: solid 1px var(--primary-color); + opacity: 0.9; + margin-left: 1rem; +} + +.sidebar ul { + display: flex; + flex-direction: column; +} + +.sidebar a { + color: #fff; + padding: 0.45rem; + margin: 0 0.25rem; +} + +.sidebar a:hover { + color: var(--light-color); +} + /* Mobile Styles */ @media (max-width: 700px) { .hide-sm { diff --git a/client/src/components/layout/Sidebar.js b/client/src/components/layout/Sidebar.js index 9f091f1..6a07f41 100644 --- a/client/src/components/layout/Sidebar.js +++ b/client/src/components/layout/Sidebar.js @@ -1,12 +1,13 @@ import React, { useContext } from "react"; import UserContext from "../../context/user/UserContext"; +import UserState from "../../context/user/UserState"; const Sidebar = () => { const userContext = useContext(UserContext); - - const { settings, user } = userContext; - const { connected } = userContext.web3; + console.log(userContext); + const { settings, user, web3 } = userContext; + const { connected } = web3; const tokens = () => (
      @@ -14,7 +15,7 @@ const Sidebar = () => { {user.ownedTokens.erc20Tokens.map(token => (
    • {token.name}
    • ))} -

      Erc20s

      +

      Erc721s

      {user.ownedTokens.erc721Tokens.map(token => (
    • {token.name}
    • ))} From a3477a8792b7a77846edc782cbbf19e754b7b7cc Mon Sep 17 00:00:00 2001 From: Flash Date: Sat, 20 Jul 2019 17:45:28 +0200 Subject: [PATCH 030/425] Added sidebar --- client/src/App.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/client/src/App.js b/client/src/App.js index 8d06745..07ea4aa 100644 --- a/client/src/App.js +++ b/client/src/App.js @@ -6,6 +6,7 @@ import { faBoxOpen } from "@fortawesome/free-solid-svg-icons"; import Alerts from "./components/layout/Alerts"; import Navbar from "./components/layout/Navbar"; +import Sidebar from "./components/layout/Sidebar"; import Home from "./components/pages/Home"; import About from "./components/pages/About"; import NotFound from "./components/pages/NotFound"; @@ -29,6 +30,7 @@ const App = () => ( +
      From c5f0b0cda472ef1f4639b1e1bfd2145bac6d369c Mon Sep 17 00:00:00 2001 From: Flash Date: Sat, 20 Jul 2019 17:46:19 +0200 Subject: [PATCH 031/425] Deleted old files --- client/src/components/Alias.js | 35 -- client/src/components/ENS.js | 89 ----- client/src/components/Footer.js | 69 ---- client/src/components/Header.js | 124 ------ client/src/components/PreTrade.js | 193 ---------- client/src/components/Sidebar.js | 75 ---- client/src/components/Sidebar/Erc20.js | 81 ---- client/src/components/Sidebar/Erc721.js | 81 ---- client/src/components/Sidebar/TokenInfo.js | 217 ----------- client/src/components/TradeWindow.js | 80 ---- client/src/components/TradeWindow/Box.js | 352 ------------------ client/src/components/TradeWindow/OfferErc.js | 272 -------------- .../src/components/TradeWindow/Satisfied.js | 232 ------------ .../src/components/TradeWindow/SubmitBox.js | 164 -------- client/src/components/TradeWindow/Summary.js | 50 --- client/src/components/Web3Status.js | 55 --- 16 files changed, 2169 deletions(-) delete mode 100644 client/src/components/Alias.js delete mode 100644 client/src/components/ENS.js delete mode 100644 client/src/components/Footer.js delete mode 100644 client/src/components/Header.js delete mode 100644 client/src/components/PreTrade.js delete mode 100644 client/src/components/Sidebar.js delete mode 100644 client/src/components/Sidebar/Erc20.js delete mode 100644 client/src/components/Sidebar/Erc721.js delete mode 100644 client/src/components/Sidebar/TokenInfo.js delete mode 100644 client/src/components/TradeWindow.js delete mode 100644 client/src/components/TradeWindow/Box.js delete mode 100644 client/src/components/TradeWindow/OfferErc.js delete mode 100644 client/src/components/TradeWindow/Satisfied.js delete mode 100644 client/src/components/TradeWindow/SubmitBox.js delete mode 100644 client/src/components/TradeWindow/Summary.js delete mode 100644 client/src/components/Web3Status.js diff --git a/client/src/components/Alias.js b/client/src/components/Alias.js deleted file mode 100644 index ed35e15..0000000 --- a/client/src/components/Alias.js +++ /dev/null @@ -1,35 +0,0 @@ -//import from "./ENS"; - - -export function KnownContracts(_address) { - try{ - if(window.ethereum.networkVersion === "1"){ //Live - //ens - switch(_address){ - case "0xFaC7BEA255a6990f749363002136aF6556b31e04": - return "ENS"; - default: - return _address; - } - } - - if(window.ethereum.networkVersion === "4"){ //Rinkeby - //ens - switch(_address){ - default: - return _address; - } - } - if(window.ethereum.networkVersion === "5"){ //Goerli - //ens - switch(_address){ - default: - return _address; - } - } - }catch(e){ - console.log("Error in KnownContracts:"); - console.log(e); - return e; - } -} \ No newline at end of file diff --git a/client/src/components/ENS.js b/client/src/components/ENS.js deleted file mode 100644 index b80a782..0000000 --- a/client/src/components/ENS.js +++ /dev/null @@ -1,89 +0,0 @@ -import namehash from "eth-ens-namehash"; -import ENS from "ethereum-ens"; -let ens; - -export function Normalise(_name) { - try{ - return namehash.normalize(_name); - }catch(e){ - console.log(e); - return e; - } -} - -export function Hash(_name) { - try{ - return namehash.hash(_name); - }catch(e){ - console.log(e); - return e; - } -} - -export function SetENS() { - ens = new ENS(window.web3.givenProvider); -} - -export function IsEns(_name) { - try{ - return ens.resolver(_name).addr() - .then(add => { - return add; - }) - .catch(e => { - return false; - }) - }catch(e){ - return false; - } -} - -export function IsReverse(_add) { - try{ - return ens.reverse(_add).name() - .then(name => { - return name; - }) - .catch(e => { - return false; - }) - }catch(e){ - return false; - } -} - -export function IsOwner(_name, _owner) { - try{ - return ens.owner(_name) - .then(owner => { - return owner === _owner ? true : false; - }) - .catch(e => { - console.log("Failed isOwner:") - console.log(e); - return false; - } - ); - }catch(e){ - console.log("Failed isOwner:") - console.log(e); - return false; - } -} - -export function CheckName(_name, _id) { - try{ - return namehash.hash(_name) - .then(hash => { - //TODO call contract to convert hash to ID by casting bytes32 to uint32 - }) - .catch(e => { - - } - ); - }catch(e) { - console.log("Failed CheckName:") - console.log(e); - return false; - }; -} \ No newline at end of file diff --git a/client/src/components/Footer.js b/client/src/components/Footer.js deleted file mode 100644 index e7ec8c6..0000000 --- a/client/src/components/Footer.js +++ /dev/null @@ -1,69 +0,0 @@ -import React, { Component } from "react"; -import { faGithub, faTwitter, faEthereum, faBitcoin } from "@fortawesome/free-brands-svg-icons";// daYoutube -import { faAt } from "@fortawesome/free-solid-svg-icons"; -import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; - -import { colours } from "../Static"; - -class Footer extends Component { - - render() { - return( - - ); - } -} - -const footerStyle = { - display: "flex", - flexWrap: "wrap", - flexDirection: "row", - justifyContent: "center", - textAlign: "center", - backgroundColor: colours.Button, - marginTop: "auto" -} - -const ulStyle = { - display: "flex", - flexWrap: "wrap", - flexDirection: "row", - justifyContent: "center", - textAlign: "center", - maxWidth: "24rem", - listStyle: "none", - padding: "0", - margin: "0.5rem" -} - -const linkStyle = { - textAlign: "left", - width: "6rem", - color: colours.Primary, - textDecoration: "none", - margin: "0.5rem 0.75rem" -} - -const iconStyle = { - width:"1rem" -} - -export default Footer; \ No newline at end of file diff --git a/client/src/components/Header.js b/client/src/components/Header.js deleted file mode 100644 index bdc6d47..0000000 --- a/client/src/components/Header.js +++ /dev/null @@ -1,124 +0,0 @@ -import React, { Component } from "react"; -//import makeBlockie from "ethereum-blockies-base64"; -import PropTypes from "prop-types"; - -import { colours } from "../Static"; - -class Header extends Component { - - networkText() { - if(!this.props.connected){ - return
      -
      NETWORK
      -
      ; - } - - if(window.ethereum.networkVersion === "1"){ - return
      -
      LIVE
      -
      ; - } - - if(window.ethereum.networkVersion === "4"){ - return
      -
      RINKEBY
      -
      ; - } - - if(window.ethereum.networkVersion === "5"){ - return
      -
      GOERLI
      -
      ; - } - return
      -
      NETWORK
      -
      ; - } - - headerText() { - return

      A R C A

      ; - } - - leftText() { - return
      -
      -
      ; - } - - //blockie - render() { - if(this.props.width <= 650){ - return( -
      - { this.headerText() } -
      - ); - } - return( -
      - { this.leftText() } - { this.headerText() } - { this.networkText() } -
      - ); - } -} - -const headerStyle = { - display: "flex", - flexDirection: "row", - justifyContent: "space-between", - textAlign: "center", - width: "100%", - backgroundColor: colours.Primary, - boxShadow: "0px 0px 10px 0px rgba(0,0,0,0.3)", - marginBottom: "1rem" -} - -const textStyle = { - display: "flex", - flexDirection: "row", - justifyContent: "center", - textAlign: "center", - color: colours.Secondary, - letterSpacing: "15px", - padding: "0", - margin: "0" -} - -const leftStyle = { - width: "0", - minWidth: "0", - letterSpacing: "7px" -} - -const h1Style = { - minWidth: "15rem", - padding: "0.45rem", - margin: "0.6rem", - marginBottom: "1rem" -} - -const networkStyle = { - alignSelf: "center", - justifySelf: "center", - letterSpacing: "7px", - padding: "0.6rem", - paddingRight: "1.8rem", - paddingLeft: "0", - margin: "0rem" -} - -/*const blockyStyle = { - marginTop:"0.72em", - border:"solid 1px", - boxShadow: "0px 10px 15px 0px rgba(0,0,0,0.5)" -}*/ - -//PropTypes -Header.propTypes = { - connected: PropTypes.bool.isRequired, - width: PropTypes.number.isRequired -} - -export default Header; \ No newline at end of file diff --git a/client/src/components/PreTrade.js b/client/src/components/PreTrade.js deleted file mode 100644 index c07ec98..0000000 --- a/client/src/components/PreTrade.js +++ /dev/null @@ -1,193 +0,0 @@ -import React, { Component } from "react"; -import PropTypes from "prop-types"; - -import { IsEns, IsReverse } from "./ENS"; -import { colours } from "../Static"; - -class PreTrade extends Component { - - constructor(props) { - super(props); - this.state = { - input1: "", - input2: "", - address1: "", - address2: "", - ensAdd1: "", - ensAdd2: "", - validInput1: false, - validInput2: false - } - this.checkAddress = this.checkAddress.bind(this); - this.onSubmit = this.onSubmit.bind(this); - this.onChange1 = this.onChange1.bind(this); - this.onChange2 = this.onChange2.bind(this); - } - - checkAddress(index, input) { - if(!this.props.connected){ - this.setState({ validInput1: false, validInput2: false }); - return; - } - - try{ - input = input.toLowerCase(); - if(window.web3.utils.isAddress(input)){ - return IsReverse(input) - .then(res => { - if(res) index === 0 ? this.setState({ validInput1: true, address1: input, ensAdd1: res }) : this.setState({ validInput2: true, address2: input, ensAdd2: res }); - else index === 0 ? this.setState({ validInput1: true, address1: input, ensAdd1: "" }) : this.setState({ validInput2: true, address2: input, ensAdd2: "" }); - }) - .catch(e => { - console.log("Error in IsReverse"); - index === 0 ? this.setState({ validInput1: false, address1: "", ensAdd1: "" }) : this.setState({ validInput2: false, address2: "", ensAdd2: "" }); - }); - }else{ - return IsEns(input) - .then(res => { - if(res){ - res = res.toLowerCase(); - index === 0 ? this.setState({ validInput1: true, address1: res, ensAdd1: input }) : this.setState({ validInput2: true, address2: res, ensAdd2: input }); - }else{ - index === 0 ? this.setState({ validInput1: false, address1: "", ensAdd1: "" }) : this.setState({ validInput2: false, address2: "", ensAdd2: "" }); - } - }) - .catch(e => { - console.log("Error in IsEns"); - index === 0 ? this.setState({ validInput1: false, address1: "", ensAdd1: "" }) : this.setState({ validInput2: false, address2: "", ensAdd2: "" }); - }); - } - }catch(e){ - index === 0 ? this.setState({ validInput1: false, address1: "", ensAdd1: "" }) : this.setState({ validInput2: false, address2: "", ensAdd2: "" }); - } - } - - onChange1(e) { - this.setState({ - [e.target.name]: e.target.value - }); - - this.checkAddress(0, e.target.value); - } - - onChange2(e) { - this.setState({ - [e.target.name]: e.target.value - }); - - this.checkAddress(1, e.target.value); - } - - async onSubmit(e) { - e.preventDefault(); - if(!this.props.connected) await this.props.enableWeb3(); - - Promise.all([this.checkAddress(0, this.state.input1), this.checkAddress(1, this.state.input2)]) - .then(() => { - if(this.state.validInput1 && this.state.validInput2){ - this.props.setAddresses([this.state.address1, this.state.address2], [this.state.ensAdd1, this.state.ensAdd2]); - } - }); - } - - render() { - return( -
      -
      -
      - - -
      -
      - -
      - ); - } -} - -const preTradeStyle = { - display: "flex", - flexWrap: "wrap", - flexDirection: "row", - justifyContent: "center", - textAlign: "center" -} - -const formStyle = { - display: "flex", - justifyContent: "center", - textAlign: "center", - maxWidth: "100%" -} - -const addressesStyle = { - display: "flex", - flexDirection: "column", - justifyContent: "space-around", - textAlign: "center", - width: "20em", - maxWidth: "100%", - paddingRight: "8px" -} - -const inputStyle = { - textAlign: "center", - width: "100%", - backgroundColor: colours.Primary, - borderColor: "#888888", - borderWidth: "1px", - borderLeft: "solid 4px green", - borderStyle: "solid", - color: colours.Secondary, - padding: "0.1rem" -} - -const badInputStyle = { - textAlign: "center", - width: "100%", - backgroundColor: colours.Primary, - borderColor: "#888888", - borderWidth: "1px", - borderLeft: "solid 4px red", - borderStyle: "solid", - color: colours.Secondary, - padding: "0.1rem" -} - -const btnStyle = { - display: "flex", - justifyContent: "center", - textAlign: "center", - background: colours.Button, - border: "none", - borderRadius: "0.4rem", - color: colours.Primary, - fontWeight: "bold", - cursor: "pointer", - padding: "10px 14px", - margin: "0.4rem" -} - -//PropTypes -PreTrade.propTypes = { - connected: PropTypes.bool.isRequired, - isUser: PropTypes.number.isRequired, - setAddresses: PropTypes.func.isRequired, - enableWeb3: PropTypes.func.isRequired -} - -export default PreTrade; \ No newline at end of file diff --git a/client/src/components/Sidebar.js b/client/src/components/Sidebar.js deleted file mode 100644 index bd072ad..0000000 --- a/client/src/components/Sidebar.js +++ /dev/null @@ -1,75 +0,0 @@ -import React, { Component } from "react"; -import Web3Status from "./Web3Status"; -import TokenInfo from "./Sidebar/TokenInfo"; -import PropTypes from "prop-types"; -import makeBlockie from "ethereum-blockies-base64"; - -import { colours } from "../Static"; - -class Sidebar extends Component {//TODO add button to toggle side sidebar - - render() { - if(this.props.width <= 650){ - return null; - } - - if(!this.props.connected){ - return( -
      -
      - -
      -
      - ); - } - - return( -
      -
      - blockie - -
      -
      - -
      -
      - ); - } -} - -const sidebarStyle = { - display: "flex", - flexDirection: "column", - justifyContent: "center", - textAlign: "center", - maxHeight: "100%", - color: colours.Secondary, - marginLeft: "auto" -} - -const topStyle = { - minWidth: "9rem", - padding: "0.4rem", - margin: "0.5rem", - marginBottom: "0.8rem", - marginTop: "0" -} - -const bottomStyle = { - maxHeight: "26rem",//? - borderRadius: "20px", - overflowY: "auto", - scrollbarWidth: "thin" -} - -//PropTypes -Sidebar.propTypes = { - connected: PropTypes.bool.isRequired, - counter: PropTypes.number.isRequired, - width: PropTypes.number.isRequired, - enableWeb3: PropTypes.func.isRequired, - addErc: PropTypes.func.isRequired, -} - -export default Sidebar; \ No newline at end of file diff --git a/client/src/components/Sidebar/Erc20.js b/client/src/components/Sidebar/Erc20.js deleted file mode 100644 index 24587c3..0000000 --- a/client/src/components/Sidebar/Erc20.js +++ /dev/null @@ -1,81 +0,0 @@ -import React, { Component } from "react"; -import PropTypes from "prop-types"; -import makeBlockie from "ethereum-blockies-base64"; - -import { colours } from "../../Static"; - -class Erc20 extends Component { - - add = (e) => { - this.props.addErc(this.props.erc); - } - - render() { - return( -
      -
    • -
      -
      - { this.props.erc.symbol }  - blockie
      -
      -
      - Balance: { this.props.erc.balance }
      - Enabled: { this.props.erc.enabled } -
      -
      - -
    • -
      - ); - } -} - -const ercStyle = { - textAlign: "left", - borderRadius: "0.4rem", - padding: "0.2rem", - paddingRight: "0rem", - margin: "0.15rem", - marginBottom: "0.5rem" -} - -const liStyle = { - display: "flex", - listStyleType: "none", - lineHeight: "120%", - fontSize: "72%" -} - -const symbolStyle = { - fontWeight: "bold", - lineHeight: "110%", - fontSize: "115%", - marginLeft: "2rem" -} - -const btnStyle = { - alignSelf: "center", - justifyContent: "center", - textAlign: "center", - background: colours.Button, - border: "none", - borderRadius: "30%", - color: "#FFFFFF", - fontSize: "130%", - fontWeight: "bold", - cursor: "pointer", - padding: "0.4rem 0.6rem", - marginLeft: "auto", - marginRight: "0.1rem" -} - -//PropTypes -Erc20.propTypes = { - erc: PropTypes.object.isRequired, - addErc: PropTypes.func.isRequired -} - -export default Erc20; \ No newline at end of file diff --git a/client/src/components/Sidebar/Erc721.js b/client/src/components/Sidebar/Erc721.js deleted file mode 100644 index f412301..0000000 --- a/client/src/components/Sidebar/Erc721.js +++ /dev/null @@ -1,81 +0,0 @@ -import React, { Component } from "react"; -import PropTypes from "prop-types"; -import makeBlockie from "ethereum-blockies-base64"; - -import { colours } from "../../Static"; - -class Erc721 extends Component { - - add = (e) => { - this.props.addErc(this.props.erc); - } - - render() { - return( -
      -
    • -
      -
      - { this.props.erc.symbol }  - blockie 
      -
      -
      - Count: { this.props.erc.balance }
      - Enabled: { this.props.erc.enabled } -
      -
      - -
    • -
      - ); - } -} - -const ercStyle = { - textAlign: "left", - borderRadius: "0.4rem", - padding: "0.2rem", - paddingRight: "0", - margin: "0.15rem", - marginBottom: "0.5rem" -} - -const liStyle = { - display: "flex", - listStyleType: "none", - lineHeight: "120%", - fontSize: "72%" -} - -const symbolStyle = { - fontWeight: "bold", - lineHeight: "110%", - fontSize: "115%", - marginLeft: "2rem", -} - -const btnStyle = { - alignSelf: "center", - justifyContent: "center", - textAlign: "center", - background: colours.Button, - border: "none", - borderRadius: "30%", - color: "#FFFFFF", - fontSize: "130%", - fontWeight: "bold", - cursor: "pointer", - padding: "0.4rem 0.6rem", - marginLeft: "auto", - marginRight: "0.1rem" -} - -//PropTypes -Erc721.propTypes = { - erc: PropTypes.object.isRequired, - addErc: PropTypes.func.isRequired -} - -export default Erc721; \ No newline at end of file diff --git a/client/src/components/Sidebar/TokenInfo.js b/client/src/components/Sidebar/TokenInfo.js deleted file mode 100644 index e940f3d..0000000 --- a/client/src/components/Sidebar/TokenInfo.js +++ /dev/null @@ -1,217 +0,0 @@ -import React, { Component } from "react"; -import PropTypes from "prop-types"; - -import Erc20 from "./Erc20"; -import Erc721 from "./Erc721"; -import { ListErc20, ListErc721, colours } from "../../Static"; -import { ErcCalls, Erc20Contract, Erc721Contract } from "../../ContractCalls"; - -class TokenInfo extends Component { - - constructor(props) { - super(props); - this.state = { - connected: false, - erc20s: [], - erc721s: [] - } - this.updateBalances = this.updateBalances.bind(this); - this.addErc20 = this.addErc20.bind(this); - this.addErc721 = this.addErc721.bind(this); - this.checkListErc20 = this.checkListErc20.bind(this); - this.checkListErc721 = this.checkListErc721.bind(this); - } - - componentWillMount() { - this.setState({ connected: this.props.connected }, () => this.updateBalances()); - } - - componentWillReceiveProps(newProps) { - if(newProps.connected !== this.props.connected || newProps.counter !== this.props.counter){ - this.setState({ connected: newProps.connected }, () => this.updateBalances()); - } - } - - updateBalances() { - if(!this.props.connected){ - return; - } - - const listErc20 = ListErc20(); - const listErc721 = ListErc721(); - - for(let i = 0; i < listErc20.length; i++){ - let erc = { id: i, contractAdd: listErc20[i], type: "ERC20" }; - const contract = Erc20Contract(listErc20[i]); - - ErcCalls("decimals", contract) - .then(res => { - erc.decimalString = "1"; - if(res === null){ - console.log(listErc20[i]); - return; - } - for(let i = 0; i < +(res.toString()); i++){ - erc.decimalString+="0"; - } - ErcCalls("balanceOf", contract) - .then(res => { - if(res === null){ - console.log(listErc20[i]); - return; - } - erc.balance = (+res/(+erc.decimalString)).toFixed(3); - - if(erc.balance === "0.000"){ - this.checkListErc20(i); - return; - } - - let promiseArray = []; - promiseArray.push(ErcCalls("symbol", contract) - .then(res => { - if(res === null){ - console.log(listErc20[i]); - erc.symbol = "N/A"; - return; - } - erc.symbol = res.toString(); - })); - promiseArray.push(ErcCalls("allowance", contract) - .then(res => { - if(res === null){ - console.log(listErc20[i]); - erc.enabled = "N/A"; - return; - } - erc.enabled = res.toString() === "0" ? "False" : "True"; - })); - Promise.all(promiseArray) - .then(() => { - this.addErc20(erc); - }); - }); - }); - } - - for(let i = 0; i < listErc721.length; i++){ - let erc = { id: i, contractAdd: listErc721[i], type: "ERC721" }; - const contract = Erc721Contract(listErc721[i]); - - ErcCalls("balanceOf", contract) - .then(res => { - if(res === null){ - console.log(listErc721[i]); - return; - } - erc.balance = res.toString(); - if(erc.balance === "0"){ - this.checkListErc721(i); - return; - } - - let promiseArray = []; - promiseArray.push(ErcCalls("symbol", contract) - .then(res => { - if(res === null){ - console.log(listErc721[i]); - erc.symbol = "N/A"; - return; - } - erc.symbol = res.toString(); - })); - promiseArray.push(ErcCalls("isApprovedForAll", contract) - .then(res => { - if(res === null){ - console.log(listErc721[i]); - erc.enabled = "N/A"; - return; - } - erc.enabled = res === false ? "False" : "True"; - })); - Promise.all(promiseArray) - .then(() => { - this.addErc721(erc); - }); - }); - } - } - - addErc20(_erc) { - let erc20s = this.state.erc20s.filter(erc20 => { - return erc20.id !== _erc.id; - }); - erc20s.push(_erc); - erc20s.sort((a, b) => { - return a.id - b.id; - }); - this.setState({ erc20s }); - } - - addErc721(_erc) { - let erc721s = this.state.erc721s.filter(erc721 => { - return erc721.id !== _erc.id; - }); - erc721s.push(_erc); - erc721s.sort((a, b) => { - return a.id - b.id; - }); - this.setState({ erc721s }); - } - - checkListErc20(_id) { - let erc20s = this.state.erc20s.filter(erc => { - return erc.id !== _id; - }); - - this.setState({ erc20s }); - } - - checkListErc721(_id) { - let erc721s = this.state.erc721s.filter(erc => { - return erc.id !== _id; - }); - - this.setState({ erc721s }); - } - - render() { - return( -
      -

      ERC20

      - { this.state.erc20s.map(erc => - - ) } -
      -

      ERC721

      - { this.state.erc721s.map(erc => - - ) } -
      - ); - } -} - -const h3Style = { - marginTop: "0", - marginBottom: "0.3rem" -} - -const tokenInfoStyle = { - minHeight: "5rem", - backgroundColor: colours.Primary, - borderRadius: "15px", - boxShadow: "0px 0px 10px 0px rgba(0,0,0,0.2)", - padding: "0.6rem 0", - paddingBottom: "0.3rem", - margin: "0.5rem" -} - -//PropTypes -TokenInfo.propTypes = { - connected: PropTypes.bool.isRequired, - addErc: PropTypes.func.isRequired, - counter: PropTypes.number.isRequired -} - -export default TokenInfo; \ No newline at end of file diff --git a/client/src/components/TradeWindow.js b/client/src/components/TradeWindow.js deleted file mode 100644 index 25ee5b2..0000000 --- a/client/src/components/TradeWindow.js +++ /dev/null @@ -1,80 +0,0 @@ -import React, { Component } from "react"; -import PropTypes from "prop-types"; -import Box from "./TradeWindow/Box"; - -import { boolStatus, userBoxStatus } from "../Static"; - -class TradeWindow extends Component { - - constructor(props) { - super(props); - this.state = { - satisfied: [boolStatus.FALSE, boolStatus.FALSE], - executedStatus: boolStatus.FALSE - } - this.setSatisfied = this.setSatisfied.bind(this); - } - - setSatisfied(_boxNum, _satisfied) { - let satisfied = this.state.satisfied; - if(satisfied[_boxNum] ===_satisfied) return; - - satisfied[_boxNum] = _satisfied; - this.setState({ satisfied }); - - if(satisfied[0] === boolStatus.TRUE && satisfied[1] === boolStatus.TRUE){ - this.setState({ executedStatus: boolStatus.TRUE }); - alert("Trade Successfully Executed"); - }else{ - this.setState({ executedStatus: boolStatus.FALSE }); - } - } - - render() { - return( -
      -
      - {/*

      { AppAddress }

      */} - - -
      -
      - ); - } -} - -const tradeWindowStyle = { - display: "flex", - flexDirection: "column", - justifyContent: "center", - textAlign: "center", - maxWidth: "55rem", - marginBottom: "1.15rem" -} - -const boxesStyle = { - display: "flex", - flexWrap: "wrap", - flexDirection: "row", - justifyContent: "center", - textAlign: "center" -} -//PropTypes -TradeWindow.propTypes = { - connected: PropTypes.bool.isRequired, - counter: PropTypes.number.isRequired, - addresses: PropTypes.array.isRequired, - ensAdds: PropTypes.array.isRequired, - userBox: PropTypes.number.isRequired, - erc: PropTypes.object.isRequired -} - -export default TradeWindow; \ No newline at end of file diff --git a/client/src/components/TradeWindow/Box.js b/client/src/components/TradeWindow/Box.js deleted file mode 100644 index a2ff2f2..0000000 --- a/client/src/components/TradeWindow/Box.js +++ /dev/null @@ -1,352 +0,0 @@ -import React, { Component } from "react"; -import PropTypes from "prop-types"; - -import Summary from "./Summary"; -import Satisfied from "./Satisfied"; -import SubmitBox from "./SubmitBox"; -import OfferErc from "./OfferErc"; - -import { sendStatus, colours } from "../../Static"; -import { ArcaContract, ArcaCalls, Erc20Contract, Erc721Contract, ErcCalls } from "../../ContractCalls"; - -class Box extends Component { - - constructor(props) { - super(props); - this.state = { - connected: false, - partnerNonce: 0, - localMethods: [], - chainMethods: [] - } - this.getMethods = this.getMethods.bind(this); - this.addLocalMethod = this.addLocalMethod.bind(this); - this.addChainErc = this.addChainErc.bind(this); - this.getErc20Offers = this.getErc20Offers.bind(this); - this.getErc721Offers = this.getErc721Offers.bind(this); - this.updateErc = this.updateErc.bind(this); - this.removeExtraMethods = this.removeExtraMethods.bind(this); - this.remove = this.remove.bind(this); - } - - componentWillReceiveProps(newProps) { - if(this.props.addresses[0] !== newProps.addresses[0] || this.props.addresses[1] !== newProps.addresses[1] - || newProps.connected !== this.props.connected || newProps.counter !== this.props.counter){ - this.setState({ connected: newProps.connected }, () => this.getMethods()); - } - } - - getMethods() { - if(!this.state.connected){ - return; - } - - const contract = ArcaContract(); - const [add1, add2] = this.props.addresses; - - ArcaCalls("getErc20Count", [add1, add2], contract) - .then(res => { - this.getErc20Offers(+res, contract); - this.removeExtraMethods(+res, "0"); - }) - .catch(e => { - return e; - }); - - ArcaCalls("getErc721Count", [add1, add2], contract) - .then(res => { - this.getErc721Offers(+res, contract); - this.removeExtraMethods(+res, "1"); - }) - .catch(e => { - return e; - }); - - ArcaCalls("getNonce", [add2, add1], contract) - .then(res => { - this.setState({ partnerNonce: +res }); - }) - .catch(e => { - return; - }) - } - - addLocalMethod(method) { - const [add1, add2] = this.props.addresses; - const arcaContract = ArcaContract(); - - if(method.type === 0){ - const ercContract = Erc20Contract(method.contractAdd); - Promise.all([ - ArcaCalls("getErc20Count", [add1, add2], arcaContract), - ErcCalls("decimals", ercContract), - ErcCalls("allowance", ercContract) - ]) - .then(res => { - method.id = method.type+"-"+res[0].toString(); - - method.decimalString = "1"; - for(let i = 0; i < +(res[1].toString()); i++){ - method.decimalString+="0"; - } - - method.enabled = res[2].toString() === "0" ? false : true; - - this.setState({ localMethods: [...this.state.localMethods, method] }); - }) - .catch(e => { - this.setState({ localMethods: [...this.state.localMethods, method] }); - }); - }else{ - const ercContract = Erc721Contract(method.contractAdd); - Promise.all([ - ArcaCalls("getErc721Count", [add1, add2], arcaContract), - ErcCalls("isApprovedForAll", ercContract) - ]) - .then(res => { - method.id = method.type+"-"+res[0].toString(); - - method.enabled = res[1]; - - this.setState({ localMethods: [...this.state.localMethods, method] }); - }); - } - } - - addChainErc(_erc) { - let removals = this.state.chainMethods.filter(erc => { - return erc.removing === true; - }); - - for(let i = 0; i < removals.length; i++){ - if(removals[i].id === _erc.id){ - return; - } - } - - let chainMethods = this.state.chainMethods.filter(erc => { - return erc.id !== _erc.id; - }); - - let localMethods = this.state.localMethods.filter(erc => { - return erc.id !== _erc.id; - }); - - chainMethods.push(_erc); - chainMethods.sort((a, b) => { - return a.id.split("-").join("") - b.id.split("-").join(""); - }); - - this.setState({ chainMethods, localMethods }); - } - - getErc20Offers(_erc20Count, _arcaContract) { - for(let i = 0; i < _erc20Count; i++){ - const [add1, add2] = this.props.addresses; - let offer = { id: "0-"+i, type: 0, contractAdd: "", amountId: "", sendStatus: sendStatus.SENT, removed: false }; - - ArcaCalls("getOfferErc20", [add1, add2, i], _arcaContract) - .then(res => { - [offer.contractAdd, offer.amountId] = [res[0].toString(), res[1]]; - const erc20Contract = Erc20Contract(offer.contractAdd); - - Promise.all([ - ErcCalls("decimals", erc20Contract), - ErcCalls("name", erc20Contract), - ErcCalls("symbol", erc20Contract), - ErcCalls("allowance", erc20Contract) - ]) - .then(res => { - let decimalString = "1"; - for(let i = 0; i < +res[0]; i++){ - decimalString+="0"; - } - offer.amountId = (+offer.amountId/+decimalString).toString(); - - res[0] = decimalString; - res[1] = res[1].toString(); - res[2] = res[2].toString(); - res[3] = res[3].toString() === "0" ? false : true; - - [offer.decimalString, offer.name, offer.symbol, offer.enabled] = res; - - this.addChainErc(offer); - }) - .catch(e => { - offer.amountId = "N/A"; - offer.symbol = "CANCELLED"; - offer.name = "N/A"; - offer.enabled = false; - //this.addChainErc(offer); - }); - }) - .catch(e => { - return e; - }); - } - } - - getErc721Offers(_erc721Count, _arcaContract) { - for(let i = 0; i < _erc721Count; i++){ - const [add1, add2] = this.props.addresses; - let offer = { id: "1-"+i, type: 1, contractAdd: "", amountId: "", sendStatus: sendStatus.SENT }; - - ArcaCalls("getOfferErc721", [add1, add2, i], _arcaContract) - .then(res => { - [offer.contractAdd, offer.amountId] = [res[0].toString(), res[1].toString()]; - const erc721Contract = Erc721Contract(offer.contractAdd); - - Promise.all([ - ErcCalls("name", erc721Contract), - ErcCalls("symbol", erc721Contract), - ErcCalls("isApprovedForAll", erc721Contract) - ]) - .then(res => { - res[0] = res[0].toString(); - res[1] = res[1].toString(); - [offer.name, offer.symbol, offer.enabled] = res; - - this.addChainErc(offer); - }) - .catch(e => { - offer.amountId = "N/A"; - offer.symbol = "N/A"; - offer.name = "N/A"; - offer.enabled = false; - - //this.addChainErc(offer); //Display removed calls - }); - }) - .catch(e => { - //console.log(e); - return; - }); - } - } - - removeExtraMethods(_offerCount, _type) { - const chainMethods = this.state.chainMethods; - for(let i = 0; i < chainMethods.length; i++){ - const id = chainMethods[i].id.split("-"); - if(id[0] !== _type) continue; - if(+id[1] >= _offerCount){ - this.remove(chainMethods[i].id); - } - } - } - - updateErc(_property, _id, _params) { - const chainMethods = this.state.chainMethods; - const localMethods = this.state.localMethods; - - switch(_property){ - case "removing": - this.state.chainMethods.forEach((method, index) => { - if(method.id === _id){ - chainMethods[index].removing = _params; - } - }); - this.setState({ chainMethods }); - break; - case "sendStatus": - this.state.localMethods.forEach((method, index) => { - if(method.id === _id){ - localMethods[index].sendStatus = _params; - } - }); - this.setState({ localMethods }); - break; - case "enabled": - this.state.localMethods.forEach((method, index) => { - if(method.id === _id){ - localMethods[index].enabled = _params; - } - }); - this.setState({ localMethods }); - break; - default: - console.log("Invalid property name: " + _property); - } - } - - remove(id) { - let localMethods = this.state.localMethods.filter(meth => meth.id !== id); - this.setState({ localMethods }); - let chainMethods = this.state.chainMethods.filter(meth => meth.id !== id); - this.setState({ chainMethods }); - } - - render() { - return( -
      - -
      -
      - { this.state.chainMethods.map(method => - - ) } -
      -
      - { this.state.localMethods.map(method => - - ) } -
      -
      - { this.props.addresses[0].length === 0 ? "" : - - } - { this.props.isUser ? - : "" - } -
      - ); - } -} - -const boxStyle = { - display: "grid", - gridColumnGap: "3px", - gridTemplateRows: "2rem 3fr", - gridTemplateColumns: "4fr 1fr", - justifyContent: "center", - textAlign: "center", - width: "100%", - minWidth: "11rem", - background: colours.Primary, - boxShadow: "0px 0px 25px -2px rgba(0,0,0,0.25)", - color: colours.Secondary, - fontWeight: "normal", - padding: "0.3rem", - margin: "1rem 1.25rem" -} - -const containerStyle = { - gridColumn: "1 auto", - gridRow: "2 auto", - overflowY: "auto", - minHeight: "7.5rem", - maxHeight: "14.45rem", - scrollbarWidth: "thin", - paddingRight: "0.2rem", - margin: "0.1rem" -} - -//PropTypes -Box.propTypes = { - connected: PropTypes.bool.isRequired, - counter: PropTypes.number.isRequired, - addresses: PropTypes.array.isRequired, - ensAdd: PropTypes.string.isRequired, - boxNum: PropTypes.number.isRequired, - isUser: PropTypes.bool.isRequired, - erc: PropTypes.object.isRequired, - setSatisfied: PropTypes.func.isRequired -} - -export default Box; \ No newline at end of file diff --git a/client/src/components/TradeWindow/OfferErc.js b/client/src/components/TradeWindow/OfferErc.js deleted file mode 100644 index c422ac1..0000000 --- a/client/src/components/TradeWindow/OfferErc.js +++ /dev/null @@ -1,272 +0,0 @@ -import React, { Component } from "react"; -import PropTypes from "prop-types"; -import makeBlockie from "ethereum-blockies-base64"; - -import { sendStatus, colours } from "../../Static"; -import { CheckName } from "../ENS"; -import { ArcaSends, Erc20Contract, Erc721Contract, ErcSends } from "../../ContractCalls"; - -class OfferErc extends Component { - - constructor(props) { - super(props); - this.state = { - sendStatus: sendStatus.UNSENT - } - this.sendMethod = this.sendMethod.bind(this); - this.enableErc = this.enableErc.bind(this); - this.broadcastAdd = this.broadcastAdd.bind(this); - this.broadcastRemove = this.broadcastRemove.bind(this); - this.removeMethod = this.removeMethod.bind(this); - } - - sendMethod() { - if(!this.props.connected){ - alert("Not connected"); - return; - } - - this.setState({ sendStatus: sendStatus.SENDING }); - this.broadcastAdd(this.props.method); - } - - enableErc() { - if(!this.props.connected){ - return; - } - const method = this.props.method; - - let contract; - if(method.type === 0){ - contract = Erc20Contract(method.contractAdd); - - ErcSends("approve", "", contract) - .then(res => { - //alert("Tx Confirmed"); - }) - .catch(e => { - alert("Tx Failed"); - this.props.updateErc("enabled", method.id, false); - }); - this.props.updateErc("enabled", method.id, true);//Assuming success - }else if(method.type === 1){ - contract = Erc721Contract(method.contractAdd); - - ErcSends("setApprovalForAll", "", contract) - .then(res => { - //alert("Tx Confirmed"); - }) - .catch(e => { - alert("Tx Failed"); - this.props.updateErc("enabled", method.id, false); - }); - this.props.updateErc("enabled", method.id, true);//Assuming success - } - } - - removeMethod() { - if(!this.props.connected){ - alert("Not connected"); - return; - } - - if(this.props.local){ - this.props.remove(this.props.method.id); - return; - } - this.props.updateErc("removing", this.props.method.id, true); - this.broadcastRemove(this.props.method); - } - - broadcastAdd(method) { - if(method.type === 0){ - ArcaSends("pushOfferErc20", [this.props.addresses[1], method.contractAdd, (+method.amountId*+method.decimalString).toString()]) - .then(() => { - this.props.updateErc("sendStatus", method.id, sendStatus.SENT); - }) - .catch((e) => { - this.props.updateErc("sendStatus", method.id, sendStatus.UNSENT); - }); - }else if(method.type === 1){ - ArcaSends("pushOfferErc721", [this.props.addresses[1], method.contractAdd, method.amountId]) - .then(() => { - this.props.updateErc("sendStatus", method.id, sendStatus.SENT); - }) - .catch((e) => { - this.props.updateErc("sendStatus", method.id, sendStatus.UNSENT); - }); - } - } - - broadcastRemove(method) { - if(method.type === 0){ - ArcaSends("removeOfferErc20", [this.props.addresses[1], method.id.split("-")[1]]) - .then(() => { - this.props.remove(method.id); - }) - .catch((e) => { - this.props.updateErc("removing", method.id, false); - //this.props.removing(this.props.method.id, false); - }); - }else if(method.type === 1){ - ArcaSends("removeOfferErc721", [this.props.addresses[1], method.id.split("-")[1]]) - .then(() => { - this.props.remove(method.id); - }) - .catch((e) => { - this.props.updateErc("removing", method.id, false); - //this.props.removing(this.props.method.id, false); - }); - } - } - - offerButton(method) { - if(!method.enabled){ - return ; - } - - //Erc20 - if(method.type === 0){ - return ; - } - - //Erc721 - if(method.sendStatus === sendStatus.SENT){ - return null; - } - return ; - } - - offer(method) { - switch(method.contractName){ - case "ENS": - return <> - blockie -
      ERC721  -
      -
      - { method.symbol } -
      -
      ENS NAME ID: { method.amountId }
      - ; - default: - return <> - blockie - { method.type === 0 ?
      ERC20   -
      : -
      ERC721  -
      } -
      - { method.symbol } -
      - { method.type === 0 ? -
      Amount: { method.amountId }
      : -
      ID: { method.amountId }
      - } - - } - } - - render() { - const method = this.props.method; - - if(method.removing) return null; - if(!this.props.isUser){ - return( -
      -
      - { this.offer(method) } -
      -
      - ); - } - return( -
      - -
      - { this.offer(method) } -
      - { this.offerButton(method) } -
      - ); - } -} - -const methodStyle = { - display: "grid", - gridColumnGap: "3px", - gridTemplateColumns: "auto 5fr auto", - justifyContent: "center", - textAlign: "center", - background: colours.Primary, - boxShadow: "0px 5px 5px -5px rgba(0,0,0,0.5)", - lineHeight: "1.4em", - fontSize: "0.95em", - fontWeight: "normal", - margin: "0.2rem", - marginLeft: "0", - marginRight: "0" -} - -const displayStyle = { - gridColumn: "2 / 3", - display: "flex", - flexWrap: "wrap", - flexDirection: "row", - justifyContent: "center", - textAlign: "start", - background: colours.Primary, - color: colours.Secondary, - fontSize: "0.95em", - margin: "0.1rem" -} - -const btnStyleSend = { - gridColumn: "3", - border: "none", - width: "5rem", - color: "#FFFFFF", - fontWeight: "bold", - cursor: "pointer", - margin: "0.2rem" -} - -const btnStyleUnsent = { - background: colours.Button -} - -const btnStyleSent = { - background: colours.ButtonPressed -} - -const btnStyleX = { - gridColumn: "1", - justifyContent: "center", - textAlign: "center", - background: colours.Primary, - border: "none", - color: colours.Secondary, - fontSize: "130%", - fontWeight: "normal", - cursor: "pointer", - marginLeft: "0.6rem" -} - -//PropTypes -OfferErc.propTypes = { - connected: PropTypes.bool.isRequired, - method: PropTypes.object.isRequired, - addresses: PropTypes.array.isRequired, - local: PropTypes.bool.isRequired, - isUser: PropTypes.bool.isRequired, - remove: PropTypes.func.isRequired, - updateErc: PropTypes.func.isRequired -} - -export default OfferErc; \ No newline at end of file diff --git a/client/src/components/TradeWindow/Satisfied.js b/client/src/components/TradeWindow/Satisfied.js deleted file mode 100644 index ecc2d65..0000000 --- a/client/src/components/TradeWindow/Satisfied.js +++ /dev/null @@ -1,232 +0,0 @@ -import React, { Component } from "react"; -import PropTypes from "prop-types"; - -import { boolStatus, colours } from "../../Static"; -import { ArcaSends, ArcaContract, ArcaCalls } from "../../ContractCalls"; - -class Satisfied extends Component { - - constructor(props) { - super(props); - this.state = { - connected: false, - satisfied: boolStatus.FALSE - } - this.getSatisfied = this.getSatisfied.bind(this); - this.toggleSatisfied = this.toggleSatisfied.bind(this); - this.acceptTrade = this.acceptTrade.bind(this); - this.rejectTrade = this.rejectTrade.bind(this); - } - - componentWillMount() { - this.setState({ connected: this.props.connected }, () => this.getSatisfied()); - } - - componentWillReceiveProps(newProps) { - if(this.props.addresses[0] !== newProps.addresses[0] || this.props.addresses[1] !== newProps.addresses[1] - || newProps.connected !== this.props.connected || newProps.counter !== this.props.counter){ - this.setState({ connected: newProps.connected }, () => this.getSatisfied()); - } - } - - getSatisfied() { - if(!this.state.connected){ - return; - } - - const [add1, add2] = this.props.addresses; - const contract = ArcaContract(); - - Promise.all([ - ArcaCalls("getPartnerNonce", [add1, add2], contract), - ArcaCalls("getNonce", [add2, add1], contract) - ]) - .then(res => { - if(+res[0] === +res[1]+1){ - if(this.state.satisfied === boolStatus.TRUE || this.state.satisfied === boolStatus.TOFALSE) { - return; - } - this.setState({ satisfied: boolStatus.TRUE} ); - this.props.setSatisfied(this.props.boxNum, boolStatus.TRUE); - }else{ - if(this.state.satisfied === boolStatus.TRUE || this.state.satisfied === boolStatus.TOTRUE) { - return; - } - this.setState({ satisfied: boolStatus.FALSE} ); - this.props.setSatisfied(this.props.boxNum, boolStatus.FALSE); - } - }); - } - - toggleSatisfied(e) { - if(!this.props.isUser){ - return; - } - - let satisfied; - switch(this.state.satisfied){ - case boolStatus.TRUE: - satisfied = boolStatus.TOFALSE; - this.rejectTrade(); - break; - case boolStatus.FALSE: - satisfied = boolStatus.TOTRUE; - this.acceptTrade(); - break; - case boolStatus.TOTRUE: - satisfied = boolStatus.TOFALSE; - this.rejectTrade(); - break; - case boolStatus.TOFALSE: - satisfied = boolStatus.TOTRUE; - this.acceptTrade(); - break; - default: - console.log("Error in toggleSatisfied"); - return; - } - - this.setState({ satisfied }); - this.props.setSatisfied(this.props.boxNum, satisfied); - } - - acceptTrade() { - if(!this.props.connected){ - alert("Not connected"); - return; - } - - ArcaSends("acceptTrade", [this.props.addresses[1], this.props.partnerNonce]) - .then(() => { - this.props.setSatisfied(this.props.boxNum, boolStatus.TRUE); - this.setState({ satisfied: boolStatus.TRUE }); - }) - .catch((e) => { - this.props.setSatisfied(this.props.boxNum, boolStatus.FALSE); - this.setState({ satisfied: boolStatus.FALSE }); - }) - } - - rejectTrade() { - if(!this.props.connected){ - alert("Not connected"); - return; - } - - ArcaSends("unacceptTrade", [this.props.addresses[1]]) - .then(() => { - this.props.setSatisfied(this.props.boxNum, boolStatus.FALSE); - this.setState({ satisfied: boolStatus.FALSE }); - }) - .catch((e) => { - this.props.setSatisfied(this.props.boxNum, boolStatus.TRUE); - this.setState({ satisfied: boolStatus.TRUE }); - }) - } - - status() { - if(this.state.satisfied === boolStatus.TRUE){ - return
      - Accepted -
      ; - } - return
      - Not Accepted -
      ; - } - - button() { - if(!this.props.isUser) return; - if(this.state.satisfied === boolStatus.TRUE){ - return ; - } - return ; - } - - render() { - return( -
      - { this.status() } - { this.button() } -
      - ); - } -} - -const satisfiedStyle = { - gridColumn: "2 auto", - gridRow: "2 auto", - display: "flex", - flexDirection: "column", - justifyContent: "space-evenly", - textAlign: "center", - alignItems: "center", - background: colours.Primary, - color: colours.Secondary, - lineHeight: "1.5em", - fontWeight: "bold", - marginLeft: "0", - marginRight: "0.3rem", - marginBottom: "0.3rem", - marginTop: "0.4rem" -} - -const btnStyle = { - gridColumn: "2", - gridRow: "1 / 3", - border: "none", - borderRadius: "0.8rem", - color: colours.Primary, - fontWeight: "bold", - cursor: "pointer", - padding: "0.6rem 1.1rem", - margin: "0.2rem" -} - -const btnStyleAccepted = { - background: colours.ButtonPressed -} - -const btnStyleNotAccepted = { - background: colours.Button -} - -const statusStyle = { - gridColumn: "2", - gridRow: "1 / 3", - width: "100%", - background: colours.Primary, - color: colours.Secondary, - fontWeight: "bold", - padding: "0.3rem 0", - margin: "0.2rem 0" -} - -const statusStyleAccepted = { - borderTop: "solid 2px green", - borderBottom: "solid 2px green" -} - -const statusStyleNotAccepted = { - borderTop: "solid 2px red", - borderBottom: "solid 2px red" -} - -//PropTypes -Satisfied.propTypes = { - connected: PropTypes.bool.isRequired, - counter: PropTypes.number.isRequired, - addresses: PropTypes.array.isRequired, - boxNum: PropTypes.number.isRequired, - isUser: PropTypes.bool.isRequired, - partnerNonce: PropTypes.number.isRequired, - setSatisfied: PropTypes.func.isRequired -} - -export default Satisfied; \ No newline at end of file diff --git a/client/src/components/TradeWindow/SubmitBox.js b/client/src/components/TradeWindow/SubmitBox.js deleted file mode 100644 index 288083d..0000000 --- a/client/src/components/TradeWindow/SubmitBox.js +++ /dev/null @@ -1,164 +0,0 @@ -import React, { Component } from "react"; -import PropTypes from "prop-types"; - -import { sendStatus, colours } from "../../Static"; -import { Erc20Contract, Erc721Contract, ErcCalls } from "../../ContractCalls"; -import { KnownContracts } from "../Alias" -class SubmitBox extends Component { - - constructor(props) { - super(props); - this.state = { - id: "", - type: "", - name: "", - symbol: "", - contractAdd: "", - amountId: "", - sendStatus: sendStatus.UNSENT - } - this.onChange = this.onChange.bind(this); - this.onSubmit = this.onSubmit.bind(this); - } - - componentWillReceiveProps(nextProps) { - if(nextProps.erc.contractAdd !== this.props.erc.contractAdd){ - this.setState({ contractAdd: nextProps.erc.contractAdd, type: nextProps.erc.type, amountId: "" }); - } - } - - async onSubmit(e) {//addOffer - e.preventDefault(); - const method = { - id: "", - type: this.state.type, - name: "", - symbol: "", - contractAdd: this.state.contractAdd, - amountId: this.state.amountId, - sendStatus: sendStatus.UNSENT, - contractName: "" - }; - - let contract; - if(method.type.includes("20")){ - contract = Erc20Contract(method.contractAdd); - method.type = 0; - }else if(method.type.includes("721")){ - contract = Erc721Contract(method.contractAdd); - method.type = 1; - }else{ - return; - } - - method.name = ""; - method.symbol = ""; - - ErcCalls("name", contract) - .then(res => { - method.name = res.toString(); - }); - ErcCalls("symbol", contract) - .then(res => { - method.symbol = res.toString(); - }); - - KnownContracts(method.contractAdd) - .then(name => { - method.contractName = name; - this.props.addMethod(method);//TODO THIS MIGHT REQUIRE PROMISE.ALL - }); - } - - onChange(e) { - this.setState({ - [e.target.name]: e.target.value - }); - } - - render() { - return( -
      - - - - -
      - ); - } -} - -const methodStyle = { - gridColumn: "1 / 3", - gridRow: "3", - justifyContent: "center", - textAlign: "center", - background: colours.Primary, - color: colours.Secondary -} - -const baseInputStyle = { - textAlign: "left", - margin: "0.2rem", - minWidth: "6em", - backgroundColor: colours.Primary, - borderColor: "#888888", - borderWidth: "1px", - borderStyle: "solid", - color: colours.Secondary, - padding: "0.1rem" -} - -const btnStyle = { - background: colours.Button, - border: "none", - borderRadius: "0.4rem", - color: colours.Primary, - fontWeight: "bold", - cursor: "pointer", - padding: "0.35rem 0.5rem", - margin: "0.2rem 0.5rem", - marginTop: "0.4rem" -} - -//PropTypes -SubmitBox.propTypes = { - connected: PropTypes.bool.isRequired, - address: PropTypes.string.isRequired, - erc: PropTypes.object.isRequired, - addMethod: PropTypes.func.isRequired -} - -export default SubmitBox; \ No newline at end of file diff --git a/client/src/components/TradeWindow/Summary.js b/client/src/components/TradeWindow/Summary.js deleted file mode 100644 index d0f1ce2..0000000 --- a/client/src/components/TradeWindow/Summary.js +++ /dev/null @@ -1,50 +0,0 @@ -import React, { Component } from "react"; -import PropTypes from "prop-types"; -import makeBlockie from "ethereum-blockies-base64"; - -import { colours } from "../../Static"; - -class Summary extends Component { - - summary() { - if(this.props.ensAdd !== "") { - return <>{ this.props.ensAdd } ; - } - if(this.props.address !== "") { - return <>{ this.props.address } ; - } - } - - render() { - return( -
      - { this.summary() } - { this.props.address !== "" ? blockie : "" } -
      - ); - } -} - -const summaryStyle = { - display: "flex", - gridColumn: "1 / 3", - gridRow: "1", - justifyContent: "center", - textAlign: "center", - background: colours.Primary, - boxShadow: "0px 5px 7px -5px rgba(0,0,0,0.65)", - color: colours.Secondary, - lineHeight: "1.8em", - padding: "0.1rem", - margin: "0", - marginTop:"0.1rem" -} - -//PropTypes -Summary.propTypes = { - address: PropTypes.string.isRequired, - ensAdd: PropTypes.string.isRequired -} - -export default Summary; \ No newline at end of file diff --git a/client/src/components/Web3Status.js b/client/src/components/Web3Status.js deleted file mode 100644 index eca01b5..0000000 --- a/client/src/components/Web3Status.js +++ /dev/null @@ -1,55 +0,0 @@ -import React, { Component } from "react"; -import PropTypes from "prop-types"; -import { colours } from "../Static"; - -class Web3Status extends Component { - - onClick = () => { - this.props.enableWeb3(); - } - - render() { - return( -
      - -
      - ); - } -} - -const web3StatusStyle = { - justifyContent: "center", - textAlign: "center", - width: "100%" -} - -const btnStyleUnsent = { - background: colours.Button, - maxWidth: "8rem", - border: "none", - borderRadius: "0.65rem", - color: colours.Primary, - fontWeight: "bold", - cursor: "pointer", - padding: "5px 20px" -} - -const btnStyleSent = { - backgroundColor: colours.ButtonPressed, - border: "none", - borderRadius: "0", - color: colours.Primary, - fontWeight: "bold", - padding: "4px 16px", - marginTop: "0.1rem" -} - -//PropTypes -Web3Status.propTypes = { - connected: PropTypes.bool.isRequired, - enableWeb3: PropTypes.func.isRequired -} - -export default Web3Status; \ No newline at end of file From 83acf04b7309db13bdf0a279f4084eec9f78efb9 Mon Sep 17 00:00:00 2001 From: Flash Date: Sat, 20 Jul 2019 17:47:00 +0200 Subject: [PATCH 032/425] Formatting --- client/src/components/layout/Navbar.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/client/src/components/layout/Navbar.js b/client/src/components/layout/Navbar.js index 729e580..8491fab 100644 --- a/client/src/components/layout/Navbar.js +++ b/client/src/components/layout/Navbar.js @@ -1,4 +1,4 @@ -import React, { Fragment, useContext } from "react"; +import React, { useContext } from "react"; import { Link } from "react-router-dom"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; @@ -33,9 +33,7 @@ const Navbar = ({ title, icon }) => {
      • - - {!connected ? "Not Connected" : networkText(network)} - + {!connected ? "Not Connected" : networkText}
      • About From 7dc20aacbe847a50b3cee46a170811f4a3fff6ea Mon Sep 17 00:00:00 2001 From: Flash Date: Sat, 20 Jul 2019 18:09:23 +0200 Subject: [PATCH 033/425] Removed comment --- client/src/components/layout/Sidebar.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/client/src/components/layout/Sidebar.js b/client/src/components/layout/Sidebar.js index 6a07f41..f91675d 100644 --- a/client/src/components/layout/Sidebar.js +++ b/client/src/components/layout/Sidebar.js @@ -1,11 +1,10 @@ import React, { useContext } from "react"; import UserContext from "../../context/user/UserContext"; -import UserState from "../../context/user/UserState"; const Sidebar = () => { const userContext = useContext(UserContext); - console.log(userContext); + const { settings, user, web3 } = userContext; const { connected } = web3; From 5702bc046f7ecadd123bf015b920dea46af98448 Mon Sep 17 00:00:00 2001 From: Flash Date: Sat, 20 Jul 2019 18:09:33 +0200 Subject: [PATCH 034/425] Added info circle --- client/src/App.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/src/App.js b/client/src/App.js index 07ea4aa..367ad30 100644 --- a/client/src/App.js +++ b/client/src/App.js @@ -2,7 +2,7 @@ import React, { Fragment } from "react"; import { BrowserRouter as Router, Switch, Route } from "react-router-dom"; import { library } from "@fortawesome/fontawesome-svg-core"; -import { faBoxOpen } from "@fortawesome/free-solid-svg-icons"; +import { faBoxOpen, faInfoCircle } from "@fortawesome/free-solid-svg-icons"; import Alerts from "./components/layout/Alerts"; import Navbar from "./components/layout/Navbar"; @@ -19,7 +19,7 @@ import setAuthToken from "./utils/setAuthToken.js"; import "./App.css"; -library.add(faBoxOpen); +library.add(faBoxOpen, faInfoCircle); localStorage.token && setAuthToken(localStorage.token); From f3a01ce9f489dfab52403f6187ed8cb5fa16c795 Mon Sep 17 00:00:00 2001 From: Flash Date: Sat, 20 Jul 2019 18:09:43 +0200 Subject: [PATCH 035/425] Added settings --- client/src/context/user/UserState.js | 1 + 1 file changed, 1 insertion(+) diff --git a/client/src/context/user/UserState.js b/client/src/context/user/UserState.js index 662819a..c07696c 100644 --- a/client/src/context/user/UserState.js +++ b/client/src/context/user/UserState.js @@ -93,6 +93,7 @@ const UserState = props => { web3: state.web3, user: state.user, tradePartner: state.tradePartner, + settings: state.settings, setWeb3, setUser, setTradePartner, From 06e6f95bb35a647d4de0501a23a35737a59087ab Mon Sep 17 00:00:00 2001 From: Flash Date: Sat, 20 Jul 2019 18:22:40 +0200 Subject: [PATCH 036/425] Formatting --- client/src/components/layout/Sidebar.js | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/client/src/components/layout/Sidebar.js b/client/src/components/layout/Sidebar.js index f91675d..4cf4a66 100644 --- a/client/src/components/layout/Sidebar.js +++ b/client/src/components/layout/Sidebar.js @@ -6,18 +6,26 @@ const Sidebar = () => { const userContext = useContext(UserContext); const { settings, user, web3 } = userContext; - const { connected } = web3; + const { connected, loading } = web3; const tokens = () => (

          Erc20s

          - {user.ownedTokens.erc20Tokens.map(token => ( -
        • {token.name}
        • - ))} + {user.ownedTokens.erc20Tokens.length > 0 ? ( + user.ownedTokens.erc20Tokens.map(token =>
        • {token.name}
        • ) + ) : loading ? ( + + ) : ( + "No erc20s found" + )}

          Erc721s

          - {user.ownedTokens.erc721Tokens.map(token => ( -
        • {token.name}
        • - ))} + {user.ownedTokens.erc721Tokens.length > 0 ? ( + user.ownedTokens.erc721Tokens.map(token =>
        • {token.name}
        • ) + ) : loading ? ( + + ) : ( + "No erc721s found" + )}
        ); From b5bbf296a0c113e93c277c499d4753c195b5ac5f Mon Sep 17 00:00:00 2001 From: Flash Date: Sat, 20 Jul 2019 18:22:51 +0200 Subject: [PATCH 037/425] Added web3 context --- client/src/context/web3/Web3Context.js | 5 +++ client/src/context/web3/Web3Reducer.js | 8 +++++ client/src/context/web3/Web3State.js | 45 ++++++++++++++++++++++++++ 3 files changed, 58 insertions(+) create mode 100644 client/src/context/web3/Web3Context.js create mode 100644 client/src/context/web3/Web3Reducer.js create mode 100644 client/src/context/web3/Web3State.js diff --git a/client/src/context/web3/Web3Context.js b/client/src/context/web3/Web3Context.js new file mode 100644 index 0000000..44e00f0 --- /dev/null +++ b/client/src/context/web3/Web3Context.js @@ -0,0 +1,5 @@ +import { createContext } from "react"; + +const Web3Context = createContext(); + +export default Web3Context; diff --git a/client/src/context/web3/Web3Reducer.js b/client/src/context/web3/Web3Reducer.js new file mode 100644 index 0000000..4ab3e80 --- /dev/null +++ b/client/src/context/web3/Web3Reducer.js @@ -0,0 +1,8 @@ +import {} from "../types"; + +export default (state, action) => { + switch (action.type) { + default: + return state; + } +}; diff --git a/client/src/context/web3/Web3State.js b/client/src/context/web3/Web3State.js new file mode 100644 index 0000000..0997112 --- /dev/null +++ b/client/src/context/web3/Web3State.js @@ -0,0 +1,45 @@ +import React, { useReducer } from "react"; + +import UserContext from "./UserContext"; +import UserReducer from "./Web3Reducer"; + +import { CONNECT_WEB3, UPDATE_WEB3 } from "../types"; + +const Web3State = props => { + const initialState = { + connected: false, + network: null + }; + + const [state, dispatch] = useReducer(UserReducer, initialState); + + /* + * Actions + */ + + const connect = () => { + dispatch({ + type: CONNECT_WEB3 + }); + }; + + const updateNetwork = () => { + dispatch({ + type: UPDATE_WEB3 + }); + }; + + return ( + + {props.children} + + ); +}; +export default Web3State; From 37b3d0d3829d3b8cad8cf7ad27c9c713262ffd09 Mon Sep 17 00:00:00 2001 From: Flash Date: Sat, 20 Jul 2019 18:24:30 +0200 Subject: [PATCH 038/425] Formatting --- client/src/context/web3/Web3State.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/client/src/context/web3/Web3State.js b/client/src/context/web3/Web3State.js index 0997112..3a0c3e2 100644 --- a/client/src/context/web3/Web3State.js +++ b/client/src/context/web3/Web3State.js @@ -1,7 +1,7 @@ import React, { useReducer } from "react"; -import UserContext from "./UserContext"; -import UserReducer from "./Web3Reducer"; +import Web3Context from "./Web3Context"; +import Web3Reducer from "./Web3Reducer"; import { CONNECT_WEB3, UPDATE_WEB3 } from "../types"; @@ -11,7 +11,7 @@ const Web3State = props => { network: null }; - const [state, dispatch] = useReducer(UserReducer, initialState); + const [state, dispatch] = useReducer(Web3Reducer, initialState); /* * Actions @@ -30,7 +30,7 @@ const Web3State = props => { }; return ( - { }} > {props.children} - + ); }; export default Web3State; From 8bf544f163cf71c8904cfd4577b45b0244f7f113 Mon Sep 17 00:00:00 2001 From: Flash Date: Sat, 20 Jul 2019 18:43:21 +0200 Subject: [PATCH 039/425] Added ens context --- client/src/context/ens/EnsContext.js | 5 +++++ client/src/context/ens/EnsReducer.js | 8 ++++++++ client/src/context/ens/EnsState.js | 19 +++++++++++++++++++ 3 files changed, 32 insertions(+) create mode 100644 client/src/context/ens/EnsContext.js create mode 100644 client/src/context/ens/EnsReducer.js create mode 100644 client/src/context/ens/EnsState.js diff --git a/client/src/context/ens/EnsContext.js b/client/src/context/ens/EnsContext.js new file mode 100644 index 0000000..36297a6 --- /dev/null +++ b/client/src/context/ens/EnsContext.js @@ -0,0 +1,5 @@ +import { createContext } from "react"; + +const EnsContext = createContext(); + +export default EnsContext; diff --git a/client/src/context/ens/EnsReducer.js b/client/src/context/ens/EnsReducer.js new file mode 100644 index 0000000..4ab3e80 --- /dev/null +++ b/client/src/context/ens/EnsReducer.js @@ -0,0 +1,8 @@ +import {} from "../types"; + +export default (state, action) => { + switch (action.type) { + default: + return state; + } +}; diff --git a/client/src/context/ens/EnsState.js b/client/src/context/ens/EnsState.js new file mode 100644 index 0000000..d2495ee --- /dev/null +++ b/client/src/context/ens/EnsState.js @@ -0,0 +1,19 @@ +import React, { useReducer } from "react"; + +import EnsContext from "./EnsContext"; +import EnsReducer from "./EnsReducer"; + +import {} from "../types"; + +const EnsState = props => { + const initialState = {}; + + const [state, dispatch] = useReducer(EnsReducer, initialState); + + /* + * Actions + */ + + return {props.children}; +}; +export default EnsState; From 4fe9edbfccf6d413d59906c0de1369fdd31d7621 Mon Sep 17 00:00:00 2001 From: Flash Date: Sat, 20 Jul 2019 19:19:27 +0200 Subject: [PATCH 040/425] Added methods --- client/src/context/web3/Web3State.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/client/src/context/web3/Web3State.js b/client/src/context/web3/Web3State.js index 3a0c3e2..b66147f 100644 --- a/client/src/context/web3/Web3State.js +++ b/client/src/context/web3/Web3State.js @@ -29,6 +29,27 @@ const Web3State = props => { }); }; + const getERC20Token = (tokenAddress, userAddress) => { + dispatch({ + type: GET_ERC20, + payload: { tokenAddress, userAddress } + }); + }; + + const getERC721Token = (tokenAddress, userAddress) => { + dispatch({ + type: GET_ERC721, + payload: { tokenAddress, userAddress } + }); + }; + + const getENSItem = (id, userAddress) => { + dispatch({ + type: GET_ENS_ITEM, + payload: { id, userAddress } + }); + }; + return ( Date: Sat, 20 Jul 2019 19:19:45 +0200 Subject: [PATCH 041/425] Added comment --- client/src/context/ens/EnsState.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/client/src/context/ens/EnsState.js b/client/src/context/ens/EnsState.js index d2495ee..b9f57f7 100644 --- a/client/src/context/ens/EnsState.js +++ b/client/src/context/ens/EnsState.js @@ -14,6 +14,8 @@ const EnsState = props => { * Actions */ + //Get erc721 id out of name => namehash => id + return {props.children}; }; export default EnsState; From 22714a43da815aa919e150e5b3d4f47ef3774a3f Mon Sep 17 00:00:00 2001 From: Flash Date: Sat, 20 Jul 2019 19:19:52 +0200 Subject: [PATCH 042/425] Added empty box --- client/src/components/tradeBox/Box.js | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 client/src/components/tradeBox/Box.js diff --git a/client/src/components/tradeBox/Box.js b/client/src/components/tradeBox/Box.js new file mode 100644 index 0000000..7b123f8 --- /dev/null +++ b/client/src/components/tradeBox/Box.js @@ -0,0 +1,7 @@ +import React from "react"; + +const Box = () => { + return
        Box
        ; +}; + +export default Box; From a36f4ae6bf4fd6ea6a915780171c522cfdc02423 Mon Sep 17 00:00:00 2001 From: Flash Date: Sat, 20 Jul 2019 19:19:58 +0200 Subject: [PATCH 043/425] Added empty Form --- client/src/components/tradeBox/Form.js | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 client/src/components/tradeBox/Form.js diff --git a/client/src/components/tradeBox/Form.js b/client/src/components/tradeBox/Form.js new file mode 100644 index 0000000..e69de29 From 00d12970c71b6ec671b66f4a16487b024690325b Mon Sep 17 00:00:00 2001 From: Flash Date: Sat, 20 Jul 2019 19:20:05 +0200 Subject: [PATCH 044/425] Added empty item --- client/src/components/tradeBox/Item.js | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 client/src/components/tradeBox/Item.js diff --git a/client/src/components/tradeBox/Item.js b/client/src/components/tradeBox/Item.js new file mode 100644 index 0000000..e69de29 From 338e15ae3ec4ac770628e3363d686b1c4d00f339 Mon Sep 17 00:00:00 2001 From: Flash Date: Sat, 20 Jul 2019 19:20:11 +0200 Subject: [PATCH 045/425] Added ens form --- .../components/tradeBox/itemTypes/EnsForm.js | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 client/src/components/tradeBox/itemTypes/EnsForm.js diff --git a/client/src/components/tradeBox/itemTypes/EnsForm.js b/client/src/components/tradeBox/itemTypes/EnsForm.js new file mode 100644 index 0000000..3c3eb3a --- /dev/null +++ b/client/src/components/tradeBox/itemTypes/EnsForm.js @@ -0,0 +1,47 @@ +import React, { useState, useEffect } from "react"; +import PropTypes from "prop-types"; + +const EnsForm = id => { + const [item, setItem] = useState({ + name: "", + namehash: "", + id: id, + verified: false + }); + + const { name, namehash, id, verified } = item; + + useEffect(() => { + //eslint-disable-next-line + }, []); + + //Input + const onChange = e => { + setItem({ ...item, [e.target.name]: e.target.value }); + //name => namehash => id + //if ids match then verify + }; + + //Render + return ( +
        +
        +

        ID:{id}

        + + {verified && "ICON"} +
        +
        + ); +}; + +EnsForm.propTypes = { + id: PropTypes.string.isRequired +}; + +export default EnsForm; From 55a0c7a53eebfeb87fab0eaf0cb48cc6274f8101 Mon Sep 17 00:00:00 2001 From: James Quinn Date: Sun, 21 Jul 2019 18:52:10 +0200 Subject: [PATCH 046/425] Updated dependencies --- client/package-lock.json | 4 ++-- package-lock.json | 49 +++++++++++----------------------------- 2 files changed, 15 insertions(+), 38 deletions(-) diff --git a/client/package-lock.json b/client/package-lock.json index b18eb09..3d0370a 100644 --- a/client/package-lock.json +++ b/client/package-lock.json @@ -15807,7 +15807,7 @@ }, "strip-ansi": { "version": "3.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "resolved": "http://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", "requires": { "ansi-regex": "^2.0.0" @@ -18610,7 +18610,7 @@ }, "yargs": { "version": "11.1.0", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-11.1.0.tgz", + "resolved": "http://registry.npmjs.org/yargs/-/yargs-11.1.0.tgz", "integrity": "sha512-NwW69J42EsCSanF8kyn5upxvjp5ds+t3+udGBeTbFnERA+lF541DDpMawzo4z6W/QrzNM18D+BPMiOBibnFV5A==", "requires": { "cliui": "^4.0.0", diff --git a/package-lock.json b/package-lock.json index a62188c..b2df5c6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1933,9 +1933,9 @@ } }, "lodash": { - "version": "4.17.11", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz", - "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==" + "version": "4.17.15", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", + "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==" }, "lowercase-keys": { "version": "1.0.1", @@ -2070,9 +2070,9 @@ "dev": true }, "mixin-deep": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/mixin-deep/-/mixin-deep-1.3.1.tgz", - "integrity": "sha512-8ZItLHeEgaqEvd5lYBXfm4EZSFCX29Jb9K+lAHhDKzReKBQKj3R+7NOF6tjqYi9t4oI8VUfaWITJQm86wnXGNQ==", + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/mixin-deep/-/mixin-deep-1.3.2.tgz", + "integrity": "sha512-WRoDn//mXBiJ1H40rqa3vH0toePwSsGb45iInWlTySa+Uu4k3tYUSxa2v1KqAiLtvlrSzaExqS1gtk96A9zvEA==", "dev": true, "requires": { "for-in": "^1.0.2", @@ -2679,9 +2679,9 @@ "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=" }, "set-value": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/set-value/-/set-value-2.0.0.tgz", - "integrity": "sha512-hw0yxk9GT/Hr5yJEYnHNKYXkIA8mVJgd9ditYZCe16ZczcaELYYcfvaXesNACk2O8O0nTiPQcQhGUQj8JLzeeg==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/set-value/-/set-value-2.0.1.tgz", + "integrity": "sha512-JxHc1weCN68wRY0fhCoXpyK55m/XPHafOmK4UWD7m2CI14GMcFypt4w/0+NV5f/ZMby2F6S2wwA7fgynh9gWSw==", "dev": true, "requires": { "extend-shallow": "^2.0.1", @@ -3110,38 +3110,15 @@ } }, "union-value": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/union-value/-/union-value-1.0.0.tgz", - "integrity": "sha1-XHHDTLW61dzr4+oM0IIHulqhrqQ=", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/union-value/-/union-value-1.0.1.tgz", + "integrity": "sha512-tJfXmxMeWYnczCVs7XAEvIV7ieppALdyepWMkHkwciRpZraG/xwT+s2JN8+pr1+8jCRf80FFzvr+MpQeeoF4Xg==", "dev": true, "requires": { "arr-union": "^3.1.0", "get-value": "^2.0.6", "is-extendable": "^0.1.1", - "set-value": "^0.4.3" - }, - "dependencies": { - "extend-shallow": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", - "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", - "dev": true, - "requires": { - "is-extendable": "^0.1.0" - } - }, - "set-value": { - "version": "0.4.3", - "resolved": "https://registry.npmjs.org/set-value/-/set-value-0.4.3.tgz", - "integrity": "sha1-fbCPnT0i3H945Trzw79GZuzfzPE=", - "dev": true, - "requires": { - "extend-shallow": "^2.0.1", - "is-extendable": "^0.1.1", - "is-plain-object": "^2.0.1", - "to-object-path": "^0.3.0" - } - } + "set-value": "^2.0.1" } }, "unique-string": { From 0da95d3bff85b8db56cdf4fe061c99179b058a2f Mon Sep 17 00:00:00 2001 From: James Quinn Date: Sun, 21 Jul 2019 20:06:55 +0200 Subject: [PATCH 047/425] Added spinner --- client/src/components/layout/Spinner.js | 2 +- client/src/components/layout/spinner.gif | Bin 0 -> 8942 bytes 2 files changed, 1 insertion(+), 1 deletion(-) create mode 100644 client/src/components/layout/spinner.gif diff --git a/client/src/components/layout/Spinner.js b/client/src/components/layout/Spinner.js index 83f4f37..b1c2666 100644 --- a/client/src/components/layout/Spinner.js +++ b/client/src/components/layout/Spinner.js @@ -6,7 +6,7 @@ const Spinner = () => ( Loading... ); diff --git a/client/src/components/layout/spinner.gif b/client/src/components/layout/spinner.gif new file mode 100644 index 0000000000000000000000000000000000000000..0424aa4ffda24a189ed8487dddd63626bceff0f8 GIT binary patch literal 8942 zcmcJU=T{T$+V*EAnG^_^KnMXTp{SsU*pVA0q>#`f(nSqQQ&B(>5D+I2AoMClTIfaT zD5$6bK>>vuMJb91h!iXKjt~1@?}z>D^{oBvo%sXinzfGWIDW@@a?H&Pcen!}0G6u* zfByXW`t|F(ckgCrXD22mhKGj-1_rvjyRTore(BPs+S=Ok^78!r{LIYE#Kc6QP#6{# zcJk!OqeqV(I&{d@)z!|<&ceci!C)8}8ExFSQCC-2LqkJJNr^}#;&3?N|No=$N7{yM zzlUkcV{g(oK!M9&)L0@hPk6cqdV0`;4+r|tIOf(oK;t_a#sV}z@1G+r|2u$Lq9guX zJ>`_1vJ<_&Mn!{Ffflu{^`jSq?!F1VIoS|mrJwird`oEm@oUc(+rn+?pS=6l9`X0P zpMMZRWRx&ECRP*|pOBc8oRXTBo{@PjD?2Cmd|rM*VUf7Fq_nKOqOz*G=EB9=y84F3 zrskGQms{JeT)ozQ{l-m6N9V1s?%Q{Idi(C)>mT@g@cx6LhmVFwM#mmM8GkzQY;tP) z`OJ&ix%q{cuU@}-`)=|5hmW5=fBE|D`;VW$elPt2P*N(~260CePJXRhPebvoSfZ9i zKDV)?JAu0S$aqg<>75i>0h($+qjT4TvN}9}$xQD$m}0r! zd5=_Dub@-|OLn#Z;&=t@6deSZ>Ht$=g3ngkWY19U?gVlw{qox3T8yvqcZ*Lrbd!fV zqJj(qgPOj#WX;eeHJ3~Z}Mh7vU?gy(gLEml82utr#ksNGHQ}mHrG8h#{QQEUo0XbQ(e8e(Q zTL{RwExJchd3=D?FOxMK%|nanuv&yj085M82D#fRJYjglgJ1#5kU>TwT=5HCfPSZr zz=N7LuR%VghVsm+bS3$L!#ma}O3zf!6`o!#IcK_+ zQhiS3ELt5}g;{a2*H#>crq7`&2VY4?UHg~54h*G7YObNn(ewfZ-F9WSaQDHfm1k9U#!<2y z<~bT>e|o*553hF3e94E!SA@0CcbrdcSz_UeLh3Xt}3=UmxkJ zo6vQ(;LP6aoAA@4*`yz&*XlP=kGbm^yqdf3B9?x$(utR)dXBrUP-ndoGamoQxwNh@ z2HgyEji(E^{?`<;w57rFQt;u$`=^;*1jNthGrAsp_>w^H+VH;Jfy6)|C%K!o`WK1% zC~Ersbh)%GfKn8?9C6z7w9#x;#F@{7@4D}^`N40$&xvF8 zf6SLe|`J&odmn#*J78V->>&Q zYwCY}xVQb?uaASA4ZlA}&uV#7LJ)=jB4>jHa+6 zHY&3epIi~fs$$io#bZmeT61r9bX{Sh+t1Lmgmlu{}D|=!4+SMc|w(eiFHW#!X4=$+xww!DKmpmVI89VE?A69twKm4Ev#_ON zf+TrJ`8!fpNs|`xTWGVs(Ro|=;vg6m1r6neTv7Vd8@1xw$jK@RzfIGd6Zkb6R0)|h zjldi+FootxySuGT$b&R8sLeOUVl{F5(F0u?8;e$YhwMH;^2SN%80u{6ek{d+HthPs zbiPkH?Qub>rvgZ!+>3*aUx1<3Wo2o2HDgY%z^{6A%V3;0(?CPbm8 zrI<%c9UE&kIIcn_VBp{or%;n{7IYSg6fzH3#fVanMDOG?X6f0C_;VPvV~%Ye8(ox9 zn#RmP6=6^%HP+=9i_rNsF^ud>U|ms^D}+K>)v z-K9~J54Ojy=&pXX{T0_ZkwDSLMRN{j#ZVQ>UP9G(fmot-Q10bbre@JX*O=2g(zTY< z&bv7Vsl>Ca8%wzfN$FQSWW|Sa(5xJbOE2wl1X*B}5i4?}o_~|Um1Mq3Y4Ew8yngS@ z#NRDG>a=#JdjLQjrPy6U>IUql3@(mn@bSLEk(0Wc-}_C8HI z+#sVB{E&gbn9f)b;t~+L?aPMZOqQ^mN>f0b*Jp!8pIjYUsQn%6qY zU@j~p-7a{bbL2_llGIRX8-De*0+8{=x_<9aQ1kC3ldrGNx*lbOhM7d~hmXZDqV@~I zM7Gh%DG6-ooGS|8fGBac#Yqm38jFU{^UTdq)fgCEYg_3SZw56uW11~5n6$8NSXBt? z;P&<|PPIigy2L6Vp{Tdd*{72Q4BHgAPF@`yyFY0OK&bO&`vOM#nxH2`SI>WP02bRH z&p8xD`|c(Y{pi5isrKLW9(J;EjN1be@!JOFU7N74JUqJI+i+H48SyHoX^zT=)nf^K zNmIFHmb4sTxnri>ItQcw;8(!V>{4WYQjna>ShJ_q#)XFh*S;;8s-Sl1?M-W1Y6fb2 zwND@R2i7U#iPS-tkpXKE@3YF7H)+Fl*$%3du~&948m?tcEY%jX`PV8?GUQ=c&v>6rXg-L zLCL_LZ>hb^UJ(m7WH;ya(xfY_6Euh*>Nr6zk$N1^U^tJOWJ%H7gc(GF+OF`?hSjF< zoRa<)ovo8}2#wK1<^1u(g}k3BH*Q|0`)6;UkVF`4nNTWEa5xbhj#s;46#EGMV?`yZH4UcXfsT5a;(4_9U79z%uK=f zGU6CeVYUk^p%6?f@v4ccwob@0DNH~(V2f2+E9*Q4jl`jfSs`e2KD){U4PEWC_NYn- zOEGDP9~m~eI>zcZL%FiY8M*E79VQB}J!N({({0KuwgsNB1oENYX`5d$&)bkgC;ax8 zoIE!3My_eVVpnwH(&x0{3jWHtgQL#AkIJW3rKm9De`)dQjTt(&CGscNmfr>MHQ|oJ zNVYWxw=p^K)R5a!=DEL4e+d^F_|z7&vbPFn%DVf-5r;BCVsL z*I{Lk%pr`l92w{1sot~$MeSiH(6rc>9Vqt-E=(fZ*4;E*J$TLOcw}zTZF*IjrVNzkccQQ`52)I5T*@$f^eNc+ z{5Zq4H93_(F?sz`H?a-*5fw}5j`qko?tT}+cCPXX@}_r0zQZ9me!dzojeV*fy0^(- zC-W2l5Is^Fl;c43^}cO=gX6d0zfBrAPn96U)Tby>G>ML$dvn_q)q#T?uTr>;lxj0C!1D`**LdWaG|YAP(>9PRFQ*41%IPm$6>kWe8sp&wWIqDMs0O zaGJzb?odL@>J550Vz)>DXaCDif;F)!4T%m+K3@kG9(3=3DfHAT1+4QodSFUP002ep zm-}B7duW+q|N1wI?fNI~}ARBZZGo5?oNW~>q;LVUb@rb*ilnHeE7FqT(yGKecp$0iux!{lh zd}@Y)6CZO61J76k&~x(|&MWhapKTV7yqFN>Nf808?ZnNkfGj56$@bp$4KM7+9&mQ| zh~uf7PgppMOF1dN`M-0%+Gu6OuFhj=WR5Xl?SC5U=HafL&AcG!W z_6aOOR?1@|&lIvSmL_<_DGoK$yG_;x8is9W3Q@5%eviMP<0^=!8t{19i1CxFb)h+R z?u7>7 za8nT)=f6e)Qa}#f4C^e>KzAcL(;_&>IcXQk-&qj7!6JusVrC;J4U&o;}J5xUmjq6hj=mrL37iTN{*x6F`{Nfqh4-I8<}j{GCu z*LwXf>9HWrDcIYB6>b9UIV%#x+lGolg@VILtTc8?;yDhOzz8+Tbtx&}M0n)HGOH_X zPFR;|sU9jO=eB9lnra@^>~201Z5Oysek)$n9{2_qr^fsw^2d87$tr$9ge}~7 z4Q7n=$H&(-8|aZ{*OUzC>_ab=$qgjEhj3zXCkj3H?LEtqB@tj1C{Mci8j+E^{_fk> zg;mTG;LdJ8ARf$;LSgq+lLt2wCq~e@+qVZ1Ikjj!Z-y#z>hbkGfS*4R1Grd4J-fLw zgv9egC{wp&&>6qb5&@39mditQ=+5)R7!|&x5L~$xZVFCwc#r(9ht=pQ4fHc%U%fjr z_ko#DH6;*<{uLm-y40GW`9X%C#RRD0XMQAY$>iB<>IJkUD*Yu z(DyHUL)lw;CiHI*7ByUiJLm_Gt{I@lBDWfyDG>ffh%gbD0H^$EK@bA5KLl&Xn(?>0 z?e|;-n4(EJKIrr7UF;ell$=BL$wF`rTp@)Cjo7{i< zA?>J6Vw|tLo0>jO2JH~S3Jc#GvHP@1v`J))t+z1QLdXWhn4I`Twjj5dmB%RB z9aPGO@(QAk@#-&BAF66$cw?LQlw>w~1e?Kf$}1_-ohIhCtr<5saD^FexeltS$YV3o z?DpSd^>K2TII61pOEqN@CL?cfHzvvX1p`YNd8w|ZswBhf%_y0h#zFF05=Fcu= z06of}Mmu`J> zsd;Wqwqt;-7SMshUoiB79@8Sx4^!s9Dak}jAYA>)TfZO)nO4iKC>$tw0>1IOe?$8e z-8dMH!6LC!y08vvq+iRB%U|^>!{~F*K0o~_0i>y}NHj~?{Or_TUr?K&_xRJSAOU&!2?e=@e(J>^$GHz3X^ZG1wyy zY4d3j`+RZHfu3l-B+j}#$1x05y9t5Ts3EcO&uT}e!8L`g&lAhS+Z2E=Pg{{>W{CrL z9dq&Exj4-1$c*UHxMy*?fsCY7Z&$=_Nfsg8Q<%+iJ#km(&_pGm<70FC<0l5gb!Jvaz#ZZVK~?F zxGjdH&zJavk)Rg5R(K7WzbihlPy>*2G*B^8GWsyTK}s$rinj?QN>a>09C@8Aiz$={ zWmkqI1vL9|yVM~$bQf>;izOJ3%S7`4)4e7dTaNC~9Yh!w=O}7{?ws!Ppq_n_N(j%L z|MxkXKuO2H*&M=ALcU}IugL;fUT43~wer2gx*%c8bqO-u0R}hYMlD(`rY?)**U6gE zm#+^|)3T6IJd*>$n~qMnY0shXVrGJ@s^MLCXGoO1UnX>;Qhtp~O3*R6M<8Z}=KMte z-qzhim`G{$h=z((R8Ph_lf`TC$lPEllf%Adls+_^0#FfJ(q6vS3O&AruU7iNeprD= zzp*oDbyl;R`QVLRTMhe*eBbTAc|EdWOkra>`26!7WV!4p0)T&JG#nKo@}7ingro#>IT$WiKWKlA5z(^G$uNCO@9q(2ZHEUkyoP8G!IsO$*Y z86dxEjV2pNEcN-ipB&b1sIp1dOL5vidxn#j(UJDZ65)O`Jm~FqB)H6GpL<6V7tF_qFftblDX9W@lDo${Vdf$4o=N^HB=Be*5N27WoF&&UMDt)-l>;`vb5815 zmpN5NsQyfumag#g9vnZdIs7H7>VRM6sXJd6pS^oK@q2b#W^I6%%;l>-2G?NGRw)ZA zj2zgd0#{9hyL#C3cl~Jeri0il!Pp8f2OMl;(Zv0BH`+rxGUu!GO-bbffPXqg51&{q~7VtOS$S52XXrSa#EF zOMaUY2j%N%yDg9SHD6wHVw9DgG1z@?$H7g^qGZ18{n=o@32qXy+YYtr%+{@2=L$zW z18qrXhpYFb8!hOAiftzdJyIj^PtF zOpui&*x~|%Ld+l;3RRJWMc9}XBsr2SWF|Tl%vlckGUb>|CWa_?k%R*p8VlpiP$X3~ zbu|^KDkfU?;>8swSj}Pr9tKEQ z*{?>)pJw7NbP~>*jIl73cPjW<1$UZW1{k`~f)9~&Z#E;UOhBi19okh$xroO8trMVKee7QD>7;p9~93P*ap&uAPc4c2b zg6W8CiSKu&tP#_nBbjS2RCGD1xb*rW*?5{;$$PCXnBY9n{{6$WN4}+^!Q*vY)M)e3 zJF-u|^@H%`ggX&#mcZik?(FOnvS&iy2u7IIJNR+Ge|~|7@1&ePed;?Wa`iJT*nWyYc?PnB%^!194{KJu!gA)#4E$i(ajI&g#V> z&!9ba3-^h8(>Yzhla1za(L2qqjKtarzpu*L-8QBTK2g0=n4jpJL!()D2cQe>H+fec z@f+TR6a;sU#eh53KGxn6X5@-K)zvTmPsakW!2h`+00kfZ)v^ALVhCvT`q9_*pum{& zxFH9ZmZSdslfQ%l58Hgv6NCd}l7A(EI^}>a*1H7Wy z7&%2n3K^fAl9n!=lr1!aWEH9P6kI7wDm@(!n&q5i12{5ONr_5sX5lWUW3JY)P{fW- zMgDE(rOQ%KbuJsPaGxsoh=nar$7Y#aJ8uG$CL5o#@V(NJ%vVg1K$(2~93bpYb{RKz&)E|(kYO$|-odL?}sQ`xoMoeqK^U$6_NiWcTK$@s? z-phXoLot+CzZNi~eR(#s@J~A{q{d19PWfHQJNb;%=o8%#xY1iiRw{GggJJ!)ttpOPNN;R5Z=N)$2M$I;=SgY6NCP#H}ef_np?Xv3eXAS@A|Mt-;$v$wI_fLIB zci#9q;Jxe2#=3Va8*M$t{sw=^+%GgvB2*OxW7KfbYPVdYeRJB9MEPPGns+sp`?c; z+Jm3UPPS?nmdVq%O*x5Jayt}2I)?v(YFl@obJ{61dlh%2wo06qQnht9((~oXr%8wP zTxN)NeYm-}BizGX*#m7ZGI=4}I`&0{&f+U$R=tUv6~}DZkr0cT_nABU_0;JK;}bSU O7>g_~XKNzx*Z%+t`<_t% literal 0 HcmV?d00001 From 41d00c2125fb6ec99cb4577c09addfe370c28907 Mon Sep 17 00:00:00 2001 From: James Quinn Date: Sun, 21 Jul 2019 20:07:41 +0200 Subject: [PATCH 048/425] Added web3 --- client/src/context/types.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/client/src/context/types.js b/client/src/context/types.js index cac820c..1baa108 100644 --- a/client/src/context/types.js +++ b/client/src/context/types.js @@ -9,8 +9,11 @@ export const SET_CURRENT_ITEM = "SET_CURRENT_ITEM"; export const CLEAR_CURRENT_ITEM = "CLEAR_CURRENT_ITEM"; // User -export const SET_WEB3 = "SET_WEB3"; export const SET_USER = "SET_USER"; export const SET_TRADE_PARTNER = "SET_TRADE_PARTNER"; export const CLEAR_USER = "CLEAR_USER"; export const CLEAR_TRADE_PARTNER = "CLEAR_TRADE_PARTNER"; + +// Web3 +export const CONNECT_WEB3 = "CONNECT_WEB3"; +export const UPDATE_WEB3 = "UPDATE_WEB3"; \ No newline at end of file From 29a6091124d6ba59ffee82a0b71aa00bd97b9c42 Mon Sep 17 00:00:00 2001 From: James Quinn Date: Sun, 21 Jul 2019 20:08:16 +0200 Subject: [PATCH 049/425] Added loading --- client/src/context/web3/Web3State.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/client/src/context/web3/Web3State.js b/client/src/context/web3/Web3State.js index b66147f..3215bc3 100644 --- a/client/src/context/web3/Web3State.js +++ b/client/src/context/web3/Web3State.js @@ -3,12 +3,16 @@ import React, { useReducer } from "react"; import Web3Context from "./Web3Context"; import Web3Reducer from "./Web3Reducer"; -import { CONNECT_WEB3, UPDATE_WEB3 } from "../types"; +import { + CONNECT_WEB3, + UPDATE_WEB3 +} from "../types"; const Web3State = props => { const initialState = { connected: false, - network: null + network: null, + loading: false }; const [state, dispatch] = useReducer(Web3Reducer, initialState); @@ -28,7 +32,7 @@ const Web3State = props => { type: UPDATE_WEB3 }); }; - +/* const getERC20Token = (tokenAddress, userAddress) => { dispatch({ type: GET_ERC20, @@ -49,12 +53,13 @@ const Web3State = props => { payload: { id, userAddress } }); }; - +*/ return ( { ); }; + export default Web3State; From 5845c20b64cb6804454da4bbcbffb20ed48948f6 Mon Sep 17 00:00:00 2001 From: James Quinn Date: Sun, 21 Jul 2019 20:08:45 +0200 Subject: [PATCH 050/425] Removed web3 --- client/src/context/user/UserState.js | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/client/src/context/user/UserState.js b/client/src/context/user/UserState.js index c07696c..2470902 100644 --- a/client/src/context/user/UserState.js +++ b/client/src/context/user/UserState.js @@ -4,7 +4,6 @@ import UserContext from "./UserContext"; import UserReducer from "./UserReducer"; import { - SET_WEB3, SET_USER, SET_TRADE_PARTNER, CLEAR_USER, @@ -39,10 +38,6 @@ const UserState = props => { erc721Tokens: [] } }, - web3: { - connected: false, - network: null - }, settings: { nickname: null } @@ -54,13 +49,6 @@ const UserState = props => { * Actions */ - const setWeb3 = web3 => { - dispatch({ - type: SET_WEB3, - payload: web3 - }); - }; - const setUser = user => { dispatch({ type: SET_USER, @@ -90,11 +78,9 @@ const UserState = props => { return ( { ); }; + export default UserState; From 0b0157b99d9f02fd07185cbf61ab98b2ab5cca1e Mon Sep 17 00:00:00 2001 From: James Quinn Date: Mon, 22 Jul 2019 12:10:35 +0200 Subject: [PATCH 051/425] Added web3 and ens state --- client/src/App.js | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/client/src/App.js b/client/src/App.js index 367ad30..1e2fab8 100644 --- a/client/src/App.js +++ b/client/src/App.js @@ -14,6 +14,8 @@ import NotFound from "./components/pages/NotFound"; import AlertState from "./context/alert/AlertState"; import TradeState from "./context/trade/TradeState"; import UserState from "./context/user/UserState"; +import Web3State from "./context/web3/Web3State"; +import EnsState from "./context/ens/EnsState"; import setAuthToken from "./utils/setAuthToken.js"; @@ -27,20 +29,24 @@ const App = () => ( - - - - -
        - - - - - - -
        -
        -
        + + + + + + +
        + + + + + + +
        +
        +
        +
        +
        From 79a663c5aef50f531573de7d6cdd1d5b297b5682 Mon Sep 17 00:00:00 2001 From: James Quinn Date: Mon, 22 Jul 2019 12:13:55 +0200 Subject: [PATCH 052/425] Switched to web3 context --- client/src/components/layout/Navbar.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/client/src/components/layout/Navbar.js b/client/src/components/layout/Navbar.js index 8491fab..70df49c 100644 --- a/client/src/components/layout/Navbar.js +++ b/client/src/components/layout/Navbar.js @@ -5,11 +5,12 @@ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import PropTypes from "prop-types"; import UserContext from "../../context/user/UserContext"; +import Web3Context from "../../context/web3/Web3Context"; const Navbar = ({ title, icon }) => { - const userContext = useContext(UserContext); - - const { connected, network } = userContext.web3; + const web3Context = useContext(Web3Context); + + const { connected, network } = web3Context; const networkText = () => { switch (network) { From f521e096996a3fe056919160333d112579fbb011 Mon Sep 17 00:00:00 2001 From: James Quinn Date: Mon, 22 Jul 2019 12:15:11 +0200 Subject: [PATCH 053/425] Connected web3 context --- client/src/components/layout/Sidebar.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/client/src/components/layout/Sidebar.js b/client/src/components/layout/Sidebar.js index 4cf4a66..12a5a24 100644 --- a/client/src/components/layout/Sidebar.js +++ b/client/src/components/layout/Sidebar.js @@ -1,12 +1,15 @@ import React, { useContext } from "react"; import UserContext from "../../context/user/UserContext"; +import Web3Context from "../../context/web3/Web3Context"; +import Spinner from "./Spinner"; const Sidebar = () => { const userContext = useContext(UserContext); + const web3Context = useContext(Web3Context); - const { settings, user, web3 } = userContext; - const { connected, loading } = web3; + const { settings, user } = userContext; + const { connected, loading } = web3Context; const tokens = () => (
          From 0dedd516ab7a1ecba792220676e5b1c0b6a711b1 Mon Sep 17 00:00:00 2001 From: James Quinn Date: Mon, 22 Jul 2019 12:15:26 +0200 Subject: [PATCH 054/425] Added types --- client/src/context/types.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/client/src/context/types.js b/client/src/context/types.js index 1baa108..ecfc681 100644 --- a/client/src/context/types.js +++ b/client/src/context/types.js @@ -16,4 +16,11 @@ export const CLEAR_TRADE_PARTNER = "CLEAR_TRADE_PARTNER"; // Web3 export const CONNECT_WEB3 = "CONNECT_WEB3"; -export const UPDATE_WEB3 = "UPDATE_WEB3"; \ No newline at end of file +export const UPDATE_WEB3 = "UPDATE_WEB3"; +export const ADD_CONTRACT_OBJECT = "ADD_CONTRACT_OBJECT"; +export const REMOVE_CONTRACT_OBJECT = "REMOVE_CONTRACT_OBJECT"; +export const CONTRACT_OBJECT_ERROR = "CONTRACT_OBJECT_ERROR"; + +// Ens + +export const SET_UTIL_CONTRACT = "SET_UTIL_CONTRACT"; \ No newline at end of file From 56bc892758ef673d22a3395931234f70f47c5a03 Mon Sep 17 00:00:00 2001 From: James Quinn Date: Mon, 22 Jul 2019 12:16:46 +0200 Subject: [PATCH 055/425] Added utilContrct to state --- client/src/context/ens/EnsState.js | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/client/src/context/ens/EnsState.js b/client/src/context/ens/EnsState.js index b9f57f7..b2e415d 100644 --- a/client/src/context/ens/EnsState.js +++ b/client/src/context/ens/EnsState.js @@ -1,12 +1,14 @@ import React, { useReducer } from "react"; - +import uuid from "uuid"; import EnsContext from "./EnsContext"; import EnsReducer from "./EnsReducer"; -import {} from "../types"; +import { SET_UTIL_CONTRACT } from "../types"; const EnsState = props => { - const initialState = {}; + const initialState = { + utilContract: null + }; const [state, dispatch] = useReducer(EnsReducer, initialState); @@ -14,8 +16,23 @@ const EnsState = props => { * Actions */ + const setUtilContract = (address) => { + dispatch({ + type: SET_UTIL_CONTRACT, + payload: { address } + }); + } + //Get erc721 id out of name => namehash => id - return {props.children}; + return ( + + {props.children} + + ) }; + export default EnsState; From 0735f8d98a6cb86a03dcaa1e5b33e735891dd237 Mon Sep 17 00:00:00 2001 From: James Quinn Date: Mon, 22 Jul 2019 12:17:15 +0200 Subject: [PATCH 056/425] Added methods --- client/src/context/web3/Web3State.js | 75 ++++++++++++++++++++++++++-- 1 file changed, 72 insertions(+), 3 deletions(-) diff --git a/client/src/context/web3/Web3State.js b/client/src/context/web3/Web3State.js index 3215bc3..342c3e1 100644 --- a/client/src/context/web3/Web3State.js +++ b/client/src/context/web3/Web3State.js @@ -1,18 +1,45 @@ -import React, { useReducer } from "react"; +import React, { useReducer, useContext } from "react"; +import uuid from "uuid"; import Web3Context from "./Web3Context"; import Web3Reducer from "./Web3Reducer"; +import AlertContext from "../alert/AlertContext"; + +import abi from "../../abis/abi"; +import abiErc20 from "../../abis/abiErc20"; +import abiErc721 from "../../abis/abiErc721"; import { CONNECT_WEB3, - UPDATE_WEB3 + UPDATE_WEB3, + ADD_CONTRACT_OBJECT, + REMOVE_CONTRACT_OBJECT, + CONTRACT_OBJECT_ERROR } from "../types"; const Web3State = props => { + const alertContext = useContext(AlertContext); + + const { setAlert } = alertContext; + const initialState = { + web3: null, connected: false, network: null, - loading: false + loading: false, + contractObjs: [], + activeCalls: [/*{ + id: uuid.v4(), + type: "USER_BALANCE", + date: Date.now() + }*/], + activeTxs: [/*{ + id: txHash, + type: "PUSH_TRADE", + nonce: 5, + date: Date.now() + }*/], + errors: [] }; const [state, dispatch] = useReducer(Web3Reducer, initialState); @@ -32,6 +59,47 @@ const Web3State = props => { type: UPDATE_WEB3 }); }; + + const addContractObj = async(address, abiName) => { + const abi = await getAbi(abiName); + + if(!abi){ + setAlert(`Failed get abi ${abiName}`, "danger"); + return; + } + + try{ + //Create contract obj + + dispatch({ + type: ADD_CONTRACT_OBJECT, + payload: {address, abi} + }); + }catch{ + dispatch({ + type: CONTRACT_OBJECT_ERROR, + }); + } + } + + const getAbi = async abiName => { + switch(abiName){ + case "ARCA": + return abi; + case "erc20": + return abiErc20; + case "erc721": + return abiErc721; + default: + return null; + } + } + + const dismissError = id => { + + } + + /* const getERC20Token = (tokenAddress, userAddress) => { dispatch({ @@ -57,6 +125,7 @@ const Web3State = props => { return ( Date: Mon, 22 Jul 2019 14:25:18 +0200 Subject: [PATCH 057/425] Removed id --- .../components/tradeBox/itemTypes/EnsForm.js | 39 ++++++++++--------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/client/src/components/tradeBox/itemTypes/EnsForm.js b/client/src/components/tradeBox/itemTypes/EnsForm.js index 3c3eb3a..9cc396c 100644 --- a/client/src/components/tradeBox/itemTypes/EnsForm.js +++ b/client/src/components/tradeBox/itemTypes/EnsForm.js @@ -1,15 +1,19 @@ import React, { useState, useEffect } from "react"; import PropTypes from "prop-types"; -const EnsForm = id => { - const [item, setItem] = useState({ +import EnsContext from "../../../context/ens/EnsContext"; + +const EnsForm = item => { + const ensContext = useContext(EnsContext); + + const [ensItem, setEnsItem] = useState({ name: "", namehash: "", - id: id, + id: item.id, verified: false }); - const { name, namehash, id, verified } = item; + const { name, namehash, id, verified } = ensItem; useEffect(() => { //eslint-disable-next-line @@ -17,31 +21,28 @@ const EnsForm = id => { //Input const onChange = e => { - setItem({ ...item, [e.target.name]: e.target.value }); + setEnsItem({ ...ensItem, [e.target.name]: e.target.value }); //name => namehash => id //if ids match then verify }; //Render return ( -
          -
          -

          ID:{id}

          - - {verified && "ICON"} -
          -
          +
          + + {verified && "ICON"} +
          ); }; EnsForm.propTypes = { - id: PropTypes.string.isRequired + item: PropTypes.object.isRequired }; export default EnsForm; From 92ccfae015d0da875bda1ae5a1d620921dbcfbc1 Mon Sep 17 00:00:00 2001 From: Flash Date: Mon, 22 Jul 2019 14:25:27 +0200 Subject: [PATCH 058/425] Added item types --- client/src/components/tradeBox/itemTypes/Erc20.js | 12 ++++++++++++ client/src/components/tradeBox/itemTypes/Erc721.js | 12 ++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 client/src/components/tradeBox/itemTypes/Erc20.js create mode 100644 client/src/components/tradeBox/itemTypes/Erc721.js diff --git a/client/src/components/tradeBox/itemTypes/Erc20.js b/client/src/components/tradeBox/itemTypes/Erc20.js new file mode 100644 index 0000000..5654e7d --- /dev/null +++ b/client/src/components/tradeBox/itemTypes/Erc20.js @@ -0,0 +1,12 @@ +import React from "react"; +import PropTypes from "prop-types"; + +const Erc20 = item => { + return
          ERC20
          ; +}; + +Erc20.propTypes = { + item: PropTypes.object.isRequired +}; + +export default Erc20; diff --git a/client/src/components/tradeBox/itemTypes/Erc721.js b/client/src/components/tradeBox/itemTypes/Erc721.js new file mode 100644 index 0000000..b4e17cb --- /dev/null +++ b/client/src/components/tradeBox/itemTypes/Erc721.js @@ -0,0 +1,12 @@ +import React from "react"; +import PropTypes from "prop-types"; + +const Erc721 = item => { + return
          ERC721
          ; +}; + +Erc721.propTypes = { + item: PropTypes.object.isRequired +}; + +export default Erc721; From 3c6a0ea1fb99e0f9801f18eb3eda6a61edece1b7 Mon Sep 17 00:00:00 2001 From: Flash Date: Mon, 22 Jul 2019 14:25:36 +0200 Subject: [PATCH 059/425] Added trade item --- client/src/components/tradeBox/Item.js | 29 ++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/client/src/components/tradeBox/Item.js b/client/src/components/tradeBox/Item.js index e69de29..b9052f9 100644 --- a/client/src/components/tradeBox/Item.js +++ b/client/src/components/tradeBox/Item.js @@ -0,0 +1,29 @@ +import React from "react"; + +import Erc20 from "./itemTypes/Erc20"; +import Erc721 from "./itemTypes/Erc721"; +import EnsForm from "./itemTypes/EnsForm"; + +const Item = item => { + const { id, type } = item; + + const internal = () => { + switch (type) { + case "erc20": + return ; + case "erc721": + return ; + case "ens": + return ; + default: + return ""; + } + }; + + return ( +
          +

          ID:{id}

          + {internal} +
          + ); +}; From 52071263b984ad1fae2513d531ea92d01ef0e4bf Mon Sep 17 00:00:00 2001 From: Flash Date: Mon, 22 Jul 2019 15:52:30 +0200 Subject: [PATCH 060/425] Renamed item --- client/src/components/tradeBox/Item.js | 29 ---------------------- client/src/components/tradeBox/Items.js | 33 +++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 29 deletions(-) delete mode 100644 client/src/components/tradeBox/Item.js create mode 100644 client/src/components/tradeBox/Items.js diff --git a/client/src/components/tradeBox/Item.js b/client/src/components/tradeBox/Item.js deleted file mode 100644 index b9052f9..0000000 --- a/client/src/components/tradeBox/Item.js +++ /dev/null @@ -1,29 +0,0 @@ -import React from "react"; - -import Erc20 from "./itemTypes/Erc20"; -import Erc721 from "./itemTypes/Erc721"; -import EnsForm from "./itemTypes/EnsForm"; - -const Item = item => { - const { id, type } = item; - - const internal = () => { - switch (type) { - case "erc20": - return ; - case "erc721": - return ; - case "ens": - return ; - default: - return ""; - } - }; - - return ( -
          -

          ID:{id}

          - {internal} -
          - ); -}; diff --git a/client/src/components/tradeBox/Items.js b/client/src/components/tradeBox/Items.js new file mode 100644 index 0000000..a834f46 --- /dev/null +++ b/client/src/components/tradeBox/Items.js @@ -0,0 +1,33 @@ +import React, { useContext, useEffect } from "react"; + +import Erc20 from "./itemTypes/Erc20"; +import Erc721 from "./itemTypes/Erc721"; +import EnsForm from "./itemTypes/EnsForm"; +import TradeContext from "../../context/trade/TradeContext"; + +const Items = () => { + const tradeContext = useContext(TradeContext); + + const internal = item => { + switch (type) { + case "erc20": + return ; + case "erc721": + return ; + case "ens": + return ; + default: + return ""; + } + }; + + return ( + tradeContext.tradeItems.length > 0 && + tradeContext.tradeItems.map(item => ( +
          +

          ID:{id}

          + {internal} +
          + )) + ); +}; From e5cf7dcb6946ffa24fcdde28836c5c6d84f89ef9 Mon Sep 17 00:00:00 2001 From: Flash Date: Mon, 22 Jul 2019 18:53:14 +0200 Subject: [PATCH 061/425] Added user box --- client/src/components/pages/Home.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/client/src/components/pages/Home.js b/client/src/components/pages/Home.js index 0758c13..776c781 100644 --- a/client/src/components/pages/Home.js +++ b/client/src/components/pages/Home.js @@ -1,15 +1,23 @@ -import React, { useEffect } from "react"; +import React, { useEffect, useContext, Fragment } from "react"; -import TradeBox from "../tradeBox/Box"; +import Box from "../tradeBox/Box"; +import UserContext from "./../../context/user/UserContext"; +import TradeContext from "./../../context/trade/TradeContext"; const Home = () => { + const userContext = useContext(UserContext); + const tradeContext = useContext(TradeContext); + + const { userBox } = tradeContext; + useEffect(() => { //eslint-disable-next-line }, []); return (
          - + {userBox === 0 ? : } + {userBox === 1 ? : }
          ); }; From 979bc6cfdd62c69eebb69d0632cbc84b101b7c75 Mon Sep 17 00:00:00 2001 From: Flash Date: Mon, 22 Jul 2019 18:53:21 +0200 Subject: [PATCH 062/425] Added user box --- client/src/components/tradeBox/Box.js | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/client/src/components/tradeBox/Box.js b/client/src/components/tradeBox/Box.js index 7b123f8..ed4e3c0 100644 --- a/client/src/components/tradeBox/Box.js +++ b/client/src/components/tradeBox/Box.js @@ -1,7 +1,24 @@ import React from "react"; +import PropTypes from "prop-types"; -const Box = () => { - return
          Box
          ; +import ItemForm from "./ItemForm"; +import Items from "./Items"; + +const Box = ({ user }) => { + return ( +
          + + {user && } +
          + ); +}; + +Box.defaultProps = { + user: false +}; + +Box.propTypes = { + user: PropTypes.bool.isRequired }; export default Box; From d46bb08930912a2f6bc6ab3de4bfe8cd581b5025 Mon Sep 17 00:00:00 2001 From: Flash Date: Mon, 22 Jul 2019 18:53:31 +0200 Subject: [PATCH 063/425] Added item form --- client/src/components/tradeBox/ItemForm.js | 62 ++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 client/src/components/tradeBox/ItemForm.js diff --git a/client/src/components/tradeBox/ItemForm.js b/client/src/components/tradeBox/ItemForm.js new file mode 100644 index 0000000..c092e52 --- /dev/null +++ b/client/src/components/tradeBox/ItemForm.js @@ -0,0 +1,62 @@ +import React, { useContext, useState } from "react"; + +import TradeContext from "../../context/trade/TradeContext"; + +const ItemForm = () => { + const tradeContext = useContext(TradeContext); + + const { addTradeItem } = tradeContext; + + const [item, setItem] = useState({ + contractAdd: "", + type: "", + id: "" //id/amount + }); + + const { contractAdd, type, id } = item; + + //Input + const onChange = e => { + setItem({ ...item, [e.target.name]: e.target.value }); + }; + + const onSubmit = e => { + e.preventDefault(); + addTradeItem(item); + }; + + //Render + return ( +
          + + + + +
          + ); +}; + +export default ItemForm; From 6a126256c6df5b31562217a247f2d1de59edbe31 Mon Sep 17 00:00:00 2001 From: Flash Date: Mon, 22 Jul 2019 18:53:40 +0200 Subject: [PATCH 064/425] Added user box --- client/src/components/tradeBox/Items.js | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/client/src/components/tradeBox/Items.js b/client/src/components/tradeBox/Items.js index a834f46..be88e26 100644 --- a/client/src/components/tradeBox/Items.js +++ b/client/src/components/tradeBox/Items.js @@ -1,15 +1,21 @@ import React, { useContext, useEffect } from "react"; +import PropTypes from "prop-types"; + import Erc20 from "./itemTypes/Erc20"; import Erc721 from "./itemTypes/Erc721"; import EnsForm from "./itemTypes/EnsForm"; import TradeContext from "../../context/trade/TradeContext"; -const Items = () => { +const Items = ({ user }) => { const tradeContext = useContext(TradeContext); + const items = user + ? tradeContext.user.tradeItems + : tradeContext.tradePartner.tradeItems; + const internal = item => { - switch (type) { + switch (item.type) { case "erc20": return ; case "erc721": @@ -22,12 +28,18 @@ const Items = () => { }; return ( - tradeContext.tradeItems.length > 0 && - tradeContext.tradeItems.map(item => ( + items.length > 0 && + items.map(item => (
          -

          ID:{id}

          - {internal} +

          ID:{item.id}

          + {internal(item)}
          )) ); }; + +Items.propTypes = { + user: PropTypes.bool.isRequired +}; + +export default Items; From 3840d6d1593f48fcdbd87e7701c13aa1e3e7c2a4 Mon Sep 17 00:00:00 2001 From: Flash Date: Mon, 22 Jul 2019 18:55:14 +0200 Subject: [PATCH 065/425] Added dependency --- client/src/components/tradeBox/itemTypes/EnsForm.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/src/components/tradeBox/itemTypes/EnsForm.js b/client/src/components/tradeBox/itemTypes/EnsForm.js index 9cc396c..a3a772f 100644 --- a/client/src/components/tradeBox/itemTypes/EnsForm.js +++ b/client/src/components/tradeBox/itemTypes/EnsForm.js @@ -1,4 +1,4 @@ -import React, { useState, useEffect } from "react"; +import React, { useState, useEffect, useContext } from "react"; import PropTypes from "prop-types"; import EnsContext from "../../../context/ens/EnsContext"; From 3429fdf3f099a022c6952d0d85fe93d02c08645b Mon Sep 17 00:00:00 2001 From: Flash Date: Mon, 22 Jul 2019 18:55:24 +0200 Subject: [PATCH 066/425] Added user box --- client/src/context/types.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/client/src/context/types.js b/client/src/context/types.js index ecfc681..e23bd0d 100644 --- a/client/src/context/types.js +++ b/client/src/context/types.js @@ -3,6 +3,7 @@ export const SET_ALERT = "SET_ALERT"; export const REMOVE_ALERT = "REMOVE_ALERT"; // Trade Items +export const SET_USER_BOX = "SET_USER_BOX"; export const ADD_TRADE_ITEM = "ADD_TRADE_ITEM"; export const REMOVE_TRADE_ITEM = "REMOVE_TRADE_ITEM"; export const SET_CURRENT_ITEM = "SET_CURRENT_ITEM"; @@ -23,4 +24,4 @@ export const CONTRACT_OBJECT_ERROR = "CONTRACT_OBJECT_ERROR"; // Ens -export const SET_UTIL_CONTRACT = "SET_UTIL_CONTRACT"; \ No newline at end of file +export const SET_UTIL_CONTRACT = "SET_UTIL_CONTRACT"; From 4dc3a1da88d90d9112d336584f2eed237c9022bb Mon Sep 17 00:00:00 2001 From: Flash Date: Mon, 22 Jul 2019 18:55:42 +0200 Subject: [PATCH 067/425] Added user box and outlines --- client/src/context/trade/TradeState.js | 43 +++++++++++++++++++++++--- 1 file changed, 38 insertions(+), 5 deletions(-) diff --git a/client/src/context/trade/TradeState.js b/client/src/context/trade/TradeState.js index b32e3d9..47981db 100644 --- a/client/src/context/trade/TradeState.js +++ b/client/src/context/trade/TradeState.js @@ -4,6 +4,7 @@ import TradeContext from "./TradeContext"; import TradeReducer from "./TradeReducer"; import { + SET_USER_BOX, ADD_TRADE_ITEM, REMOVE_TRADE_ITEM, SET_CURRENT_ITEM, @@ -12,7 +13,20 @@ import { const TradeState = props => { const initialState = { - tradeItems: [], + userBox: null, + user: { + tradeItems: [ + /*{ + sent: UNSENT/UNCONFIRMED/CONFIRMED, + txHash: null/"", + type: erc20/erc721/ens, + data: {} + }*/ + ] + }, + tradePartner: { + tradeItems: [] + }, currentItem: null }; @@ -22,6 +36,21 @@ const TradeState = props => { * Actions */ + const setUserBox = id => { + dispatch({ + type: SET_USER_BOX, + payload: id + }); + }; + + const getTradeItems = () => { + //get user trade items from db + //get partner trade items from db + //get user items from contract + //get partner items from contract + //dispatch trade items to reducer + }; + const addTradeItem = tradeItem => { dispatch({ type: ADD_TRADE_ITEM, @@ -29,7 +58,10 @@ const TradeState = props => { }); }; - const removeTradeItem = id => { + const cancelTradeItem = id => { + //cancel trade item on contract + //remove trade item on db + dispatch({ type: REMOVE_TRADE_ITEM, payload: id @@ -52,10 +84,11 @@ const TradeState = props => { return ( Date: Tue, 23 Jul 2019 00:49:16 +0200 Subject: [PATCH 068/425] Added app context --- client/src/context/app/AppContext.js | 5 +++ client/src/context/app/AppReducer.js | 10 ++++++ client/src/context/app/AppState.js | 46 ++++++++++++++++++++++++++++ 3 files changed, 61 insertions(+) create mode 100644 client/src/context/app/AppContext.js create mode 100644 client/src/context/app/AppReducer.js create mode 100644 client/src/context/app/AppState.js diff --git a/client/src/context/app/AppContext.js b/client/src/context/app/AppContext.js new file mode 100644 index 0000000..8b88387 --- /dev/null +++ b/client/src/context/app/AppContext.js @@ -0,0 +1,5 @@ +import { createContext } from "react"; + +const AppContext = createContext(); + +export default AppContext; diff --git a/client/src/context/app/AppReducer.js b/client/src/context/app/AppReducer.js new file mode 100644 index 0000000..19b675b --- /dev/null +++ b/client/src/context/app/AppReducer.js @@ -0,0 +1,10 @@ +import { SET_LOCATION } from "../types"; + +export default (state, action) => { + switch (action.type) { + case SET_LOCATION: + return action.payload; + default: + return state; + } +}; diff --git a/client/src/context/app/AppState.js b/client/src/context/app/AppState.js new file mode 100644 index 0000000..4fceda1 --- /dev/null +++ b/client/src/context/app/AppState.js @@ -0,0 +1,46 @@ +import React, { useReducer } from "react"; + +import { SET_LOCATION } from "../types"; + +import AppContext from "./AppContext"; +import AppReducer from "./AppReducer"; + +const AppState = props => { + const location = ""; + const initialState = location; + + const [state, dispatch] = useReducer(AppReducer, initialState); + + /* + * Actions + */ + + const setLocation = location => { + switch (location) { + case "home": + case "about": + case "notFound": + break; + default: + location = "home"; + } + + dispatch({ + type: SET_LOCATION, + payload: location + }); + }; + + return ( + + {props.children} + + ); +}; + +export default AppState; From 89d83028933e252e1e17dc85b5c356d9a8aed622 Mon Sep 17 00:00:00 2001 From: Flash Date: Tue, 23 Jul 2019 00:49:24 +0200 Subject: [PATCH 069/425] Added app type --- client/src/context/types.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/client/src/context/types.js b/client/src/context/types.js index e23bd0d..fa99e56 100644 --- a/client/src/context/types.js +++ b/client/src/context/types.js @@ -1,3 +1,6 @@ +// App +export const SET_LOCATION = "SET_LOCATION"; + // Alerts export const SET_ALERT = "SET_ALERT"; export const REMOVE_ALERT = "REMOVE_ALERT"; From 1161f1fde7f52a138edf7e4b79bd114938df62d3 Mon Sep 17 00:00:00 2001 From: Flash Date: Tue, 23 Jul 2019 00:49:38 +0200 Subject: [PATCH 070/425] Added app context --- client/src/components/pages/About.js | 33 ++++++++++++++++--------- client/src/components/pages/Home.js | 8 +++--- client/src/components/pages/NotFound.js | 28 +++++++++++++++------ 3 files changed, 47 insertions(+), 22 deletions(-) diff --git a/client/src/components/pages/About.js b/client/src/components/pages/About.js index a883502..2c64901 100644 --- a/client/src/components/pages/About.js +++ b/client/src/components/pages/About.js @@ -1,13 +1,24 @@ -import React, { Fragment } from "react"; - -const About = () => ( - -

          About

          -

          Ethereum Application

          -

          - Version: 1.0.0 -

          -
          -); +import React, { Fragment, useContext, useEffect } from "react"; + +import AppContext from "./../../context/app/AppContext"; + +const About = () => { + const appContext = useContext(AppContext); + const { setLocation } = appContext; + + useEffect(() => { + setLocation("about"); + //eslint-disable-next-line + }, []); + return ( + +

          About

          +

          Ethereum Application

          +

          + Version: 1.0.0 +

          +
          + ); +}; export default About; diff --git a/client/src/components/pages/Home.js b/client/src/components/pages/Home.js index 776c781..6a24cd0 100644 --- a/client/src/components/pages/Home.js +++ b/client/src/components/pages/Home.js @@ -1,16 +1,18 @@ import React, { useEffect, useContext, Fragment } from "react"; import Box from "../tradeBox/Box"; -import UserContext from "./../../context/user/UserContext"; +import AppContext from "./../../context/app/AppContext"; import TradeContext from "./../../context/trade/TradeContext"; -const Home = () => { - const userContext = useContext(UserContext); +const Home = props => { + const appContext = useContext(AppContext); const tradeContext = useContext(TradeContext); + const { setLocation } = appContext; const { userBox } = tradeContext; useEffect(() => { + setLocation("home"); //eslint-disable-next-line }, []); diff --git a/client/src/components/pages/NotFound.js b/client/src/components/pages/NotFound.js index 7f6337e..8a6a3b4 100644 --- a/client/src/components/pages/NotFound.js +++ b/client/src/components/pages/NotFound.js @@ -1,10 +1,22 @@ -import React from "react"; - -const NotFound = () => ( -
          -

          Not Found

          -

          The page you are looking for does not exist.

          -
          -); +import React, { useContext, useEffect } from "react"; + +import AppContext from "./../../context/app/AppContext"; + +const NotFound = props => { + const appContext = useContext(AppContext); + const { setLocation } = appContext; + + useEffect(() => { + setLocation("notFound"); + //eslint-disable-next-line + }, []); + + return ( +
          +

          Not Found

          +

          The page you are looking for does not exist.

          +
          + ); +}; export default NotFound; From 50266f1e3add6bce58ad27c92216a06ade103834 Mon Sep 17 00:00:00 2001 From: Flash Date: Tue, 23 Jul 2019 00:49:47 +0200 Subject: [PATCH 071/425] Added conditional formatting --- client/src/components/layout/Navbar.js | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/client/src/components/layout/Navbar.js b/client/src/components/layout/Navbar.js index 70df49c..6e74fd3 100644 --- a/client/src/components/layout/Navbar.js +++ b/client/src/components/layout/Navbar.js @@ -1,27 +1,32 @@ import React, { useContext } from "react"; import { Link } from "react-router-dom"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; - import PropTypes from "prop-types"; -import UserContext from "../../context/user/UserContext"; +import AppContext from "../../context/app/AppContext"; import Web3Context from "../../context/web3/Web3Context"; const Navbar = ({ title, icon }) => { const web3Context = useContext(Web3Context); - + const appContext = useContext(AppContext); + + const { location } = appContext; const { connected, network } = web3Context; const networkText = () => { + if (!connected) { + return "Not Connected"; + } + switch (network) { case 1: - return LIVE; + return "LIVE"; case 4: - return RINKEBY; + return "RINKEBY"; case 5: - return GOERLI; + return "GOERLI"; default: - return UNSUPPORTED; + return "UNSUPPORTED"; } }; @@ -34,7 +39,9 @@ const Navbar = ({ title, icon }) => {
          • - {!connected ? "Not Connected" : networkText} + + {location === "home" ? networkText() : "Home"} +
          • About From 31ff22a83e5edc5aa33d36d87070ddf9faa0d943 Mon Sep 17 00:00:00 2001 From: Flash Date: Tue, 23 Jul 2019 00:49:54 +0200 Subject: [PATCH 072/425] Added app state --- client/src/App.js | 51 +++++++++++++++++++++++++---------------------- 1 file changed, 27 insertions(+), 24 deletions(-) diff --git a/client/src/App.js b/client/src/App.js index 1e2fab8..7b76c10 100644 --- a/client/src/App.js +++ b/client/src/App.js @@ -11,6 +11,7 @@ import Home from "./components/pages/Home"; import About from "./components/pages/About"; import NotFound from "./components/pages/NotFound"; +import AppState from "./context/app/AppState"; import AlertState from "./context/alert/AlertState"; import TradeState from "./context/trade/TradeState"; import UserState from "./context/user/UserState"; @@ -26,30 +27,32 @@ library.add(faBoxOpen, faInfoCircle); localStorage.token && setAuthToken(localStorage.token); const App = () => ( - - - - - - - - - -
            - - - - - - -
            -
            -
            -
            -
            -
            -
            -
            + + + + + + + + + + +
            + + + + + + +
            +
            +
            +
            +
            +
            +
            +
            +
            ); export default App; From 92e816609a51fe184f35452e97e82cc04f378a8f Mon Sep 17 00:00:00 2001 From: Flash Date: Tue, 23 Jul 2019 06:05:48 +0200 Subject: [PATCH 073/425] Removed empty file --- client/src/components/tradeBox/Form.js | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 client/src/components/tradeBox/Form.js diff --git a/client/src/components/tradeBox/Form.js b/client/src/components/tradeBox/Form.js deleted file mode 100644 index e69de29..0000000 From 53d4c0d8ccd57c41bb8051c6fc883041a518aceb Mon Sep 17 00:00:00 2001 From: Flash Date: Tue, 23 Jul 2019 06:05:57 +0200 Subject: [PATCH 074/425] Added item style --- client/src/components/tradeBox/Items.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/client/src/components/tradeBox/Items.js b/client/src/components/tradeBox/Items.js index be88e26..2ae30c1 100644 --- a/client/src/components/tradeBox/Items.js +++ b/client/src/components/tradeBox/Items.js @@ -30,7 +30,7 @@ const Items = ({ user }) => { return ( items.length > 0 && items.map(item => ( -
            +

            ID:{item.id}

            {internal(item)}
            @@ -38,6 +38,10 @@ const Items = ({ user }) => { ); }; +const itemStyle = { + boxShadow: "0px 5px 5px -5px rgba(0,0,0,0.5)" +}; + Items.propTypes = { user: PropTypes.bool.isRequired }; From 571e7c6ec59a46ed11bb123258808b58832fc922 Mon Sep 17 00:00:00 2001 From: Flash Date: Tue, 23 Jul 2019 06:06:05 +0200 Subject: [PATCH 075/425] Updated reducer --- client/src/context/trade/TradeReducer.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/client/src/context/trade/TradeReducer.js b/client/src/context/trade/TradeReducer.js index 53f9e61..6351345 100644 --- a/client/src/context/trade/TradeReducer.js +++ b/client/src/context/trade/TradeReducer.js @@ -10,12 +10,20 @@ export default (state, action) => { case ADD_TRADE_ITEM: return { ...state, - tradeItems: [...state.tradeItems, action.payload] + user: { + ...state.user, + tradeItems: [...state.user.tradeItems, action.payload] + } }; case REMOVE_TRADE_ITEM: return { ...state, - tradeItems: state.tradeItems.filter(item => item.id !== action.payload) + user: { + ...state.user, + tradeItems: state.user.tradeItems.filter( + item => item.id !== action.payload + ) + } }; case SET_CURRENT_ITEM: return { From d8be6c9b283b1cafc65925d36380735df3dd0934 Mon Sep 17 00:00:00 2001 From: Flash Date: Tue, 23 Jul 2019 06:06:26 +0200 Subject: [PATCH 076/425] Added dummy data --- client/src/context/trade/TradeState.js | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/client/src/context/trade/TradeState.js b/client/src/context/trade/TradeState.js index 47981db..4a3de1f 100644 --- a/client/src/context/trade/TradeState.js +++ b/client/src/context/trade/TradeState.js @@ -13,7 +13,7 @@ import { const TradeState = props => { const initialState = { - userBox: null, + userBox: 1, user: { tradeItems: [ /*{ @@ -22,10 +22,23 @@ const TradeState = props => { type: erc20/erc721/ens, data: {} }*/ + { + sent: "UNSENT", + txHash: null, + type: "erc20", + id: 0 + } ] }, tradePartner: { - tradeItems: [] + tradeItems: [ + { + sent: "UNSENT", + txHash: null, + type: "erc20", + id: 0 + } + ] }, currentItem: null }; @@ -88,6 +101,7 @@ const TradeState = props => { user: state.user, tradePartner: state.tradePartner, currentItem: state.currentItem, + addTradeItem, setUserBox, setCurrentItem, clearCurrentItem From e6ffba9d9c429734d77ee9f98ac22b1ef2f38e0e Mon Sep 17 00:00:00 2001 From: Flash Date: Tue, 23 Jul 2019 08:34:31 +0200 Subject: [PATCH 077/425] Added style --- client/src/components/tradeBox/Items.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/client/src/components/tradeBox/Items.js b/client/src/components/tradeBox/Items.js index 2ae30c1..ddc9fa1 100644 --- a/client/src/components/tradeBox/Items.js +++ b/client/src/components/tradeBox/Items.js @@ -7,10 +7,10 @@ import Erc721 from "./itemTypes/Erc721"; import EnsForm from "./itemTypes/EnsForm"; import TradeContext from "../../context/trade/TradeContext"; -const Items = ({ user }) => { +const Items = ({ isUser }) => { const tradeContext = useContext(TradeContext); - const items = user + const items = isUser ? tradeContext.user.tradeItems : tradeContext.tradePartner.tradeItems; @@ -39,11 +39,14 @@ const Items = ({ user }) => { }; const itemStyle = { + display: "flex", + flexDirection: "row", + justifyContent: "space-around", boxShadow: "0px 5px 5px -5px rgba(0,0,0,0.5)" }; Items.propTypes = { - user: PropTypes.bool.isRequired + isUser: PropTypes.bool.isRequired }; export default Items; From d3bc076697943a4cbba8dbce54dec9331b5b27f6 Mon Sep 17 00:00:00 2001 From: Flash Date: Tue, 23 Jul 2019 08:34:37 +0200 Subject: [PATCH 078/425] Renamed var --- client/src/components/pages/Home.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/src/components/pages/Home.js b/client/src/components/pages/Home.js index 6a24cd0..b734241 100644 --- a/client/src/components/pages/Home.js +++ b/client/src/components/pages/Home.js @@ -18,8 +18,8 @@ const Home = props => { return (
            - {userBox === 0 ? : } - {userBox === 1 ? : } + {userBox === 0 ? : } + {userBox === 1 ? : }
            ); }; From e7576e2cacbbd6ef5a55b44782dfc9829a8f3474 Mon Sep 17 00:00:00 2001 From: Flash Date: Tue, 23 Jul 2019 08:39:51 +0200 Subject: [PATCH 079/425] Added context --- client/src/components/tradeBox/Box.js | 32 ++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/client/src/components/tradeBox/Box.js b/client/src/components/tradeBox/Box.js index ed4e3c0..2f18421 100644 --- a/client/src/components/tradeBox/Box.js +++ b/client/src/components/tradeBox/Box.js @@ -1,24 +1,44 @@ -import React from "react"; +import React, { useContext, useEffect, useState } from "react"; import PropTypes from "prop-types"; import ItemForm from "./ItemForm"; import Items from "./Items"; +import UserContext from "../../context/user/UserContext"; + +const Box = ({ isUser }) => { + const userContext = useContext(UserContext); + + const [trader, setTrader] = useState({ + address: "initialAdd", + ens: "ens" + }); + + const { address, ens } = trader; + + useEffect(() => { + if (isUser) { + setTrader(userContext.user); + } else { + setTrader(userContext.tradePartner); + } + //eslint-disable-next-line + }, [isUser, userContext.user, userContext.tradePartner]); -const Box = ({ user }) => { return (
            - - {user && } + {ens ? ens : address && address} + + {isUser && }
            ); }; Box.defaultProps = { - user: false + isUser: false }; Box.propTypes = { - user: PropTypes.bool.isRequired + isUser: PropTypes.bool.isRequired }; export default Box; From a2bcbeee6dd3ac88830a3d9f5fde3da06e189910 Mon Sep 17 00:00:00 2001 From: James Quinn Date: Wed, 24 Jul 2019 20:59:11 +0200 Subject: [PATCH 080/425] Updated dependencies --- client/package-lock.json | 1015 ++++++++++++++++++++------------------ client/package.json | 2 +- 2 files changed, 540 insertions(+), 477 deletions(-) diff --git a/client/package-lock.json b/client/package-lock.json index 3d0370a..63ffa9f 100644 --- a/client/package-lock.json +++ b/client/package-lock.json @@ -938,6 +938,11 @@ "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-1.1.3.tgz", "integrity": "sha512-shAmDyaQC4H92APFoIaVDHCx5bStIocgvbwQyxPRrbUY20V1EYTbSDchWbuwlMG3V17cprZhA6+78JfB+3DTPw==" }, + "@sindresorhus/is": { + "version": "0.14.0", + "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-0.14.0.tgz", + "integrity": "sha512-9NET910DNaIPngYnLLPeg+Ogzqsi9uM4mSboU5y6p8S5DzMTVEsJZrawi+BoDNUVBa2DhJqQYUFvMDfgU062LQ==" + }, "@svgr/babel-plugin-add-jsx-attribute": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/@svgr/babel-plugin-add-jsx-attribute/-/babel-plugin-add-jsx-attribute-4.0.0.tgz", @@ -1049,12 +1054,12 @@ "loader-utils": "^1.1.0" } }, - "@types/bn.js": { - "version": "4.11.5", - "resolved": "https://registry.npmjs.org/@types/bn.js/-/bn.js-4.11.5.tgz", - "integrity": "sha512-AEAZcIZga0JgVMHNtl1CprA/hXX7/wPt79AgR4XqaDt7jyj3QWYw6LPoOiznPtugDmlubUnAahMs2PFxGcQrng==", + "@szmarczak/http-timer": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@szmarczak/http-timer/-/http-timer-1.1.2.tgz", + "integrity": "sha512-XIB2XbzHTN6ieIjfIMV9hlVcfPU26s2vafYWQcZHWXHOxiaRZYEDKEwdl129Zyg50+foYV2jCgtrqSA6qNuNSA==", "requires": { - "@types/node": "*" + "defer-to-connect": "^1.0.1" } }, "@types/node": { @@ -2469,22 +2474,6 @@ "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-1.13.0.tgz", "integrity": "sha512-EgmjVLMn22z7eGGv3kcnHwSnJXmFHjISTY9E/S5lIcTD3Oxw05QTcBLNkJFzcb3cNueUdF/IN4U+d78V0zO8Hw==" }, - "bindings": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz", - "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==", - "requires": { - "file-uri-to-path": "1.0.0" - } - }, - "bip66": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/bip66/-/bip66-1.1.5.tgz", - "integrity": "sha1-AfqHSHhcpwlV1QESF9GzE5lpyiI=", - "requires": { - "safe-buffer": "^5.0.1" - } - }, "bl": { "version": "1.2.2", "resolved": "https://registry.npmjs.org/bl/-/bl-1.2.2.tgz", @@ -2853,6 +2842,40 @@ "unset-value": "^1.0.0" } }, + "cacheable-request": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-6.1.0.tgz", + "integrity": "sha512-Oj3cAGPCqOZX7Rz64Uny2GYAZNliQSqfbePrgAQ1wKAihYmCUnraBtJtKcGR4xz7wF+LoJC+ssFZvv5BgF9Igg==", + "requires": { + "clone-response": "^1.0.2", + "get-stream": "^5.1.0", + "http-cache-semantics": "^4.0.0", + "keyv": "^3.0.0", + "lowercase-keys": "^2.0.0", + "normalize-url": "^4.1.0", + "responselike": "^1.0.2" + }, + "dependencies": { + "get-stream": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.1.0.tgz", + "integrity": "sha512-EXr1FOzrzTfGeL0gQdeFEvOMm2mzMOglyiOXSTpPC+iAjAKftbr3jpCMWynogwYnM+eSj9sHGc6wjIcDvYiygw==", + "requires": { + "pump": "^3.0.0" + } + }, + "lowercase-keys": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-2.0.0.tgz", + "integrity": "sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA==" + }, + "normalize-url": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-4.3.0.tgz", + "integrity": "sha512-0NLtR71o4k6GLP+mr6Ty34c5GA6CMoEsncKJxvQd8NzPxaHRJNnb5gZE8R1XF4CPIS7QPHLJ74IFszwtNVAHVQ==" + } + } + }, "call-me-maybe": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/call-me-maybe/-/call-me-maybe-1.0.1.tgz", @@ -3177,6 +3200,14 @@ "shallow-clone": "^0.1.2" } }, + "clone-response": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/clone-response/-/clone-response-1.0.2.tgz", + "integrity": "sha1-0dyXOSAxTfZ/vrlCI7TuNQI56Ws=", + "requires": { + "mimic-response": "^1.0.0" + } + }, "co": { "version": "4.6.0", "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", @@ -4173,6 +4204,11 @@ "strip-bom": "^2.0.0" } }, + "defer-to-connect": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-1.0.2.tgz", + "integrity": "sha512-k09hcQcTDY+cwgiwa6PYKLm3jlagNzQ+RSvhjzESOGOx+MNOuXkxTfEvPrO1IOQ81tArCFYQgi631clB70RpQw==" + }, "define-properties": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", @@ -4475,16 +4511,6 @@ "resolved": "https://registry.npmjs.org/dotenv-expand/-/dotenv-expand-4.2.0.tgz", "integrity": "sha1-3vHxyl1gWdJKdm5YeULCEQbOEnU=" }, - "drbg.js": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/drbg.js/-/drbg.js-1.0.1.tgz", - "integrity": "sha1-Pja2xCs3BDgjzbwzLVjzHiRFSAs=", - "requires": { - "browserify-aes": "^1.0.6", - "create-hash": "^1.1.2", - "create-hmac": "^1.1.4" - } - }, "duplexer": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/duplexer/-/duplexer-0.1.1.tgz", @@ -5075,11 +5101,6 @@ "pnglib": "0.0.1" } }, - "ethereum-common": { - "version": "0.0.18", - "resolved": "https://registry.npmjs.org/ethereum-common/-/ethereum-common-0.0.18.tgz", - "integrity": "sha1-L9w1dvIykDNYl26znaeDIT/5Uj8=" - }, "ethereum-ens": { "version": "0.7.7", "resolved": "https://registry.npmjs.org/ethereum-ens/-/ethereum-ens-0.7.7.tgz", @@ -5110,29 +5131,6 @@ } } }, - "ethereumjs-tx": { - "version": "1.3.7", - "resolved": "https://registry.npmjs.org/ethereumjs-tx/-/ethereumjs-tx-1.3.7.tgz", - "integrity": "sha512-wvLMxzt1RPhAQ9Yi3/HKZTn0FZYpnsmQdbKYfUUpi4j1SEIcbkd9tndVjcPrufY3V7j2IebOpC00Zp2P/Ay2kA==", - "requires": { - "ethereum-common": "^0.0.18", - "ethereumjs-util": "^5.0.0" - } - }, - "ethereumjs-util": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/ethereumjs-util/-/ethereumjs-util-5.2.0.tgz", - "integrity": "sha512-CJAKdI0wgMbQFLlLRtZKGcy/L6pzVRgelIZqRqNbuVFM3K9VEnyfbcvz0ncWMRNCe4kaHWjwRYQcYMucmwsnWA==", - "requires": { - "bn.js": "^4.11.0", - "create-hash": "^1.1.2", - "ethjs-util": "^0.1.3", - "keccak": "^1.0.2", - "rlp": "^2.0.0", - "safe-buffer": "^5.1.1", - "secp256k1": "^3.0.1" - } - }, "ethers": { "version": "4.0.0-beta.1", "resolved": "https://registry.npmjs.org/ethers/-/ethers-4.0.0-beta.1.tgz", @@ -5203,15 +5201,6 @@ } } }, - "ethjs-util": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/ethjs-util/-/ethjs-util-0.1.6.tgz", - "integrity": "sha512-CUnVOQq7gSpDHZVVrQW8ExxUETWrnrvXYvYz55wOU8Uj4VCgw56XC2B/fVqQN+f7gmrnRHSLVnFAwsCuNwji8w==", - "requires": { - "is-hex-prefixed": "1.0.0", - "strip-hex-prefix": "1.0.0" - } - }, "eventemitter3": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-3.1.0.tgz", @@ -5784,11 +5773,6 @@ "resolved": "https://registry.npmjs.org/file-type/-/file-type-5.2.0.tgz", "integrity": "sha1-LdvqfHP/42No365J3DOMBYwritY=" }, - "file-uri-to-path": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", - "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==" - }, "filename-regex": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/filename-regex/-/filename-regex-2.0.1.tgz", @@ -6298,6 +6282,14 @@ "universalify": "^0.1.0" } }, + "fs-minipass": { + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-1.2.6.tgz", + "integrity": "sha512-crhvyXcMejjv3Z5d2Fa9sf5xLYVCF5O1c71QxbVnbLsmYMBEvDAftewesN/HhY03YRoA7zOMxjNGrF5svGaaeQ==", + "requires": { + "minipass": "^2.2.1" + } + }, "fs-promise": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/fs-promise/-/fs-promise-2.0.3.tgz", @@ -7068,9 +7060,9 @@ "integrity": "sha512-d4sze1JNC454Wdo2fkuyzCr6aHcbL6PGGuFAz0Li/NcOm1tCHGnWDRmJP85dh9IhQErTc2svWFEX5xHIOo//kQ==" }, "handlebars": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.1.1.tgz", - "integrity": "sha512-3Zhi6C0euYZL5sM0Zcy7lInLXKQ+YLcF/olbN010mzGQ4XVm50JeyBnMqofHh696GrciGruC7kCcApPDJvVgwA==", + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.1.2.tgz", + "integrity": "sha512-nvfrjqvt9xQ8Z/w0ijewdD/vvWDTOweBUm96NTr66Wfvo1mJenBLwcYmPs3TIBP5ruzYGD7Hx/DaM9RmhroGPw==", "requires": { "neo-async": "^2.6.0", "optimist": "^0.6.1", @@ -7412,6 +7404,11 @@ "readable-stream": "^3.1.1" } }, + "http-cache-semantics": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.0.3.tgz", + "integrity": "sha512-TcIMG3qeVLgDr1TEd2XvHaTnMPwYQUQMIBLy+5pLSDKYFc7UIqj39w8EGzZkaxoLv/l2K8HaI0t5AVA+YYgUew==" + }, "http-deceiver": { "version": "1.2.7", "resolved": "https://registry.npmjs.org/http-deceiver/-/http-deceiver-1.2.7.tgz", @@ -8908,9 +8905,9 @@ "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==" }, "js-yaml": { - "version": "3.13.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.0.tgz", - "integrity": "sha512-pZZoSxcCYco+DIKBTimr67J6Hy+EYGZDY/HCWC+iAEA9h1ByhMXAIVUXMcMFpOCxQ/xjXmPI2MkDL5HRm5eFrQ==", + "version": "3.13.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.1.tgz", + "integrity": "sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==", "requires": { "argparse": "^1.0.7", "esprima": "^4.0.0" @@ -8971,6 +8968,11 @@ "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==" }, + "json-buffer": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.0.tgz", + "integrity": "sha1-Wx85evx11ne96Lz8Dkfh+aPZqJg=" + }, "json-parse-better-errors": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz", @@ -9049,17 +9051,6 @@ "array-includes": "^3.0.3" } }, - "keccak": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/keccak/-/keccak-1.4.0.tgz", - "integrity": "sha512-eZVaCpblK5formjPjeTBik7TAg+pqnDrMHIffSvi9Lh7PQgM1+hSzakUeZFCk9DVVG0dacZJuaz2ntwlzZUIBw==", - "requires": { - "bindings": "^1.2.1", - "inherits": "^2.0.3", - "nan": "^2.2.1", - "safe-buffer": "^5.1.0" - } - }, "keccakjs": { "version": "0.2.3", "resolved": "https://registry.npmjs.org/keccakjs/-/keccakjs-0.2.3.tgz", @@ -9069,6 +9060,14 @@ "sha3": "^1.2.2" } }, + "keyv": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/keyv/-/keyv-3.1.0.tgz", + "integrity": "sha512-9ykJ/46SN/9KPM/sichzQ7OvXyGDYKGTaDlKMGCAlg2UK8KRy4jb0d8sFc+0Tt0YYnThq8X2RZgCg74RPxgcVA==", + "requires": { + "json-buffer": "3.0.0" + } + }, "killable": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/killable/-/killable-1.0.1.tgz", @@ -9615,6 +9614,30 @@ "resolved": "http://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=" }, + "minipass": { + "version": "2.3.5", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-2.3.5.tgz", + "integrity": "sha512-Gi1W4k059gyRbyVUZQ4mEqLm0YIUiGYfvxhF6SIlk3ui1WVxMTGfGdQ2SInh3PDrRTVvPKgULkpJtT4RH10+VA==", + "requires": { + "safe-buffer": "^5.1.2", + "yallist": "^3.0.0" + }, + "dependencies": { + "yallist": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.0.3.tgz", + "integrity": "sha512-S+Zk8DEWE6oKpV+vI3qWkaK+jSbIK86pCwe2IF/xwIpQ8jEuxpw9NyaGjmp9+BoJv5FV2piqCDcoCtStppiq2A==" + } + } + }, + "minizlib": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-1.2.1.tgz", + "integrity": "sha512-7+4oTUOWKg7AuL3vloEWekXY2/D20cevzsrNT2kGWm+39J9hGTCBv8VI5Pm5lXZ/o3/mdR4f8rflAPhnQb8mPA==", + "requires": { + "minipass": "^2.2.1" + } + }, "mississippi": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/mississippi/-/mississippi-3.0.0.tgz", @@ -9633,9 +9656,9 @@ } }, "mixin-deep": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/mixin-deep/-/mixin-deep-1.3.1.tgz", - "integrity": "sha512-8ZItLHeEgaqEvd5lYBXfm4EZSFCX29Jb9K+lAHhDKzReKBQKj3R+7NOF6tjqYi9t4oI8VUfaWITJQm86wnXGNQ==", + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/mixin-deep/-/mixin-deep-1.3.2.tgz", + "integrity": "sha512-WRoDn//mXBiJ1H40rqa3vH0toePwSsGb45iInWlTySa+Uu4k3tYUSxa2v1KqAiLtvlrSzaExqS1gtk96A9zvEA==", "requires": { "for-in": "^1.0.2", "is-extendable": "^1.0.1" @@ -10155,7 +10178,7 @@ "dependencies": { "minimist": { "version": "0.0.10", - "resolved": "http://registry.npmjs.org/minimist/-/minimist-0.0.10.tgz", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.10.tgz", "integrity": "sha1-3j+YVD2/lggr5IrRoMfNqDYwHc8=" }, "wordwrap": { @@ -14496,6 +14519,14 @@ "resolved": "https://registry.npmjs.org/resolve-url/-/resolve-url-0.2.1.tgz", "integrity": "sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo=" }, + "responselike": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/responselike/-/responselike-1.0.2.tgz", + "integrity": "sha1-kYcg7ztjHFZCvgaPFa3lpG9Loec=", + "requires": { + "lowercase-keys": "^1.0.0" + } + }, "restore-cursor": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-2.0.0.tgz", @@ -14537,15 +14568,6 @@ "inherits": "^2.0.1" } }, - "rlp": { - "version": "2.2.3", - "resolved": "https://registry.npmjs.org/rlp/-/rlp-2.2.3.tgz", - "integrity": "sha512-l6YVrI7+d2vpW6D6rS05x2Xrmq8oW7v3pieZOJKBEdjuTF4Kz/iwk55Zyh1Zaz+KOB2kC8+2jZlp2u9L4tTzCQ==", - "requires": { - "bn.js": "^4.11.1", - "safe-buffer": "^5.1.1" - } - }, "rsvp": { "version": "3.6.2", "resolved": "https://registry.npmjs.org/rsvp/-/rsvp-3.6.2.tgz", @@ -14977,28 +14999,6 @@ "pbkdf2": "^3.0.3" } }, - "secp256k1": { - "version": "3.7.1", - "resolved": "https://registry.npmjs.org/secp256k1/-/secp256k1-3.7.1.tgz", - "integrity": "sha512-1cf8sbnRreXrQFdH6qsg2H71Xw91fCCS9Yp021GnUNJzWJS/py96fS4lHbnTnouLp08Xj6jBoBB6V78Tdbdu5g==", - "requires": { - "bindings": "^1.5.0", - "bip66": "^1.1.5", - "bn.js": "^4.11.8", - "create-hash": "^1.2.0", - "drbg.js": "^1.0.1", - "elliptic": "^6.4.1", - "nan": "^2.14.0", - "safe-buffer": "^5.1.2" - }, - "dependencies": { - "nan": { - "version": "2.14.0", - "resolved": "https://registry.npmjs.org/nan/-/nan-2.14.0.tgz", - "integrity": "sha512-INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9+5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg==" - } - } - }, "seek-bzip": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/seek-bzip/-/seek-bzip-1.0.5.tgz", @@ -15128,9 +15128,9 @@ "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=" }, "set-value": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/set-value/-/set-value-2.0.0.tgz", - "integrity": "sha512-hw0yxk9GT/Hr5yJEYnHNKYXkIA8mVJgd9ditYZCe16ZczcaELYYcfvaXesNACk2O8O0nTiPQcQhGUQj8JLzeeg==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/set-value/-/set-value-2.0.1.tgz", + "integrity": "sha512-JxHc1weCN68wRY0fhCoXpyK55m/XPHafOmK4UWD7m2CI14GMcFypt4w/0+NV5f/ZMby2F6S2wwA7fgynh9gWSw==", "requires": { "extend-shallow": "^2.0.1", "is-extendable": "^0.1.1", @@ -15575,7 +15575,7 @@ }, "sprintf-js": { "version": "1.0.3", - "resolved": "http://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=" }, "sshpk": { @@ -16298,6 +16298,11 @@ "kind-of": "^3.0.2" } }, + "to-readable-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/to-readable-stream/-/to-readable-stream-1.0.0.tgz", + "integrity": "sha512-Iq25XBt6zD5npPhlLVXGFN3/gyR2/qODcKNNyTMd4vbm39HUaOiAM4PMq0eMVC/Tkxz+Zjdsc55g9yyz+Yq00Q==" + }, "to-regex": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/to-regex/-/to-regex-3.0.2.tgz", @@ -16517,35 +16522,14 @@ } }, "union-value": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/union-value/-/union-value-1.0.0.tgz", - "integrity": "sha1-XHHDTLW61dzr4+oM0IIHulqhrqQ=", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/union-value/-/union-value-1.0.1.tgz", + "integrity": "sha512-tJfXmxMeWYnczCVs7XAEvIV7ieppALdyepWMkHkwciRpZraG/xwT+s2JN8+pr1+8jCRf80FFzvr+MpQeeoF4Xg==", "requires": { "arr-union": "^3.1.0", "get-value": "^2.0.6", "is-extendable": "^0.1.1", - "set-value": "^0.4.3" - }, - "dependencies": { - "extend-shallow": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", - "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", - "requires": { - "is-extendable": "^0.1.0" - } - }, - "set-value": { - "version": "0.4.3", - "resolved": "https://registry.npmjs.org/set-value/-/set-value-0.4.3.tgz", - "integrity": "sha1-fbCPnT0i3H945Trzw79GZuzfzPE=", - "requires": { - "extend-shallow": "^2.0.1", - "is-extendable": "^0.1.1", - "is-plain-object": "^2.0.1", - "to-object-path": "^0.3.0" - } - } + "set-value": "^2.0.1" } }, "uniq": { @@ -16870,40 +16854,45 @@ "integrity": "sha512-II+n2ms4mPxK+RnIxRPOw3zwF2jRscdJIUE9BfkKHm4FYEg9+biIoTMnaZF5MpemE3T+VhMLrhbyD4ilkPCSbg==" }, "web3": { - "version": "1.0.0-beta.55", - "resolved": "https://registry.npmjs.org/web3/-/web3-1.0.0-beta.55.tgz", - "integrity": "sha512-yJpwy4IUA3T/F9hWzYQVn0GbJCrAaZ0KTIO3iuqkhaYH0Y09KV7k4GzFi4hN7hT4cFTj4yIKaeVCwQ5kzvi2Vg==", - "requires": { - "@babel/runtime": "^7.3.1", - "@types/node": "^10.12.18", - "web3-core": "1.0.0-beta.55", - "web3-eth": "1.0.0-beta.55", - "web3-eth-personal": "1.0.0-beta.55", - "web3-net": "1.0.0-beta.55", - "web3-providers": "1.0.0-beta.55", - "web3-shh": "1.0.0-beta.55", - "web3-utils": "1.0.0-beta.55" + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/web3/-/web3-1.2.0.tgz", + "integrity": "sha512-iFrVAexsopX97x0ofBU/7HrCxzovf624qBkjBUeHZDf/G3Sb4tMQtjkCRc5lgVvzureq5SCqDiFDcqnw7eJ0bA==", + "requires": { + "web3-bzz": "1.2.0", + "web3-core": "1.2.0", + "web3-eth": "1.2.0", + "web3-eth-personal": "1.2.0", + "web3-net": "1.2.0", + "web3-shh": "1.2.0", + "web3-utils": "1.2.0" }, "dependencies": { "@types/node": { - "version": "10.14.9", - "resolved": "https://registry.npmjs.org/@types/node/-/node-10.14.9.tgz", - "integrity": "sha512-NelG/dSahlXYtSoVPErrp06tYFrvzj8XLWmKA+X8x0W//4MqbUyZu++giUG/v0bjAT6/Qxa8IjodrfdACyb0Fg==" + "version": "10.14.13", + "resolved": "https://registry.npmjs.org/@types/node/-/node-10.14.13.tgz", + "integrity": "sha512-yN/FNNW1UYsRR1wwAoyOwqvDuLDtVXnaJTZ898XIw/Q5cCaeVAlVwvsmXLX5PuiScBYwZsZU4JYSHB3TvfdwvQ==" }, - "eth-lib": { - "version": "0.2.8", - "resolved": "https://registry.npmjs.org/eth-lib/-/eth-lib-0.2.8.tgz", - "integrity": "sha512-ArJ7x1WcWOlSpzdoTBX8vkwlkSQ85CjjifSZtV4co64vWxSV8geWfPI9x4SVYu3DSxnX4yWFVTtGL+j9DUFLNw==", + "buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.2.1.tgz", + "integrity": "sha512-c+Ko0loDaFfuPWiL02ls9Xd3GO3cPVmUobQ6t3rXNUk304u6hGq+8N/kFi+QEIKhzK3uwolVhLzszmfLmMLnqg==", "requires": { - "bn.js": "^4.11.6", - "elliptic": "^6.4.0", - "xhr-request-promise": "^0.1.2" + "base64-js": "^1.0.2", + "ieee754": "^1.1.4" + } + }, + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "requires": { + "ms": "2.0.0" } }, "ethers": { - "version": "4.0.30", - "resolved": "https://registry.npmjs.org/ethers/-/ethers-4.0.30.tgz", - "integrity": "sha512-1a39Y+q5zTfrXCLndV+CHsTHq+T5/TvAx5y0S/PKd700C0lfU70CJnU7q89bd+4pIuWp05TkrEsrTj2dXhkcSA==", + "version": "4.0.0-beta.3", + "resolved": "https://registry.npmjs.org/ethers/-/ethers-4.0.0-beta.3.tgz", + "integrity": "sha512-YYPogooSknTwvHg3+Mv71gM/3Wcrx+ZpCzarBj3mqs9njjRkrOo2/eufzhHloOCo3JSoNI4TQJJ6yU5ABm3Uog==", "requires": { "@types/node": "^10.3.2", "aes-js": "3.0.0", @@ -16911,7 +16900,7 @@ "elliptic": "6.3.3", "hash.js": "1.1.3", "js-sha3": "0.5.7", - "scrypt-js": "2.0.4", + "scrypt-js": "2.0.3", "setimmediate": "1.0.4", "uuid": "2.0.1", "xmlhttprequest": "1.8.0" @@ -16927,9 +16916,55 @@ "hash.js": "^1.0.0", "inherits": "^2.0.1" } + }, + "setimmediate": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.4.tgz", + "integrity": "sha1-IOgd5iLUoCWIzgyNqJc8vPHTE48=" } } }, + "eventemitter3": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-3.1.2.tgz", + "integrity": "sha512-tvtQIeLVHjDkJYnzf2dgVMxfuSGJeM/7UCG17TT4EumTfNtF+0nebF/4zWOIkCreAbtNqhGEboB6BWrwqNaw4Q==" + }, + "fs-extra": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-4.0.3.tgz", + "integrity": "sha512-q6rbdDd1o2mAnQreO7YADIxf/Whx4AHBiRf6d+/cVT8h44ss+lHgxf1FemcqDnQt9X3ct4McHr+JMGlYSsK7Cg==", + "requires": { + "graceful-fs": "^4.1.2", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" + } + }, + "get-stream": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", + "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==", + "requires": { + "pump": "^3.0.0" + } + }, + "got": { + "version": "9.6.0", + "resolved": "https://registry.npmjs.org/got/-/got-9.6.0.tgz", + "integrity": "sha512-R7eWptXuGYxwijs0eV+v3o6+XH1IqVK8dJOEecQfTmkncw9AV4dcw/Dhxi8MdlqPthxxpZyizMzyg8RTmEsG+Q==", + "requires": { + "@sindresorhus/is": "^0.14.0", + "@szmarczak/http-timer": "^1.1.2", + "cacheable-request": "^6.0.0", + "decompress-response": "^3.3.0", + "duplexer3": "^0.1.4", + "get-stream": "^4.1.0", + "lowercase-keys": "^1.0.1", + "mimic-response": "^1.0.1", + "p-cancelable": "^1.0.0", + "to-readable-stream": "^1.0.0", + "url-parse-lax": "^3.0.0" + } + }, "hash.js": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.3.tgz", @@ -16939,10 +16974,23 @@ "minimalistic-assert": "^1.0.0" } }, - "scrypt-js": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/scrypt-js/-/scrypt-js-2.0.4.tgz", - "integrity": "sha512-4KsaGcPnuhtCZQCxFxN3GVYIhKFPTdLd8PLC552XwbMndtD0cjRFAhDuuydXQ0h08ZfPgzqe6EKHozpuH74iDw==" + "oboe": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/oboe/-/oboe-2.1.4.tgz", + "integrity": "sha1-IMiM2wwVNxuwQRklfU/dNLCqSfY=", + "requires": { + "http-https": "^1.0.0" + } + }, + "p-cancelable": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-1.1.0.tgz", + "integrity": "sha512-s73XxOZ4zpt1edZYZzvhqFa6uvQc1vwUa0K0BdtIZgQMAJj9IbebH+JkgKZc9h+B05PKHLOTl4ajG1BmNrVZlw==" + }, + "prepend-http": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/prepend-http/-/prepend-http-2.0.0.tgz", + "integrity": "sha1-6SQ0v6XqjBn0HN/UAddBo8gZ2Jc=" }, "scrypt.js": { "version": "0.3.0", @@ -16953,121 +17001,234 @@ "scryptsy": "^1.2.1" } }, - "setimmediate": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.4.tgz", - "integrity": "sha1-IOgd5iLUoCWIzgyNqJc8vPHTE48=" + "swarm-js": { + "version": "0.1.39", + "resolved": "https://registry.npmjs.org/swarm-js/-/swarm-js-0.1.39.tgz", + "integrity": "sha512-QLMqL2rzF6n5s50BptyD6Oi0R1aWlJC5Y17SRIVXRj6OR1DRIPM7nepvrxxkjA1zNzFz6mUOMjfeqeDaWB7OOg==", + "requires": { + "bluebird": "^3.5.0", + "buffer": "^5.0.5", + "decompress": "^4.0.0", + "eth-lib": "^0.1.26", + "fs-extra": "^4.0.2", + "got": "^7.1.0", + "mime-types": "^2.1.16", + "mkdirp-promise": "^5.0.1", + "mock-fs": "^4.1.0", + "setimmediate": "^1.0.5", + "tar": "^4.0.2", + "xhr-request-promise": "^0.1.2" + }, + "dependencies": { + "get-stream": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz", + "integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=" + }, + "got": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/got/-/got-7.1.0.tgz", + "integrity": "sha512-Y5WMo7xKKq1muPsxD+KmrR8DH5auG7fBdDVueZwETwV6VytKyU9OX/ddpq2/1hp1vIPvVb4T81dKQz3BivkNLw==", + "requires": { + "decompress-response": "^3.2.0", + "duplexer3": "^0.1.4", + "get-stream": "^3.0.0", + "is-plain-obj": "^1.1.0", + "is-retry-allowed": "^1.0.0", + "is-stream": "^1.0.0", + "isurl": "^1.0.0-alpha5", + "lowercase-keys": "^1.0.0", + "p-cancelable": "^0.3.0", + "p-timeout": "^1.1.1", + "safe-buffer": "^5.0.1", + "timed-out": "^4.0.0", + "url-parse-lax": "^1.0.0", + "url-to-options": "^1.0.1" + } + }, + "p-cancelable": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-0.3.0.tgz", + "integrity": "sha512-RVbZPLso8+jFeq1MfNvgXtCRED2raz/dKpacfTNxsx6pLEpEomM7gah6VeHSYV3+vo0OAi4MkArtQcWWXuQoyw==" + }, + "prepend-http": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/prepend-http/-/prepend-http-1.0.4.tgz", + "integrity": "sha1-1PRWKwzjaW5BrFLQ4ALlemNdxtw=" + }, + "url-parse-lax": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/url-parse-lax/-/url-parse-lax-1.0.0.tgz", + "integrity": "sha1-evjzA2Rem9eaJy56FKxovAYJ2nM=", + "requires": { + "prepend-http": "^1.0.1" + } + } + } + }, + "tar": { + "version": "4.4.10", + "resolved": "https://registry.npmjs.org/tar/-/tar-4.4.10.tgz", + "integrity": "sha512-g2SVs5QIxvo6OLp0GudTqEf05maawKUxXru104iaayWA09551tFCTI8f1Asb4lPfkBr91k07iL4c11XO3/b0tA==", + "requires": { + "chownr": "^1.1.1", + "fs-minipass": "^1.2.5", + "minipass": "^2.3.5", + "minizlib": "^1.2.1", + "mkdirp": "^0.5.0", + "safe-buffer": "^5.1.2", + "yallist": "^3.0.3" + } + }, + "url-parse-lax": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/url-parse-lax/-/url-parse-lax-3.0.0.tgz", + "integrity": "sha1-FrXK/Afb42dsGxmZF3gj1lA6yww=", + "requires": { + "prepend-http": "^2.0.0" + } + }, + "utf8": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/utf8/-/utf8-3.0.0.tgz", + "integrity": "sha512-E8VjFIQ/TyQgp+TZfS6l8yp/xWppSAHzidGiRrqe4bK4XP9pTRyKFgGJpO3SN7zdX4DeomTrwaseCHovfpFcqQ==" }, "uuid": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/uuid/-/uuid-2.0.1.tgz", "integrity": "sha1-wqMN7bPlNdcsz4LjQ5QaULqFM6w=" }, + "web3-bzz": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/web3-bzz/-/web3-bzz-1.2.0.tgz", + "integrity": "sha512-QEIdvguSEpqBK9b815nzx4yvpfKv/SAvaFeCMjQ0vjIVqFhAwBHDxd+f+X3nWGVRGVeOTP7864tau26CPBtQ8Q==", + "requires": { + "got": "9.6.0", + "swarm-js": "0.1.39", + "underscore": "1.9.1" + } + }, "web3-core": { - "version": "1.0.0-beta.55", - "resolved": "https://registry.npmjs.org/web3-core/-/web3-core-1.0.0-beta.55.tgz", - "integrity": "sha512-AMMp7TLEtE7u8IJAu/THrRhBTZyZzeo7Y6GiWYNwb5+KStC9hIGLr9cI1KX9R6ZioTOLRHrqT7awDhnJ1ku2mg==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/web3-core/-/web3-core-1.2.0.tgz", + "integrity": "sha512-Vy+fargzx94COdihE79zIM5lb/XAl/LJlgGdmz2a6QhgGZrSL8K6DKKNS+OuORAcLJN2PWNMc4IdfknkOw1PhQ==", "requires": { - "@babel/runtime": "^7.3.1", - "@types/bn.js": "^4.11.4", - "@types/node": "^10.12.18", - "lodash": "^4.17.11", - "web3-core-method": "1.0.0-beta.55", - "web3-providers": "1.0.0-beta.55", - "web3-utils": "1.0.0-beta.55" + "web3-core-helpers": "1.2.0", + "web3-core-method": "1.2.0", + "web3-core-requestmanager": "1.2.0", + "web3-utils": "1.2.0" } }, "web3-core-helpers": { - "version": "1.0.0-beta.55", - "resolved": "https://registry.npmjs.org/web3-core-helpers/-/web3-core-helpers-1.0.0-beta.55.tgz", - "integrity": "sha512-suj9Xy/lIqajaYLJTEjr2rlFgu6hGYwChHmf8+qNrC2luZA6kirTamtB9VThWMxbywx7p0bqQFjW6zXogAgWhg==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/web3-core-helpers/-/web3-core-helpers-1.2.0.tgz", + "integrity": "sha512-KLCCP2FS1cMz23Y9l3ZaEDzaUky+GpsNavl4Hn1xX8lNaKcfgGEF+DgtAY/TfPQYAxLjLrSbIFUDzo9H/W1WAQ==", "requires": { - "@babel/runtime": "^7.3.1", - "lodash": "^4.17.11", - "web3-core": "1.0.0-beta.55", - "web3-eth-iban": "1.0.0-beta.55", - "web3-utils": "1.0.0-beta.55" + "underscore": "1.9.1", + "web3-eth-iban": "1.2.0", + "web3-utils": "1.2.0" } }, "web3-core-method": { - "version": "1.0.0-beta.55", - "resolved": "https://registry.npmjs.org/web3-core-method/-/web3-core-method-1.0.0-beta.55.tgz", - "integrity": "sha512-w1cW/s2ji9qGELHk2uMJCn1ooay0JJLVoPD1nvmsW6OTRWcVjxa62nJrFQhe6P5lEb83Xk9oHgmCxZoVUHibOw==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/web3-core-method/-/web3-core-method-1.2.0.tgz", + "integrity": "sha512-Iff5rCL+sgHe6zZVZijp818aRixKQf3ZAyQsT6ewER1r9yqXsH89DJtX33Xw8xiaYSwUFcpNs2j+Kluhv/eVAw==", + "requires": { + "underscore": "1.9.1", + "web3-core-helpers": "1.2.0", + "web3-core-promievent": "1.2.0", + "web3-core-subscriptions": "1.2.0", + "web3-utils": "1.2.0" + } + }, + "web3-core-promievent": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/web3-core-promievent/-/web3-core-promievent-1.2.0.tgz", + "integrity": "sha512-9THNYsZka91AX4LZGZvka5hio9+QlOY22hNgCiagmCmYytyKk3cXftL6CWefnNF7XgW8sy/ew5lzWLVsQW61Lw==", + "requires": { + "any-promise": "1.3.0", + "eventemitter3": "3.1.2" + } + }, + "web3-core-requestmanager": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/web3-core-requestmanager/-/web3-core-requestmanager-1.2.0.tgz", + "integrity": "sha512-hPe1jyESodXAiE7qJglu7ySo4GINCn5CgG+9G1ATLQbriZsir83QMSeKQekv/hckKFIf4SvZJRPEBhtAle+Dhw==", "requires": { - "@babel/runtime": "^7.3.1", - "eventemitter3": "3.1.0", - "lodash": "^4.17.11", - "rxjs": "^6.4.0", - "web3-core": "1.0.0-beta.55", - "web3-core-helpers": "1.0.0-beta.55", - "web3-core-subscriptions": "1.0.0-beta.55", - "web3-utils": "1.0.0-beta.55" + "underscore": "1.9.1", + "web3-core-helpers": "1.2.0", + "web3-providers-http": "1.2.0", + "web3-providers-ipc": "1.2.0", + "web3-providers-ws": "1.2.0" } }, "web3-core-subscriptions": { - "version": "1.0.0-beta.55", - "resolved": "https://registry.npmjs.org/web3-core-subscriptions/-/web3-core-subscriptions-1.0.0-beta.55.tgz", - "integrity": "sha512-pb3oQbUzK7IoyXwag8TYInQddg0rr7BHxKc+Pbs/92hVNQ5ps4iGMVJKezdrjlQ1IJEEUiDIglXl4LZ1hIuMkw==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/web3-core-subscriptions/-/web3-core-subscriptions-1.2.0.tgz", + "integrity": "sha512-DHipGH8It5E4HxxvymhkudcYhBVgGx6MwGWobIVKFgp6JRxtuvAbqwrMbuD/+78J6yXOa4y9zVXBk12dm2NXGg==", "requires": { - "@babel/runtime": "^7.3.1", - "eventemitter3": "^3.1.0", - "lodash": "^4.17.11" + "eventemitter3": "3.1.2", + "underscore": "1.9.1", + "web3-core-helpers": "1.2.0" } }, "web3-eth": { - "version": "1.0.0-beta.55", - "resolved": "https://registry.npmjs.org/web3-eth/-/web3-eth-1.0.0-beta.55.tgz", - "integrity": "sha512-F3zJ9I1gOgQdNGfi2Dy2lmj6OqCMJoRN01XHhQZagq0HY1JYMfObtfMi5E3L+qsegsSddHbqp4YY57tKx6uxpA==", - "requires": { - "@babel/runtime": "^7.3.1", - "ethereumjs-tx": "^1.3.7", - "rxjs": "^6.4.0", - "web3-core": "1.0.0-beta.55", - "web3-core-helpers": "1.0.0-beta.55", - "web3-core-method": "1.0.0-beta.55", - "web3-core-subscriptions": "1.0.0-beta.55", - "web3-eth-abi": "1.0.0-beta.55", - "web3-eth-accounts": "1.0.0-beta.55", - "web3-eth-contract": "1.0.0-beta.55", - "web3-eth-ens": "1.0.0-beta.55", - "web3-eth-iban": "1.0.0-beta.55", - "web3-eth-personal": "1.0.0-beta.55", - "web3-net": "1.0.0-beta.55", - "web3-providers": "1.0.0-beta.55", - "web3-utils": "1.0.0-beta.55" + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/web3-eth/-/web3-eth-1.2.0.tgz", + "integrity": "sha512-GP1+hHS/IVW1tAOIDS44PxCpvSl9PBU/KAB40WgP27UMvSy43LjHxGlP6hQQOdIfmBLBTvGvn2n+Z5kW2gzAzg==", + "requires": { + "underscore": "1.9.1", + "web3-core": "1.2.0", + "web3-core-helpers": "1.2.0", + "web3-core-method": "1.2.0", + "web3-core-subscriptions": "1.2.0", + "web3-eth-abi": "1.2.0", + "web3-eth-accounts": "1.2.0", + "web3-eth-contract": "1.2.0", + "web3-eth-ens": "1.2.0", + "web3-eth-iban": "1.2.0", + "web3-eth-personal": "1.2.0", + "web3-net": "1.2.0", + "web3-utils": "1.2.0" } }, "web3-eth-abi": { - "version": "1.0.0-beta.55", - "resolved": "https://registry.npmjs.org/web3-eth-abi/-/web3-eth-abi-1.0.0-beta.55.tgz", - "integrity": "sha512-3h1xnm/vYmKUXTOYAOP0OsB5uijQV76pNNRGKOB6Dq6GR1pbcbD3WrB/4I643YA8l91t5FRzFzUiA3S77R2iqw==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/web3-eth-abi/-/web3-eth-abi-1.2.0.tgz", + "integrity": "sha512-FDuPq/tFeMg/D/f7cNSmvVYkMYb1z379gUUzSL8ZFtZrdHPkezq+lq/TmWmbCOMLYNXlhGJBzjGdLXRS4Upprg==", "requires": { - "@babel/runtime": "^7.3.1", - "ethers": "^4.0.27", - "lodash": "^4.17.11", - "web3-utils": "1.0.0-beta.55" + "ethers": "4.0.0-beta.3", + "underscore": "1.9.1", + "web3-utils": "1.2.0" } }, "web3-eth-accounts": { - "version": "1.0.0-beta.55", - "resolved": "https://registry.npmjs.org/web3-eth-accounts/-/web3-eth-accounts-1.0.0-beta.55.tgz", - "integrity": "sha512-VfzvwpSDHXqRVelIxsBVhgbV9BkFvhJ/q+bKhnVUUXV0JAhMK/7uC92TsqKk4EBYuqpHyZ1jjqrL4n03fMU7zw==", - "requires": { - "@babel/runtime": "^7.3.1", - "browserify-cipher": "^1.0.1", - "eth-lib": "0.2.8", - "lodash": "^4.17.11", - "pbkdf2": "^3.0.17", - "randombytes": "^2.1.0", - "scrypt.js": "0.3.0", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/web3-eth-accounts/-/web3-eth-accounts-1.2.0.tgz", + "integrity": "sha512-d/fUAL3F6HqstvEiBnZ1RwZ77/DytgF9d6A3mWVvPOUk2Pqi77PM0adRvsKvIWUaQ/k6OoCk/oXtbzaO7CyGpg==", + "requires": { + "any-promise": "1.3.0", + "crypto-browserify": "3.12.0", + "eth-lib": "0.2.7", + "scrypt.js": "^0.3.0", + "underscore": "1.9.1", "uuid": "3.3.2", - "web3-core": "1.0.0-beta.55", - "web3-core-helpers": "1.0.0-beta.55", - "web3-core-method": "1.0.0-beta.55", - "web3-providers": "1.0.0-beta.55", - "web3-utils": "1.0.0-beta.55" + "web3-core": "1.2.0", + "web3-core-helpers": "1.2.0", + "web3-core-method": "1.2.0", + "web3-utils": "1.2.0" }, "dependencies": { + "eth-lib": { + "version": "0.2.7", + "resolved": "https://registry.npmjs.org/eth-lib/-/eth-lib-0.2.7.tgz", + "integrity": "sha1-L5Pxex4jrsN1nNSj/iDBKGo/wco=", + "requires": { + "bn.js": "^4.11.6", + "elliptic": "^6.4.0", + "xhr-request-promise": "^0.1.2" + } + }, "uuid": { "version": "3.3.2", "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz", @@ -17076,112 +17237,146 @@ } }, "web3-eth-contract": { - "version": "1.0.0-beta.55", - "resolved": "https://registry.npmjs.org/web3-eth-contract/-/web3-eth-contract-1.0.0-beta.55.tgz", - "integrity": "sha512-v6oB1wfH039/A5sTb4ZTKX++fcBTHEkuQGpq50ATIDoxP/UTz2+6S+iL+3sCJTsByPw2/Bni/HM7NmLkXqzg/Q==", - "requires": { - "@babel/runtime": "^7.3.1", - "@types/bn.js": "^4.11.4", - "lodash": "^4.17.11", - "web3-core": "1.0.0-beta.55", - "web3-core-helpers": "1.0.0-beta.55", - "web3-core-method": "1.0.0-beta.55", - "web3-core-subscriptions": "1.0.0-beta.55", - "web3-eth-abi": "1.0.0-beta.55", - "web3-eth-accounts": "1.0.0-beta.55", - "web3-providers": "1.0.0-beta.55", - "web3-utils": "1.0.0-beta.55" + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/web3-eth-contract/-/web3-eth-contract-1.2.0.tgz", + "integrity": "sha512-hfjozNbfsoMeR3QklfkwU0Mqcw6YRD4y1Cb1ghGWNhFy2+/sbvKcQNPPJDKFTde22PRzGQBWyh/nb422Sux4bQ==", + "requires": { + "underscore": "1.9.1", + "web3-core": "1.2.0", + "web3-core-helpers": "1.2.0", + "web3-core-method": "1.2.0", + "web3-core-promievent": "1.2.0", + "web3-core-subscriptions": "1.2.0", + "web3-eth-abi": "1.2.0", + "web3-utils": "1.2.0" } }, "web3-eth-ens": { - "version": "1.0.0-beta.55", - "resolved": "https://registry.npmjs.org/web3-eth-ens/-/web3-eth-ens-1.0.0-beta.55.tgz", - "integrity": "sha512-jEL17coO0FJXb7KYq4+7DhVXj0Rh+wHfZ86jOvFUvJsRaUHfqK2TlMatuhD2mbrmxpBYb6oMPnXVnNK9bnD5Rg==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/web3-eth-ens/-/web3-eth-ens-1.2.0.tgz", + "integrity": "sha512-kE6uHMLwH9dv+MZSKT7BcKXcQ6CcLP5m5mM44s2zg2e9Rl20F3J6R3Ik6sLc/w2ywdCwTe/Z22yEstHXQwu5ig==", "requires": { - "@babel/runtime": "^7.3.1", "eth-ens-namehash": "2.0.8", - "lodash": "^4.17.11", - "web3-core": "1.0.0-beta.55", - "web3-core-helpers": "1.0.0-beta.55", - "web3-core-method": "1.0.0-beta.55", - "web3-eth-abi": "1.0.0-beta.55", - "web3-eth-accounts": "1.0.0-beta.55", - "web3-eth-contract": "1.0.0-beta.55", - "web3-net": "1.0.0-beta.55", - "web3-providers": "1.0.0-beta.55", - "web3-utils": "1.0.0-beta.55" + "underscore": "1.9.1", + "web3-core": "1.2.0", + "web3-core-helpers": "1.2.0", + "web3-core-promievent": "1.2.0", + "web3-eth-abi": "1.2.0", + "web3-eth-contract": "1.2.0", + "web3-utils": "1.2.0" } }, "web3-eth-iban": { - "version": "1.0.0-beta.55", - "resolved": "https://registry.npmjs.org/web3-eth-iban/-/web3-eth-iban-1.0.0-beta.55.tgz", - "integrity": "sha512-a2Fxsb5Mssa+jiXgjUdIzJipE0175IcQXJbZLpKft2+zeSJWNTbaa3PQD2vPPpIM4W789q06N+f9Zc0Fyls+1g==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/web3-eth-iban/-/web3-eth-iban-1.2.0.tgz", + "integrity": "sha512-6DzTx/cvIgEvxadhJjLGpsuDUARA4RKskNOuwWYUsUODcPb50rsfMmRkHhGtLss/sNXVE5gNjbT9rX3TDqy2tg==", "requires": { - "@babel/runtime": "^7.3.1", "bn.js": "4.11.8", - "web3-utils": "1.0.0-beta.55" + "web3-utils": "1.2.0" } }, "web3-eth-personal": { - "version": "1.0.0-beta.55", - "resolved": "https://registry.npmjs.org/web3-eth-personal/-/web3-eth-personal-1.0.0-beta.55.tgz", - "integrity": "sha512-H0mahLQx6Oj7lpgTamKAswr3rHChRUZijeWAar2Hj7BABQlLRKwx8n09nYhxggvvLYQNQS90JjvQue7rAo2LQQ==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/web3-eth-personal/-/web3-eth-personal-1.2.0.tgz", + "integrity": "sha512-8QdcaT6dbdiMC8zEqvDuij8XeI34r2GGdQYGvYBP2UgCm15EZBHgewxO30A+O+j2oIW1/Hu60zP5upnhCuA1Dw==", "requires": { - "@babel/runtime": "^7.3.1", - "web3-core": "1.0.0-beta.55", - "web3-core-helpers": "1.0.0-beta.55", - "web3-core-method": "1.0.0-beta.55", - "web3-eth-accounts": "1.0.0-beta.55", - "web3-net": "1.0.0-beta.55", - "web3-providers": "1.0.0-beta.55", - "web3-utils": "1.0.0-beta.55" + "web3-core": "1.2.0", + "web3-core-helpers": "1.2.0", + "web3-core-method": "1.2.0", + "web3-net": "1.2.0", + "web3-utils": "1.2.0" } }, "web3-net": { - "version": "1.0.0-beta.55", - "resolved": "https://registry.npmjs.org/web3-net/-/web3-net-1.0.0-beta.55.tgz", - "integrity": "sha512-do2WY8+/GArJSWX7k/zZ7nBnV9Y3n6LhPYkwT3LeFqDzD515bKwlomaNC8hOaTc6UQyXIoPprYTK2FevL7jrZw==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/web3-net/-/web3-net-1.2.0.tgz", + "integrity": "sha512-7iD8C6vvx8APXPMmlpPLGWjn4bsXHzd3BTdFzKjkoYjiiVFJdVAbY3j1BwN/6tVQu8Ay7sDpV2EdTNub7GKbyw==", + "requires": { + "web3-core": "1.2.0", + "web3-core-method": "1.2.0", + "web3-utils": "1.2.0" + } + }, + "web3-providers-http": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/web3-providers-http/-/web3-providers-http-1.2.0.tgz", + "integrity": "sha512-UrUn6JSz7NVCZ+0nZZtC4cmbl5JIi57w1flL1jN8jgkfdWDdErNvTkSwCt/QYdTQscMaUtWXDDOSAsVO6YC64g==", + "requires": { + "web3-core-helpers": "1.2.0", + "xhr2-cookies": "1.1.0" + } + }, + "web3-providers-ipc": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/web3-providers-ipc/-/web3-providers-ipc-1.2.0.tgz", + "integrity": "sha512-T2OSbiqu7+dahbGG5YFEQM5+FXdLVvaTCKmHXaQpw8IuL5hw7HELtyFOtHVudgDRyw0tJKxIfAiX/v2F1IL1fQ==", + "requires": { + "oboe": "2.1.4", + "underscore": "1.9.1", + "web3-core-helpers": "1.2.0" + } + }, + "web3-providers-ws": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/web3-providers-ws/-/web3-providers-ws-1.2.0.tgz", + "integrity": "sha512-rnwGcCe6cev5A6eG5UBCQqPmkJVZMCrK+HN1AvUCco0OHD/0asGc9LuLbtkQIyznA6Lzetq/OOcaTOM4KeT11g==", "requires": { - "@babel/runtime": "^7.3.1", - "lodash": "^4.17.11", - "web3-core": "1.0.0-beta.55", - "web3-core-helpers": "1.0.0-beta.55", - "web3-core-method": "1.0.0-beta.55", - "web3-providers": "1.0.0-beta.55", - "web3-utils": "1.0.0-beta.55" + "underscore": "1.9.1", + "web3-core-helpers": "1.2.0", + "websocket": "github:frozeman/WebSocket-Node#browserifyCompatible" } }, "web3-shh": { - "version": "1.0.0-beta.55", - "resolved": "https://registry.npmjs.org/web3-shh/-/web3-shh-1.0.0-beta.55.tgz", - "integrity": "sha512-lGP2HQ/1ThNnfoU8677aL48KsTx4Ht+2KQIn39dGpxVZqysQmovQIltbymVnAr4h8wofwcEz46iNHGa+PAyNzA==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/web3-shh/-/web3-shh-1.2.0.tgz", + "integrity": "sha512-VFjS8kvsQBodudFmIoVJWvDNZosONJZZnhvktngD3POu5dwbJmSCl6lzbLJ2C5XjR15dF+JvSstAkWbM+2sdPg==", "requires": { - "@babel/runtime": "^7.3.1", - "web3-core": "1.0.0-beta.55", - "web3-core-helpers": "1.0.0-beta.55", - "web3-core-method": "1.0.0-beta.55", - "web3-core-subscriptions": "1.0.0-beta.55", - "web3-net": "1.0.0-beta.55", - "web3-providers": "1.0.0-beta.55", - "web3-utils": "1.0.0-beta.55" + "web3-core": "1.2.0", + "web3-core-method": "1.2.0", + "web3-core-subscriptions": "1.2.0", + "web3-net": "1.2.0" } }, "web3-utils": { - "version": "1.0.0-beta.55", - "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-1.0.0-beta.55.tgz", - "integrity": "sha512-ASWqUi8gtWK02Tp8ZtcoAbHenMpQXNvHrakgzvqTNNZn26wgpv+Q4mdPi0KOR6ZgHFL8R/9b5BBoUTglS1WPpg==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-1.2.0.tgz", + "integrity": "sha512-tI1low8ICoaWU2c53cikH0rsksKuIskI2nycH5E5sEXxxl9/BOD3CeDDBFbxgNPQ+bpDevbR7gXNEDB7Ud4G9g==", "requires": { - "@babel/runtime": "^7.3.1", - "@types/bn.js": "^4.11.4", - "@types/node": "^10.12.18", "bn.js": "4.11.8", - "eth-lib": "0.2.8", - "ethjs-unit": "^0.1.6", - "lodash": "^4.17.11", + "eth-lib": "0.2.7", + "ethjs-unit": "0.1.6", "number-to-bn": "1.7.0", - "randombytes": "^2.1.0", - "utf8": "2.1.1" + "randomhex": "0.1.5", + "underscore": "1.9.1", + "utf8": "3.0.0" + }, + "dependencies": { + "eth-lib": { + "version": "0.2.7", + "resolved": "https://registry.npmjs.org/eth-lib/-/eth-lib-0.2.7.tgz", + "integrity": "sha1-L5Pxex4jrsN1nNSj/iDBKGo/wco=", + "requires": { + "bn.js": "^4.11.6", + "elliptic": "^6.4.0", + "xhr-request-promise": "^0.1.2" + } + } + } + }, + "websocket": { + "version": "github:frozeman/WebSocket-Node#6c72925e3f8aaaea8dc8450f97627e85263999f2", + "from": "github:frozeman/WebSocket-Node#browserifyCompatible", + "requires": { + "debug": "^2.2.0", + "nan": "^2.3.3", + "typedarray-to-buffer": "^3.1.2", + "yaeti": "^0.0.6" } + }, + "yallist": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.0.3.tgz", + "integrity": "sha512-S+Zk8DEWE6oKpV+vI3qWkaK+jSbIK86pCwe2IF/xwIpQ8jEuxpw9NyaGjmp9+BoJv5FV2piqCDcoCtStppiq2A==" } } }, @@ -17471,138 +17666,6 @@ "web3-utils": "1.0.0-beta.37" } }, - "web3-providers": { - "version": "1.0.0-beta.55", - "resolved": "https://registry.npmjs.org/web3-providers/-/web3-providers-1.0.0-beta.55.tgz", - "integrity": "sha512-MNifc7W+iF6rykpbDR1MuX152jshWdZXHAU9Dk0Ja2/23elhIs4nCWs7wOX9FHrKgdrQbscPoq0uy+0aGzyWVQ==", - "requires": { - "@babel/runtime": "^7.3.1", - "@types/node": "^10.12.18", - "eventemitter3": "3.1.0", - "lodash": "^4.17.11", - "url-parse": "1.4.4", - "web3-core": "1.0.0-beta.55", - "web3-core-helpers": "1.0.0-beta.55", - "web3-core-method": "1.0.0-beta.55", - "web3-utils": "1.0.0-beta.55", - "websocket": "^1.0.28", - "xhr2-cookies": "1.1.0" - }, - "dependencies": { - "@types/node": { - "version": "10.14.9", - "resolved": "https://registry.npmjs.org/@types/node/-/node-10.14.9.tgz", - "integrity": "sha512-NelG/dSahlXYtSoVPErrp06tYFrvzj8XLWmKA+X8x0W//4MqbUyZu++giUG/v0bjAT6/Qxa8IjodrfdACyb0Fg==" - }, - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "requires": { - "ms": "2.0.0" - } - }, - "eth-lib": { - "version": "0.2.8", - "resolved": "https://registry.npmjs.org/eth-lib/-/eth-lib-0.2.8.tgz", - "integrity": "sha512-ArJ7x1WcWOlSpzdoTBX8vkwlkSQ85CjjifSZtV4co64vWxSV8geWfPI9x4SVYu3DSxnX4yWFVTtGL+j9DUFLNw==", - "requires": { - "bn.js": "^4.11.6", - "elliptic": "^6.4.0", - "xhr-request-promise": "^0.1.2" - } - }, - "web3-core": { - "version": "1.0.0-beta.55", - "resolved": "https://registry.npmjs.org/web3-core/-/web3-core-1.0.0-beta.55.tgz", - "integrity": "sha512-AMMp7TLEtE7u8IJAu/THrRhBTZyZzeo7Y6GiWYNwb5+KStC9hIGLr9cI1KX9R6ZioTOLRHrqT7awDhnJ1ku2mg==", - "requires": { - "@babel/runtime": "^7.3.1", - "@types/bn.js": "^4.11.4", - "@types/node": "^10.12.18", - "lodash": "^4.17.11", - "web3-core-method": "1.0.0-beta.55", - "web3-providers": "1.0.0-beta.55", - "web3-utils": "1.0.0-beta.55" - } - }, - "web3-core-helpers": { - "version": "1.0.0-beta.55", - "resolved": "https://registry.npmjs.org/web3-core-helpers/-/web3-core-helpers-1.0.0-beta.55.tgz", - "integrity": "sha512-suj9Xy/lIqajaYLJTEjr2rlFgu6hGYwChHmf8+qNrC2luZA6kirTamtB9VThWMxbywx7p0bqQFjW6zXogAgWhg==", - "requires": { - "@babel/runtime": "^7.3.1", - "lodash": "^4.17.11", - "web3-core": "1.0.0-beta.55", - "web3-eth-iban": "1.0.0-beta.55", - "web3-utils": "1.0.0-beta.55" - } - }, - "web3-core-method": { - "version": "1.0.0-beta.55", - "resolved": "https://registry.npmjs.org/web3-core-method/-/web3-core-method-1.0.0-beta.55.tgz", - "integrity": "sha512-w1cW/s2ji9qGELHk2uMJCn1ooay0JJLVoPD1nvmsW6OTRWcVjxa62nJrFQhe6P5lEb83Xk9oHgmCxZoVUHibOw==", - "requires": { - "@babel/runtime": "^7.3.1", - "eventemitter3": "3.1.0", - "lodash": "^4.17.11", - "rxjs": "^6.4.0", - "web3-core": "1.0.0-beta.55", - "web3-core-helpers": "1.0.0-beta.55", - "web3-core-subscriptions": "1.0.0-beta.55", - "web3-utils": "1.0.0-beta.55" - } - }, - "web3-core-subscriptions": { - "version": "1.0.0-beta.55", - "resolved": "https://registry.npmjs.org/web3-core-subscriptions/-/web3-core-subscriptions-1.0.0-beta.55.tgz", - "integrity": "sha512-pb3oQbUzK7IoyXwag8TYInQddg0rr7BHxKc+Pbs/92hVNQ5ps4iGMVJKezdrjlQ1IJEEUiDIglXl4LZ1hIuMkw==", - "requires": { - "@babel/runtime": "^7.3.1", - "eventemitter3": "^3.1.0", - "lodash": "^4.17.11" - } - }, - "web3-eth-iban": { - "version": "1.0.0-beta.55", - "resolved": "https://registry.npmjs.org/web3-eth-iban/-/web3-eth-iban-1.0.0-beta.55.tgz", - "integrity": "sha512-a2Fxsb5Mssa+jiXgjUdIzJipE0175IcQXJbZLpKft2+zeSJWNTbaa3PQD2vPPpIM4W789q06N+f9Zc0Fyls+1g==", - "requires": { - "@babel/runtime": "^7.3.1", - "bn.js": "4.11.8", - "web3-utils": "1.0.0-beta.55" - } - }, - "web3-utils": { - "version": "1.0.0-beta.55", - "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-1.0.0-beta.55.tgz", - "integrity": "sha512-ASWqUi8gtWK02Tp8ZtcoAbHenMpQXNvHrakgzvqTNNZn26wgpv+Q4mdPi0KOR6ZgHFL8R/9b5BBoUTglS1WPpg==", - "requires": { - "@babel/runtime": "^7.3.1", - "@types/bn.js": "^4.11.4", - "@types/node": "^10.12.18", - "bn.js": "4.11.8", - "eth-lib": "0.2.8", - "ethjs-unit": "^0.1.6", - "lodash": "^4.17.11", - "number-to-bn": "1.7.0", - "randombytes": "^2.1.0", - "utf8": "2.1.1" - } - }, - "websocket": { - "version": "1.0.28", - "resolved": "https://registry.npmjs.org/websocket/-/websocket-1.0.28.tgz", - "integrity": "sha512-00y/20/80P7H4bCYkzuuvvfDvh+dgtXi5kzDf3UcZwN6boTYaKvsrtZ5lIYm1Gsg48siMErd9M4zjSYfYFHTrA==", - "requires": { - "debug": "^2.2.0", - "nan": "^2.11.0", - "typedarray-to-buffer": "^3.1.5", - "yaeti": "^0.0.6" - } - } - } - }, "web3-providers-http": { "version": "1.0.0-beta.37", "resolved": "https://registry.npmjs.org/web3-providers-http/-/web3-providers-http-1.0.0-beta.37.tgz", diff --git a/client/package.json b/client/package.json index 3eb5166..81c0850 100644 --- a/client/package.json +++ b/client/package.json @@ -17,7 +17,7 @@ "react-scripts": "^2.1.8", "react-transition-group": "^2.9.0", "uuid": "^3.3.2", - "web3": "^1.0.0-beta.55" + "web3": "^1.2.0" }, "scripts": { "start": "react-scripts start", From 32f2321f880cb92e6cb2c410c72c80f5e53bb817 Mon Sep 17 00:00:00 2001 From: James Quinn Date: Wed, 24 Jul 2019 22:24:59 +0200 Subject: [PATCH 081/425] Added pre trade form --- client/src/components/layout/PreTradeForm.js | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 client/src/components/layout/PreTradeForm.js diff --git a/client/src/components/layout/PreTradeForm.js b/client/src/components/layout/PreTradeForm.js new file mode 100644 index 0000000..efa47cf --- /dev/null +++ b/client/src/components/layout/PreTradeForm.js @@ -0,0 +1,7 @@ +import React from "react"; + +const PreTradeForm = () => { + return
            Addresses/ENS
            ; +}; + +export default PreTradeFor; From 3d06ee339b329fe983a990d404d3896928cc3623 Mon Sep 17 00:00:00 2001 From: James Quinn Date: Thu, 25 Jul 2019 18:43:17 +0200 Subject: [PATCH 082/425] Added skeleton --- client/src/components/layout/PreTradeForm.js | 90 +++++++++++++++++++- 1 file changed, 87 insertions(+), 3 deletions(-) diff --git a/client/src/components/layout/PreTradeForm.js b/client/src/components/layout/PreTradeForm.js index efa47cf..9f20560 100644 --- a/client/src/components/layout/PreTradeForm.js +++ b/client/src/components/layout/PreTradeForm.js @@ -1,7 +1,91 @@ -import React from "react"; +import React, { useState, useEffect, useContext } from "react"; + +import TradeContext from "../../context/trade/TradeContext"; +import Web3Context from "../../context/web3/Web3Context"; +import EnsContext from "../../context/ens/EnsContext"; const PreTradeForm = () => { - return
            Addresses/ENS
            ; + const tradeContext = useContext(TradeContext); + const web3Context = useContext(Web3Context); + const ensContext = useContext(EnsContext); + + //get ens checker + //get web3 connection + //get web3 address validator + //get trade address and ens setter + //get trade validation setter + + const [formState, setFormState] = useState({ + input1: "", + address1: null, + ens1: null, + input1: "", + address1: null, + ens1: null + }); + + const { input1, address1, ens1, input2, address2, ens2 } = formState; + + //Input + useEffect(() => { + checkInput(1); + }, [input1]); + + useEffect(() => { + checkInput(2); + }, [input2]); + + checkInput = inputNum => { + inputNum === 1 && + { + //check if input1 is valid ens address + //*if true, check whether it points to a valid address + //**if true, ens1 = input1, address1 = returned ens address, valid = true and return + //*else, ens1 to null + //else, check if input1 is valid address + //*if true, set address1 = input1, valid = true and return + //else, address1 = null, valid = false, push to context and return + }; + + //check if input2 is valid ens address + //*if true, check whether it points to a valid address + //**if true, ens2 = input2, address2 = returned ens address, valid = true and return + //*else, ens2 to null + //else, check if input2 is valid address + //*if true, set address2 = input2, valid = true and return + //address2 = null, valid = false, push to context and return + }; + + const onChange = e => { + setFormState({ ...formState, [e.target.name]: e.target.value }); + }; + + const onSubmit = e => { + e.preventDefault(); + + checkInput(1); + checkInput(2); + //Push to context state + }; + + return ( +
            + + +
            + ); }; -export default PreTradeFor; +export default PreTradeForm; From 41a2c570ea168c50512c16fc7f827f00c63e3291 Mon Sep 17 00:00:00 2001 From: James Quinn Date: Thu, 25 Jul 2019 18:46:25 +0200 Subject: [PATCH 083/425] Added form --- client/src/components/layout/PreTradeForm.js | 20 +++++++++----------- client/src/components/pages/Home.js | 2 ++ 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/client/src/components/layout/PreTradeForm.js b/client/src/components/layout/PreTradeForm.js index 9f20560..f3e879e 100644 --- a/client/src/components/layout/PreTradeForm.js +++ b/client/src/components/layout/PreTradeForm.js @@ -35,17 +35,15 @@ const PreTradeForm = () => { checkInput(2); }, [input2]); - checkInput = inputNum => { - inputNum === 1 && - { - //check if input1 is valid ens address - //*if true, check whether it points to a valid address - //**if true, ens1 = input1, address1 = returned ens address, valid = true and return - //*else, ens1 to null - //else, check if input1 is valid address - //*if true, set address1 = input1, valid = true and return - //else, address1 = null, valid = false, push to context and return - }; + const checkInput = inputNum => { + inputNum === 1 && console.log("checking"); + //check if input1 is valid ens address + //*if true, check whether it points to a valid address + //**if true, ens1 = input1, address1 = returned ens address, valid = true and return + //*else, ens1 to null + //else, check if input1 is valid address + //*if true, set address1 = input1, valid = true and return + //else, address1 = null, valid = false, push to context and return //check if input2 is valid ens address //*if true, check whether it points to a valid address diff --git a/client/src/components/pages/Home.js b/client/src/components/pages/Home.js index b734241..33726be 100644 --- a/client/src/components/pages/Home.js +++ b/client/src/components/pages/Home.js @@ -1,5 +1,6 @@ import React, { useEffect, useContext, Fragment } from "react"; +import PreTradeForm from "../layout/PreTradeForm"; import Box from "../tradeBox/Box"; import AppContext from "./../../context/app/AppContext"; import TradeContext from "./../../context/trade/TradeContext"; @@ -18,6 +19,7 @@ const Home = props => { return (
            + {userBox === 0 ? : } {userBox === 1 ? : }
            From c749646e94279fc09f52a7b6fa27c1210dc5622c Mon Sep 17 00:00:00 2001 From: James Quinn Date: Fri, 26 Jul 2019 10:56:18 +0200 Subject: [PATCH 084/425] Updated dependencies --- client/package-lock.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/package-lock.json b/client/package-lock.json index 63ffa9f..8499bed 100644 --- a/client/package-lock.json +++ b/client/package-lock.json @@ -10178,7 +10178,7 @@ "dependencies": { "minimist": { "version": "0.0.10", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.10.tgz", + "resolved": "http://registry.npmjs.org/minimist/-/minimist-0.0.10.tgz", "integrity": "sha1-3j+YVD2/lggr5IrRoMfNqDYwHc8=" }, "wordwrap": { @@ -15575,7 +15575,7 @@ }, "sprintf-js": { "version": "1.0.3", - "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "resolved": "http://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=" }, "sshpk": { From 8443c14f2c89bb331d7b41235178f969aebab0b8 Mon Sep 17 00:00:00 2001 From: James Quinn Date: Fri, 26 Jul 2019 11:15:32 +0200 Subject: [PATCH 085/425] Added to css --- client/src/App.css | 81 +++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 80 insertions(+), 1 deletion(-) diff --git a/client/src/App.css b/client/src/App.css index 2a9b2f6..cf26074 100644 --- a/client/src/App.css +++ b/client/src/App.css @@ -88,6 +88,22 @@ img { text-align: left; } +/* Cards */ +.card { + padding: 1rem; + border: #ccc 1px dotted; + margin: 0.7rem 0; +} + +/* List */ +.list { + margin: 0.5rem 0; +} + +.list li { + padding-bottom: 0.3rem; +} + /* Padding */ .p { padding: 0.5rem; @@ -140,7 +156,70 @@ img { margin: 3rem 0; } -/**/ +/* Grid */ +.grid-2 { + display: grid; + grid-template-columns: repeat(2, 1fr); + grid-gap: 2rem; +} + +.grid-3 { + display: grid; + grid-template-columns: repeat(3, 1fr); + grid-gap: 1rem; +} + +.grid-4 { + display: grid; + grid-template-columns: repeat(4, 1fr); + grid-gap: 2rem; +} + +.grid-2-3 { + display: grid; + grid-template-columns: 2fr 3fr; + grid-gap: 2rem; +} + +.btn { + display: inline-block; + background: var(--light-color); + color: #333; + padding: 0.4rem 1.3rem; + font-size: 1rem; + border: none; + cursor: pointer; + margin-right: 0.5rem; + transition: opacity 0.2s ease-in; + outline: none; +} + +.btn-link { + background: none; + padding: 0; + margin: 0; +} + +.btn-block { + display: block; + width: 100%; +} + +.btn-sm { + font-size: 0.8rem; + padding: 0.3rem 1rem; + margin-right: 0.2rem; +} + +.badge { + font-size: 0.8rem; + padding: 0.2rem 0.7rem; + text-align: center; + margin: 0.3rem; + background: var(--light-color); + color: #333; + border-radius: 5px; +} .alert { padding: 0.7rem; From 3ae27e84603ef7d298b3d72831065952c6d141dd Mon Sep 17 00:00:00 2001 From: James Quinn Date: Fri, 26 Jul 2019 11:15:58 +0200 Subject: [PATCH 086/425] Switched home msg --- client/src/components/layout/Navbar.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/client/src/components/layout/Navbar.js b/client/src/components/layout/Navbar.js index 6e74fd3..7f99378 100644 --- a/client/src/components/layout/Navbar.js +++ b/client/src/components/layout/Navbar.js @@ -40,7 +40,9 @@ const Navbar = ({ title, icon }) => {
            • - {location === "home" ? networkText() : "Home"} + + {location === "home" ? networkText() : "Trade Windows"} +
            • From 32156ea1f6f5b113210f7ff8259616c2ac3d748c Mon Sep 17 00:00:00 2001 From: James Quinn Date: Fri, 26 Jul 2019 11:16:21 +0200 Subject: [PATCH 087/425] Added block style to buttons --- client/src/components/layout/PreTradeForm.js | 7 ++++++- client/src/components/tradeBox/ItemForm.js | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/client/src/components/layout/PreTradeForm.js b/client/src/components/layout/PreTradeForm.js index f3e879e..0529c6e 100644 --- a/client/src/components/layout/PreTradeForm.js +++ b/client/src/components/layout/PreTradeForm.js @@ -67,7 +67,7 @@ const PreTradeForm = () => { }; return ( -
              + { value={input2} onChange={onChange} /> +
              ); }; diff --git a/client/src/components/tradeBox/ItemForm.js b/client/src/components/tradeBox/ItemForm.js index c092e52..a30ac27 100644 --- a/client/src/components/tradeBox/ItemForm.js +++ b/client/src/components/tradeBox/ItemForm.js @@ -27,7 +27,7 @@ const ItemForm = () => { //Render return ( -
              + {
              ); From a9b6f4a50dd9fae1ee251cee1db9871c06ef1a46 Mon Sep 17 00:00:00 2001 From: James Quinn Date: Fri, 26 Jul 2019 11:56:12 +0200 Subject: [PATCH 088/425] Added box and trade form styles --- client/src/App.css | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/client/src/App.css b/client/src/App.css index cf26074..fcd2faa 100644 --- a/client/src/App.css +++ b/client/src/App.css @@ -351,6 +351,21 @@ img { color: var(--light-color); } +/* Box */ +.box { + display: flex; + min-height: 3rem; +} + +/* Trade Form */ +.flexColumn { + display: flex; + justify-content: center; + flex-direction: column; + max-width: 42em; + margin: 0 auto; +} + /* Mobile Styles */ @media (max-width: 700px) { .hide-sm { From 750d0d0d3ee2fb2b2e11cd6efb9620be85775882 Mon Sep 17 00:00:00 2001 From: James Quinn Date: Fri, 26 Jul 2019 11:56:26 +0200 Subject: [PATCH 089/425] Added styling --- client/src/components/layout/PreTradeForm.js | 44 ++++++++++---------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/client/src/components/layout/PreTradeForm.js b/client/src/components/layout/PreTradeForm.js index 0529c6e..436c758 100644 --- a/client/src/components/layout/PreTradeForm.js +++ b/client/src/components/layout/PreTradeForm.js @@ -67,27 +67,29 @@ const PreTradeForm = () => { }; return ( -
              - - - -
              +
              +
              + + + +
              +
              ); }; From 159a68165b9e114e430790a7c894a388718864d2 Mon Sep 17 00:00:00 2001 From: James Quinn Date: Fri, 26 Jul 2019 16:37:26 +0200 Subject: [PATCH 090/425] Styling --- client/src/App.css | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/client/src/App.css b/client/src/App.css index fcd2faa..9585571 100644 --- a/client/src/App.css +++ b/client/src/App.css @@ -38,6 +38,10 @@ img { width: 100%; } +input { + margin: 0.2rem; +} + /* Utilities */ .container { max-width: 1100px; @@ -189,7 +193,6 @@ img { font-size: 1rem; border: none; cursor: pointer; - margin-right: 0.5rem; transition: opacity 0.2s ease-in; outline: none; } From a46ce0ab87e192b1b8abc5740d06abf86bbd73d0 Mon Sep 17 00:00:00 2001 From: James Quinn Date: Fri, 26 Jul 2019 16:37:35 +0200 Subject: [PATCH 091/425] Changed button --- client/src/components/layout/PreTradeForm.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/src/components/layout/PreTradeForm.js b/client/src/components/layout/PreTradeForm.js index 436c758..11807b9 100644 --- a/client/src/components/layout/PreTradeForm.js +++ b/client/src/components/layout/PreTradeForm.js @@ -86,7 +86,7 @@ const PreTradeForm = () => {
            From 7d360a445abcd5c910a81df9c806ba2c736b5fe8 Mon Sep 17 00:00:00 2001 From: James Quinn Date: Fri, 26 Jul 2019 16:41:20 +0200 Subject: [PATCH 092/425] Removed sm button class --- client/src/components/layout/PreTradeForm.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/client/src/components/layout/PreTradeForm.js b/client/src/components/layout/PreTradeForm.js index 11807b9..70a0a6f 100644 --- a/client/src/components/layout/PreTradeForm.js +++ b/client/src/components/layout/PreTradeForm.js @@ -83,11 +83,7 @@ const PreTradeForm = () => { value={input2} onChange={onChange} /> - +
      ); From e143efd3c88979c73e1c6a0a37f3b9865af5d32b Mon Sep 17 00:00:00 2001 From: James Quinn Date: Fri, 26 Jul 2019 16:41:32 +0200 Subject: [PATCH 093/425] Removed s --- client/src/components/layout/Navbar.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/src/components/layout/Navbar.js b/client/src/components/layout/Navbar.js index 7f99378..3c5a6ed 100644 --- a/client/src/components/layout/Navbar.js +++ b/client/src/components/layout/Navbar.js @@ -41,7 +41,7 @@ const Navbar = ({ title, icon }) => {
    • - {location === "home" ? networkText() : "Trade Windows"} + {location === "home" ? networkText() : "Trade Window"}
    • From ad4fddfcf88f21805dbf32eff868eb92b0a4fdac Mon Sep 17 00:00:00 2001 From: James Quinn Date: Fri, 26 Jul 2019 16:41:57 +0200 Subject: [PATCH 094/425] Styling --- client/src/App.css | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/client/src/App.css b/client/src/App.css index 9585571..fda4b95 100644 --- a/client/src/App.css +++ b/client/src/App.css @@ -39,7 +39,8 @@ img { } input { - margin: 0.2rem; + margin: 0.1rem; + padding: 0.1rem 0.5em; } /* Utilities */ From f8133c54f11e9ae8626e299da27011f4cd0014cb Mon Sep 17 00:00:00 2001 From: James Quinn Date: Fri, 26 Jul 2019 17:47:40 +0200 Subject: [PATCH 095/425] Added x axis variants to margin and padding --- client/src/App.css | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/client/src/App.css b/client/src/App.css index fda4b95..2e9190a 100644 --- a/client/src/App.css +++ b/client/src/App.css @@ -40,7 +40,7 @@ img { input { margin: 0.1rem; - padding: 0.1rem 0.5em; + padding: 0.5em; } /* Utilities */ @@ -134,6 +134,18 @@ input { .py-3 { padding: 3rem 0; } +.px { + padding: 0 0.5rem; +} +.px-1 { + padding: 0 1rem; +} +.px-2 { + padding: 0 2rem; +} +.px-3 { + padding: 0 3rem; +} /* Margin */ .m { @@ -160,7 +172,18 @@ input { .my-3 { margin: 3rem 0; } - +.mx { + margin: 0 0.5rem; +} +.mx-1 { + margin: 0 1rem; +} +.mx-2 { + margin: 0 2rem; +} +.mx-3 { + margin: 0 3rem; +} /* Grid */ .grid-2 { display: grid; From 42c2e6b751c2b83a6bfb18430f88d6ce5966ec7d Mon Sep 17 00:00:00 2001 From: James Quinn Date: Fri, 26 Jul 2019 18:06:31 +0200 Subject: [PATCH 096/425] Added grow-x --- client/src/App.css | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/client/src/App.css b/client/src/App.css index 2e9190a..f944ef6 100644 --- a/client/src/App.css +++ b/client/src/App.css @@ -69,10 +69,6 @@ input { margin-bottom: 1rem; } -.text-center { - text-align: center; -} - .text-primary { color: var(--primary-color); } @@ -393,6 +389,22 @@ input { margin: 0 auto; } +.flexRow { + display: flex; + flex-direction: row; + margin: 0 auto; +} + +.grow-1 { + flex-grow: 1; +} +.grow-2 { + flex-grow: 2; +} +.grow-3 { + flex-grow: 3; +} + /* Mobile Styles */ @media (max-width: 700px) { .hide-sm { From 252e73538a06adaf5d5871948b90917eec37a275 Mon Sep 17 00:00:00 2001 From: James Quinn Date: Fri, 26 Jul 2019 18:09:43 +0200 Subject: [PATCH 097/425] Styling --- client/src/App.css | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/client/src/App.css b/client/src/App.css index f944ef6..595dad5 100644 --- a/client/src/App.css +++ b/client/src/App.css @@ -385,7 +385,7 @@ input { display: flex; justify-content: center; flex-direction: column; - max-width: 42em; + max-width: 43em; margin: 0 auto; } @@ -404,6 +404,9 @@ input { .grow-3 { flex-grow: 3; } +.address { + max-width: 43em; +} /* Mobile Styles */ @media (max-width: 700px) { From 5fba1366abdbd8e377fce5d7d50a3a18cef7c396 Mon Sep 17 00:00:00 2001 From: James Quinn Date: Fri, 26 Jul 2019 18:10:08 +0200 Subject: [PATCH 098/425] Added new item form --- client/src/components/tradeBox/ItemForm.js | 107 +++++++++++++++------ 1 file changed, 80 insertions(+), 27 deletions(-) diff --git a/client/src/components/tradeBox/ItemForm.js b/client/src/components/tradeBox/ItemForm.js index a30ac27..aa325c0 100644 --- a/client/src/components/tradeBox/ItemForm.js +++ b/client/src/components/tradeBox/ItemForm.js @@ -1,4 +1,4 @@ -import React, { useContext, useState } from "react"; +import React, { Fragment, useContext, useState } from "react"; import TradeContext from "../../context/trade/TradeContext"; @@ -8,12 +8,15 @@ const ItemForm = () => { const { addTradeItem } = tradeContext; const [item, setItem] = useState({ + type: "ens", contractAdd: "", - type: "", - id: "" //id/amount + id: null, + amount: null, + name: null, + verified: true }); - const { contractAdd, type, id } = item; + const { contractAdd, type, id, amount, name, verified } = item; //Input const onChange = e => { @@ -22,37 +25,87 @@ const ItemForm = () => { const onSubmit = e => { e.preventDefault(); + addTradeItem(item); }; + const erc = () => ( + + ); + + const form = () => { + switch (type) { + case "ens": + return ( + + + {verified && ( + VERIFIED + )} + + ); + case "erc20": + return ( + + {erc()} + + + ); + case "erc721": + return ( + + {erc()} + + + ); + + default: + return ""; + } + }; + //Render return (
      - - - +
      + + {form()} +
      From bf2cbd8810d855a0825426572bb63b218ab3035a Mon Sep 17 00:00:00 2001 From: James Quinn Date: Fri, 26 Jul 2019 22:25:06 +0200 Subject: [PATCH 099/425] Styling --- client/src/App.css | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/client/src/App.css b/client/src/App.css index 595dad5..2d38eec 100644 --- a/client/src/App.css +++ b/client/src/App.css @@ -38,7 +38,8 @@ img { width: 100%; } -input { +input, +select { margin: 0.1rem; padding: 0.5em; } @@ -376,8 +377,8 @@ input { /* Box */ .box { - display: flex; - min-height: 3rem; + min-height: 6rem; + margin-top: 0.5rem; } /* Trade Form */ @@ -392,7 +393,9 @@ input { .flexRow { display: flex; flex-direction: row; + flex-wrap: wrap; margin: 0 auto; + max-width: 50em; } .grow-1 { @@ -405,7 +408,7 @@ input { flex-grow: 3; } .address { - max-width: 43em; + max-width: 22rem; } /* Mobile Styles */ @@ -420,19 +423,6 @@ input { grid-template-columns: 1fr; } - /* Text Styles */ - .x-large { - font-size: 3rem; - } - - .large { - font-size: 2rem; - } - - .lead { - font-size: 1rem; - } - /* Navbar */ .navbar { display: block; From 92c3b07c1ec880f5c72fb082360d569a050e4c21 Mon Sep 17 00:00:00 2001 From: James Quinn Date: Fri, 26 Jul 2019 22:25:15 +0200 Subject: [PATCH 100/425] Styling --- client/src/components/layout/PreTradeForm.js | 38 ++++++++++---------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/client/src/components/layout/PreTradeForm.js b/client/src/components/layout/PreTradeForm.js index 70a0a6f..ed8bffd 100644 --- a/client/src/components/layout/PreTradeForm.js +++ b/client/src/components/layout/PreTradeForm.js @@ -67,25 +67,25 @@ const PreTradeForm = () => { }; return ( -
      -
      - - - -
      -
      +
      + + + +
      ); }; From 2be01a3467e20310a0c40a3bec0312dae5d4183f Mon Sep 17 00:00:00 2001 From: James Quinn Date: Fri, 26 Jul 2019 22:25:29 +0200 Subject: [PATCH 101/425] Added Box to box --- client/src/components/tradeBox/Box.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/src/components/tradeBox/Box.js b/client/src/components/tradeBox/Box.js index 2f18421..c37748a 100644 --- a/client/src/components/tradeBox/Box.js +++ b/client/src/components/tradeBox/Box.js @@ -25,8 +25,8 @@ const Box = ({ isUser }) => { }, [isUser, userContext.user, userContext.tradePartner]); return ( -
      - {ens ? ens : address && address} +
      +

      {ens ? ens : address ? address : "Box"}

      {isUser && }
      From 85aff41d014e62b17258c1d83da478fb5b9ece0f Mon Sep 17 00:00:00 2001 From: James Quinn Date: Fri, 26 Jul 2019 22:25:43 +0200 Subject: [PATCH 102/425] Moved submit into flewrow --- client/src/components/tradeBox/ItemForm.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/client/src/components/tradeBox/ItemForm.js b/client/src/components/tradeBox/ItemForm.js index aa325c0..781c368 100644 --- a/client/src/components/tradeBox/ItemForm.js +++ b/client/src/components/tradeBox/ItemForm.js @@ -10,9 +10,9 @@ const ItemForm = () => { const [item, setItem] = useState({ type: "ens", contractAdd: "", - id: null, - amount: null, - name: null, + id: "", + amount: "", + name: "", verified: true }); @@ -102,12 +102,12 @@ const ItemForm = () => { {form()} +
      - ); }; From 2f66a50a924b0b0af3e70e67af3bc1a42146884a Mon Sep 17 00:00:00 2001 From: James Quinn Date: Sat, 27 Jul 2019 01:40:45 +0200 Subject: [PATCH 103/425] Added shadows --- client/src/App.css | 40 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 36 insertions(+), 4 deletions(-) diff --git a/client/src/App.css b/client/src/App.css index 2d38eec..09be5e3 100644 --- a/client/src/App.css +++ b/client/src/App.css @@ -41,7 +41,7 @@ img { input, select { margin: 0.1rem; - padding: 0.5em; + padding: 0.2rem; } /* Utilities */ @@ -181,6 +181,10 @@ select { .mx-3 { margin: 0 3rem; } +.mtop-2 { + margin-top: 2rem; +} + /* Grid */ .grid-2 { display: grid; @@ -377,12 +381,14 @@ select { /* Box */ .box { - min-height: 6rem; - margin-top: 0.5rem; + min-height: 10rem; + margin: 1rem; + padding: 0.25rem; } /* Trade Form */ .flexColumn { + /*TODO*/ display: flex; justify-content: center; flex-direction: column; @@ -390,7 +396,7 @@ select { margin: 0 auto; } -.flexRow { +.flex-row { display: flex; flex-direction: row; flex-wrap: wrap; @@ -411,6 +417,32 @@ select { max-width: 22rem; } +.shadow { + box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.5); +} +.shadow-top { + box-shadow: 0px -5px 5px -5px rgba(0, 0, 0, 0.5); +} +.shadow-bot { + box-shadow: 0px 5px 5px -5px rgba(0, 0, 0, 0.5); +} +.shadow-bot-7 { + box-shadow: 0px 7px 5px -5px rgba(0, 0, 0, 0.5); +} +.shadow-right { + box-shadow: 5px 0px 5px -5px rgba(0, 0, 0, 0.5); +} +.shadow-left { + box-shadow: -5px 0px 5px -5px rgba(0, 0, 0, 0.5); +} +.item { + display: flex; + flex-direction: row; + justify-content: space-around; + padding-top: 0.5rem; + padding-bottom: 0.4rem; +} + /* Mobile Styles */ @media (max-width: 700px) { .hide-sm { From 824f0ed3ac108f515cfb164935cb079a763a8100 Mon Sep 17 00:00:00 2001 From: James Quinn Date: Sat, 27 Jul 2019 01:40:57 +0200 Subject: [PATCH 104/425] Styling --- client/src/components/layout/PreTradeForm.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/src/components/layout/PreTradeForm.js b/client/src/components/layout/PreTradeForm.js index ed8bffd..5e60e2b 100644 --- a/client/src/components/layout/PreTradeForm.js +++ b/client/src/components/layout/PreTradeForm.js @@ -84,7 +84,7 @@ const PreTradeForm = () => { value={input2} onChange={onChange} /> - + ); }; From 6231d7be9c191af6d113e685cb9c6b375a65c145 Mon Sep 17 00:00:00 2001 From: James Quinn Date: Sat, 27 Jul 2019 01:41:42 +0200 Subject: [PATCH 105/425] Box styling --- client/src/components/tradeBox/Box.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/client/src/components/tradeBox/Box.js b/client/src/components/tradeBox/Box.js index c37748a..a2d22f3 100644 --- a/client/src/components/tradeBox/Box.js +++ b/client/src/components/tradeBox/Box.js @@ -25,9 +25,13 @@ const Box = ({ isUser }) => { }, [isUser, userContext.user, userContext.tradePartner]); return ( -
      -

      {ens ? ens : address ? address : "Box"}

      - +
      +
      +

      + {ens ? ens : address ? address : "Box"} +

      + +
      {isUser && }
      ); From cb2ffef0d0ab1ceea05ff1dd1988319786eb3573 Mon Sep 17 00:00:00 2001 From: James Quinn Date: Sat, 27 Jul 2019 01:42:03 +0200 Subject: [PATCH 106/425] Aded item styling to css --- client/src/components/tradeBox/Items.js | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/client/src/components/tradeBox/Items.js b/client/src/components/tradeBox/Items.js index ddc9fa1..6ed299f 100644 --- a/client/src/components/tradeBox/Items.js +++ b/client/src/components/tradeBox/Items.js @@ -30,7 +30,7 @@ const Items = ({ isUser }) => { return ( items.length > 0 && items.map(item => ( -
      +

      ID:{item.id}

      {internal(item)}
      @@ -38,13 +38,6 @@ const Items = ({ isUser }) => { ); }; -const itemStyle = { - display: "flex", - flexDirection: "row", - justifyContent: "space-around", - boxShadow: "0px 5px 5px -5px rgba(0,0,0,0.5)" -}; - Items.propTypes = { isUser: PropTypes.bool.isRequired }; From 8ad30b517623f1ba6137e077ce647c8dfc1c5390 Mon Sep 17 00:00:00 2001 From: James Quinn Date: Sat, 27 Jul 2019 01:42:21 +0200 Subject: [PATCH 107/425] Styling --- client/src/components/tradeBox/ItemForm.js | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/client/src/components/tradeBox/ItemForm.js b/client/src/components/tradeBox/ItemForm.js index 781c368..fba6897 100644 --- a/client/src/components/tradeBox/ItemForm.js +++ b/client/src/components/tradeBox/ItemForm.js @@ -94,19 +94,15 @@ const ItemForm = () => { //Render return ( -
      -
      + +
      {form()} - +
      ); From 93550343d5cf95e43270781579ac6c05b409ff93 Mon Sep 17 00:00:00 2001 From: James Quinn Date: Sat, 27 Jul 2019 01:52:49 +0200 Subject: [PATCH 108/425] Fixed name --- client/src/components/tradeBox/Box.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/src/components/tradeBox/Box.js b/client/src/components/tradeBox/Box.js index a2d22f3..7980c7f 100644 --- a/client/src/components/tradeBox/Box.js +++ b/client/src/components/tradeBox/Box.js @@ -27,7 +27,7 @@ const Box = ({ isUser }) => { return (
      -

      +

      {ens ? ens : address ? address : "Box"}

      From d998f594ce28185e2e7891fceeed645822a75a0c Mon Sep 17 00:00:00 2001 From: James Quinn Date: Sat, 27 Jul 2019 02:15:23 +0200 Subject: [PATCH 109/425] Added accepted styling --- client/src/App.css | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/client/src/App.css b/client/src/App.css index 09be5e3..e98e852 100644 --- a/client/src/App.css +++ b/client/src/App.css @@ -386,8 +386,29 @@ select { padding: 0.25rem; } +.inner-box { + display: flex; + flex-direction: row; + justify-content: space-between; +} +.item { + display: flex; + flex-direction: row; + justify-content: space-around; + align-self: flex-start; + flex-grow: 2; + padding-top: 0.5rem; + padding-bottom: 0.4rem; +} +.accepted { + display: flex; + justify-content: center; + align-self: flex-start; + padding: 2rem; +} + /* Trade Form */ -.flexColumn { +.flex-column { /*TODO*/ display: flex; justify-content: center; @@ -435,13 +456,6 @@ select { .shadow-left { box-shadow: -5px 0px 5px -5px rgba(0, 0, 0, 0.5); } -.item { - display: flex; - flex-direction: row; - justify-content: space-around; - padding-top: 0.5rem; - padding-bottom: 0.4rem; -} /* Mobile Styles */ @media (max-width: 700px) { From acde98ef76aa16da1709e0d31726e82bb07dc538 Mon Sep 17 00:00:00 2001 From: James Quinn Date: Sat, 27 Jul 2019 02:15:32 +0200 Subject: [PATCH 110/425] Renamed classname --- client/src/components/layout/PreTradeForm.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/src/components/layout/PreTradeForm.js b/client/src/components/layout/PreTradeForm.js index 5e60e2b..5365aec 100644 --- a/client/src/components/layout/PreTradeForm.js +++ b/client/src/components/layout/PreTradeForm.js @@ -67,7 +67,7 @@ const PreTradeForm = () => { }; return ( -
      + Date: Sat, 27 Jul 2019 02:15:38 +0200 Subject: [PATCH 111/425] Added accepted --- client/src/components/tradeBox/Accepted.js | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 client/src/components/tradeBox/Accepted.js diff --git a/client/src/components/tradeBox/Accepted.js b/client/src/components/tradeBox/Accepted.js new file mode 100644 index 0000000..8c0f358 --- /dev/null +++ b/client/src/components/tradeBox/Accepted.js @@ -0,0 +1,7 @@ +import React from "react"; + +const Accepted = () => { + return
      Accepted
      ; +}; + +export default Accepted; From ff34bfa864a546c513dd3767c1e093641b16b420 Mon Sep 17 00:00:00 2001 From: James Quinn Date: Sat, 27 Jul 2019 02:15:53 +0200 Subject: [PATCH 112/425] Added innerbox --- client/src/components/tradeBox/Box.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/client/src/components/tradeBox/Box.js b/client/src/components/tradeBox/Box.js index 7980c7f..6e99a7f 100644 --- a/client/src/components/tradeBox/Box.js +++ b/client/src/components/tradeBox/Box.js @@ -3,6 +3,7 @@ import PropTypes from "prop-types"; import ItemForm from "./ItemForm"; import Items from "./Items"; +import Accepted from "./Accepted"; import UserContext from "../../context/user/UserContext"; const Box = ({ isUser }) => { @@ -30,7 +31,10 @@ const Box = ({ isUser }) => {

      {ens ? ens : address ? address : "Box"}

      - +
      + + +
      {isUser && }
      From 969fecf0d76bab8d25d97a474445ce0246180a34 Mon Sep 17 00:00:00 2001 From: Flash Date: Sat, 27 Jul 2019 20:18:15 +0200 Subject: [PATCH 113/425] Updated web3 state --- client/src/context/web3/Web3State.js | 61 +++++++++++++--------------- 1 file changed, 28 insertions(+), 33 deletions(-) diff --git a/client/src/context/web3/Web3State.js b/client/src/context/web3/Web3State.js index 342c3e1..1127056 100644 --- a/client/src/context/web3/Web3State.js +++ b/client/src/context/web3/Web3State.js @@ -26,22 +26,18 @@ const Web3State = props => { web3: null, connected: false, network: null, - loading: false, - contractObjs: [], - activeCalls: [/*{ - id: uuid.v4(), - type: "USER_BALANCE", - date: Date.now() - }*/], - activeTxs: [/*{ - id: txHash, - type: "PUSH_TRADE", - nonce: 5, - date: Date.now() - }*/], - errors: [] + activeReqs: [], + completedReqs: [], + activeTxs: [], + completedTxs: [] }; + // { + // id: "",//uuid.v4(), + // type: "", + // date,// Date.now() + // } + const [state, dispatch] = useReducer(Web3Reducer, initialState); /* @@ -60,31 +56,31 @@ const Web3State = props => { }); }; - const addContractObj = async(address, abiName) => { + const addContractObj = async (address, abiName) => { const abi = await getAbi(abiName); - - if(!abi){ + + if (!abi) { setAlert(`Failed get abi ${abiName}`, "danger"); return; } - - try{ + + try { //Create contract obj dispatch({ type: ADD_CONTRACT_OBJECT, - payload: {address, abi} + payload: { address, abi } }); - }catch{ + } catch { dispatch({ - type: CONTRACT_OBJECT_ERROR, + type: CONTRACT_OBJECT_ERROR }); } - } + }; const getAbi = async abiName => { - switch(abiName){ - case "ARCA": + switch (abiName) { + case "arca": return abi; case "erc20": return abiErc20; @@ -93,14 +89,9 @@ const Web3State = props => { default: return null; } - } - - const dismissError = id => { - - } - + }; -/* + /* const getERC20Token = (tokenAddress, userAddress) => { dispatch({ type: GET_ERC20, @@ -122,13 +113,17 @@ const Web3State = props => { }); }; */ + return ( Date: Sat, 27 Jul 2019 20:21:06 +0200 Subject: [PATCH 114/425] Removed ens context --- client/src/context/ens/EnsContext.js | 5 ---- client/src/context/ens/EnsReducer.js | 8 ------ client/src/context/ens/EnsState.js | 38 ---------------------------- 3 files changed, 51 deletions(-) delete mode 100644 client/src/context/ens/EnsContext.js delete mode 100644 client/src/context/ens/EnsReducer.js delete mode 100644 client/src/context/ens/EnsState.js diff --git a/client/src/context/ens/EnsContext.js b/client/src/context/ens/EnsContext.js deleted file mode 100644 index 36297a6..0000000 --- a/client/src/context/ens/EnsContext.js +++ /dev/null @@ -1,5 +0,0 @@ -import { createContext } from "react"; - -const EnsContext = createContext(); - -export default EnsContext; diff --git a/client/src/context/ens/EnsReducer.js b/client/src/context/ens/EnsReducer.js deleted file mode 100644 index 4ab3e80..0000000 --- a/client/src/context/ens/EnsReducer.js +++ /dev/null @@ -1,8 +0,0 @@ -import {} from "../types"; - -export default (state, action) => { - switch (action.type) { - default: - return state; - } -}; diff --git a/client/src/context/ens/EnsState.js b/client/src/context/ens/EnsState.js deleted file mode 100644 index b2e415d..0000000 --- a/client/src/context/ens/EnsState.js +++ /dev/null @@ -1,38 +0,0 @@ -import React, { useReducer } from "react"; -import uuid from "uuid"; -import EnsContext from "./EnsContext"; -import EnsReducer from "./EnsReducer"; - -import { SET_UTIL_CONTRACT } from "../types"; - -const EnsState = props => { - const initialState = { - utilContract: null - }; - - const [state, dispatch] = useReducer(EnsReducer, initialState); - - /* - * Actions - */ - - const setUtilContract = (address) => { - dispatch({ - type: SET_UTIL_CONTRACT, - payload: { address } - }); - } - - //Get erc721 id out of name => namehash => id - - return ( - - {props.children} - - ) -}; - -export default EnsState; From 57ef292d385cb6ce6a567fcdcb3cf4afc2c41d7a Mon Sep 17 00:00:00 2001 From: Flash Date: Sat, 27 Jul 2019 20:26:29 +0200 Subject: [PATCH 115/425] Attempted cleanup --- client/src/components/tradeBox/Box.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/client/src/components/tradeBox/Box.js b/client/src/components/tradeBox/Box.js index 6e99a7f..62d0a02 100644 --- a/client/src/components/tradeBox/Box.js +++ b/client/src/components/tradeBox/Box.js @@ -9,6 +9,8 @@ import UserContext from "../../context/user/UserContext"; const Box = ({ isUser }) => { const userContext = useContext(UserContext); + const contextTrader = isUser() ? userContext.user : userContext.tradePartner; + const [trader, setTrader] = useState({ address: "initialAdd", ens: "ens" @@ -17,13 +19,10 @@ const Box = ({ isUser }) => { const { address, ens } = trader; useEffect(() => { - if (isUser) { - setTrader(userContext.user); - } else { - setTrader(userContext.tradePartner); - } + setTrader(contextTrader); + //eslint-disable-next-line - }, [isUser, userContext.user, userContext.tradePartner]); + }, [isUser, contextTrader]); // Might need userContext.user, userContext.tradePartner return (
      From 76d87895dbb6ccd1eb6194439d5d4df8b83762e5 Mon Sep 17 00:00:00 2001 From: Flash Date: Sat, 27 Jul 2019 20:32:22 +0200 Subject: [PATCH 116/425] Added to state --- client/src/context/user/UserState.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/client/src/context/user/UserState.js b/client/src/context/user/UserState.js index 2470902..aa028ca 100644 --- a/client/src/context/user/UserState.js +++ b/client/src/context/user/UserState.js @@ -17,10 +17,16 @@ const UserState = props => { ens: null, balance: null, ownedTokens: { + web3Loading: false, + dbLoading: false, + synced: false, //synced is set when loading is set to false erc20Tokens: [], erc721Tokens: [] }, requestedTokens: { + web3Loading: false, + dbLoading: false, + synced: false, //synced is set when loading is set to false erc20Tokens: [], erc721Tokens: [] } @@ -30,10 +36,16 @@ const UserState = props => { ens: null, balance: null, ownedTokens: { + web3Loading: false, + dbLoading: false, + synced: false, //synced is set when loading is set to false erc20Tokens: [], erc721Tokens: [] }, requestedTokens: { + web3Loading: false, + dbLoading: false, + synced: false, //synced is set when loading is set to false erc20Tokens: [], erc721Tokens: [] } From 6d27de7cc6db8122454dddc11be1b8f8aaad7c87 Mon Sep 17 00:00:00 2001 From: Flash Date: Sat, 27 Jul 2019 21:01:33 +0200 Subject: [PATCH 117/425] Added sentStatus --- client/src/context/sentStatus.js | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 client/src/context/sentStatus.js diff --git a/client/src/context/sentStatus.js b/client/src/context/sentStatus.js new file mode 100644 index 0000000..3a8f582 --- /dev/null +++ b/client/src/context/sentStatus.js @@ -0,0 +1,3 @@ +export const LOCAL = "LOCAL"; +export const SENT = "SENT"; +export const UNSENT = "UNSENT"; From fa277790803e35b45b221315b463f06dd15833b6 Mon Sep 17 00:00:00 2001 From: Flash Date: Sat, 27 Jul 2019 21:02:03 +0200 Subject: [PATCH 118/425] Refactored state --- client/src/context/trade/TradeState.js | 60 +++++++++++++++++--------- 1 file changed, 40 insertions(+), 20 deletions(-) diff --git a/client/src/context/trade/TradeState.js b/client/src/context/trade/TradeState.js index 4a3de1f..f7aa204 100644 --- a/client/src/context/trade/TradeState.js +++ b/client/src/context/trade/TradeState.js @@ -11,36 +11,56 @@ import { CLEAR_CURRENT_ITEM } from "../types"; +import { LOCAL, SENT, UNSENT } from "../sentStatus"; + const TradeState = props => { const initialState = { userBox: 1, + currentItem: null, user: { tradeItems: [ - /*{ - sent: UNSENT/UNCONFIRMED/CONFIRMED, - txHash: null/"", - type: erc20/erc721/ens, - data: {} - }*/ - { - sent: "UNSENT", - txHash: null, - type: "erc20", - id: 0 - } + // { + // id: "", //uuid, + // txHash: null, + // web3Loading: false, + // dbLoading: false, + // synced: false, //lock edits until synced + // slot: null, + // tab: 0, + // type: "", + // sent: "", + // data: { + // contractAdd: "", + // id: "", //erc721/ens + // amount: "", //erc20 + // name: "", //ens + // verified: false //ens + // } + // } ] }, tradePartner: { tradeItems: [ - { - sent: "UNSENT", - txHash: null, - type: "erc20", - id: 0 - } + // { + // id: "", //uuid, + // txHash: null, + // web3Loading: false, + // dbLoading: false, + // synced: false, //lock edits until synced + // slot: null, + // tab: 0, + // type: "", + // sent: "", + // data: { + // contractAdd: "", + // id: "", //erc721/ens + // amount: "", //erc20 + // name: "", //ens + // verified: false //ens + // } + // } ] - }, - currentItem: null + } }; const [state, dispatch] = useReducer(TradeReducer, initialState); From ec8eb31a82cee234d1c2ad1a00780978ccdd5d90 Mon Sep 17 00:00:00 2001 From: Flash Date: Sat, 27 Jul 2019 22:20:29 +0200 Subject: [PATCH 119/425] Styling --- client/src/App.css | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/client/src/App.css b/client/src/App.css index e98e852..901710c 100644 --- a/client/src/App.css +++ b/client/src/App.css @@ -391,20 +391,27 @@ select { flex-direction: row; justify-content: space-between; } +.items { + align-self: flex-start; + display: flex; + flex-direction: column; + justify-content: space-between; + width: 100%; +} .item { display: flex; flex-direction: row; justify-content: space-around; - align-self: flex-start; - flex-grow: 2; + width: 100%; padding-top: 0.5rem; padding-bottom: 0.4rem; } .accepted { display: flex; + align-items: center; justify-content: center; - align-self: flex-start; - padding: 2rem; + margin: 2rem; + min-height: 100%; } /* Trade Form */ From 1ac9ae35896de7ba80fdfbfa55d457eca6c1fa1b Mon Sep 17 00:00:00 2001 From: Flash Date: Sat, 27 Jul 2019 22:20:44 +0200 Subject: [PATCH 120/425] Styled Accepted --- client/src/components/tradeBox/Accepted.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/client/src/components/tradeBox/Accepted.js b/client/src/components/tradeBox/Accepted.js index 8c0f358..17823e7 100644 --- a/client/src/components/tradeBox/Accepted.js +++ b/client/src/components/tradeBox/Accepted.js @@ -1,7 +1,11 @@ import React from "react"; const Accepted = () => { - return
      Accepted
      ; + return ( +
      +

      Accepted

      +
      + ); }; export default Accepted; From 1be0d304c9e7eee3ab718388405629097685f14f Mon Sep 17 00:00:00 2001 From: Flash Date: Sat, 27 Jul 2019 22:50:12 +0200 Subject: [PATCH 121/425] Removed margin --- client/src/App.css | 1 - 1 file changed, 1 deletion(-) diff --git a/client/src/App.css b/client/src/App.css index 901710c..638ded7 100644 --- a/client/src/App.css +++ b/client/src/App.css @@ -410,7 +410,6 @@ select { display: flex; align-items: center; justify-content: center; - margin: 2rem; min-height: 100%; } From c67fb27ebcbc844d28990a8aff40a197d08532fa Mon Sep 17 00:00:00 2001 From: Flash Date: Sat, 27 Jul 2019 22:50:23 +0200 Subject: [PATCH 122/425] Added small spinner --- client/src/components/layout/Spinner.js | 29 +++++++++++++++++-------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/client/src/components/layout/Spinner.js b/client/src/components/layout/Spinner.js index b1c2666..8345286 100644 --- a/client/src/components/layout/Spinner.js +++ b/client/src/components/layout/Spinner.js @@ -1,14 +1,25 @@ -import React, { Fragment } from "react"; +import React from "react"; import spinner from "./spinner.gif"; -const Spinner = () => ( - - Loading... - +const Spinner = ({ height }) => ( + Loading... ); export default Spinner; From ff0dee15efaff309a99f2068ef80d5545007f2a9 Mon Sep 17 00:00:00 2001 From: Flash Date: Sat, 27 Jul 2019 22:51:51 +0200 Subject: [PATCH 123/425] Added accepted to context --- client/src/components/tradeBox/Accepted.js | 26 +++- client/src/context/trade/TradeState.js | 170 ++++++++++++++++----- 2 files changed, 154 insertions(+), 42 deletions(-) diff --git a/client/src/components/tradeBox/Accepted.js b/client/src/components/tradeBox/Accepted.js index 17823e7..509f242 100644 --- a/client/src/components/tradeBox/Accepted.js +++ b/client/src/components/tradeBox/Accepted.js @@ -1,11 +1,31 @@ -import React from "react"; +import React, { useContext } from "react"; +import TradeContext from "../../context/trade/TradeContext"; +import PropTypes from "prop-types"; + +import Spinner from "../layout/Spinner"; + +const Accepted = ({ isUser }) => { + const tradeContext = useContext(TradeContext); + + const accepted = isUser + ? tradeContext.user.accepted + : tradeContext.tradePartner.accepted; -const Accepted = () => { return (
      -

      Accepted

      + {accepted ? ( +

      Accepted

      + ) : accepted === false ? ( +

      Not Accepted

      + ) : ( + + )}
      ); }; +Accepted.propTypes = { + isUser: PropTypes.bool.isRequired +}; + export default Accepted; diff --git a/client/src/context/trade/TradeState.js b/client/src/context/trade/TradeState.js index f7aa204..b266cc5 100644 --- a/client/src/context/trade/TradeState.js +++ b/client/src/context/trade/TradeState.js @@ -1,4 +1,5 @@ import React, { useReducer } from "react"; +import uuid from "uuid"; import TradeContext from "./TradeContext"; import TradeReducer from "./TradeReducer"; @@ -11,7 +12,7 @@ import { CLEAR_CURRENT_ITEM } from "../types"; -import { LOCAL, SENT, UNSENT } from "../sentStatus"; +import { SENT, UNSENT } from "../sentStatus"; const TradeState = props => { const initialState = { @@ -19,50 +20,141 @@ const TradeState = props => { currentItem: null, user: { tradeItems: [ - // { - // id: "", //uuid, - // txHash: null, - // web3Loading: false, - // dbLoading: false, - // synced: false, //lock edits until synced - // slot: null, - // tab: 0, - // type: "", - // sent: "", - // data: { - // contractAdd: "", - // id: "", //erc721/ens - // amount: "", //erc20 - // name: "", //ens - // verified: false //ens - // } - // } - ] + { + id: uuid.v4(), + network: { + sent: UNSENT, + txHash: null, + web3Loading: false, + dbLoading: false, + synced: true, + slot: 0, + tab: 0 + }, + data: { + type: "erc20", + contractAdd: "0x", + amount: "" + } + }, + { + id: uuid.v4(), + network: { + sent: SENT, + txHash: "0x", + web3Loading: false, + dbLoading: false, + synced: true, + slot: 1, + tab: 0 + }, + data: { + type: "erc721", + contractAdd: "0x", + id: "52" + } + }, + { + id: uuid.v4(), + network: { + sent: SENT, + txHash: "0x", + web3Loading: false, + dbLoading: false, + synced: true, + slot: 2, + tab: 0 + }, + data: { + type: "ens", + contractAdd: "0x", + id: "5", + name: "jimmy.eth", + verified: true + } + } + ], + accepted: true }, tradePartner: { tradeItems: [ - // { - // id: "", //uuid, - // txHash: null, - // web3Loading: false, - // dbLoading: false, - // synced: false, //lock edits until synced - // slot: null, - // tab: 0, - // type: "", - // sent: "", - // data: { - // contractAdd: "", - // id: "", //erc721/ens - // amount: "", //erc20 - // name: "", //ens - // verified: false //ens - // } - // } - ] + { + id: uuid.v4(), + network: { + sent: UNSENT, + txHash: null, + web3Loading: false, + dbLoading: false, + synced: true, + slot: 0, + tab: 0 + }, + data: { + type: "erc20", + contractAdd: "0x", + amount: "" + } + }, + { + id: uuid.v4(), + network: { + sent: SENT, + txHash: "0x", + web3Loading: false, + dbLoading: false, + synced: true, + slot: 1, + tab: 0 + }, + data: { + type: "erc721", + contractAdd: "0x", + id: "52" + } + }, + { + id: uuid.v4(), + network: { + sent: SENT, + txHash: "0x", + web3Loading: false, + dbLoading: false, + synced: true, + slot: 2, + tab: 0 + }, + data: { + type: "ens", + contractAdd: "0x", + id: "5", + name: "jimmy.eth", + verified: true + } + } + ], + accepted: null } }; + // { + // id: "", //uuid, + // txHash: null, + // web3Loading: false, + // dbLoading: false, + // synced: false, //lock edits until synced + // slot: null, + // tab: 0, + // type: "", + // sent: "", + // data: { + // contractAdd: "", + // id: "", //erc721/ens + // amount: "", //erc20 + // name: "", //ens + // verified: false //ens + // } + // } + const [state, dispatch] = useReducer(TradeReducer, initialState); /* From 73a12d51e07262fe267500341fe57c7d43a7e87b Mon Sep 17 00:00:00 2001 From: Flash Date: Sat, 27 Jul 2019 22:52:10 +0200 Subject: [PATCH 124/425] Added items classname --- client/src/components/tradeBox/Items.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/client/src/components/tradeBox/Items.js b/client/src/components/tradeBox/Items.js index 6ed299f..90eb39a 100644 --- a/client/src/components/tradeBox/Items.js +++ b/client/src/components/tradeBox/Items.js @@ -28,13 +28,15 @@ const Items = ({ isUser }) => { }; return ( - items.length > 0 && - items.map(item => ( -
      -

      ID:{item.id}

      - {internal(item)} -
      - )) +
      + {items.length > 0 && + items.map(item => ( +
      +

      ID:{item.id}

      + {internal(item)} +
      + ))} +
      ); }; From d75da92859234dec7c12c1e7df1f9c20710172cc Mon Sep 17 00:00:00 2001 From: Flash Date: Sat, 27 Jul 2019 22:52:20 +0200 Subject: [PATCH 125/425] Fixed isUser --- client/src/components/tradeBox/Box.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/src/components/tradeBox/Box.js b/client/src/components/tradeBox/Box.js index 62d0a02..128af7c 100644 --- a/client/src/components/tradeBox/Box.js +++ b/client/src/components/tradeBox/Box.js @@ -9,7 +9,7 @@ import UserContext from "../../context/user/UserContext"; const Box = ({ isUser }) => { const userContext = useContext(UserContext); - const contextTrader = isUser() ? userContext.user : userContext.tradePartner; + const contextTrader = isUser ? userContext.user : userContext.tradePartner; const [trader, setTrader] = useState({ address: "initialAdd", From 20c2fe0cb982fc722e5e3e3c88e0ba1e02794ec6 Mon Sep 17 00:00:00 2001 From: Flash Date: Sun, 28 Jul 2019 01:49:19 +0200 Subject: [PATCH 126/425] Cleaned vars --- client/src/components/layout/PreTradeForm.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/client/src/components/layout/PreTradeForm.js b/client/src/components/layout/PreTradeForm.js index 5365aec..18c184f 100644 --- a/client/src/components/layout/PreTradeForm.js +++ b/client/src/components/layout/PreTradeForm.js @@ -19,9 +19,9 @@ const PreTradeForm = () => { input1: "", address1: null, ens1: null, - input1: "", - address1: null, - ens1: null + input2: "", + address2: null, + ens2: null }); const { input1, address1, ens1, input2, address2, ens2 } = formState; @@ -36,7 +36,7 @@ const PreTradeForm = () => { }, [input2]); const checkInput = inputNum => { - inputNum === 1 && console.log("checking"); + inputNum === 1 && console.log("checking1"); //check if input1 is valid ens address //*if true, check whether it points to a valid address //**if true, ens1 = input1, address1 = returned ens address, valid = true and return @@ -45,6 +45,7 @@ const PreTradeForm = () => { //*if true, set address1 = input1, valid = true and return //else, address1 = null, valid = false, push to context and return + inputNum === 2 && console.log("checking2"); //check if input2 is valid ens address //*if true, check whether it points to a valid address //**if true, ens2 = input2, address2 = returned ens address, valid = true and return From dd91f76acd4d27ed8ddb34a29cb180d43ee4928f Mon Sep 17 00:00:00 2001 From: Flash Date: Sun, 28 Jul 2019 01:49:23 +0200 Subject: [PATCH 127/425] Styling --- client/src/App.css | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/src/App.css b/client/src/App.css index 638ded7..58c7cad 100644 --- a/client/src/App.css +++ b/client/src/App.css @@ -382,8 +382,7 @@ select { /* Box */ .box { min-height: 10rem; - margin: 1rem; - padding: 0.25rem; + padding: 0.4rem; } .inner-box { @@ -397,6 +396,7 @@ select { flex-direction: column; justify-content: space-between; width: 100%; + margin-bottom: 0.5rem; } .item { display: flex; From b17d02211a1a3d38346b58f91224bdc7792749ff Mon Sep 17 00:00:00 2001 From: Flash Date: Sun, 28 Jul 2019 01:49:32 +0200 Subject: [PATCH 128/425] Cleaned spinner --- client/src/components/layout/Spinner.js | 45 ++++++++++++++----------- 1 file changed, 25 insertions(+), 20 deletions(-) diff --git a/client/src/components/layout/Spinner.js b/client/src/components/layout/Spinner.js index 8345286..5c7593b 100644 --- a/client/src/components/layout/Spinner.js +++ b/client/src/components/layout/Spinner.js @@ -1,25 +1,30 @@ import React from "react"; import spinner from "./spinner.gif"; -const Spinner = ({ height }) => ( - Loading... -); +const Spinner = ({ size }) => { + const style = { + margin: "auto", + display: "block" + }; + + switch (size) { + case 5: + style.width = "5rem"; + style.height = "5rem"; + break; + case 7: + style.width = "7rem"; + style.height = "7rem"; + break; + case 10: + style.width = "10rem"; + style.height = "10rem"; + break; + default: + style.width = "100%"; + } + + return Loading...; +}; export default Spinner; From ecbefbac0d609223258b4da207fdb84535f77465 Mon Sep 17 00:00:00 2001 From: Flash Date: Sun, 28 Jul 2019 01:49:39 +0200 Subject: [PATCH 129/425] Added margin --- client/src/components/tradeBox/Box.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/src/components/tradeBox/Box.js b/client/src/components/tradeBox/Box.js index 128af7c..fe056d3 100644 --- a/client/src/components/tradeBox/Box.js +++ b/client/src/components/tradeBox/Box.js @@ -25,7 +25,7 @@ const Box = ({ isUser }) => { }, [isUser, contextTrader]); // Might need userContext.user, userContext.tradePartner return ( -
      +

      {ens ? ens : address ? address : "Box"} From 60c081a727d9b39b093a7e639c1068ccd93d055a Mon Sep 17 00:00:00 2001 From: Flash Date: Sun, 28 Jul 2019 01:49:50 +0200 Subject: [PATCH 130/425] Added size to Spinner --- client/src/components/tradeBox/Accepted.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/src/components/tradeBox/Accepted.js b/client/src/components/tradeBox/Accepted.js index 509f242..7d4ebf1 100644 --- a/client/src/components/tradeBox/Accepted.js +++ b/client/src/components/tradeBox/Accepted.js @@ -18,7 +18,7 @@ const Accepted = ({ isUser }) => { ) : accepted === false ? (

      Not Accepted

      ) : ( - + )}

      ); From 7040007befa7b23605c01e9949597fc258e4983c Mon Sep 17 00:00:00 2001 From: Flash Date: Sun, 28 Jul 2019 01:56:30 +0200 Subject: [PATCH 131/425] Styling --- client/src/App.css | 1 + client/src/components/tradeBox/ItemForm.js | 11 ++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/client/src/App.css b/client/src/App.css index 58c7cad..1a21732 100644 --- a/client/src/App.css +++ b/client/src/App.css @@ -411,6 +411,7 @@ select { align-items: center; justify-content: center; min-height: 100%; + min-width: 8rem; } /* Trade Form */ diff --git a/client/src/components/tradeBox/ItemForm.js b/client/src/components/tradeBox/ItemForm.js index fba6897..672a96e 100644 --- a/client/src/components/tradeBox/ItemForm.js +++ b/client/src/components/tradeBox/ItemForm.js @@ -54,7 +54,16 @@ const ItemForm = () => { onChange={onChange} /> {verified && ( - VERIFIED + + VERIFIED + )} ); From cebebae8f0ba7a14669d0841c082f22ba25a1da0 Mon Sep 17 00:00:00 2001 From: Flash Date: Sun, 28 Jul 2019 03:34:52 +0200 Subject: [PATCH 132/425] Refactored --- client/src/context/user/UserState.js | 125 +++++++++++++++++++++++---- 1 file changed, 106 insertions(+), 19 deletions(-) diff --git a/client/src/context/user/UserState.js b/client/src/context/user/UserState.js index aa028ca..bed4e08 100644 --- a/client/src/context/user/UserState.js +++ b/client/src/context/user/UserState.js @@ -4,17 +4,28 @@ import UserContext from "./UserContext"; import UserReducer from "./UserReducer"; import { - SET_USER, - SET_TRADE_PARTNER, CLEAR_USER, - CLEAR_TRADE_PARTNER + CLEAR_TRADE_PARTNER, + SET_ADDRESS, + CLEAR_ADDRESS, + SET_BALANCE, + CLEAR_BALANCE, + SET_OWNED_TOKENS, + SET_REQUESTED_TOKENS, + ADD_REQUESTED_TOKEN, + SET_SETTINGS, + UPDATE_SETTINGS, + CLEAR_SETTINGS } from "../types"; const UserState = props => { const initialState = { user: { - address: "", - ens: null, + addressObj: { + address: "", + ens: null + }, + balance: null, ownedTokens: { web3Loading: false, @@ -32,8 +43,10 @@ const UserState = props => { } }, tradePartner: { - address: "", - ens: null, + addressObj: { + address: "", + ens: null + }, balance: null, ownedTokens: { web3Loading: false, @@ -61,29 +74,95 @@ const UserState = props => { * Actions */ - const setUser = user => { + const clearUser = () => { + dispatch({ + type: CLEAR_USER + }); + }; + + const clearTradePartner = () => { + dispatch({ + type: CLEAR_TRADE_PARTNER + }); + }; + + const getAddress = (user, addressObj) => { + //GET addressObj from web3state (browser) + dispatch({ + type: SET_ADDRESS, + payload: { user, addressObj } + }); + }; + + const clearAddress = user => { dispatch({ - type: SET_USER, + type: CLEAR_ADDRESS, payload: user }); }; - const setTradePartner = tradePartner => { + const getBalance = (user, balance) => { + //GET balance from db and web3 dispatch({ - type: SET_TRADE_PARTNER, - payload: tradePartner + type: SET_BALANCE, + payload: { user, balance } }); }; - const clearUser = () => { + const clearBalance = user => { dispatch({ - type: CLEAR_USER + type: CLEAR_BALANCE, + payload: user }); }; - const clearTradePartner = () => { + const getOwnedTokens = user => { + //GET tokens from db and web3 (with map) + const ownedTokens = []; + dispatch({ - type: CLEAR_TRADE_PARTNER + type: SET_OWNED_TOKENS, + payload: { user, ownedTokens } + }); + }; + + const getRequestedTokens = user => { + //GET tokens from db + const ownedTokens = []; + + dispatch({ + type: SET_REQUESTED_TOKENS, + payload: { user, ownedTokens } + }); + }; + + const addRequestedToken = token => { + dispatch({ + type: ADD_REQUESTED_TOKEN, + payload: token + }); + }; + + const getSettings = () => { + //GET tokens from db + const settings = {}; + + dispatch({ + type: SET_SETTINGS, + payload: settings + }); + }; + + const updateSettings = settings => { + dispatch({ + type: UPDATE_SETTINGS, + payload: settings + }); + }; + + const clearSettings = () => { + dispatch({ + type: CLEAR_SETTINGS }); }; @@ -93,10 +172,18 @@ const UserState = props => { user: state.user, tradePartner: state.tradePartner, settings: state.settings, - setUser, - setTradePartner, clearUser, - clearTradePartner + clearTradePartner, + getAddress, + clearAddress, + getBalance, + clearBalance, + getOwnedTokens, + getRequestedTokens, + addRequestedToken, + getSettings, + updateSettings, + clearSettings }} > {props.children} From 08882e18e7917b21c71076e7957ea461c1ad9736 Mon Sep 17 00:00:00 2001 From: Flash Date: Sun, 28 Jul 2019 03:35:17 +0200 Subject: [PATCH 133/425] Refactored --- client/src/context/types.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/client/src/context/types.js b/client/src/context/types.js index fa99e56..164ca98 100644 --- a/client/src/context/types.js +++ b/client/src/context/types.js @@ -13,10 +13,18 @@ export const SET_CURRENT_ITEM = "SET_CURRENT_ITEM"; export const CLEAR_CURRENT_ITEM = "CLEAR_CURRENT_ITEM"; // User -export const SET_USER = "SET_USER"; -export const SET_TRADE_PARTNER = "SET_TRADE_PARTNER"; export const CLEAR_USER = "CLEAR_USER"; export const CLEAR_TRADE_PARTNER = "CLEAR_TRADE_PARTNER"; +export const SET_ADDRESS = "SET_ADDRESS"; +export const CLEAR_ADDRESS = "CLEAR_ADDRESS"; +export const SET_BALANCE = "SET_BALANCE"; +export const CLEAR_BALANCE = "CLEAR_BALANCE"; +export const SET_OWNED_TOKENS = "SET_OWNED_TOKENS"; +export const SET_REQUESTED_TOKENS = "SET_REQUESTED_TOKENS"; +export const ADD_REQUESTED_TOKEN = "ADD_REQUESTED_TOKEN"; +export const SET_SETTINGS = "SET_SETTINGS"; +export const UPDATE_SETTINGS = "UPDATE_SETTINGS"; +export const CLEAR_SETTINGS = "CLEAR_SETTINGS"; // Web3 export const CONNECT_WEB3 = "CONNECT_WEB3"; @@ -26,5 +34,4 @@ export const REMOVE_CONTRACT_OBJECT = "REMOVE_CONTRACT_OBJECT"; export const CONTRACT_OBJECT_ERROR = "CONTRACT_OBJECT_ERROR"; // Ens - export const SET_UTIL_CONTRACT = "SET_UTIL_CONTRACT"; From 5026ae0c9ad278c223f6a2e16f38969b3eec9999 Mon Sep 17 00:00:00 2001 From: Flash Date: Sun, 28 Jul 2019 03:35:28 +0200 Subject: [PATCH 134/425] Added namehash --- client/src/context/trade/TradeState.js | 1 + 1 file changed, 1 insertion(+) diff --git a/client/src/context/trade/TradeState.js b/client/src/context/trade/TradeState.js index b266cc5..2c90290 100644 --- a/client/src/context/trade/TradeState.js +++ b/client/src/context/trade/TradeState.js @@ -70,6 +70,7 @@ const TradeState = props => { contractAdd: "0x", id: "5", name: "jimmy.eth", + namehash: "0xnamehash", verified: true } } From 722e01775229ecefa4df65aba2a24a909049e85a Mon Sep 17 00:00:00 2001 From: Flash Date: Sun, 28 Jul 2019 14:24:14 +0200 Subject: [PATCH 135/425] Added pre validation --- client/src/App.css | 11 +++++++++++ client/src/components/layout/PreTradeForm.js | 12 ++++++++++-- client/src/components/tradeBox/ItemForm.js | 18 ++++++++++++++---- 3 files changed, 35 insertions(+), 6 deletions(-) diff --git a/client/src/App.css b/client/src/App.css index 1a21732..1f582e2 100644 --- a/client/src/App.css +++ b/client/src/App.css @@ -463,6 +463,17 @@ select { .shadow-left { box-shadow: -5px 0px 5px -5px rgba(0, 0, 0, 0.5); } +.is-valid { + border-color: #888888; + border-width: 1px; + border-style: solid; +} +.valid { + border-left: solid 4px green; +} +.invalid { + border-left: solid 4px red; +} /* Mobile Styles */ @media (max-width: 700px) { diff --git a/client/src/components/layout/PreTradeForm.js b/client/src/components/layout/PreTradeForm.js index 18c184f..4af5d6c 100644 --- a/client/src/components/layout/PreTradeForm.js +++ b/client/src/components/layout/PreTradeForm.js @@ -70,7 +70,11 @@ const PreTradeForm = () => { return ( { onChange={onChange} /> { const erc = () => ( { return ( { {erc()} { {erc()} Date: Sun, 28 Jul 2019 14:40:44 +0200 Subject: [PATCH 136/425] Destructuring --- client/src/components/layout/Sidebar.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/client/src/components/layout/Sidebar.js b/client/src/components/layout/Sidebar.js index 12a5a24..cf154f1 100644 --- a/client/src/components/layout/Sidebar.js +++ b/client/src/components/layout/Sidebar.js @@ -9,6 +9,8 @@ const Sidebar = () => { const web3Context = useContext(Web3Context); const { settings, user } = userContext; + const { nickname } = settings; + const { connected, loading } = web3Context; const tokens = () => ( @@ -34,7 +36,7 @@ const Sidebar = () => { return (
      -

      {settings.nickname && settings.nickname}

      +

      {nickname && nickname}

      {connected ?

      Not Connected

      : tokens()}
      ); From c5ada761320829a3491bb75a58d8bfe62952b081 Mon Sep 17 00:00:00 2001 From: Flash Date: Sun, 28 Jul 2019 14:41:35 +0200 Subject: [PATCH 137/425] Box styling --- client/src/App.css | 4 ++++ client/src/components/tradeBox/Box.js | 8 +++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/client/src/App.css b/client/src/App.css index 1f582e2..13688fc 100644 --- a/client/src/App.css +++ b/client/src/App.css @@ -383,6 +383,10 @@ select { .box { min-height: 10rem; padding: 0.4rem; + overflow: hidden; + overflow-y: auto; + overflow-x: auto; + scrollbar-width: thin; } .inner-box { diff --git a/client/src/components/tradeBox/Box.js b/client/src/components/tradeBox/Box.js index fe056d3..18ab5b4 100644 --- a/client/src/components/tradeBox/Box.js +++ b/client/src/components/tradeBox/Box.js @@ -9,7 +9,9 @@ import UserContext from "../../context/user/UserContext"; const Box = ({ isUser }) => { const userContext = useContext(UserContext); - const contextTrader = isUser ? userContext.user : userContext.tradePartner; + const addressObj = isUser + ? userContext.user.addressObj + : userContext.tradePartner.addressObj; const [trader, setTrader] = useState({ address: "initialAdd", @@ -19,10 +21,10 @@ const Box = ({ isUser }) => { const { address, ens } = trader; useEffect(() => { - setTrader(contextTrader); + setTrader(addressObj); //eslint-disable-next-line - }, [isUser, contextTrader]); // Might need userContext.user, userContext.tradePartner + }, [isUser, addressObj]); // Might need userContext.user, userContext.tradePartner return (
      From 1f738e4338e781bc6970a5a6ce7f700739351898 Mon Sep 17 00:00:00 2001 From: Flash Date: Sun, 28 Jul 2019 14:42:03 +0200 Subject: [PATCH 138/425] Added preliminary data --- client/src/context/user/UserState.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/src/context/user/UserState.js b/client/src/context/user/UserState.js index bed4e08..4b1cc43 100644 --- a/client/src/context/user/UserState.js +++ b/client/src/context/user/UserState.js @@ -22,8 +22,8 @@ const UserState = props => { const initialState = { user: { addressObj: { - address: "", - ens: null + address: "0x", + ens: "jaquinn.eth" }, balance: null, From 89ed28420ef374ed4011140ee30e1da1ee29b480 Mon Sep 17 00:00:00 2001 From: Flash Date: Sun, 28 Jul 2019 15:27:23 +0200 Subject: [PATCH 139/425] Container and box styling --- client/src/App.css | 8 ++++---- client/src/components/tradeBox/Box.js | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/client/src/App.css b/client/src/App.css index 13688fc..32662da 100644 --- a/client/src/App.css +++ b/client/src/App.css @@ -46,10 +46,10 @@ select { /* Utilities */ .container { - max-width: 1100px; + max-width: 850px; margin: auto; overflow: hidden; - padding: 0 2rem; + /* padding: 0 2rem; */ } /* Text Styles*/ @@ -356,12 +356,12 @@ select { display: flex; /* flex-direction: column; */ align-items: left; - padding: 0.7rem 2rem; + padding: 0 1.5rem; z-index: 1; height: 100%; border-left: solid 1px var(--primary-color); opacity: 0.9; - margin-left: 1rem; + margin-top: 0.5rem; } .sidebar ul { diff --git a/client/src/components/tradeBox/Box.js b/client/src/components/tradeBox/Box.js index 18ab5b4..888156f 100644 --- a/client/src/components/tradeBox/Box.js +++ b/client/src/components/tradeBox/Box.js @@ -27,7 +27,7 @@ const Box = ({ isUser }) => { }, [isUser, addressObj]); // Might need userContext.user, userContext.tradePartner return ( -
      +

      {ens ? ens : address ? address : "Box"} From a8d7039d07764fac5536490b6fed9e381d12272a Mon Sep 17 00:00:00 2001 From: Flash Date: Sun, 28 Jul 2019 17:13:46 +0200 Subject: [PATCH 140/425] Removed ens context --- client/src/components/layout/PreTradeForm.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/client/src/components/layout/PreTradeForm.js b/client/src/components/layout/PreTradeForm.js index 4af5d6c..402736d 100644 --- a/client/src/components/layout/PreTradeForm.js +++ b/client/src/components/layout/PreTradeForm.js @@ -2,12 +2,10 @@ import React, { useState, useEffect, useContext } from "react"; import TradeContext from "../../context/trade/TradeContext"; import Web3Context from "../../context/web3/Web3Context"; -import EnsContext from "../../context/ens/EnsContext"; const PreTradeForm = () => { const tradeContext = useContext(TradeContext); const web3Context = useContext(Web3Context); - const ensContext = useContext(EnsContext); //get ens checker //get web3 connection From 9cacb827296ed8e4eb83250d5e477bf3d2a483f0 Mon Sep 17 00:00:00 2001 From: Flash Date: Sun, 28 Jul 2019 17:14:05 +0200 Subject: [PATCH 141/425] Formatting --- client/src/components/tradeBox/ItemForm.js | 1 - 1 file changed, 1 deletion(-) diff --git a/client/src/components/tradeBox/ItemForm.js b/client/src/components/tradeBox/ItemForm.js index 8474ff3..e48750c 100644 --- a/client/src/components/tradeBox/ItemForm.js +++ b/client/src/components/tradeBox/ItemForm.js @@ -105,7 +105,6 @@ const ItemForm = () => { /> ); - default: return ""; } From 1cda6dc3313f427ec40d62c5386b683b5fdb67ce Mon Sep 17 00:00:00 2001 From: Flash Date: Sun, 28 Jul 2019 17:14:13 +0200 Subject: [PATCH 142/425] Removed ens context --- client/src/components/tradeBox/itemTypes/EnsForm.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/client/src/components/tradeBox/itemTypes/EnsForm.js b/client/src/components/tradeBox/itemTypes/EnsForm.js index a3a772f..f265a44 100644 --- a/client/src/components/tradeBox/itemTypes/EnsForm.js +++ b/client/src/components/tradeBox/itemTypes/EnsForm.js @@ -1,11 +1,7 @@ import React, { useState, useEffect, useContext } from "react"; import PropTypes from "prop-types"; -import EnsContext from "../../../context/ens/EnsContext"; - const EnsForm = item => { - const ensContext = useContext(EnsContext); - const [ensItem, setEnsItem] = useState({ name: "", namehash: "", From 5e4fa9621efba617871311f8e43f018560af551e Mon Sep 17 00:00:00 2001 From: Flash Date: Sun, 28 Jul 2019 18:05:17 +0200 Subject: [PATCH 143/425] Added footer --- client/src/App.js | 51 ++++++++++++++++++++++++++++------------------- 1 file changed, 31 insertions(+), 20 deletions(-) diff --git a/client/src/App.js b/client/src/App.js index 7b76c10..23474c9 100644 --- a/client/src/App.js +++ b/client/src/App.js @@ -2,27 +2,44 @@ import React, { Fragment } from "react"; import { BrowserRouter as Router, Switch, Route } from "react-router-dom"; import { library } from "@fortawesome/fontawesome-svg-core"; -import { faBoxOpen, faInfoCircle } from "@fortawesome/free-solid-svg-icons"; +import { + faBoxOpen, + faInfoCircle, + faAt +} from "@fortawesome/free-solid-svg-icons"; +import { + faGithub, + faTwitter, + faEthereum, + faBitcoin +} from "@fortawesome/free-brands-svg-icons"; import Alerts from "./components/layout/Alerts"; import Navbar from "./components/layout/Navbar"; -import Sidebar from "./components/layout/Sidebar"; import Home from "./components/pages/Home"; import About from "./components/pages/About"; import NotFound from "./components/pages/NotFound"; +import Footer from "./components/layout/Footer"; import AppState from "./context/app/AppState"; import AlertState from "./context/alert/AlertState"; import TradeState from "./context/trade/TradeState"; import UserState from "./context/user/UserState"; import Web3State from "./context/web3/Web3State"; -import EnsState from "./context/ens/EnsState"; import setAuthToken from "./utils/setAuthToken.js"; import "./App.css"; -library.add(faBoxOpen, faInfoCircle); +library.add( + faBoxOpen, + faInfoCircle, + faAt, + faGithub, + faTwitter, + faEthereum, + faBitcoin +); localStorage.token && setAuthToken(localStorage.token); @@ -32,22 +49,16 @@ const App = () => ( - - - - - -
      - - - - - - -
      -
      -
      -
      + + + + + + + + +