Skip to content

Commit

Permalink
feat: adapt ownership queries to use the address instead of ID (#373)
Browse files Browse the repository at this point in the history
  • Loading branch information
juanmahidalgo authored Nov 25, 2024
1 parent 573cab1 commit decd4dc
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/logic/fetch-elements/fetch-items.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ function createQueryForCategory(category: ItemCategory) {
category === 'wearable' ? `itemType_in: [wearable_v1, wearable_v2, smart_wearable_v1]` : `itemType: emote_v1`
return `query fetchItemsByOwner($owner: String, $idFrom: ID) {
nfts(
where: { id_gt: $idFrom, owner: $owner, ${itemTypeFilter}},
where: { id_gt: $idFrom, owner_: {address: $owner}, ${itemTypeFilter}},
orderBy: id,
orderDirection: asc,
first: ${THE_GRAPH_PAGE_SIZE}
Expand Down
2 changes: 1 addition & 1 deletion src/logic/fetch-elements/fetch-lands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { fetchAllNFTs, THE_GRAPH_PAGE_SIZE } from './fetch-elements'
const QUERY_LANDS: string = `
query fetchLANDsByOwner($owner: String, $idFrom: ID) {
nfts(
where: { owner: $owner, category_in: [parcel, estate], id_gt: $idFrom },
where: { owner_: {address: $owner}, category_in: [parcel, estate], id_gt: $idFrom },
orderBy: transferredAt,
orderDirection: desc,
first: ${THE_GRAPH_PAGE_SIZE}
Expand Down
2 changes: 1 addition & 1 deletion src/logic/fetch-elements/fetch-names.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { fetchAllNFTs, THE_GRAPH_PAGE_SIZE } from './fetch-elements'
const QUERY_NAMES_PAGINATED: string = `
query fetchNamesByOwner($owner: String, $idFrom: ID) {
nfts(
where: {owner: $owner, category: ens, id_gt: $idFrom }
where: {owner_: {address: $owner}, category: ens, id_gt: $idFrom }
orderBy: id,
orderDirection: asc,
first: ${THE_GRAPH_PAGE_SIZE}
Expand Down
4 changes: 2 additions & 2 deletions test/unit/logic/fetch-elements/fetch-items.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ describe('fetchEmotes', () => {
expect(theGraph.maticCollectionsSubgraph.query).toBeCalled()
const expectedQuery = `query fetchItemsByOwner($owner: String, $idFrom: ID) {
nfts(
where: { id_gt: $idFrom, owner: $owner, itemType: emote_v1},
where: { id_gt: $idFrom, owner_: {address: $owner}, itemType: emote_v1},
orderBy: id,
orderDirection: asc,
first: 1000
Expand Down Expand Up @@ -251,7 +251,7 @@ describe('fetchWearables', () => {
expect(theGraph.maticCollectionsSubgraph.query).toBeCalled()
const expectedQuery = `query fetchItemsByOwner($owner: String, $idFrom: ID) {
nfts(
where: { id_gt: $idFrom, owner: $owner, itemType_in: [wearable_v1, wearable_v2, smart_wearable_v1]},
where: { id_gt: $idFrom, owner_: {address: $owner}, itemType_in: [wearable_v1, wearable_v2, smart_wearable_v1]},
orderBy: id,
orderDirection: asc,
first: 1000
Expand Down

0 comments on commit decd4dc

Please sign in to comment.