export type GetApiCollectionStatsSearchBitcoinArgs = {window?: ('10m' | '1h' | '6h' | '1d' | '7d' | '30d') | undefined, sort?: ('volume' | 'volumePercentageChange' | 'totalVolume' | 'sales' | 'salesPercentageChange' | 'totalSales' | 'floorPrice' | 'floorPricePercentageChange' | 'topOffer' | 'listedOverSupply' | 'ownerPercentage' | 'pending' | 'marketCap') | undefined, direction?: ('asc' | 'desc') | undefined, offset?: number | undefined, limit?: number | undefined}; export type GetApiCollectionStatsSearchBitcoinOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get collection statistics * * GET /collection_stats/search/bitcoin */ export const getApiCollectionStatsSearchBitcoin = async (args: GetApiCollectionStatsSearchBitcoinArgs, options?: GetApiCollectionStatsSearchBitcoinOptions) => { const {baseUrl = "https://api-mainnet.magiceden.dev/v2", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.window != null) query.append("window", String(args.window)) if (args.sort != null) query.append("sort", String(args.sort)) if (args.direction != null) query.append("direction", String(args.direction)) if (args.offset != null) query.append("offset", String(args.offset)) if (args.limit != null) query.append("limit", String(args.limit)) const url = `${baseUrl.replace(/\/+$/, '')}/collection_stats/search/bitcoin${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "GET", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };