Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: Make hash available in addition to CID when using IPFS #1311

Closed
wants to merge 2 commits into from

Conversation

WaDadidou
Copy link
Collaborator

Before

useIpfs allows to get the CID of uploaded files

image
Our files types embed this CID as url

image

After

useIpfs allows to get the CID and the hash (before parsing it to CID) of uploaded files

image
Our files types embed the CID as url and the hash as hash

image

Copy link

netlify bot commented Oct 17, 2024

Deploy Preview for teritori-dapp ready!

Name Link
🔨 Latest commit 4ef932a
🔍 Latest deploy log https://app.netlify.com/sites/teritori-dapp/deploys/67119690849dc90008e68233
😎 Deploy Preview https://deploy-preview-1311--teritori-dapp.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

netlify bot commented Oct 17, 2024

Deploy Preview for testitori ready!

Name Link
🔨 Latest commit 4ef932a
🔍 Latest deploy log https://app.netlify.com/sites/testitori/deploys/67119690e49ebc000881e469
😎 Deploy Preview https://deploy-preview-1311--testitori.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link
Collaborator

@MikaelVallenet MikaelVallenet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@n0izn0iz
Copy link
Collaborator

what is the purpose of this? I think you are putting twice the same data, this is costing gas for no benefit form what I understand

Copy link
Collaborator

@n0izn0iz n0izn0iz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

requesting change to prevent merging before clarification

@WaDadidou WaDadidou self-assigned this Oct 18, 2024
@WaDadidou
Copy link
Collaborator Author

requesting change to prevent merging before clarification

I send a hash and not a CID to UploadMetadatas:
https://github.com/TERITORI/teritori-dapp/blob/feat/cosmwasm-launchpad/packages/hooks/launchpad/useCompleteCollection.ts#L116

Because, in the UploadMetadatas function, we VerifyPinned:
https://github.com/TERITORI/teritori-dapp/blob/feat/cosmwasm-launchpad/go/pkg/launchpad/service.go#L78

My modification is stupid, I might as well adapt the service rather than change useIpfs, or maybe retrieve the hash from the CID

@n0izn0iz
Copy link
Collaborator

closing, like discussed in sync:

in all cases: we shouldn't modify this basic type that is used to publish data on-chain
also: a cid is a hash
and: VerifyPinned is actually parsing a CID from a string

f you are passing the metadata.image field, which should be an ipfs uri, you need to strip the ipfs:// scheme, maybe that was the actual problem

also be careful to always store ipfs uris (ipfs://<cid>) on-chain and not raw CIDs

@n0izn0iz n0izn0iz closed this Oct 18, 2024
@WaDadidou
Copy link
Collaborator Author

Bad files types modifications !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants