Skip to content

Commit

Permalink
Merge pull request #150 from NetSepio/rushikesh-nft
Browse files Browse the repository at this point in the history
add : search user nfts
  • Loading branch information
Rushikeshnimkar authored Oct 11, 2024
2 parents f498f52 + 65d9325 commit f169d7d
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 238 deletions.
21 changes: 17 additions & 4 deletions components/UserNFTs.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
import { Connection, PublicKey } from '@solana/web3.js';
import { Metaplex } from '@metaplex-foundation/js';

const COLLECTION_IDS = {
DL_NFT: '5FusHaKEKjfKsmQwXNrhFcFABGGxu7iYCdbvyVSRe3Ri',
SOLANA_MONKEY_BUSINESS_GEN2: 'SMBtHCCC6RYRutFEPb4gZqeBLUZbMNhRKaMKZZLHi7W',
SOLANA_MONKEY_BUSINESS_GEN3: '8Rt3Ayqth4DAiPnW9MDFi63TiQJHmohfTWLMQFHi4KZH',
SHARKX: '5f2PvbmKd9pRLjKdMr8nrK8fNisLi7irjB6X5gopnKpB'
};

const fetchUserNFTs = async (userAddress: string, chainSymbol: string) => {
if (!userAddress) {
console.log('No user address provided');
Expand Down Expand Up @@ -29,7 +36,12 @@ const fetchUserNFTs = async (userAddress: string, chainSymbol: string) => {
const userNFTs = await metaplex.nfts().findAllByOwner({ owner: ownerPublicKey });
console.log('All user NFTs:', userNFTs);

const erebrusNFTs = userNFTs.filter(nft => nft.symbol === "EVPN").map(nft => ({
const filteredNFTs = userNFTs.filter(nft =>
nft.collection?.address.toString() === COLLECTION_IDS.DL_NFT ||
nft.collection?.address.toString() === COLLECTION_IDS.SOLANA_MONKEY_BUSINESS_GEN2 ||
nft.collection?.address.toString() === COLLECTION_IDS.SOLANA_MONKEY_BUSINESS_GEN3 ||
nft.collection?.address.toString() === COLLECTION_IDS.SHARKX
).map(nft => ({
amount: 1,
current_token_data: {
token_name: nft.name,
Expand All @@ -39,12 +51,13 @@ const fetchUserNFTs = async (userAddress: string, chainSymbol: string) => {
cdn_asset_uris: {
cdn_image_uri: nft.json?.image || '',
},
collection: nft.collection?.address.toString(),
},
}));

console.log('Filtered Erebrus NFTs:', erebrusNFTs);
console.log('Filtered NFTs from specified collections:', filteredNFTs);

return erebrusNFTs;
return filteredNFTs;
} else {
console.log('NFT fetching for this chain not implemented yet');
return [];
Expand All @@ -55,4 +68,4 @@ const fetchUserNFTs = async (userAddress: string, chainSymbol: string) => {
}
};

export default fetchUserNFTs;
export default fetchUserNFTs;
226 changes: 0 additions & 226 deletions pages/dvpnnft.tsx

This file was deleted.

4 changes: 2 additions & 2 deletions pages/nodeinfo/[id].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ const NodeDetail: React.FC = () => {
<img src="/ellipse1.png" className="w-20 h-20 md:w-40 md:h-40" />
<div className="absolute inset-0 flex flex-col items-center justify-center text-xs md:text-base">
<div className="text-sm md:text-lg font-semibold">{node.uploadSpeed}</div>
<div className="text-xs md:text-sm">Kbps Speed</div>
<div className="text-xs md:text-sm">Mbps Speed</div>
</div>
</div>
<div className="mt-2 text-xs md:text-base">Upload</div>
Expand All @@ -189,7 +189,7 @@ const NodeDetail: React.FC = () => {
<img src="/ellipse1.png" className="w-20 h-20 md:w-40 md:h-40" />
<div className="absolute inset-0 flex flex-col items-center justify-center text-xs md:text-base">
<div className="text-sm md:text-lg font-semibold">{node.downloadSpeed}</div>
<div className="text-xs md:text-sm">Kbps Speed</div>
<div className="text-xs md:text-sm">Mbps Speed</div>
</div>
</div>
<div className="mt-2 text-xs md:text-base">Download</div>
Expand Down
19 changes: 13 additions & 6 deletions pages/plans.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,12 +155,19 @@ const Plans = () => {
Start Free Trial
</button>
<button
className="bg-white text-black text-base sm:text-lg border-2 border-white px-4 py-2 rounded-[10px] w-full sm:w-1/2 focus:outline-none"
>
<Link href="/mint">
Mint NFT Now
</Link>
</button>
className={`bg-white text-black text-base sm:text-lg border-2 border-white px-4 py-2 rounded-[10px] w-full sm:w-1/2 focus:outline-none ${
chainSym === 'sol' ? 'opacity-50 cursor-not-allowed' : ''
}`}
disabled={chainSym === 'sol'}
>
{chainSym !== 'sol' ? (
<Link href="/mint">
Mint NFT Now
</Link>
) : (
<span>Mint NFT Now</span>
)}
</button>
</div>
</div>
</div>
Expand Down

0 comments on commit f169d7d

Please sign in to comment.