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
--- a/pallets/fungible/src/common.rs
+++ b/pallets/fungible/src/common.rs
@@ -177,6 +177,10 @@
 		token == TokenId::default()
 	}
 
+	fn last_token_id(&self) -> TokenId {
+		TokenId::default()
+	}
+
 	fn token_owner(&self, _token: TokenId) -> T::CrossAccountId {
 		T::CrossAccountId::default()
 	}
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
before · pallets/nonfungible/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::DispatchError;9use sp_std::vec::Vec;1011use crate::{12	AccountBalance, Allowance, Config, CreateItemData, DataKind, Error, NonfungibleHandle, Owned,13	Owner, Pallet, SelfWeightOf, TokenData, weights::WeightInfo,14};1516pub struct CommonWeights<T: Config>(PhantomData<T>);17impl<T: Config> CommonWeightInfo for CommonWeights<T> {18	fn create_item() -> Weight {19		<SelfWeightOf<T>>::create_item()20	}2122	fn create_multiple_items(amount: u32) -> Weight {23		<SelfWeightOf<T>>::create_multiple_items(amount)24	}2526	fn burn_item() -> Weight {27		<SelfWeightOf<T>>::burn_item()28	}2930	fn transfer() -> Weight {31		<SelfWeightOf<T>>::transfer()32	}3334	fn approve() -> Weight {35		<SelfWeightOf<T>>::approve()36	}3738	fn transfer_from() -> Weight {39		<SelfWeightOf<T>>::transfer_from()40	}4142	fn set_variable_metadata(_bytes: u32) -> Weight {43		<SelfWeightOf<T>>::set_variable_metadata()44	}45}4647fn map_create_data<T: Config>(48	data: nft_data_structs::CreateItemData,49	to: &T::CrossAccountId,50) -> Result<CreateItemData<T>, DispatchError> {51	match data {52		nft_data_structs::CreateItemData::NFT(data) => Ok(CreateItemData {53			const_data: data.const_data,54			variable_data: data.variable_data,55			owner: to.clone(),56		}),57		_ => fail!(<Error<T>>::NotNonfungibleDataUsedToMintFungibleCollectionToken),58	}59}6061impl<T: Config> CommonCollectionOperations<T> for NonfungibleHandle<T> {62	fn create_item(63		&self,64		sender: T::CrossAccountId,65		to: T::CrossAccountId,66		data: nft_data_structs::CreateItemData,67	) -> DispatchResultWithPostInfo {68		with_weight(69			<Pallet<T>>::create_item(self, &sender, map_create_data(data, &to)?),70			<SelfWeightOf<T>>::create_item(),71		)72	}7374	fn create_multiple_items(75		&self,76		sender: T::CrossAccountId,77		to: T::CrossAccountId,78		data: Vec<nft_data_structs::CreateItemData>,79	) -> DispatchResultWithPostInfo {80		let data = data81			.into_iter()82			.map(|d| map_create_data::<T>(d, &to))83			.collect::<Result<Vec<_>, DispatchError>>()?;8485		let amount = data.len();86		with_weight(87			<Pallet<T>>::create_multiple_items(self, &sender, data),88			<SelfWeightOf<T>>::create_multiple_items(amount as u32),89		)90	}9192	fn burn_item(93		&self,94		sender: T::CrossAccountId,95		token: TokenId,96		amount: u128,97	) -> DispatchResultWithPostInfo {98		ensure!(amount <= 1, <Error<T>>::NonfungibleItemsHaveNoAmount);99		if amount == 1 {100			with_weight(101				<Pallet<T>>::burn(&self, &sender, token),102				<SelfWeightOf<T>>::burn_item(),103			)104		} else {105			Ok(().into())106		}107	}108109	fn transfer(110		&self,111		from: T::CrossAccountId,112		to: T::CrossAccountId,113		token: TokenId,114		amount: u128,115	) -> DispatchResultWithPostInfo {116		ensure!(amount <= 1, <Error<T>>::NonfungibleItemsHaveNoAmount);117		if amount == 1 {118			with_weight(119				<Pallet<T>>::transfer(&self, &from, &to, token),120				<SelfWeightOf<T>>::transfer(),121			)122		} else {123			Ok(().into())124		}125	}126127	fn approve(128		&self,129		sender: T::CrossAccountId,130		spender: T::CrossAccountId,131		token: TokenId,132		amount: u128,133	) -> DispatchResultWithPostInfo {134		ensure!(amount <= 1, <Error<T>>::NonfungibleItemsHaveNoAmount);135136		with_weight(137			if amount == 1 {138				<Pallet<T>>::set_allowance(&self, &sender, token, Some(&spender))139			} else {140				<Pallet<T>>::set_allowance(&self, &sender, token, None)141			},142			<SelfWeightOf<T>>::approve(),143		)144	}145146	fn transfer_from(147		&self,148		sender: T::CrossAccountId,149		from: T::CrossAccountId,150		to: T::CrossAccountId,151		token: TokenId,152		amount: u128,153	) -> DispatchResultWithPostInfo {154		ensure!(amount <= 1, <Error<T>>::NonfungibleItemsHaveNoAmount);155156		if amount == 1 {157			with_weight(158				<Pallet<T>>::transfer_from(&self, &sender, &from, &to, token),159				<SelfWeightOf<T>>::transfer_from(),160			)161		} else {162			Ok(().into())163		}164	}165166	fn set_variable_metadata(167		&self,168		sender: T::CrossAccountId,169		token: TokenId,170		data: Vec<u8>,171	) -> DispatchResultWithPostInfo {172		with_weight(173			<Pallet<T>>::set_variable_metadata(&self, &sender, token, data),174			<SelfWeightOf<T>>::set_variable_metadata(),175		)176	}177178	fn account_tokens(&self, account: T::CrossAccountId) -> Vec<TokenId> {179		<Owned<T>>::iter_prefix((self.id, account.as_sub()))180			.map(|(id, _)| id)181			.collect()182	}183184	fn token_exists(&self, token: TokenId) -> bool {185		<Pallet<T>>::token_exists(self, token)186	}187188	fn token_owner(&self, token: TokenId) -> T::CrossAccountId {189		<Owner<T>>::get((self.id, token))190	}191	fn const_metadata(&self, token: TokenId) -> Vec<u8> {192		<TokenData<T>>::get((self.id, token, DataKind::Constant))193	}194	fn variable_metadata(&self, token: TokenId) -> Vec<u8> {195		<TokenData<T>>::get((self.id, token, DataKind::Variable))196	}197198	fn collection_tokens(&self) -> u32 {199		<Pallet<T>>::total_supply(self)200	}201202	fn account_balance(&self, account: T::CrossAccountId) -> u32 {203		<AccountBalance<T>>::get((self.id, account.as_sub()))204	}205206	fn balance(&self, account: T::CrossAccountId, token: TokenId) -> u128 {207		if <Owner<T>>::get((self.id, token)) == account {208			1209		} else {210			0211		}212	}213214	fn allowance(215		&self,216		sender: T::CrossAccountId,217		spender: T::CrossAccountId,218		token: TokenId,219	) -> u128 {220		if <Owner<T>>::get((self.id, token)) != sender {221			0222		} else if <Allowance<T>>::get((self.id, token)) == Some(spender) {223			1224		} else {225			0226		}227	}228}
after · pallets/nonfungible/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::DispatchError;9use sp_std::vec::Vec;1011use crate::{12	AccountBalance, Allowance, Config, CreateItemData, DataKind, Error, NonfungibleHandle, Owned,13	Owner, Pallet, SelfWeightOf, TokenData, weights::WeightInfo,14};1516pub struct CommonWeights<T: Config>(PhantomData<T>);17impl<T: Config> CommonWeightInfo for CommonWeights<T> {18	fn create_item() -> Weight {19		<SelfWeightOf<T>>::create_item()20	}2122	fn create_multiple_items(amount: u32) -> Weight {23		<SelfWeightOf<T>>::create_multiple_items(amount)24	}2526	fn burn_item() -> Weight {27		<SelfWeightOf<T>>::burn_item()28	}2930	fn transfer() -> Weight {31		<SelfWeightOf<T>>::transfer()32	}3334	fn approve() -> Weight {35		<SelfWeightOf<T>>::approve()36	}3738	fn transfer_from() -> Weight {39		<SelfWeightOf<T>>::transfer_from()40	}4142	fn set_variable_metadata(_bytes: u32) -> Weight {43		<SelfWeightOf<T>>::set_variable_metadata()44	}45}4647fn map_create_data<T: Config>(48	data: nft_data_structs::CreateItemData,49	to: &T::CrossAccountId,50) -> Result<CreateItemData<T>, DispatchError> {51	match data {52		nft_data_structs::CreateItemData::NFT(data) => Ok(CreateItemData {53			const_data: data.const_data,54			variable_data: data.variable_data,55			owner: to.clone(),56		}),57		_ => fail!(<Error<T>>::NotNonfungibleDataUsedToMintFungibleCollectionToken),58	}59}6061impl<T: Config> CommonCollectionOperations<T> for NonfungibleHandle<T> {62	fn create_item(63		&self,64		sender: T::CrossAccountId,65		to: T::CrossAccountId,66		data: nft_data_structs::CreateItemData,67	) -> DispatchResultWithPostInfo {68		with_weight(69			<Pallet<T>>::create_item(self, &sender, map_create_data(data, &to)?),70			<SelfWeightOf<T>>::create_item(),71		)72	}7374	fn create_multiple_items(75		&self,76		sender: T::CrossAccountId,77		to: T::CrossAccountId,78		data: Vec<nft_data_structs::CreateItemData>,79	) -> DispatchResultWithPostInfo {80		let data = data81			.into_iter()82			.map(|d| map_create_data::<T>(d, &to))83			.collect::<Result<Vec<_>, DispatchError>>()?;8485		let amount = data.len();86		with_weight(87			<Pallet<T>>::create_multiple_items(self, &sender, data),88			<SelfWeightOf<T>>::create_multiple_items(amount as u32),89		)90	}9192	fn burn_item(93		&self,94		sender: T::CrossAccountId,95		token: TokenId,96		amount: u128,97	) -> DispatchResultWithPostInfo {98		ensure!(amount <= 1, <Error<T>>::NonfungibleItemsHaveNoAmount);99		if amount == 1 {100			with_weight(101				<Pallet<T>>::burn(&self, &sender, token),102				<SelfWeightOf<T>>::burn_item(),103			)104		} else {105			Ok(().into())106		}107	}108109	fn transfer(110		&self,111		from: T::CrossAccountId,112		to: T::CrossAccountId,113		token: TokenId,114		amount: u128,115	) -> DispatchResultWithPostInfo {116		ensure!(amount <= 1, <Error<T>>::NonfungibleItemsHaveNoAmount);117		if amount == 1 {118			with_weight(119				<Pallet<T>>::transfer(&self, &from, &to, token),120				<SelfWeightOf<T>>::transfer(),121			)122		} else {123			Ok(().into())124		}125	}126127	fn approve(128		&self,129		sender: T::CrossAccountId,130		spender: T::CrossAccountId,131		token: TokenId,132		amount: u128,133	) -> DispatchResultWithPostInfo {134		ensure!(amount <= 1, <Error<T>>::NonfungibleItemsHaveNoAmount);135136		with_weight(137			if amount == 1 {138				<Pallet<T>>::set_allowance(&self, &sender, token, Some(&spender))139			} else {140				<Pallet<T>>::set_allowance(&self, &sender, token, None)141			},142			<SelfWeightOf<T>>::approve(),143		)144	}145146	fn transfer_from(147		&self,148		sender: T::CrossAccountId,149		from: T::CrossAccountId,150		to: T::CrossAccountId,151		token: TokenId,152		amount: u128,153	) -> DispatchResultWithPostInfo {154		ensure!(amount <= 1, <Error<T>>::NonfungibleItemsHaveNoAmount);155156		if amount == 1 {157			with_weight(158				<Pallet<T>>::transfer_from(&self, &sender, &from, &to, token),159				<SelfWeightOf<T>>::transfer_from(),160			)161		} else {162			Ok(().into())163		}164	}165166	fn set_variable_metadata(167		&self,168		sender: T::CrossAccountId,169		token: TokenId,170		data: Vec<u8>,171	) -> DispatchResultWithPostInfo {172		with_weight(173			<Pallet<T>>::set_variable_metadata(&self, &sender, token, data),174			<SelfWeightOf<T>>::set_variable_metadata(),175		)176	}177178	fn account_tokens(&self, account: T::CrossAccountId) -> Vec<TokenId> {179		<Owned<T>>::iter_prefix((self.id, account.as_sub()))180			.map(|(id, _)| id)181			.collect()182	}183184	fn token_exists(&self, token: TokenId) -> bool {185		<Pallet<T>>::token_exists(self, token)186	}187188	fn last_token_id(&self) -> TokenId {189		TokenId(<TokensMinted<T>>::get(self.id))190	}191192	fn token_owner(&self, token: TokenId) -> T::CrossAccountId {193		<Owner<T>>::get((self.id, token))194	}195	fn const_metadata(&self, token: TokenId) -> Vec<u8> {196		<TokenData<T>>::get((self.id, token, DataKind::Constant))197	}198	fn variable_metadata(&self, token: TokenId) -> Vec<u8> {199		<TokenData<T>>::get((self.id, token, DataKind::Variable))200	}201202	fn collection_tokens(&self) -> u32 {203		<Pallet<T>>::total_supply(self)204	}205206	fn account_balance(&self, account: T::CrossAccountId) -> u32 {207		<AccountBalance<T>>::get((self.id, account.as_sub()))208	}209210	fn balance(&self, account: T::CrossAccountId, token: TokenId) -> u128 {211		if <Owner<T>>::get((self.id, token)) == account {212			1213		} else {214			0215		}216	}217218	fn allowance(219		&self,220		sender: T::CrossAccountId,221		spender: T::CrossAccountId,222		token: TokenId,223	) -> u128 {224		if <Owner<T>>::get((self.id, token)) != sender {225			0226		} else if <Allowance<T>>::get((self.id, token)) == Some(spender) {227			1228		} else {229			0230		}231	}232}
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 {