mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 11:07:56 +00:00
Nfts attribute read interface (#13349)
* feat: add custom and system attributes to Inspect * feat: add nfts runtime api * fix: pass std feature to runtime api * fix: api copyright Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com> --------- Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com>
This commit is contained in:
@@ -33,10 +33,10 @@ use frame_support::{
|
||||
pallet_prelude::Get,
|
||||
parameter_types,
|
||||
traits::{
|
||||
fungible::ItemOf, AsEnsureOriginWithArg, ConstBool, ConstU128, ConstU16, ConstU32,
|
||||
Currency, EitherOfDiverse, EqualPrivilegeOnly, Everything, Imbalance, InstanceFilter,
|
||||
KeyOwnerProofSystem, LockIdentifier, Nothing, OnUnbalanced, U128CurrencyToVote,
|
||||
WithdrawReasons,
|
||||
fungible::ItemOf, tokens::nonfungibles_v2::Inspect, AsEnsureOriginWithArg, ConstBool,
|
||||
ConstU128, ConstU16, ConstU32, Currency, EitherOfDiverse, EqualPrivilegeOnly, Everything,
|
||||
Imbalance, InstanceFilter, KeyOwnerProofSystem, LockIdentifier, Nothing, OnUnbalanced,
|
||||
U128CurrencyToVote, WithdrawReasons,
|
||||
},
|
||||
weights::{
|
||||
constants::{
|
||||
@@ -2187,6 +2187,50 @@ impl_runtime_apis! {
|
||||
}
|
||||
}
|
||||
|
||||
impl pallet_nfts_runtime_api::NftsApi<Block, AccountId, u32, u32> for Runtime {
|
||||
fn owner(collection: u32, item: u32) -> Option<AccountId> {
|
||||
<Nfts as Inspect<AccountId>>::owner(&collection, &item)
|
||||
}
|
||||
|
||||
fn collection_owner(collection: u32) -> Option<AccountId> {
|
||||
<Nfts as Inspect<AccountId>>::collection_owner(&collection)
|
||||
}
|
||||
|
||||
fn attribute(
|
||||
collection: u32,
|
||||
item: u32,
|
||||
key: Vec<u8>,
|
||||
) -> Option<Vec<u8>> {
|
||||
<Nfts as Inspect<AccountId>>::attribute(&collection, &item, &key)
|
||||
}
|
||||
|
||||
fn custom_attribute(
|
||||
account: AccountId,
|
||||
collection: u32,
|
||||
item: u32,
|
||||
key: Vec<u8>,
|
||||
) -> Option<Vec<u8>> {
|
||||
<Nfts as Inspect<AccountId>>::custom_attribute(
|
||||
&account,
|
||||
&collection,
|
||||
&item,
|
||||
&key,
|
||||
)
|
||||
}
|
||||
|
||||
fn system_attribute(
|
||||
collection: u32,
|
||||
item: u32,
|
||||
key: Vec<u8>,
|
||||
) -> Option<Vec<u8>> {
|
||||
<Nfts as Inspect<AccountId>>::system_attribute(&collection, &item, &key)
|
||||
}
|
||||
|
||||
fn collection_attribute(collection: u32, key: Vec<u8>) -> Option<Vec<u8>> {
|
||||
<Nfts as Inspect<AccountId>>::collection_attribute(&collection, &key)
|
||||
}
|
||||
}
|
||||
|
||||
impl pallet_mmr::primitives::MmrApi<
|
||||
Block,
|
||||
mmr::Hash,
|
||||
|
||||
Reference in New Issue
Block a user