Skip to content

Commit

Permalink
Merge pull request #279 from DeFiCh/ci/master
Browse files Browse the repository at this point in the history
release: 2.1.7
  • Loading branch information
monstrobishi committed Jan 13, 2021
2 parents b0599e0 + 480f11d commit 1275454
Show file tree
Hide file tree
Showing 148 changed files with 12,438 additions and 2,232 deletions.
37 changes: 14 additions & 23 deletions .github/workflows/dev-builds.yml
Original file line number Diff line number Diff line change
@@ -1,71 +1,62 @@
on:
push:
branches:
- ci/master
- 'ci/**'
- master
- code-refactoring
jobs:
build_linux_version:
runs-on: ubuntu-latest
env:
GH_TOKEN: ${{ secrets.GH_TOKEN}}
steps:
- uses: actions/checkout@v2
- name: Get App Version
uses: nyaayaya/package-version@v1
- name: install dependencies
run: npm cache clean --force && npm run init
- name: Build app
run: npm run build:linux
- uses: actions/upload-artifact@v2
with:
name: linux-build
path: 'dist/defi-app-2.1.6.AppImage'
path: 'dist/defi-app-${{ env.PACKAGE_VERSION}}.AppImage'

build_mac_version:
runs-on: macos-latest
env:
GH_TOKEN: ${{ secrets.GH_TOKEN}}
CSC_LINK: ${{ secrets.CSC_LINK}}
CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD}}
CI: true
steps:
- uses: actions/checkout@v2
- name: Get App Version
uses: nyaayaya/package-version@v1
- name: install dependencies
run: npm cache clean --force && npm run init
- name: Build app
run: npm run build:mac
- uses: actions/upload-artifact@v2
with:
name: mac-build
path: 'dist/defi-app-2.1.6.dmg'
path: 'dist/defi-app-${{ env.PACKAGE_VERSION}}.dmg'

build_windows_version:
runs-on: windows-latest
env:
GH_TOKEN: ${{ secrets.GH_TOKEN}}
CSC_LINK: ${{ secrets.CSC_LINK}}
CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD}}
steps:
- uses: actions/checkout@v2
- name: Get App Version
uses: nyaayaya/package-version@v1
- name: install dependencies
run: npm cache clean --force && npm run init
- name: Build app
run: |
mkdir binary -ea 0
cd binary
rm -r -fo win, mac, linux -ErrorAction Ignore
mkdir win
cd ..
mkdir temp -ea 0
cd temp
rm -r -fo win -ErrorAction Ignore
mkdir win
cd win
curl https://github.com/DeFiCh/ain/releases/download/v1.3.17rc3/defichain-1.3.17rc3-x86_64-w64-mingw32.zip -O defichain-1.3.17rc3-x86_64-w64-mingw32.zip
Expand-Archive -LiteralPath .\defichain-1.3.17rc3-x86_64-w64-mingw32.zip -DestinationPath .
Copy-Item .\defichain-1.3.17rc3\bin\defid.exe .
cd ..\..
Copy-Item temp\win\defid.exe binary\win\defid.exe
icacls binary\win\defid.exe /grant everyone:F
npm run build:win
run: npm run build:win
shell: powershell
- uses: actions/upload-artifact@v2
with:
name: win-build
path: 'dist/defi-app Setup 2.1.6.exe'
path: 'dist/defi-app Setup ${{ env.PACKAGE_VERSION}}.exe'
22 changes: 4 additions & 18 deletions .github/workflows/release-builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ jobs:
GH_TOKEN: ${{ secrets.GH_TOKEN}}
CSC_LINK: ${{ secrets.CSC_LINK}}
CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD}}
CI: true

steps:
- uses: actions/checkout@v2
Expand All @@ -43,6 +44,8 @@ jobs:
runs-on: windows-latest
env:
GH_TOKEN: ${{ secrets.GH_TOKEN}}
CSC_LINK: ${{ secrets.CSC_LINK}}
CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD}}

steps:
- uses: actions/checkout@v2
Expand All @@ -51,24 +54,7 @@ jobs:
run: npm cache clean --force && npm run init

- name: Build app
run: |
mkdir binary -ea 0
cd binary
rm -r -fo win, mac, linux -ErrorAction Ignore
mkdir win
cd ..
mkdir temp -ea 0
cd temp
rm -r -fo win -ErrorAction Ignore
mkdir win
cd win
curl https://github.com/DeFiCh/ain/releases/download/v1.3.17rc3/defichain-1.3.17rc3-x86_64-w64-mingw32.zip -O defichain-1.3.17rc3-x86_64-w64-mingw32.zip
Expand-Archive -LiteralPath .\defichain-1.3.17rc3-x86_64-w64-mingw32.zip -DestinationPath .
Copy-Item .\defichain-1.3.17rc3\bin\defid.exe .
cd ..\..
Copy-Item temp\win\defid.exe binary\win\defid.exe
icacls binary\win\defid.exe /grant everyone:F
shell: powershell
run: npm run pre:build:win

- name: Publish app
run: npm run publish:win
4 changes: 2 additions & 2 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2020 DeFi Blockchain Developers
Copyright (c) 2020-2021 DeFi Blockchain Developers

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand All @@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
THE SOFTWARE.
77 changes: 49 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,52 +1,73 @@
# DeFi app
# DeFi App

![Image](https://i.imgur.com/F7tpKU5.png)
Use DeFi app to interact with DeFiChain. It is a wallet for \$DFI, wrapped BTC, ETH, USDT. Liquidity mine, use the DEX, create masternodes, and more.
![Image](https://defichain.com/img/app/liquidity@2x.png)

For direct download, check the [Releases](https://github.com/DeFiCh/app/releases) for latest downloadable binaries for Windows, Mac and Linux.
# Documentation
- [Getting started](#getting-started)
- [Development](#development)
- [About Us](https://defichain.com/)

## Scripts
# Getting Started
[Download the desktop app](https://defichain.com/downloads/) or [check releases](https://github.com/DeFiCh/app/releases) for latest downloadable installers for Windows, Mac and Linux.

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

## Setup binary
## Initial Setup

Fetch and extract binary file
##### Install all dependencies for both Electron and WebApp

Mac: `sh ./pre-build-mac.sh`
Linux: `sh ./pre-build-linux.sh`
Windows: `sh ./pre-build-win.sh`
```bash
npm run init
```

### Run Electron desktop app with webapp
##### Setup the required binary

`npm start`
To connect to the node, you need to setup the binary. Run the command below that matches your Operating System.

### Run Electron desktop app with webapp in dev mode
| Operating System | Command |
| ---------------- | ------------------------- |
| Windows | `npm run pre:build:win` |
| Mac | `npm run pre:build:mac` |
| Linux | `npm run pre:build:linux` |

`npm run start:dev`
## Running Apps (Electron and WebApp)

### Run webapp
##### To run both apps in Dev Mode

`npm run start:react`
```bash
npm run start:dev
```

### Build react app
##### To run WebApp only

`npm run build:react`
```bash
npm run start:react
```

### Build electron app for native platform
##### To run Electron only

`npm run build`
```bash
npm run start:electron
```

### Build electron app for all platform
## Building Apps

`npm run build:all`
##### To build the app using native platform

## Electron configuration
```bash
npm run build
```

Electron config is in [electron-app/index.ts](electron-app/index.ts)
##### To build the app for all platforms

## License
```bash
npm run build:all
```

The DeFi Blockchain App is released under the terms of the MIT license. For more
information see https://opensource.org/licenses/MIT.
## Licenses

QR scanner shutter audio `webapp/src/assets/audio/shutter.mp3` is licensed by [Soundsnap](https://www.soundsnap.com). Commercial redistribution of the audio is prohibited. For full Soundsnap license, visit [https://www.soundsnap.com/licence](https://www.soundsnap.com/licence).
The DeFi Blockchain App is released under the terms of the MIT license. For more information see https://opensource.org/licenses/MIT.

QR scanner shutter audio `webapp/src/assets/audio/shutter.mp3` is licensed by [Soundsnap](https://www.soundsnap.com).
Commercial redistribution of the audio is prohibited. For full Soundsnap license, visit [https://www.soundsnap.com/licence](https://www.soundsnap.com/licence).
18 changes: 18 additions & 0 deletions electron-app/assets/entitlements.mac.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.cs.allow-unsigned-executable-memory</key>
<true/>
<key>com.apple.security.cs.allow-jit</key>
<true/>
<key>com.apple.security.cs.disable-library-validation</key>
<true/>
<key>com.apple.security.files.user-selected.read-write</key>
<true/>
<key>com.apple.developer.aps-environment</key>
<true/>
<key>com.apple.security.device.camera</key>
<true/>
</dict>
</plist>
30 changes: 30 additions & 0 deletions electron-app/assets/notarize.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
const { notarize } = require('electron-notarize');
const { build } = require('../../package.json');

exports.default = async function notarizeMacOS(context) {
const { electronPlatformName, appOutDir } = context;
if (electronPlatformName !== 'darwin') {
return;
}

if (!process.env.CI) {
console.warn('Skipping notarizing step. Packaging is not running in CI');
return;
}

if (!('APPLE_ID' in process.env && 'APPLE_ID_PASS' in process.env)) {
console.warn(
'Skipping notarizing step. APPLE_ID and APPLE_ID_PASS env variables must be set'
);
return;
}

const appName = context.packager.appInfo.productFilename;

await notarize({
appBundleId: build.appId,
appPath: `${appOutDir}/${appName}.app`,
appleId: process.env.APPLE_ID,
appleIdPassword: process.env.APPLE_ID_PASS,
});
};
4 changes: 2 additions & 2 deletions electron-app/src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ import {
ACTIVATE,
CLOSE,
SECOND_INSTANCE,
STOP_BINARY_AND_QUEUE,
} from './constants';
import initiateElectronUpdateManager from './ipc-events/electronupdatemanager';
import ElectronLogger from './services/electronLogger';
import initiateBackupImportWalletManager from './ipc-events/backupAndImportWallet';
import { createMnemonicAction } from './ipc-events/createMnemonic';
import { STOP_BINARY_AND_QUEUE } from '@defi_types/ipcEvents';

declare var process: {
argv: any;
Expand Down Expand Up @@ -84,7 +84,7 @@ export default class App {
protocol.interceptFileProtocol('file', (request, callback) => {
/* all urls start with 'file://' */
const fileUrl = request.url.substr(7);
const basePath = path.normalize(`${__dirname}/../../../webapp`);
const basePath = path.normalize(`${__dirname}/../../../../webapp`);
if (this.isDevMode) {
callback(path.normalize(`${basePath}/build/release/${fileUrl}`));
} else {
Expand Down
2 changes: 0 additions & 2 deletions electron-app/src/constants/app.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import path from 'path';

export const SITE_URL = 'https://defichain.com/';
export const ICON = path.join(
__dirname,
'/electron-app/assets/icon/icon-512.png'
Expand All @@ -13,7 +12,6 @@ export const ACTIVATE = 'activate';
export const CLOSE = 'close';
export const CLOSED = 'closed';
export const SECOND_INSTANCE = 'second-instance';
export const RESTART_APP = 'restart-app';

export const DARWIN = 'darwin';
export const MAC = 'mac';
Expand Down
2 changes: 1 addition & 1 deletion electron-app/src/constants/dirpath.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const BINARY_FILE_NAME = getPlatform() === 'win' ? 'defid.exe' : 'defid';
export const BINARY_FILE_PATH = IS_DEV
? path.join(rootPath, './binary', getPlatform())
: IS_PACKAGED
? path.join(__dirname, '../../../../..', 'binary', getPlatform())
? path.join(__dirname, '../../../../../..', 'binary', getPlatform())
: path.join(rootPath, '../', 'binary', getPlatform());

export const CONFIG_FILE_PATH = path.join(HOME_PATH, '/.defi', 'defi.conf');
Expand Down
2 changes: 0 additions & 2 deletions electron-app/src/constants/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
export * from './app';
export * from './dirpath';
export * from './ipcevents';
export * from './uiconfig';
4 changes: 2 additions & 2 deletions electron-app/src/controllers/wallets.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import path from 'path';
import * as log from '../services/electronLogger';
import DialogManager from '../services/dialogmanager';
import { WALLET_DAT } from '../constants';
import {
MENU_BACKUP_WALLET,
MENU_IMPORT_WALLET,
RESET_BACKUP_WALLET,
START_BACKUP_WALLET,
WALLET_DAT,
} from '../constants';
} from '@defi_types/ipcEvents';
import { copyFile, deleteFile, getBaseFolder, responseMessage } from '../utils';

const saveFileDailog = async (
Expand Down
5 changes: 4 additions & 1 deletion electron-app/src/ipc-events/appUpdateManager.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import { CancellationToken } from 'electron-updater';
import { app, ipcMain } from 'electron';
import { POST_UPDATE_ACTION, START_DOWNLOAD_UPDATE } from '../constants';
import {
POST_UPDATE_ACTION,
START_DOWNLOAD_UPDATE,
} from '@defi_types/ipcEvents';

export default function initiateAppUpdateManager(autoUpdater: any) {
ipcMain.on(POST_UPDATE_ACTION, () => {
Expand Down
2 changes: 1 addition & 1 deletion electron-app/src/ipc-events/autostart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
PRELAUNCH_PREFERENCE_DISABLE,
PRELAUNCH_PREFERENCE_ENABLE,
PRELAUNCH_PREFERENCE_STATUS,
} from '../constants';
} from '@defi_types/ipcEvents';

export default function initiateAutoStart() {
ipcMain.on(PRELAUNCH_PREFERENCE_STATUS, async (event) => {
Expand Down
2 changes: 1 addition & 1 deletion electron-app/src/ipc-events/backupAndImportWallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
BACKUP_WALLET_DAT,
REPLACE_WALLET_DAT,
ENABLE_RESET_MENU,
} from '../constants';
} from '@defi_types/ipcEvents';
import Wallet from '../controllers/wallets';
import { responseMessage } from '../utils';

Expand Down
2 changes: 1 addition & 1 deletion electron-app/src/ipc-events/createMnemonic.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ipcMain } from 'electron';
import { CREATE_MNEMONIC } from '../constants';
import { CREATE_MNEMONIC } from '@defi_types/ipcEvents';
import Mnemonic from '../mnemonic';

export const createMnemonicAction = () => {
Expand Down
Loading

0 comments on commit 1275454

Please sign in to comment.