@xoxno/sdk-js
Version:
The SDK to interact with the XOXNO Protocol!
301 lines • 17.1 kB
TypeScript
import type { AnalyticsGraphs, NftData, StakingSummaryPools } from '../types';
import type { CollectionListings, CollectionRanksExport, CollectionsNFTsResponse, CollectionStatsDoc, CollectionStatsResults, CollectionVolume, GetCollectionMintInfo, GetCollectionsArgs, GetCollectionStatsArgs, GETDropsArgs, GetDropsResponse, GetGlobalOffersArgs, GetNFTsArgs, GetOffersArgs, GetOffersResponse, GlobalOffersResult, ICollectionAttributes, ICollectionProfile, IOwners, ISingleHolder, SearchNFTsResponse, SuggestNFTsArgs, SuggestResults } from '../types/collection';
import type { TradincActivityArgs, TradingActivityResponse } from '../types/trading';
/**
* CollectionModule provides a set of methods to interact with NFT collections.
* It includes methods for getting collection profile information, floor price,
* collection attributes, and searching NFTs within a collection.
*
* @example
* const collectionModule = new CollectionModule();
*/
export declare class CollectionModule {
private api;
constructor();
/**
* @public
* @async
* @function getCollectionProfile
* @param {string} collection - The ticker of the collection to fetch the profile for.
* @returns {Promise<ICollectionProfile>} A promise that resolves to the fetched collection profile.
*
* This function fetches the profile of a given collection. It takes the following parameter:
* - collection (string): The ticker of the collection to fetch the profile for.
*
* The function first validates the input ticker and checks if it is a valid collection ticker.
* If it is valid, the function fetches the collection profile using the API.
* Finally, it returns a promise that resolves to the fetched collection profile.
*/
getCollectionProfile: (collection: string) => Promise<ICollectionProfile>;
/**
* @public
* @async
* @function getDailyTrending
* @returns {Promise<NftData[]>} A promise that resolves to the array of trending NFTs.
* This function fetches the top NFTs that are trending today based on their floor and volumes
*/
getDailyTrending: () => Promise<NftData[]>;
/**
* Fetches the floor price of a collection.
* @param collection - The ticker of the collection.
* @param token - The token for the floor price calculation (default: 'EGLD').
* @returns A Promise that resolves to the collection's floor price as a number.
* @throws An error if the provided collection ticker is invalid.
*/
getCollectionFloorPrice: (collection: string, token?: string) => Promise<{
price: number;
usdPrice: number;
}>;
/**
* @public
* @async
* @function getCollectionAttributes
* @param {string} collection - The ticker of the collection to fetch the attributes for.
* @returns {Promise<ICollectionAttributes>} A promise that resolves to the fetched collection attributes.
*
* This function fetches the attributes of a given collection. It takes the following parameter:
* - collection (string): The ticker of the collection to fetch the attributes for.
*
* The function first validates the input ticker and checks if it is a valid collection ticker.
* If it is valid, the function fetches the collection attributes using the API.
* Finally, it returns a promise that resolves to the fetched collection attributes.
*/
getCollectionAttributes: (collection: string) => Promise<ICollectionAttributes>;
/**
* Searches for NFTs based on the provided arguments.
* @param {SearchNFTsArgs} args - The SearchNFTsArgs object containing the search parameters.
* @returns {Promise<SearchNFTsResponse>} A Promise that resolves to the SearchNFTsResponse object.
* @throws An error if the provided collection ticker is invalid or if the 'top' value is greater than 100.
*/
getNFTs: (args: GetNFTsArgs) => Promise<SearchNFTsResponse>;
/**
* Searches for NFTs based on the provided arguments.
* @param {SearchNFTsArgs} args - The SearchNFTsArgs object containing the search parameters.
* @returns {Promise<SearchNFTsResponse>} A Promise that resolves to the SearchNFTsResponse object.
* @throws An error if the provided collection ticker is invalid or if the 'top' value is greater than 100.
*/
getSearchNFTs: (args: GetNFTsArgs) => Promise<SearchNFTsResponse>;
/**
* @public
* @async
* @function suggestCollections
* @param {SuggestNFTsArgs} args - An object containing the necessary parameters to fetch suggested collections results.
* @returns {Promise<SuggestResults>} A promise that resolves to the fetched collections results.
*
* This function fetches suggested collections results based on the provided arguments. It takes an object with the following properties:
* - name (string): The name to search for (required).
* - top (number, optional): The maximum number of results to return (default is 35, cannot be greater than 100).
* - skip (number, optional): The number of results to skip (default is 0).
*
* Finally, it returns a promise that resolves to the fetched collections results.
*/
suggestCollections: (args: SuggestNFTsArgs) => Promise<SuggestResults>;
/**
* @public
* @async
* @function collectionListingsAnalytics
* @param {string} ticker - The unique collection identifier called ticker
* @returns {Promise<CollectionListings>} A promise that resolves to the distribution of listings
*/
collectionListingsAnalytics: (ticker: string) => Promise<CollectionListings>;
/**
* Retrieves trading history based on the provided arguments.
*
* @param {TradincActivityArgs} args - The arguments for filtering the trading activity.
* @returns {Promise<TradingActivityResponse>} A promise resolving to a TradingActivityResponse object containing the activity.
* @throws {Error} Throws an error if the 'top' argument is greater than 100.
*/
getTradingActivity: (args: TradincActivityArgs) => Promise<TradingActivityResponse>;
getOffers: (args: GetOffersArgs) => Promise<GetOffersResponse>;
/**
* Fetch collections profiles based on the provided arguments.
* @param {GetCollectionsArgs} args - The GetCollectionsArgs object containing the search parameters.
* @returns {Promise<CollectionsNFTsResponse>} A Promise that resolves to the CollectionsNFTsResponse object.
* @throws An error if the 'top' value is greater than 100.
*/
getCollections: (args?: GetCollectionsArgs) => Promise<CollectionsNFTsResponse>;
/**
* Fetch global offers based on the provided arguments.
* @param {GetGlobalOffersArgs} args - The GetCollectionsArgs object containing the search parameters.
* @returns {Promise<GlobalOffersResult>} A Promise that resolves to the GlobalOffersResult object.
* @throws An error if the 'top' value is greater than 100.
*/
getGlobalOffers: (args?: GetGlobalOffersArgs) => Promise<GlobalOffersResult>;
/**
* @public
* @async
* @function getCollectionVolume
* @param {string} collection - The ticker of the collection to fetch the volume for (e.g., 'EAPES-8f3c1f').
* @param {string} after - The start date (inclusive) of the date range for the volume data (e.g., '2023-04-17').
* @param {string} before - The end date (inclusive) of the date range for the volume data (e.g., '2023-04-25').
* @param {string} bin - The binning period for the volume data (e.g., '1d' for 1 day).
* @returns {Promise<CollectionVolume[]>} A promise that resolves to an array of collection volume data.
*
* This function fetches volume data for a given collection within a specified date range and binning period. It takes the following parameters:
* - collection (string): The ticker of the collection to fetch the volume for (e.g., 'EAPES-8f3c1f').
* - after (string): The start date (inclusive) of the date range for the volume data (e.g., '2023-04-17').
* - before (string): The end date (inclusive) of the date range for the volume data (e.g., '2023-04-25').
* - bin (string): The binning period for the volume data (e.g., '1d' for 1 day).
*
* The function first validates the input collection ticker and checks if it is a valid collection ticker.
* If it is valid, the function fetches the collection volume data using the API with the specified query parameters.
* Finally, it returns a promise that resolves to an array of collection volume data.
*/
getCollectionVolume: (collection: string, after: string, before: string, bin: string) => Promise<CollectionVolume[]>;
/**
* @public
* @async
* @function getMarketplaceVolume
* @param {string} after - The start date (inclusive) of the date range for the volume data (e.g., '2023-04-17').
* @param {string} before - The end date (inclusive) of the date range for the volume data (e.g., '2023-04-25').
* @param {string} bin - The binning period for the volume data (e.g., '1d' for 1 day).
* @returns {Promise<CollectionVolume[]>} A promise that resolves to an array of collection volume data.
*
* This function fetches volume data for a given collection within a specified date range and binning period. It takes the following parameters:
* - collection (string): The ticker of the collection to fetch the volume for (e.g., 'EAPES-8f3c1f').
* - after (string): The start date (inclusive) of the date range for the volume data (e.g., '2023-04-17').
* - before (string): The end date (inclusive) of the date range for the volume data (e.g., '2023-04-25').
* - bin (string): The binning period for the volume data (e.g., '1d' for 1 day).
*
* The function first validates the input collection ticker and checks if it is a valid collection ticker.
* If it is valid, the function fetches the collection volume data using the API with the specified query parameters.
* Finally, it returns a promise that resolves to an array of collection volume data.
*/
getMarketplaceVolume: (after: string, before: string, bin: string) => Promise<CollectionVolume[]>;
/**
* @public
* @async
* @function getCollectionOwners
* @param {string} collection - The ticker of the collection to fetch the owner information for (e.g., 'EAPES-8f3c1f').
* @returns {Promise<IOwners>} A promise that resolves a struct of collection information about holders
*
* This function fetches owner information for a given collection. It takes the following parameter:
* - collection (string): The ticker of the collection to fetch the owner information for (e.g., 'EAPES-8f3c1f').
*
* The function first validates the input collection ticker and checks if it is a valid collection ticker.
* If it is valid, the function fetches the collection owner information using the API.
* Finally, it returns a promise that resolves a struct of collection information about holders
*/
getCollectionOwners: (collection: string) => Promise<IOwners>;
/**
* @public
* @async
* @function getExportOwners
* @param {string} collection - The ticker of the collection to fetch the owner information for (e.g., 'EAPES-8f3c1f').
* @returns {Promise<ISingleHolder[]>} A promise that resolves an array of holders part of the collection.
*
* This function fetches owners information for a given collection. It takes the following parameter:
* - collection (string): The ticker of the collection to fetch the owner information for (e.g., 'EAPES-8f3c1f').
*
* The function first validates the input collection ticker and checks if it is a valid collection ticker.
* If it is valid, the function fetches the collection owner information using the API.
* Finally, it returns a promise that resolves to an array of collection owner information.
*/
getExportOwners: (collection: string) => Promise<ISingleHolder[]>;
/**
* @public
* @async
* @function getCollectionsStatistics
* @param {GetCollectionStatsArgs} args - The filter payload for the collection statsitics
* @returns {Promise<CollectionStatsResults>} A promise that resolves to a struct with information
* Finally, it returns a promise that resolves a struct with information
*/
getCollectionsStatistics: (args: GetCollectionStatsArgs) => Promise<CollectionStatsResults>;
/**
* @public
* @async
* @function getCollectionStats
* @param {GetCollectionStatsArgs} args - The filter payload for the collection statsitics
* @returns {Promise<CollectionStatsDoc>} A promise that resolves to a struct with information
* Finally, it returns a promise that resolves a struct with information
*/
getCollectionStats: (ticker: string) => Promise<CollectionStatsDoc>;
getAwaitEmpty: (delay: number) => Promise<boolean>;
/**
* @public
* @async
* @function getCollectionMintInfo
* @param {string} ticker - The ticker of the collection to fetch the owner information for (e.g., 'EAPES-8f3c1f').
* @returns {Promise<GetCollectionMintInfo>} A promise that resolves to a struct with information
* Finally, it returns a promise that resolves a struct with information
*/
getCollectionMintInfo: ({ ticker, extra, }: {
ticker: string;
extra?: RequestInit;
}) => Promise<GetCollectionMintInfo>;
/**
* @public
* @async
* @function getCollectionRanks
* @param {string} ticker - The ticker of the collection to fetch the owner information for (e.g., 'EAPES-8f3c1f').
* @returns {Promise<CollectionRanksExport[]>} A promise that resolves to a struct with information
* Finally, it returns a promise that resolves a struct with information
*/
getCollectionRanks: ({ ticker, extra, }: {
ticker: string;
extra?: RequestInit;
}) => Promise<CollectionRanksExport[]>;
/**
* @public
* @async
* @function getDropInfo
* @param {string} collectionTag - The unique ID of the collection part of the launchpad smart contract
* @param {string} creatorTag - The unique ID of the creator part of the launchpad smart contract
* @returns {Promise<GetCollectionMintInfo>} A promise that resolves to a struct with information
* Finally, it returns a promise that resolves a struct with information
*/
getDropInfo: ({ collectionTag, creatorTag, extra, }: {
collectionTag: string;
creatorTag: string;
extra?: RequestInit;
}) => Promise<GetCollectionMintInfo>;
/**
* @public
* @async
* @function getCollectionGraphData
* @param category - The ticker of the collection.
* @returns {Promise<AnalyticsGraphs>} A promise the required analytics data
* This function gets the global graph data
*/
getCollectionGraphData: (collection: string, startTime: string, endTime: string, bin: string) => Promise<AnalyticsGraphs>;
/**
* @public
* @async
* @function getPinnedCollections
* @returns {Promise<ICollectionProfile[]>} A promise that resolves to the fetched pinned collections.
*/
getPinnedCollections: () => Promise<ICollectionProfile[]>;
/**
* Get drops based on the provided arguments.
* @param {SearchNFTsArgs} args - The SearchNFTsArgs object containing the search parameters.
* @returns {Promise<SearchNFTsResponse>} A Promise that resolves to the SearchNFTsResponse object.
* @throws An error if the provided collection ticker is invalid or if the 'top' value is greater than 100.
*/
getSearchDrops: (args: GETDropsArgs) => Promise<GetDropsResponse>;
/**
* Get drops based on the provided arguments.
* @param {SearchNFTsArgs} args - The SearchNFTsArgs object containing the search parameters.
* @returns {Promise<SearchNFTsResponse>} A Promise that resolves to the SearchNFTsResponse object.
* @throws An error if the provided collection ticker is invalid or if the 'top' value is greater than 100.
*/
getDrops: (args: GETDropsArgs) => Promise<GetDropsResponse>;
/** Gets collection staking info
* @param {String} collection - User's address
* @returns {StakingSummaryPools[]} Collection's staking info
* @throws {Error} Throws an error if the collection is invalid
* */
getCollectionStakingSummary: ({ collection, extra, }: {
collection: string;
extra?: RequestInit;
}) => Promise<StakingSummaryPools[]>;
/**
* @public
* @async
* @function getCollectionsFloor
* @param collections - The tickers of the collection.
* @returns {Promise<Record<string, number>>} Floor price of the collections
* This function gets the floor price of the collections
*/
getCollectionsFloor: (collections: string[]) => Promise<Record<string, number>>;
}
//# sourceMappingURL=index.d.ts.map