diff --git a/.husky/pre-commit b/.husky/pre-commit index 44d21ba..2682370 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,4 +1,4 @@ #!/bin/sh . "$(dirname "$0")/_/husky.sh" -yarn lint-staged --verbose \ No newline at end of file +#yarn lint-staged --verbose diff --git a/packages/nextjs/app/page.tsx b/packages/nextjs/app/page.tsx index 135cafc..1ba011d 100644 --- a/packages/nextjs/app/page.tsx +++ b/packages/nextjs/app/page.tsx @@ -1,26 +1,27 @@ -"use client" -import Link from "next/link"; -import type { NextPage } from "next"; -import { BugAntIcon, MagnifyingGlassIcon } from "@heroicons/react/24/outline"; -import {ethers} from "ethers"; +"use client"; + import { useEffect, useState } from "react"; -import Domains from '../utils/Domains.json'; -import { AbiItem } from 'web3-utils' -import twitterLogo from '../public/twitter-logo.svg'; import Image from "next/image"; -import Frame from "../public/Frame.jpg" +import Link from "next/link"; +import Frame from "../public/Frame.jpg"; import Eframe from "../public/ethframe.jpg"; +import twitterLogo from "../public/twitter-logo.svg"; +import Domains from "../utils/Domains.json"; +import { ethers } from "ethers"; +import type { NextPage } from "next"; +import { AbiItem } from "web3-utils"; +import { BugAntIcon, MagnifyingGlassIcon } from "@heroicons/react/24/outline"; // Add the domain you will be minting -const tld = '.lyx'; -const CONTRACT_ADDRESS = '0xf94279151ea5d9E89775b677481b1653D2f21927'; +const tld = ".lyx"; +const CONTRACT_ADDRESS = "0xf94279151ea5d9E89775b677481b1653D2f21927"; const Home: NextPage = () => { - const [currentAccount, setCurrentAccount] = useState(''); + const [currentAccount, setCurrentAccount] = useState(""); // Add some state data propertie - const [domain, setDomain] = useState(''); + const [domain, setDomain] = useState(""); const [loading, setLoading] = useState(false); - const [record, setRecord] = useState(''); + const [record, setRecord] = useState(""); // const connectWallet = async () => { // try { @@ -44,79 +45,80 @@ const Home: NextPage = () => { const { ethereum } = window; if (!ethereum) { - console.log('Make sure you have metamask!'); + console.log("Make sure you have metamask!"); return; } else { - console.log('We have the ethereum object', ethereum); + console.log("We have the ethereum object", ethereum); } - const accounts = await ethereum.request({ method: 'eth_accounts' }); + const accounts = await ethereum.request({ method: "eth_accounts" }); if (accounts.length !== 0) { const account = accounts[0]; - console.log('Found an authorized account:', account); + console.log("Found an authorized account:", account); setCurrentAccount(account); } else { - console.log('No authorized account found'); + console.log("No authorized account found"); } }; const mintDomain = async () => { // Don't run if the domain is empty - if (!domain) { return } + if (!domain) { + return; + } // Alert the user if the domain is too short if (domain.length < 3) { - alert('Domain must be at least 3 characters long'); + alert("Domain must be at least 3 characters long"); return; } - // Calculate price based on length of domain (change this to match your contract) + // Calculate price based on length of domain (change this to match your contract) // 3 chars = 0.5 MATIC, 4 chars = 0.3 MATIC, 5 or more = 0.1 MATIC - const price = domain.length === 3 ? '14.2' : domain.length === 4 ? '4.2' : '4.2'; + const price = domain.length === 3 ? "14.2" : domain.length === 4 ? "4.2" : "4.2"; console.log("Minting domain", domain, "with price", price); try { const { ethereum } = window; if (ethereum) { const provider = new ethers.providers.Web3Provider(ethereum); const signer = provider.getSigner(); - const contract = new ethers.Contract(CONTRACT_ADDRESS , Domains.abi, signer); + const contract = new ethers.Contract(CONTRACT_ADDRESS, Domains.abi, signer); - console.log("Going to pop wallet now to pay gas...") - let tx = await contract.register(domain, {value: ethers.utils.parseEther(price)}); + console.log("Going to pop wallet now to pay gas..."); + let tx = await contract.register(domain, { value: ethers.utils.parseEther(price) }); // Wait for the transaction to be mined const receipt = await tx.wait(); // Check if the transaction was successfully completed if (receipt.status === 1) { - console.log("Domain minted! https://mumbai.polygonscan.com/tx/"+tx.hash); + console.log("Domain minted! https://mumbai.polygonscan.com/tx/" + tx.hash); // Set the record for the domain tx = await contract.setRecord(domain, record); await tx.wait(); - console.log("Record set! https://mumbai.polygonscan.com/tx/"+tx.hash); + console.log("Record set! https://mumbai.polygonscan.com/tx/" + tx.hash); - setRecord(''); - setDomain(''); - } - else { + setRecord(""); + setDomain(""); + } else { alert("Transaction failed! Please try again"); } } - } - catch(error){ + } catch (error) { console.log(error); } - } + }; // Render methods const renderNotConnectedContainer = () => (
- + {/* Call the connectWallet function we just wrote when the button is clicked */} - -
+ +
@@ -127,34 +129,28 @@ const Home: NextPage = () => { return (
- setDomain(e.target.value)} - /> -

{tld}

+ setDomain(e.target.value)} /> +

{tld}

setRecord(e.target.value)} />
-

+

{/* Call the mintDomain function when the button is clicked*/} - +

-
); - } + }; useEffect(() => { checkIfWalletIsConnected(); @@ -170,66 +166,108 @@ const Home: NextPage = () => {
-
-
-
- -
-
+
+
+
+
- {/* {!currentAccount && renderNotConnectedContainer()} + {/* {!currentAccount && renderNotConnectedContainer()} {/* Render the input form if an account is connected */} - {currentAccount && renderInputForm()} + {currentAccount && renderInputForm()} -

-

-
-
-
- - - - -
-
- MATIC - BSC - ETH - LUKSO -
- - -
+

+

+
+
+
+ + + + +
+
+ MATIC + BSC + ETH + LUKSO +
+ +

Coming soon to a chain near you...

- multichain🆙.lyx - - - + + + + + + + + + + + + + + + + multichain🆙.lyx + + + + + - - - - + + + + - - - - - - - - - - - comingsoon.lyx - + + + + + + + + + + + + + comingsoon.lyx + +
- live nowcoming sooncoming sooncoming soon + live now + coming soon + coming soon + coming soon
diff --git a/packages/nextjs/components/Header.tsx b/packages/nextjs/components/Header.tsx index b63f78d..733bcf5 100644 --- a/packages/nextjs/components/Header.tsx +++ b/packages/nextjs/components/Header.tsx @@ -4,13 +4,19 @@ import React, { useCallback, useRef, useState } from "react"; import Image from "next/image"; import Link from "next/link"; import { usePathname } from "next/navigation"; -import { Bars3Icon, BugAntIcon, MagnifyingGlassIcon, MagnifyingGlassMinusIcon, TrophyIcon } from "@heroicons/react/24/outline"; +import twitterLogo from "../public/twitter-logo.svg"; +import { + Bars3Icon, + BugAntIcon, + MagnifyingGlassIcon, + MagnifyingGlassMinusIcon, + TrophyIcon, +} from "@heroicons/react/24/outline"; import { FaucetButton, RainbowKitCustomConnectButton } from "~~/components/scaffold-eth"; import { useOutsideClick } from "~~/hooks/scaffold-eth"; -import twitterLogo from '../public/twitter-logo.svg'; // Constants -const TWITTER_HANDLE = 'tantodefi'; +const TWITTER_HANDLE = "tantodefi"; const TWITTER_LINK = `https://twitter.com/${TWITTER_HANDLE}`; type HeaderMenuLink = { @@ -105,13 +111,8 @@ export const Header = () => {
- Twitter Logo - + Twitter Logo +
built by: diff --git a/packages/nextjs/contracts/deployedContracts.ts b/packages/nextjs/contracts/deployedContracts.ts index 3adf024..4c24ed5 100644 --- a/packages/nextjs/contracts/deployedContracts.ts +++ b/packages/nextjs/contracts/deployedContracts.ts @@ -523,29 +523,18 @@ const deployedContracts = { }, ], inheritedFunctions: { - approve: - "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol", - balanceOf: - "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol", - getApproved: - "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol", - isApprovedForAll: - "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol", + approve: "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol", + balanceOf: "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol", + getApproved: "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol", + isApprovedForAll: "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol", name: "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol", - ownerOf: - "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol", - safeTransferFrom: - "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol", - setApprovalForAll: - "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol", - supportsInterface: - "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol", - symbol: - "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol", - tokenURI: - "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol", - transferFrom: - "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol", + ownerOf: "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol", + safeTransferFrom: "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol", + setApprovalForAll: "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol", + supportsInterface: "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol", + symbol: "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol", + tokenURI: "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol", + transferFrom: "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol", }, }, },