forked from Scaffold-Stark/scaffold-stark-2
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4046b77
commit d939b43
Showing
19 changed files
with
3,007 additions
and
2,316 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
compressionLevel: mixed | ||
|
||
enableColors: true | ||
|
||
enableGlobalCache: false | ||
|
||
nmHoistingLimits: workspaces | ||
|
||
nodeLinker: node-modules | ||
|
||
plugins: | ||
- path: .yarn/plugins/@yarnpkg/plugin-typescript.cjs | ||
spec: "@yarnpkg/plugin-typescript" | ||
|
||
yarnPath: .yarn/releases/yarn-3.2.3.cjs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
"use client"; | ||
|
||
import { lazy, useEffect, useState } from "react"; | ||
import type { NextPage } from "next"; | ||
import { notification } from "~~/utils/scaffold-stark/notification"; | ||
// import { getMetadataFromIPFS } from "~~/utils/simpleNFT/ipfs-fetch"; | ||
|
||
const LazyReactJson = lazy(() => import("react-json-view")); | ||
|
||
const IpfsDownload: NextPage = () => { | ||
const [yourJSON, setYourJSON] = useState({}); | ||
const [ipfsPath, setIpfsPath] = useState(""); | ||
const [loading, setLoading] = useState(false); | ||
const [mounted, setMounted] = useState(false); | ||
useEffect(() => { | ||
setMounted(true); | ||
}, []); | ||
|
||
// const handleIpfsDownload = async () => { | ||
// setLoading(true); | ||
// const notificationId = notification.loading("Getting data from IPFS"); | ||
// try { | ||
// const metaData = await getMetadataFromIPFS(ipfsPath); | ||
// notification.remove(notificationId); | ||
// notification.success("Downloaded from IPFS"); | ||
|
||
// setYourJSON(metaData); | ||
// } catch (error) { | ||
// notification.remove(notificationId); | ||
// notification.error("Error downloading from IPFS"); | ||
// console.log(error); | ||
// } finally { | ||
// setLoading(false); | ||
// } | ||
// }; | ||
|
||
return ( | ||
<> | ||
<div className="flex items-center flex-col flex-grow pt-10"> | ||
<h1 className="text-center mb-4"> | ||
<span className="block text-4xl font-bold">Download from IPFS</span> | ||
</h1> | ||
<div className={`flex border-2 border-accent/95 bg-base-200 rounded-full text-accent w-96`}> | ||
<input | ||
className="input input-ghost focus:outline-none focus:bg-transparent focus:text-secondary-content h-[2.2rem] min-h-[2.2rem] px-4 border w-full font-medium placeholder:text-accent/50 text-secondary-content/75" | ||
placeholder="IPFS CID" | ||
value={ipfsPath} | ||
onChange={e => setIpfsPath(e.target.value)} | ||
autoComplete="off" | ||
/> | ||
</div> | ||
<button | ||
className={`btn btn-secondary my-6 ${loading ? "loading" : ""}`} | ||
disabled={loading} | ||
// onClick={handleIpfsDownload} | ||
> | ||
Download from IPFS | ||
</button> | ||
|
||
{mounted && ( | ||
<LazyReactJson | ||
style={{ padding: "1rem", borderRadius: "0.75rem" }} | ||
src={yourJSON} | ||
theme="solarized" | ||
enableClipboard={false} | ||
onEdit={edit => { | ||
setYourJSON(edit.updated_src); | ||
}} | ||
onAdd={add => { | ||
setYourJSON(add.updated_src); | ||
}} | ||
onDelete={del => { | ||
setYourJSON(del.updated_src); | ||
}} | ||
/> | ||
)} | ||
</div> | ||
</> | ||
); | ||
}; | ||
|
||
export default IpfsDownload; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
"use client"; | ||
|
||
import { lazy, useEffect, useState } from "react"; | ||
import type { NextPage } from "next"; | ||
import { notification } from "~~/utils/scaffold-stark/notification"; | ||
// import { addToIPFS } from "~~/utils/simpleNFT/ipfs-fetch"; | ||
import nftsMetadata from "~~/utils/scaffold-stark/simpleNFT/nftsMetadata"; | ||
|
||
const LazyReactJson = lazy(() => import("react-json-view")); | ||
|
||
const IpfsUpload: NextPage = () => { | ||
const [yourJSON, setYourJSON] = useState<object>(nftsMetadata[0]); | ||
const [loading, setLoading] = useState(false); | ||
const [uploadedIpfsPath, setUploadedIpfsPath] = useState(""); | ||
const [mounted, setMounted] = useState(false); | ||
useEffect(() => { | ||
setMounted(true); | ||
}, []); | ||
|
||
// const handleIpfsUpload = async () => { | ||
// setLoading(true); | ||
// const notificationId = notification.loading("Uploading to IPFS..."); | ||
// try { | ||
// const uploadedItem = await addToIPFS(yourJSON); | ||
// notification.remove(notificationId); | ||
// notification.success("Uploaded to IPFS"); | ||
|
||
// setUploadedIpfsPath(uploadedItem.path); | ||
// } catch (error) { | ||
// notification.remove(notificationId); | ||
// notification.error("Error uploading to IPFS"); | ||
// console.log(error); | ||
// } finally { | ||
// setLoading(false); | ||
// } | ||
// }; | ||
|
||
return ( | ||
<> | ||
<div className="flex items-center flex-col flex-grow pt-10"> | ||
<h1 className="text-center mb-4"> | ||
<span className="block text-4xl font-bold">Upload to IPFS</span> | ||
</h1> | ||
|
||
{mounted && ( | ||
<LazyReactJson | ||
style={{ padding: "1rem", borderRadius: "0.75rem" }} | ||
src={yourJSON} | ||
theme="solarized" | ||
enableClipboard={false} | ||
onEdit={edit => { | ||
setYourJSON(edit.updated_src); | ||
}} | ||
onAdd={add => { | ||
setYourJSON(add.updated_src); | ||
}} | ||
onDelete={del => { | ||
setYourJSON(del.updated_src); | ||
}} | ||
/> | ||
)} | ||
<button | ||
className={`btn btn-secondary mt-4 ${loading ? "loading" : ""}`} | ||
disabled={loading} | ||
// onClick={handleIpfsUpload} | ||
> | ||
Upload to IPFS | ||
</button> | ||
{/* {uploadedIpfsPath && ( | ||
<div className="mt-4"> | ||
<a href={`https://ipfs.io/ipfs/${uploadedIpfsPath}`} target="_blank" rel="noreferrer"> | ||
{`https://ipfs.io/ipfs/${uploadedIpfsPath}`} | ||
</a> | ||
</div> | ||
)} */} | ||
</div> | ||
</> | ||
); | ||
}; | ||
|
||
export default IpfsUpload; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import ButtonStyle from "~~/components/ButtonStyle/ButtonStyle" | ||
import { MyHoldings } from "~~/components/SimpleNFT/MyHoldings" | ||
|
||
function Page() { | ||
return ( | ||
<main className="flex flex-col flex-1"> | ||
<div className="flex flex-col items-center p-10"> | ||
<h1>My NFTs</h1> | ||
<ButtonStyle>Mint NFT</ButtonStyle> | ||
<MyHoldings></MyHoldings> | ||
</div> | ||
</main> | ||
) | ||
} | ||
|
||
export default Page |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
"use client"; | ||
|
||
import type { NextPage } from "next"; | ||
import { Address } from "~~/components/scaffold-stark"; | ||
// import { useScaffoldEventHistory } from "~~/hooks/scaffold-stark"; | ||
|
||
const Transfers: NextPage = () => { | ||
// const { data: transferEvents, isLoading } = useScaffoldEventHistory({ | ||
// contractName: "YourCollectible", | ||
// eventName: "Transfer", | ||
// // Specify the starting block number from which to read events, this is a bigint. | ||
// fromBlock: 0n, | ||
// }); | ||
|
||
// if (isLoading) | ||
// return ( | ||
// <div className="flex justify-center items-center mt-10"> | ||
// <span className="loading loading-spinner loading-xl"></span> | ||
// </div> | ||
// ); | ||
|
||
const transferEvents=[ | ||
{ | ||
address:"0x7f982E4f614167DfC7950fdA06e920b9E2514748", | ||
} | ||
] | ||
|
||
return ( | ||
<> | ||
<div className="flex items-center flex-col flex-grow pt-10"> | ||
<div className="px-5"> | ||
<h1 className="text-center mb-8"> | ||
<span className="block text-4xl font-bold">All Transfers Events</span> | ||
</h1> | ||
</div> | ||
<div className="overflow-x-auto shadow-lg"> | ||
<table className="table table-zebra w-full"> | ||
<thead> | ||
<tr> | ||
<th className="bg-primary">Token Id</th> | ||
<th className="bg-primary">From</th> | ||
<th className="bg-primary">To</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{!transferEvents || transferEvents.length === 0 ? ( | ||
<tr> | ||
<td colSpan={3} className="text-center"> | ||
No events found | ||
</td> | ||
</tr> | ||
) : ( | ||
transferEvents?.map((event, index) => { | ||
return ( | ||
<tr key={index}> | ||
{/* <th className="text-center">{event.args.tokenId?.toString()}</th> */} | ||
<td> | ||
{/* <Address address={event.args.from} /> */} | ||
</td> | ||
<td> | ||
{/* <Address address={event.args.to} /> */} | ||
</td> | ||
</tr> | ||
); | ||
}) | ||
)} | ||
</tbody> | ||
</table> | ||
</div> | ||
</div> | ||
</> | ||
); | ||
}; | ||
|
||
export default Transfers; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
.base_button__small { | ||
padding-block: 14px; | ||
padding-inline: 24px; | ||
border-radius: 7px; | ||
} | ||
|
||
.base_button__large { | ||
width: 490px; | ||
padding: 16px 33px; | ||
border: none; | ||
border-radius: 8px; | ||
} |
Oops, something went wrong.