Studio NFT Code Inventory
Complete inventory of all NFT-related code in apps/emprops-studio/. This codebase was originally built as a full NFT platform — AI generation fed into NFT minting. The studio still contains extensive NFT UI, contract interaction code, and marketplace components that can be reconnected to the new Diamond/Arbitrum backend.
Summary
| Category | Files | Total LOC (est.) |
|---|---|---|
| Pages | 10+ | ~2,000 |
| Components | 35+ | ~4,000 |
| Clients | 7 | ~2,500 |
| Hooks | 10+ | ~2,000 |
| Contracts/ABIs | 11 | ~1,500 |
| State (Atoms) | 3 | ~200 |
| Types | 1 | ~100 |
| Utils | 3 | ~300 |
| Total | ~80 files | ~12,600 |
Pages
| Page | Path | What It Does |
|---|---|---|
| Marketplace | pages/marketplace/index.tsx | Browse published collections with filters (artist, blockchain, status, type, price). Uses EmPropsApi platform client. ~835 LOC |
| Marketplace Apps | pages/marketplace/apps/index.tsx | App listing view within marketplace |
| Collection Detail | pages/marketplace/apps/[id]/index.tsx | Single collection view with token grid |
| Token Detail | pages/tokens/emprops/[id]/[tokenId].tsx | Individual token view with metadata, image, traits |
| Token Collection | pages/tokens/emprops/[id].tsx | Token list view for a collection |
| Collection Page | pages/collection/[id].tsx | Collection management page (creator view) |
| Profile Collection | pages/profile/[address]/collection/ | User's owned/created collections |
| Profile Sales | pages/profile/[address]/sales/ | User's sales history |
| Profile Creations | pages/profile/[address]/creations/ | User's created artworks |
| Redeem | pages/studio/redeem.tsx | Redeem funds from collection sales |
API Routes (Next.js)
| Route | What It Does |
|---|---|
pages/api/allowlist/proof/[address].ts | Generate Merkle proof for allowlist verification |
pages/api/allowlist/validate/[address].ts | Validate address is on allowlist |
pages/api/blockchains/tezos/[network]/contracts/[contractAddress]/mints/signings/ | Tezos mint transaction signing |
pages/api/contracts/[network]/[contractAddress]/mints/signings/ | EVM mint transaction signing |
pages/api/checkout/ | Checkout flow |
pages/api/checkout/stripe/ | Stripe payment integration for fiat purchases |
Components
Minting Components
| Component | Path | Blockchain Support |
|---|---|---|
| MintButton (router) | components/MintButton/index.tsx | Dispatches to chain-specific mint button |
| TezosMintButton | components/MintButton/TezosMintButton.tsx | TEZOS — Beacon wallet minting |
| USDEthereumMintButton | components/MintButton/USDEthereumMintButton.tsx | ETHEREUM — USD-denominated ETH minting |
| USDTezosMintButton | components/MintButton/USDTezosMintButton.tsx | TEZOS — USD-denominated minting |
| BatchMintCounter | components/MintButton/BatchMintCounter.tsx | ALL — Quantity selector for batch mints |
| MintButtonLabel | components/MintButton/MintButtonLabel.tsx | ALL — Mint button text/styling |
| Base MintButton | components/Blockchain/Base/v1/MintButton | BASE — Base chain mint button |
| Ethereum MintButton | components/Blockchain/Ethereum/v1/MintButton | ETHEREUM — Ethereum mint button |
Arbitrum Impact
A new ArbitrumMint component is needed. For Phase 1 (custodial), it calls the API /nft/collections/:id/mint endpoint — no user wallet required. Later phases can add user-signed minting via wagmi.
Collection Management Components
| Component | Path | Description |
|---|---|---|
| PublishCollectionModal | components/PublishCollectionModal/index.tsx (~267 LOC) | Publish collection to blockchain. Handles wallet connection, receivers, credits, metadata upload. Supports TEZOS, ETHEREUM, BASE. |
| CollectionSettings | components/CollectionSettings/ | Manage published collection (status, price, editions) |
| CollectionSettingsLoader | components/CollectionSettingsLoader/ | Loading state for settings |
| CollectionDetails | components/CollectionDetails/ | Display collection info (read-only) |
| CollectionDetailsForm | components/CollectionDetailsForm/ | Edit collection details |
| CollectionHistory | components/CollectionHistory/ | Collection event history log |
| CollectionItems | components/CollectionItems/ | Token grid for a collection |
| CollectionItems/BlockchainIcon | components/CollectionItems/BlockchainIcon | Chain icon display (Tezos, Eth, Base) |
| CollectionCorruptedModal | components/CollectionCorruptedModal/ | Error state for corrupted collection data |
| ManageCollection | components/ManageCollection/ | Collection management actions |
| ManageCollectionPreview | components/ManageCollectionPreview/ | Preview of managed collection |
| MoveCollectionDialog | components/MoveCollectionDialog/ | Move collection between projects |
| UpdateCollectionDetails | components/UpdateCollectionDetails/ | Update collection metadata |
| BlockchainSelector | components/BlockchainSelector/ | Chain selection dropdown |
Arbitrum Impact
PublishCollectionModal needs an Arbitrum deployment flow — call /nft/collections/:id/deploy instead of direct contract interaction. BlockchainSelector needs ARBITRUM added.
Marketplace Components
| Component | Path | Description |
|---|---|---|
| MarketActions | components/MarketActions/index.tsx (~100 LOC) | Buy/Sell/List tokens — TEZOS ONLY (line 60 blockchain check) |
| BuyToken | components/MarketActions/BuyToken.tsx | Buy a listed token |
| ListForSale | components/MarketActions/ListForSale.tsx | List token for sale |
| UnlistForSale | components/MarketActions/UnlistForSale.tsx | Cancel listing |
| MarketplaceToast | components/MarketplaceToast/ | Transaction notification toasts |
Arbitrum Impact
MarketActions is currently Tezos-only. For Arbitrum Phase 1: replace with "View on OpenSea" link. Phase 3+: add native marketplace facet support.
Publishing & NFT Flow
| Component | Path | Description |
|---|---|---|
| NFTPublishingForm | components/NFTPublishingForm/ | NFT publishing form |
| PublishAlerts | components/PublishAlerts/ | Publishing validation alerts |
| PublishLongForm | components/PublishLongForm/ | Long-form publishing flow |
| VerificationModal | components/VerificationModal/ | Collection verification |
| StorefrontHeader | components/StorefrontHeader/ | Storefront page header |
| Storefronts | components/Storefronts/ | Storefront listing |
Wallet Components
| Component | Path | Description |
|---|---|---|
| ConnectWallet | components/ConnectWallet/ | Wallet connection UI |
| Wallet | components/Wallet/ | Tezos wallet component (Beacon) |
| WalletEth | components/WalletEth/ | EVM wallet component (wagmi) |
| WalletAlerts | components/WalletAlerts/ | Wallet status alerts |
| WalletsTable | components/WalletsTable/ | Manage multiple wallets |
| AddWalletForm | components/AddWalletForm/ | Add new wallet |
| NetworkSwitch | components/NetworkSwitch/ | Switch network prompt (EVM) |
Financial Components
| Component | Path | Description |
|---|---|---|
| Redeem | components/Redeem/ | Redeem collection funds |
| RedeemLoader | components/RedeemLoader/ | Redeem loading state |
| ClaimRewardsForm | components/ClaimRewardsForm/ | Claim rewards |
| Royalties | components/Royalties/ | Royalty configuration |
| SalesConfigForm | components/SalesConfigForm/ | Sales configuration |
| PriceDisplay | components/PriceDisplay/ | Price with blockchain icon |
Token Display Components
| Component | Path | Description |
|---|---|---|
| TokenInfo | components/TokenInfo/ | Token detail display |
| TokenTypeLink | components/TokenTypeLink/ | Link to token type |
| GridItemToken | components/GridItemToken/ | Token in grid view |
| GridItemCollection | components/GridItemCollection/ | Collection in grid view |
| RandomTokenViewer | components/RandomTokenViewer/ | Random token preview |
Clients
contract-client.ts (Core NFT Engine)
Path: clients/contract-client.ts — 1,275 LOC
This is the most important file for understanding NFT contract interactions. It handles:
- Tezos: Collection creation, minting, redeeming, status updates, price updates, edition management via Taquito
- Ethereum/Base (EVM): Contract interactions via ethers.js/wagmi
- Contract Registry:
allowedContractsmapping for TEZOS, ETHEREUM, BASE with addresses and ABIs - Multi-chain dispatch: Routes operations to the correct chain handler
Critical for Arbitrum
This file needs Diamond contract interaction functions added for Arbitrum — getArbitrumCollection(), getArbitrumTokenMetadata(). Write operations should go through the API (custodial), not direct contract calls.
Other Clients
| Client | Path | Description |
|---|---|---|
| tezos-client.ts | clients/tezos-client.ts | Tezos-specific client (Beacon wallet SDK) |
| indexer-client.ts | clients/indexer-client.ts | TzKT indexer client for Tezos blockchain data |
| wallet.ts | clients/wallet.ts | Wallet abstraction layer |
| emprops-api-client.ts | clients/emprops-api-client.ts | Platform API client (originally called Java backend) |
| open-api-client/ | clients/open-api-client/ | Open API client (metadata, collections) |
| stripe-client.ts | clients/stripe-client.ts | Stripe payments for fiat purchases |
Hooks
contract-client.ts (EVM Contract Hooks)
Path: hooks/contract-client.ts — 402 LOC
Uses @stakeordie/emprops-clients ContractFactoryFacade to provide:
useCollectionContract— Get contract instance for a collectionusePublishCollection— Publish collection to blockchainuseMintToken— Mint tokensuseUpdateStatus/useUpdatePrice/useUpdateEditions— Update collection settingsuseWithdrawFunds— Withdraw collected fundsuseRedeemAmount— Calculate redeemable amount
collections.ts (Collection CRUD)
Path: hooks/collections.ts — 517 LOC
- Collection listing with infinite scroll
- Collection CRUD operations
- Receiver management (revenue split recipients)
- Preview generation
- Feed/discovery queries
useMarketContract.ts (Tezos Marketplace)
Path: hooks/useMarketContract.ts — 210 LOC
Tezos-only marketplace operations:
listNFTForSale(price)— List token on marketplaceunlistNFTForSale()— Remove listingbuyNFT()— Purchase listed token
Other Hooks
| Hook | Path | Description |
|---|---|---|
| useIndexerClient | hooks/useIndexerClient.ts | TzKT indexer access |
| publish-utils | hooks/publish-utils.ts | Publishing validation helpers |
| publish-verifier | hooks/publish-verifier.ts | Publish verification |
| wallets | hooks/wallets.ts | Wallet management |
| rewards | hooks/rewards.ts | Collection rewards |
| useWertConverter | hooks/useWertConverter.ts | Fiat-to-crypto conversion (Wert widget) |
Contracts (Ethereum ABIs & TypeScript Wrappers)
Path: contracts/ethereum/
These are TypeScript wrappers around contract ABIs, used by the contract-client and hooks.
| File | Description |
|---|---|
collections-contract.ts | Collections contract ABI wrapper |
collections-contract.json | Collections contract ABI |
member-collections-contract.ts | Member collections ABI wrapper |
member-collections-contract.json | Member collections ABI |
member-collections-token-contract.ts | Member token ABI wrapper — exports contractConfig with address + ABI for wagmi |
member-collections-token-contract.json | Member token ABI |
patron-pass-collections-contract.ts | Patron pass collections ABI wrapper |
patron-pass-collections-contract.json | Patron pass collections ABI |
patron-pass-token-contract.ts | Patron pass token ABI wrapper |
patron-pass-token-contract.json | Patron pass token ABI |
utils.ts | ABI utility functions |
Arbitrum Impact
New Diamond ABI files will be needed: diamond-factory.ts, diamond-collection.ts with the Diamond facet interfaces (ERC721A, Mint, Metadata, Royalty).
State Management (Jotai Atoms)
| Atom | Path | Description |
|---|---|---|
| mint | atoms/mint.ts | Mint state tracking (current mint progress, tx status) |
| tokenMarket | atoms/tokenMarket.ts | Market state (listing changes, price updates) |
| address | atoms/address.ts | Connected wallet address state |
Types
wallet.ts
Path: types/wallet.ts
type Blockchain = "TEZOS" | "ETHEREUM" | "BASE"Key types:
Blockchain— Chain identifier enum (needs"ARBITRUM"added)ChainId— Numeric chain IDsWalletState— Current wallet connection stateWallet— Wallet interface (address, chain, provider)
Utils
| File | Path | Description |
|---|---|---|
| allowlist.ts | utils/allowlist.ts | Merkle tree allowlist utilities for gated mints |
| wallet.ts | utils/wallet.ts | Wallet helper functions |
| transactionDetails.ts | utils/transactionDetails.ts | Transaction formatting and display |
External Package: @stakeordie/emprops-clients
Used by hooks/contract-client.ts. This is an npm package (not in the monorepo) that provides:
ContractFactoryFacade— Creates chain-specific contract instancesBlockchainType,VersionType— Chain/version enumsCollectionStatus— Contract state enums (active, paused, etc.)MintModeEthereumV1— Mint mode configurationCreateCollectionParamsBaseV1,CreateCollectionParamsEthereumV1— Collection creation parameter types
Dependency Note
This package was built for the ERC721A/ERC1167 architecture. For Diamond contracts, we'll either update this package or create Diamond-specific hooks directly in the studio.
What Needs to Change for Arbitrum
Files to Modify
| File | Change |
|---|---|
types/wallet.ts | Add "ARBITRUM" to Blockchain type + Arbitrum chain IDs |
clients/contract-client.ts | Add Diamond contract read functions for Arbitrum |
hooks/contract-client.ts | Add Arbitrum chain + Diamond hooks |
hooks/collections.ts | Support Arbitrum in collection publish flow |
components/MintButton/ | Add ArbitrumMint.tsx component |
components/PublishCollectionModal/ | Add Diamond deployment flow |
components/MarketActions/ | Add Arbitrum support (OpenSea links initially) |
components/CollectionSettings/ | Add Arbitrum collection management |
components/BlockchainSelector/ | Add Arbitrum option |
pages/tokens/emprops/[id]/[tokenId].tsx | Render Arbitrum token metadata |
Files to Create
| File | Purpose |
|---|---|
components/MintButton/ArbitrumMint.tsx | Custodial mint button (calls API) |
hooks/diamond.ts | Diamond-specific hooks (loupe, facets, read) |
lib/arbitrum.ts | Arbitrum chain config + utilities |
contracts/ethereum/diamond-factory.json | Diamond Factory ABI |
contracts/ethereum/diamond-collection.json | Diamond Collection ABI (all facets) |
Related Documentation
- Legacy Architecture — How the original microservices worked
- Legacy Tezos Implementation — Tezos contract details
- Contract Client Deep Dive — contract-client.ts internals
- External Repos — emprops-hardhat, emprops-ponder, emprops-react-web3
- Implementation Plan — Phase 5 covers studio restoration
