substrate
substrate copied to clipboard
Add amalgamation traits for NFT CollectionId and ItemId
I don't know this is the right direction but I believe this would help when people interacting with NFT traits return values in their own pallets
Basically I'm imitating how fungible traits does
Background: I'm learning NFTs pallet so I'm building my own pallet that invoking pallet_nfts via nonfungibles_v2 interface, I tried:
- Create collections in my pallet and deposit an event
- Mint items in my pallet
then, I found few problems:
create_collectionreturnscollection_idbut can't be used in event's payload becausethe trait `Clone` is not implemented for `<<T as pallet::Config>::NonFungibles as frame_support::traits::tokens::nonfungibles_v2::Inspect<<T as frame_system::Config>::AccountId>>::CollectionIdmint_intorequiresItemConfigbut it can be constructed out of pallet_nfts
and a question:
How to construct CollectionId and ItemId from a 3rd pallet?
Add a non topic change (perhaps I need update the title?)
@jsidorenko Could you help to take a look? (don't know how to assign reviewers...)
Hey @jasl ,
How to construct CollectionId and ItemId from a 3rd pallet?
Could you pls provide some code snippet or push your code to GH and put a link here?
I don't quite understand the problem you're facing when constructing the ItemId, won't the 1234u32.into() do the magic?
Hey @jasl ,
How to construct CollectionId and ItemId from a 3rd pallet?
Could you pls provide some code snippet or push your code to GH and put a link here?
I don't quite understand the problem you're facing when constructing the ItemId, won't the
1234u32.into()do the magic?
I remeber I tried but not work, I'll re-check and make a public repo for you if not works
Hey @jasl ,
How to construct CollectionId and ItemId from a 3rd pallet?
Could you pls provide some code snippet or push your code to GH and put a link here? I don't quite understand the problem you're facing when constructing the ItemId, won't the
1234u32.into()do the magic?
I pushed minimal reproducible code
Background: I'm trying to build a pallet to work with pallet_nft, my goal is disable most of pallet_nfts extrinsic and my pallet will help to management collection, minting nfts and update them, users can only own and burn NFTs, rest of other operations are restricted.
version 1: https://github.com/jasl/learn_nft/blob/main/src/lib.rs my pallet extending pallet_nft (relates to https://github.com/paritytech/substrate/pull/13517 )
error[E0603]: type alias `NextCollectionId` is private
--> src/lib.rs:116:18
|
116 | pallet_nfts::NextCollectionId::<T, I>::get().unwrap_or(CollectionIdOf::<T, I>::initial_value());
| ^^^^^^^^^^^^^^^^ private type alias
|
note: the type alias `NextCollectionId` is defined here
--> /Users/jasl/.cargo/git/checkouts/substrate-7e08433d4c370a21/2cb4825/frame/nfts/src/lib.rs:59:9
|
59 | pub use pallet::*;
| ^^^^^^^^^
error[E0277]: the trait bound `<T as pallet_nfts::Config<I>>::ItemId: From<u32>` is not satisfied
--> src/lib.rs:147:10
|
147 | 0u32.into(),
| ^^^^ the trait `From<u32>` is not implemented for `<T as pallet_nfts::Config<I>>::ItemId`
|
= note: required for `u32` to implement `Into<<T as pallet_nfts::Config<I>>::ItemId>`
help: consider further restricting the associated type
|
135 | ) -> DispatchResult where <T as pallet_nfts::Config<I>>::ItemId: From<u32> {
| ++++++++++++++++++++++++++++++++++++++++++++++++++++++
Some errors have detailed explanations: E0277, E0603.
For more information about an error, try `rustc --explain E0277`.
version 2: https://github.com/jasl/learn_nft/blob/another-case/src/lib.rs use nonfungibles_v2 trait
error[E0277]: the trait bound `<<T as pallet::Config>::NFTCollection as frame_support::traits::tokens::nonfungibles_v2::Inspect<<T as frame_system::Config>::AccountId>>::CollectionId: Clone` is not satisfied
--> src/lib.rs:83:42
|
83 | CollectionCreated { who: T::AccountId, collection_id: CollectionIdOf<T> },
| ^^^^^^^^^^^^^ the trait `Clone` is not implemented for `<<T as pallet::Config>::NFTCollection as frame_support::traits::tokens::nonfungibles_v2::Inspect<<T as frame_system::Config>::AccountId>>::CollectionId`
error[E0369]: binary operation `==` cannot be applied to type `&<<T as pallet::Config>::NFTCollection as frame_support::traits::tokens::nonfungibles_v2::Inspect<<T as frame_system::Config>::AccountId>>::CollectionId`
--> src/lib.rs:83:42
|
83 | CollectionCreated { who: T::AccountId, collection_id: CollectionIdOf<T> },
| ^^^^^^^^^^^^^
error[E0277]: `<<T as pallet::Config>::NFTCollection as frame_support::traits::tokens::nonfungibles_v2::Inspect<<T as frame_system::Config>::AccountId>>::CollectionId` doesn't implement `std::fmt::Debug`
--> src/lib.rs:83:42
|
83 | CollectionCreated { who: T::AccountId, collection_id: CollectionIdOf<T> },
| ^^^^^^^^^^^^^ `<<T as pallet::Config>::NFTCollection as frame_support::traits::tokens::nonfungibles_v2::Inspect<<T as frame_system::Config>::AccountId>>::CollectionId` cannot be formatted using `{:?}` because it doesn't implement `std::fmt::Debug`
|
= help: the trait `std::fmt::Debug` is not implemented for `<<T as pallet::Config>::NFTCollection as frame_support::traits::tokens::nonfungibles_v2::Inspect<<T as frame_system::Config>::AccountId>>::CollectionId`
= note: required for `&<<T as pallet::Config>::NFTCollection as frame_support::traits::tokens::nonfungibles_v2::Inspect<<T as frame_system::Config>::AccountId>>::CollectionId` to implement `std::fmt::Debug`
= note: required for the cast from `&<<T as pallet::Config>::NFTCollection as frame_support::traits::tokens::nonfungibles_v2::Inspect<<T as frame_system::Config>::AccountId>>::CollectionId` to the object type `dyn std::fmt::Debug`
error[E0277]: the trait bound `&<<T as pallet::Config>::NFTCollection as frame_support::traits::tokens::nonfungibles_v2::Inspect<<T as frame_system::Config>::AccountId>>::ItemId: From<u32>` is not satisfied
--> src/lib.rs:145:10
|
145 | 1u32.into(),
| ^^^^ the trait `From<u32>` is not implemented for `&<<T as pallet::Config>::NFTCollection as frame_support::traits::tokens::nonfungibles_v2::Inspect<<T as frame_system::Config>::AccountId>>::ItemId`
|
= note: required for `u32` to implement `Into<&<<T as pallet::Config>::NFTCollection as frame_support::traits::tokens::nonfungibles_v2::Inspect<<T as frame_system::Config>::AccountId>>::ItemId>`
error[E0308]: mismatched types
--> src/lib.rs:144:5
|
143 | T::NFTCollection::mint_into(
| --------------------------- arguments to this function are incorrect
144 | collection,
| ^^^^^^^^^^
| |
| expected `&<... as Inspect<...>>::CollectionId`, found associated type
| help: consider borrowing here: `&collection`
|
= note: expected reference `&<<T as pallet::Config>::NFTCollection as frame_support::traits::tokens::nonfungibles_v2::Inspect<<T as frame_system::Config>::AccountId>>::CollectionId`
found associated type `<<T as pallet::Config>::NFTCollection as frame_support::traits::tokens::nonfungibles_v2::Inspect<<T as frame_system::Config>::AccountId>>::CollectionId`
= help: consider constraining the associated type `<<T as pallet::Config>::NFTCollection as frame_support::traits::tokens::nonfungibles_v2::Inspect<<T as frame_system::Config>::AccountId>>::CollectionId` to `&<<T as pallet::Config>::NFTCollection as frame_support::traits::tokens::nonfungibles_v2::Inspect<<T as frame_system::Config>::AccountId>>::CollectionId`
= note: for more information, visit https://doc.rust-lang.org/book/ch19-03-advanced-traits.html
note: associated function defined here
--> /Users/jasl/.cargo/git/checkouts/substrate-7e08433d4c370a21/2cb4825/frame/support/src/traits/tokens/nonfungibles_v2.rs:224:5
|
224 | fn mint_into(
| ^^^^^^^^^
error[E0277]: `<<T as pallet::Config>::NFTCollection as frame_support::traits::tokens::nonfungibles_v2::Inspect<<T as frame_system::Config>::AccountId>>::CollectionId` doesn't implement `std::fmt::Debug`
--> src/lib.rs:136:4
|
136 | collection: CollectionIdOf<T>
| ^^^^^^^^^^ `<<T as pallet::Config>::NFTCollection as frame_support::traits::tokens::nonfungibles_v2::Inspect<<T as frame_system::Config>::AccountId>>::CollectionId` cannot be formatted using `{:?}` because it doesn't implement `std::fmt::Debug`
|
= help: the trait `std::fmt::Debug` is not implemented for `<<T as pallet::Config>::NFTCollection as frame_support::traits::tokens::nonfungibles_v2::Inspect<<T as frame_system::Config>::AccountId>>::CollectionId`
= note: required for `&<<T as pallet::Config>::NFTCollection as frame_support::traits::tokens::nonfungibles_v2::Inspect<<T as frame_system::Config>::AccountId>>::CollectionId` to implement `std::fmt::Debug`
= note: required for the cast from `&<<T as pallet::Config>::NFTCollection as frame_support::traits::tokens::nonfungibles_v2::Inspect<<T as frame_system::Config>::AccountId>>::CollectionId` to the object type `dyn std::fmt::Debug`
error[E0277]: the trait bound `<<T as pallet::Config>::NFTCollection as frame_support::traits::tokens::nonfungibles_v2::Inspect<<T as frame_system::Config>::AccountId>>::CollectionId: Clone` is not satisfied
--> src/lib.rs:136:4
|
136 | collection: CollectionIdOf<T>
| ^^^^^^^^^^ the trait `Clone` is not implemented for `<<T as pallet::Config>::NFTCollection as frame_support::traits::tokens::nonfungibles_v2::Inspect<<T as frame_system::Config>::AccountId>>::CollectionId`
error[E0369]: binary operation `==` cannot be applied to type `&<<T as pallet::Config>::NFTCollection as frame_support::traits::tokens::nonfungibles_v2::Inspect<<T as frame_system::Config>::AccountId>>::CollectionId`
--> src/lib.rs:136:4
|
136 | collection: CollectionIdOf<T>
| ^^^^^^^^^^
error[E0277]: the trait bound `<<T as pallet::Config>::NFTCollection as frame_support::traits::tokens::nonfungibles_v2::Inspect<<T as frame_system::Config>::AccountId>>::CollectionId: WrapperTypeEncode` is not satisfied
--> src/lib.rs:136:4
|
52 | #[frame_support::pallet]
| ------------------------ required by a bound introduced by this call
...
136 | collection: CollectionIdOf<T>
| ^^^^^^^^^^ the trait `WrapperTypeEncode` is not implemented for `<<T as pallet::Config>::NFTCollection as frame_support::traits::tokens::nonfungibles_v2::Inspect<<T as frame_system::Config>::AccountId>>::CollectionId`
|
= note: required for `<<T as pallet::Config>::NFTCollection as frame_support::traits::tokens::nonfungibles_v2::Inspect<<T as frame_system::Config>::AccountId>>::CollectionId` to implement `parity_scale_codec::Encode`
error[E0277]: the trait bound `<<T as pallet::Config>::NFTCollection as frame_support::traits::tokens::nonfungibles_v2::Inspect<<T as frame_system::Config>::AccountId>>::CollectionId: WrapperTypeDecode` is not satisfied
--> src/lib.rs:93:12
|
93 | #[pallet::call]
| _______________^
94 | | impl<T: Config> Pallet<T> {
95 | | #[pallet::call_index(0)]
96 | | #[pallet::weight(0)]
... |
135 | | origin: OriginFor<T>,
136 | | collection: CollectionIdOf<T>
| |_________________________________________^ the trait `WrapperTypeDecode` is not implemented for `<<T as pallet::Config>::NFTCollection as frame_support::traits::tokens::nonfungibles_v2::Inspect<<T as frame_system::Config>::AccountId>>::CollectionId`
|
= note: required for `<<T as pallet::Config>::NFTCollection as frame_support::traits::tokens::nonfungibles_v2::Inspect<<T as frame_system::Config>::AccountId>>::CollectionId` to implement `Decode`
error[E0277]: the trait bound `<<T as pallet::Config>::NFTCollection as frame_support::traits::tokens::nonfungibles_v2::Inspect<<T as frame_system::Config>::AccountId>>::CollectionId: TypeInfo` is not satisfied
--> src/lib.rs:93:12
|
93 | #[pallet::call]
| ^^^^ the trait `TypeInfo` is not implemented for `<<T as pallet::Config>::NFTCollection as frame_support::traits::tokens::nonfungibles_v2::Inspect<<T as frame_system::Config>::AccountId>>::CollectionId`
|
note: required for `pallet::Call<T>` to implement `TypeInfo`
--> src/lib.rs:52:1
|
52 | #[frame_support::pallet]
| ^^^^^^^^^^^^^^^^^^^^^^^^ unsatisfied trait bound introduced in this `derive` macro
...
93 | #[pallet::call]
| ^^^^
note: required by a bound in `meta_type`
--> /Users/jasl/.cargo/registry/src/github.com-1ecc6299db9ec823/scale-info-2.3.1/src/lib.rs:394:17
|
394 | T: ?Sized + TypeInfo + 'static,
| ^^^^^^^^ required by this bound in `meta_type`
= note: this error originates in the derive macro `frame_support::scale_info::TypeInfo` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider further restricting the associated type
|
93 | #[pallet::call where <<T as pallet::Config>::NFTCollection as frame_support::traits::tokens::nonfungibles_v2::Inspect<<T as frame_system::Config>::AccountId>>::CollectionId: TypeInfo]
| +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Some errors have detailed explanations: E0277, E0308, E0369.
For more information about an error, try `rustc --explain E0277`.
error: could not compile `pallet-nft_computing` due to 11 previous errors
warning: build failed, waiting for other jobs to finish...
error[E0277]: the trait bound `<<T as pallet::Config>::NFTCollection as hidden_include::traits::tokens::nonfungibles_v2::Inspect<<T as frame_system::Config>::AccountId>>::CollectionId: Clone` is not satisfied
--> src/lib.rs:83:42
|
83 | CollectionCreated { who: T::AccountId, collection_id: CollectionIdOf<T> },
| ^^^^^^^^^^^^^ the trait `Clone` is not implemented for `<<T as pallet::Config>::NFTCollection as hidden_include::traits::tokens::nonfungibles_v2::Inspect<<T as frame_system::Config>::AccountId>>::CollectionId`
error[E0369]: binary operation `==` cannot be applied to type `&<<T as pallet::Config>::NFTCollection as hidden_include::traits::tokens::nonfungibles_v2::Inspect<<T as frame_system::Config>::AccountId>>::CollectionId`
--> src/lib.rs:83:42
|
83 | CollectionCreated { who: T::AccountId, collection_id: CollectionIdOf<T> },
| ^^^^^^^^^^^^^
error[E0277]: `<<T as pallet::Config>::NFTCollection as hidden_include::traits::tokens::nonfungibles_v2::Inspect<<T as frame_system::Config>::AccountId>>::CollectionId` doesn't implement `std::fmt::Debug`
--> src/lib.rs:83:42
|
83 | CollectionCreated { who: T::AccountId, collection_id: CollectionIdOf<T> },
| ^^^^^^^^^^^^^ `<<T as pallet::Config>::NFTCollection as hidden_include::traits::tokens::nonfungibles_v2::Inspect<<T as frame_system::Config>::AccountId>>::CollectionId` cannot be formatted using `{:?}` because it doesn't implement `std::fmt::Debug`
|
= help: the trait `std::fmt::Debug` is not implemented for `<<T as pallet::Config>::NFTCollection as hidden_include::traits::tokens::nonfungibles_v2::Inspect<<T as frame_system::Config>::AccountId>>::CollectionId`
= note: required for `&<<T as pallet::Config>::NFTCollection as hidden_include::traits::tokens::nonfungibles_v2::Inspect<<T as frame_system::Config>::AccountId>>::CollectionId` to implement `std::fmt::Debug`
= note: required for the cast from `&<<T as pallet::Config>::NFTCollection as hidden_include::traits::tokens::nonfungibles_v2::Inspect<<T as frame_system::Config>::AccountId>>::CollectionId` to the object type `dyn std::fmt::Debug`
error[E0277]: the trait bound `&<<T as pallet::Config>::NFTCollection as hidden_include::traits::tokens::nonfungibles_v2::Inspect<<T as frame_system::Config>::AccountId>>::ItemId: From<u32>` is not satisfied
--> src/lib.rs:145:10
|
145 | 1u32.into(),
| ^^^^ the trait `From<u32>` is not implemented for `&<<T as pallet::Config>::NFTCollection as hidden_include::traits::tokens::nonfungibles_v2::Inspect<<T as frame_system::Config>::AccountId>>::ItemId`
|
= note: required for `u32` to implement `Into<&<<T as pallet::Config>::NFTCollection as hidden_include::traits::tokens::nonfungibles_v2::Inspect<<T as frame_system::Config>::AccountId>>::ItemId>`
error[E0308]: mismatched types
--> src/lib.rs:144:5
|
143 | T::NFTCollection::mint_into(
| --------------------------- arguments to this function are incorrect
144 | collection,
| ^^^^^^^^^^
| |
| expected `&<... as Inspect<...>>::CollectionId`, found associated type
| help: consider borrowing here: `&collection`
|
= note: expected reference `&<<T as pallet::Config>::NFTCollection as hidden_include::traits::tokens::nonfungibles_v2::Inspect<<T as frame_system::Config>::AccountId>>::CollectionId`
found associated type `<<T as pallet::Config>::NFTCollection as hidden_include::traits::tokens::nonfungibles_v2::Inspect<<T as frame_system::Config>::AccountId>>::CollectionId`
= help: consider constraining the associated type `<<T as pallet::Config>::NFTCollection as hidden_include::traits::tokens::nonfungibles_v2::Inspect<<T as frame_system::Config>::AccountId>>::CollectionId` to `&<<T as pallet::Config>::NFTCollection as hidden_include::traits::tokens::nonfungibles_v2::Inspect<<T as frame_system::Config>::AccountId>>::CollectionId`
= note: for more information, visit https://doc.rust-lang.org/book/ch19-03-advanced-traits.html
note: associated function defined here
--> /Users/jasl/.cargo/git/checkouts/substrate-7e08433d4c370a21/2cb4825/frame/support/src/traits/tokens/nonfungibles_v2.rs:224:5
|
224 | fn mint_into(
| ^^^^^^^^^
error[E0277]: `<<T as pallet::Config>::NFTCollection as hidden_include::traits::tokens::nonfungibles_v2::Inspect<<T as frame_system::Config>::AccountId>>::CollectionId` doesn't implement `std::fmt::Debug`
--> src/lib.rs:136:4
|
136 | collection: CollectionIdOf<T>
| ^^^^^^^^^^ `<<T as pallet::Config>::NFTCollection as hidden_include::traits::tokens::nonfungibles_v2::Inspect<<T as frame_system::Config>::AccountId>>::CollectionId` cannot be formatted using `{:?}` because it doesn't implement `std::fmt::Debug`
|
= help: the trait `std::fmt::Debug` is not implemented for `<<T as pallet::Config>::NFTCollection as hidden_include::traits::tokens::nonfungibles_v2::Inspect<<T as frame_system::Config>::AccountId>>::CollectionId`
= note: required for `&<<T as pallet::Config>::NFTCollection as hidden_include::traits::tokens::nonfungibles_v2::Inspect<<T as frame_system::Config>::AccountId>>::CollectionId` to implement `std::fmt::Debug`
= note: required for the cast from `&<<T as pallet::Config>::NFTCollection as hidden_include::traits::tokens::nonfungibles_v2::Inspect<<T as frame_system::Config>::AccountId>>::CollectionId` to the object type `dyn std::fmt::Debug`
error[E0277]: the trait bound `<<T as pallet::Config>::NFTCollection as hidden_include::traits::tokens::nonfungibles_v2::Inspect<<T as frame_system::Config>::AccountId>>::CollectionId: Clone` is not satisfied
--> src/lib.rs:136:4
|
136 | collection: CollectionIdOf<T>
| ^^^^^^^^^^ the trait `Clone` is not implemented for `<<T as pallet::Config>::NFTCollection as hidden_include::traits::tokens::nonfungibles_v2::Inspect<<T as frame_system::Config>::AccountId>>::CollectionId`
error[E0369]: binary operation `==` cannot be applied to type `&<<T as pallet::Config>::NFTCollection as hidden_include::traits::tokens::nonfungibles_v2::Inspect<<T as frame_system::Config>::AccountId>>::CollectionId`
--> src/lib.rs:136:4
|
use nonfungibles_v2
136 | collection: CollectionIdOf<T>
| ^^^^^^^^^^
error[E0277]: the trait bound `<<T as pallet::Config>::NFTCollection as hidden_include::traits::tokens::nonfungibles_v2::Inspect<<T as frame_system::Config>::AccountId>>::CollectionId: WrapperTypeEncode` is not satisfied
--> src/lib.rs:136:4
|
52 | #[frame_support::pallet]
| ------------------------ required by a bound introduced by this call
...
136 | collection: CollectionIdOf<T>
| ^^^^^^^^^^ the trait `WrapperTypeEncode` is not implemented for `<<T as pallet::Config>::NFTCollection as hidden_include::traits::tokens::nonfungibles_v2::Inspect<<T as frame_system::Config>::AccountId>>::CollectionId`
|
= note: required for `<<T as pallet::Config>::NFTCollection as hidden_include::traits::tokens::nonfungibles_v2::Inspect<<T as frame_system::Config>::AccountId>>::CollectionId` to implement `parity_scale_codec::Encode`
error[E0277]: the trait bound `<<T as pallet::Config>::NFTCollection as hidden_include::traits::tokens::nonfungibles_v2::Inspect<<T as frame_system::Config>::AccountId>>::CollectionId: WrapperTypeDecode` is not satisfied
--> src/lib.rs:93:12
|
93 | #[pallet::call]
| _______________^
94 | | impl<T: Config> Pallet<T> {
95 | | #[pallet::call_index(0)]
96 | | #[pallet::weight(0)]
... |
135 | | origin: OriginFor<T>,
136 | | collection: CollectionIdOf<T>
| |_________________________________________^ the trait `WrapperTypeDecode` is not implemented for `<<T as pallet::Config>::NFTCollection as hidden_include::traits::tokens::nonfungibles_v2::Inspect<<T as frame_system::Config>::AccountId>>::CollectionId`
|
= note: required for `<<T as pallet::Config>::NFTCollection as hidden_include::traits::tokens::nonfungibles_v2::Inspect<<T as frame_system::Config>::AccountId>>::CollectionId` to implement `Decode`
error[E0277]: the trait bound `<<T as pallet::Config>::NFTCollection as hidden_include::traits::tokens::nonfungibles_v2::Inspect<<T as frame_system::Config>::AccountId>>::CollectionId: TypeInfo` is not satisfied
--> src/lib.rs:93:12
|
93 | #[pallet::call]
| ^^^^ the trait `TypeInfo` is not implemented for `<<T as pallet::Config>::NFTCollection as hidden_include::traits::tokens::nonfungibles_v2::Inspect<<T as frame_system::Config>::AccountId>>::CollectionId`
|
note: required for `pallet::Call<T>` to implement `TypeInfo`
--> src/lib.rs:52:1
|
52 | #[frame_support::pallet]
| ^^^^^^^^^^^^^^^^^^^^^^^^ unsatisfied trait bound introduced in this `derive` macro
...
93 | #[pallet::call]
| ^^^^
note: required by a bound in `meta_type`
--> /Users/jasl/.cargo/registry/src/github.com-1ecc6299db9ec823/scale-info-2.3.1/src/lib.rs:394:17
|
394 | T: ?Sized + TypeInfo + 'static,
| ^^^^^^^^ required by this bound in `meta_type`
= note: this error originates in the derive macro `frame_support::scale_info::TypeInfo` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider further restricting the associated type
|
93 | #[pallet::call where <<T as pallet::Config>::NFTCollection as hidden_include::traits::tokens::nonfungibles_v2::Inspect<<T as frame_system::Config>::AccountId>>::CollectionId: TypeInfo]
| ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
error: could not compile `pallet-nft_computing` due to 11 previous errors
Hi @jasl, I'm wondering why don't you want to connect the nfts pallet in a loosely coupled way? Then you will be able to access the mint_into and create_collection methods. In the case of the create_collection(), you won't need to pass the collection id and deal with the NextCollectionId storage item. You can find the example of connecting the pallet in this PR: https://github.com/paritytech/substrate/pull/12565
Sorry, I just checked the second example where you used the traits
so, the item_id problem I was able able to solve locally by adding + From<u32> to type's definition in your pallet
Hi @jasl, I'm wondering why don't you want to connect the nfts pallet in a loosely coupled way? Then you will be able to access the mint_into and create_collection methods. In the case of the create_collection(), you won't need to pass the collection id and deal with the NextCollectionId storage item. You can find the example of connecting the pallet in this PR: #12565
My another case (https://github.com/jasl/learn_nft/blob/another-case/src/lib.rs) use that way, I'll learn from that PR first.
thank you
@jasl regarding the Copy/Clone issue, I found it doesn't complain if you provide the ItemId/CollectionId via the runtime config: https://github.com/paritytech/substrate/pull/12565/files#diff-d757e0d131cebbebb0176e5448e53b54970ebb64f1c5d7f01537a4e221e587b0R175-R176
@jasl regarding the Copy/Clone issue, I found it doesn't complain if you provide the ItemId/CollectionId via the runtime config: https://github.com/paritytech/substrate/pull/12565/files#diff-d757e0d131cebbebb0176e5448e53b54970ebb64f1c5d7f01537a4e221e587b0R175-R176
I'll try this tonight, thank you for metion this.
I'll apply all Basti's suggests then squash them
@bkchr I basically follow how AssetId does, do you think AssetId (and maybe Balance) can apply this?
can you pls run cargo +nightly fmt?
@bkchr I basically follow how AssetId does, do you think AssetId (and maybe Balance) can apply this?
Good questions :P IDK, I would need to check the code.
bot fmt
@bkchr https://gitlab.parity.io/parity/mirrors/substrate/-/jobs/2504577 was started for your command "$PIPELINE_SCRIPTS_DIR/commands/fmt/fmt.sh". Check out https://gitlab.parity.io/parity/mirrors/substrate/-/pipelines?page=1&scope=all&username=group_605_bot to know what else is being executed currently.
Comment bot cancel 34-8516d894-46f0-48e0-8e8f-852b42384013 to cancel this command or bot cancel to cancel all commands in this pull request.
@bkchr Command "$PIPELINE_SCRIPTS_DIR/commands/fmt/fmt.sh" has finished. Result: https://gitlab.parity.io/parity/mirrors/substrate/-/jobs/2504577 has finished. If any artifacts were generated, you can download them from https://gitlab.parity.io/parity/mirrors/substrate/-/jobs/2504577/artifacts/download.
P. S. @jasl I think we should simplify the collection's creation via traits and remove the config param. If the advanced (non-default) settings are needed, they should be set via separate methods. I've opened a PR for this today: https://github.com/paritytech/substrate/pull/13572
#13572
GREAT! Thank you ! After this one merge, I'll refactor my code
@bkchr Could you help to merge this?
bot merge