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

The Generative drop v0 #7745

Merged
merged 16 commits into from
Oct 26, 2023
Merged

The Generative drop v0 #7745

merged 16 commits into from
Oct 26, 2023

Conversation

Jarsen136
Copy link
Contributor

@Jarsen136 Jarsen136 commented Oct 19, 2023

Thank you for your contribution to the KodaDot - One Stop Shop for Polkadot NFTs.

👇 __ Let's make a quick check before the contribution.

PR Type

  • Feature

Needs QA check

  • @kodadot/qa-guild please review

Context

Did your issue had any of the "$" label on it?

Screenshot 📸

  • My fix has changed UI

Copilot Summary

🤖 Generated by Copilot at 7e44249

This pull request adds support for generative NFTs with unlockable content of different MIME types. It introduces a new component Generative.vue and several subcomponents to render the generative drop UI. It also updates the dropCollectionById query, the useDrops hook, and the pages/[prefix]/drops/[id].vue file to handle the new drop type. It adds a new function generativeTokenMintArgs and modifies the createUnlockableMetadata function to create the mint transaction arguments and metadata hash. It also adds some translation keys to the locales/en.json file.

🤖 Generated by Copilot at 7e44249

Oh we are the coders of the NFT sea
We make the drops generative and unlockable
We use the hooks and the components with useGraphql
And we mint the tokens with generativeTokenMintArgs

@netlify
Copy link

netlify bot commented Oct 19, 2023

Deploy Preview for koda-canary ready!

Name Link
🔨 Latest commit ce8c16d
🔍 Latest deploy log https://app.netlify.com/sites/koda-canary/deploys/653a62eb5888c6000863bd2b
😎 Deploy Preview https://deploy-preview-7745--koda-canary.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.

@kodabot
Copy link
Collaborator

kodabot commented Oct 19, 2023

SUCCESS @Jarsen136 PR for issue #7580 which is assigned to you. Please wait for review and don't hesitate to grab another issue in the meantime!

@reviewpad
Copy link
Contributor

reviewpad bot commented Oct 19, 2023

AI-Generated Summary: This pull request introduces two new Vue components: Generative.vue and GenerativePreview.vue in the collection/drop directory. The code also adds new functionality for generating NFTs, including mint arguments and metadata creation. A new drop type, "generative", has been included to handle different pricing models depending on the drop type. This update also provides UI enhancements such as time left for the 'mint' action and the ability for users to preview examples of possible drop variations.

In terms of localization, English translations for "run" and "variations" have been added.

Various GraphQL queries have been updated, and new computed properties have been added to support the new functionality. In particular, dropCollectionById now includes description metadata for the collection. The drop price is conditional based on the drop type.

Overall, this PR adds the necessary features for users to mint generative NFTs on the platform.

@reviewpad reviewpad bot added the large Pull request is large label Oct 19, 2023
@Jarsen136
Copy link
Contributor Author

when meta > 0 you need to call api.tx.nfts.mint(collectionId, collection.count, accountId)

I got stuck at the final step of minting NFT. When I try to send the tx, it fails and tells me I have no permission to operate this collection. Would you mind helping me with this PR and pointing out what's wrong with it? @vikiival

@vikiival
Copy link
Member

pointing out what's wrong with it? @vikiival

Please follow

#7580 (comment)

@Jarsen136
Copy link
Contributor Author

when meta > 0 you need to call api.tx.nfts.mint(collectionId, collection.count, accountId)

pointing out what's wrong with it? @vikiival

Please follow

#7580 (comment)

What should we do if the meta is equal to zero?
Same as other drops: Call an API

I did follow the guide. The meta of the generative drop is 1000000000, so I call api.tx.nfts.mint and then the transaction failed because of no permission. Let me know if I miss something in this PR.

image

@vikiival
Copy link
Member

I did follow the guide. The meta of the generative drop is 1000000000

Meta should be null in this case i fixed the DB

@Jarsen136
Copy link
Contributor Author

I did follow the guide. The meta of the generative drop is 1000000000

Meta should be null in this case i fixed the DB

I have updated them accordingly.
Which API should I call? I have tried with api /do/genchains and it responded successfully but there is no nft created then.

@vikiival
Copy link
Member

successfully but there is no nft created then.

Because it failed https://assethub-kusama.subscan.io/extrinsic/0xf4f157a609689979848dcd87c68dade6a996e96953ebd3433296353f5b92fffd

@Jarsen136
Copy link
Contributor Author

successfully but there is no nft created then.

Because it failed https://assethub-kusama.subscan.io/extrinsic/0xf4f157a609689979848dcd87c68dade6a996e96953ebd3433296353f5b92fffd

As this transaction was emitted from the server side, what should we do to deal with this failure?
The only difference I noticed is that mint_to points to another address instead of the collection's owner.
image

@vikiival
Copy link
Member

It should point to your address, honestly i do not know why it failed

@Jarsen136
Copy link
Contributor Author

It should point to your address, honestly i do not know why it failed


Only the collection's owner has permission to mint nft and send it to other address. I bet that's why the transaction failed. WDYT? @vikiival


For the previous successful transaction, it was emitted by the collection's owner.

emitted by: Gn84LKb5HSxc3SACayxCzKQcWESRMcT1VUCqeZURfGj6ASi
collection id: 165
collection's owner: Gn84LKb5HSxc3SACayxCzKQcWESRMcT1VUCqeZURfGj6ASi

image
image

However, for the failed one, it was emitted by the Gn84xxx6ASi instead of collection's owner (vikiival)
emitted by: Gn84LKb5HSxc3SACayxCzKQcWESRMcT1VUCqeZURfGj6ASi
collection id: 176
collection's owner: vikiival

image

@vikiival
Copy link
Member

Only the collection's owner has permission to mint nft and send it to other address. I bet that's why the transaction failed.

Yup I had really weird settings on this collection (according to blockchain - KodaBot was the owner, but vikiival had all the rights to mint.

TL;DR I was able to mint but

This timer is too low. I waited around a mintute to be redirected. So please show a correct time.

Screenshot 2023-10-23 at 12 39 27

  1. When I was playing with settings I broke the squid. The fix should be propagated in 10 min or less

@Jarsen136
Copy link
Contributor Author

Yup I had really weird settings on this collection (according to blockchain - KodaBot was the owner, but vikiival had all the rights to mint.

TL;DR I was able to mint but

Interesting : ) Now It works for me as well.

This timer is too low. I waited around a mintute to be redirected. So please show a correct time.

Updated

@Jarsen136 Jarsen136 marked this pull request as ready for review October 23, 2023 12:48
@Jarsen136 Jarsen136 requested a review from a team as a code owner October 23, 2023 12:48
@Jarsen136 Jarsen136 requested review from preschian and floyd-li and removed request for a team October 23, 2023 12:48
@Jarsen136
Copy link
Contributor Author

Jarsen136 commented Oct 23, 2023

  1. you are missing trailing slash

2. NFT view is broken
  1. In GenerativePreview.vue L:45 should be

✅ All of them have been fixed. Thank you for pointing them out with the code. @vikiival

image

@prury
Copy link
Member

prury commented Oct 23, 2023

Some questions:
Mint button is supposed to work only after clicking on Run? is this normal behavior?
Variations sometimes take a long time to load here for me(5s), maybe a small loading icon could tell the user that the variation is loading?

creation goes nicely: https://deploy-preview-7745--koda-canary.netlify.app/ahk/gallery/176-4

recent NFTs mint still needs implementation:
image

@Jarsen136
Copy link
Contributor Author

Some questions: Mint button is supposed to work only after clicking on Run? is this normal behavior?

Yes, the user should click the button and choose their favourite image.

Variations sometimes take a long time to load here for me(5s), maybe a small loading icon could tell the user that the variation is loading?

Updated. I have added the loading icon for it.

creation goes nicely: https://deploy-preview-7745--koda-canary.netlify.app/ahk/gallery/176-4

recent NFTs mint still needs implementation: image

Done

image

@vikiival
Copy link
Member

Yes, the user should click the button and choose their favourite image.

I would default it with ss58 of current chain ()

@Jarsen136
Copy link
Contributor Author

Yes, the user should click the button and choose their favourite image.

I would default it with ss58 of current chain ()

✅ Updated. I set a default value for it so the user does not have to click the run button.

@prury
Copy link
Member

prury commented Oct 24, 2023

Done

image

they all have the same cover image even if NFTs are different

@prury
Copy link
Member

prury commented Oct 24, 2023

one last thing, if i understood correctly, the image I'm seeing on the right side is what i get when i click mint, so, instead of example of drop we could change it to something else, maybe "Select your Variation" and change the Variation button to Generate. @exezbcz wdyt?

image

@Jarsen136
Copy link
Contributor Author

Done
image

they all have the same cover image even if NFTs are different

It's intended because we set the same preview image for every image.
ref #7580 (comment)

image

@vikiival
Copy link
Member

vikiival commented Oct 26, 2023

@prury / @Jarsen136 Is there any blocker for this PR?

@vikiival
Copy link
Member

Also can someone from @kodadot/internal-dev review?

@Jarsen136
Copy link
Contributor Author

@Jarsen136 Is there any blocker for this PR?

No. It's ready to review and merged.

Copy link
Contributor

@roiLeo roiLeo left a comment

Choose a reason for hiding this comment

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

otherwise lgtm

components/collection/drop/Generative.vue Show resolved Hide resolved
components/collection/drop/Generative.vue Show resolved Hide resolved
components/collection/drop/Generative.vue Show resolved Hide resolved
components/collection/drop/Generative.vue Outdated Show resolved Hide resolved
components/collection/drop/Generative.vue Outdated Show resolved Hide resolved
components/collection/drop/Generative.vue Show resolved Hide resolved
components/collection/drop/Generative.vue Show resolved Hide resolved
@prury
Copy link
Member

prury commented Oct 26, 2023

@prury / @Jarsen136 Is there any blocker for this PR?

was just waiting about Exez opinion on this #7745 (comment), but will open a followup instead

@exezbcz
Copy link
Member

exezbcz commented Oct 26, 2023

@prury I would remove the tag and create followup for more UI changes

@prury
Copy link
Member

prury commented Oct 26, 2023

@prury I would remove the tag and create followup for more UI changes

@Jarsen136 please remove:
image
and we are good to go

yangwao and others added 2 commits October 26, 2023 15:00
Co-authored-by: roiLeo <medina.leo42@gmail.com>
Co-authored-by: roiLeo <medina.leo42@gmail.com>
@codeclimate
Copy link

codeclimate bot commented Oct 26, 2023

Code Climate has analyzed commit ce8c16d and detected 1 issue on this pull request.

Here's the issue category breakdown:

Category Count
Complexity 1

View more on Code Climate.

@yangwao
Copy link
Member

yangwao commented Oct 26, 2023

I think there will be few refactor/iterations to improve codebase, now we can at least test it

Thanks!
pay 50 usd

@yangwao yangwao merged commit fe55b4f into main Oct 26, 2023
8 of 9 checks passed
@yangwao yangwao deleted the issue-7580 branch October 26, 2023 13:01
@yangwao
Copy link
Member

yangwao commented Oct 26, 2023

😍 Perfect, I’ve sent the payout
💵 $50 @ 4.34 USD/DOT ~ 11.521 $DOT
🧗 16SjUbGKSdjCdWTy3NNT3JxbRVGGqD4mwkHpc6BD9U2Rp29Z
🔗 0x25170e0a1c3d08cde8726caad0cfdc533453b10fe1367626b7ecef058ec0a55e

🪅 Let’s grab another issue and get rewarded!
🪄 github.com/kodadot/nft-gallery/issues

@yangwao yangwao added the paid pull-request has been paid label Oct 26, 2023
@sonarcloud
Copy link

sonarcloud bot commented Oct 26, 2023

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
4.8% 4.8% Duplication

idea Catch issues before they fail your Quality Gate with our IDE extension sonarlint SonarLint

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
large Pull request is large paid pull-request has been paid waiting-for-review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The Generative drop v0
7 participants