difftreelog
fix dependency versions after rebase
in: master
12 files changed
Cargo.lockdiffbeforeafterboth--- a/Cargo.lock
+++ b/Cargo.lock
@@ -2484,7 +2484,7 @@
[[package]]
name = "fc-consensus"
version = "2.0.0-dev"
-source = "git+https://github.com/uniquenetwork/frontier.git?branch=unique-polkadot-v0.9.18#7c8ce8f83e0c8a5b57655622b721f8655b161903"
+source = "git+https://github.com/uniquenetwork/frontier.git?branch=unique-polkadot-v0.9.18-2#82310d1dd3189f34bd901a9ac894ad33eca5cf89"
dependencies = [
"async-trait",
"derive_more",
@@ -2511,7 +2511,7 @@
[[package]]
name = "fc-db"
version = "2.0.0-dev"
-source = "git+https://github.com/uniquenetwork/frontier.git?branch=unique-polkadot-v0.9.18#7c8ce8f83e0c8a5b57655622b721f8655b161903"
+source = "git+https://github.com/uniquenetwork/frontier.git?branch=unique-polkadot-v0.9.18-2#82310d1dd3189f34bd901a9ac894ad33eca5cf89"
dependencies = [
"fp-storage",
"kvdb",
@@ -2527,7 +2527,7 @@
[[package]]
name = "fc-mapping-sync"
version = "2.0.0-dev"
-source = "git+https://github.com/uniquenetwork/frontier.git?branch=unique-polkadot-v0.9.18#7c8ce8f83e0c8a5b57655622b721f8655b161903"
+source = "git+https://github.com/uniquenetwork/frontier.git?branch=unique-polkadot-v0.9.18-2#82310d1dd3189f34bd901a9ac894ad33eca5cf89"
dependencies = [
"fc-consensus",
"fc-db",
@@ -2545,7 +2545,7 @@
[[package]]
name = "fc-rpc"
version = "2.0.0-dev"
-source = "git+https://github.com/uniquenetwork/frontier.git?branch=unique-polkadot-v0.9.18#7c8ce8f83e0c8a5b57655622b721f8655b161903"
+source = "git+https://github.com/uniquenetwork/frontier.git?branch=unique-polkadot-v0.9.18-2#82310d1dd3189f34bd901a9ac894ad33eca5cf89"
dependencies = [
"ethereum",
"ethereum-types",
@@ -2591,7 +2591,7 @@
[[package]]
name = "fc-rpc-core"
version = "1.1.0-dev"
-source = "git+https://github.com/uniquenetwork/frontier.git?branch=unique-polkadot-v0.9.18#7c8ce8f83e0c8a5b57655622b721f8655b161903"
+source = "git+https://github.com/uniquenetwork/frontier.git?branch=unique-polkadot-v0.9.18-2#82310d1dd3189f34bd901a9ac894ad33eca5cf89"
dependencies = [
"ethereum",
"ethereum-types",
@@ -2725,7 +2725,7 @@
[[package]]
name = "fp-consensus"
version = "2.0.0-dev"
-source = "git+https://github.com/uniquenetwork/frontier.git?branch=unique-polkadot-v0.9.18#7c8ce8f83e0c8a5b57655622b721f8655b161903"
+source = "git+https://github.com/uniquenetwork/frontier.git?branch=unique-polkadot-v0.9.18-2#82310d1dd3189f34bd901a9ac894ad33eca5cf89"
dependencies = [
"ethereum",
"parity-scale-codec",
@@ -2739,7 +2739,7 @@
[[package]]
name = "fp-evm"
version = "3.0.0-dev"
-source = "git+https://github.com/uniquenetwork/frontier.git?branch=unique-polkadot-v0.9.18#7c8ce8f83e0c8a5b57655622b721f8655b161903"
+source = "git+https://github.com/uniquenetwork/frontier.git?branch=unique-polkadot-v0.9.18-2#82310d1dd3189f34bd901a9ac894ad33eca5cf89"
dependencies = [
"evm",
"impl-trait-for-tuples",
@@ -2751,9 +2751,18 @@
]
[[package]]
+name = "fp-evm-mapping"
+version = "0.1.0"
+source = "git+https://github.com/uniquenetwork/frontier.git?branch=unique-polkadot-v0.9.18-2#82310d1dd3189f34bd901a9ac894ad33eca5cf89"
+dependencies = [
+ "frame-support",
+ "sp-core",
+]
+
+[[package]]
name = "fp-rpc"
version = "3.0.0-dev"
-source = "git+https://github.com/uniquenetwork/frontier.git?branch=unique-polkadot-v0.9.18#7c8ce8f83e0c8a5b57655622b721f8655b161903"
+source = "git+https://github.com/uniquenetwork/frontier.git?branch=unique-polkadot-v0.9.18-2#82310d1dd3189f34bd901a9ac894ad33eca5cf89"
dependencies = [
"ethereum",
"ethereum-types",
@@ -2770,7 +2779,7 @@
[[package]]
name = "fp-self-contained"
version = "1.0.0-dev"
-source = "git+https://github.com/uniquenetwork/frontier.git?branch=unique-polkadot-v0.9.18#7c8ce8f83e0c8a5b57655622b721f8655b161903"
+source = "git+https://github.com/uniquenetwork/frontier.git?branch=unique-polkadot-v0.9.18-2#82310d1dd3189f34bd901a9ac894ad33eca5cf89"
dependencies = [
"ethereum",
"frame-support",
@@ -2787,7 +2796,7 @@
[[package]]
name = "fp-storage"
version = "2.0.0"
-source = "git+https://github.com/uniquenetwork/frontier.git?branch=unique-polkadot-v0.9.18#7c8ce8f83e0c8a5b57655622b721f8655b161903"
+source = "git+https://github.com/uniquenetwork/frontier.git?branch=unique-polkadot-v0.9.18-2#82310d1dd3189f34bd901a9ac894ad33eca5cf89"
[[package]]
name = "frame-benchmarking"
@@ -5577,6 +5586,7 @@
"cumulus-primitives-timestamp",
"cumulus-primitives-utility",
"derivative",
+ "fp-evm-mapping",
"fp-rpc",
"fp-self-contained",
"frame-benchmarking",
@@ -5636,7 +5646,6 @@
"substrate-wasm-builder",
"unique-runtime-common",
"up-data-structs",
- "up-evm-mapping",
"up-rpc",
"xcm",
"xcm-builder",
@@ -5835,7 +5844,7 @@
[[package]]
name = "pallet-base-fee"
version = "1.0.0"
-source = "git+https://github.com/uniquenetwork/frontier.git?branch=unique-polkadot-v0.9.18#7c8ce8f83e0c8a5b57655622b721f8655b161903"
+source = "git+https://github.com/uniquenetwork/frontier.git?branch=unique-polkadot-v0.9.18-2#82310d1dd3189f34bd901a9ac894ad33eca5cf89"
dependencies = [
"frame-support",
"frame-system",
@@ -5988,6 +5997,7 @@
version = "0.1.0"
dependencies = [
"evm-coder",
+ "fp-evm-mapping",
"frame-support",
"frame-system",
"pallet-evm",
@@ -5999,7 +6009,6 @@
"sp-runtime",
"sp-std",
"up-data-structs",
- "up-evm-mapping",
]
[[package]]
@@ -6062,13 +6071,14 @@
[[package]]
name = "pallet-ethereum"
version = "4.0.0-dev"
-source = "git+https://github.com/uniquenetwork/frontier.git?branch=unique-polkadot-v0.9.18#7c8ce8f83e0c8a5b57655622b721f8655b161903"
+source = "git+https://github.com/uniquenetwork/frontier.git?branch=unique-polkadot-v0.9.18-2#82310d1dd3189f34bd901a9ac894ad33eca5cf89"
dependencies = [
"ethereum",
"ethereum-types",
"evm",
"fp-consensus",
"fp-evm",
+ "fp-evm-mapping",
"fp-rpc",
"fp-self-contained",
"fp-storage",
@@ -6092,12 +6102,13 @@
[[package]]
name = "pallet-evm"
version = "6.0.0-dev"
-source = "git+https://github.com/uniquenetwork/frontier.git?branch=unique-polkadot-v0.9.18#7c8ce8f83e0c8a5b57655622b721f8655b161903"
+source = "git+https://github.com/uniquenetwork/frontier.git?branch=unique-polkadot-v0.9.18-2#82310d1dd3189f34bd901a9ac894ad33eca5cf89"
dependencies = [
"evm",
"evm-gasometer",
"evm-runtime",
"fp-evm",
+ "fp-evm-mapping",
"frame-benchmarking",
"frame-support",
"frame-system",
@@ -6141,6 +6152,7 @@
version = "0.1.0"
dependencies = [
"evm-coder",
+ "fp-evm-mapping",
"frame-support",
"frame-system",
"log",
@@ -6176,6 +6188,7 @@
version = "0.1.0"
dependencies = [
"fp-evm",
+ "fp-evm-mapping",
"frame-support",
"frame-system",
"pallet-ethereum",
@@ -6186,7 +6199,6 @@
"sp-io",
"sp-runtime",
"sp-std",
- "up-evm-mapping",
"up-sponsorship",
]
@@ -6200,6 +6212,7 @@
"frame-support",
"frame-system",
"pallet-common",
+ "pallet-evm",
"pallet-evm-coder-substrate",
"pallet-structure",
"parity-scale-codec",
@@ -6427,6 +6440,7 @@
"frame-support",
"frame-system",
"pallet-common",
+ "pallet-evm",
"pallet-evm-coder-substrate",
"pallet-structure",
"parity-scale-codec",
@@ -6544,6 +6558,7 @@
"frame-support",
"frame-system",
"pallet-common",
+ "pallet-evm",
"pallet-structure",
"parity-scale-codec",
"scale-info",
@@ -6817,6 +6832,7 @@
"ethereum",
"evm-coder",
"fp-evm",
+ "fp-evm-mapping",
"frame-benchmarking",
"frame-support",
"frame-system",
@@ -6843,7 +6859,6 @@
"sp-runtime",
"sp-std",
"up-data-structs",
- "up-evm-mapping",
"up-sponsorship",
]
@@ -8726,6 +8741,7 @@
"cumulus-primitives-timestamp",
"cumulus-primitives-utility",
"derivative",
+ "fp-evm-mapping",
"fp-rpc",
"fp-self-contained",
"frame-executive",
@@ -8782,7 +8798,6 @@
"substrate-wasm-builder",
"unique-runtime-common",
"up-data-structs",
- "up-evm-mapping",
"up-rpc",
"xcm",
"xcm-builder",
@@ -12380,6 +12395,7 @@
"jsonrpc-core-client",
"jsonrpc-derive",
"pallet-common",
+ "pallet-evm",
"parity-scale-codec",
"sp-api",
"sp-blockchain",
@@ -12591,6 +12607,7 @@
"cumulus-primitives-timestamp",
"cumulus-primitives-utility",
"derivative",
+ "fp-evm-mapping",
"fp-rpc",
"fp-self-contained",
"frame-benchmarking",
@@ -12650,7 +12667,6 @@
"substrate-wasm-builder",
"unique-runtime-common",
"up-data-structs",
- "up-evm-mapping",
"up-rpc",
"xcm",
"xcm-builder",
@@ -12732,6 +12748,7 @@
"derivative",
"frame-support",
"frame-system",
+ "pallet-evm",
"parity-scale-codec",
"scale-info",
"serde",
@@ -12739,17 +12756,6 @@
"sp-runtime",
"sp-std",
"struct-versioning",
- "up-evm-mapping",
-]
-
-[[package]]
-name = "up-evm-mapping"
-version = "0.1.0"
-dependencies = [
- "frame-support",
- "parity-scale-codec",
- "scale-info",
- "sp-core",
]
[[package]]
@@ -12757,6 +12763,7 @@
version = "0.1.0"
dependencies = [
"pallet-common",
+ "pallet-evm",
"parity-scale-codec",
"sp-api",
"sp-core",
client/rpc/src/lib.rsdiffbeforeafterboth1// 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/>.1617use std::sync::Arc;1819use codec::Decode;20use jsonrpc_core::{Error as RpcError, ErrorCode, Result};21use jsonrpc_derive::rpc;22use up_data_structs::{RpcCollection, Collection, CollectionId, CollectionStats, CollectionLimits, TokenId};23use sp_api::{BlockId, BlockT, ProvideRuntimeApi, ApiExt};24use sp_blockchain::HeaderBackend;25use up_rpc::UniqueApi as UniqueRuntimeApi;2627#[rpc]28pub trait UniqueApi<BlockHash, CrossAccountId, AccountId> {29 #[rpc(name = "unique_accountTokens")]30 fn account_tokens(31 &self,32 collection: CollectionId,33 account: CrossAccountId,34 at: Option<BlockHash>,35 ) -> Result<Vec<TokenId>>;36 #[rpc(name = "unique_tokenExists")]37 fn token_exists(38 &self,39 collection: CollectionId,40 token: TokenId,41 at: Option<BlockHash>,42 ) -> Result<bool>;4344 #[rpc(name = "unique_tokenOwner")]45 fn token_owner(46 &self,47 collection: CollectionId,48 token: TokenId,49 at: Option<BlockHash>,50 ) -> Result<Option<CrossAccountId>>;51 #[rpc(name = "unique_constMetadata")]52 fn const_metadata(53 &self,54 collection: CollectionId,55 token: TokenId,56 at: Option<BlockHash>,57 ) -> Result<Vec<u8>>;58 #[rpc(name = "unique_variableMetadata")]59 fn variable_metadata(60 &self,61 collection: CollectionId,62 token: TokenId,63 at: Option<BlockHash>,64 ) -> Result<Vec<u8>>;6566 #[rpc(name = "unique_collectionTokens")]67 fn collection_tokens(&self, collection: CollectionId, at: Option<BlockHash>) -> Result<u32>;68 #[rpc(name = "unique_accountBalance")]69 fn account_balance(70 &self,71 collection: CollectionId,72 account: CrossAccountId,73 at: Option<BlockHash>,74 ) -> Result<u32>;75 #[rpc(name = "unique_balance")]76 fn balance(77 &self,78 collection: CollectionId,79 account: CrossAccountId,80 token: TokenId,81 at: Option<BlockHash>,82 ) -> Result<String>;83 #[rpc(name = "unique_allowance")]84 fn allowance(85 &self,86 collection: CollectionId,87 sender: CrossAccountId,88 spender: CrossAccountId,89 token: TokenId,90 at: Option<BlockHash>,91 ) -> Result<String>;9293 #[rpc(name = "unique_adminlist")]94 fn adminlist(95 &self,96 collection: CollectionId,97 at: Option<BlockHash>,98 ) -> Result<Vec<CrossAccountId>>;99 #[rpc(name = "unique_allowlist")]100 fn allowlist(101 &self,102 collection: CollectionId,103 at: Option<BlockHash>,104 ) -> Result<Vec<CrossAccountId>>;105 #[rpc(name = "unique_allowed")]106 fn allowed(107 &self,108 collection: CollectionId,109 user: CrossAccountId,110 at: Option<BlockHash>,111 ) -> Result<bool>;112 #[rpc(name = "unique_lastTokenId")]113 fn last_token_id(&self, collection: CollectionId, at: Option<BlockHash>) -> Result<TokenId>;114 #[rpc(name = "unique_collectionById")]115 fn collection_by_id(116 &self,117 collection: CollectionId,118 at: Option<BlockHash>,119 ) -> Result<Option<RpcCollection<AccountId>>>;120 #[rpc(name = "unique_collectionStats")]121 fn collection_stats(&self, at: Option<BlockHash>) -> Result<CollectionStats>;122123 #[rpc(name = "unique_nextSponsored")]124 fn next_sponsored(125 &self,126 collection: CollectionId,127 account: CrossAccountId,128 token: TokenId,129 at: Option<BlockHash>,130 ) -> Result<Option<u64>>;131 #[rpc(name = "unique_effectiveCollectionLimits")]132 fn effective_collection_limits(133 &self,134 collection_id: CollectionId,135 at: Option<BlockHash>,136 ) -> Result<Option<CollectionLimits>>;137}138139pub struct Unique<C, P> {140 client: Arc<C>,141 _marker: std::marker::PhantomData<P>,142}143144impl<C, P> Unique<C, P> {145 pub fn new(client: Arc<C>) -> Self {146 Self {147 client,148 _marker: Default::default(),149 }150 }151}152153pub enum Error {154 RuntimeError,155}156157impl From<Error> for i64 {158 fn from(e: Error) -> i64 {159 match e {160 Error::RuntimeError => 1,161 }162 }163}164165macro_rules! pass_method {166 (167 $method_name:ident($($name:ident: $ty:ty),* $(,)?) -> $result:ty $(=> $mapper:expr)?168 $(; changed_in $ver:expr, $changed_method_name:ident ($($changed_name:expr), * $(,)?) => $fixer:expr)*169 ) => {170 fn $method_name(171 &self,172 $(173 $name: $ty,174 )*175 at: Option<<Block as BlockT>::Hash>,176 ) -> Result<$result> {177 let api = self.client.runtime_api();178 let at = BlockId::hash(at.unwrap_or_else(|| self.client.info().best_hash));179 let _api_version = if let Ok(Some(api_version)) =180 api.api_version::<dyn UniqueRuntimeApi<Block, CrossAccountId, AccountId>>(&at)181 {182 api_version183 } else {184 // unreachable for our runtime185 return Err(RpcError {186 code: ErrorCode::InvalidParams,187 message: "Api is not available".into(),188 data: None,189 })190 };191192 let result = $(if _api_version < $ver {193 api.$changed_method_name(&at, $($changed_name),*).map(|r| r.map($fixer))194 } else)*195 { api.$method_name(&at, $($name),*) };196197 let result = result.map_err(|e| RpcError {198 code: ErrorCode::ServerError(Error::RuntimeError.into()),199 message: "Unable to query".into(),200 data: Some(format!("{:?}", e).into()),201 })?;202 result.map_err(|e| RpcError {203 code: ErrorCode::InvalidParams,204 message: "Runtime returned error".into(),205 data: Some(format!("{:?}", e).into()),206 })$(.map($mapper))?207 }208 };209}210211#[allow(deprecated)]212impl<C, Block, CrossAccountId, AccountId>213 UniqueApi<<Block as BlockT>::Hash, CrossAccountId, AccountId> for Unique<C, Block>214where215 Block: BlockT,216 AccountId: Decode,217 C: 'static + ProvideRuntimeApi<Block> + HeaderBackend<Block>,218 C::Api: UniqueRuntimeApi<Block, CrossAccountId, AccountId>,219 CrossAccountId: pallet_evm::account::CrossAccountId<AccountId>,220{221 pass_method!(account_tokens(collection: CollectionId, account: CrossAccountId) -> Vec<TokenId>);222 pass_method!(token_exists(collection: CollectionId, token: TokenId) -> bool);223 pass_method!(224 token_owner(collection: CollectionId, token: TokenId) -> Option<CrossAccountId>;225 changed_in 2, token_owner_before_version_2(collection, token) => |u| Some(u)226 );227 pass_method!(const_metadata(collection: CollectionId, token: TokenId) -> Vec<u8>);228 pass_method!(variable_metadata(collection: CollectionId, token: TokenId) -> Vec<u8>);229 pass_method!(collection_tokens(collection: CollectionId) -> u32);230 pass_method!(account_balance(collection: CollectionId, account: CrossAccountId) -> u32);231 pass_method!(balance(collection: CollectionId, account: CrossAccountId, token: TokenId) -> String => |v| v.to_string());232 pass_method!(allowance(collection: CollectionId, sender: CrossAccountId, spender: CrossAccountId, token: TokenId) -> String => |v| v.to_string());233234 pass_method!(adminlist(collection: CollectionId) -> Vec<CrossAccountId>);235 pass_method!(allowlist(collection: CollectionId) -> Vec<CrossAccountId>);236 pass_method!(allowed(collection: CollectionId, user: CrossAccountId) -> bool);237 pass_method!(last_token_id(collection: CollectionId) -> TokenId);238 pass_method!(collection_by_id(collection: CollectionId) -> Option<RpcCollection<AccountId>>);239 pass_method!(collection_stats() -> CollectionStats);240 pass_method!(next_sponsored(collection: CollectionId, account: CrossAccountId, token: TokenId) -> Option<u64>);241 pass_method!(effective_collection_limits(collection_id: CollectionId) -> Option<CollectionLimits>);242}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/>.1617use std::sync::Arc;1819use codec::Decode;20use jsonrpc_core::{Error as RpcError, ErrorCode, Result};21use jsonrpc_derive::rpc;22use up_data_structs::{RpcCollection, CollectionId, CollectionStats, CollectionLimits, TokenId};23use sp_api::{BlockId, BlockT, ProvideRuntimeApi, ApiExt};24use sp_blockchain::HeaderBackend;25use up_rpc::UniqueApi as UniqueRuntimeApi;2627#[rpc]28pub trait UniqueApi<BlockHash, CrossAccountId, AccountId> {29 #[rpc(name = "unique_accountTokens")]30 fn account_tokens(31 &self,32 collection: CollectionId,33 account: CrossAccountId,34 at: Option<BlockHash>,35 ) -> Result<Vec<TokenId>>;36 #[rpc(name = "unique_tokenExists")]37 fn token_exists(38 &self,39 collection: CollectionId,40 token: TokenId,41 at: Option<BlockHash>,42 ) -> Result<bool>;4344 #[rpc(name = "unique_tokenOwner")]45 fn token_owner(46 &self,47 collection: CollectionId,48 token: TokenId,49 at: Option<BlockHash>,50 ) -> Result<Option<CrossAccountId>>;51 #[rpc(name = "unique_constMetadata")]52 fn const_metadata(53 &self,54 collection: CollectionId,55 token: TokenId,56 at: Option<BlockHash>,57 ) -> Result<Vec<u8>>;58 #[rpc(name = "unique_variableMetadata")]59 fn variable_metadata(60 &self,61 collection: CollectionId,62 token: TokenId,63 at: Option<BlockHash>,64 ) -> Result<Vec<u8>>;6566 #[rpc(name = "unique_collectionTokens")]67 fn collection_tokens(&self, collection: CollectionId, at: Option<BlockHash>) -> Result<u32>;68 #[rpc(name = "unique_accountBalance")]69 fn account_balance(70 &self,71 collection: CollectionId,72 account: CrossAccountId,73 at: Option<BlockHash>,74 ) -> Result<u32>;75 #[rpc(name = "unique_balance")]76 fn balance(77 &self,78 collection: CollectionId,79 account: CrossAccountId,80 token: TokenId,81 at: Option<BlockHash>,82 ) -> Result<String>;83 #[rpc(name = "unique_allowance")]84 fn allowance(85 &self,86 collection: CollectionId,87 sender: CrossAccountId,88 spender: CrossAccountId,89 token: TokenId,90 at: Option<BlockHash>,91 ) -> Result<String>;9293 #[rpc(name = "unique_adminlist")]94 fn adminlist(95 &self,96 collection: CollectionId,97 at: Option<BlockHash>,98 ) -> Result<Vec<CrossAccountId>>;99 #[rpc(name = "unique_allowlist")]100 fn allowlist(101 &self,102 collection: CollectionId,103 at: Option<BlockHash>,104 ) -> Result<Vec<CrossAccountId>>;105 #[rpc(name = "unique_allowed")]106 fn allowed(107 &self,108 collection: CollectionId,109 user: CrossAccountId,110 at: Option<BlockHash>,111 ) -> Result<bool>;112 #[rpc(name = "unique_lastTokenId")]113 fn last_token_id(&self, collection: CollectionId, at: Option<BlockHash>) -> Result<TokenId>;114 #[rpc(name = "unique_collectionById")]115 fn collection_by_id(116 &self,117 collection: CollectionId,118 at: Option<BlockHash>,119 ) -> Result<Option<RpcCollection<AccountId>>>;120 #[rpc(name = "unique_collectionStats")]121 fn collection_stats(&self, at: Option<BlockHash>) -> Result<CollectionStats>;122123 #[rpc(name = "unique_nextSponsored")]124 fn next_sponsored(125 &self,126 collection: CollectionId,127 account: CrossAccountId,128 token: TokenId,129 at: Option<BlockHash>,130 ) -> Result<Option<u64>>;131 #[rpc(name = "unique_effectiveCollectionLimits")]132 fn effective_collection_limits(133 &self,134 collection_id: CollectionId,135 at: Option<BlockHash>,136 ) -> Result<Option<CollectionLimits>>;137}138139pub struct Unique<C, P> {140 client: Arc<C>,141 _marker: std::marker::PhantomData<P>,142}143144impl<C, P> Unique<C, P> {145 pub fn new(client: Arc<C>) -> Self {146 Self {147 client,148 _marker: Default::default(),149 }150 }151}152153pub enum Error {154 RuntimeError,155}156157impl From<Error> for i64 {158 fn from(e: Error) -> i64 {159 match e {160 Error::RuntimeError => 1,161 }162 }163}164165macro_rules! pass_method {166 (167 $method_name:ident($($name:ident: $ty:ty),* $(,)?) -> $result:ty $(=> $mapper:expr)?168 $(; changed_in $ver:expr, $changed_method_name:ident ($($changed_name:expr), * $(,)?) => $fixer:expr)*169 ) => {170 fn $method_name(171 &self,172 $(173 $name: $ty,174 )*175 at: Option<<Block as BlockT>::Hash>,176 ) -> Result<$result> {177 let api = self.client.runtime_api();178 let at = BlockId::hash(at.unwrap_or_else(|| self.client.info().best_hash));179 let _api_version = if let Ok(Some(api_version)) =180 api.api_version::<dyn UniqueRuntimeApi<Block, CrossAccountId, AccountId>>(&at)181 {182 api_version183 } else {184 // unreachable for our runtime185 return Err(RpcError {186 code: ErrorCode::InvalidParams,187 message: "Api is not available".into(),188 data: None,189 })190 };191192 let result = $(if _api_version < $ver {193 api.$changed_method_name(&at, $($changed_name),*).map(|r| r.map($fixer))194 } else)*195 { api.$method_name(&at, $($name),*) };196197 let result = result.map_err(|e| RpcError {198 code: ErrorCode::ServerError(Error::RuntimeError.into()),199 message: "Unable to query".into(),200 data: Some(format!("{:?}", e).into()),201 })?;202 result.map_err(|e| RpcError {203 code: ErrorCode::InvalidParams,204 message: "Runtime returned error".into(),205 data: Some(format!("{:?}", e).into()),206 })$(.map($mapper))?207 }208 };209}210211#[allow(deprecated)]212impl<C, Block, CrossAccountId, AccountId>213 UniqueApi<<Block as BlockT>::Hash, CrossAccountId, AccountId> for Unique<C, Block>214where215 Block: BlockT,216 AccountId: Decode,217 C: 'static + ProvideRuntimeApi<Block> + HeaderBackend<Block>,218 C::Api: UniqueRuntimeApi<Block, CrossAccountId, AccountId>,219 CrossAccountId: pallet_evm::account::CrossAccountId<AccountId>,220{221 pass_method!(account_tokens(collection: CollectionId, account: CrossAccountId) -> Vec<TokenId>);222 pass_method!(token_exists(collection: CollectionId, token: TokenId) -> bool);223 pass_method!(224 token_owner(collection: CollectionId, token: TokenId) -> Option<CrossAccountId>;225 changed_in 2, token_owner_before_version_2(collection, token) => |u| Some(u)226 );227 pass_method!(const_metadata(collection: CollectionId, token: TokenId) -> Vec<u8>);228 pass_method!(variable_metadata(collection: CollectionId, token: TokenId) -> Vec<u8>);229 pass_method!(collection_tokens(collection: CollectionId) -> u32);230 pass_method!(account_balance(collection: CollectionId, account: CrossAccountId) -> u32);231 pass_method!(balance(collection: CollectionId, account: CrossAccountId, token: TokenId) -> String => |v| v.to_string());232 pass_method!(allowance(collection: CollectionId, sender: CrossAccountId, spender: CrossAccountId, token: TokenId) -> String => |v| v.to_string());233234 pass_method!(adminlist(collection: CollectionId) -> Vec<CrossAccountId>);235 pass_method!(allowlist(collection: CollectionId) -> Vec<CrossAccountId>);236 pass_method!(allowed(collection: CollectionId, user: CrossAccountId) -> bool);237 pass_method!(last_token_id(collection: CollectionId) -> TokenId);238 pass_method!(collection_by_id(collection: CollectionId) -> Option<RpcCollection<AccountId>>);239 pass_method!(collection_stats() -> CollectionStats);240 pass_method!(next_sponsored(collection: CollectionId, account: CrossAccountId, token: TokenId) -> Option<u64>);241 pass_method!(effective_collection_limits(collection_id: CollectionId) -> Option<CollectionLimits>);242}pallets/common/src/lib.rsdiffbeforeafterboth--- a/pallets/common/src/lib.rs
+++ b/pallets/common/src/lib.rs
@@ -29,11 +29,13 @@
};
use pallet_evm::GasWeightMapping;
use up_data_structs::{
- COLLECTION_NUMBER_LIMIT, Collection, RpcCollection, CollectionId, CreateItemData, MAX_TOKEN_PREFIX_LENGTH,
- COLLECTION_ADMINS_LIMIT, MetaUpdatePermission, TokenId, CollectionStats, MAX_TOKEN_OWNERSHIP,
- CollectionMode, NFT_SPONSOR_TRANSFER_TIMEOUT, FUNGIBLE_SPONSOR_TRANSFER_TIMEOUT,
- REFUNGIBLE_SPONSOR_TRANSFER_TIMEOUT, MAX_SPONSOR_TIMEOUT, CUSTOM_DATA_LIMIT, CollectionLimits,
- CustomDataLimit, CreateCollectionData, SponsorshipState, CreateItemExData, SponsoringRateLimit, budget::Budget, COLLECTION_FIELD_LIMIT, CollectionField, PhantomType,
+ COLLECTION_NUMBER_LIMIT, Collection, RpcCollection, CollectionId, CreateItemData,
+ MAX_TOKEN_PREFIX_LENGTH, COLLECTION_ADMINS_LIMIT, MetaUpdatePermission, TokenId,
+ CollectionStats, MAX_TOKEN_OWNERSHIP, CollectionMode, NFT_SPONSOR_TRANSFER_TIMEOUT,
+ FUNGIBLE_SPONSOR_TRANSFER_TIMEOUT, REFUNGIBLE_SPONSOR_TRANSFER_TIMEOUT, MAX_SPONSOR_TIMEOUT,
+ CUSTOM_DATA_LIMIT, CollectionLimits, CustomDataLimit, CreateCollectionData, SponsorshipState,
+ CreateItemExData, SponsoringRateLimit, budget::Budget, COLLECTION_FIELD_LIMIT, CollectionField,
+ PhantomType,
};
pub use pallet::*;
use sp_core::H160;
@@ -162,7 +164,6 @@
#[frame_support::pallet]
pub mod pallet {
use super::*;
- use frame_support::{Blake2_128Concat, pallet_prelude::*, storage::Key};
use pallet_evm::account;
use dispatch::CollectionDispatch;
use frame_support::{Blake2_128Concat, pallet_prelude::*, storage::Key, traits::StorageVersion};
@@ -170,7 +171,6 @@
use frame_support::traits::Currency;
use up_data_structs::{TokenId, mapping::TokenAddressMapping};
use scale_info::TypeInfo;
- use up_evm_mapping::CrossAccountId;
#[pallet::config]
pub trait Config:
@@ -519,6 +519,7 @@
owner_can_transfer: Some(limits.owner_can_transfer()),
owner_can_destroy: Some(limits.owner_can_destroy()),
transfers_enabled: Some(limits.transfers_enabled()),
+ nesting_rule: Some(limits.nesting_rule().clone()),
};
Some(effective_limits)
pallets/fungible/src/lib.rsdiffbeforeafterboth--- a/pallets/fungible/src/lib.rs
+++ b/pallets/fungible/src/lib.rs
@@ -24,8 +24,8 @@
budget::Budget,
};
use pallet_common::{
- Error as CommonError, Event as CommonEvent, Pallet as PalletCommon,
- CollectionHandle, dispatch::CollectionDispatch,
+ Error as CommonError, Event as CommonEvent, Pallet as PalletCommon, CollectionHandle,
+ dispatch::CollectionDispatch,
};
use pallet_structure::Pallet as PalletStructure;
use pallet_evm_coder_substrate::WithRecorder;
pallets/nonfungible/src/lib.rsdiffbeforeafterboth--- a/pallets/nonfungible/src/lib.rs
+++ b/pallets/nonfungible/src/lib.rs
@@ -24,8 +24,8 @@
};
use pallet_evm::account::CrossAccountId;
use pallet_common::{
- Error as CommonError, Pallet as PalletCommon, Event as CommonEvent,
- CollectionHandle, dispatch::CollectionDispatch,
+ Error as CommonError, Pallet as PalletCommon, Event as CommonEvent, CollectionHandle,
+ dispatch::CollectionDispatch,
};
use pallet_structure::Pallet as PalletStructure;
use pallet_evm_coder_substrate::{SubstrateRecorder, WithRecorder};
pallets/refungible/src/lib.rsdiffbeforeafterboth--- a/pallets/refungible/src/lib.rs
+++ b/pallets/refungible/src/lib.rs
@@ -23,8 +23,8 @@
};
use pallet_evm::account::CrossAccountId;
use pallet_common::{
- Error as CommonError, Event as CommonEvent, Pallet as PalletCommon,
- CollectionHandle, dispatch::CollectionDispatch,
+ Error as CommonError, Event as CommonEvent, Pallet as PalletCommon, CollectionHandle,
+ dispatch::CollectionDispatch,
};
use pallet_structure::Pallet as PalletStructure;
use sp_runtime::{ArithmeticError, DispatchError, DispatchResult};
pallets/unique/src/eth/sponsoring.rsdiffbeforeafterboth--- a/pallets/unique/src/eth/sponsoring.rs
+++ b/pallets/unique/src/eth/sponsoring.rs
@@ -31,7 +31,6 @@
UniqueNFTCall, ERC721UniqueExtensionsCall, ERC721MintableCall, ERC721Call,
};
use pallet_fungible::erc::{UniqueFungibleCall, ERC20Call};
-use up_data_structs::{TokenId, CreateItemData, CreateNftData};
pub struct UniqueEthSponsorshipHandler<T: Config>(PhantomData<*const T>);
impl<T: Config> SponsorshipHandler<T::CrossAccountId, (H160, Vec<u8>)>
primitives/data-structs/Cargo.tomldiffbeforeafterboth--- a/primitives/data-structs/Cargo.toml
+++ b/primitives/data-structs/Cargo.toml
@@ -25,6 +25,7 @@
sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.20" }
derivative = "2.2.0"
struct-versioning = { path = "../../crates/struct-versioning" }
+pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.18-2" }
[features]
default = ["std"]
@@ -37,6 +38,7 @@
"sp-runtime/std",
"sp-core/std",
"sp-std/std",
+ "pallet-evm/std",
]
serde1 = ["serde"]
limit-testing = []
primitives/data-structs/src/mapping.rsdiffbeforeafterboth--- a/primitives/data-structs/src/mapping.rs
+++ b/primitives/data-structs/src/mapping.rs
@@ -3,7 +3,7 @@
use sp_core::H160;
use crate::{CollectionId, TokenId};
-use up_evm_mapping::CrossAccountId;
+use pallet_evm::account::CrossAccountId;
pub trait TokenAddressMapping<Address> {
fn token_to_address(collection: CollectionId, token: TokenId) -> Address;
primitives/rpc/src/lib.rsdiffbeforeafterboth--- a/primitives/rpc/src/lib.rs
+++ b/primitives/rpc/src/lib.rs
@@ -16,7 +16,7 @@
#![cfg_attr(not(feature = "std"), no_std)]
-use up_data_structs::{CollectionId, TokenId, RpcCollection, Collection, CollectionStats, CollectionLimits};
+use up_data_structs::{CollectionId, TokenId, RpcCollection, CollectionStats, CollectionLimits};
use sp_std::vec::Vec;
use codec::Decode;
use sp_runtime::DispatchError;
runtime/common/Cargo.tomldiffbeforeafterboth--- a/runtime/common/Cargo.toml
+++ b/runtime/common/Cargo.toml
@@ -93,11 +93,6 @@
default-features = false
path = "../../primitives/data-structs"
-[dependencies.pallet-evm]
-default-features = false
-git = "https://github.com/uniquenetwork/frontier.git"
-branch = "unique-polkadot-v0.9.18"
-
[dependencies.sp-consensus-aura]
default-features = false
git = "https://github.com/paritytech/substrate"
runtime/opal/src/lib.rsdiffbeforeafterboth--- a/runtime/opal/src/lib.rs
+++ b/runtime/opal/src/lib.rs
@@ -67,7 +67,7 @@
},
};
use up_data_structs::mapping::{EvmTokenAddressMapping, CrossTokenAddressMapping};
-use up_data_structs::{CollectionId, TokenId, CollectionStats, RpcCollection};
+use up_data_structs::{CollectionId, TokenId, CollectionStats, CollectionLimits, RpcCollection};
// use pallet_contracts::weights::WeightInfo;
// #[cfg(any(feature = "std", test))]
use frame_system::{