diff --git a/package.json b/package.json index 8f51cc18..d47e054a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "data-dex", - "version": "1.18.11", + "version": "1.18.12", "description": "The Itheum Data DEX enables you to trade your data using web3 tech", "dependencies": { "@chakra-ui/icons": "2.1.1", @@ -11,7 +11,7 @@ "@itheum/sdk-mx-data-nft": "3.8.0-alpha.12", "@itheum/sdk-mx-enterprise": "0.3.0", "@multiversx/sdk-core": "13.14.2", - "@multiversx/sdk-dapp": "npm:@bucurdavid/sdk-dapp-fork@3.1.0", + "@multiversx/sdk-dapp": "3.0.10", "@peerme/sdk": "0.2.1", "@sentry/react": "7.118.0", "@tanstack/match-sorter-utils": "8.15.1", diff --git a/src/components/ListDataNFTModal.tsx b/src/components/ListDataNFTModal.tsx index 0a5be41e..4c50b88a 100644 --- a/src/components/ListDataNFTModal.tsx +++ b/src/components/ListDataNFTModal.tsx @@ -288,7 +288,7 @@ export default function ListDataNFTModal({ isOpen, onClose, sellerFee, nftData, - + diff --git a/src/components/MarketplaceLowerCard.tsx b/src/components/MarketplaceLowerCard.tsx index da7fed1e..164443e4 100644 --- a/src/components/MarketplaceLowerCard.tsx +++ b/src/components/MarketplaceLowerCard.tsx @@ -49,7 +49,6 @@ const MarketplaceLowerCard: FC = ({ extendedOffer: of <> - diff --git a/src/components/MyListedDataLowerCard.tsx b/src/components/MyListedDataLowerCard.tsx index 0cb37cbf..704289fb 100644 --- a/src/components/MyListedDataLowerCard.tsx +++ b/src/components/MyListedDataLowerCard.tsx @@ -278,7 +278,13 @@ const MyListedDataLowerCard: FC = ({ offer, nftMetad - + @@ -349,7 +355,13 @@ const MyListedDataLowerCard: FC = ({ offer, nftMetad - + @@ -396,7 +408,13 @@ const MyListedDataLowerCard: FC = ({ offer, nftMetad - + diff --git a/src/components/NftMediaComponent.tsx b/src/components/NftMediaComponent.tsx index 05cf12e1..34669eae 100644 --- a/src/components/NftMediaComponent.tsx +++ b/src/components/NftMediaComponent.tsx @@ -42,12 +42,26 @@ const NftMediaComponent: React.FC = (props) => { openNftDetailsDrawer, } = props; - const media = imageUrls || nftMedia?.map((mediaObj) => mediaObj.url) || [DEFAULT_NFT_IMAGE]; const [imageIndex, setImageIndex] = useState(0); const [switchedImageManually, setSwitchedImageManually] = useState(false); const [nextImageIndex, setNextImageIndex] = useState(0); const makeFlip = nextImageIndex !== imageIndex; const isMobile = window.innerWidth <= 480; + let media: string[] = []; + + // if they send both nftMedia and imageUrls, only use imageUrls first if nftMedia has a default issue (known issue in Private PRC) + if (nftMedia && imageUrls && nftMedia?.length > 0 && imageUrls?.length > 0) { + const nftMediaSentAndMainIsADefaultOne = Boolean(nftMedia?.find((mediaObj) => mediaObj.url.includes("default.png"))); + + if (nftMediaSentAndMainIsADefaultOne) { + media = imageUrls; + } else { + media = nftMedia?.map((mediaObj) => mediaObj.url); + } + } else { + // default to normal legacy logic + media = imageUrls || nftMedia?.map((mediaObj) => mediaObj.url) || [DEFAULT_NFT_IMAGE]; + } useEffect(() => { if (autoSlide && media.length > 1 && !switchedImageManually) { diff --git a/src/components/ProcureDataNFTModal.tsx b/src/components/ProcureDataNFTModal.tsx index 8edfa369..ece71293 100644 --- a/src/components/ProcureDataNFTModal.tsx +++ b/src/components/ProcureDataNFTModal.tsx @@ -170,7 +170,6 @@ export default function ProcureDataNFTModal({ const isOnOfferPage = window.location.pathname.includes("/offer-"); const shouldUseCallbackRoute = isWebWallet && amount == offer.quantity && isOnOfferPage; const callbackRoute = "/datanfts/wallet"; - const { sessionId } = await marketContract.sendAcceptOfferEsdtTransaction( offer.index, paymentAmount.toFixed(), @@ -243,7 +242,13 @@ export default function ProcureDataNFTModal({ - + diff --git a/src/components/ProcureDataNFTSuccessCTAModel.tsx b/src/components/ProcureDataNFTSuccessCTAModel.tsx index 03bc10c3..bfd0b448 100644 --- a/src/components/ProcureDataNFTSuccessCTAModel.tsx +++ b/src/components/ProcureDataNFTSuccessCTAModel.tsx @@ -38,7 +38,13 @@ export default function ProcureDataNFTSuccessCTAModel({ isOpen, onClose, nftData {nftData.tokenName} - + )} diff --git a/src/components/Sections/AppHeader.tsx b/src/components/Sections/AppHeader.tsx index 3d71d831..13f6fd50 100644 --- a/src/components/Sections/AppHeader.tsx +++ b/src/components/Sections/AppHeader.tsx @@ -290,7 +290,7 @@ const AppHeader = ({ onShowConnectWalletModal, setMenuItem, handleLogout }: { on {exploreRouterMenu.map((menu) => ( - }> + }> diff --git a/src/components/Sections/RecentDataNFTs.tsx b/src/components/Sections/RecentDataNFTs.tsx index a68d7a0d..4f62920d 100644 --- a/src/components/Sections/RecentDataNFTs.tsx +++ b/src/components/Sections/RecentDataNFTs.tsx @@ -149,6 +149,7 @@ const RecentDataNFTs = ({ headingText, headingSize }: { headingText: string; hea as={ReactRouterLink}> = ({ openNftDetailsDrawer, }) => { const { colorMode } = useColorMode(); - // Multiversx API const { address } = useGetAccountInfo(); const { network: { chainId: chainID }, @@ -63,10 +61,8 @@ const UpperCardComponent: FC = ({ const { isLoggedIn: isMxLoggedIn } = useGetLoginInfo(); const ChainExplorer = CHAIN_TX_VIEWER[chainID as keyof typeof CHAIN_TX_VIEWER]; const navigate = useNavigate(); - const userData = useMintStore((state) => state.userData); const itheumPrice = useMarketStore((state) => state.itheumPrice); - const feePrice = offer ? printPrice( convertWeiToEsdt(offer.wantedTokenAmount as BigNumber.Value, tokenDecimals(offer.wantedTokenIdentifier)).toNumber(), @@ -75,6 +71,7 @@ const UpperCardComponent: FC = ({ : ""; const fee = offer ? convertWeiToEsdt(offer.wantedTokenAmount as BigNumber.Value, tokenDecimals(offer.wantedTokenIdentifier)).toNumber() : 0; const parsedCreationTime = moment(nftMetadata?.creationTime); + return ( = ({ mb="1.5rem"> { @@ -432,7 +430,7 @@ export default function DataNFTDetails(props: DataNFTDetailsProps) { alignItems={{ base: "initial", md: "initial" }} justifyContent={{ xl: "space-between" }}> - + @@ -890,7 +888,13 @@ export default function DataNFTDetails(props: DataNFTDetailsProps) { + style={{ textDecoration: "none" }} + onClick={() => { + window.scrollTo({ + top: 0, + behavior: "smooth", + }); + }}> @@ -899,7 +903,13 @@ export default function DataNFTDetails(props: DataNFTDetailsProps) { + style={{ textDecoration: "none" }} + onClick={() => { + window.scrollTo({ + top: 0, + behavior: "smooth", + }); + }}> diff --git a/src/pages/DataNFT/DataNFTMarketplaceMultiversX.tsx b/src/pages/DataNFT/DataNFTMarketplaceMultiversX.tsx index 318b2176..be3bc160 100644 --- a/src/pages/DataNFT/DataNFTMarketplaceMultiversX.tsx +++ b/src/pages/DataNFT/DataNFTMarketplaceMultiversX.tsx @@ -673,7 +673,14 @@ export const Marketplace: FC = ({ tabState }) => { borderRadius="0.75rem"> openNftDetailsModal(index)}> - + diff --git a/src/pages/DataNFT/DataNftCollection.tsx b/src/pages/DataNFT/DataNftCollection.tsx index 35dcaeb2..09538fba 100644 --- a/src/pages/DataNFT/DataNftCollection.tsx +++ b/src/pages/DataNFT/DataNftCollection.tsx @@ -115,7 +115,7 @@ export const DataNftCollectionCard: FC = ({ borderRadius="8px" width="70%" height="12%"> - + View Data NFT Collection @@ -136,7 +136,7 @@ export const DataNftCollectionCard: FC = ({ onClick={() => { window.open(dataPreview); }}> - + Preview Data diff --git a/src/pages/DataNFT/components/BondingCards.tsx b/src/pages/DataNFT/components/BondingCards.tsx index 59ca5bec..383cb617 100644 --- a/src/pages/DataNFT/components/BondingCards.tsx +++ b/src/pages/DataNFT/components/BondingCards.tsx @@ -242,7 +242,13 @@ export const BondingCards: React.FC = () => { - + {nfmeIdNonce !== dataNft.nonce ? ( @@ -406,7 +412,13 @@ export const BondingCards: React.FC = () => { {dataNft.tokenName} - + {nfmeIdNonce === dataNft.nonce && ( diff --git a/src/pages/Home/components/TrendingData.tsx b/src/pages/Home/components/TrendingData.tsx index c7276bd2..30b3b4f4 100644 --- a/src/pages/Home/components/TrendingData.tsx +++ b/src/pages/Home/components/TrendingData.tsx @@ -108,7 +108,14 @@ export const TrendingData: React.FC = () => { - + diff --git a/src/pages/Home/components/VolumesDataNfts.tsx b/src/pages/Home/components/VolumesDataNfts.tsx index 4a3102f9..a7cdddd6 100644 --- a/src/pages/Home/components/VolumesDataNfts.tsx +++ b/src/pages/Home/components/VolumesDataNfts.tsx @@ -100,7 +100,14 @@ const VolumesDataNfts: React.FC = () => { - + diff --git a/src/pages/Profile/components/DataCreatorTabs.tsx b/src/pages/Profile/components/DataCreatorTabs.tsx index c0f60dd6..b4f1aaf2 100644 --- a/src/pages/Profile/components/DataCreatorTabs.tsx +++ b/src/pages/Profile/components/DataCreatorTabs.tsx @@ -56,43 +56,29 @@ export const DataCreatorTabs: React.FC = ({ tabState }) => { const { hasPendingTransactions } = useGetPendingTransactions(); const { address } = useGetAccountInfo(); const isApiUp = useMarketStore((state) => state.isApiUp); - const { pageNumber, profileAddress } = useParams(); const navigate = useNavigate(); const toast = useToast(); - const offers = useMarketStore((state) => state.offers); const updateOffers = useMarketStore((state) => state.updateOffers); const [isLoadingFirst, setIsLoadingFirst] = useState(false); - - // pagination const pageCount = useMarketStore((state) => state.pageCount); const updatePageCount = useMarketStore((state) => state.updatePageCount); const pageSize = 8; const pageIndex = pageNumber ? Number(pageNumber) : 0; - const mintContract = new DataNftMintContract(chainID); const marketContract = new DataNftMarketContract(chainID); - const [nftMetadatas, setNftMetadatas] = useState([]); - // const [marketFreezedNonces, setMarketFreezedNonces] = useState([]); - // const maxPaymentFeeMap = useMarketStore((state) => state.maxPaymentFeeMap); - // const marketRequirements = useMarketStore((state) => state.marketRequirements); const [isLoadingSecond, setIsLoadingSecond] = useState(false); - const [offerForDrawer, setOfferForDrawer] = useState(); const [dataNftForDrawer, setDataNftForDrawer] = useState(); const [myListedCount, setMyListedCount] = useState(0); - const [oneCreatedNFTImgLoaded, setOneCreatedNFTImgLoaded] = useState(false); const [oneListedNFTImgLoaded, setOneListedNFTImgLoaded] = useState(false); - const [dataNfts, setDataNft] = useState>([]); - const { isOpen: isOpenDataNftDetails, onOpen: onOpenDataNftDetails, onClose: onCloseDataNftDetails } = useDisclosure(); const { isOpen: isOpenListingDetails, onOpen: onOpenListingDetails, onClose: onCloseListingDetails } = useDisclosure(); const { colorMode } = useColorMode(); - const profileTabs = [ { tabNumber: 1, @@ -126,15 +112,6 @@ export const DataCreatorTabs: React.FC = ({ tabState }) => { }, ]; - const getOnChainNFTs = async () => { - const dataNftsT: DataNft[] = await getNftsOfACollectionForAnAddress( - address, - contractsForChain(chainID).dataNftTokens.map((v) => v.id), - chainID - ); - return dataNftsT; - }; - useEffect(() => { if (!profileAddress || hasPendingTransactions) return; if (tabState !== 1) return; @@ -166,23 +143,6 @@ export const DataCreatorTabs: React.FC = ({ tabState }) => { })(); }, [profileAddress, hasPendingTransactions, tabState]); - const setPageIndex = (newPageIndex: number) => { - navigate(`/datanfts/marketplace/${tabState === 1 ? "market" : "my"}${newPageIndex > 0 ? "/" + newPageIndex : ""}`); - }; - - const onGotoPage = useThrottle((newPageIndex: number) => { - if (0 <= newPageIndex && newPageIndex < pageCount) { - setPageIndex(newPageIndex); - } - }); - - // useEffect(() => { - // (async () => { - // const _marketFreezedNonces = await mintContract.getSftsFrozenForAddress(marketContract.dataNftMarketContractAddress); - // setMarketFreezedNonces(_marketFreezedNonces); - // })(); - // }, []); - useEffect(() => { (async () => { if (!profileAddress || hasPendingTransactions) return; @@ -233,6 +193,25 @@ export const DataCreatorTabs: React.FC = ({ tabState }) => { })(); }, [profileAddress, pageIndex, pageSize, tabState, hasPendingTransactions]); + const getOnChainNFTs = async () => { + const dataNftsT: DataNft[] = await getNftsOfACollectionForAnAddress( + address, + contractsForChain(chainID).dataNftTokens.map((v) => v.id), + chainID + ); + return dataNftsT; + }; + + const setPageIndex = (newPageIndex: number) => { + navigate(`/datanfts/marketplace/${tabState === 1 ? "market" : "my"}${newPageIndex > 0 ? "/" + newPageIndex : ""}`); + }; + + const onGotoPage = useThrottle((newPageIndex: number) => { + if (0 <= newPageIndex && newPageIndex < pageCount) { + setPageIndex(newPageIndex); + } + }); + function openNftDetailsModal(index: number) { if (tabState == 1) { setDataNftForDrawer(dataNfts[index]);