Skip to content

v10.2.1

Choose a tag to compare

@ryanio ryanio released this 01 May 02:02

What's Changed

Patch release adding server-side trait filtering on three collection-scoped read methods.

Server-side trait filtering

getNFTsByCollection, getBestListings, and getEventsByCollection now accept an optional traits argument:

import type { TraitFilter } from "@opensea/sdk"

const { nfts } = await openseaSDK.api.getNFTsByCollection(
  "doodles-official",
  undefined, undefined,
  [{ traitType: "Background", value: "Red" }],
)
  • Multiple entries are AND-combined server-side.
  • Empty result when no items match (not all items).
  • Returns 400 if a single trait matches more than 1000 items.
  • The SDK accepts a structured TraitFilter[] and JSON-encodes it for the wire — callers don't need to JSON.stringify.

New exports

  • TraitFilter{ traitType, value } shape.
  • GetEventsByCollectionArgs — extends GetEventsArgs with traits. Type-restricts the field to the collection endpoint, so the other event methods reject traits at compile time.
  • encodeTraitsParam — exposed for callers building requests directly (e.g. via the generic api.get()).

Requirements

  • Requires @opensea/api-types@^0.2.2 (already a transitive dep on install).

Full Changelog: ProjectOpenSea/opensea-devtools@sdk-v10.2.0...sdk-v10.2.1