Skip to content
This repository has been archived by the owner on Jun 16, 2023. It is now read-only.

Commit

Permalink
Merge pull request #25
Browse files Browse the repository at this point in the history
  • Loading branch information
bsrinivas8687 authored Mar 2, 2021
2 parents 5846fb7 + 27252c2 commit 15501ae
Show file tree
Hide file tree
Showing 64 changed files with 2,474 additions and 1,163 deletions.
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
GENERATE_SOURCEMAP=false
REACT_APP_VERSION=$npm_package_version
3 changes: 3 additions & 0 deletions .env.development
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
BROWSER=none
FAST_REFRESH=true
REACT_APP_LISTEN_URL=http://127.0.0.1:8080
1 change: 1 addition & 0 deletions build.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ builder.build({
],
},
mac: {
strictVerify: false,
category: 'public.app-category.utilities',
icon: './electron/icon.icns',
},
Expand Down
4 changes: 2 additions & 2 deletions cli/rest/auth/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func HandlerLogin(ctx *context.Context) http.HandlerFunc {
},
Access: types.Token{
Value: fmt.Sprintf("%X", access),
Expiry: time.Now().Add(30 * time.Second),
Expiry: time.Now().Add(1 * time.Minute),
},
})
} else {
Expand Down Expand Up @@ -86,7 +86,7 @@ func HandlerLogin(ctx *context.Context) http.HandlerFunc {
Refresh: refresh,
Access: types.Token{
Value: fmt.Sprintf("%X", bytes),
Expiry: time.Now().Add(30 * time.Second),
Expiry: time.Now().Add(1 * time.Minute),
},
})
}
Expand Down
2 changes: 1 addition & 1 deletion cli/types/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ func (c *Config) WithDefaultValues() *Config {

c.Chain.BroadcastMode = "block"
c.Chain.Fees = ""
c.Chain.Gas = 1e5
c.Chain.Gas = 5e5
c.Chain.GasAdjustment = 0
c.Chain.GasPrices = "0.01tsent"
c.Chain.ID = "sentinel-turing-3a"
Expand Down
2 changes: 2 additions & 0 deletions electron/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ const createMainWindow = () => {
autoHideMenuBar: true,
height: 720,
icon: path.join(__dirname, 'icon.png'),
minHeight: 480,
minWidth: 852,
title: 'Sentinel',
webPreferences: {
preload: path.join(__dirname, 'preload.js'),
Expand Down
19 changes: 10 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sentinel",
"version": "0.3.0-rc0",
"version": "0.3.0-rc1",
"main": "./electron/index.js",
"homepage": "./",
"description": "Sentinel desktop and web client.",
Expand All @@ -16,32 +16,33 @@
"@ramonak/react-progress-bar": "^2.1.3",
"@testing-library/jest-dom": "^5.11.9",
"@testing-library/react": "^11.2.5",
"@testing-library/user-event": "^12.7.1",
"@testing-library/user-event": "^12.8.1",
"async": "^3.2.0",
"axios": "^0.21.1",
"bech32": "^2.0.0",
"bootstrap": "^4.6.0",
"electron": "^11.2.3",
"electron-builder": "^22.9.1",
"eslint": "^7.20.0",
"electron": "^11.3.0",
"electron-builder": "^22.10.5",
"env-cmd": "^10.1.0",
"eslint": "^7.21.0",
"eslint-config-standard": "^16.0.2",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^4.3.1",
"eslint-plugin-react": "^7.22.0",
"eslint-plugin-sort-exports": "^0.3.2",
"eslint-plugin-sort-imports-es6-autofix": "^0.5.0",
"lodash": "^4.17.20",
"lodash": "^4.17.21",
"prop-types": "^15.7.2",
"qrcode.react": "^1.0.1",
"react": "^17.0.1",
"react-bootstrap": "^1.4.3",
"react-bootstrap": "^1.5.0",
"react-copy-to-clipboard": "^5.0.3",
"react-dom": "^17.0.1",
"react-download-link": "^2.3.0",
"react-redux": "^7.2.2",
"react-router-dom": "^5.2.0",
"react-scripts": "4.0.2",
"react-scripts": "4.0.3",
"react-simple-maps": "^2.3.0",
"redux": "^4.0.5",
"redux-devtools-extension": "^2.13.8",
Expand All @@ -50,7 +51,7 @@
},
"scripts": {
"build:web": "react-scripts build",
"start:web": "react-scripts start",
"start:web": "env-cmd -f .env.development react-scripts start",
"build:desktop": "GENERATE_SOURCEMAP=false react-scripts build && NODE_ENV=production node build.js",
"start:desktop": "GENERATE_SOURCEMAP=false react-scripts build && NODE_ENV=production electron .",
"build:desktop:development": "react-scripts build && node build.js",
Expand Down
6 changes: 4 additions & 2 deletions src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,10 @@ label, .label {
align-items: center;
}

.section-body .title {
.section-body .title, .section-body .login-title, .login-body .login-title {
text-align: center;
padding: 30px 0;
margin: 0;
}

.section-body .password-box {
Expand Down Expand Up @@ -110,7 +112,7 @@ label, .label {

.settings-modal {
position: relative;
min-height: 350px !important;
min-height: 476px !important;
}

.settings-modal .btn.button-primary {
Expand Down
6 changes: 4 additions & 2 deletions src/actions/account.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
import { emptyFunc } from '../constants/common';
import Async from 'async';
import Axios from '../services/axios';
import Lodash from 'lodash';

export const getAccountInProgress = (data) => {
return {
Expand Down Expand Up @@ -40,11 +41,12 @@ export const getAccount = (cb = emptyFunc) => (dispatch, getState) => {
const {
keys: {
items,
index,
name,
},
} = getState();

const url = accountGetURL(items[index].address);
const item = Lodash.find(items, ['name', name]);
const url = accountGetURL(item.address);
Axios.get(url)
.then((res) => {
try {
Expand Down
7 changes: 3 additions & 4 deletions src/actions/configuration.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,16 +173,15 @@ export const putConfigurationSuccess = (data) => {
};
};

export const putConfiguration = (cb = emptyFunc) => (dispatch, getState) => {
export const putConfiguration = (from, cb = emptyFunc) => (dispatch, getState) => {
Async.waterfall([
(next) => {
dispatch(putConfigurationInProgress());
next(null);
}, (next) => {
const {
keys: {
items,
index,
name,
},
configuration: {
chain: {
Expand All @@ -201,7 +200,7 @@ export const putConfiguration = (cb = emptyFunc) => (dispatch, getState) => {

const url = configurationPutURL();
Axios.put(url, {
from: items[index]?.name,
from: from || name,
chain: {
broadcast_mode: broadcastMode.value.trim(),
fees: fees.value.trim(),
Expand Down
6 changes: 4 additions & 2 deletions src/actions/delegations.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
import { emptyFunc } from '../constants/common';
import Async from 'async';
import Axios from '../services/axios';
import Lodash from 'lodash';

export const getDelegationsInProgress = (data) => {
return {
Expand Down Expand Up @@ -38,11 +39,12 @@ export const getDelegations = (cb = emptyFunc) => (dispatch, getState) => {
const {
keys: {
items,
index,
name,
},
} = getState();

const url = delegationsGetURL(items[index].address);
const item = Lodash.find(items, ['name', name]);
const url = delegationsGetURL(item.address);
Axios.get(url)
.then((res) => {
try {
Expand Down
152 changes: 149 additions & 3 deletions src/actions/keys.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,28 @@
import {
KEYS_CREATE_MODAL_HIDE,
KEYS_CREATE_MODAL_SHOW,
KEYS_DELETE_ERROR,
KEYS_DELETE_IN_PROGRESS,
KEYS_DELETE_NAME_SET,
KEYS_DELETE_PASSWORD_SET,
KEYS_DELETE_PASSWORD_VISIBLE_SET,
KEYS_DELETE_SUCCESS,
KEYS_GET_ERROR,
KEYS_GET_IN_PROGRESS,
KEYS_GET_SUCCESS,
KEYS_INFO_MODAL_HIDE,
KEYS_INFO_MODAL_SHOW,
KEYS_LIST_MODAL_HIDE,
KEYS_LIST_MODAL_SHOW,
KEYS_NAME_SET,
KEYS_PASSWORD_VISIBLE_SET,
KEYS_POST_ERROR,
KEYS_POST_IN_PROGRESS,
KEYS_POST_SUCCESS,
KEY_MNEMONIC_SET,
KEY_NAME_SET,
KEY_PASSWORD_SET,
keysDeleteURL,
keysGetURL,
keysPostURL,
} from '../constants/keys';
Expand Down Expand Up @@ -160,10 +174,142 @@ export const postKeys = (history, cb = emptyFunc) => (dispatch, getState) => {
dispatch(postKeysSuccess(result));
next(null);
}, (next) => {
const { keys } = getState();
if (history) {
const { keys } = getState();

history.push(`/keys/${keys.post.info.name}`);
next(new Error(''));
} else {
next(null);
}
},
], cb);
};

export const showKeysListModal = (data) => {
return {
type: KEYS_LIST_MODAL_SHOW,
data,
};
};

history.push(`/keys/${keys.post.info.name}`);
next(new Error(''));
export const hideKeysListModal = (data) => {
return {
type: KEYS_LIST_MODAL_HIDE,
data,
};
};

export const showKeysCreateModal = (data) => {
return {
type: KEYS_CREATE_MODAL_SHOW,
data,
};
};

export const hideKeysCreateModal = (data) => {
return {
type: KEYS_CREATE_MODAL_HIDE,
data,
};
};

export const setKeysDeletePassword = (data) => {
return {
type: KEYS_DELETE_PASSWORD_SET,
data,
};
};

export const setKeysDeletePasswordVisible = (data) => {
return {
type: KEYS_DELETE_PASSWORD_VISIBLE_SET,
data,
};
};

export const setKeysDeleteNameSet = (data) => {
return {
type: KEYS_DELETE_NAME_SET,
data,
};
};

export const setKeysName = (data) => {
return {
type: KEYS_NAME_SET,
data,
};
};

export const showKeysInfoModal = (data) => {
return {
type: KEYS_INFO_MODAL_SHOW,
data,
};
};

export const hideKeysInfoModal = (data) => {
return {
type: KEYS_INFO_MODAL_HIDE,
data,
};
};

export const deleteKeysInProgress = (data) => {
return {
type: KEYS_DELETE_IN_PROGRESS,
data,
};
};

export const deleteKeysSuccess = (data) => {
return {
type: KEYS_DELETE_SUCCESS,
data,
};
};

export const deleteKeysError = (data) => {
return {
type: KEYS_DELETE_ERROR,
data,
};
};

export const deleteKeys = (cb = emptyFunc) => (dispatch, getState) => {
Async.waterfall([
(next) => {
dispatch(deleteKeysInProgress(null));
next(null);
}, (next) => {
const {
keys: {
delete: {
name,
password,
},
},
} = getState();

const url = keysDeleteURL(name);
Axios.post(url, {
password: password.value.trim(),
}).then((res) => {
try {
next(null, res?.data?.result);
} catch (e) {
console.error(e);
}
}).catch((error) => {
console.error(error);

dispatch(deleteKeysError(error?.response?.data?.error || error));
next(error);
});
}, (result, next) => {
dispatch(deleteKeysSuccess(result));
next(null);
},
], cb);
};
Loading

0 comments on commit 15501ae

Please sign in to comment.