-
Notifications
You must be signed in to change notification settings - Fork 13
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
migrate markets from nftobject #155
base: main
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
@market/components/NFTAsks.tsx
Outdated
tokenId: string | ||
contractAddress: string | ||
collectionName: string | ||
markets: ReturnType<typeof useToken>['markets'] |
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.
does typegen generate any types that are a little more intuitive than this?
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.
My attempt to extract it was unsuccesful. Good thing is that this type is so ugly that it begs for further improvement.
@market/hooks/useAskHelper.ts
Outdated
// } | ||
// } | ||
|
||
export const useAskHelper = ({ ask }: ReturnType<typeof useToken>['markets'][0]) => { |
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.
Same here, think we need more concrete 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.
I agree!
@market/hooks/useAskHelper.ts
Outdated
) | ||
const rawAskAmount = useMemo(() => ask?.price?.nativePrice.raw, [ask]) | ||
const displayAskAmount = useMemo(() => ask?.price?.nativePrice.value, [ask]) | ||
const usdAskAmount = ask?.price.usdPrice |
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.
Looks like the formatting has been stripped out here. Are we sure output would be correct?
}, | ||
// not timestamp in db, only block 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.
How would we deal with this?
const auctions = markets.filter( | ||
(item) => item?.properties?.__typename === 'V3ReserveAuction' | ||
) | ||
const asks = markets.filter((item) => item?.properties?.__typename === 'V3Ask') |
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.
@olegakbarov here, I think we still need to sort with getLatestBlockNumber. This was a fix for a bug that was causing issues during the summer, at least for Asks
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.
Thanks for head's up! I assumed sorting from api is sufficient.
@market/hooks/useRelevantMarket.ts
Outdated
(item) => item?.properties?.__typename === 'V3ReserveAuction' | ||
) | ||
const asks = markets.filter((item) => item?.properties?.__typename === 'V3Ask') | ||
const offers = markets.filter((item) => item?.properties?.__typename === 'V1Offer') | ||
|
||
const ask = asks[0] | ||
const auction = auctions[0] | ||
const offer = offers[0] |
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.
We should return all offers and not just offers[0]... all offers are relevant (this is changed in the PR I pushed yesterday... we'd need to merge from main or fix it here)
compositions/NFTPage/NFTMarket.tsx
Outdated
|
||
if (nftObj) { | ||
if (hasActiveAuction) { |
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 sure all the logic from main is reconciled in the sidebar!
setTimeout(() => revalidate({ retryCount }), 5000) | ||
}, | ||
dedupingInterval: 10000, | ||
refreshInterval: 5000, |
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.
Can probably reduce this frequency
NFTObject
will dramatically simplify codebase and remove dependency onzdk
.token
andmarkets
tokenId
,contractAddress
are currently "drilled" through number of components, but it makes sense to extract them in provider later on.useAskHelper
anduseRelevantAsk
essentially unlocks the migration toNFTObject
as those are two main touch points where legacy data types are used