Skip to content

Commit

Permalink
packages upgrade.
Browse files Browse the repository at this point in the history
  • Loading branch information
SrikanthSoparla committed May 16, 2024
2 parents c5c6d61 + 5a130a0 commit 9aed2e8
Show file tree
Hide file tree
Showing 47 changed files with 9,686 additions and 8,280 deletions.
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
SKIP_PREFLIGHT_CHECK = true
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ yarn
1. clone repository and install packages

```sh
git clone https://github.dev/OmniFlix/insync.git
git clone https://github.com/OmniFlix/insync.git
cd insync
yarn
```
Expand All @@ -33,7 +33,7 @@ yarn
export const config = {
RPC_URL: 'https://rpc.flixnet.omniflix.network',
REST_URL: 'https://rest.flixnet.omniflix.network',
EXPLORER_URL: 'https://explorer.omniflix.network',
EXPLORER_URL: 'https://www.mintscan.io/omniflix',
STAKING_URL: 'https://flix.omniflix.co/stake',
NETWORK_NAME: 'OmniFlix',
NETWORK_TYPE: 'testnet',
Expand Down
25 changes: 25 additions & 0 deletions config-overrides.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
const webpack = require('webpack');

module.exports = function override (config, env) {
config.resolve.fallback = {
stream: require.resolve('stream-browserify'),
crypto: require.resolve('crypto-browserify'),
process: require.resolve('process/browser'),
buffer: require.resolve('buffer'),
levenary: false,
vm: false,
};
config.resolve.extensions = [...config.resolve.extensions, '.ts', '.js'];
config.plugins = [
...config.plugins,
new webpack.ProvidePlugin({
Buffer: ['buffer', 'Buffer'],
}),
new webpack.ProvidePlugin({
process: 'process/browser',
}),
];
config.ignoreWarnings = [/Failed to parse source map/];

return config;
};
59 changes: 39 additions & 20 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,40 +6,53 @@
"license": "MIT",
"private": true,
"dependencies": {
"@cosmjs/amino": "^0.26.5",
"@cosmjs/proto-signing": "^0.26.5",
"@cosmjs/stargate": "^0.26.5",
"@cosmostation/cosmos-client": "^0.0.1",
"@cosmjs/amino": "0.32.2",
"@cosmjs/launchpad": "0.27.1",
"@cosmjs/proto-signing": "0.32.2",
"@cosmjs/stargate": "0.32.2",
"@cosmostation/cosmos-client": "0.0.5",
"@cosmostation/extension-client": "^0.1.7",
"@emotion/react": "^11.11.3",
"@material-ui/core": "^4.11.3",
"@material-ui/icons": "^4.11.2",
"@material-ui/lab": "^4.0.0-alpha.58",
"classnames": "^2.2.6",
"@redux-devtools/extension": "^3.3.0",
"buffer": "^6.0.3",
"classnames": "2.5.1",
"crypto-browserify": "^3.12.0",
"history": "^5.0.0",
"js-base64": "^3.6.0",
"latest": "^0.2.0",
"long": "^5.2.0",
"moment": "^2.29.1",
"moment": "2.30.1",
"mui-datatables": "^3.7.7",
"process": "^0.11.10",
"prop-types": "^15.7.2",
"react": "^16.12.0",
"react-dom": "^16.13.1",
"react-redux": "^7.2.0",
"react-router": "^5.2.0",
"react-router-dom": "^5.2.0",
"react-scripts": "3.4.0",
"redux": "^4.0.5",
"redux-devtools-extension": "^2.13.8",
"redux-thunk": "^2.3.0"
"react": "18.2.0",
"react-app-rewired": "^2.2.1",
"react-dom": "18.2.0",
"react-redux": "9.1.0",
"react-router": "6.22.0",
"react-router-dom": "6.22.0",
"react-scripts": "5.0.1",
"redux": "5.0.1",
"redux-thunk": "^2.3.0",
"stream-browserify": "^3.0.0",
"typescript": "^5.3.3",
"web-vitals": "^3.5.2",
"webpack": "^5.89.0"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
"start": "react-app-rewired start",
"build": "react-app-rewired build",
"test": "react-app-rewired test",
"eject": "react-app-rewired eject"
},
"devDependencies": {
"@cosmjs/launchpad": "^0.26.5",
"@babel/core": "7.23.2",
"@babel/eslint-parser": "7.22.15",
"@babel/plugin-proposal-private-property-in-object": "7.21.11",
"@babel/preset-env": "7.23.2",
"axios": "^0.21.1",
"env-cmd": "^10.1.0",
"eslint": "^6.8.0",
Expand All @@ -50,6 +63,12 @@
"eslint-plugin-react": "^7.18.3",
"eslint-plugin-standard": "^4.0.1"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
Expand Down
Binary file modified public/favicon.ico
Binary file not shown.
10 changes: 5 additions & 5 deletions src/Router.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { Route, Switch } from 'react-router-dom';
import { Route, Routes } from 'react-router-dom';
import Home from './containers/Home';
import Stake from './containers/Stake';
import Proposals from './containers/Proposals';
Expand All @@ -23,19 +23,19 @@ const Router = () => {
return (
<div className="main_content">
<div className="content_div scroll_bar">
<Switch>
<Routes>
{routes.map((route) =>
<Route
key={route.path}
exact
component={route.component}
element={<route.component/>}
path={route.path}/>,
)}
<Route
exact
component={Home}
element={<Home/>}
path="*"/>
</Switch>
</Routes>
</div>
</div>
);
Expand Down
2 changes: 1 addition & 1 deletion src/actions/accounts/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ export const fetchVestingBalance = (address) => (dispatch) => {
},
})
.then((res) => {
dispatch(fetchVestingBalanceSuccess(res.data && res.data.result));
dispatch(fetchVestingBalanceSuccess(res.data && res.data.balances));
})
.catch((error) => {
dispatch(fetchVestingBalanceError(
Expand Down
157 changes: 154 additions & 3 deletions src/actions/stake.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
import {
APR_FETCH_ERROR,
APR_FETCH_IN_PROGRESS,
APR_FETCH_SUCCESS,
CLAIM_REWARDS_DIALOG_HIDE,
CLAIM_REWARDS_DIALOG_SHOW,
CLAIM_REWARDS_VALIDATOR_SET,
CLAIM_DELEGATE_DIALOG_SHOW,
CLAIM_DELEGATE_DIALOG_HIDE,
CLAIM_DELEGATE_VALIDATOR_SET,
DELEGATE_DIALOG_HIDE,
DELEGATE_DIALOG_SHOW,
DELEGATE_FAILED_DIALOG_HIDE,
Expand All @@ -13,6 +19,9 @@ import {
DELEGATED_VALIDATORS_FETCH_ERROR,
DELEGATED_VALIDATORS_FETCH_IN_PROGRESS,
DELEGATED_VALIDATORS_FETCH_SUCCESS,
INACTIVE_VALIDATORS_FETCH_ERROR,
INACTIVE_VALIDATORS_FETCH_IN_PROGRESS,
INACTIVE_VALIDATORS_FETCH_SUCCESS,
SEARCH_LIST_SET,
TO_VALIDATOR_SET,
TOKENS_SET,
Expand All @@ -26,10 +35,21 @@ import {
VALIDATORS_FETCH_ERROR,
VALIDATORS_FETCH_IN_PROGRESS,
VALIDATORS_FETCH_SUCCESS,
SELECTED_MULTI_VALIDATORS,
} from '../constants/stake';
import Axios from 'axios';
import { getDelegatedValidatorsURL, getValidatorURL, validatorImageURL, VALIDATORS_LIST_URL } from '../constants/url';
import {
getDelegatedValidatorsURL,
getValidatorURL,
INACTIVE_VALIDATORS_UNBONDING_URL,
INACTIVE_VALIDATORS_URL,
validatorImageURL,
VALIDATORS_LIST_URL,
} from '../constants/url';
import { config } from '../config';
import { calculateNominalAPR, calculateRealAPR, getBlocksPerYearReal, getParams } from '../utils/aprCalculation';

const axios = require('axios').default;

const fetchValidatorsInProgress = () => {
return {
Expand Down Expand Up @@ -60,7 +80,7 @@ export const getValidators = (cb) => (dispatch) => {
})
.then((res) => {
dispatch(fetchValidatorsSuccess(res.data && res.data.validators));
cb(res.data && res.data.result);
cb(res.data && res.data.validators);
})
.catch((error) => {
dispatch(fetchValidatorsError(
Expand Down Expand Up @@ -183,7 +203,7 @@ export const getValidatorDetails = (address, cb) => (dispatch) => {
})
.then((res) => {
dispatch(fetchValidatorSuccess(res.data && res.data.validators));
cb(res.data && res.data.result);
cb(res.data && res.data.validators);
})
.catch((error) => {
dispatch(fetchValidatorError(
Expand Down Expand Up @@ -258,6 +278,25 @@ export const setClaimRewardsValidator = (value) => {
};
};

export const showClaimDelegateDialog = () => {
return {
type: CLAIM_DELEGATE_DIALOG_SHOW,
};
};

export const hideClaimDelegateDialog = () => {
return {
type: CLAIM_DELEGATE_DIALOG_HIDE,
};
};

export const setClaimDelegateValidator = (value) => {
return {
type: CLAIM_DELEGATE_VALIDATOR_SET,
value,
};
};

const fetchValidatorImageInProgress = () => {
return {
type: VALIDATOR_IMAGE_FETCH_IN_PROGRESS,
Expand Down Expand Up @@ -307,3 +346,115 @@ export const fetchValidatorImage = (id) => (dispatch) => {
));
});
};

const fetchInActiveValidatorsInProgress = () => {
return {
type: INACTIVE_VALIDATORS_FETCH_IN_PROGRESS,
};
};

const fetchInActiveValidatorsSuccess = (list) => {
return {
type: INACTIVE_VALIDATORS_FETCH_SUCCESS,
list,
};
};

const fetchInActiveValidatorsError = (message) => {
return {
type: INACTIVE_VALIDATORS_FETCH_ERROR,
};
};

export const getInActiveValidators = (cb) => (dispatch) => {
dispatch(fetchInActiveValidatorsInProgress());
(async () => {
try {
const result = await Axios.get(INACTIVE_VALIDATORS_URL, {
headers: {
Accept: 'application/json, text/plain, */*',
Connection: 'keep-alive',
},
});
const unBondingResult = await Axios.get(INACTIVE_VALIDATORS_UNBONDING_URL, {
headers: {
Accept: 'application/json, text/plain, */*',
Connection: 'keep-alive',
},
});
const updatedResult = [...result.data && result.data.validators, ...unBondingResult.data && unBondingResult.data.validators];
dispatch(fetchInActiveValidatorsSuccess(updatedResult));
cb(updatedResult);
} catch (error) {
dispatch(fetchInActiveValidatorsError(
error.response &&
error.response.data &&
error.response.data.message
? error.response.data.message
: 'Failed!',
));
cb(null);
}
})();
};

const fetchAPRInProgress = () => {
return {
type: APR_FETCH_IN_PROGRESS,
};
};

export const fetchAPRSuccess = (nominalAPR, actualAPR) => {
return {
type: APR_FETCH_SUCCESS,
nominalAPR,
actualAPR,
};
};

const fetchAPRError = (message) => {
return {
type: APR_FETCH_ERROR,
message,
};
};

export const fetchAPR = () => (dispatch) => {
dispatch(fetchAPRInProgress());
(async () => {
try {
const apiUrl = config.REST_URL;
const lcdApi = axios.create({
baseURL: apiUrl,
headers: {
'Content-Type': 'application/json; charset=utf-8',
Accept: 'application/json',
},
timeout: 10000,
});

const params = await getParams(lcdApi);
const blocksYearReal = await getBlocksPerYearReal(lcdApi);
const nominalAPR = calculateNominalAPR(params);
const actualAPR = calculateRealAPR(params, nominalAPR, blocksYearReal);

dispatch(fetchAPRSuccess((nominalAPR * 100), (actualAPR * 100)));
} catch (error) {
dispatch(fetchAPRError(
error.response &&
error.response.data &&
error.response.data.message
? error.response.data.message
: error,
));
return null;
}
})();
};

export const selectMultiValidators = (value) => {
return {
type: SELECTED_MULTI_VALIDATORS,
value,
};
};
Loading

0 comments on commit 9aed2e8

Please sign in to comment.