feat(spg-nft): add deduplication option to mint functions #108
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR adds a new deduplication option to the
mint
andmintByPeriphery
functions inSPGNFT
, integrating this option into the existing workflow functions that useSPGNFT
.Function Behaviors
SPGNFT
, themint
andmintByPeriphery
functions will check if the dedup parameter is set to true and skip the minting process if thenftMetadataHash
has already been used. Instead, the function will return the token ID of the original mint associated with that metadata hash.RegistrationWorkflows
,DerivativeWorkflows
,LicenseAttachmentWorkflows
, andGroupingWorkflows
, attempting to mint with a duplicatednftMetadataHash
whilededup
is enabled will throw an error containing information about the IP that was first registered with the metadata hash.dedup
flag is set to false, the samenftMetadataHash
can be reused for minting and registering multiple IPs.Test Plan
Refactored existing tests to include the deduplication parameter. Added new tests to ensure the functions correctly revert when deduplication occurs.
Related Issue
nftMetadataHash
During IP Registration #106