@munityclubs/nft-feature-gating
v0.1.0
Published
Reusable NFT collection feature-gating helpers for community apps.
Maintainers
Readme
@munityclubs/nft-feature-gating
Reusable NFT collection feature-gating helpers for community apps.
Munity uses this pattern for Clubs where one community can have multiple NFT Collections, and each Collection can unlock different product surfaces like files, roadmap, or merch.
Install
npm install @munityclubs/nft-feature-gatingUsage
import {
buildFeatureGating,
evaluateFeatureAccess,
} from "@munityclubs/nft-feature-gating";
const gating = buildFeatureGating({
publicCollections,
ownedCollectionIds: ["collection-a"],
});
const access = evaluateFeatureAccess({
featureKey: "files_tab",
gatingCollections: publicCollections,
ownedCollectionIds: ["collection-a"],
hasWallet: true,
});What It Covers
- Per-feature NFT Collection gating maps
- Any-of-N Collection unlock logic
- Public-safe gate collection objects for "mint to unlock" UI
- Creator, wallet-missing, ungated, collection, and forbidden access reasons
- Human copy for gated feature prompts
The package is storage-neutral. Your app still owns wallet authentication, on-chain ownership reads, database queries, and authoritative API enforcement.
Development
yarn install
yarn testLicense
MIT
