Skip to content

Commit

Permalink
Merge pull request #215 from ainft-team/fix/hyeonwoong/type-error
Browse files Browse the repository at this point in the history
Fix type error
  • Loading branch information
woomurf authored Sep 18, 2023
2 parents 3aa8fe2 + ec01309 commit 8cef9c3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 4 additions & 2 deletions src/nft.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ import {
UploadAssetFromDataUrlParams,
SearchOption,
SearchReponse,
AinftTokenSearch,
AinftCollectionSearch,
} from './types';
import Ainft721 from './ainft721';
import stringify from 'fast-json-stable-stringify';
Expand Down Expand Up @@ -269,7 +271,7 @@ export default class Nft extends FactoryBase {
* @returns
* @param {NftSearchParams & SearchOption} searchParams
*/
searchCollections(searchParams: NftSearchParams & SearchOption): Promise<SearchReponse> {
searchCollections(searchParams: NftSearchParams & SearchOption): Promise<SearchReponse<AinftCollectionSearch>> {
let query: Record<string, any> = {};
if (searchParams) {
const { userAddress, nftId, name, symbol, limit, offset } = searchParams;
Expand All @@ -283,7 +285,7 @@ export default class Nft extends FactoryBase {
* Search nft assets on the ain blockchain.
* @param {NftSearchParams & SearchOption} searchParams
*/
searchAssets(searchParams: NftSearchParams & SearchOption): Promise<SearchReponse> {
searchAssets(searchParams: NftSearchParams & SearchOption): Promise<SearchReponse<AinftTokenSearch>> {
let query: Record<string, any> = {};
if (searchParams) {
const { userAddress, nftId, name, symbol, limit, offset, tokenId } = searchParams;
Expand Down
4 changes: 2 additions & 2 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -880,8 +880,8 @@ export interface AinftTokenSearch {
collectionInfo: AinftCollectionSearch;
}

export interface SearchReponse {
list: Array<AinftCollectionSearch | AinftTokenSearch>,
export interface SearchReponse<T extends AinftCollectionSearch | AinftTokenSearch> {
list: Array<T>,
isFinal: boolean;
nextOffset: string;
}

0 comments on commit 8cef9c3

Please sign in to comment.