diff --git a/frame/nfts/src/lib.rs b/frame/nfts/src/lib.rs index 333fe97dd4a1e..92b27432ab215 100644 --- a/frame/nfts/src/lib.rs +++ b/frame/nfts/src/lib.rs @@ -662,7 +662,7 @@ pub mod pallet { /// /// The origin must be Signed and the sender must have sufficient funds free. /// - /// `ItemDeposit` funds of sender are reserved. + /// `CollectionDeposit` funds of sender are reserved. /// /// Parameters: /// - `admin`: The admin of this collection. The admin is the initial address of each @@ -844,6 +844,7 @@ pub mod pallet { MintType::HolderOf(collection_id) => { let MintWitness { owned_item, .. } = witness_data.clone().ok_or(Error::::WitnessRequired)?; + let owned_item = owned_item.ok_or(Error::::BadWitness)?; let owns_item = Account::::contains_key(( &caller, diff --git a/frame/nfts/src/tests.rs b/frame/nfts/src/tests.rs index c94e75d343930..f7879570a4cb7 100644 --- a/frame/nfts/src/tests.rs +++ b/frame/nfts/src/tests.rs @@ -427,7 +427,7 @@ fn mint_should_work() { 1, 42, account(2), - Some(MintWitness { owned_item: 42, ..Default::default() }) + Some(MintWitness { owned_item: Some(42), ..Default::default() }) ), Error::::BadWitness ); @@ -436,7 +436,7 @@ fn mint_should_work() { 1, 42, account(2), - Some(MintWitness { owned_item: 43, ..Default::default() }) + Some(MintWitness { owned_item: Some(43), ..Default::default() }) )); // can't mint twice @@ -446,7 +446,7 @@ fn mint_should_work() { 1, 46, account(2), - Some(MintWitness { owned_item: 43, ..Default::default() }) + Some(MintWitness { owned_item: Some(43), ..Default::default() }) ), Error::::AlreadyClaimed ); diff --git a/frame/nfts/src/types.rs b/frame/nfts/src/types.rs index f083b116fe938..5a9f6ae2f0e21 100644 --- a/frame/nfts/src/types.rs +++ b/frame/nfts/src/types.rs @@ -133,7 +133,7 @@ impl CollectionDetails { #[derive(Clone, Encode, Decode, Default, Eq, PartialEq, RuntimeDebug, TypeInfo)] pub struct MintWitness { /// Provide the id of the item in a required collection. - pub owned_item: ItemId, + pub owned_item: Option, /// The price specified in mint settings. pub mint_price: Option, }