- NFT Marketplace
- STARTING CODEBASE!
- Table of Contents
- Getting Started
- Database Reset
- Features
- Addresses for testing
- node
- You'll know you've installed it right if you can run
node --versionand get a response likev18.0.0
- You'll know you've installed it right if you can run
- pnpm
- You'll know you've installed it right if you can run
pnpm --versionand get a response like8.0.0
- You'll know you've installed it right if you can run
- git
- You'll know you've installed it right if you can run
git --versionand get a response likegit version 2.33.0
- You'll know you've installed it right if you can run
- foundry/anvil
- You'll know you've installed it right if you can run
anvil --versionand get a response likeanvil Version: 1.0.0-stable
- You'll know you've installed it right if you can run
- docker
- You'll know you've installed it right if you can run
docker --versionand get a response likeDocker version 27.4.0, build bde2b89
- You'll know you've installed it right if you can run
- rindexer
- ou'll know you've installed it right if you can run
rindexer --versionand get a response likerindexer 0.15.2
- ou'll know you've installed it right if you can run
Create a .env.local file with the following environment variables:
NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID=your_project_id
GRAPHQL_API_URL=http://localhost:3001/graphql
ENABLE_COMPLIANCE_CHECK=false
CIRCLE_API_KEY=TEST_API_KEY
NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID: Get this from WalletConnect CloudGRAPHQL_API_URL: Points to your local indexer GraphQL endpointENABLE_COMPLIANCE_CHECK: To enable compliance checks, set this totrue. If you set this to false, you don't need theCIRCLE_API_KEYCIRCLE_API_KEY: Get this from Circle Developer Portal
git clone https://github.com/cyfrin/ts-nft-marketplace-cu
cd nft-marketplace
pnpm installAdd the following network to your metamask:
- Name: Anvil
- RPC URL: http://127.0.0.1:8545
- Chain ID: 31337
- Currency Symbol: ETH
Private Keys
==================
(0) 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80 # This one
(9) 0x2a871d0798f97d79848a013d4936a73bf4cc922c825d33c1cf7073dff6d409c6 # This one
Add private keys 0 and 9 to your Metamask, these will have NFTs already loaded when you run pnpm anvil later.
For working with a postgres DB, add a .env file to ./marketplaceIndexer/.env:
DATABASE_URL=postgresql://postgres:rindexer@localhost:5440/postgres
POSTGRES_PASSWORD=rindexer
This will work with the default commands we run below. If you wish to change your database, you may change your endpoints.
The application requires three components running in parallel:
- Local Ethereum blockchain (anvil), this will come with some blockchain state already loaded. Including contracts, tokens, and NFTs in the accounts you added to Metamask above.
- Blockchain indexer
- Next.js application
pnpm anvil
pnpm indexer
pnpm run devIn your Metamask now, select account 0 which you imported from the step above, and add the following NFT with tokenID 0:
0x9fE46736679d2D9a65F0992F2272dE9f3c7fa6e0
You should see the NFT in your metamask. Note: This will only work while pnpm anvil is running!
If you need to reset the indexer database:
pnpm run reset-indexerThis will stop the indexer, remove the volume, and restart it.
- NFT Minting: Create new NFTs with the CakeNFT contract
- NFT Listing: List your NFTs for sale on the marketplace
- NFT Buying: Purchase NFTs that others have listed
- Recently Listed NFTs: View the most recent NFTs available for purchase
- Address Compliance: Integrated with Circle's compliance API to screen addresses
- Wallet Integration: Connect with MetaMask, Rainbow, and other wallets via WalletConnect
- usdc: "0x5FbDB2315678afecb367f032d93F642f64180aa3"
- nftMarketplace: "0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512"
- cakeNft: "0x9fE46736679d2D9a65F0992F2272dE9f3c7fa6e0"
- moodNft: "0xCf7Ed3AccA5a467e9e704C703E8D87F634fB0Fc9"