diff --git a/src/components/Deposit.jsx b/src/components/Deposit.jsx index 35c1db1..4094fe8 100644 --- a/src/components/Deposit.jsx +++ b/src/components/Deposit.jsx @@ -24,7 +24,7 @@ export default function Deposit({ tokenId, reload, setReload, onClose }) { addressOrName: CONTRACT_dNFT, contractInterface: dNFTabi, functionName: "deposit", - args: [tokenId, dyad ? String(dyad * 10 ** 21) : "0"], + args: [tokenId, dyad ? String(dyad * 10 ** 18) : "0"], onError: (error) => { console.log("error deposit", error); }, @@ -54,8 +54,8 @@ export default function Deposit({ tokenId, reload, setReload, onClose }) { args: [address, CONTRACT_dNFT], onSuccess: (data) => { const allowance = parseInt(data._hex); - console.log("allowance", allowance / 10 ** 21); - setIsApproved(allowance / 10 ** 21 >= parseFloat(dyad)); + console.log("allowance", allowance / 10 ** 18); + setIsApproved(allowance / 10 ** 18 >= parseFloat(dyad)); }, }); diff --git a/src/components/NFT.jsx b/src/components/NFT.jsx index 1832e05..47ed76d 100644 --- a/src/components/NFT.jsx +++ b/src/components/NFT.jsx @@ -28,11 +28,12 @@ export default function NFT({ const { address } = useAccount(); - const [rank, setRank] = useState(); const [xp, setXP] = useState(); const [dyad, setDyad] = useState(); const [dyadBalance, setDyadBalance] = useState(); + const [tokenId, setTokenId] = useState(); + const { isOpen, onOpen, onClose } = useDisclosure(); const { isOpen: isOpenSync, @@ -60,8 +61,9 @@ export default function NFT({ }, ], onSuccess: (data) => { + console.log("tokenOfOwnerByIndex", parseInt(data[0]._hex)); if (data && data[0]) { - setRank(parseInt(data[0]._hex)); + setTokenId(parseInt(data[0]._hex)); } }, }); @@ -72,19 +74,19 @@ export default function NFT({ addressOrName: CONTRACT_dNFT, contractInterface: abi, functionName: "xp", - args: [rank], + args: [tokenId], }, { addressOrName: CONTRACT_dNFT, contractInterface: abi, functionName: "dyadMinted", - args: [rank], + args: [tokenId], }, { addressOrName: CONTRACT_dNFT, contractInterface: abi, functionName: "virtualDyadBalance", - args: [rank], + args: [tokenId], }, ], onSuccess: (data) => { @@ -112,7 +114,7 @@ export default function NFT({ #{calcRank(xps, xp)}