Be Your Own Bank at blockchain.info/wallet. Please contact support if you have any issues using the wallet.
This repo contains the three codebases/packages listed below that are combined into one via Lerna.
- blockchain-info-components The shared UI components library.
- blockchain-wallet-v4 The functional library for handling wallets.
- blockchain-wallet-v4-frontend The frontend application built with React/Redux.
- Ensure Node version >= 8.0 is installed
- Run the following command to install necessary global packages:
npm install -g lerna yarn babel-cli rimraf cross-env
- Install, link and hoist packages:
yarn bootstrap
- Start the application in development mode:
yarn start
- The frontend application will now be accessible via browser at
localhost:8080
To ensure proper support for Windows, please take the following actions before running the above setup isntructions.
- Open a Powershell window with rights elevated to an Administrator.
- Run
npm install -g windows-build-tools
. This will install Python 2.7 and Visual C++ Build Tools which are required to compile some native Node modules. - Ensure Python has been added to your environment variables by opening a cmd prompt and typing
python
. If you get aCommandNotFoundException
message, add the folder%USERPROFILE%\.windows-build-tools\python27
to your environment variables.
- To completely remove all dependencies and artifacts run
yarn clean
- After installing or uninstalling a NPM package, run
yarn bootstrap
to re-init the project - All development specific dependencies should be installed as a
dev-dependency
in the top levelpackage.json
viayarn i --save-dev [package-name]
- All application specific dependencies should be installed in the specific packages
package.json
viayarn i --save [package-name]
The frontend application can be ran locally with different build configurations found in config/env
. The following commands are available:
yarn start
Runs the application with thedevelopment.js
configuration fileyarn start:dev
Runs the application with thedevelopment.js
configuration fileyarn start:staging
Runs the application with thestaging.js
configuration fileyarn start:testnet
Runs the application with thetestnet.js
configuration fileyarn start:prod
Runs the application with theproduction.js
configuration fileyarn run:prod
Runs the application mimicking the production environment entirely (i.e. code is bundled and minified, HMR is disabled, Express server is used (./server.js
) and theproduction.js
configuration file is loaded)
Notes:
- Developers will need to manually create the
development.js
andstaging.js
files - Custom application runtimes are possible by modifying the corresponding environment files found in the
config/env
folder
- React Developer Tools Inspect the React component tree
- Redux DevTools View/debug Redux state changes
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:
yarn lint
Lints all packagesyarn lint:components
Lints only blockchain-info-componentsyarn lint:core
Lints only blockchain-wallet-v4yarn lint:frontend
Lints only blockchain-wallet-v4-frontendyarn lint:fix
Automatically resolves fixable issues via ESLint
These IDE plugins/packages assist with complying with these lint rules while developing:
Testing is done via Jest and Enzyme.
yarn test
Runs unit tests for all packagesyarn test:components
Runs unit tests for only blockchain-info-componentsyarn test:core
Runs unit tests for only blockchain-wallet-v4yarn test:frontend
Runs unit tests for only blockchain-wallet-v4-frontend
yarn test:watch
Watches and then runs desired testsyarn test:components:watch
Watches and then runs desired tests for only blockchain-info-componentsyarn test:core:watch
Watches and then runs desired tests for only blockchain-wallet-v4yarn test:frontend:watch
Watches and then runs desired tests for only blockchain-wallet-v4-frontend
To enable debugging for unit tests via the Chrome browser, run the following commands:
yarn test:components:debug
Debugs unit tests for only blockchain-info-componentsyarn test:core:debug
Debugs unit tests for only blockchain-wallet-v4yarn test:frontend:debug
Debugs unit tests for only blockchain-wallet-v4-frontend
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.
We are snapshot testing UI some components. Here are the commands to update them when necessary:
yarn test:components:update
Updates component snapshots for only blockchain-info-componentsyarn test:frontend:update
Updates component snapshots for only blockchain-wallet-v4-frontend
To generate code coverage reports via Istanbul, the following commands are available:
yarn coverage
Generates a coverage report for all packagesyarn coverage:components
Generates coverage report for only blockchain-info-componentsyarn coverage:core
Generates coverage report for only blockchain-wallet-v4yarn coverage:frontend
Generates coverage report for only blockchain-wallet-v4-frontend
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 theindex.html
file in your browser to view.
To run both unit tests and linting, the following commands are available:
yarn vet
Lints and unit tests all packagesyarn vet:components
Lints and unit tests only blockchain-info-componentsyarn vet:core
Lints and unit tests only blockchain-wallet-v4yarn vet:frontend
Lints and unit tests only blockchain-wallet-v4-frontend
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 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 assetsstorybook:serve
Builds storybook assets and then serves them locally atlocalhost:6006
Bug fixes and feedback on our code is always appreciated.
Security issues can be reported to us in the following venues:
- Email: security@blockchain.info
- Bug Bounty: https://hackerone.com/blockchain