export type CreateOfferActionItem = {chain: string, contract: string, token_id: string}; export type ListingPriceInput = {amount: string, currency: string}; export type CreateOfferActionsRequest = {address: string, end_time?: (string | null) | undefined, item: CreateOfferActionItem, price: ListingPriceInput, quantity: number, start_time?: (string | null) | undefined, use_creator_fee?: (boolean | null) | undefined}; export type CreateApiApiV2OffersActionsArgs = {body: CreateOfferActionsRequest}; export type CreateApiApiV2OffersActionsOptions = {baseUrl?: string | undefined, ApiKeyAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get offer creation actions * * POST /api/v2/offers/actions */ export const createApiApiV2OffersActions = async (args: CreateApiApiV2OffersActionsArgs, options?: CreateApiApiV2OffersActionsOptions) => { 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/offers/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() };