Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
KorbinianK committed May 2, 2024
1 parent 84ef2a2 commit cccb0c7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,16 @@ 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';
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;

Expand Down Expand Up @@ -37,8 +40,7 @@ class MoralisNFTRepository implements INFTRepository {
}

async findByAddress({ address, chainId, refresh = false }: FetchNftArgs): Promise<NFT[]> {
// eslint-disable-next-line no-console
console.log('Fetching NFTs from Moralis', address, chainId, refresh);
log('fetching NFTs', { address, chainId, refresh });

this.lastFetchedAddress = address;

Expand All @@ -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

Expand Down
4 changes: 4 additions & 0 deletions packages/bridge-ui/src/routes/api/nft/+server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit cccb0c7

Please sign in to comment.