Skip to content

Commit f8740f2

Browse files
Merge pull request #269 from decentraland/feat/use-nft-owner-address
feat: use owner_address instead of owner_id
2 parents 08f15bc + df21475 commit f8740f2

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

src/ports/nfts/queries.ts

+2-6
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,7 @@ function getRarityWhereStatement(rarities?: Rarity[]): SQLStatement | null {
5252
}
5353

5454
function getFilteredNFTCTE(nftFilters: GetNFTsFilters, uncapped = false): SQLStatement {
55-
const ownerEthereumAddress = nftFilters.owner ? `${nftFilters.owner.toLocaleLowerCase()}-ETHEREUM` : null
56-
const ownerPolygonAddress = nftFilters.owner ? `${nftFilters.owner.toLocaleLowerCase()}-POLYGON` : null
57-
const FILTER_BY_OWNER = nftFilters.owner ? SQL` owner_id = ${ownerEthereumAddress} OR owner_id = ${ownerPolygonAddress} ` : null
55+
const FILTER_BY_OWNER = nftFilters.owner ? SQL` owner_address = ${nftFilters.owner} ` : null
5856
const FILTER_BY_CATEGORY = nftFilters.category ? SQL` category = ${nftFilters.category.toLocaleLowerCase()} ` : null
5957
const FILTER_BY_TOKEN_ID = nftFilters.tokenId ? SQL` token_id = ${nftFilters.tokenId} ` : null
6058
const FILTER_BY_ITEM_ID = nftFilters.itemId ? SQL` LOWER(item_id) = LOWER(${nftFilters.itemId}) ` : null
@@ -411,9 +409,7 @@ function getNFTWhereStatement(nftFilters: GetNFTsFilters): SQLStatement {
411409
}
412410

413411
function getRecentlyListedNFTsQuery(nftFilters: GetNFTsFilters): SQLStatement {
414-
const ownerEthereumAddress = nftFilters.owner ? `${nftFilters.owner.toLocaleLowerCase()}-ETHEREUM` : null
415-
const ownerPolygonAddress = nftFilters.owner ? `${nftFilters.owner.toLocaleLowerCase()}-POLYGON` : null
416-
const FILTER_BY_OWNER = nftFilters.owner ? SQL` owner_id = ${ownerEthereumAddress} OR owner_id = ${ownerPolygonAddress} ` : null
412+
const FILTER_BY_OWNER = nftFilters.owner ? SQL` owner_address = ${nftFilters.owner} ` : null
417413
const FILTER_BY_CATEGORY = nftFilters.category ? SQL` category = ${nftFilters.category.toLowerCase()} ` : null
418414
const FILTER_BY_TOKEN_ID = nftFilters.tokenId ? SQL` token_id = ${nftFilters.tokenId} ` : null
419415
const FILTER_BY_ITEM_ID = nftFilters.itemId ? SQL` LOWER(item_id) = LOWER(${nftFilters.itemId}) ` : null

0 commit comments

Comments
 (0)