Skip to content

Latest commit

 

History

History
190 lines (127 loc) · 5.09 KB

HACKING.md

File metadata and controls

190 lines (127 loc) · 5.09 KB

Darkwallet Development

You are welcome to participate in the development by contributing or forking the code at:

https://github.com/darkwallet/darkwallet

For normal wallet development you can just modify the .js files, no need for fancy compilers :).

Note the wallet has a long running background process, so after modifying files (specially for backend/ and model/ files) you may need to restart the background page.

The background process ties up the wallet behaviour for any number of open tabs.

Debugging

Check the following wiki page for information on getting to the debug consoles of the darkwallet:

https://wiki.unsystem.net/index.php/DarkWallet/Debug

Code organization

The code is structured as follows:

src/js/			Code Root
├── backend		Background page specific code (runs on the background)
│   ├── channels	Communication channels and transport
│   └── services	Backend services
├── frontend		User facing code (runs on the tabs, tied to html, uses angular)
│   ├── controllers	Angular controllers
│   ├── directives	Angular directives
│   ├── filters		Angular filters
│   ├── popup		Code for the popup area on the topbar
│   └── scripts		Content scripts
├── model		Storage related core, and generic model functionality.
└── util		Generic utils
    └── ng		Angular utils

Frontend development

From the frontend, You use the Darkwallet global object to access main objects for the application.

The "main" files for the frontend are the src/js/frontend/controllers/ files, wallet.js is the top level controller at the moment.

Backend development

The "main" file for the backend is src/js/backend/main.js.

The backend hosts several services (src/js/backend/services/) taking care of different aspects of the application.

Frontend and backend communication

The frontend and backend processes use "Ports" for communication. The backend opens several service ports, where the frontend areas can connect. This ensures callbacks are properly disconnected when tabs are closed or controllers are destroyed, so we just get notifications from the backend on these ports.

To command the backend, the frontend can access directly in most situations, so just start on Darkwallet and move down.

Internationalization

Translating

If you want to help translating the app to more languages go to our transifex project

Developers

You can make a string translatable using the "_" filter:

<p>{{'This string is translated to the system language'|_}}<p>

You can use strong and emphasis markdown formatting syntax:

<p ng-bind-html="('I love *darkwallet*'|_)"></p>

Javascript errors are also translatable, separing the parameters using | inside the same string.

throw new Error('Test error with some colors: {0}, {1} and {2}|'+['red', 'green', 'blue'].join('|'));

When you add or modify a language string, run the following command:

$ npm run i18n-update

Having transifex client downloaded and configured, you can:

$ tx push -s # Push the sources
$ tx pull -t # Pull the translations

Testing

We use the tool karma to run the tests.

All the following commands should be done from the darkwallet root folder.

Setup your environment

$ npm -d install
$ npm install -g karma-cli # you may need sudo here

Running the tests

$ karma start test/karma.conf.js

Releasing

We use semver to version our releases, you can read the specification in their web.

We also use git flow branching model, so you can assume that the code in the master branch is stable and the bleeding edge is in the develop branch.

We use git flow util in order to realize it. It can be downloaded using apt:

$ sudo apt-get install git-flow

Javascript tasks

To update or modify dependencies you may need the following information:

Adding/Upgrading dependencies with bower

If you want to add/upgrade a dependency, use bower.

$ bower install angular --save # --save option modify bower.json file

Read bower documentation for more info.

CSS Hacking

Our css is generated from the files in the sass folder, so any changes should be done there instead of in the css folder.

Setup your SASS compiling environment:

Make sure you have nodejs installed, then on the darkwallet root folder, do:

$ npm install -g grunt-cli bower # you may need sudo here
$ npm install
$ bower update

Then build with grunt build or just run grunt and it will keep watching for changes on the sass folder.

Icon set

You can use the following cheatsheet to look for icon codes:

Search other icon sets for useful icons:

--

  • unsystem dev