NFT Collection Sales Display Component
The NFT Collection Sales Display component displays the latest sales information for a given NFT collection that occurred through OpenSea’s Seaport.
The NFT Collection Sales Display component displays the latest sales information for a given NFT collection that occurred through OpenSea’s Seaport.
Implementation:
Step 1: Create the Component File
- In your
create-web3-dapp
frontend>components
folder, create a new file namednftCollectionSalesDisplay.jsx
. - Copy the code from the NFT Collection Sales Display Component Preview Component's Code Tab and paste it inside the
nftCollectionSalesDisplay.jsx
file.
Step 2: Implement the getNftCollectionSale
API
getNftCollectionSale
API- In your
create-web3-dapp
frontend>pages>api
folder, create a new file namedgetNftCollectionSale.js
.
Copy the code from the NFT Collection Sales Display Component Preview Component's API Tab and paste it inside thegetNftCollectionSale.js
file.
Step 3: Add the Styles
- In your
create-web3-dapp
frontend>styles
folder, create a new file namedNftCollectionSalesDisplay.module.css
. - Copy the code from the NFT Collection Sales Display Component Preview Component's Styles Tab and paste it inside the
NftCollectionSalesDisplay.module.css
file.
Step 4: Include the Component
-
Navigate to the page, in your
frontend>pages
folder, where you want to implement the NFT Collection Sales Display Component. -
Import the component by adding the following line of code at the top:
import NftCollectionSalesDisplay from "./components/nftCollectionSalesDisplay.jsx";
- Add the component to the
return
statement of your NextJS page function and pass in the props as parameters:
import NftCollectionSalesDisplay from "../components/nftCollectionSalesDisplay.jsx";
export default function Home() {
return (
<>
<NftCollectionSalesDisplay collectionAddress={"vitalik.eth"} chain={"ETH_MAINNET"} limit={50}/>
</>
);
}
Step 5: Start Your Application
Open a terminal and navigate to the frontend
folder of your create-web3-dapp
project.
Run the following command to start your application:
npm run dev
Congratulations! You have successfully implemented the NFT Collection Sales Display component in your create-web3-dapp
project.
Updated over 1 year ago