/blockchain-wallet-v4-frontend

Next generation (pre-release) version of Blockchain Wallet built with React & Redux

Primary LanguageJavaScript

Build Status Coverage Status js-standard-style

Blockchain Wallet v4

Be Your Own Bank at blockchain.info/wallet. Please contact support if you have any issues using the wallet.

About

This repo contains the three codebases/packages listed below that are combined into one via Lerna.

Packages

Local Development

  1. Ensure Node version >= 8.0 is installed
  2. Ensure lerna and yarn are installed globally: npm install -g lerna yarn
  3. Install and link packages: yarn bootstrap
  4. Start application in dev mode: yarn start
  5. The frontend will now be accessible via browser at localhost:8080

Important Notes

  1. After installing or uninstalling a NPM package, run the following node command at the root of the project:
    • lerna bootstrap
  2. All developer specific dependencies should be installed in the top level package.json. This helps reduce duplicate packages as well as speed up build times.
    • yarn i --save-dev [package-name]
  3. To test bitcoin handling in dev mode: run this javascript command in the browser console:
    • window.navigator.registerProtocolHandler('bitcoin', http://localhost:8080/a/%s, 'Blockchain')

Useful Chrome Extensions

Production Builds

To build the frontend application for production: yarn build:prod

Code Quality

Linting

We follow the rules outlined by the Javascript Standard Style as well as a few React specfic rules.

Code linting is handled by ESLint. The following commands are available:

These IDE plugins/packages assist with complying with these lint rules while developing:

Unit Tests

Testing is done via Jest and Enzyme.

Running Tests

Running Tests via Watch

Debugging Tests

To enable debugging for unit tests via the Chrome browser, run the following commands:

After running one of the above commands, Node will wait for a debugger to attach before starting the tests. To attach, simply open your browser and go to chrome://inspect and click on "Open Dedicated DevTools for Node", which will give you a list of available node instances you can connect to. Click on the address displayed in the terminal (usually localhost:9229) and you will be able to debug tests using Chrome's DevTools.

Updating Snapshot Tests

We are snapshot testing UI some components. Here are the commands to update them when necessary:

Code Coverage

To generate code coverage reports via Istanbul, the following commands are available:

Depending upon which coverage report was ran, the results can be found in the following directories:

  • coverage/index.html
  • coverage/blockchain-info-components/index.html
  • coverage/blockchain-wallet-v4/index.html
  • coverage/blockchain-wallet-v4-frontend/index.html Simply open the index.html file in your browser to view.

CI Build Vetting

To run both unit tests and linting, the following commands are available:

Bundle Reports

To visualize and interact with the treemap of the production code bundles files:

  • yarn analyze Once completed, a browser will automatically open with the results.

Storybook

Storybook is used by the blockchain-info-components package to interactively view, develop and test components.
The following commands are available:

  • storybook:build: Builds the static storybook assets
  • storybook:serve Builds storybook assets and then serves them locally at localhost:6006

Contribute

Bug fixes and feedback on our code is always appreciated.

Security

Security issues can be reported to us in the following venues: