-
-
Notifications
You must be signed in to change notification settings - Fork 363
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
Optimize query on TokenEntity #7462
Comments
@vikiival more data should be on tokenEntity, to avoid needing to query lots of nft data on the FE |
Yes. Which data do we need? |
we needid nftsForListing: { } Gaps :count (unburnt) - currently returning total count (burned included) collection floor price, rn getting it requires another query over nfts Currently possible queryquery TokenEntites($userid: String) {
tokenEntities(orderBy: updatedAt_DESC, limit:50, ) {
id
name
image
media
count
updatedAt
blockNumber
nftForBuying: nfts(
where: {
currentOwner_not_eq: $userid,
price_gt: "0",
burned_eq: false},
limit: 1,
orderBy: price_ASC)
{
id
price
}
nftsForListing: nfts(
where: {
currentOwner_eq: $userid,
price_eq: "0",
burned_eq: false
} )
{
id
currentOwner
}
collection {
floorPrice :nfts(where: {price_gt: "0"} ,orderBy: price_ASC, limit:1) {
price
}
name
id
}
}
} |
This filter does not make sense imo as there is nothing I can represent as serial number.
So that means TokenEntity is expecting same image under one collection right?
Like count or why?
same as above
owners: string[] |
ok, but that will mean we will need to drop sort by sequence
correct, all of the nfts under one collection that share same ipfs URL are a single TokenEntity
this btn will add all these ids's into listing cart
same for the buy now action button. need to know which nft id to buy (the cheapest) |
Can be lazy loaded on demand.
Collection Is already present, same as blockNumber and updated at https://github.com/kodadot/stick/blob/f870effae7141dde9668e94dfe771f6fdd7ff596/schema.graphql#L32 |
ASSIGNED - @daiagi 🔒 LOCKED -> Friday, October 13th 2023, 04:09:35 UTC -> 36 hours |
new query will look something like this query tokenListWithSearch(
$first: Int!
$offset: Int
$orderBy: [String!] = ["blockNumber_DESC"]
$price_gte: Float
$price_gt: Float
$price_lte: Float
$owner: String
$denyList: [String!]
) {
tokenEntities: tokenEntityList(
owner: $owner
denyList: $denyList
orderBy: $orderBy
limit: $first
offset: $offset
price_gte: $price_gte
price_gt: $price_gt
price_lte: $price_lte
) {
id
name
image
media
metadata
supply
cheapest {
id
price
currentOwner
}
collection {
id
name
}
meta {
id
image
animationUrl
description
}
}
tokenEntityCount(
owner: $owner
denyList: $denyList
price_gte: $price_gte
price_gt: $price_gt
price_lte: $price_lte
) {
totalCount
}
} and I am currently integrating the front end using local machine indexer + graphql server PR will come soon |
Released Stick v5 and Speck v5 with this change |
Thanks viki |
ASSIGNMENT EXPIRED - @daiagi has been unassigned. |
New release of v5.0.1 in kodadot/stick#115 and kodadot/stick#116 |
What happened?
One of the reasons why #7419 on AHP was caused is this huge and scary query.
It does so many joins that squid database decided to give up.
Please reproduce in steps
Expected Behavior
The task:
Delete unnecessary information from the query so I does not make too many complicated joins.
Blocked by Questions on @daiagi
What browsers are you seeing the problem on?
No response
At which address did you encounter bug?
No response
Are you logged in?
None
Which wallet you are using?
No response
At which chain did you encounter bug?
No response
Screenshots
Relevant log output
No response
Payment link for reward
https://kodadot.xyz/ksm/transfer/?target=%3CMy_Kusama_Address_check_https://github.com/kodadot/nft-gallery/blob/main/CONTRIBUTING.md#creating-your-ksm-address%3E
Code of Conduct
The text was updated successfully, but these errors were encountered: