diff --git a/components/Login/aptos.tsx b/components/Login/aptos.tsx index 59534b7..459fb38 100644 --- a/components/Login/aptos.tsx +++ b/components/Login/aptos.tsx @@ -44,6 +44,7 @@ export const useAptosWallet = () => { flowId: nonce, signature: `${signaturewallet}`, pubKey: publicKey, + chainName : "aptos" }; const authenticateApiUrl = `${REACT_APP_GATEWAY_URL}api/v1.0/authenticate?chain=${chainsym}`; diff --git a/components/Login/ethereum.tsx b/components/Login/ethereum.tsx index b7f2325..a2a417e 100644 --- a/components/Login/ethereum.tsx +++ b/components/Login/ethereum.tsx @@ -44,6 +44,7 @@ const authenticationData = { flowId: nonce, signature: data, + chainName : "manta" }; const authenticateApiUrl = `${REACT_APP_GATEWAY_URL}api/v1.0/authenticate?chain=${chainsym}`; diff --git a/components/Login/peaq.tsx b/components/Login/peaq.tsx index d37740d..5249dc2 100644 --- a/components/Login/peaq.tsx +++ b/components/Login/peaq.tsx @@ -44,6 +44,7 @@ export const usePeaqWallet = () => { const authenticationData = { flowId: nonce, signature: data, + chainName : "peaq" }; const authenticateApiUrl = `${REACT_APP_GATEWAY_URL}api/v1.0/authenticate?chain=evm`; diff --git a/components/Login/solana.tsx b/components/Login/solana.tsx index fae5d62..64ec8c3 100644 --- a/components/Login/solana.tsx +++ b/components/Login/solana.tsx @@ -87,6 +87,7 @@ export const useSolWallet = (setshowsignbutton) => { pubKey: publicKey, walletAddress: publicKey, message: message, + chainName : "solana" }; const authenticateApiUrl = `${REACT_APP_GATEWAY_URL}api/v1.0/authenticate?walletAddress=${publicKey}&chain=sol`; diff --git a/components/Login/suiwallet.tsx b/components/Login/suiwallet.tsx index 8f89762..a004ef6 100644 --- a/components/Login/suiwallet.tsx +++ b/components/Login/suiwallet.tsx @@ -59,6 +59,7 @@ const erebrusWallet =getwallet(); const authenticationData = { flowId: nonce, signatureSui:result.signature, + chainName : "sui" }; diff --git a/components/UserNFTs.tsx b/components/UserNFTs.tsx index c22af25..b94486a 100644 --- a/components/UserNFTs.tsx +++ b/components/UserNFTs.tsx @@ -1,6 +1,14 @@ 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', + Superteam_Member_NFT :'5sDBuHZ7zDzZ2Px1YQS3ELxoFja5J66vpKKcW84ndRk7' +}; + const fetchUserNFTs = async (userAddress: string, chainSymbol: string) => { if (!userAddress) { console.log('No user address provided'); @@ -29,7 +37,13 @@ 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 || + nft.collection?.address.toString() === COLLECTION_IDS.Superteam_Member_NFT + ).map(nft => ({ amount: 1, current_token_data: { token_name: nft.name, @@ -39,12 +53,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 []; @@ -55,4 +70,4 @@ const fetchUserNFTs = async (userAddress: string, chainSymbol: string) => { } }; -export default fetchUserNFTs; +export default fetchUserNFTs; \ No newline at end of file diff --git a/pages/dvpnnft.tsx b/pages/dvpnnft.tsx deleted file mode 100644 index 7444984..0000000 --- a/pages/dvpnnft.tsx +++ /dev/null @@ -1,226 +0,0 @@ -import React, { useState, useEffect } from 'react'; -import Footer from "../components/Footer"; -import { BrowserView, MobileView } from 'react-device-detect'; -import axios from 'axios'; - -const REACT_APP_GATEWAY_URL = process.env.NEXT_PUBLIC_GATEWAY_URL; - -const BaliDVPNNFTPage = () => { - const [walletAddress, setWalletAddress] = useState(''); - const [response, setResponse] = useState(null); - const [error, setError] = useState(null); - const [showPopup, setShowPopup] = useState(false); - const [isLoading, setIsLoading] = useState(false); - - const handleWalletAddressChange = (event) => { - setWalletAddress(event.target.value); - }; - - const handleGoClick = async () => { - setIsLoading(true); - - setTimeout(async () => { - try { - const result = await axios.post(`${REACT_APP_GATEWAY_URL}api/v1.0/dvpnnft/chain=evm`, { - wallet_address: walletAddress - }); - setResponse(result.data); - setError(null); - - if (result.data && result.data.transaction_hash) { - setShowPopup(true); - } else if (result.status === 302) { - setShowPopup(true); - setResponse({ alreadyMinted: true }); - } - } catch (err) { - if (err.response && err.response.status === 302) { - setShowPopup(true); - setResponse({ alreadyMinted: true }); - } else { - setError('An error occurred while processing your request.'); - setResponse(null); - } - } finally { - setIsLoading(false); - } - }, 3000); // 3 second delay - }; - - const renderLoadingAnimation = () => { - if (!isLoading) return null; - - return ( -
-
-
-

Processing...

-
-
- ); - }; - const renderResponse = () => { - if (error) { - return

{error}

; - } - - - if (response && !response.alreadyMinted) { - return ( -
-

Response:

-
-            {JSON.stringify(response, null, 2)}
-          
-
- ); - } - return null; - }; - - const renderPopup = () => { - if (!showPopup) return null; - - const isAlreadyMinted = response && response.alreadyMinted; - - return ( -
-
-
-
- {isAlreadyMinted ? ( - - - - ) : ( - - - - )} -
-

- {isAlreadyMinted ? "Already Minted" : "Success!"} -

-

- {isAlreadyMinted - ? "You have already minted an NFT with this wallet address." - : "Your transaction was successful."} -

- {!isAlreadyMinted && ( -
-

Transaction Hash:

-

{response.transaction_hash}

-

- You can view these NFTs at{' '} - - element.market - -

-
- )} - -
-
-
- ); - }; - return ( - <> - -
-
-

Mint Your FREE Bali ÐVPN NFT

-

Secure, Private, Exclusive

-
- - - - -{renderResponse()} -
- Erebrus DVPN -
- {renderPopup()} -
-
- -
-

- Mint Your FREE Bali DVPN NFT -

-
-
-
-
- Erebrus DVPN -
- -
-

- Secure, Private, Exclusive -

-
{ e.preventDefault(); handleGoClick(); }}> -

- Enter your wallet address and click GO -

-
- -
-
- - {renderResponse()} -
-
- {renderPopup()} -
-
-
- -
- {renderLoadingAnimation()} - -