-
Notifications
You must be signed in to change notification settings - Fork 17
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
feat: Rarity endpoints return prices field with prices in various currencies #500
Conversation
Pull Request Test Coverage Report for Build 2295822557
💛 - Coveralls |
deeede0
to
1b148eb
Compare
return { | ||
id: rarity.name, | ||
name: rarity.name, | ||
price: rarity.price.toString(), | ||
maxSupply: rarity.maxSupply.toString(), | ||
} |
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 if we return the currency of the price. If inUSD
is not set, it's not clear which is the currency it's returning the price.
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 you suggest adding another field such as currency: 'mana' | 'usd' to distinguish?
src/Rarity/Rarity.router.ts
Outdated
return collectionAPI.fetchRarities() | ||
} | ||
|
||
const inUSD = req.query.inUSD === 'true' |
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 if we name this query parameter currency
? We can later have different conversions if we want to.
const inUSD = req.query.inUSD === 'true' | |
const inUSD = req.query.currency === 'usd' |
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 like that!
src/Rarity/Rarity.router.spec.ts
Outdated
}) | ||
}) | ||
|
||
// TODO: Tests for when rarities feature flag is enabled |
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.
Tests are missing here :)
@LautaroPetaccio Thanks for the feedback!
|
…taining the rarities
08ab436
to
c9ebf41
Compare
@LautaroPetaccio |
src/Rarity/Rarity.router.ts
Outdated
price: blockchainRarity.price, | ||
originalPrice: graphRarity.price, | ||
originalCurrency: Currency.USD, |
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.
As "Original" as name might be a bit confusing, what if we change this to a map?
As a map:
price: {
'MANA': '4000000000000000000',
'USD': '10000000000000000000'
}
@LautaroPetaccio Replaced "original" fields with "prices" field containing a Record of Currency -> Price |
Closes #490