git.delta.rocks / unique-network / refs/commits / 352886154808

difftreelog

feat(rpc) adminlist/allowlist/last_token_id calls

Yaroslav Bolyukin2021-10-22parent: #9c7fc18.patch.diff
in: master

10 files changed

modifiedclient/rpc/src/lib.rsdiffbeforeafterboth
--- a/client/rpc/src/lib.rs
+++ b/client/rpc/src/lib.rs
@@ -1,5 +1,6 @@
 use std::sync::Arc;
 
+use codec::Decode;
 use jsonrpc_core::{Error as RpcError, ErrorCode, Result};
 use jsonrpc_derive::rpc;
 use nft_data_structs::{CollectionId, TokenId};
@@ -72,6 +73,13 @@
 		token: TokenId,
 		at: Option<BlockHash>,
 	) -> Result<u128>;
+
+	#[rpc(name = "nft_adminlist")]
+	fn adminlist(&self, collection: CollectionId, at: Option<BlockHash>) -> Result<Vec<AccountId>>;
+	#[rpc(name = "nft_allowlist")]
+	fn allowlist(&self, collection: CollectionId, at: Option<BlockHash>) -> Result<Vec<AccountId>>;
+	#[rpc(name = "nft_lastTokenId")]
+	fn last_token_id(&self, collection: CollectionId, at: Option<BlockHash>) -> Result<TokenId>;
 }
 
 pub struct Nft<C, P> {
@@ -125,6 +133,7 @@
 	for Nft<C, Block>
 where
 	Block: BlockT,
+	AccountId: Decode,
 	C: 'static + ProvideRuntimeApi<Block> + HeaderBackend<Block>,
 	C::Api: NftRuntimeApi<Block, CrossAccountId, AccountId>,
 	CrossAccountId: pallet_common::account::CrossAccountId<AccountId>,
@@ -138,4 +147,8 @@
 	pass_method!(account_balance(collection: CollectionId, account: CrossAccountId) -> u32);
 	pass_method!(balance(collection: CollectionId, account: CrossAccountId, token: TokenId) -> u128);
 	pass_method!(allowance(collection: CollectionId, sender: CrossAccountId, spender: CrossAccountId, token: TokenId) -> u128);
+
+	pass_method!(adminlist(collection: CollectionId) -> Vec<AccountId>);
+	pass_method!(allowlist(collection: CollectionId) -> Vec<AccountId>);
+	pass_method!(last_token_id(collection: CollectionId) -> TokenId);
 }
modifiedpallets/common/src/lib.rsdiffbeforeafterboth
--- a/pallets/common/src/lib.rs
+++ b/pallets/common/src/lib.rs
@@ -109,12 +109,12 @@
 	pub fn ignores_owned_amount(&self, user: &T::CrossAccountId) -> Result<bool, DispatchError> {
 		Ok(self.limits.owner_can_transfer && self.is_owner_or_admin(user)?)
 	}
-	pub fn check_whitelist(&self, user: &T::CrossAccountId) -> DispatchResult {
+	pub fn check_allowlist(&self, user: &T::CrossAccountId) -> DispatchResult {
 		self.consume_sload()?;
 
 		ensure!(
-			<WhiteList<T>>::get((self.id, user.as_sub())),
-			<Error<T>>::AddressNotInWhiteList
+			<Allowlist<T>>::get((self.id, user.as_sub())),
+			<Error<T>>::AddressNotInAllowlist
 		);
 		Ok(())
 	}
@@ -252,7 +252,7 @@
 		/// Collection is not in mint mode.
 		PublicMintingNotAllowed,
 		/// Address is not in white list.
-		AddressNotInWhiteList,
+		AddressNotInAllowlist,
 
 		/// Collection name can not be longer than 63 char.
 		CollectionNameLimitExceeded,
@@ -315,9 +315,9 @@
 		QueryKind = ValueQuery,
 	>;
 
-	/// Whitelisted collection users
+	/// Allowlisted collection users
 	#[pallet::storage]
-	pub type WhiteList<T: Config> = StorageNMap<
+	pub type Allowlist<T: Config> = StorageNMap<
 		Key = (
 			Key<Blake2_128Concat, CollectionId>,
 			Key<Blake2_128Concat, T::AccountId>,
@@ -398,6 +398,7 @@
 		<CollectionById<T>>::insert(id, data);
 		Ok(id)
 	}
+
 	pub fn destroy_collection(
 		collection: CollectionHandle<T>,
 		sender: &T::CrossAccountId,
@@ -417,11 +418,11 @@
 		<DestroyedCollectionCount<T>>::put(destroyed_collections);
 		<CollectionById<T>>::remove(collection.id);
 		<IsAdmin<T>>::remove_prefix((collection.id,), None);
-		<WhiteList<T>>::remove_prefix((collection.id,), None);
+		<Allowlist<T>>::remove_prefix((collection.id,), None);
 		Ok(())
 	}
 
-	pub fn toggle_whitelist(
+	pub fn toggle_allowlist(
 		collection: &CollectionHandle<T>,
 		sender: &T::CrossAccountId,
 		user: &T::CrossAccountId,
@@ -432,9 +433,9 @@
 		// =========
 
 		if allowed {
-			<WhiteList<T>>::insert((collection.id, user.as_sub()), true);
+			<Allowlist<T>>::insert((collection.id, user.as_sub()), true);
 		} else {
-			<WhiteList<T>>::remove((collection.id, user.as_sub()));
+			<Allowlist<T>>::remove((collection.id, user.as_sub()));
 		}
 
 		Ok(())
@@ -511,6 +512,7 @@
 
 	fn account_tokens(&self, account: T::CrossAccountId) -> Vec<TokenId>;
 	fn token_exists(&self, token: TokenId) -> bool;
+	fn last_token_id(&self) -> TokenId;
 
 	fn token_owner(&self, token: TokenId) -> T::CrossAccountId;
 	fn const_metadata(&self, token: TokenId) -> Vec<u8>;
modifiedpallets/fungible/src/common.rsdiffbeforeafterboth
before · pallets/fungible/src/common.rs
1use core::marker::PhantomData;23use frame_support::{dispatch::DispatchResultWithPostInfo, ensure, fail, weights::Weight};4use nft_data_structs::TokenId;5use pallet_common::{6	CommonCollectionOperations, CommonWeightInfo, account::CrossAccountId, with_weight,7};8use sp_runtime::ArithmeticError;9use sp_std::{vec::Vec, vec};1011use crate::{12	Allowance, Balance, Config, Error, FungibleHandle, Pallet, SelfWeightOf, weights::WeightInfo,13};1415pub struct CommonWeights<T: Config>(PhantomData<T>);16impl<T: Config> CommonWeightInfo for CommonWeights<T> {17	fn create_item() -> Weight {18		<SelfWeightOf<T>>::create_item()19	}2021	fn create_multiple_items(_amount: u32) -> Weight {22		Self::create_item()23	}2425	fn burn_item() -> Weight {26		<SelfWeightOf<T>>::burn_item()27	}2829	fn transfer() -> Weight {30		<SelfWeightOf<T>>::transfer()31	}3233	fn approve() -> Weight {34		<SelfWeightOf<T>>::approve()35	}3637	fn transfer_from() -> Weight {38		<SelfWeightOf<T>>::transfer_from()39	}4041	fn set_variable_metadata(_bytes: u32) -> Weight {42		// Error43		044	}45}4647impl<T: Config> CommonCollectionOperations<T> for FungibleHandle<T> {48	fn create_item(49		&self,50		sender: T::CrossAccountId,51		to: T::CrossAccountId,52		data: nft_data_structs::CreateItemData,53	) -> DispatchResultWithPostInfo {54		match data {55			nft_data_structs::CreateItemData::Fungible(data) => with_weight(56				<Pallet<T>>::create_item(self, &sender, (to, data.value)),57				<SelfWeightOf<T>>::create_item(),58			),59			_ => fail!(<Error<T>>::NotFungibleDataUsedToMintFungibleCollectionToken),60		}61	}6263	fn create_multiple_items(64		&self,65		sender: T::CrossAccountId,66		to: T::CrossAccountId,67		data: Vec<nft_data_structs::CreateItemData>,68	) -> DispatchResultWithPostInfo {69		let mut sum: u128 = 0;70		for data in data {71			match data {72				nft_data_structs::CreateItemData::Fungible(data) => {73					sum = sum74						.checked_add(data.value)75						.ok_or(ArithmeticError::Overflow)?;76				}77				_ => fail!(<Error<T>>::NotFungibleDataUsedToMintFungibleCollectionToken),78			}79		}8081		with_weight(82			<Pallet<T>>::create_item(self, &sender, (to, sum)),83			<SelfWeightOf<T>>::create_item(),84		)85	}8687	fn burn_item(88		&self,89		sender: T::CrossAccountId,90		token: TokenId,91		amount: u128,92	) -> DispatchResultWithPostInfo {93		ensure!(94			token == TokenId::default(),95			<Error<T>>::FungibleItemsHaveNoId96		);9798		with_weight(99			<Pallet<T>>::burn(self, &sender, amount),100			<SelfWeightOf<T>>::burn_item(),101		)102	}103104	fn transfer(105		&self,106		from: T::CrossAccountId,107		to: T::CrossAccountId,108		token: TokenId,109		amount: u128,110	) -> DispatchResultWithPostInfo {111		ensure!(112			token == TokenId::default(),113			<Error<T>>::FungibleItemsHaveNoId114		);115116		with_weight(117			<Pallet<T>>::transfer(&self, &from, &to, amount),118			<SelfWeightOf<T>>::transfer(),119		)120	}121122	fn approve(123		&self,124		sender: T::CrossAccountId,125		spender: T::CrossAccountId,126		token: TokenId,127		amount: u128,128	) -> DispatchResultWithPostInfo {129		ensure!(130			token == TokenId::default(),131			<Error<T>>::FungibleItemsHaveNoId132		);133134		with_weight(135			<Pallet<T>>::set_allowance(&self, &sender, &spender, amount),136			<SelfWeightOf<T>>::approve(),137		)138	}139140	fn transfer_from(141		&self,142		sender: T::CrossAccountId,143		from: T::CrossAccountId,144		to: T::CrossAccountId,145		token: TokenId,146		amount: u128,147	) -> DispatchResultWithPostInfo {148		ensure!(149			token == TokenId::default(),150			<Error<T>>::FungibleItemsHaveNoId151		);152153		with_weight(154			<Pallet<T>>::transfer_from(&self, &sender, &from, &to, amount),155			<SelfWeightOf<T>>::transfer_from(),156		)157	}158159	fn set_variable_metadata(160		&self,161		_sender: T::CrossAccountId,162		_token: TokenId,163		_data: Vec<u8>,164	) -> DispatchResultWithPostInfo {165		fail!(<Error<T>>::FungibleItemsHaveData)166	}167168	fn account_tokens(&self, account: T::CrossAccountId) -> Vec<TokenId> {169		if <Balance<T>>::get((self.id, account.as_sub())) != 0 {170			vec![TokenId::default()]171		} else {172			vec![]173		}174	}175176	fn token_exists(&self, token: TokenId) -> bool {177		token == TokenId::default()178	}179180	fn token_owner(&self, _token: TokenId) -> T::CrossAccountId {181		T::CrossAccountId::default()182	}183	fn const_metadata(&self, _token: TokenId) -> Vec<u8> {184		Vec::new()185	}186	fn variable_metadata(&self, _token: TokenId) -> Vec<u8> {187		Vec::new()188	}189190	fn collection_tokens(&self) -> u32 {191		1192	}193194	fn account_balance(&self, account: T::CrossAccountId) -> u32 {195		if <Balance<T>>::get((self.id, account.as_sub())) != 0 {196			1197		} else {198			0199		}200	}201202	fn balance(&self, account: T::CrossAccountId, token: TokenId) -> u128 {203		if token != TokenId::default() {204			return 0;205		}206		<Balance<T>>::get((self.id, account.as_sub()))207	}208209	fn allowance(210		&self,211		sender: T::CrossAccountId,212		spender: T::CrossAccountId,213		token: TokenId,214	) -> u128 {215		if token != TokenId::default() {216			return 0;217		}218		<Allowance<T>>::get((self.id, sender.as_sub(), spender.as_sub()))219	}220}
after · pallets/fungible/src/common.rs
1use core::marker::PhantomData;23use frame_support::{dispatch::DispatchResultWithPostInfo, ensure, fail, weights::Weight};4use nft_data_structs::TokenId;5use pallet_common::{6	CommonCollectionOperations, CommonWeightInfo, account::CrossAccountId, with_weight,7};8use sp_runtime::ArithmeticError;9use sp_std::{vec::Vec, vec};1011use crate::{12	Allowance, Balance, Config, Error, FungibleHandle, Pallet, SelfWeightOf, weights::WeightInfo,13};1415pub struct CommonWeights<T: Config>(PhantomData<T>);16impl<T: Config> CommonWeightInfo for CommonWeights<T> {17	fn create_item() -> Weight {18		<SelfWeightOf<T>>::create_item()19	}2021	fn create_multiple_items(_amount: u32) -> Weight {22		Self::create_item()23	}2425	fn burn_item() -> Weight {26		<SelfWeightOf<T>>::burn_item()27	}2829	fn transfer() -> Weight {30		<SelfWeightOf<T>>::transfer()31	}3233	fn approve() -> Weight {34		<SelfWeightOf<T>>::approve()35	}3637	fn transfer_from() -> Weight {38		<SelfWeightOf<T>>::transfer_from()39	}4041	fn set_variable_metadata(_bytes: u32) -> Weight {42		// Error43		044	}45}4647impl<T: Config> CommonCollectionOperations<T> for FungibleHandle<T> {48	fn create_item(49		&self,50		sender: T::CrossAccountId,51		to: T::CrossAccountId,52		data: nft_data_structs::CreateItemData,53	) -> DispatchResultWithPostInfo {54		match data {55			nft_data_structs::CreateItemData::Fungible(data) => with_weight(56				<Pallet<T>>::create_item(self, &sender, (to, data.value)),57				<SelfWeightOf<T>>::create_item(),58			),59			_ => fail!(<Error<T>>::NotFungibleDataUsedToMintFungibleCollectionToken),60		}61	}6263	fn create_multiple_items(64		&self,65		sender: T::CrossAccountId,66		to: T::CrossAccountId,67		data: Vec<nft_data_structs::CreateItemData>,68	) -> DispatchResultWithPostInfo {69		let mut sum: u128 = 0;70		for data in data {71			match data {72				nft_data_structs::CreateItemData::Fungible(data) => {73					sum = sum74						.checked_add(data.value)75						.ok_or(ArithmeticError::Overflow)?;76				}77				_ => fail!(<Error<T>>::NotFungibleDataUsedToMintFungibleCollectionToken),78			}79		}8081		with_weight(82			<Pallet<T>>::create_item(self, &sender, (to, sum)),83			<SelfWeightOf<T>>::create_item(),84		)85	}8687	fn burn_item(88		&self,89		sender: T::CrossAccountId,90		token: TokenId,91		amount: u128,92	) -> DispatchResultWithPostInfo {93		ensure!(94			token == TokenId::default(),95			<Error<T>>::FungibleItemsHaveNoId96		);9798		with_weight(99			<Pallet<T>>::burn(self, &sender, amount),100			<SelfWeightOf<T>>::burn_item(),101		)102	}103104	fn transfer(105		&self,106		from: T::CrossAccountId,107		to: T::CrossAccountId,108		token: TokenId,109		amount: u128,110	) -> DispatchResultWithPostInfo {111		ensure!(112			token == TokenId::default(),113			<Error<T>>::FungibleItemsHaveNoId114		);115116		with_weight(117			<Pallet<T>>::transfer(&self, &from, &to, amount),118			<SelfWeightOf<T>>::transfer(),119		)120	}121122	fn approve(123		&self,124		sender: T::CrossAccountId,125		spender: T::CrossAccountId,126		token: TokenId,127		amount: u128,128	) -> DispatchResultWithPostInfo {129		ensure!(130			token == TokenId::default(),131			<Error<T>>::FungibleItemsHaveNoId132		);133134		with_weight(135			<Pallet<T>>::set_allowance(&self, &sender, &spender, amount),136			<SelfWeightOf<T>>::approve(),137		)138	}139140	fn transfer_from(141		&self,142		sender: T::CrossAccountId,143		from: T::CrossAccountId,144		to: T::CrossAccountId,145		token: TokenId,146		amount: u128,147	) -> DispatchResultWithPostInfo {148		ensure!(149			token == TokenId::default(),150			<Error<T>>::FungibleItemsHaveNoId151		);152153		with_weight(154			<Pallet<T>>::transfer_from(&self, &sender, &from, &to, amount),155			<SelfWeightOf<T>>::transfer_from(),156		)157	}158159	fn set_variable_metadata(160		&self,161		_sender: T::CrossAccountId,162		_token: TokenId,163		_data: Vec<u8>,164	) -> DispatchResultWithPostInfo {165		fail!(<Error<T>>::FungibleItemsHaveData)166	}167168	fn account_tokens(&self, account: T::CrossAccountId) -> Vec<TokenId> {169		if <Balance<T>>::get((self.id, account.as_sub())) != 0 {170			vec![TokenId::default()]171		} else {172			vec![]173		}174	}175176	fn token_exists(&self, token: TokenId) -> bool {177		token == TokenId::default()178	}179180	fn last_token_id(&self) -> TokenId {181		TokenId::default()182	}183184	fn token_owner(&self, _token: TokenId) -> T::CrossAccountId {185		T::CrossAccountId::default()186	}187	fn const_metadata(&self, _token: TokenId) -> Vec<u8> {188		Vec::new()189	}190	fn variable_metadata(&self, _token: TokenId) -> Vec<u8> {191		Vec::new()192	}193194	fn collection_tokens(&self) -> u32 {195		1196	}197198	fn account_balance(&self, account: T::CrossAccountId) -> u32 {199		if <Balance<T>>::get((self.id, account.as_sub())) != 0 {200			1201		} else {202			0203		}204	}205206	fn balance(&self, account: T::CrossAccountId, token: TokenId) -> u128 {207		if token != TokenId::default() {208			return 0;209		}210		<Balance<T>>::get((self.id, account.as_sub()))211	}212213	fn allowance(214		&self,215		sender: T::CrossAccountId,216		spender: T::CrossAccountId,217		token: TokenId,218	) -> u128 {219		if token != TokenId::default() {220			return 0;221		}222		<Allowance<T>>::get((self.id, sender.as_sub(), spender.as_sub()))223	}224}
modifiedpallets/fungible/src/lib.rsdiffbeforeafterboth
--- a/pallets/fungible/src/lib.rs
+++ b/pallets/fungible/src/lib.rs
@@ -123,7 +123,7 @@
 			.ok_or(<CommonError<T>>::TokenValueTooLow)?;
 
 		if collection.access == AccessMode::WhiteList {
-			collection.check_whitelist(owner)?;
+			collection.check_allowlist(owner)?;
 		}
 
 		// =========
@@ -161,8 +161,8 @@
 		);
 
 		if collection.access == AccessMode::WhiteList {
-			collection.check_whitelist(from)?;
-			collection.check_whitelist(to)?;
+			collection.check_allowlist(from)?;
+			collection.check_allowlist(to)?;
 		}
 		<PalletCommon<T>>::ensure_correct_receiver(to)?;
 
@@ -222,10 +222,10 @@
 				collection.mint_mode,
 				<CommonError<T>>::PublicMintingNotAllowed
 			);
-			collection.check_whitelist(sender)?;
+			collection.check_allowlist(sender)?;
 
 			for (owner, _) in data.iter() {
-				collection.check_whitelist(owner)?;
+				collection.check_allowlist(owner)?;
 			}
 		}
 
@@ -305,8 +305,8 @@
 		amount: u128,
 	) -> DispatchResult {
 		if collection.access == AccessMode::WhiteList {
-			collection.check_whitelist(&owner)?;
-			collection.check_whitelist(&spender)?;
+			collection.check_allowlist(&owner)?;
+			collection.check_allowlist(&spender)?;
 		}
 
 		if <Balance<T>>::get((collection.id, owner.as_sub())) < amount {
@@ -334,7 +334,7 @@
 		}
 		if collection.access == AccessMode::WhiteList {
 			// `from`, `to` checked in [`transfer`]
-			collection.check_whitelist(spender)?;
+			collection.check_allowlist(spender)?;
 		}
 
 		let allowance = <Allowance<T>>::get((collection.id, from.as_sub(), spender.as_sub()))
modifiedpallets/nft/src/lib.rsdiffbeforeafterboth
--- a/pallets/nft/src/lib.rs
+++ b/pallets/nft/src/lib.rs
@@ -41,7 +41,7 @@
 };
 use pallet_common::{
 	account::CrossAccountId, CollectionHandle, IsAdmin, Pallet as PalletCommon,
-	Error as CommonError, CommonWeightInfo,
+	Error as CommonError, CommonWeightInfo, Allowlist,
 };
 use pallet_refungible::{Pallet as PalletRefungible, RefungibleHandle};
 use pallet_fungible::{Pallet as PalletFungible, FungibleHandle};
@@ -311,7 +311,7 @@
 			let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
 			let collection = <CollectionHandle<T>>::try_get(collection_id)?;
 
-			<PalletCommon<T>>::toggle_whitelist(
+			<PalletCommon<T>>::toggle_allowlist(
 				&collection,
 				&sender,
 				&address,
@@ -340,7 +340,7 @@
 			let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
 			let collection = <CollectionHandle<T>>::try_get(collection_id)?;
 
-			<PalletCommon<T>>::toggle_whitelist(
+			<PalletCommon<T>>::toggle_allowlist(
 				&collection,
 				&sender,
 				&address,
@@ -923,3 +923,17 @@
 		}
 	}
 }
+
+// TODO: limit returned entries?
+impl<T: Config> Pallet<T> {
+	pub fn adminlist(collection: CollectionId) -> Vec<T::AccountId> {
+		<IsAdmin<T>>::iter_prefix((collection,))
+			.map(|(a, _)| a)
+			.collect()
+	}
+	pub fn allowlist(collection: CollectionId) -> Vec<T::AccountId> {
+		<Allowlist<T>>::iter_prefix((collection,))
+			.map(|(a, _)| a)
+			.collect()
+	}
+}
modifiedpallets/nonfungible/src/common.rsdiffbeforeafterboth
--- a/pallets/nonfungible/src/common.rs
+++ b/pallets/nonfungible/src/common.rs
@@ -185,6 +185,10 @@
 		<Pallet<T>>::token_exists(self, token)
 	}
 
+	fn last_token_id(&self) -> TokenId {
+		TokenId(<TokensMinted<T>>::get(self.id))
+	}
+
 	fn token_owner(&self, token: TokenId) -> T::CrossAccountId {
 		<Owner<T>>::get((self.id, token))
 	}
modifiedpallets/nonfungible/src/lib.rsdiffbeforeafterboth
--- a/pallets/nonfungible/src/lib.rs
+++ b/pallets/nonfungible/src/lib.rs
@@ -198,7 +198,7 @@
 		);
 
 		if collection.access == AccessMode::WhiteList {
-			collection.check_whitelist(sender)?;
+			collection.check_allowlist(sender)?;
 		}
 
 		let burnt = <TokensBurnt<T>>::get(collection.id)
@@ -246,8 +246,8 @@
 		);
 
 		if collection.access == AccessMode::WhiteList {
-			collection.check_whitelist(from)?;
-			collection.check_whitelist(to)?;
+			collection.check_allowlist(from)?;
+			collection.check_allowlist(to)?;
 		}
 		<PalletCommon<T>>::ensure_correct_receiver(to)?;
 
@@ -314,10 +314,10 @@
 				collection.mint_mode,
 				<CommonError<T>>::PublicMintingNotAllowed
 			);
-			collection.check_whitelist(sender)?;
+			collection.check_allowlist(sender)?;
 
 			for item in data.iter() {
-				collection.check_whitelist(&item.owner)?;
+				collection.check_allowlist(&item.owner)?;
 			}
 		}
 
@@ -453,9 +453,9 @@
 		spender: Option<&T::CrossAccountId>,
 	) -> DispatchResult {
 		if collection.access == AccessMode::WhiteList {
-			collection.check_whitelist(&sender)?;
+			collection.check_allowlist(&sender)?;
 			if let Some(spender) = spender {
-				collection.check_whitelist(&spender)?;
+				collection.check_allowlist(&spender)?;
 			}
 		}
 
@@ -488,7 +488,7 @@
 		}
 		if collection.access == AccessMode::WhiteList {
 			// `from`, `to` checked in [`transfer`]
-			collection.check_whitelist(spender)?;
+			collection.check_allowlist(spender)?;
 		}
 
 		if <Allowance<T>>::get((collection.id, token)).as_ref() != Some(spender) {
modifiedpallets/refungible/src/lib.rsdiffbeforeafterboth
--- a/pallets/refungible/src/lib.rs
+++ b/pallets/refungible/src/lib.rs
@@ -268,8 +268,8 @@
 		);
 
 		if collection.access == AccessMode::WhiteList {
-			collection.check_whitelist(from)?;
-			collection.check_whitelist(to)?;
+			collection.check_allowlist(from)?;
+			collection.check_allowlist(to)?;
 		}
 		<PalletCommon<T>>::ensure_correct_receiver(to)?;
 
@@ -361,11 +361,11 @@
 				collection.mint_mode,
 				<CommonError<T>>::PublicMintingNotAllowed
 			);
-			collection.check_whitelist(sender)?;
+			collection.check_allowlist(sender)?;
 
 			for item in data.iter() {
 				for (user, _) in &item.users {
-					collection.check_whitelist(&user)?;
+					collection.check_allowlist(&user)?;
 				}
 			}
 		}
@@ -485,8 +485,8 @@
 		amount: u128,
 	) -> DispatchResult {
 		if collection.access == AccessMode::WhiteList {
-			collection.check_whitelist(&sender)?;
-			collection.check_whitelist(&spender)?;
+			collection.check_allowlist(&sender)?;
+			collection.check_allowlist(&spender)?;
 		}
 
 		<PalletCommon<T>>::ensure_correct_receiver(spender)?;
@@ -517,7 +517,7 @@
 		}
 		if collection.access == AccessMode::WhiteList {
 			// `from`, `to` checked in [`transfer`]
-			collection.check_whitelist(spender)?;
+			collection.check_allowlist(spender)?;
 		}
 
 		let allowance = <Allowance<T>>::get((collection.id, token, from.as_sub(), &spender))
modifiedprimitives/rpc/src/lib.rsdiffbeforeafterboth
--- a/primitives/rpc/src/lib.rs
+++ b/primitives/rpc/src/lib.rs
@@ -3,9 +3,11 @@
 use nft_data_structs::{CollectionId, TokenId};
 use sp_std::vec::Vec;
 use sp_core::H160;
+use codec::Decode;
 
 sp_api::decl_runtime_apis! {
 	pub trait NftApi<CrossAccountId, AccountId> where
+		AccountId: Decode,
 		CrossAccountId: pallet_common::account::CrossAccountId<AccountId>,
 	{
 		fn account_tokens(collection: CollectionId, account: CrossAccountId) -> Vec<TokenId>;
@@ -27,5 +29,9 @@
 
 		/// Used for ethereum integration
 		fn eth_contract_code(account: H160) -> Option<Vec<u8>>;
+
+		fn adminlist(collection: CollectionId) -> Vec<AccountId>;
+		fn allowlist(collection: CollectionId) -> Vec<AccountId>;
+		fn last_token_id(collection: CollectionId) -> TokenId;
 	}
 }
modifiedruntime/src/lib.rsdiffbeforeafterboth
--- a/runtime/src/lib.rs
+++ b/runtime/src/lib.rs
@@ -972,6 +972,15 @@
 		fn eth_contract_code(account: H160) -> Option<Vec<u8>> {
 			<pallet_nft::NftErcSupport<Runtime>>::get_code(&account)
 		}
+		fn adminlist(collection: CollectionId) -> Vec<AccountId> {
+			<pallet_nft::Pallet<Runtime>>::adminlist(collection)
+		}
+		fn allowlist(collection: CollectionId) -> Vec<AccountId> {
+			<pallet_nft::Pallet<Runtime>>::allowlist(collection)
+		}
+		fn last_token_id(collection: CollectionId) -> TokenId {
+			dispatch_nft_runtime!(collection.last_token_id())
+		}
 	}
 
 	impl sp_api::Core<Block> for Runtime {