export type ChainIdentifier = 'base' | 'ethereum' | 'zora' | 'arbitrum' | 'sei' | 'avalanche' | 'polygon' | 'optimism' | 'ape_chain' | 'flow' | 'soneium' | 'ronin' | 'bera_chain' | 'solana' | 'shape' | 'unichain' | 'gunzilla' | 'abstract' | 'animechain' | 'hyperevm' | 'somnia' | 'monad' | 'hyperliquid' | 'megaeth' | 'ink' | 'robinhood' | 'stablechain'; export type GetApiApiV2AccountAddressOffersArgs = {address: string, after?: string | undefined, limit?: number | undefined, collection_slugs?: Array | undefined, chains?: Array | undefined, sort_by?: ('START_TIME' | 'END_TIME') | undefined, sort_direction?: ('asc' | 'desc') | undefined}; export type GetApiApiV2AccountAddressOffersOptions = {baseUrl?: string | undefined, ApiKeyAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get active offers made by an account * * GET /api/v2/account/{address}/offers */ export const getApiApiV2AccountAddressOffers = async (args: GetApiApiV2AccountAddressOffersArgs, options?: GetApiApiV2AccountAddressOffersOptions) => { const {baseUrl = "https://api.opensea.io", fetch: fetchFn = fetch, ApiKeyAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "*/*") if (args.after != null) query.append("after", String(args.after)) if (args.limit != null) query.append("limit", String(args.limit)) for (const item of args.collection_slugs ?? []) query.append("collection_slugs", String(item)) for (const item of args.chains ?? []) query.append("chains", String(item)) if (args.sort_by != null) query.append("sort_by", String(args.sort_by)) if (args.sort_direction != null) query.append("sort_direction", String(args.sort_direction)) if (ApiKeyAuth !== undefined) headers.set("x-api-key", ApiKeyAuth) const url = `${baseUrl.replace(/\/+$/, '')}/api/v2/account/${encodeURIComponent(String(args.address))}/offers${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 res.blob() };