June 6, 2019

956 words 5 mins read

LiskHQ/lisk-desktop

LiskHQ/lisk-desktop

Lisk graphical user interface for desktop

repo name LiskHQ/lisk-desktop
repo link https://github.com/LiskHQ/lisk-desktop
homepage https://lisk.io/wallet
language JavaScript
size (curr.) 56018 kB
stars (curr.) 564
created 2017-11-02
license GNU General Public License v3.0

Lisk Desktop

Build Status Coverage Status License: GPL v3 GitHub package.json version DeepScan grade Dependencies Status devDependencies Status

For Contributors

Please see CONTRIBUTING_GUIDE.md for more information.

Development

Setup environemnt

git clone https://github.com/LiskHQ/lisk-desktop.git
cd lisk-desktop
npm install
npm run dev

Run on browser

Open http://localhost:8080

For ease of development, you can set the following query string to see network options in login page:

http://localhost:8080/#/?showNetwork=true

If you are actively developing in a specific route, and want to be automatically signed in every time you reload the page, please add the following input pairs to your localStorage:

loginKey: a valid passphrase

Add the above pair using the storage tab in your dev tools or via JavaScript command:

localStorage.setItem('loginKey', 'wagon stock borrow episode laundry kitten salute link globe zero feed marble') // desired account passphrase

When developing with hardware wallet, this will sign you in using the first account on the first connected hardware wallet:

localStorage.setItem('hwWalletAutoLogin', true);

You can use the same approach to define a desired network to which Lisk Desktop connects:

localStorage.setItem('liskCoreUrl', 'http://localhost:4000') // desired node to log in into

Build

Production build

To build the project simply run

npm run build

Under the hood, this script runs

npm run build-prod

to build the React app under src/ and

npm run build-electron

to build the electron app under app/ using webpack. You can run the above scripts individually if you’re looking to see the changes solely on one of the two said applications.

Using Commercial Fonts

Basier Circle and Gilroy used in the production version are commercial fonts. This repository only contains open fonts and uses Open Sans as a replacement for the commercial ones.

If you have licensed copies of Basier Circle and Gilroy, you can add them to fonts folder to replace the empty files that are there so that webpack build doesn’t fail if the fonts are not present.

Run Electron

If you have already built the application as described above, you can launch Electron using

npm run start

Run with parameters

To launch a version which supports hardware wallets, you can run

npm run dev-hardware-wallet

or to launch electron and receive live updates from already running webpack-dev-server on port 8080 and you can run

LISK_HUB_URL="http://localhost:8080" DEBUG=true npm run start

This comes with Redux dev tools.

Distribution

Windows

Build package for Windows (on Windows in Git BASH).

npm run pack:win

macOS

Build package for macOS (on macOs)

npm run pack 

Linux

Build package for Linux (on Linux).

npm run pack 

Testing

Unit tests

Single run

npm run test

Run each time a file changes

npm run test-live

E2E tests

In order to run e2e tests you need to install lisk-core

Setup core

Setup a lisk test node as described in https://github.com/LiskHQ/lisk#tests

Run lisk test node with pm2 on localhost:4000

Run

Start the development version of Lisk:

npm run dev

Apply blockchain snapshot

./test/e2e-test-setup.sh ~/git/lisk/

(replace ~/git/lisk/ with your path to lisk core)

Run e2e tests

npm run cypress:run

React Storybook

To launch storybook sandbox with components run

npm run storybook

and navigate to

http://localhost:6006/

Directory Layout

├── __mocks__/                     # Modules used to mock dependencies for testing purpose.
├── .storybook/                    # React storybooks reside here.
├── app/                           # Electron based application that launces the react app.
├── build/                         # Build specific materials.
├── config/                        # Automation scripts (Webpack configurations, i18n scanner, etc)
├── coverage/                      # Results of Jest test coverage.
├── dist/                          # Platform specific built outputs.
├── docs/                          # Project documentations such as contribution guides and development guidelines.
├── i18n/                          # Localization files inluding setup scripts and translation json files.
├── libs/                          # Modules which can be consumed individually in other projects.
├── node_modules/                  # 3rd-party libraries and utilities.
├── src/                           # Application source code.
│   ├── actions/                   # Store actions reside here and are broken into script files dedicated to each system entity.
│   ├── app/                       # The bootstrap React application
│   ├── assets/                    # Static files (images, fonts, etc)
│   ├── components/                # React presentational components are located here.
│   │   ├── screens/               # These are the component that represent screens with dedicated URL.
│   │   ├── shared/                # These are the React components used at least in 2 other components (calendar, liskAmount, etc)
│   │   └── toolbox/               # Basic elements with basic styles and functionality which are used in numerous places (button, input, etc)
│   ├── constants/                 # Names, addresses, static configurations and other values used throughout the application
│   ├── context/                   # React context configuration files
│   ├── hooks/                     # React custom hooks
│   ├── store/                     # Redux store resides here.
│   │   ├── middlewares/           # All the Redux middlewares are places here and have their dedicated script files based on the system entities.
│   │   ├── reducers/              # Redux reducers are located here. similar to actions and reducers, they are placed in script files named after the entity they represent.
│   ├── utils/                     # Utility functions
└──test/                           # E2E tests written with Cypress.io and Cucumber; also some helpers used by unit test that live in /src

Contributors

See contributors section.

License

Copyright © 2016-2018 Lisk Foundation

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

comments powered by Disqus