Skip to content

Commit

Permalink
Merge pull request #6 from SmartCash/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
jpteodosio authored Sep 16, 2020
2 parents 36663ba + cd03f27 commit 9e51c1e
Show file tree
Hide file tree
Showing 18 changed files with 4,704 additions and 3,678 deletions.
6 changes: 4 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ typings/
.yarn-integrity

# dotenv environment variables file
.env
.env.test
# .env
# .env.test

# parcel-bundler cache (https://parceljs.org/)
.cache
Expand Down Expand Up @@ -107,3 +107,5 @@ dist

# WebStorm
.idea

build/
18 changes: 18 additions & 0 deletions localhost.crt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
-----BEGIN CERTIFICATE-----
MIIC5TCCAc2gAwIBAgIJAIl6U0vHSpaQMA0GCSqGSIb3DQEBCwUAMBQxEjAQBgNV
BAMMCWxvY2FsaG9zdDAeFw0xOTEyMjQwOTA0MDZaFw0yMDAxMjMwOTA0MDZaMBQx
EjAQBgNVBAMMCWxvY2FsaG9zdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
ggEBAN4HtjsmCTYqpJdFnQsszEzbpyDRph55WGbIlAPz2RJ1U9S7ag/APkSEHw+i
ufzYad+QlXruD0H6d8t9+Wt7gZBGH7ZpAwFRQ5InA36kGVGWWUsnVbSmNhW5OQY3
66IzK5zakGKSTe+1/JcuHvBSrqN1l2775kqs1sRaq+rUCCOD++OISJIYlb3vCoKP
tRqWme16VxGPRTasHeYriJUna/p3kYLpcS3kYC97nzebui3P0EsSX5jZ2a1zWmq2
ZwiBW4eTPsJSF852Xn69JJ7FDmPof8VXUwAzUKoC3ywTg1kvNBihFZWySzLn3LzO
LiagHe7/Ep3jTGtd6gyqvHOFWRsCAwEAAaM6MDgwFAYDVR0RBA0wC4IJbG9jYWxo
b3N0MAsGA1UdDwQEAwIHgDATBgNVHSUEDDAKBggrBgEFBQcDATANBgkqhkiG9w0B
AQsFAAOCAQEAU71535ripYYarG0Gv000ZziHRo3LHQj3kY3XbNH5ihEghQ0bO2uE
uo8v4O5gN8cZc8r6X7Z01AeolK1MC0Cd+fjd0IHc8ZcT9dEnl7phqxCpHS+KzE9F
AIIDmyBaJb4jgfghiY8cWzjlBxilMeOrs2qKCpjbc3xdlgx3bvhvlsndUHpOSnP3
qc+uBNFjkVvvANW34YMVvVplCiq0Sys6dAd0sfDH/mIqO0TDgYl32Mp0uJ3znwUO
ZYDRRpGw/3V+OCs0BWn/EGCDOXLR6U7zeeqGc+p9NwUYvEYaQdvqhLRD0BUP4AXQ
J3jUnj60n64J2xYFYMRQMyDe4KArfLxSrA==
-----END CERTIFICATE-----
28 changes: 28 additions & 0 deletions localhost.key
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
-----BEGIN PRIVATE KEY-----
MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQDeB7Y7Jgk2KqSX
RZ0LLMxM26cg0aYeeVhmyJQD89kSdVPUu2oPwD5EhB8Porn82GnfkJV67g9B+nfL
fflre4GQRh+2aQMBUUOSJwN+pBlRlllLJ1W0pjYVuTkGN+uiMyuc2pBikk3vtfyX
Lh7wUq6jdZdu++ZKrNbEWqvq1Agjg/vjiEiSGJW97wqCj7UalpntelcRj0U2rB3m
K4iVJ2v6d5GC6XEt5GAve583m7otz9BLEl+Y2dmtc1pqtmcIgVuHkz7CUhfOdl5+
vSSexQ5j6H/FV1MAM1CqAt8sE4NZLzQYoRWVsksy59y8zi4moB3u/xKd40xrXeoM
qrxzhVkbAgMBAAECggEBAK71jsD/UQTxB2/4uC7FJ1xtPj6bVfbvkhy0dAbFUcm8
0MlywboVuDuPjVZp2XuIIa29Jj2PeFB6iYm+BByRX2CMEZNRHsAcBE4YFiXmM9lZ
y5VwMpY+36GwqmHfEPxorDZW+K3kMivx0VBkVJb14I4ILMOVFjzEBB0Igi5y1NL+
R29YnLO/m2Suqk1lkPA3XXw1aut4FLVxF5jwNDl5H2Xkyq7bb3pgHPuKLOUZseKB
KpbRG9pd331eeWwi6oMa5s7gWHB2UhgvCGfHST7DdP72z+MDr0KYYVl1ljmjkc3Y
FpaRQ8eAb8tF+U2/vGSSJW2mkb+i0z95lAioUOQwRQECgYEA8HmFul+jXoubu4ZD
hIK5V59Tu7NRChyWzmIGepEHB64sJM1rzmz7QYV2XR91eE6Tt519telsLH7cawdr
Duznr4IEh6x5aG64rksfAJpadDzFH2ZG4/4mCBtFe8p7RogF7q6CWXETngLfrzNp
SeTs28zfLINglAk3cvIOGA/PHJsCgYEA7F1YJk3hCr1jDWmfUucHH47chG6hnDBy
HMo5cUnuSnny26ppOcXYUDtkVp2K1k6EQvPN+8hVlKhwwu3yrFL0SxYnMwJSUeFi
NPV7Xc/bj53vrzhRDFXahdzp6h6KdurR2vefGPnakRyrrikCBDQlEtVkvb8ofdQa
6ukodGb1PYECgYEAsV3QhsCXrNpoCQ5kqk4JClnX1q/R7BVeHecrRCfH+aA7qwFg
rKaxQ4h+3vyfFhdO2LVuzUfXo5IGXWLhUebmlArf8HoEKkTQLq31teojIWzZL+mu
C+eegYgr3bxg5IrbZUqNlg7TG06fUYgn9nrFQPGBAkH8b/PEVCG4x4KRjlUCgYAC
nzp2GlEPxHAP2wcYbVWn5PbPRUbnq6XoadnfRtms29N02lwWdvpiUXZYe6Dppa9T
6s5zJ5LDdmbh0q/pd3YcSx+eMj1liSGEwuBedwrReggJoo9Lmrw01fGGVlZk4U/4
pNyP812YVIAXC39pOobawaE/dZpmYu71giafu/CmgQKBgQDFXYonCUCMteFsCGvH
+avXda0+CU15fAuFjTIDQHR1Jm03lptYBtztL+AjABNcnvrAyYYKx4UdWgQaFXbT
rdZjCxD5IJ22LTvl5WvC2aOXrydJbi+MW7+/b6io719njrkNP+XqYCnKNhdUDVVJ
X7wVz0wCBIp4OZo97PNM2ILW5w==
-----END PRIVATE KEY-----
8,001 changes: 4,407 additions & 3,594 deletions package-lock.json

Large diffs are not rendered by default.

77 changes: 49 additions & 28 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,39 +2,54 @@
"name": "wallet",
"version": "0.1.0",
"private": true,
"build": {
"appId": "smarthub",
"win": {
"icon": "build/icon.png"
}
},
"main": "public/electron.js",
"homepage": "./",
"dependencies": {
"@testing-library/jest-dom": "^4.2.4",
"@testing-library/react": "^9.5.0",
"@testing-library/user-event": "^7.2.1",
"axios": "^0.19.2",
"axios-hooks": "^1.10.0",
"big.js": "^5.2.2",
"crypto-js": "^4.0.0",
"lodash": "^4.17.15",
"moment": "^2.24.0",
"random": "^2.1.1",
"random-js": "^2.1.0",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-hook-form": "^5.5.3",
"react-phone-number-input": "^3.0.22",
"react-qr-reader": "^2.2.1",
"react-router-dom": "^5.1.2",
"react-scripts": "3.4.1",
"request": "^2.88.0",
"request-promise": "^4.2.5",
"smartcashjs-lib": "^3.3.6",
"string-format": "^2.0.0",
"styled-components": "^5.1.0",
"qrious": "^4.0.2",
"jspdf": "^1.5.3",
"file-saver": "1.3.8"
"@testing-library/jest-dom": "~4.2.4",
"@testing-library/react": "~9.5.0",
"@testing-library/user-event": "~7.2.1",
"axios": "~0.19.2",
"axios-hooks": "~1.10.0",
"big.js": "~5.2.2",
"cross-env": "~6.0.3",
"crypto-js": "~4.0.0",
"electron-is-dev": "~1.1.0",
"file-saver": "1.3.8",
"jspdf": "~1.5.3",
"lodash": "~4.17.15",
"moment": "~2.24.0",
"qrious": "~4.0.2",
"random": "~2.1.1",
"random-js": "~2.1.0",
"react": "~16.13.1",
"react-dom": "~16.13.1",
"react-hook-form": "~5.5.3",
"react-input-mask": "~2.0.4",
"react-phone-number-input": "~3.0.22",
"react-qr-reader": "~2.2.1",
"react-router-dom": "~5.1.2",
"react-scripts": "~3.4.3",
"react-text-mask": "~5.4.3",
"request": "~2.88.0",
"request-promise": "~4.2.5",
"smartcashjs-lib": "~3.3.6",
"string-format": "~2.0.0",
"styled-components": "~5.1.0",
"text-mask-addons": "~3.8.0"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build -- --profile",
"test": "react-scripts test",
"eject": "react-scripts eject"
"test-react": "react-scripts test --env=jsdom",
"eject-react": "react-scripts eject",
"build-electron": "npm run build && electron-builder",
"start-electron": "concurrently \"cross-env BROWSER=none npm run start-react\" \"wait-on http://localhost:3000 && electron .\""
},
"eslintConfig": {
"extends": "react-app"
Expand All @@ -50,5 +65,11 @@
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"electron": "~10.1.1",
"electron-builder": "~22.8.0",
"concurrently": "~5.1.0",
"wait-on": "~4.0.2"
}
}
34 changes: 34 additions & 0 deletions public/electron.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
const electron = require("electron");
const app = electron.app;
const BrowserWindow = electron.BrowserWindow;
const path = require("path");
const isDev = require("electron-is-dev");
let mainWindow;
function createWindow() {
mainWindow = new BrowserWindow({
width: 1200,
height: 800,
icon: ""
});


mainWindow.loadURL(
isDev
? "http://localhost:3000"
: `file://${path.join(__dirname, "../build/index.html")}`
);
mainWindow.on("closed", () => (mainWindow = null));
}

app.on("ready", createWindow);
app.on("window-all-closed", () => {
if (process.platform !== "darwin") {
app.quit();
}
});

app.on("activate", () => {
if (mainWindow === null) {
createWindow();
}
});
4 changes: 0 additions & 4 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta
name="description"
content="Web site created using create-react-app"
/>
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<title>SmartHub Local</title>
</head>
Expand Down
4 changes: 2 additions & 2 deletions public/manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"short_name": "React App",
"name": "Create React App Sample",
"short_name": "SmartHub",
"name": "SmartHub",
"icons": [
{
"src": "favicon.ico",
Expand Down
6 changes: 5 additions & 1 deletion src/app.route.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
import React from "react";
import { BrowserRouter as Router, Switch, Route } from "react-router-dom";
import { HashRouter as Router, Switch, Route } from "react-router-dom";
import Send from "./pages/send/Send";
import ExportPrivateKeys from "./pages/export-private-keys/ExportPrivateKeys";
import ExportPrivateKeysWithMSK from "./pages/export-private-keys-msk/ExportPrivateKeysWithMSK";
import HttpsRedirect from "./components/RedirectToHttps";


function AppRoute() {
return (
<HttpsRedirect>
<Router>
<Switch>
<Route exact path="/">
Expand All @@ -19,6 +22,7 @@ function AppRoute() {
</Route>
</Switch>
</Router>
</HttpsRedirect>
);
}

Expand Down
25 changes: 25 additions & 0 deletions src/components/RedirectToHttps.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
const isLocalHost = hostname => !!(
hostname === 'localhost' ||
hostname === '[::1]' ||
hostname.match(/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/)
);

const HttpsRedirect = ({ disabled, children }) => {
if (
!disabled &&
typeof window !== 'undefined' &&
window.location &&
window.location.protocol === 'http:' &&
!isLocalHost(window.location.hostname)
) {
window.location.href = window.location.href.replace(
/^http(?!s)/,
'https'
);
return null;
}

return children;
};

export default HttpsRedirect;
14 changes: 13 additions & 1 deletion src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,20 @@ body {
color: #555;
line-height: 1.5;
font-weight: 600;

flex: 0 0 90%;
position: relative;
}

.formControl .sendAllFunds {
flex: 1;
background: none;
border: 1px solid #ccc;
font-size: 10px;
line-height: normal;
height: 32px;
margin-top: auto;
margin-bottom: 9px;
border-radius: 3px;
}

.formControl input[type="text"] {
Expand Down
11 changes: 11 additions & 0 deletions src/lib/math.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const SATOSHI = 10000000;
const toSatoshi = (amount) => (amount * SATOSHI);
const fromSatoshi = (amount) => (amount / SATOSHI);

export const sumtractFloats = (amount1, amount2) => {
return fromSatoshi(toSatoshi(amount1) + toSatoshi(amount2));
};

export const subtractFloats = (amount1, amount2) => {
return fromSatoshi(toSatoshi(amount1) - toSatoshi(amount2));
};
15 changes: 9 additions & 6 deletions src/pages/export-private-keys-msk/ExportPrivateKeysWithMSK.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@ import {
ExportMessage,
AlertMessage,
} from "./styled";
import { useForm, Controller } from "react-hook-form";
import { useForm } from "react-hook-form";
import useAxios from "axios-hooks";
import PhoneInput from "react-phone-number-input";
import "./PhoneInput.css";
import logo from "../../assets/images/logo.png";
import generatePDF from "./GeneratorPDF";
Expand Down Expand Up @@ -81,27 +80,31 @@ function ExportPrivateKeysWithMSK() {
,{" "}
<a
target="_blank"
rel="noopener noreferrer"
href="https://play.google.com/store/apps/details?id=com.coinomi.wallet"
>
Coinomi
</a>
,{" "}
<a
target="_blank"
rel="noopener noreferrer"
href="https://play.google.com/store/apps/details?id=io.atomicwallet"
>
Atomic Wallet
</a>
,{" "}
<a
target="_blank"
rel="noopener noreferrer"
href="https://play.google.com/store/apps/details?id=co.edgesecure.app"
>
Edge Wallet
</a>
,
<a
target="_blank"
rel="noopener noreferrer"
href="https://play.google.com/store/apps/details?id=cloud.peer2.pungo_wallet"
>
Pungo Wallet
Expand Down Expand Up @@ -157,31 +160,31 @@ function ExportPrivateKeysWithMSK() {
,{" "}
<a
target="_blank"
rel="noreferrer"
rel="noopener noreferrer"
href="https://play.google.com/store/apps/details?id=com.coinomi.wallet"
>
Coinomi
</a>
,{" "}
<a
target="_blank"
rel="noreferrer"
rel="noopener noreferrer"
href="https://play.google.com/store/apps/details?id=io.atomicwallet"
>
Atomic Wallet
</a>
,{" "}
<a
target="_blank"
rel="noreferrer"
rel="noopener noreferrer"
href="https://play.google.com/store/apps/details?id=co.edgesecure.app"
>
Edge Wallet
</a>
,
<a
target="_blank"
rel="noreferrer"
rel="noopener noreferrer"
href="https://play.google.com/store/apps/details?id=cloud.peer2.pungo_wallet"
>
Pungo Wallet
Expand Down
Loading

0 comments on commit 9e51c1e

Please sign in to comment.