// Copyright © Endless // Copyright © Aptos Foundation // SPDX-License-Identifier: Apache-2.0 import { EndlessConfig } from "./endlessConfig"; import { AccountAddressInput } from "../core"; import { CollectionResponse, NftMetrics, NftTokenResponse, PageableCollectionResponse, PageableHoldersItem, PageableNftCollectionHistoryRecord, PageableNftTokenHistoryRecord, PageableNftTokenResponse, PaginationArgsOfIndexer, } from "../types"; import { getCollections, batchGetCollections, getCollection, getCollectionHistory, getCollectionHolders, getCollectionTokens, getNft, getNftHistory, getNftMetrics, } from "../internal/nft"; /** * A class to query all `NFT` related queries on Endless. */ export class NFT { constructor(readonly config: EndlessConfig) {} /** * Get all collections * * @param args.options.page The page number to retrieve * @param args.options.pageSize The number of items to retrieve per page * @returns The collections */ async getCollections(args?: { options?: PaginationArgsOfIndexer; }): Promise { return getCollections({ endlessConfig: this.config, ...args }); } /** * Batch get collections by IDs * * @param args.ids The IDs of the collections to retrieve * @returns The collections */ async batchGetCollections(args: { ids: AccountAddressInput[]; }): Promise { return batchGetCollections({ endlessConfig: this.config, ...args }); } /** * Get a collection by ID * * @param args.id The ID of the collection to retrieve * @returns The collection */ async getCollection(args: { id: AccountAddressInput; }): Promise { return getCollection({ endlessConfig: this.config, ...args }); } /** * Get collection history by ID * * @param args.id The ID of the collection to retrieve history for * @param args.options.page The page number to retrieve * @param args.options.pageSize The number of items to retrieve per page * @returns The collection history */ async getCollectionHistory(args: { id: AccountAddressInput; options?: PaginationArgsOfIndexer; }): Promise { return getCollectionHistory({ endlessConfig: this.config, ...args }); } /** * Get collection holders by ID * * @param args.id The ID of the collection to retrieve holders for * @param args.options.page The page number to retrieve * @param args.options.pageSize The number of items to retrieve per page * @returns The collection holders */ async getCollectionHolders(args: { id: AccountAddressInput; options?: PaginationArgsOfIndexer; }): Promise { return getCollectionHolders({ endlessConfig: this.config, ...args }); } /** * Get collection tokens by ID * * @param args.id The ID of the collection to retrieve tokens for * @param args.options.page The page number to retrieve * @param args.options.pageSize The number of items to retrieve per page * @returns The collection tokens */ async getCollectionTokens(args: { id: AccountAddressInput; options?: PaginationArgsOfIndexer; }): Promise { return getCollectionTokens({ endlessConfig: this.config, ...args }); } /** * Get an NFT by ID * * @param args.id The ID of the NFT to retrieve * @returns The NFT */ async getNft(args: { id: AccountAddressInput; }): Promise { return getNft({ endlessConfig: this.config, ...args }); } /** * Get NFT history by ID * * @param args.id The ID of the NFT to retrieve history for * @param args.options.page The page number to retrieve * @param args.options.pageSize The number of items to retrieve per page * @returns The NFT history */ async getNftHistory(args: { id: AccountAddressInput; options?: PaginationArgsOfIndexer; }): Promise { return getNftHistory({ endlessConfig: this.config, ...args }); } /** * Get NFT metrics * * @returns The NFT metrics */ async getNftMetrics(): Promise { return getNftMetrics({ endlessConfig: this.config }); } }