export type ConsiderationObject = {asset_contract_address: string, token_id: string}; export type FulfillerObject = {address: string}; export type ListingObject = {chain: string, hash: string, protocol_address: string}; export type FullfillListingRequest = {consideration?: ConsiderationObject | undefined, fulfiller: FulfillerObject, include_optional_creator_fees?: (boolean | null) | undefined, listing: ListingObject, recipient?: string | undefined, units_to_fill?: (number | null) | undefined}; export type CreateApiApiV2ListingsFulfillmentActionsArgs = {body: FullfillListingRequest}; export type CreateApiApiV2ListingsFulfillmentActionsOptions = {baseUrl?: string | undefined, ApiKeyAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get listing fulfillment actions * * POST /api/v2/listings/fulfillment/actions */ export const createApiApiV2ListingsFulfillmentActions = async (args: CreateApiApiV2ListingsFulfillmentActionsArgs, options?: CreateApiApiV2ListingsFulfillmentActionsOptions) => { 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/fulfillment/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() };