mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 11:07:56 +00:00
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.
This commit is contained in:
@@ -2630,10 +2630,10 @@ impl_runtime_apis! {
|
||||
|
||||
fn system_attribute(
|
||||
collection: u32,
|
||||
item: u32,
|
||||
item: Option<u32>,
|
||||
key: Vec<u8>,
|
||||
) -> Option<Vec<u8>> {
|
||||
<Nfts as Inspect<AccountId>>::system_attribute(&collection, &item, &key)
|
||||
<Nfts as Inspect<AccountId>>::system_attribute(&collection, item.as_ref(), &key)
|
||||
}
|
||||
|
||||
fn collection_attribute(collection: u32, key: Vec<u8>) -> Option<Vec<u8>> {
|
||||
|
||||
Reference in New Issue
Block a user