From 4c1ca3f9d1a0b051db11b89c174ea0c9b26217d5 Mon Sep 17 00:00:00 2001 From: "Shankar D. Warang" Date: Tue, 21 Nov 2023 18:44:50 +0530 Subject: [PATCH] Delete pages/rough.tsx --- pages/rough.tsx | 194 ------------------------------------------------ 1 file changed, 194 deletions(-) delete mode 100644 pages/rough.tsx diff --git a/pages/rough.tsx b/pages/rough.tsx deleted file mode 100644 index b9caa00..0000000 --- a/pages/rough.tsx +++ /dev/null @@ -1,194 +0,0 @@ - // generate a function that returns an object containing nft_url and nft name - const generate = (wallet: string, addresses: string[]): {name: string, img: string}[] => { - - let nfts: {name: string, img: string}[] = []; - - console.log(addresses, "inside function:"); - - for(let address in addresses){ - const { contract } = useContract(addresses[address]); - const { data, isLoading, error } = useOwnedNFTs(contract, wallet); - let nft = {name: "", img: ""}; - const metadata = data?.[0].metadata; - nft.img = metadata?.animation_url; - useEffect(() => { - setLoader(isLoading); - setError(error); - },[]) - nft.name = metadata?.name.toString().split(": ")[1]; - nfts.push(nft); - } - return nfts; - }; - - const nfts = generate(wallet, addresses); - console.log(nfts) - - - -import { Listbox } from '@headlessui/react'; -import { useState, Fragment, useEffect } from 'react'; -import { useOwnedNFTs, useContract, useAddress, MediaRenderer, useMetamask, useDisconnect } from '@thirdweb-dev/react'; -import IconArrow from 'remixicon/icons/Arrows/arrow-down-s-line.svg'; - -const NFTsSeries = [ - { - index: 1, - type: 'NFTDrop Series', - addresses: [ - "0x6B7508b491b907B2C6d86737516F3786Ddc75063", - "0x9DD893814e0934C038EeD71eD0591DB201674747", - "0x4d08e6e1c7607906Cd87Ef189a39aF7A68f677A3", - "0x405355C2613B516812eA4d2159Ca8798AEdb97D5" - ], - }, - { - index: 2, - type: 'GiftDrop Series', - addresses: ["0xcBD6701C3313aC76c529468957Fc2137484A4A51"], - }, -]; - -const maxIndex = Math.max(...NFTsSeries.map((m) => m.index)); - -export default function NftPage() { - const [activeIndex, setActiveIndex] = useState(maxIndex); - const [loader, setLoader] = useState(true); - const [error, setError] = useState(); - const selectedEdition = NFTsSeries.find((m) => m.index === activeIndex); - const dropdownOptions = NFTsSeries.map((m) => m.type); - - console.log(selectedEdition); - - const addresses = selectedEdition.addresses; - console.log(addresses); - - - const wallet = useAddress(); - - - const disconnectWallet = useDisconnect(); - const connectWallet = useMetamask(); - - return ( - <> -
-
- {nfts.map((nft, index) => ( - - {!loader &&
- -
} - {console.log(nft.img)} -

{nft.name}

-
*/} - {/* )) - } -
-
- - ); -} - -export async function getStaticProps() { - return { - props: { - meta: { - title: 'NFT Page', - description: - 'View your NFTs here.', - }, - }, - }; -} - -import { Listbox } from "@headlessui/react"; -import { useState, Fragment, useEffect } from 'react'; -import { useDisconnect, useMetamask } from "@thirdweb-dev/react"; -import IconArrow from 'remixicon/icons/Arrows/arrow-down-s-line.svg'; - - -const NFTsSeries = [ - { - index: 1, - type: 'NFTDrop Series', - addresses: [ - "0x6B7508b491b907B2C6d86737516F3786Ddc75063", - "0x9DD893814e0934C038EeD71eD0591DB201674747", - "0x4d08e6e1c7607906Cd87Ef189a39aF7A68f677A3", - "0x405355C2613B516812eA4d2159Ca8798AEdb97D5" - ], - }, - { - index: 2, - type: 'GiftDrop Series', - addresses: ["0xcBD6701C3313aC76c529468957Fc2137484A4A51"], - }, -]; - -const maxIndex = Math.max(...NFTsSeries.map((m) => m.index)); - -export default function NFTsPage() { - - const [activeIndex, setActiveIndex] = useState(maxIndex); - const selectedEdition = NFTsSeries.find((m) => m.index === activeIndex); - const dropdownOptions = NFTsSeries.map((m) => m.type); - const disconnectWallet = useDisconnect(); - const connectWallet = useMetamask(); - - return ( - <> -
-

Minted NFTs

-

- Connect wallet to view minted NFTs: -

- - -
-
-
- - - {selectedEdition?.type} - - - - {dropdownOptions.map((type, index) => ( - - {({ active }) => (active ? {type} : {type})} - - ))} - - -
-
- - ) -} - -const NFTsContractAddress = [ - { - index: 1, - type: "NFT Drop Series", - address: "0x6B7508b491b907B2C6d86737516F3786Ddc75063", - }, - { - index: 2, - type: "GiftDrop Series", - address: "0xcBD6701C3313aC76c529468957Fc2137484A4A51", - }, -]; - - useEffect(() => { - const getContractMetadata = (addresses: string[]) => { - for(let index in addresses){ - console.log(addresses[index]); - } - }; - getContractMetadata(contractAddresses); - },[]);