A Trait rule grants a role to members whose tokens have specific traits. Traits come from each token's metadata, located through the contract's tokenURI.
Settings
| Field | Description |
|---|---|
| Network | The EVM chain the contract is on |
| Contract address | An ERC-721 contract |
| Traits | One or more trait type and value pairs, for example Background: Gold |
| Match | Any: a token needs at least one of the chosen traits. All: a single token must have every chosen trait. |
| Minimum | Optional. How many matching tokens the member must hold. Defaults to 1. |
| Role | The Discord role to grant |
The dashboard samples the metadata of the first tokens in the collection (IDs 0 to 40) and lists the trait types and values it finds, so you can pick them instead of typing.
How it is checked
- NXT finds the tokens from the contract held by the member's wallets.
- For each token, NXT reads its metadata from the contract's
tokenURI. IPFS (ipfs://) and Arweave (ar://) links are resolved through gateways, and results are cached for up to seven days. - Each token is compared with the chosen traits. Trait types and values are matched without regard to letter case.
- The rule passes when the number of matching tokens is at least the minimum.
If metadata for some tokens cannot be fetched and the member does not already have enough matches, the result is unknown, and no role is removed. NXT tries again on the next check.
Examples
- Faction roles: one Trait rule per faction value, each pointing to its own role, with each role given access to a private channel.
- Full set: Match All with
Hat: CrownandEyes: Lasergrants a role only for tokens with both. - Collector of a trait: Match Any with
Background: Gold, minimum 3.
Trait rules support ERC-721 contracts. Collections with metadata that changes after reveal are re-read when the cache refreshes, within seven days.