Closed vibern0 closed 4 years ago
To know if SPACE is rent, we only need to verify if the tokenURI is set. Here's an example using the command line after renting a SPACE with success
truffle(development)> decentra = await DecentramallToken.deployed()
undefined
truffle(development)> (await decentra.totalSupply()).toString()
'1'
truffle(development)> (await decentra.tokenByIndex(0)).toString()
'59445606994480167206646304069559128798226201844767837182811341979008600605747'
truffle(development)> (await decentra.tokenURI('59445606994480167206646304069559128798226201844767837182811341979008600605747')).toString()
'QmRCNryuXnysNZKnN5evFJrzQ39ZtuPAr4xwRAGvKv4oAC'
truffle(development)>
There might be a simple way to do this but I can't figure out how to retrieve the tokenURI from the smart contract based on the tokenID from the context. I can display the tokenURI through an independent async function calling the contract, but I can't call the context inside the useEffect nor call the contract inside the renderContext...
Depends on #11