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

Assets controller #18

Merged
merged 16 commits into from
Sep 18, 2018
Merged

Assets controller #18

merged 16 commits into from
Sep 18, 2018

Conversation

estebanmino
Copy link
Contributor

@estebanmino estebanmino commented Sep 12, 2018

This PR adds AssetsController in order to support assets on it. First two assets supported are tokens (ERC20) and collectibles (ERC721).

  • Add collectible/token
  • Remove collectible/token
  • Assets per account and network basis
  • Tests

Related #17

BLOCKER: eth-contract-metadata is not the official, we should decide what to do with collectibles metadata before merge.

@estebanmino estebanmino changed the title Assets controller [WIP] Assets controller Sep 12, 2018
@codecov-io
Copy link

codecov-io commented Sep 13, 2018

Codecov Report

Merging #18 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff           @@
##           master    #18    +/-   ##
======================================
  Coverage     100%   100%            
======================================
  Files          14     15     +1     
  Lines         626    770   +144     
  Branches       73     99    +26     
======================================
+ Hits          626    770   +144
Impacted Files Coverage Δ
src/PreferencesController.ts 100% <ø> (ø) ⬆️
src/AssetsController.ts 100% <100%> (ø)
src/TokenRatesController.ts 100% <100%> (ø) ⬆️
src/TransactionController.ts 100% <0%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 90648e8...56e346a. Read the comment docs.

@estebanmino estebanmino changed the title [WIP] Assets controller Assets controller Sep 13, 2018
Copy link
Contributor

@bitpshr bitpshr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a very strong pull request, I have very little feedback. Really well done. I created MetaMask/website#134 to track stuff around eth-contract-metadata. Feel free to land this whenever you want and I can cut a new release (or show you how to do that as well.)

*
* @param address - Hex address of the collectible contract
* @param tokenId - The NFT identifier
* @returns - Current collectible list
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: This may be more accurate if it says "Promise resolving to the current collectible list".

* @param tokenId - The NFT identifier
* @returns - Current collectible name and image
*/
async requestNFTCustomInformation(address: string, tokenId: number): Promise<CollectibleCustomInformation> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think this method should be public? Will it ever be called externally? Same question for fetchCollectibleBasicInformation. If these methods will only ever be used internally to this controller, I say we make them private to keep the external API as small as possible.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

totally agree, I'll move it

@estebanmino
Copy link
Contributor Author

Thanks @bitpshr. I'll wait for you in order to coordinate the integration to the app as well.

@codecov-io
Copy link

Codecov Report

Merging #18 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff           @@
##           master    #18    +/-   ##
======================================
  Coverage     100%   100%            
======================================
  Files          14     15     +1     
  Lines         626    760   +134     
  Branches       73     99    +26     
======================================
+ Hits          626    760   +134
Impacted Files Coverage Δ
src/PreferencesController.ts 100% <ø> (ø) ⬆️
src/AssetsController.ts 100% <100%> (ø)
src/TokenRatesController.ts 100% <100%> (ø) ⬆️
src/TransactionController.ts 100% <0%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 90648e8...c4fb377. Read the comment docs.

@estebanmino estebanmino merged commit 82c29fa into master Sep 18, 2018
@estebanmino estebanmino deleted the assets-controller branch September 18, 2018 22:40
MajorLift pushed a commit that referenced this pull request Sep 22, 2023

---------

Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: legobt <6wbvkn0j@anonaddy.me>
MajorLift pushed a commit that referenced this pull request Sep 22, 2023
v1.0.1 contains two changes that should have been considered
semver-major:

- Type-interface incompatability with previous version (MetaMask/json-rpc-engine#139)
- Introduced dependency `@metamask/json-rpc-engine` indicates a minimum
  supported Node.js version of 16. This prevents the module from
  installing on some package manager configurations, like default
  yarn classic.

This will be re-released as v2.0.0.
kanthesha pushed a commit that referenced this pull request Oct 11, 2023
Escalate errors on RPC responses
MajorLift pushed a commit that referenced this pull request Oct 11, 2023
* assets controller tokens

* Update PreferencesController no more tokens responsability

* Update AssetsController handling collectibles

* Update tests according to new AssetsController

* Fix some lines on AssetsController

* AssetsController using preferences selected address and assets getter

* AssetsController tokens object with selected address as keys

* AssetsController test tokens per account

* AssetsController tokens by selected address respective test

* AssetsController update new tokens when adding token

* AssetsController add and remove collectibles per account

* AssetsController assets per account and network

* AssetsCOntroller minor documentation additions

* AssetsController clean up

* AssetsController clean up

* AssetsController test update for private methods
MajorLift pushed a commit that referenced this pull request Oct 11, 2023
* assets controller tokens

* Update PreferencesController no more tokens responsability

* Update AssetsController handling collectibles

* Update tests according to new AssetsController

* Fix some lines on AssetsController

* AssetsController using preferences selected address and assets getter

* AssetsController tokens object with selected address as keys

* AssetsController test tokens per account

* AssetsController tokens by selected address respective test

* AssetsController update new tokens when adding token

* AssetsController add and remove collectibles per account

* AssetsController assets per account and network

* AssetsCOntroller minor documentation additions

* AssetsController clean up

* AssetsController clean up

* AssetsController test update for private methods
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.

3 participants