Skip to content

Commit

Permalink
fix: Fetch catalyst items by pointers (#700)
Browse files Browse the repository at this point in the history
  • Loading branch information
cyaiox authored Aug 29, 2023
1 parent 233d63d commit 4fc551a
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions src/ethereum/api/peer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ import { ILoggerComponent } from '@well-known-components/interfaces'
import { createConsoleLogComponent } from '@well-known-components/logger'
import { createFetchComponent } from '@well-known-components/fetch-component'
import { env } from 'decentraland-commons'
import { ContentClient, createContentClient } from 'dcl-catalyst-client/dist/client/ContentClient'
import {
ContentClient,
createContentClient,
} from 'dcl-catalyst-client/dist/client/ContentClient'
import { ItemAttributes, ItemType } from '../../Item'
import { CollectionAttributes } from '../../Collection'
import { logExecutionTime } from '../../utils/logging'
Expand Down Expand Up @@ -36,7 +39,7 @@ export class PeerAPI {
constructor() {
this.contentClient = createContentClient({
url: `${PEER_URL}/content`,
fetcher: createFetchComponent()
fetcher: createFetchComponent(),
})
this.logger = createConsoleLogComponent().getLogger('PeerAPI')
}
Expand Down Expand Up @@ -68,8 +71,11 @@ export class PeerAPI {
return logExecutionTime(
() =>
urns.length > 0
? (this.contentClient.fetchEntitiesByIds(urns)
.then((entities) => entities.map((entity) => entity.metadata)) as Promise<T[]>)
? (this.contentClient
.fetchEntitiesByPointers(urns)
.then((entities) =>
entities.map((entity) => entity.metadata)
) as Promise<T[]>)
: [],
this.logger,
'Wearables Fetch'
Expand All @@ -80,8 +86,11 @@ export class PeerAPI {
return logExecutionTime(
() =>
urns.length > 0
? (this.contentClient.fetchEntitiesByIds(urns)
.then((entities) => entities.map((entity) => entity.metadata)) as Promise<T[]>)
? (this.contentClient
.fetchEntitiesByPointers(urns)
.then((entities) =>
entities.map((entity) => entity.metadata)
) as Promise<T[]>)
: [],
this.logger,
'Emotes Fetch'
Expand Down

0 comments on commit 4fc551a

Please sign in to comment.