Calls to `eth.sign` are now transiently persisted in memory, and displayed in a chronological stack with pending transactions (which are still persisted to disk).
This allows the user a method to sign/cancel transactions even if they miss the Chrome notification.
Improved a lot of the view routing, to avoid cases where routes would show an empty account view, or transition to the accounts list when it shouldn't.
Broke the transaction approval view into a couple components so messages and transactions could have their own templates.
Fixes#151
- Cancelling or completing a tx now goes back to account detail view.
- Restoring a vault now does not select an unloaded account, shows account list.
- Account list now never selects an item only uses the cells as buttons.
When starting up, we now create a `web3` inside the `background.js` process, which we pass to the `idStore` and ask for the current `network`.
We include the `network` on `app.metamask.network` in the state object.
We re-request the network when changing provider.
We filter the transaction list for transactions that match the current network.
When selecting an account, we now persist the selection to the `configManager`, so the selection can be restored when re-unlocking Metamask.
Also found the bug where `rawtestrpc` was still being used as a default, and fixed it!
- When unlocking, the first account is now selected by default and displayed as the main view.
- There is now a "CHANGE ACCT" button on the detail view to show the accounts list.
- Clicking an account from the accounts list now navigates to the detail view and selects that account.
- Config/Info screen "back" buttons now fire a new action, `GO_HOME`, which is configured to navigate to the accountDetail view, putting that logic in one place.
- When locking and unlocking again, the first account is always displayed, eventually we should persist the selection.
When sending a transaction, we were converting to BN before handling decimals, which meant we were losing any precision past a decimal point, since BN does not handle decimals!
Put this numeric normalization into a utility function with a test around it and got it working.
utils.formatBalance was returning rounded ether, was not useful for displaying account balances.
Now returns four decimal points, and is easily configurable for more, with passing tests.
Spoiler alert: Don't you dare divide bignumber wei. Bignumber does not have decimals. Keep it as wei, format it as ether.