Description
📝 Issue Title: Document the manifest.ts file for Dojo configuration management based on deployment type
🔍 Scope
Create comprehensive documentation for the manifest.ts
file that demonstrates how Dojo manages deployment-specific contract information across different networks. This documentation should explain the manifest system, environment-based configuration switching, and how contract deployment data flows from Dojo deployments to frontend configuration for seamless multi-network support.
This will be part of the React integration section under /integrations/react/manifest
and should serve as the definitive guide for understanding and managing Dojo deployment manifests in TypeScript applications.
🔄 How to Implement the Issue
Documentation Structure:
- Step 1: Create
/client/pages/integrations/react/Manifest.md
following the established documentation format - Step 2: Document the manifest system and its role in Dojo deployments
- Step 3: Explain the environment-based configuration switching pattern
- Step 4: Detail the manifest file structure and contract information
Content Requirements:
-
Step 1: File Overview & Manifest System
- Explain what the
manifest.ts
file does in the Dojo ecosystem - Document the role of manifest files in Dojo deployments
- Show how manifest files contain contract deployment information
- Explain what the
-
Step 2: Manifest Imports and Structure
import localhost from "../../../contract/manifest_dev.json"; // local development manifest import sepolia from "./manifest_sepolia.json"; // sepolia manifest import mainnet from "./manifest_sepolia.json"; // change for the right mainnet manifest import slot from "./manifest_sepolia.json"; // change for the right slot manifest
- Document each manifest import and its purpose:
localhost
: Development manifest from contract build outputsepolia
: Testnet deployment manifestmainnet
: Production deployment manifest (note: currently using sepolia as placeholder)slot
: Slot deployment manifest (note: currently using sepolia as placeholder)
- Explain the file path patterns and naming conventions
- Show the relationship with Dojo deployment outputs
- Document each manifest import and its purpose:
-
Step 3: Type Definition and Safety
type DeployType = keyof typeof manifests; export type Manifest = typeof manifest;
- Document the DeployType union type and its role in type safety
- Explain the Manifest type export and its usage in other files
- Show how TypeScript ensures valid deployment type selection
- Document the relationship with environment variable validation
-
Step 4: Manifests Object Configuration
const manifests = { localhost, mainnet, sepolia, slot, };
- Explain the manifests object structure and key mapping
- Document how this enables dynamic manifest selection
- Show the relationship with VITE_PUBLIC_DEPLOY_TYPE values
- Explain the benefits of centralized manifest management
-
Step 5: Environment-Based Selection Logic
const deployType = import.meta.env.VITE_PUBLIC_DEPLOY_TYPE as string; export const manifest = deployType in manifests ? manifests[deployType as DeployType] : sepolia;
- Document the environment variable usage and type casting
- Explain the fallback strategy (defaults to sepolia)
- Show the conditional selection logic and type safety
- Document error handling for invalid environment values
-
Step 6: Integration with Other Configuration Files
- Show how
dojoConfig.ts
uses manifest data - Document the relationship with
cartridgeConnector.tsx
contract addresses - Explain the flow from manifest to contract bindings
- Show the integration with Dojo SDK initialization
- Show how
✅ Acceptance Criteria
Configuration Management:
- The manifest system and its role in Dojo deployments is clearly explained
- Environment-based selection logic is documented with examples
Multi-Network Support:
- The pattern for supporting multiple networks is documented
- Environment variable coordination is explained
- Troubleshooting for network switching issues is included
Integration Context:
- The relationship with other configuration files is clearly established
📸 Additional Context
Source File Location:
/client/src/config/manifest.ts
from the Dojo-Game-Starter repository
Key Elements to Document:
- Environment switching: How VITE_PUBLIC_DEPLOY_TYPE controls manifest selection
- Type safety: TypeScript patterns for valid deployment type selection
- Fallback strategy: Default to sepolia when environment is invalid/missing
Success Criteria:
- A developer understands the role of manifests in Dojo deployments
- The environment-based configuration switching is clearly explained
- Manifest file structure and its usage is well-documented
- Integration with other configuration files is established
- Best practices for multi-network management are provided
Contribution Guidelines
- Please ensure you read and follow the contribution guidelines in the project's [README](/README.md) file
- Use the exact code from the
manifest.ts
file as the primary reference - Follow the established documentation format used in other guides of Dojo By Example