-
-
Notifications
You must be signed in to change notification settings - Fork 205
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
Add top gainers losers to token discovery service #5309
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just leaving a few proposals. Code looks great 👍
...rch-discovery-controller/src/token-discovery-api-service/token-discovery-api-service.test.ts
Show resolved
Hide resolved
); | ||
} | ||
|
||
return response.json(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to validate the response in any way or not?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with the validation but how do you feel about revisiting this in portfolio api first since it's closest to the server, and bad shapes would never even reach this point?
(this gives more credence to refactoring the error handling in the core repo you mention elsewhere)
@@ -16,7 +29,7 @@ export type TokenSearchResponseItem = { | |||
logoUrl?: string; | |||
}; | |||
|
|||
export type TokenTrendingResponseItem = { | |||
export type MoralisTokenResponseItem = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick: this seems unrelated to a vanilla Response object and looks to be only the tokenItem. Adding Response into the name confuses me a bit and could lead people to think this includes status and other properties of an HTTP Response
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Recommend dropping the ResponseItem portion all together to simply be MoralisToken
? I like that too.
...n-search-discovery-controller/src/token-discovery-api-service/token-discovery-api-service.ts
Show resolved
Hide resolved
...n-search-discovery-controller/src/token-discovery-api-service/token-discovery-api-service.ts
Show resolved
Hide resolved
…ithub.com:MetaMask/core into add-top-gainers-losers-to-token-discovery-service
…ithub.com:MetaMask/core into add-top-gainers-losers-to-token-discovery-service
@@ -17,10 +17,10 @@ module.exports = merge(baseConfig, { | |||
// An object that configures minimum threshold enforcement for coverage results | |||
coverageThreshold: { | |||
global: { | |||
branches: 100, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What are your thoughts on adding more test coverage? When the thresholds are at 100, it makes it really easy to know what's untested because you can just look at the output of yarn test
. When it's below 100, however, you end up having to guess or open the coverage report and manually search, which ends up being annoying.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I saw that a majority of packages here have their coverage set to 100. I think a more pragmatic 60-70% strikes a good balance between confidence and effort. Would you be willing to compromise on a level under 100 that still gives you confidence or is the 100% a dogma in your bones!
Explanation
We're introducing methods that allow consumers to fetch top-gainers and top-losers from the portfolio api (ultimately via the Moralis service).
I've also consolidated some of the types in this PR so they are reusable and provided a base type inheritance.
References
Changelog
@metamask/package-a
Added: param types inherit from a
ParamsBase
Added:
getTopGainersByChains
to theTokenDiscoveryApiService
Added:
getTopLosersByChains
to theTokenDiscoveryApiService
Changed: - BREAKING: Renamed
TokenTrendingResponseItem
name toMoralisTokenResponseItem
Checklist