-
Notifications
You must be signed in to change notification settings - Fork 14
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
chore: use exotics api v2 #298
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.
Lgtm
types/api/xverse/ordinals.ts
Outdated
export const RoadArmorRareSats = ['MYTHIC', 'LEGENDARY', 'EPIC', 'RARE', 'UNCOMMON', 'COMMON'] as const; | ||
export type RoadArmorRareSatsType = (typeof RoadArmorRareSats)[number]; |
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.
nit: should be Rodarmor
types/api/xverse/ordinals.ts
Outdated
rarity_ranking: SatRarity; | ||
offset: number; | ||
}; | ||
export const Sattributes = [ |
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.
nit: we use "satribute" in api code
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.
Yeah, I initially wrote it sattributes everywhere as well because English π All the market places use a single 't' though, so we went with that for consistency.
β¦ types as common/unknown
tests/api/ordinals.test.ts
Outdated
import { mapRareSatsAPIResponseToBundle } from 'api'; | ||
import { Bundle, UtxoOrdinalBundle } from 'types'; |
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.
Please make these relative imports
api/ordinals.ts
Outdated
totalSats: apiBundle.value, | ||
}; | ||
|
||
// if bundle has and empty sat ranges, it means that it's a common/unknown bundle |
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.
nit π
// if bundle has and empty sat ranges, it means that it's a common/unknown bundle | |
// if bundle has empty sat ranges, it means that it's a common/unknown bundle |
api/ordinals.ts
Outdated
); | ||
|
||
const rangeWithUnsupportedSatsAndWithoutInscriptions = | ||
satRange.satributes.length === 1 && !satRange.inscriptions.length && !supportedSatributes.length; |
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.
Shouldn't this be
satRange.satributes.length === 1 && !satRange.inscriptions.length && !supportedSatributes.length; | |
!satRange.inscriptions.length && !supportedSatributes.length; |
api/ordinals.ts
Outdated
yearMined, | ||
satributes, | ||
// only one inscription per range is supported | ||
inscriptions: satRange.inscriptions.length > 1 ? [satRange.inscriptions[0]] : satRange.inscriptions, |
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.
Why do we only support one? π
api/ordinals.ts
Outdated
|
||
// if totalExoticSats doesn't match the value of the bundle, | ||
// it means that the bundle is not fully exotic and we need to add a common unknown sat range | ||
if (totalExoticSats !== apiBundle.value) { |
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.
if (totalExoticSats !== apiBundle.value) { | |
if (totalExoticSats + totalCommonUnknownInscribedSats !== apiBundle.value) { |
export type Bundle = Omit<UtxoOrdinalBundle, 'sat_ranges'> & { | ||
satRanges: BundleSatRange[]; | ||
inscriptions: SatRangeInscription[]; | ||
satributes: RareSatsType[][]; |
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.
This is the return type of the API to bundle mapping. At this point, any unknown satributes would have been filtered out.
Maybe we should have RareSatsType
as just RodarmorRareSatsType | SatributesType
and use that here. Then we can have something like FuzzyRareSatTypes
(please choose a better name π
) which is RareSatsType | string
which we can use for the API response type.
|
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.
π Nice!
π PR Type
π Background
This PR implements the v2 of exotics API and adds an util to map API response to Bundle
π Changes
Does this PR introduce a breaking change?
Changes:
β Review checklist
Please ensure the following are true before merging: