Welcome to Fartifacts NFT Collection

Your exclusive access to limited-edition NFTs and Web3 experiences.

About Fartifacts

Fartifacts is a revolutionary Web3 NFT collection that merges digital art, blockchain, and fun!

Our Collection

Explore our limited edition NFTs.

Mint Your Fartifacts NFT

Mint your exclusive NFT from the Fartifacts collection. Don’t miss out!

Join Our Community

Connect with other collectors and NFT enthusiasts on our social channels.

Your NFT Collection

// Function to connect wallet (MetaMask) async function connectWallet() { const provider = await detectEthereumProvider(); if (provider) { const web3 = new Web3(provider); await provider.request({ method: 'eth_requestAccounts' }); console.log("Wallet connected"); document.getElementById('wallet-connect').innerText = 'Connected'; } else { alert("Please install MetaMask to continue."); } } // Function to mint NFT (example with dummy data) async function mintNFT() { if (typeof window.ethereum !== 'undefined') { const web3 = new Web3(window.ethereum); const accounts = await web3.eth.getAccounts(); const userAddress = accounts[0]; // Example contract interaction - Replace with your contract address and method const contract = new web3.eth.Contract( contractABI, // Add the actual ABI here 'YOUR_CONTRACT_ADDRESS' ); try { const mintResponse = await contract.methods.mint(userAddress, 1).send({ from: userAddress, value: web3.utils.toWei('0.1', 'ether') // Example value to pay for mint }); alert("NFT Minted Successfully!"); console.log(mintResponse); } catch (error) { console.error(error); alert("Error minting NFT"); } } } // Dynamically load NFTs from an API or a JSON file const nftGallery = document.getElementById('nft-gallery'); // Dummy Data: Replace with real data or API calls const nftData = [ { id: 1, imageUrl: 'images/nft1.png', name: 'Fartifact #1' }, { id: 2, imageUrl: 'images/nft2.png', name: 'Fartifact #2' }, { id: 3, imageUrl: 'images/nft3.png', name: 'Fartifact #3' }, ]; nftData.forEach(item => { const nftItem = document.createElement('div'); nftItem.classList.add('nft-item'); nftItem.innerHTML = `${item.name}

${item.name}

`; nftGallery.appendChild(nftItem); }); // Function to switch network (Ethereum to Polygon) async function switchNetwork() { const network = document.getElementById("network").value; const chainId = network === 'polygon' ? '0x89' : '0x1'; // Polygon or Ethereum Mainnet try { await window.ethereum.request({ method: 'wallet_switchEthereumChain', params: [{ chainId }] }); } catch (error) { console.error('Failed to switch network:', error); } } // Function to show notifications function showNotification(message) { const notificationElement = document.getElementById("notification"); notificationElement.innerHTML = message; notificationElement.classList.add("show"); setTimeout(() => { notificationElement.classList.remove("show"); }, 5000); } } }); } // Function to load user's collection (use actual data from your backend or contract) async function loadUserCollection(address) { const response = await fetch(`http://localhost:3000/user/${address}/nfts`); const data = await response.json(); const collectionElement = document.getElementById("userCollection"); collectionElement.innerHTML = data.map(nft => `
${nft.name}

${nft.name}

`).join(''); } // Function to switch between Ethereum and Polygon networks async function switchNetwork() { const network = document.getElementById("network").value; const chainId = network === 'polygon' ? '0x89' : '0x1'; // Polygon or Ethereum Mainnet try { await window.ethereum.request({ method: 'wallet_switchEthereumChain', params: [{ chainId }] }); } catch (error) { console.error('Failed to switch network:', error); alert('Network switch failed. Please try again.'); } } // Dynamically load NFTs from an API or a JSON file const nftGallery = document.getElementById('nft-gallery'); // Example data for NFT items (replace with dynamic data) const nftData = [ { id: 1, imageUrl: 'images/nft1.png', name: 'Fartifact #1' }, { id: 2, imageUrl: 'images/nft2.png', name: 'Fartifact #2' }, { id: 3, imageUrl: 'images/nft3.png', name: 'Fartifact #3' } ]; nftData.forEach(item => { const nftItem = document.createElement('div'); nftItem.classList.add('nft-item'); nftItem.innerHTML = `${item.name}

${item.name}

`; nftGallery.appendChild(nftItem); }); // Notification function to show success/error messages function showNotification(message) { const notificationElement = document.getElementById("notification"); notificationElement.innerHTML = message; notificationElement.classList.add("show"); setTimeout(() => { notificationElement.classList.remove("show"); }, 5000); } // Call this function when an NFT is minted successfully or when a network switch occurs async function mintNFT() { const userAddress = await getUserAddress(); const mintAmount = 1; // Define how many NFTs user wants to mint if (!userAddress) { alert('Please connect your wallet!'); return; } try { // Show transaction notification showNotification("Processing your minting request..."); const response = await fetch('http://localhost:3000/mint', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ userAddress, amount: mintAmount }) }); const result = await response.json(); if (response.status === 200) { showNotification("Minting successful! Check your wallet."); } else { showNotification(result.error || 'Minting failed. Try again later.'); } } catch (error) { console.error(error); showNotification('Minting failed. Please try again later.'); } } // Function to update milestones based on the number of minted NFTs function updateMilestones(mintedCount) { const milestones = [100, 250, 500, 1000]; const milestoneElement = document.getElementById('milestones'); milestones.forEach(milestone => { if (mintedCount >= milestone) { milestoneElement.innerHTML = `Congratulations! You've reached ${milestone} NFTs minted!`; } }); }

Your Profile

Name: John Doe

Email: johndoe@example.com

Your NFTs

async function loadUserProfile(userAddress) { const response = await fetch(`http://localhost:3000/user/${userAddress}/profile`); const data = await response.json(); document.getElementById("userName").innerText = data.name; document.getElementById("userEmail").innerText = data.email; const userNFTCollection = document.getElementById("userNFTCollection"); userNFTCollection.innerHTML = data.nfts.map(nft => `
${nft.name}

${nft.name}

`).join(''); }

Marketplace

async function loadMarketplaceItems() { const response = await fetch('http://localhost:3000/marketplace'); const items = await response.json(); const marketplaceItemsElement = document.getElementById('marketplaceItems'); marketplaceItemsElement.innerHTML = items.map(item => `
${item.name}

${item.name}

Price: ${item.price} ETH

`).join(''); } async function buyNFT(nftId) { const userAddress = await getUserAddress(); if (!userAddress) { alert('Please connect your wallet!'); return; } try { const response = await fetch(`http://localhost:3000/buy/${nftId}`, { method: 'POST', headers: { 'Content-Type': 'application/json', }, body: JSON.stringify({ userAddress }) }); const result = await response.json(); if (response.status === 200) { showNotification("Purchase successful! Check your wallet."); } else { showNotification(result.error || 'Purchase failed.'); } } catch (error) { console.error(error); showNotification('Purchase failed. Please try again later.'); } }
document.getElementById("priceFilter").addEventListener('change', async (event) => { const filterValue = event.target.value; const response = await fetch(`http://localhost:3000/marketplace?filter=${filterValue}`); const items = await response.json(); displayMarketplaceItems(items); }); function displayMarketplaceItems(items) { const marketplaceItemsElement = document.getElementById('marketplaceItems'); marketplaceItemsElement.innerHTML = items.map(item => `
${item.name}

${item.name}

Price: ${item.price} ETH

`).join(''); }

Your Milestones

You have minted 0 NFTs. Keep going to earn rewards!

async function updateMilestones(userAddress) { const response = await fetch(`http://localhost:3000/user/${userAddress}/milestones`); const data = await response.json(); document.getElementById('mintedCount').innerText = data.mintedCount; if (data.mintedCount >= 100) { document.getElementById('milestones').innerHTML += '

Congratulations on minting 100 NFTs! You have unlocked a special reward!

'; } } app.post('/mint', (req, res) => { // Handle minting logic, verify user, interact with blockchain res.json({ success: true }); }); app.get('/marketplace', (req, res) => { // Fetch marketplace listings res.json(getMarketplaceItems()); }); app.post('/buy/:nftId', (req, res) => { // Handle purchase transaction res.json({ success: true }); }); app.get('/user/:address/milestones', (req, res) => { // Fetch user's milestones res.json(getUserMilestones(req.params.address)); });

Active Auctions

async function loadAuctionItems() { const response = await fetch('http://localhost:3000/auctions'); const auctionItems = await response.json(); const auctionItemsElement = document.getElementById('auctionItems'); auctionItemsElement.innerHTML = auctionItems.map(item => `
${item.name}

${item.name}

Current Bid: ${item.currentBid} ETH

`).join(''); } async function placeBid(nftId, currentBid) { const userAddress = await getUserAddress(); if (!userAddress) { alert('Please connect your wallet!'); return; } const bidAmount = prompt(`Current bid: ${currentBid} ETH. Enter your bid amount:`); if (parseFloat(bidAmount) <= currentBid) { alert('Your bid must be higher than the current bid.'); return; } try { const response = await fetch(`http://localhost:3000/auction/bid/${nftId}`, { method: 'POST', headers: { 'Content-Type': 'application/json', }, body: JSON.stringify({ userAddress, bidAmount }) }); const result = await response.json(); if (response.status === 200) { showNotification(`Bid placed successfully! Current bid is now ${bidAmount} ETH.`); } else { showNotification(result.error || 'Bid failed.'); } } catch (error) { console.error(error); showNotification('Bid failed. Please try again later.'); } }

${nft.name}

Creator's Royalty: ${nft.royaltyPercentage}%

Price: ${nft.price} ETH

// Royalty function in a smart contract mapping(uint256 => address) private nftCreators; mapping(uint256 => uint256) private nftRoyalties; function setRoyalty(uint256 tokenId, address creator, uint256 royaltyPercentage) public { nftCreators[tokenId] = creator; nftRoyalties[tokenId] = royaltyPercentage; } function transferNFT(address buyer, uint256 tokenId, uint256 salePrice) public { address creator = nftCreators[tokenId]; uint256 royaltyAmount = (salePrice * nftRoyalties[tokenId]) / 100; payable(creator).transfer(royaltyAmount); } async function loadCreatorRoyalties(creatorAddress) { const response = await fetch(`http://localhost:3000/creator/${creatorAddress}/earnings`); const data = await response.json(); document.getElementById('creatorEarnings').innerText = `Total Earnings: ${data.totalEarnings} ETH`; }

Customize Your NFT

document.getElementById('nftForm').addEventListener('submit', async (event) => { event.preventDefault(); const color = document.getElementById('color').value; const size = document.getElementById('size').value; try { const response = await fetch('http://localhost:3000/mint-custom', { method: 'POST', headers: { 'Content-Type': 'application/json', }, body: JSON.stringify({ color, size }) }); const result = await response.json(); if (response.status === 200) { alert('NFT minted successfully!'); } else { alert(result.error || 'Minting failed.'); } } catch (error) { console.error(error); alert('Minting failed. Please try again later.'); } });

Follow Creators

async function followCreator(creatorAddress) { const userAddress = await getUserAddress(); if (!userAddress) { alert('Please connect your wallet!'); return; } const response = await fetch(`http://localhost:3000/follow/${creatorAddress}`, { method: 'POST', headers: { 'Content-Type': 'application/json', }, body: JSON.stringify({ userAddress }) }); if (response.status === 200) { alert('You are now following this creator!'); } else { alert('Failed to follow. Please try again later.'); } } async function unfollowCreator(creatorAddress) { const userAddress = await getUserAddress(); if (!userAddress) { alert('Please connect your wallet!'); return; } const response = await fetch(`http://localhost:3000/unfollow/${creatorAddress}`, { method: 'POST', headers: { 'Content-Type': 'application/json', }, body: JSON.stringify({ userAddress }) }); if (response.status === 200) { alert('You have unfollowed this creator!'); } else { alert('Failed to unfollow. Please try again later.'); } }
function changeLanguage(event) { const selectedLanguage = event.target.value; // Load translations based on the selected language loadTranslations(selectedLanguage); } async function loadTranslations(language) { const response = await fetch(`/translations/${language}.json`); const translations = await response.json(); document.getElementById('marketplace').innerText = translations.marketplace; document.getElementById('auctionPage').innerText = translations.auctionPage; // Apply translations to other sections }