import { type BaseStreamMessage, type Callback, type ClientConfig, type CollectionOfferEvent, EventType, type ItemCancelledEvent, type ItemListedEvent, type ItemMetadataUpdate, type ItemReceivedBidEvent, type ItemReceivedOfferEvent, type ItemSoldEvent, type ItemTransferredEvent, type OrderValidationEvent, type TraitOfferEvent } from "./types"; /** * Client for the OpenSea Stream API. * * @example * ```ts * import { OpenSeaStreamClient } from "@opensea/sdk/stream" * * const client = new OpenSeaStreamClient({ apiKey: "YOUR_API_KEY" }) * * const unsubscribe = client.onItemListed("doodles-official", event => { * console.log(event.payload.item.nft_id) * }) * ``` * * @category Main Classes */ export declare class OpenSeaStreamClient { private transport; private logLevel; private onEvent; constructor({ network, apiKey, token, apiUrl, connectOptions, logLevel, onError, onEvent, }: ClientConfig); private log; private debug; private info; private warn; private error; connect: () => void; disconnect: (callback?: () => void) => void; private on; onItemMetadataUpdated: (collectionSlug: string, callback: Callback) => () => void; onItemCancelled: (collectionSlug: string, callback: Callback) => () => void; onItemListed: (collectionSlug: string, callback: Callback) => () => void; onItemSold: (collectionSlug: string, callback: Callback) => () => void; onItemTransferred: (collectionSlug: string, callback: Callback) => () => void; /** * No-op. The Stream API does not emit `item_received_offer` and never has, so * this only ever registered a handler that could not fire. Item-level offers * arrive as `item_received_bid`, so use {@link onItemReceivedBid} instead. * * Kept callable, and kept from opening a connection for a topic that yields * nothing, so existing call sites keep compiling and running unchanged. * * @deprecated Use {@link onItemReceivedBid}. This does nothing. * @hidden */ onItemReceivedOffer: (_collectionSlug: string, _callback: Callback) => () => void; onItemReceivedBid: (collectionSlug: string, callback: Callback) => () => void; onCollectionOffer: (collectionSlug: string, callback: Callback) => () => void; onTraitOffer: (collectionSlug: string, callback: Callback) => () => void; onOrderInvalidate: (collectionSlug: string, callback: Callback) => () => void; onOrderRevalidate: (collectionSlug: string, callback: Callback) => () => void; /** * Subscribe to several event types on one collection with a single callback, * filtered server-side to the requested types. * * The callback receives `BaseStreamMessage`: one subscription can * deliver several event types, so there is no single payload type to hand * back. `event_type` identifies which arrived, and the payload needs * narrowing before use. * * ```ts * client.onEvents(slug, [EventType.ITEM_SOLD, EventType.ITEM_LISTED], event => { * if (event.event_type === EventType.ITEM_SOLD) { * const sale = event as ItemSoldEvent * console.log(sale.payload.sale_price) * } * }) * ``` * * Use the typed single-event methods, such as `onItemSold`, when you want the * payload typed for you. * * @param collectionSlug collection slug, or `"*"` for all collections * @param eventTypes event types to subscribe to * @param callback invoked for every subscribed event type * @returns a function that removes all of this call's handlers */ onEvents: (collectionSlug: string, eventTypes: EventType[], callback: Callback>) => () => void; }