From cccb0c745730d437a95ed688a7842a537722e0ae Mon Sep 17 00:00:00 2001 From: Korbinian Date: Thu, 2 May 2024 13:58:22 +0200 Subject: [PATCH] test --- .../infrastructure/api/MoralisNFTRepository.server.ts | 9 +++++---- packages/bridge-ui/src/routes/api/nft/+server.ts | 4 ++++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/packages/bridge-ui/src/libs/nft/infrastructure/api/MoralisNFTRepository.server.ts b/packages/bridge-ui/src/libs/nft/infrastructure/api/MoralisNFTRepository.server.ts index 8568a8c026a..8f3f11ba56c 100644 --- a/packages/bridge-ui/src/libs/nft/infrastructure/api/MoralisNFTRepository.server.ts +++ b/packages/bridge-ui/src/libs/nft/infrastructure/api/MoralisNFTRepository.server.ts @@ -3,6 +3,7 @@ import { type Address, zeroAddress } from 'viem'; import { moralisApiConfig } from '$config'; import { MORALIS_API_KEY } from '$env/static/private'; +import { getLogger } from '$libs/util/logger'; import type { INFTRepository } from '$nftAPI/domain/interfaces/INFTRepository'; import type { NFT } from '$nftAPI/domain/models/NFT'; import { mapToNFTFromMoralis } from '$nftAPI/infrastructure/mappers/nft/MoralisNFTMapper'; @@ -10,6 +11,8 @@ import type { NFTApiData } from '$nftAPI/infrastructure/types/moralis'; import type { FetchNftArgs } from '../types/common'; +const log = getLogger('api:infrastructure:MoralisNFTRepository'); + class MoralisNFTRepository implements INFTRepository { private static instance: MoralisNFTRepository; @@ -37,8 +40,7 @@ class MoralisNFTRepository implements INFTRepository { } async findByAddress({ address, chainId, refresh = false }: FetchNftArgs): Promise { - // eslint-disable-next-line no-console - console.log('Fetching NFTs from Moralis', address, chainId, refresh); + log('fetching NFTs', { address, chainId, refresh }); this.lastFetchedAddress = address; @@ -58,8 +60,7 @@ class MoralisNFTRepository implements INFTRepository { address: address, limit: moralisApiConfig.limit, }); - // eslint-disable-next-line no-console - console.log('response', response); + log('moralis response', response); this.cursor = response.pagination.cursor || ''; this.hasFetchedAll = !this.cursor; // If there is no cursor, we have fetched all NFTs diff --git a/packages/bridge-ui/src/routes/api/nft/+server.ts b/packages/bridge-ui/src/routes/api/nft/+server.ts index 5b750397bf3..73d0953ad8d 100644 --- a/packages/bridge-ui/src/routes/api/nft/+server.ts +++ b/packages/bridge-ui/src/routes/api/nft/+server.ts @@ -5,6 +5,10 @@ import moralisRepository from '$nftAPI/infrastructure/api/MoralisNFTRepository.s const nftService = new NFTService(moralisRepository); +export const config = { + runtime: 'edge', +}; + export const POST: RequestHandler = async ({ request }) => { try { const { address, chainId, refresh } = await request.json();