Skip to content

Commit

Permalink
Merge pull request #165 from DeFiCh/ci/master
Browse files Browse the repository at this point in the history
Ci/master
  • Loading branch information
saurabh391 committed Dec 23, 2020
2 parents 2b7f07d + 6dde7b6 commit 81014aa
Show file tree
Hide file tree
Showing 114 changed files with 2,682 additions and 1,614 deletions.
14 changes: 8 additions & 6 deletions .github/workflows/dev-builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ on:
push:
branches:
- ci/*
- fix/issues-liquidity
- feature/add-receive-address-manually
- master
jobs:
build_linux_version:
Expand All @@ -17,7 +19,7 @@ jobs:
- uses: actions/upload-artifact@v2
with:
name: linux-build
path: 'dist/defi-app-2.1.3.AppImage'
path: 'dist/defi-app-2.1.4.AppImage'

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

build_windows_version:
runs-on: windows-latest
Expand All @@ -56,9 +58,9 @@ jobs:
rm -r -fo win -ErrorAction Ignore
mkdir win
cd win
curl https://github.com/DeFiCh/ain/releases/download/v1.3.9/defichain-1.3.9-x86_64-w64-mingw32.zip -O defichain-1.3.9-x86_64-w64-mingw32.zip
Expand-Archive -LiteralPath .\defichain-1.3.9-x86_64-w64-mingw32.zip -DestinationPath .
Copy-Item .\defichain-1.3.9\bin\defid.exe .
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 .
cd ..\..
Copy-Item temp\win\defid.exe binary\win\defid.exe
icacls binary\win\defid.exe /grant everyone:F
Expand All @@ -67,4 +69,4 @@ jobs:
- uses: actions/upload-artifact@v2
with:
name: win-build
path: 'dist/defi-app Setup 2.1.3.exe'
path: 'dist/defi-app Setup 2.1.4.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.9/defichain-1.3.9-x86_64-w64-mingw32.zip -O defichain-1.3.9-x86_64-w64-mingw32.zip
Expand-Archive -LiteralPath .\defichain-1.3.9-x86_64-w64-mingw32.zip -DestinationPath .
Copy-Item .\defichain-1.3.9\bin\defid.exe .
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 .
cd ..\..
Copy-Item temp\win\defid.exe binary\win\defid.exe
icacls binary\win\defid.exe /grant everyone:F
Expand Down
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@ For direct download, check the [Releases](https://github.com/DeFiCh/app/releases

`npm run init` initialize and install npm dependency for electron and webapp

## Setup binary

Fetch and extract binary file

Mac: `sh ./pre-build-mac.sh`
Linux: `sh ./pre-build-linux.sh`
Windows: `sh ./pre-build-win.sh`

### Run Electron desktop app with webapp

`npm start`
Expand Down
11 changes: 7 additions & 4 deletions electron-app/src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,12 @@ export default class App {
autoUpdater.checkForUpdatesAndNotify().catch((e) => {
log.error(e);
});

initiateElectronUpdateManager(autoUpdater, this.mainWindow);
initiateBackupImportWalletManager(this.mainWindow, this.createMenu.bind(this));
initiateBackupImportWalletManager(
this.mainWindow,
this.createMenu.bind(this)
);
createMnemonicAction();
};

Expand Down Expand Up @@ -128,9 +131,9 @@ export default class App {
}

// Create menu
createMenu(enableReset?: boolean) {
createMenu(isWalletLoaded?: boolean) {
const appMenu = new AppMenu();
const template = appMenu.getTemplate(enableReset);
const template = appMenu.getTemplate(isWalletLoaded);
const menu = Menu.buildFromTemplate(template);
Menu.setApplicationMenu(menu);
}
Expand Down
1 change: 1 addition & 0 deletions electron-app/src/constants/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,4 @@ export const DEFAULT_ELECTRON_FORMAT =
export const DISCLAIMER_DIALOG_TIMER = 10000;
export const STOP_BINARY_INTERVAL = 500;
export const REINDEX_ERROR_STRING = 'restart with -reindex';
export const ACCOUNT_HISTORY_REINDEX_ERROR_STRING = 'Account history needs rebuild';
15 changes: 9 additions & 6 deletions electron-app/src/ipc-events/backupAndImportWallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,16 @@ const initiateBackupImportWalletManager = (
}
});

ipcMain.on(ENABLE_RESET_MENU, async () => {
try {
createMenu(true);
} catch (err) {
console.log(err);
ipcMain.on(
ENABLE_RESET_MENU,
async (event: Electron.IpcMainEvent, arg: any) => {
try {
createMenu(arg?.isWalletCreatedFlag);
} catch (err) {
console.log(err);
}
}
});
);
};

export default initiateBackupImportWalletManager;
6 changes: 4 additions & 2 deletions electron-app/src/menus/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,28 +12,30 @@ import { logFilePath } from '../services/electronLogger';
import Logs from '../controllers/logs';

export default class AppMenu {
getTemplate(enableReset?: boolean) {
getTemplate(isWalletLoaded?: boolean) {
const template: Electron.MenuItemConstructorOptions[] = [
{
label: 'Wallet',
submenu: [
{
label: 'Import Wallet',
enabled: !!isWalletLoaded,
click(item, bw) {
const wallet = new Wallet();
wallet.load(bw);
},
},
{
label: 'Backup Wallet',
enabled: !!isWalletLoaded,
click(item, bw) {
const wallet = new Wallet();
wallet.startBackupWallet(bw);
},
},
{
label: 'Reset Wallet',
enabled: !!enableReset,
enabled: !!isWalletLoaded,
click(item, bw) {
const wallet = new Wallet();
wallet.resetWallet(bw);
Expand Down
8 changes: 6 additions & 2 deletions electron-app/src/services/defiprocessmanager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
DEFAULT_RPC_ALLOW_IP,
STOP_BINARY_INTERVAL,
REINDEX_ERROR_STRING,
ACCOUNT_HISTORY_REINDEX_ERROR_STRING,
} from '../constants';
import {
checkPathExists,
Expand Down Expand Up @@ -97,8 +98,11 @@ export default class DefiProcessManager {

// on STDERR
child.stderr.on('data', (err) => {
const regex = new RegExp(REINDEX_ERROR_STRING, 'g');
const res = regex.test(err?.toString('utf8').trim());
const regex = new RegExp(REINDEX_ERROR_STRING, 'gi');
const regex1 = new RegExp(ACCOUNT_HISTORY_REINDEX_ERROR_STRING, 'gi');

const errorString = err?.toString('utf8').trim();
const res = regex.test(errorString) || regex1.test(errorString);

// change value of isReindexReq variable based on regex evaluation
if (res) {
Expand Down
5 changes: 5 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"name": "defi-app",
"version": "2.1.3",
"version": "2.1.4",
"description": "DeFi blockchain client ui",
"main": "./electron-app/build/index.js",
"author": {
"name": "Cake",
"email": "cake@cakedefi.com",
"url": "http://cakedefi.com/"
"name": "DeFiChain Foundation",
"email": "engineering@defichain.com",
"url": "http://defichain.com/"
},
"homepage": "./",
"publicPath": "./",
Expand Down Expand Up @@ -77,6 +77,7 @@
"random-binary": "^1.0.3",
"random-string": "^0.2.0",
"react-ellipsis-text": "^1.2.1",
"react-icons": "^4.1.0",
"react-md-spinner": "^1.0.0",
"uid": "^1.0.0",
"uifx": "^2.0.7",
Expand Down
6 changes: 3 additions & 3 deletions pre-build-linux.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 linux
mkdir linux && cd linux
wget https://github.com/DeFiCh/ain/releases/download/v1.3.9/defichain-1.3.9-x86_64-pc-linux-gnu.tar.gz
tar -xvf defichain-1.3.9-x86_64-pc-linux-gnu.tar.gz
cp defichain-1.3.9/bin/defid .
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 .
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.9/defichain-1.3.9-x86_64-apple-darwin11.tar.gz
tar -xvf defichain-1.3.9-x86_64-apple-darwin11.tar.gz
cp defichain-1.3.9/bin/defid .
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 .
cd ../.. && cp temp/mac/defid binary/mac/defid
chmod 777 binary/mac/defid
2 changes: 1 addition & 1 deletion webapp/.neutrinorc.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ module.exports = {
clean: true,
devtool: {
production: 'nosources-source-map',
development: 'cheap-module-eval-source-map',
development: 'inline-source-map',
},
env: {
DEBUG: process.env.DEBUG || true,
Expand Down
Loading

0 comments on commit 81014aa

Please sign in to comment.