Skip to content
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

refactor(core-state): wallet model cleanup #2839

Merged
merged 9 commits into from
Jul 24, 2019
Merged

Conversation

spkjp
Copy link
Contributor

@spkjp spkjp commented Jul 24, 2019

This PR cleans up the wallet model and moves almost all of the existing wallet properties into a private attributes object.

Whenever the wallet model had to be extended we'd introduce a new property. This bloated the entire class with no clear semantic structure. With more and more transaction types coming up. this becomes even more of an issue.

The new approach to interface with (custom) wallet data is by using the following set of functions:

    hasAttribute(key: string): boolean;
    getAttribute<T = any>(key: string, defaultValue?: T): T;
    setAttribute<T = any>(key: string, value: T): void;
    forgetAttribute(key: string): void;

Internally it is using dottie to support access based on a property path.

This PR is quite pervasive and will break at least all existing custom transactions and #2773.

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Refactor
  • Performance
  • Tests
  • Build
  • Documentation
  • Code style update
  • Continuous Integration
  • Other, please describe:

Does this PR introduce a breaking change?

  • Yes
  • No

Does this PR release a new version?

  • Yes
  • No

If yes, please describe the impact and migration path for existing applications:

The PR fulfills these requirements:

  • It's submitted to the develop branch, not the master branch
  • All tests are passing
  • New/updated tests are included

If adding a new feature, the PR's description includes:

  • A convincing reason for adding this feature (to avoid wasting your time, it's best to open a suggestion issue first and wait for approval before working on it)

@faustbrian faustbrian merged commit 016ab15 into 2.6 Jul 24, 2019
@ghost ghost deleted the wallet-attributes branch July 24, 2019 04:22
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.

2 participants