v12.2.0
What's Changed
Trait floor prices (#675)
Adds getCollectionTraitFloors(slug) for GET /api/v2/traits/{slug}/floors, added to the spec in @opensea/api-types 0.9.2.
Important
Corrected after publishing. These notes originally showed the call as sdk.api.collections.getCollectionTraitFloors(slug). That shape was ahead of the code rather than wrong forever: sdk.api had no collections property at the time, so the example threw a TypeError before making a request, and the per-domain namespaces that make it valid were added later.
The cause was that the method landed on the internal CollectionsAPI with no forwarder on OpenSeaAPI, so in 12.2.0 and 12.3.0 there is no way to call it at all. Reported in opensea-sdk#2007. If you are on either version, use the workaround below; neither example above it works there.
On a release that has the fix, either of these works, and the namespaced form is preferred:
const { chain, floors } = await sdk.api.collections.getCollectionTraitFloors("boredapeyachtclub")
// floors: [{ traitType: "Background", value: "Purple", floorPrice: 1.25, paymentTokenSymbol: "ETH" }]On 12.2.0 or 12.3.0, reach the endpoint through the generic request method, which is typed and needs no upgrade:
import type { TraitFloorsResponse } from "@opensea/sdk"
const { chain, floors } = await sdk.api.get<TraitFloorsResponse>(
"/api/v2/traits/boredapeyachtclub/floors",
)Covers text trait values with at least one active listing, ordered by trait type, then value, then price. Numeric traits are not enumerated there; use getTraits for their min/max range. Every floor is denominated on the collection's own chain, identified by chain plus each entry's paymentTokenSymbol.
Full Changelog: v12.1.1...v12.2.0