Expose collection attributes from `Inspect` trait (#1914)
# Description - What does this PR do? While working with `pallet_nfts` through `nonfungibles_v2` traits `Inspect, Mutate`, I found out that once you have set the collection attribute with `<Nfts as Mutate>::set_collection_attribute()`, it's not possible to read it with `<Nfts as Inspect>::collection_attribute()` since they use different `namespace` values. When setting the attribute, `AttributeNamespace::Pallet` is used, while `AttributeNamespace::CollectionOwner` is used when reading. more context: https://github.com/freeverseio/laos/issues/7#issuecomment-1766137370 This PR makes `item` an optional parameter in `Inspect::system_attribute()`, to be able to read collection attributes. - Why are these changes needed? To be able to read collection level attributes when reading attributes of the collection. It will be possible to read collection attributes by passing `None` for `item` - How were these changes implemented and what do they affect? `NftsApi` is also affected and `NftsApi::system_attribute()` now accepts optional `item` parameter. ## Breaking change Because of the change in the `NftsApi::system_attribute()` method's `item` param, parachains who integrated the `NftsApi` need to update their API code and frontend integrations accordingly. AssetHubs are unaffected since the NftsApi wasn't released on those parachains yet.
Showing
- cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs 2 additions, 2 deletions...s/parachains/runtimes/assets/asset-hub-westend/src/lib.rs
- substrate/bin/node/runtime/src/lib.rs 2 additions, 2 deletionssubstrate/bin/node/runtime/src/lib.rs
- substrate/frame/nfts/runtime-api/src/lib.rs 1 addition, 1 deletionsubstrate/frame/nfts/runtime-api/src/lib.rs
- substrate/frame/nfts/src/impl_nonfungibles.rs 5 additions, 3 deletionssubstrate/frame/nfts/src/impl_nonfungibles.rs
- substrate/frame/nfts/src/tests.rs 81 additions, 1 deletionsubstrate/frame/nfts/src/tests.rs
- substrate/frame/support/src/traits/tokens/nonfungible_v2.rs 2 additions, 2 deletionssubstrate/frame/support/src/traits/tokens/nonfungible_v2.rs
- substrate/frame/support/src/traits/tokens/nonfungibles_v2.rs 8 additions, 5 deletionssubstrate/frame/support/src/traits/tokens/nonfungibles_v2.rs
Please register or sign in to comment