GraphemeNFT / rarible-scaffold

MIT License
0 stars 0 forks source link

add tokenURI to return from `getInfo` #47

Closed dcsan closed 2 years ago

dcsan commented 2 years ago

to save me making two calls inside OneLetter.jsx on each letter render - add everything in one return value

            graphemeContract.tokenURI(tokenId).then(uri => {
                console.log('uri', uri)
                setTokenURI(uri)
            })

            graphemeContract.getInfo(tokenId)
                .then((infoRes) => {
                    // returns an array of dna, isClaimed
                    const [dnaObj, isClaimed] = infoRes
                    // console.log('info', infoRes)
                    const dna = dnaObj.toHexString()
                    setHex(dna)
                    setClaimed(isClaimed)
                    console.log({ isClaimed, dna })
                })

i started but not sure how to read it - is it getBaseURI ?

    function getInfo(uint256 tokenId) public view returns (uint256, bool) {
        return (_items[tokenId].dna, _items[tokenId].isClaimed);
        // _getTokenURI(tokenId)
    }
keepRunning commented 2 years ago

You can use this now. I will update this in the Grapheme contract

function getInfo(uint256 tokenId) public view returns (uint256 dna, bool isClaimed, string memory tokenUri, address owner) { return (_items[tokenId].dna, _items[tokenId].isClaimed, tokenURI(tokenId), ownerOf(tokenId)); }

dcsan commented 2 years ago

can you use YourCollectible contract? or else fix everything in the whole app to use Grapheme contract? including all build scripts, deploy scripts etc.

tomosaigon commented 2 years ago

If this is blocked just use 2 separate calls. We can optimize performance later.

dcsan commented 2 years ago

yeah its working as 2 calls now

dcsan commented 2 years ago

51