git.delta.rocks / unique-network / refs/commits / 5e8916aa3a6c

difftreelog

source

primitives/rpc/src/lib.rs2.6 KiBsourcehistory
1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617#![cfg_attr(not(feature = "std"), no_std)]1819use up_data_structs::{CollectionId, TokenId, Collection, CollectionStats};20use sp_std::vec::Vec;21use sp_core::H160;22use codec::Decode;23use sp_runtime::DispatchError;2425type Result<T> = core::result::Result<T, DispatchError>;2627sp_api::decl_runtime_apis! {28	#[api_version(2)]29	pub trait UniqueApi<CrossAccountId, AccountId> where30		AccountId: Decode,31		CrossAccountId: pallet_common::account::CrossAccountId<AccountId>,32	{33		#[changed_in(2)]34		fn token_owner(collection: CollectionId, token: TokenId) -> Result<CrossAccountId>;3536		fn account_tokens(collection: CollectionId, account: CrossAccountId) -> Result<Vec<TokenId>>;37		fn token_exists(collection: CollectionId, token: TokenId) -> Result<bool>;3839		fn token_owner(collection: CollectionId, token: TokenId) -> Result<Option<CrossAccountId>>;40		fn const_metadata(collection: CollectionId, token: TokenId) -> Result<Vec<u8>>;41		fn variable_metadata(collection: CollectionId, token: TokenId) -> Result<Vec<u8>>;4243		fn collection_tokens(collection: CollectionId) -> Result<u32>;44		fn account_balance(collection: CollectionId, account: CrossAccountId) -> Result<u32>;45		fn balance(collection: CollectionId, account: CrossAccountId, token: TokenId) -> Result<u128>;46		fn allowance(47			collection: CollectionId,48			sender: CrossAccountId,49			spender: CrossAccountId,50			token: TokenId,51		) -> Result<u128>;5253		/// Used for ethereum integration54		fn eth_contract_code(account: H160) -> Option<Vec<u8>>;5556		fn adminlist(collection: CollectionId) -> Result<Vec<CrossAccountId>>;57		fn allowlist(collection: CollectionId) -> Result<Vec<CrossAccountId>>;58		fn allowed(collection: CollectionId, user: CrossAccountId) -> Result<bool>;59		fn last_token_id(collection: CollectionId) -> Result<TokenId>;60		fn collection_by_id(collection: CollectionId) -> Result<Option<Collection<AccountId>>>;61		fn collection_stats() -> Result<CollectionStats>;62	}63}