GraphemeNFT / rarible-scaffold

MIT License
0 stars 0 forks source link

render letters grid #28

Closed dcsan closed 3 years ago

dcsan commented 3 years ago

I have the grid of letters rendering and pulling from the contract

    useEffect(() => {
        if (itemId) {
            props.readContracts.YourCollectible.getDNA(itemId).then((dnaObj) => {
                console.log('dnaObj', dnaObj)
                setHex(dnaObj.toHexString())
                setBigInt(dnaObj.toBigInt())
            })
        }
        // getInfo()
    }, [itemId])

the bigInt doesn't render for some reason... maybe JS limitation on sizes we could break apart the hex values before passing into the renderer as a sequence of 255 bytes?

dnaObj BigNumber {_hex: "0x31ec22b5991b8fc4f5c36c564ea46d65213bf61fddeded0e48edac923a7f8d6f", _isBigNumber: true}_hex: "0x31ec22b5991b8fc4f5c36c564ea46d65213bf61fddeded0e48edac923a7f8d6f"_isBigNumber: true[[Prototype]]: Object
OneLetter.jsx:26 longNumber 22580545043118008175038654896222348504147725612910864307615515937782823357807n

image

dcsan commented 3 years ago

@tomosaigon can your render component take a hex string or how would you like that?

tomosaigon commented 3 years ago

Here's a reason we should just make each token return a uint32. Then munge that into an array of numbers, each number from 0 to 8 (so you would slice the uint32 into 10 3-bit values).

dcsan commented 3 years ago

FYI ArtBlocks does return a 32 byte hash like this. it's the length of a wallet signature I think, so perhaps our render code should deal with that? I think it would be cool in the end if people could put their wallet address or whatever into the Letter component and get a glyph out of it that is pretty unique visualization of that address?

tomosaigon commented 3 years ago

Although it's not set in stone or documented publicly, the working vision is that DNA is 32 bits of data and renderings are based on that. Passing in more bits won't improve the rendering.

It looks like it works now so I'll close this.

Discussing minting tokens based on custom declared data would venture into a totally separate art concept.