Skip to content

Re-write LightWallet and MWC in Typescript. Using modern packages. #145

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 985 commits into from
Dec 9, 2017

Conversation

adilwali
Copy link
Contributor

@adilwali adilwali commented Oct 24, 2017

This is an experimental branch that considers upgrading core packages and restructuring the core LW application architecture.

ONGOING TODO LIST:

=======================MERGE LINE=================================

DONE:

  • Stop calling v1 notifications hundreds of times in quick succession.
  • Sending Merit should work all the way through without promise chain errors.
  • Re-write MWC in Typescript.
  • Modernize Wallets View and associated services.
  • Modernize Transactions View and associated services.
  • Modernize Settings Views and associated services.
  • Modernize Onboarding Views and associated services.
  • Re-write core services to be promise-based (using bluebird promises.)
  • Flatten dependencies between lightwallet, mwc, and bitcore-lib.
  • Make the total payload of the application much smaller.
  • Make the initial startup time much faster.
  • Preliminary segwit support in LW stack (bitcore lib, primarily)

@adilwali
Copy link
Contributor Author

After spending some time thinking on it, I think that this is generally the structural direction we want to head in.

I wasn't as thoughtful as I should have been originally about the Ionic approach, and how it is tied to the notion of pages. Pages, by design, are different than components. They have their own notion of hierarchy, etc.

This Issue over at Ionic sheds a little light on the topic: ionic-team/ionic-framework#6847

It sounds like they are heading in the direction of views over pages. So I tried to keep that in mind here.

The biggest open question on my mind is how to handle the primary navigation views. (The tabs: Send, Receive, Community, etc.) In order to get the modernization refactor done quickly without introducting too much risk, we can keep all these pages grouped (as they are today), perhaps with a more semantic name.

Some ideas that come to mind are:

  • primary
  • primary-actions
  • transact

Of the above, I like transact the best, since it most closely describes what the primary actions allow you to do. The only exception might be the community tab, but if use the abstract notion of a transaction, then it's not crazy to think of a invitation as a transaction.

@adilwali
Copy link
Contributor Author

Another important approach thing to think about is how much has been (over)loaded into the profile service. Going forward, we should strive to separate out thematically relevant functionality into more moderately-sized modules (including services).

At a high-level, I could see something like:

app/
├── core/
│   ├── profile.service.ts 
│   ├── wallet.service.ts
│   ├── keys.service.ts
├── lib/
│   ├──bwc.js

@adilwali
Copy link
Contributor Author

Phew. Now you can click through the tourFlow with the new structure. And BWC makes a call to BWS when you attempt to unlock the wallet.

I want to clarify one thing as of this point:
It may seem contrived to create this level of modularity in a series of modules that are tightly-coupled.

So, the question is, why do it?

The answer is: we want to etch a blueprint of the architecture we desire in the code as of now. Yes, many components are still tightly coupled, so we do not get many of the benefits of lazy-loading. But, now that we have a framework, folder-structure, and a stylistic (folder-by-feature) approach in place, we can start refactoring in that direction.

So, in short, it'll get a bit worse before it gets better. But it will get better.

@adilwali
Copy link
Contributor Author

Phew. As of now, this branch now has working transactions and eventing. It also has the bluebird types, and MeritWalletClient is typed in most places throughout the app to gain the true power of TypeScript.

@adilwali adilwali changed the title Modernizing the application architecture, and upgrading core packages. Re-write LightWallet and MWC in Typescript. Using modern packages. Nov 22, 2017
@adilwali adilwali mentioned this pull request Nov 26, 2017
adilwali and others added 29 commits December 8, 2017 10:14
Falling back to long-polling for real-time application updates.
Additional core stability enhancements before 1.0.
Style looks like the normal send confirmation screen.
…tyling

Barrow and steal styling from send page to vault spend confirmation.
Instead of using the cached value.
Computing actual vault balances from utxos.
…real-time

* origin/major/modernize:
  Computing actual vault balances from utxos.
  Missing vault spend confirm css.
  revert bws url to localhost
  Barrow and steal styling from send page to vault spend confirmation.
1. Updated vault is now saved in mongo.
2. Whitelist addresses are correct.
Fix whitelist selection during vault renew.
bug - trying to use unconfirmed utxo crashes bws
Re-doing the network view and the logic to be faster and more usable.
Showing transactions on the wallets screen on first load of the app.
@adilwali adilwali merged commit 23b0117 into master Dec 9, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants