Background is Blue or Red). Trait bids are a stricter form of collection bids.
The seller must still choose a concrete token when filling, but that token’s indexed attributes must satisfy all of your trait criteria.
See Getting Started for prerequisites and installation.
What is a trait bid?
- You offer ERC-20 tokens to buy one or more NFTs from a collection, identified by an ERC-721 collection or ERC-1155 collection buy item.
- You attach
traitCriteria: an array of filters. Each filter has a trait type (metadata attribute name) and a list of allowed values. - Matching semantics: every trait type you specify must be matched by the NFT’s metadata. For a given type, the token matches if its attribute value is one of the values you listed. Matching is case-insensitive for values and numerical values are converted to their string equivalent.
- Orders appear as
TRAIT_BIDin API responses alongside listings, bids, and collection bids. Use the ordertypefield when branching in your app or webhooks.
Prerequisites
- Same setup as other orderbook flows (Passport or wallet, fees, etc.).
- Metadata for fulfillment: when a seller fills your bid with a specific
tokenId, Immutable validates that token’s attributes against your criteria. That requires the NFT’s metadata to be available through Immutable’s indexer. If metadata is missing or out of date, fulfillment can fail even if the token exists on-chain.
Creating a trait bid
The flow mirrors collection bids: prepare (buildsorderComponents, orderHash, and actions) → run any approval transactions → sign the EIP-712 order from the SIGNABLE action → create.
Filling a trait bid (seller)
Sellers callfulfillOrder with the trait bid order id and the token ID they are selling. The fifth argument is tokenId (criteria fulfillment); pass undefined for amountToFill when you are not doing a partial ERC-1155 quantity fill.
Querying trait bids
List trait bids
Filter by collection contract, status, maker, and pagination — same ergonomics aslistCollectionBids.
Get one trait bid
Comparison: token bid vs collection bid vs trait bid
| Aspect | Token bid | Collection bid | Trait bid |
|---|---|---|---|
| Buy target | One specific tokenId | Any token in the collection | Any token in the collection whose metadata matches traitCriteria |
| Fulfillment | Seller sells that token | Seller passes tokenId | Seller passes tokenId + metadata must match |
| Typical use | Target a rare ID | Floor sweep / any item | Offers on filtered sets (e.g. legendary + blue background) |
Fees and cancellation
- Fees: same maker/taker concepts as other orders — see Fees.
- Cancel: use the bid’s order id with Cancel orders (soft or hard cancel patterns apply to open orders).
Next steps
Collection bids
Bids on any NFT in a collection without trait filters
Fill orders
Fulfillment, actions, and approvals
Order management
Status, pagination, and webhooks
Cancel orders
Cancel trait bids you created