ourzora / zdk

MIT License
107 stars 42 forks source link

sha256FromBuffer is failing inside IsUriHashVerified #52

Closed MrBents closed 2 years ago

MrBents commented 3 years ago

https://github.com/ourzora/zdk/blob/3c1f8f31a33ea28288f394f8e906945046a2e2b3/src/utils.ts#L599-L618

The axios call returns the correct data, however the call to sha256FromBuffer always returns the same thing, regardless of the input arraybuffer. Not sure what the issue is here. See the example below, both content and metadata URIs erroneously resolve to the same hash.

{tokenURI: "https://storage.googleapis.com/nft-canvas/66/66/images/1621801970097.png", metadataURI: "https://storage.googleapis.com/nft-canvas/66/66/metadata.json", contentHash: "0x18b4cf64cb828da7b198868c84011b58cbe50165dbd54c047aed9cd266aae684", metadataHash: "0x18b4cf64cb828da7b198868c84011b58cbe50165dbd54c047aed9cd266aae684"}

universalsequences commented 2 years ago

Hey! I've encountered the same problem just now.

I noticed that by changing the sha256FromBuffer(resp.data) line to sha256FromBuffer(Buffer.from(resp.data)) it works perfectly though.

The problem is that sha256FromBuffer expects a Buffer not an arrayBuffer.

iainnash commented 2 years ago

Closed, for old contracts.