Skip to content

Commit

Permalink
Merge pull request #197 from DeFiCh/ci/master
Browse files Browse the repository at this point in the history
Ci/master
  • Loading branch information
saurabh391 committed Dec 29, 2020
2 parents 325d05e + 2dc27dd commit a940153
Show file tree
Hide file tree
Showing 19 changed files with 173 additions and 27 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/dev-builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- uses: actions/upload-artifact@v2
with:
name: linux-build
path: 'dist/defi-app-2.1.4.AppImage'
path: 'dist/defi-app-2.1.5.AppImage'

build_mac_version:
runs-on: macos-latest
Expand All @@ -36,7 +36,7 @@ jobs:
- uses: actions/upload-artifact@v2
with:
name: mac-build
path: 'dist/defi-app-2.1.4.dmg'
path: 'dist/defi-app-2.1.5.dmg'

build_windows_version:
runs-on: windows-latest
Expand All @@ -58,9 +58,9 @@ jobs:
rm -r -fo win -ErrorAction Ignore
mkdir win
cd win
curl https://github.com/DeFiCh/ain/releases/download/v1.3.15/defichain-1.3.15-x86_64-w64-mingw32.zip -O defichain-1.3.15-x86_64-w64-mingw32.zip
Expand-Archive -LiteralPath .\defichain-1.3.15-x86_64-w64-mingw32.zip -DestinationPath .
Copy-Item .\defichain-1.3.15\bin\defid.exe .
curl https://github.com/DeFiCh/ain/releases/download/v1.3.16/defichain-1.3.16-x86_64-w64-mingw32.zip -O defichain-1.3.16-x86_64-w64-mingw32.zip
Expand-Archive -LiteralPath .\defichain-1.3.16-x86_64-w64-mingw32.zip -DestinationPath .
Copy-Item .\defichain-1.3.16\bin\defid.exe .
cd ..\..
Copy-Item temp\win\defid.exe binary\win\defid.exe
icacls binary\win\defid.exe /grant everyone:F
Expand All @@ -69,4 +69,4 @@ jobs:
- uses: actions/upload-artifact@v2
with:
name: win-build
path: 'dist/defi-app Setup 2.1.4.exe'
path: 'dist/defi-app Setup 2.1.5.exe'
6 changes: 3 additions & 3 deletions .github/workflows/release-builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ jobs:
rm -r -fo win -ErrorAction Ignore
mkdir win
cd win
curl https://github.com/DeFiCh/ain/releases/download/v1.3.15/defichain-1.3.15-x86_64-w64-mingw32.zip -O defichain-1.3.15-x86_64-w64-mingw32.zip
Expand-Archive -LiteralPath .\defichain-1.3.15-x86_64-w64-mingw32.zip -DestinationPath .
Copy-Item .\defichain-1.3.15\bin\defid.exe .
curl https://github.com/DeFiCh/ain/releases/download/v1.3.16/defichain-1.3.16-x86_64-w64-mingw32.zip -O defichain-1.3.16-x86_64-w64-mingw32.zip
Expand-Archive -LiteralPath .\defichain-1.3.16-x86_64-w64-mingw32.zip -DestinationPath .
Copy-Item .\defichain-1.3.16\bin\defid.exe .
cd ..\..
Copy-Item temp\win\defid.exe binary\win\defid.exe
icacls binary\win\defid.exe /grant everyone:F
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "defi-app",
"version": "2.1.4",
"version": "2.1.5",
"description": "DeFi blockchain client ui",
"main": "./electron-app/build/index.js",
"author": {
Expand Down
6 changes: 3 additions & 3 deletions pre-build-linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ cd ..
mkdir -p temp
cd temp && rm -rf linux
mkdir linux && cd linux
wget https://github.com/DeFiCh/ain/releases/download/v1.3.15/defichain-1.3.15-x86_64-pc-linux-gnu.tar.gz
tar -xvf defichain-1.3.15-x86_64-pc-linux-gnu.tar.gz
cp defichain-1.3.15/bin/defid .
wget https://github.com/DeFiCh/ain/releases/download/v1.3.16/defichain-1.3.16-x86_64-pc-linux-gnu.tar.gz
tar -xvf defichain-1.3.16-x86_64-pc-linux-gnu.tar.gz
cp defichain-1.3.16/bin/defid .
cd ../.. && cp temp/linux/defid binary/linux/defid
chmod 777 binary/linux/defid
6 changes: 3 additions & 3 deletions pre-build-mac.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ cd ..
mkdir -p temp
cd temp && rm -rf mac
mkdir mac && cd mac
wget https://github.com/DeFiCh/ain/releases/download/v1.3.15/defichain-1.3.15-x86_64-apple-darwin11.tar.gz
tar -xvf defichain-1.3.15-x86_64-apple-darwin11.tar.gz
cp defichain-1.3.15/bin/defid .
wget https://github.com/DeFiCh/ain/releases/download/v1.3.16/defichain-1.3.16-x86_64-apple-darwin11.tar.gz
tar -xvf defichain-1.3.16-x86_64-apple-darwin11.tar.gz
cp defichain-1.3.16/bin/defid .
cd ../.. && cp temp/mac/defid binary/mac/defid
chmod 777 binary/mac/defid
2 changes: 1 addition & 1 deletion webapp/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "defi-app",
"version": "2.1.4",
"version": "2.1.5",
"description": "DeFi blockchain client ui",
"author": {
"name": "DeFiChain Foundation",
Expand Down
2 changes: 2 additions & 0 deletions webapp/src/app/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import Popover from '../containers/PopOver';
import EncryptWalletModel from '../containers/PopOver/EncryptWalletModel';
import WalletPassphraseModel from '../containers/PopOver/WalletPassphraseModel';
import { getPageTitle } from '../utils/utility';
import RefreshUtxosModal from '../containers/PopOver/RefreshUtxosModal';

interface AppProps extends RouteComponentProps {
isRunning: boolean;
Expand Down Expand Up @@ -105,6 +106,7 @@ const App: React.FunctionComponent<AppProps> = (props: AppProps) => {
<WalletPassphraseModel />
<RestartWalletModel />
<GeneralReIndexModal />
<RefreshUtxosModal />
</>
);
};
Expand Down
3 changes: 2 additions & 1 deletion webapp/src/constants/configs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const PAYMENT_REQ_LIST_SIZE = 10;
export const QUEUE_CONCURRENCY = 5;
export const VERIFY_MNEMONIC_QUIZ_QUESTIONS_LIMIT = 6;
export const VERIFY_MNEMONIC_QUIZ_OPTIONS_PER_QUESTIONS_LIMIT = 3;
export const BALANCE_CRON_DELAY_TIME = 120000;
export const BALANCE_CRON_DELAY_TIME = 30000;
export const BITCOIN_CLI_REGEX = /bitcoin-cli/g;
export const DEFI_CLI_TEXT = 'defi-cli';
export const DEFAULT_ELECTRON_LOG_FORMAT =
Expand Down Expand Up @@ -58,6 +58,7 @@ export const UPDATE_MODAL_CLOSE_TIMEOUT = 1000;
export const ENTROPY_BITS = 256;
export const RANDOM_WORD_ENTROPY_BITS = 128;
export const DEFAULT_DFI_FOR_ACCOUNT_TO_ACCOUNT = 0.01;
export const DEFAULT_DFI_FOR_REFRESH_UTXOS = 0.1;
export const MINIMUM_UTXOS_FOR_LIQUIDITY = 0.05;
export const UNDEFINED_STRING = 'undefined';
export const LIST_TOKEN_PAGE_SIZE = 500;
Expand Down
39 changes: 39 additions & 0 deletions webapp/src/containers/PopOver/RefreshUtxosModal/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import React from 'react';
import { connect } from 'react-redux';
import { Modal, ModalBody } from 'reactstrap';
import { I18n } from 'react-redux-i18n';
import Loader from '../../../components/Loader';
import styles from '../popOver.module.scss';

interface RefreshUtxosModalProps {
isRefreshUtxosModalOpen: boolean;
}

const RefreshUtxosModal: React.FunctionComponent<RefreshUtxosModalProps> = (
props: RefreshUtxosModalProps
) => {
const { isRefreshUtxosModalOpen } = props;

return (
<Modal isOpen={isRefreshUtxosModalOpen} centered>
<ModalBody>
<div className={styles.errorModal}>
<Loader className='mb-4' size={28} />
<p>{I18n.t('alerts.refreshUtxos')}</p>
</div>
</ModalBody>
</Modal>
);
};

const mapStateToProps = (state) => {
const { isRefreshUtxosModalOpen } = state.settings;

return {
isRefreshUtxosModalOpen,
};
};

const mapDispatchToProps = {};

export default connect(mapStateToProps, mapDispatchToProps)(RefreshUtxosModal);
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { openGeneralReIndexModal } from '../../../PopOver/reducer';
interface SettingsTabGeneralProps {
launchAtLogin: boolean;
reindexAfterSaving: boolean;
refreshUtxosAfterSaving: boolean;
minimizedAtLaunch: boolean;
pruneBlockStorage: boolean;
blockStorage: number;
Expand All @@ -28,6 +29,7 @@ interface SettingsTabGeneralProps {
handleDropDowns: (data: any, field: any) => any;
openGeneralReIndexModal: () => void;
handeReindexToggle: () => void;
handeRefreshUtxosToggle: () => void;
}

const SettingsTabGeneral = (props: SettingsTabGeneralProps) => {
Expand All @@ -47,9 +49,11 @@ const SettingsTabGeneral = (props: SettingsTabGeneralProps) => {
networkOptions,
network,
reindexAfterSaving,
refreshUtxosAfterSaving,
handleDropDowns,
openGeneralReIndexModal,
handeReindexToggle,
handeRefreshUtxosToggle,
} = props;

return (
Expand Down Expand Up @@ -96,6 +100,17 @@ const SettingsTabGeneral = (props: SettingsTabGeneralProps) => {
/>
</Col>
</Row>
<Row className='mb-5'>
<Col md='4'>{I18n.t('containers.settings.refreshUtxos')}</Col>
<Col md='8' lg='6'>
<SettingsRowToggle
handleToggles={handeRefreshUtxosToggle}
label={'refreshUtxosAfterSaving'}
field={refreshUtxosAfterSaving}
fieldName={'refreshUtxosAfterSaving'}
/>
</Col>
</Row>
<Row className='mb-5'>
<Col md='4'>{I18n.t('containers.settings.utxoConsolidator')}</Col>
<Col md='8' lg='6'>
Expand Down
22 changes: 20 additions & 2 deletions webapp/src/containers/SettingsPage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ interface SettingsPageProps {
getSettingOptionsRequest: () => void;
updateSettings: (data: any) => void;
changeLanguage: () => void;
isRefreshUtxosModalOpen: boolean;
}

interface SettingsPageState {
Expand Down Expand Up @@ -78,6 +79,9 @@ const SettingsPage: React.FunctionComponent<SettingsPageProps> = (
});

const [reindexAfterSaving, setIsReindexAfterSaving] = useState(false);
const [refreshUtxosAfterSaving, setIsRefreshUtxosAfterSaving] = useState(
false
);

useEffect(() => {
props.getSettingOptionsRequest();
Expand All @@ -94,7 +98,10 @@ const SettingsPage: React.FunctionComponent<SettingsPageProps> = (
if (!props.isRestart) {
setIsReindexAfterSaving(false);
}
}, [props.isRestart]);
if (!props.isRefreshUtxosModalOpen) {
setIsRefreshUtxosAfterSaving(false);
}
}, [props.isRestart, props.isRefreshUtxosModalOpen]);

useEffect(() => {
const prevPropsValue =
Expand Down Expand Up @@ -137,6 +144,10 @@ const SettingsPage: React.FunctionComponent<SettingsPageProps> = (
setIsReindexAfterSaving(!reindexAfterSaving);
};

const handeRefreshUtxosToggle = () => {
setIsRefreshUtxosAfterSaving(!refreshUtxosAfterSaving);
};

const handleFractionalNumInputs = (
event: { target: { name: string; value: string } },
field: string
Expand Down Expand Up @@ -232,6 +243,7 @@ const SettingsPage: React.FunctionComponent<SettingsPageProps> = (
maximumCount,
feeRate,
reindexAfterSaving: reindexAfterSaving,
refreshUtxosAfterSaving,
};
props.updateSettings(settings);
};
Expand Down Expand Up @@ -283,12 +295,14 @@ const SettingsPage: React.FunctionComponent<SettingsPageProps> = (
feeRate={feeRate!}
scriptVerificationThreads={scriptVerificationThreads!}
reindexAfterSaving={reindexAfterSaving!}
refreshUtxosAfterSaving={refreshUtxosAfterSaving}
handleRegularNumInputs={handleRegularNumInputs}
handleFractionalInputs={handleFractionalNumInputs}
handleToggles={handleToggles}
network={network!}
handleDropDowns={handleDropDowns}
handeReindexToggle={handeReindexToggle}
handeRefreshUtxosToggle={handeRefreshUtxosToggle}
/>
<SettingsTabDisplay
language={language!}
Expand All @@ -299,7 +313,9 @@ const SettingsPage: React.FunctionComponent<SettingsPageProps> = (
</TabContent>
</div>
<SettingsTabsFooter
isUnsavedChanges={isUnsavedChanges || reindexAfterSaving}
isUnsavedChanges={
isUnsavedChanges || reindexAfterSaving || refreshUtxosAfterSaving
}
saveChanges={saveChanges}
/>
</div>
Expand All @@ -313,6 +329,7 @@ const mapStateToProps = (state) => {
appConfig,
isUpdating,
isUpdated,
isRefreshUtxosModalOpen,
} = state.settings;
const { isRestart } = state.popover;
const { locale } = state.i18n;
Expand All @@ -324,6 +341,7 @@ const mapStateToProps = (state) => {
isUpdated,
locale,
isRestart,
isRefreshUtxosModalOpen,
};
};

Expand Down
9 changes: 9 additions & 0 deletions webapp/src/containers/SettingsPage/reducer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export const initialState = {
amountUnits: [],
displayModes: [],
networkOptions: [],
isRefreshUtxosModalOpen: false,
};

const configSlice = createSlice({
Expand Down Expand Up @@ -66,6 +67,12 @@ const configSlice = createSlice({
state.isUpdating = false;
state.settingsError = action.payload;
},
refreshUtxosRequest(state) {
state.isRefreshUtxosModalOpen = true;
},
refreshUtxosSuccess(state) {
state.isRefreshUtxosModalOpen = false;
},
},
});

Expand All @@ -81,6 +88,8 @@ export const {
updateSettingsRequest,
updateSettingsSuccess,
updateSettingsFailure,
refreshUtxosRequest,
refreshUtxosSuccess,
} = actions;

export default reducer;
4 changes: 4 additions & 0 deletions webapp/src/containers/SettingsPage/saga.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {
getAmountUnits,
getDisplayModes,
getNetWorkList,
refreshUtxosAfterSavingData,
} from './service';
import store from '../../app/rootStore';
import { setupI18n } from '../../translations/i18n';
Expand Down Expand Up @@ -117,6 +118,9 @@ export function* updateSettings(action) {
yield call(shutDownBinary);
yield call(restartNode, { isReindexReq: true });
}
if (data.refreshUtxosAfterSaving) {
yield call(refreshUtxosAfterSavingData);
}
} else {
yield put({
type: updateSettingsFailure.type,
Expand Down
Loading

0 comments on commit a940153

Please sign in to comment.