### Install Frontend Dependencies Source: https://github.com/hackdays-io/mint-rally/blob/staging/document/docs/developer/dev-env/frontend.md Navigates to the frontend directory and installs project dependencies using yarn. ```bash cd frontend pwd {your_directories}/mint-rally/frontend yarn ``` -------------------------------- ### Start Development Server Source: https://github.com/hackdays-io/mint-rally/blob/staging/document/docs/developer/dev-env/frontend.md Starts the Next.js development server. The application will be accessible at http://localhost:3000/. ```bash yarn dev ``` -------------------------------- ### Configure Environment Variables Source: https://github.com/hackdays-io/mint-rally/blob/staging/document/docs/developer/dev-env/frontend.md Copies the example environment file to .env.local and prompts the user to edit it. Specific variables for testnet or localnet must be populated. ```bash cp .env.example .env.local vi .env.local ``` -------------------------------- ### Install Frontend Dependencies Source: https://github.com/hackdays-io/mint-rally/blob/staging/document/i18n/ja/docusaurus-plugin-content-docs/current/developer/dev-env/frontend.md Navigates to the frontend directory and installs project dependencies using Yarn. ```bash cd frontend pwd {your_directories}/mint-rally/frontend yarn ``` -------------------------------- ### Run Local Node Source: https://github.com/hackdays-io/mint-rally/blob/staging/document/docs/developer/dev-env/localnode.md Commands to navigate to the hardhat directory, install dependencies, copy environment files, and start the local blockchain node using Docker or directly. ```shell cd hardhat yarn cp .env.example .env docker-compose up ``` ```shell cd hardhat yarn cp .env.example .env yarn localchain ``` -------------------------------- ### Run Local Node Source: https://github.com/hackdays-io/mint-rally/blob/staging/document/i18n/ja/docusaurus-plugin-content-docs/current/developer/dev-env/localnode.md Commands to navigate to the hardhat directory, install dependencies, copy environment files, and start the local blockchain node using Docker or directly. ```shell cd hardhat yarn cp .env.example .env docker-compose up ``` ```shell cd hardhat yarn cp .env.example .env yarn localchain ``` -------------------------------- ### Set Up .env Configuration File Source: https://github.com/hackdays-io/mint-rally/blob/staging/document/docs/developer/dev-env/contract.md Copies the example environment configuration file to .env. This is a standard practice to set up project-specific variables and secrets. ```shell cp .env.example .env ``` -------------------------------- ### Start Development Server Source: https://github.com/hackdays-io/mint-rally/blob/staging/document/i18n/ja/docusaurus-plugin-content-docs/current/developer/dev-env/frontend.md Starts the Next.js development server using Yarn, making the application accessible locally. ```bash yarn dev ``` -------------------------------- ### Create and Configure .env.local Source: https://github.com/hackdays-io/mint-rally/blob/staging/document/i18n/ja/docusaurus-plugin-content-docs/current/developer/dev-env/frontend.md Copies the example environment file to .env.local and instructs on updating variables for testnet or localnet configurations. ```bash cp .env.example .env.local vi .env.local ``` -------------------------------- ### Install NPM using Yarn Source: https://github.com/hackdays-io/mint-rally/blob/staging/document/docs/developer/dev-env/contract.md This snippet demonstrates how to install project dependencies using Yarn within the hardhat directory. It assumes Yarn is already installed and the project has a package.json file. ```shell cd hardhat pwd yarn ``` -------------------------------- ### Verify Homebrew Installation Source: https://github.com/hackdays-io/mint-rally/blob/staging/document/docs/developer/dev-env/devenv_mac.md Checks if Homebrew is installed correctly by displaying its version. Successful output indicates a proper installation. ```shell brew --version ``` -------------------------------- ### Start Local Development Server with Yarn Source: https://github.com/hackdays-io/mint-rally/blob/staging/document/README.md Starts a local development server for the Mint Rally website. It automatically rebuilds the site upon detecting changes and opens it in a browser. ```shell $ yarn start ``` -------------------------------- ### Start Development Server Source: https://github.com/hackdays-io/mint-rally/blob/staging/frontend/README.md Commands to run the Next.js development server. These commands initiate the local development environment, allowing for real-time updates as code is modified. ```bash npm run dev # or yarn dev ``` -------------------------------- ### Install Dependencies with Yarn Source: https://github.com/hackdays-io/mint-rally/blob/staging/document/README.md Installs all project dependencies required for Docusaurus and website development. This command should be run after cloning the repository. ```shell $ yarn ``` -------------------------------- ### Verify Node.js Installation Source: https://github.com/hackdays-io/mint-rally/blob/staging/document/docs/developer/dev-env/devenv_mac.md Checks if Node.js is installed and accessible by displaying its version. Successful output confirms the installation and PATH configuration. ```shell node -v ``` -------------------------------- ### Verify Yarn Installation Source: https://github.com/hackdays-io/mint-rally/blob/staging/document/docs/developer/dev-env/devenv_mac.md Checks if Yarn is installed and accessible by displaying its version. Successful output confirms the installation. ```shell yarn --version ``` -------------------------------- ### Install Homebrew Package Manager Source: https://github.com/hackdays-io/mint-rally/blob/staging/document/docs/developer/dev-env/devenv_mac.md Installs the Homebrew package manager on macOS using the official installation script. This is a prerequisite for managing other development tools. ```shell /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" ``` -------------------------------- ### Install Node.js v18 via Homebrew Source: https://github.com/hackdays-io/mint-rally/blob/staging/document/docs/developer/dev-env/devenv_mac.md Installs Node.js version 18 using Homebrew, which is recommended for MintRally development. This command ensures a specific, tested version is used. ```shell brew install node@18 ``` -------------------------------- ### Install Yarn Package Manager Source: https://github.com/hackdays-io/mint-rally/blob/staging/document/docs/developer/dev-env/devenv_mac.md Installs Yarn globally using npm, the Node Package Manager. Yarn is used for managing project dependencies. ```shell npm install -g yarn ``` -------------------------------- ### Deploy Contracts to Local Node Source: https://github.com/hackdays-io/mint-rally/blob/staging/document/docs/developer/dev-env/localnode.md Commands to deploy smart contracts to the running local blockchain node and retrieve the addresses of the deployed contracts for frontend integration. ```shell cd hardhat yarn deploy:local ``` -------------------------------- ### Set Private Key for Local Deployment Source: https://github.com/hackdays-io/mint-rally/blob/staging/document/i18n/ja/docusaurus-plugin-content-docs/current/developer/dev-env/localnode.md Details on how to update the `.env` file within the hardhat directory with the private key obtained from the local node console, which is necessary for contract deployment. ```.env LOCAL_PRIVATE_KEY=privatekey_you_got_from_console ``` -------------------------------- ### Deploy Contracts to Local Node Source: https://github.com/hackdays-io/mint-rally/blob/staging/document/i18n/ja/docusaurus-plugin-content-docs/current/developer/dev-env/localnode.md Commands to deploy smart contracts to the running local blockchain node and retrieve the addresses of the deployed contracts for frontend integration. ```shell cd hardhat yarn deploy:local ``` -------------------------------- ### Frontend Configuration with Contract Addresses Source: https://github.com/hackdays-io/mint-rally/blob/staging/document/docs/developer/dev-env/localnode.md Environment variables required for the frontend application, mapping contract names to their deployed addresses on the local network. These addresses are outputted after contract deployment. ```.env NEXT_PUBLIC_FORWARDER_ADDRESS=0xa513E6E4b8f... NEXT_PUBLIC_CONTRACT_MINT_NFT_MANAGER=0x2279B7A0a... NEXT_PUBLIC_CONTRACT_EVENT_MANAGER=0x8A791620dd626... ``` -------------------------------- ### Configure Metamask for Local Network Source: https://github.com/hackdays-io/mint-rally/blob/staging/document/docs/developer/dev-env/localnode.md Instructions and parameters required to add a custom local network to Metamask, enabling interaction with the local blockchain node. ```APIDOC Add Localnetwork to Metamask: Parameters: - Network Name: Localnetwork - New RPC URL: http://127.0.0.1:8545/ - Chain ID: 31337 - Currency Symbol: ETH - Block Explorer URL: (Optional) ``` -------------------------------- ### Configure Metamask for Local Network Source: https://github.com/hackdays-io/mint-rally/blob/staging/document/i18n/ja/docusaurus-plugin-content-docs/current/developer/dev-env/localnode.md Instructions and parameters required to add a custom local network to Metamask, enabling interaction with the local blockchain node. ```APIDOC Add Localnetwork to Metamask: Parameters: - Network Name: Localnetwork - New RPC URL: http://127.0.0.1:8545/ - Chain ID: 31337 - Currency Symbol: ETH - Block Explorer URL: (Optional) ``` -------------------------------- ### Frontend Configuration with Contract Addresses Source: https://github.com/hackdays-io/mint-rally/blob/staging/document/i18n/ja/docusaurus-plugin-content-docs/current/developer/dev-env/localnode.md Environment variables required for the frontend application, mapping contract names to their deployed addresses on the local network. These addresses are outputted after contract deployment. ```.env NEXT_PUBLIC_FORWARDER_ADDRESS=0xa513E6E4b8f... NEXT_PUBLIC_CONTRACT_MINT_NFT_MANAGER=0x2279B7A0a... NEXT_PUBLIC_CONTRACT_EVENT_MANAGER=0x8A791620dd626... ``` -------------------------------- ### Set Private Key for Local Deployment Source: https://github.com/hackdays-io/mint-rally/blob/staging/document/docs/developer/dev-env/localnode.md Details on how to update the `.env` file within the hardhat directory with the private key obtained from the local node console, which is necessary for contract deployment. ```.env LOCAL_PRIVATE_KEY=privatekey_you_got_from_console ``` -------------------------------- ### Create Test Data for Frontend Testing Source: https://github.com/hackdays-io/mint-rally/blob/staging/document/docs/developer/dev-env/localnode.md Instructions to set the EventManager contract address in the hardhat/.env file and execute a command to generate test data, including event groups and event data, on the local node. ```.env LOCAL_CONTRACT_EVENT_MANAGER_ADDRESS=0x0165878A594ca255338adfa4d4.... ``` ```shell yarn create:testdata ``` -------------------------------- ### Create Test Data for Frontend Testing Source: https://github.com/hackdays-io/mint-rally/blob/staging/document/i18n/ja/docusaurus-plugin-content-docs/current/developer/dev-env/localnode.md Instructions to set the EventManager contract address in the hardhat/.env file and execute a command to generate test data, including event groups and event data, on the local node. ```.env LOCAL_CONTRACT_EVENT_MANAGER_ADDRESS=0x0165878A594ca255338adfa4d4.... ``` ```shell yarn create:testdata ``` -------------------------------- ### Build Zero-Knowledge Proof Circuit Source: https://github.com/hackdays-io/mint-rally/blob/staging/document/docs/developer/dev-env/contract.md Executes the circuit build script defined in the project's package.json. This command compiles the zero-knowledge proof circuits, preparing them for testing or deployment. ```shell yarn build:circuit ``` -------------------------------- ### Development Tooling Commands Source: https://github.com/hackdays-io/mint-rally/blob/staging/hardhat/README.md Commands for linting and formatting code using ESLint, Prettier, and Solhint. ```shell npx eslint '**/*.{js,ts}' npx eslint '**/*.{js,ts}' --fix npx prettier '**/*.{json,sol,md}' --check npx prettier '**/*.{json,sol,md}' --write npx solhint 'contracts/**/*.sol' npx solhint 'contracts/**/*.sol' --fix ``` -------------------------------- ### Compile and Execute Tests Source: https://github.com/hackdays-io/mint-rally/blob/staging/document/docs/developer/dev-env/contract.md Runs the project's test suite, which typically includes compilation of smart contracts and execution of associated tests. This command ensures the project's logic is functioning correctly. ```shell yarn test ``` -------------------------------- ### Build Static Website with Yarn Source: https://github.com/hackdays-io/mint-rally/blob/staging/document/README.md Generates the static production-ready files for the Mint Rally website. The output is placed in the 'build' directory, ready for hosting. ```shell $ yarn build ``` -------------------------------- ### Etherscan Contract Verification Source: https://github.com/hackdays-io/mint-rally/blob/staging/hardhat/README.md Steps and commands to verify a deployed contract on Etherscan. Requires setting up a .env file with API keys and node URLs. ```APIDOC Etherscan Verification: Purpose: Verifies deployed smart contracts on Etherscan for transparency and interaction. Prerequisites: - A deployed contract on a network supported by Etherscan (e.g., Ropsten). - A .env file with: - ETHERSCAN_API_KEY: Your Etherscan API key. - HARDHAT_NETWORK_URL: URL for your network provider (e.g., Alchemy). - PRIVATE_KEY: Private key of the account used for deployment. Steps: 1. Deploy the contract: Command: hardhat run --network Example: hardhat run --network ropsten scripts/deploy.ts 2. Verify the contract: Command: npx hardhat verify --network [constructor_arguments...] Example: npx hardhat verify --network ropsten DEPLOYED_CONTRACT_ADDRESS "Hello, Hardhat!" Parameters: --network : The network to verify on (e.g., ropsten, mainnet). : The address where the contract was deployed. [constructor_arguments...]: Any arguments required by the contract's constructor, passed as strings. Related Commands: - hardhat run: For deploying contracts. - hardhat compile: To compile contracts before deployment. Notes: - Ensure the contract source code matches the deployed bytecode exactly. - Constructor arguments must be provided in the correct order and format. ``` -------------------------------- ### Hardhat Performance Optimizations Source: https://github.com/hackdays-io/mint-rally/blob/staging/hardhat/README.md Guidance on improving the performance of Hardhat tests and scripts by optimizing TypeScript compilation. ```APIDOC TypeScript Performance Optimization: Purpose: Speeds up test and script execution by skipping TypeScript type checking during compilation. Method: Set the TS_NODE_TRANSPILE_ONLY environment variable. Configuration: Environment Variable: TS_NODE_TRANSPILE_ONLY Value: Set to '1' to enable. Usage: - For tests: REPORT_GAS=true TS_NODE_TRANSPILE_ONLY=1 npx hardhat test - For scripts: TS_NODE_TRANSPILE_ONLY=1 npx hardhat run scripts/deploy.ts Details: This optimization tells ts-node to only transpile TypeScript to JavaScript without performing type checking. This can significantly reduce execution time, especially for large projects. Caveats: - This bypasses type checking, so errors related to type mismatches might not be caught until runtime. - It's recommended to run full type checks separately (e.g., using `tsc --noEmit`) before deploying to production. ``` -------------------------------- ### Hardhat Project Tasks Source: https://github.com/hackdays-io/mint-rally/blob/staging/hardhat/README.md Common Hardhat tasks for project management, testing, and execution. These commands are run using npx hardhat. ```shell npx hardhat accounts npx hardhat compile npx hardhat clean npx hardhat test npx hardhat node npx hardhat help REPORT_GAS=true npx hardhat test npx hardhat coverage npx hardhat run scripts/deploy.ts TS_NODE_FILES=true npx ts-node scripts/deploy.ts ``` -------------------------------- ### Deploy Website with Yarn Source: https://github.com/hackdays-io/mint-rally/blob/staging/document/README.md Deploys the Mint Rally website, typically to GitHub Pages. It can be used with or without SSH, and requires specifying a Git user if not using SSH. ```shell $ USE_SSH=true yarn deploy ``` ```shell $ GIT_USER= yarn deploy ``` -------------------------------- ### Required API Keys Configuration Source: https://github.com/hackdays-io/mint-rally/blob/staging/frontend/README.md Lists the necessary environment variables that must be configured for the project to function correctly. These keys are typically set in a `.env` file or through environment variable management systems. ```APIDOC Required API Keys: - NEXT_PUBLIC_WEB3_STORAGE_KEY - Description: API key for web3.storage service. - Source: https://web3.storage/tokens/ - NEXT_PUBLIC_CONTRACT_EVENT_MANAGER - Description: Address or identifier for the deployed contract event manager. - Source: Your deployed contract. - NEXT_PUBLIC_CONTRACT_MINT_NFT_MANAGER - Description: Address or identifier for the deployed contract mint NFT manager. - Source: Your deployed contract. ``` -------------------------------- ### Upload Defender Autotask Script Source: https://github.com/hackdays-io/mint-rally/blob/staging/document/docs/developer/dev-env/deploy.md Builds the Autotask script for meta-transactions and uploads it to OpenZeppelin Defender for the staging environment. Use 'yarn upload:prd' for production deployment. ```shell // build autotask script yarn build // upload script yarn upload:stg ``` -------------------------------- ### Deploy Contract to Testnet Source: https://github.com/hackdays-io/mint-rally/blob/staging/document/docs/developer/dev-env/deploy.md Executes the contract deployment script for the staging environment using Hardhat. Navigate to the contract directory first. Use 'yarn deploy:main' for mainnet deployment. ```shell cd hardhat yarn deploy:stg ``` -------------------------------- ### Verify Deployed Contract Source: https://github.com/hackdays-io/mint-rally/blob/staging/document/docs/developer/dev-env/deploy.md Verifies the deployed smart contract on the network's block explorer for transparency and trust. Replace '
' with the actual contract address obtained after deployment. This command should be run for each contract (MintNFT, EventManager, Forwarder). ```shell yarn verify --network mumbai
``` -------------------------------- ### Configure PATH for Node.js v18 Source: https://github.com/hackdays-io/mint-rally/blob/staging/document/docs/developer/dev-env/devenv_mac.md Adds the Node.js v18 binary directory to the PATH environment variable in the .zshrc file. This makes Node.js commands accessible from the terminal. ```shell echo 'export PATH="/opt/homebrew/opt/node@18/bin:$PATH"' >> ~/.zshrc ``` -------------------------------- ### Next.js API Routes Source: https://github.com/hackdays-io/mint-rally/blob/staging/frontend/README.md Information on accessing and modifying API routes within the Next.js project. API routes are defined in the `pages/api` directory and are mapped to `/api/*` endpoints. ```javascript Access API routes on http://localhost:3000/api/hello. This endpoint can be edited in `pages/api/hello.ts`. ``` -------------------------------- ### Vercel Environment Variables for Mint Rally Source: https://github.com/hackdays-io/mint-rally/blob/staging/document/docs/developer/dev-env/deploy.md Configuration of environment variables required for the Mint Rally frontend deployment on Vercel. These variables connect the application to smart contracts, external services like Alchemy and Pinata, and define network-specific settings. ```APIDOC Environment Variables: NEXT_PUBLIC_FORWARDER_ADDRESS Description: The forwarder contract address created in step 3.1. Type: String NEXT_PUBLIC_CONTRACT_EVENT_MANAGER Description: The event manager contract address created in step 3.1. Type: String NEXT_PUBLIC_CONTRACT_MINT_NFT_MANAGER Description: The mint NFT manager contract address created in step 3.1. Type: String NEXT_PUBLIC_WEBHOOK_URL Description: The webhook URL obtained in step 1.3. Type: String NEXT_PUBLIC_PROVIDER_RPC Description: RPC endpoint URL from a provider like Alchemy for the target network. Type: String Example: https://matic-mumbai.chainstacklabs.com (Testnet) NEXT_PUBLIC_CHAIN_ID Description: The chain ID for the target network. Type: Number Values: 80001 (Testnet), 137 (Mainnet) NEXT_PUBLIC_CHAIN_NAME Description: The human-readable name of the target network. Type: String Values: "Polygon Testnet", "Polygon Mainnet" NEXT_PUBLIC_BLOCK_EXPLORER_URL Description: The base URL for the block explorer of the target network. Type: String Example: https://mumbai.polygonscan.com/ (Testnet) NEXT_PUBLIC_METAMASK_RPC_URL Description: The RPC URL specifically for MetaMask integration. Type: String Example: https://matic-mumbai.chainstacklabs.com (Testnet) NEXT_PUBLIC_PINATA_JWT Description: JSON Web Token for authenticating with Pinata services. Type: String Reference: [link](/docs/frontend.md#create-pinata-jwt) NEXT_PUBLIC_PINATA_GATEWAY Description: The base URI for the Pinata IPFS gateway. Type: String Example: gateway.pinata.cloud OZ_RELAYER_API_KEYS Description: An array of OpenZeppelin Relayer API keys. Type: Array OZ_RELAYER_API_SECRETS Description: An array of OpenZeppelin Relayer API secrets. Type: Array ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.