export type ListingPriceInput = {amount: string, currency: string}; export type ListingItem = {chain: string, contract: string, end_time?: (string | null) | undefined, price: ListingPriceInput, quantity: number, start_time?: (string | null) | undefined, token_id: string}; export type CreateListingActionsRequest = {address: string, items: Array, taker?: (string | null) | undefined, use_creator_fee?: (boolean | null) | undefined}; export type CreateApiApiV2ListingsActionsArgs = {body: CreateListingActionsRequest}; export type CreateApiApiV2ListingsActionsOptions = {baseUrl?: string | undefined, ApiKeyAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get listing creation actions * * POST /api/v2/listings/actions */ export const createApiApiV2ListingsActions = async (args: CreateApiApiV2ListingsActionsArgs, options?: CreateApiApiV2ListingsActionsOptions) => { const {baseUrl = "https://api.opensea.io", fetch: fetchFn = fetch, ApiKeyAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") headers.set('accept', "*/*") if (ApiKeyAuth !== undefined) headers.set("x-api-key", ApiKeyAuth) const url = `${baseUrl.replace(/\/+$/, '')}/api/v2/listings/actions${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return res.blob() };