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

coinmarketcap typescript refactor #218

Merged
merged 12 commits into from
Feb 4, 2021

Conversation

emmick4
Copy link
Contributor

@emmick4 emmick4 commented Jan 12, 2021

Refactor the Coinmarketcap external adapter to match the typescript adapter pattern.

@github-actions
Copy link
Contributor

I see that you haven't updated any CHANGELOG files. Would it make sense to do so?

coinmarketcap/package.json Outdated Show resolved Hide resolved
coinmarketcap/src/adapter.ts Outdated Show resolved Hide resolved
coinmarketcap/src/endpoint/marketcap.ts Outdated Show resolved Hide resolved
coinmarketcap/src/endpoint/price.ts Outdated Show resolved Hide resolved
coinmarketcap/test/adapter.test.ts Outdated Show resolved Hide resolved
coinmarketcap/src/endpoint/dominance.ts Outdated Show resolved Hide resolved
coinmarketcap/src/endpoint/marketcap.ts Outdated Show resolved Hide resolved
coinmarketcap/src/endpoint/price.ts Outdated Show resolved Hide resolved
coinmarketcap/src/endpoint/price.ts Outdated Show resolved Hide resolved
coinmarketcap/test/adapter.test.ts Outdated Show resolved Hide resolved
coinmarketcap/test/adapter.test.ts Outdated Show resolved Hide resolved
@krebernisak
Copy link
Contributor

@emmick4 any updates on this. We should get this in this week, as we are looking to finish the TS migration and publish a new release.

@justinkaseman justinkaseman mentioned this pull request Jan 27, 2021
@justinkaseman
Copy link
Member

Chipped away at #219 by with commit c6fc972.

getDefaultConfig now takes in a parameter for if the API_KEY is required or not.
It defaults to not required, where it will use getRandomEnv logic.

Leaving ticket open as this change still needs to be brought to all EAs.

justinkaseman
justinkaseman previously approved these changes Feb 3, 2021
Copy link
Contributor

@ebarakos ebarakos left a comment

Choose a reason for hiding this comment

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

Seems good, left only one potential change.

The price endpoint though is quite complicated. We might need to add various test cases regarding slug/cid + to do some good acceptance testing. There is probably room for refactoring, either now or at some point, once we cover all cases with tests.

@@ -24,6 +24,14 @@ export const toObjectWithNumbers = (obj: any) => {
return Object.fromEntries(Object.entries(obj).map(([k, v]) => [k, toNumber(v)]))
}

// pick a random string from env var after splitting with the delimiter ("a&b&c" "&" -> choice(["a","b","c"]))
export const getRandomEnv = (name: string, delimiter = ',', prefix = '') => {
Copy link
Contributor

Choose a reason for hiding this comment

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

I left a comment in the batch PR about this -> #226 (comment)

What do you think?

@justinkaseman
Copy link
Member

Seems good, left only one potential change.

The price endpoint though is quite complicated. We might need to add various test cases regarding slug/cid + to do some good acceptance testing. There is probably room for refactoring, either now or at some point, once we cover all cases with tests.

Agreed that there is probably room for refactoring and additional tests, but for the sake of staying in the scope of the TS refactor and hitting this release I think we should instead open a new ticket for that.

Opening one now for CMC price endpoint refactor.

@justinkaseman justinkaseman dismissed stale reviews from ebarakos and krebernisak February 4, 2021 16:56

Entering changes for acceptance testing

@justinkaseman justinkaseman self-requested a review February 4, 2021 16:57
@justinkaseman justinkaseman merged commit 09e2bb2 into develop Feb 4, 2021
@justinkaseman justinkaseman deleted the emmick/coinmarketcap-refactor branch February 4, 2021 18:09
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.

None yet

4 participants