difftreelog
feat Separate rpc calls to own group
in: master
31 files changed
Cargo.lockdiffbeforeafterboth--- a/Cargo.lock
+++ b/Cargo.lock
@@ -113,6 +113,20 @@
checksum = "508b352bb5c066aac251f6daf6b36eccd03e8a88e8081cd44959ea277a3af9a8"
[[package]]
+name = "app-promotion-rpc"
+version = "0.1.0"
+dependencies = [
+ "pallet-common",
+ "pallet-evm",
+ "parity-scale-codec 3.1.5",
+ "sp-api",
+ "sp-core",
+ "sp-runtime",
+ "sp-std",
+ "up-data-structs",
+]
+
+[[package]]
name = "approx"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -5127,6 +5141,7 @@
name = "opal-runtime"
version = "0.9.27"
dependencies = [
+ "app-promotion-rpc",
"cumulus-pallet-aura-ext",
"cumulus-pallet-dmp-queue",
"cumulus-pallet-parachain-system",
@@ -8358,6 +8373,7 @@
name = "quartz-runtime"
version = "0.9.27"
dependencies = [
+ "app-promotion-rpc",
"cumulus-pallet-aura-ext",
"cumulus-pallet-dmp-queue",
"cumulus-pallet-parachain-system",
@@ -8381,6 +8397,7 @@
"hex-literal",
"log",
"orml-vesting",
+ "pallet-app-promotion",
"pallet-aura",
"pallet-balances",
"pallet-base-fee",
@@ -12132,6 +12149,7 @@
version = "0.1.3"
dependencies = [
"anyhow",
+ "app-promotion-rpc",
"jsonrpsee",
"pallet-common",
"pallet-evm",
@@ -12210,6 +12228,7 @@
name = "unique-node"
version = "0.9.27"
dependencies = [
+ "app-promotion-rpc",
"clap",
"cumulus-client-cli",
"cumulus-client-collator",
@@ -12298,6 +12317,7 @@
name = "unique-rpc"
version = "0.1.1"
dependencies = [
+ "app-promotion-rpc",
"fc-db",
"fc-mapping-sync",
"fc-rpc",
@@ -12347,6 +12367,7 @@
name = "unique-runtime"
version = "0.9.27"
dependencies = [
+ "app-promotion-rpc",
"cumulus-pallet-aura-ext",
"cumulus-pallet-dmp-queue",
"cumulus-pallet-parachain-system",
@@ -12370,6 +12391,7 @@
"hex-literal",
"log",
"orml-vesting",
+ "pallet-app-promotion",
"pallet-aura",
"pallet-balances",
"pallet-base-fee",
client/rpc/Cargo.tomldiffbeforeafterboth--- a/client/rpc/Cargo.toml
+++ b/client/rpc/Cargo.toml
@@ -8,6 +8,7 @@
pallet-common = { default-features = false, path = '../../pallets/common' }
up-data-structs = { default-features = false, path = '../../primitives/data-structs' }
up-rpc = { path = "../../primitives/rpc" }
+app-promotion-rpc = { path = "../../primitives/app_promotion_rpc"}
rmrk-rpc = { path = "../../primitives/rmrk-rpc" }
codec = { package = "parity-scale-codec", version = "3.1.2" }
jsonrpsee = { version = "0.14.0", features = ["server", "macros"] }
client/rpc/src/lib.rsdiffbeforeafterboth--- a/client/rpc/src/lib.rs
+++ b/client/rpc/src/lib.rs
@@ -31,6 +31,7 @@
use sp_api::{BlockId, BlockT, ProvideRuntimeApi, ApiExt};
use sp_blockchain::HeaderBackend;
use up_rpc::UniqueApi as UniqueRuntimeApi;
+use app_promotion_rpc::AppPromotionApi as AppPromotionRuntimeApi;
// RMRK
use rmrk_rpc::RmrkApi as RmrkRuntimeApi;
@@ -38,6 +39,7 @@
RmrkCollectionId, RmrkNftId, RmrkBaseId, RmrkNftChild, RmrkThemeName, RmrkResourceId,
};
+pub use app_promotion_unique_rpc::AppPromotionApiServer;
pub use rmrk_unique_rpc::RmrkApiServer;
#[rpc(server)]
@@ -244,39 +246,48 @@
token_id: TokenId,
at: Option<BlockHash>,
) -> Result<Option<String>>;
+}
+
+mod app_promotion_unique_rpc {
+ use super::*;
+
+ #[rpc(server)]
+ #[async_trait]
+ pub trait AppPromotionApi<BlockHash, BlockNumber, CrossAccountId, AccountId> {
+ /// Returns the total amount of staked tokens.
+ #[method(name = "appPromotion_totalStaked")]
+ fn total_staked(&self, staker: Option<CrossAccountId>, at: Option<BlockHash>)
+ -> Result<String>;
- /// Returns the total amount of staked tokens.
- #[method(name = "unique_totalStaked")]
- fn total_staked(&self, staker: Option<CrossAccountId>, at: Option<BlockHash>)
- -> Result<String>;
+ ///Returns the total amount of staked tokens per block when staked.
+ #[method(name = "appPromotion_totalStakedPerBlock")]
+ fn total_staked_per_block(
+ &self,
+ staker: CrossAccountId,
+ at: Option<BlockHash>,
+ ) -> Result<Vec<(BlockNumber, String)>>;
- ///Returns the total amount of staked tokens per block when staked.
- #[method(name = "unique_totalStakedPerBlock")]
- fn total_staked_per_block(
- &self,
- staker: CrossAccountId,
- at: Option<BlockHash>,
- ) -> Result<Vec<(BlockNumber, String)>>;
+ /// Returns the total amount locked by staking tokens.
+ #[method(name = "appPromotion_totalStakingLocked")]
+ fn total_staking_locked(&self, staker: CrossAccountId, at: Option<BlockHash>)
+ -> Result<String>;
- /// Returns the total amount locked by staking tokens.
- #[method(name = "unique_totalStakingLocked")]
- fn total_staking_locked(&self, staker: CrossAccountId, at: Option<BlockHash>)
- -> Result<String>;
+ /// Returns the total amount of tokens pending withdrawal from staking.
+ #[method(name = "appPromotion_pendingUnstake")]
+ fn pending_unstake(
+ &self,
+ staker: Option<CrossAccountId>,
+ at: Option<BlockHash>,
+ ) -> Result<String>;
- /// Returns the total amount of tokens pending withdrawal from staking.
- #[method(name = "unique_pendingUnstake")]
- fn pending_unstake(
- &self,
- staker: Option<CrossAccountId>,
- at: Option<BlockHash>,
- ) -> Result<String>;
- /// Returns the total amount of tokens pending withdrawal from staking per block.
- #[method(name = "unique_pendingUnstakePerBlock")]
- fn pending_unstake_per_block(
- &self,
- staker: CrossAccountId,
- at: Option<BlockHash>,
- ) -> Result<Vec<(BlockNumber, String)>>;
+ /// Returns the total amount of tokens pending withdrawal from staking per block.
+ #[method(name = "appPromotion_pendingUnstakePerBlock")]
+ fn pending_unstake_per_block(
+ &self,
+ staker: CrossAccountId,
+ at: Option<BlockHash>,
+ ) -> Result<Vec<(BlockNumber, String)>>;
+ }
}
mod rmrk_unique_rpc {
@@ -415,6 +426,20 @@
}
}
+pub struct AppPromotion<C, P> {
+ client: Arc<C>,
+ _marker: std::marker::PhantomData<P>,
+}
+
+impl<C, P> AppPromotion<C, P> {
+ pub fn new(client: Arc<C>) -> Self {
+ Self {
+ client,
+ _marker: Default::default(),
+ }
+ }
+}
+
pub struct Rmrk<C, P> {
client: Arc<C>,
_marker: std::marker::PhantomData<P>,
@@ -474,6 +499,12 @@
};
}
+macro_rules! app_promotion_api {
+ () => {
+ dyn AppPromotionRuntimeApi<Block, BlockNumber, CrossAccountId, AccountId>
+ };
+}
+
macro_rules! rmrk_api {
() => {
dyn RmrkRuntimeApi<Block, AccountId, CollectionInfo, NftInfo, ResourceInfo, PropertyInfo, BaseInfo, PartType, Theme>
@@ -556,7 +587,20 @@
pass_method!(effective_collection_limits(collection_id: CollectionId) -> Option<CollectionLimits>, unique_api);
pass_method!(total_pieces(collection_id: CollectionId, token_id: TokenId) -> Option<String> => |o| o.map(|number| number.to_string()) , unique_api);
pass_method!(token_owners(collection: CollectionId, token: TokenId) -> Vec<CrossAccountId>, unique_api);
- pass_method!(total_staked(staker: Option<CrossAccountId>) -> String => |v| v.to_string(), unique_api);
+}
+
+impl<C, Block, BlockNumber, CrossAccountId, AccountId>
+ app_promotion_unique_rpc::AppPromotionApiServer<<Block as BlockT>::Hash, BlockNumber, CrossAccountId, AccountId>
+ for AppPromotion<C, Block>
+where
+ Block: BlockT,
+ BlockNumber: Decode + Member + AtLeast32BitUnsigned,
+ AccountId: Decode,
+ C: 'static + ProvideRuntimeApi<Block> + HeaderBackend<Block>,
+ C::Api: AppPromotionRuntimeApi<Block, BlockNumber, CrossAccountId, AccountId>,
+ CrossAccountId: pallet_evm::account::CrossAccountId<AccountId>,
+{
+ pass_method!(total_staked(staker: Option<CrossAccountId>) -> String => |v| v.to_string(), app_promotion_api);
pass_method!(total_staked_per_block(staker: CrossAccountId) -> Vec<(BlockNumber, String)> =>
|v| v
.into_iter()
node/cli/Cargo.tomldiffbeforeafterboth1################################################################################2# Build Dependencies34[build-dependencies.substrate-build-script-utils]5git = "https://github.com/paritytech/substrate"6branch = "polkadot-v0.9.27"78################################################################################9# Substrate Dependecies1011[dependencies.codec]12default-features = false13features = ['derive']14package = 'parity-scale-codec'15version = '3.1.2'1617[dependencies.frame-benchmarking]18git = "https://github.com/paritytech/substrate"19branch = "polkadot-v0.9.27"2021[dependencies.frame-benchmarking-cli]22git = "https://github.com/paritytech/substrate"23branch = "polkadot-v0.9.27"2425[dependencies.try-runtime-cli]26git = "https://github.com/paritytech/substrate"27branch = "polkadot-v0.9.27"2829[dependencies.pallet-transaction-payment-rpc]30git = "https://github.com/paritytech/substrate"31branch = "polkadot-v0.9.27"3233[dependencies.substrate-prometheus-endpoint]34git = "https://github.com/paritytech/substrate"35branch = "polkadot-v0.9.27"3637[dependencies.sc-basic-authorship]38git = "https://github.com/paritytech/substrate"39branch = "polkadot-v0.9.27"4041[dependencies.sc-chain-spec]42git = "https://github.com/paritytech/substrate"43branch = "polkadot-v0.9.27"4445[dependencies.sc-cli]46features = ['wasmtime']47git = "https://github.com/paritytech/substrate"48branch = "polkadot-v0.9.27"4950[dependencies.sc-client-api]51git = "https://github.com/paritytech/substrate"52branch = "polkadot-v0.9.27"5354[dependencies.sc-consensus]55git = "https://github.com/paritytech/substrate"56branch = "polkadot-v0.9.27"5758[dependencies.sc-consensus-aura]59git = "https://github.com/paritytech/substrate"60branch = "polkadot-v0.9.27"6162[dependencies.sc-executor]63features = ['wasmtime']64git = "https://github.com/paritytech/substrate"65branch = "polkadot-v0.9.27"6667[dependencies.sc-finality-grandpa]68git = "https://github.com/paritytech/substrate"69branch = "polkadot-v0.9.27"7071[dependencies.sc-keystore]72git = "https://github.com/paritytech/substrate"73branch = "polkadot-v0.9.27"7475[dependencies.sc-rpc]76git = "https://github.com/paritytech/substrate"77branch = "polkadot-v0.9.27"7879[dependencies.sc-rpc-api]80git = "https://github.com/paritytech/substrate"81branch = "polkadot-v0.9.27"8283[dependencies.sc-service]84features = ['wasmtime']85git = "https://github.com/paritytech/substrate"86branch = "polkadot-v0.9.27"8788[dependencies.sc-telemetry]89git = "https://github.com/paritytech/substrate"90branch = "polkadot-v0.9.27"9192[dependencies.sc-transaction-pool]93git = "https://github.com/paritytech/substrate"94branch = "polkadot-v0.9.27"9596[dependencies.sc-tracing]97git = "https://github.com/paritytech/substrate"98branch = "polkadot-v0.9.27"99100[dependencies.sc-sysinfo]101git = "https://github.com/paritytech/substrate"102branch = "polkadot-v0.9.27"103104[dependencies.sp-block-builder]105git = "https://github.com/paritytech/substrate"106branch = "polkadot-v0.9.27"107108[dependencies.sp-api]109git = "https://github.com/paritytech/substrate"110branch = "polkadot-v0.9.27"111112[dependencies.sp-blockchain]113git = "https://github.com/paritytech/substrate"114branch = "polkadot-v0.9.27"115116[dependencies.sp-consensus]117git = "https://github.com/paritytech/substrate"118branch = "polkadot-v0.9.27"119120[dependencies.sp-consensus-aura]121git = "https://github.com/paritytech/substrate"122branch = "polkadot-v0.9.27"123124[dependencies.sp-core]125git = "https://github.com/paritytech/substrate"126branch = "polkadot-v0.9.27"127128[dependencies.sp-finality-grandpa]129git = "https://github.com/paritytech/substrate"130branch = "polkadot-v0.9.27"131132[dependencies.sp-inherents]133git = "https://github.com/paritytech/substrate"134branch = "polkadot-v0.9.27"135136[dependencies.sp-keystore]137git = "https://github.com/paritytech/substrate"138branch = "polkadot-v0.9.27"139140[dependencies.sp-offchain]141git = "https://github.com/paritytech/substrate"142branch = "polkadot-v0.9.27"143144[dependencies.sp-runtime]145git = "https://github.com/paritytech/substrate"146branch = "polkadot-v0.9.27"147148[dependencies.sp-session]149git = "https://github.com/paritytech/substrate"150branch = "polkadot-v0.9.27"151152[dependencies.sp-timestamp]153git = "https://github.com/paritytech/substrate"154branch = "polkadot-v0.9.27"155156[dependencies.sp-transaction-pool]157git = "https://github.com/paritytech/substrate"158branch = "polkadot-v0.9.27"159160[dependencies.sp-trie]161git = "https://github.com/paritytech/substrate"162branch = "polkadot-v0.9.27"163164[dependencies.substrate-frame-rpc-system]165git = "https://github.com/paritytech/substrate"166branch = "polkadot-v0.9.27"167168[dependencies.sc-network]169git = "https://github.com/paritytech/substrate"170branch = "polkadot-v0.9.27"171172[dependencies.serde]173features = ['derive']174version = '1.0.130'175176[dependencies.serde_json]177version = '1.0.68'178179[dependencies.sc-consensus-manual-seal]180git = "https://github.com/paritytech/substrate"181branch = "polkadot-v0.9.27"182183################################################################################184# Cumulus dependencies185186[dependencies.cumulus-client-consensus-aura]187git = "https://github.com/paritytech/cumulus"188branch = "polkadot-v0.9.27"189190[dependencies.cumulus-client-consensus-common]191git = "https://github.com/paritytech/cumulus"192branch = "polkadot-v0.9.27"193194[dependencies.cumulus-client-collator]195git = "https://github.com/paritytech/cumulus"196branch = "polkadot-v0.9.27"197198[dependencies.cumulus-client-cli]199git = "https://github.com/paritytech/cumulus"200branch = "polkadot-v0.9.27"201202[dependencies.cumulus-client-network]203git = "https://github.com/paritytech/cumulus"204branch = "polkadot-v0.9.27"205206[dependencies.cumulus-primitives-core]207git = "https://github.com/paritytech/cumulus"208branch = "polkadot-v0.9.27"209210[dependencies.cumulus-primitives-parachain-inherent]211git = "https://github.com/paritytech/cumulus"212branch = "polkadot-v0.9.27"213214[dependencies.cumulus-client-service]215git = "https://github.com/paritytech/cumulus"216branch = "polkadot-v0.9.27"217218[dependencies.cumulus-relay-chain-interface]219git = "https://github.com/paritytech/cumulus"220branch = "polkadot-v0.9.27"221222[dependencies.cumulus-relay-chain-inprocess-interface]223git = "https://github.com/paritytech/cumulus"224branch = "polkadot-v0.9.27"225226[dependencies.cumulus-relay-chain-rpc-interface]227git = "https://github.com/paritytech/cumulus"228branch = "polkadot-v0.9.27"229230################################################################################231# Polkadot dependencies232[dependencies.polkadot-primitives]233git = "https://github.com/paritytech/polkadot"234branch = "release-v0.9.27"235236[dependencies.polkadot-service]237git = "https://github.com/paritytech/polkadot"238branch = "release-v0.9.27"239240[dependencies.polkadot-cli]241git = "https://github.com/paritytech/polkadot"242branch = "release-v0.9.27"243244[dependencies.polkadot-test-service]245git = "https://github.com/paritytech/polkadot"246branch = "release-v0.9.27"247248[dependencies.polkadot-parachain]249git = "https://github.com/paritytech/polkadot"250branch = "release-v0.9.27"251252253################################################################################254# Local dependencies255256[dependencies.up-common]257path = "../../primitives/common"258259[dependencies.unique-runtime]260path = '../../runtime/unique'261optional = true262263[dependencies.quartz-runtime]264path = '../../runtime/quartz'265optional = true266267[dependencies.opal-runtime]268path = '../../runtime/opal'269optional = true270271[dependencies.up-data-structs]272path = "../../primitives/data-structs"273default-features = false274275[dependencies.up-rpc]276path = "../../primitives/rpc"277278[dependencies.pallet-transaction-payment-rpc-runtime-api]279git = "https://github.com/paritytech/substrate"280branch = "polkadot-v0.9.27"281282################################################################################283# Package284285[package]286authors = ['Unique Network <support@uniquenetwork.io>']287build = 'build.rs'288description = 'Unique Node'289edition = '2021'290homepage = 'https://unique.network'291license = 'GPLv3'292name = 'unique-node'293repository = 'https://github.com/UniqueNetwork/unique-chain'294version = "0.9.27"295296[[bin]]297name = 'unique-collator'298path = "src/main.rs"299300[package.metadata.docs.rs]301targets = ['x86_64-unknown-linux-gnu']302303[dependencies]304futures = '0.3.17'305log = '0.4.14'306flexi_logger = "0.22.5"307parking_lot = '0.12.1'308clap = "3.1.2"309jsonrpsee = { version = "0.14.0", features = ["server", "macros"] }310tokio = { version = "1.19.2", features = ["time"] }311312fc-rpc-core = { git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }313fc-consensus = { git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }314fc-mapping-sync = { git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }315fc-rpc = { git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }316fc-db = { git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }317fp-rpc = { git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }318pallet-ethereum = { git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }319320unique-rpc = { default-features = false, path = "../rpc" }321rmrk-rpc = { path = "../../primitives/rmrk-rpc" }322323[features]324default = ["opal-runtime"]325runtime-benchmarks = [326 'unique-runtime?/runtime-benchmarks',327 'quartz-runtime?/runtime-benchmarks',328 'opal-runtime/runtime-benchmarks',329 'polkadot-service/runtime-benchmarks',330]331try-runtime = [332 'unique-runtime?/try-runtime',333 'quartz-runtime?/try-runtime',334 'opal-runtime?/try-runtime',335]1################################################################################2# Build Dependencies34[build-dependencies.substrate-build-script-utils]5git = "https://github.com/paritytech/substrate"6branch = "polkadot-v0.9.27"78################################################################################9# Substrate Dependecies1011[dependencies.codec]12default-features = false13features = ['derive']14package = 'parity-scale-codec'15version = '3.1.2'1617[dependencies.frame-benchmarking]18git = "https://github.com/paritytech/substrate"19branch = "polkadot-v0.9.27"2021[dependencies.frame-benchmarking-cli]22git = "https://github.com/paritytech/substrate"23branch = "polkadot-v0.9.27"2425[dependencies.try-runtime-cli]26git = "https://github.com/paritytech/substrate"27branch = "polkadot-v0.9.27"2829[dependencies.pallet-transaction-payment-rpc]30git = "https://github.com/paritytech/substrate"31branch = "polkadot-v0.9.27"3233[dependencies.substrate-prometheus-endpoint]34git = "https://github.com/paritytech/substrate"35branch = "polkadot-v0.9.27"3637[dependencies.sc-basic-authorship]38git = "https://github.com/paritytech/substrate"39branch = "polkadot-v0.9.27"4041[dependencies.sc-chain-spec]42git = "https://github.com/paritytech/substrate"43branch = "polkadot-v0.9.27"4445[dependencies.sc-cli]46features = ['wasmtime']47git = "https://github.com/paritytech/substrate"48branch = "polkadot-v0.9.27"4950[dependencies.sc-client-api]51git = "https://github.com/paritytech/substrate"52branch = "polkadot-v0.9.27"5354[dependencies.sc-consensus]55git = "https://github.com/paritytech/substrate"56branch = "polkadot-v0.9.27"5758[dependencies.sc-consensus-aura]59git = "https://github.com/paritytech/substrate"60branch = "polkadot-v0.9.27"6162[dependencies.sc-executor]63features = ['wasmtime']64git = "https://github.com/paritytech/substrate"65branch = "polkadot-v0.9.27"6667[dependencies.sc-finality-grandpa]68git = "https://github.com/paritytech/substrate"69branch = "polkadot-v0.9.27"7071[dependencies.sc-keystore]72git = "https://github.com/paritytech/substrate"73branch = "polkadot-v0.9.27"7475[dependencies.sc-rpc]76git = "https://github.com/paritytech/substrate"77branch = "polkadot-v0.9.27"7879[dependencies.sc-rpc-api]80git = "https://github.com/paritytech/substrate"81branch = "polkadot-v0.9.27"8283[dependencies.sc-service]84features = ['wasmtime']85git = "https://github.com/paritytech/substrate"86branch = "polkadot-v0.9.27"8788[dependencies.sc-telemetry]89git = "https://github.com/paritytech/substrate"90branch = "polkadot-v0.9.27"9192[dependencies.sc-transaction-pool]93git = "https://github.com/paritytech/substrate"94branch = "polkadot-v0.9.27"9596[dependencies.sc-tracing]97git = "https://github.com/paritytech/substrate"98branch = "polkadot-v0.9.27"99100[dependencies.sc-sysinfo]101git = "https://github.com/paritytech/substrate"102branch = "polkadot-v0.9.27"103104[dependencies.sp-block-builder]105git = "https://github.com/paritytech/substrate"106branch = "polkadot-v0.9.27"107108[dependencies.sp-api]109git = "https://github.com/paritytech/substrate"110branch = "polkadot-v0.9.27"111112[dependencies.sp-blockchain]113git = "https://github.com/paritytech/substrate"114branch = "polkadot-v0.9.27"115116[dependencies.sp-consensus]117git = "https://github.com/paritytech/substrate"118branch = "polkadot-v0.9.27"119120[dependencies.sp-consensus-aura]121git = "https://github.com/paritytech/substrate"122branch = "polkadot-v0.9.27"123124[dependencies.sp-core]125git = "https://github.com/paritytech/substrate"126branch = "polkadot-v0.9.27"127128[dependencies.sp-finality-grandpa]129git = "https://github.com/paritytech/substrate"130branch = "polkadot-v0.9.27"131132[dependencies.sp-inherents]133git = "https://github.com/paritytech/substrate"134branch = "polkadot-v0.9.27"135136[dependencies.sp-keystore]137git = "https://github.com/paritytech/substrate"138branch = "polkadot-v0.9.27"139140[dependencies.sp-offchain]141git = "https://github.com/paritytech/substrate"142branch = "polkadot-v0.9.27"143144[dependencies.sp-runtime]145git = "https://github.com/paritytech/substrate"146branch = "polkadot-v0.9.27"147148[dependencies.sp-session]149git = "https://github.com/paritytech/substrate"150branch = "polkadot-v0.9.27"151152[dependencies.sp-timestamp]153git = "https://github.com/paritytech/substrate"154branch = "polkadot-v0.9.27"155156[dependencies.sp-transaction-pool]157git = "https://github.com/paritytech/substrate"158branch = "polkadot-v0.9.27"159160[dependencies.sp-trie]161git = "https://github.com/paritytech/substrate"162branch = "polkadot-v0.9.27"163164[dependencies.substrate-frame-rpc-system]165git = "https://github.com/paritytech/substrate"166branch = "polkadot-v0.9.27"167168[dependencies.sc-network]169git = "https://github.com/paritytech/substrate"170branch = "polkadot-v0.9.27"171172[dependencies.serde]173features = ['derive']174version = '1.0.130'175176[dependencies.serde_json]177version = '1.0.68'178179[dependencies.sc-consensus-manual-seal]180git = "https://github.com/paritytech/substrate"181branch = "polkadot-v0.9.27"182183################################################################################184# Cumulus dependencies185186[dependencies.cumulus-client-consensus-aura]187git = "https://github.com/paritytech/cumulus"188branch = "polkadot-v0.9.27"189190[dependencies.cumulus-client-consensus-common]191git = "https://github.com/paritytech/cumulus"192branch = "polkadot-v0.9.27"193194[dependencies.cumulus-client-collator]195git = "https://github.com/paritytech/cumulus"196branch = "polkadot-v0.9.27"197198[dependencies.cumulus-client-cli]199git = "https://github.com/paritytech/cumulus"200branch = "polkadot-v0.9.27"201202[dependencies.cumulus-client-network]203git = "https://github.com/paritytech/cumulus"204branch = "polkadot-v0.9.27"205206[dependencies.cumulus-primitives-core]207git = "https://github.com/paritytech/cumulus"208branch = "polkadot-v0.9.27"209210[dependencies.cumulus-primitives-parachain-inherent]211git = "https://github.com/paritytech/cumulus"212branch = "polkadot-v0.9.27"213214[dependencies.cumulus-client-service]215git = "https://github.com/paritytech/cumulus"216branch = "polkadot-v0.9.27"217218[dependencies.cumulus-relay-chain-interface]219git = "https://github.com/paritytech/cumulus"220branch = "polkadot-v0.9.27"221222[dependencies.cumulus-relay-chain-inprocess-interface]223git = "https://github.com/paritytech/cumulus"224branch = "polkadot-v0.9.27"225226[dependencies.cumulus-relay-chain-rpc-interface]227git = "https://github.com/paritytech/cumulus"228branch = "polkadot-v0.9.27"229230################################################################################231# Polkadot dependencies232[dependencies.polkadot-primitives]233git = "https://github.com/paritytech/polkadot"234branch = "release-v0.9.27"235236[dependencies.polkadot-service]237git = "https://github.com/paritytech/polkadot"238branch = "release-v0.9.27"239240[dependencies.polkadot-cli]241git = "https://github.com/paritytech/polkadot"242branch = "release-v0.9.27"243244[dependencies.polkadot-test-service]245git = "https://github.com/paritytech/polkadot"246branch = "release-v0.9.27"247248[dependencies.polkadot-parachain]249git = "https://github.com/paritytech/polkadot"250branch = "release-v0.9.27"251252253################################################################################254# Local dependencies255256[dependencies.up-common]257path = "../../primitives/common"258259[dependencies.unique-runtime]260path = '../../runtime/unique'261optional = true262263[dependencies.quartz-runtime]264path = '../../runtime/quartz'265optional = true266267[dependencies.opal-runtime]268path = '../../runtime/opal'269optional = true270271[dependencies.up-data-structs]272path = "../../primitives/data-structs"273default-features = false274275[dependencies.up-rpc]276path = "../../primitives/rpc"277278[dependencies.pallet-transaction-payment-rpc-runtime-api]279git = "https://github.com/paritytech/substrate"280branch = "polkadot-v0.9.27"281282################################################################################283# Package284285[package]286authors = ['Unique Network <support@uniquenetwork.io>']287build = 'build.rs'288description = 'Unique Node'289edition = '2021'290homepage = 'https://unique.network'291license = 'GPLv3'292name = 'unique-node'293repository = 'https://github.com/UniqueNetwork/unique-chain'294version = "0.9.27"295296[[bin]]297name = 'unique-collator'298path = "src/main.rs"299300[package.metadata.docs.rs]301targets = ['x86_64-unknown-linux-gnu']302303[dependencies]304futures = '0.3.17'305log = '0.4.14'306flexi_logger = "0.22.5"307parking_lot = '0.12.1'308clap = "3.1.2"309jsonrpsee = { version = "0.14.0", features = ["server", "macros"] }310tokio = { version = "1.19.2", features = ["time"] }311312fc-rpc-core = { git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }313fc-consensus = { git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }314fc-mapping-sync = { git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }315fc-rpc = { git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }316fc-db = { git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }317fp-rpc = { git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }318pallet-ethereum = { git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }319320unique-rpc = { default-features = false, path = "../rpc" }321app-promotion-rpc = { path = "../../primitives/app_promotion_rpc", default-features = false}322rmrk-rpc = { path = "../../primitives/rmrk-rpc" }323324[features]325default = ["opal-runtime"]326runtime-benchmarks = [327 'unique-runtime?/runtime-benchmarks',328 'quartz-runtime?/runtime-benchmarks',329 'opal-runtime/runtime-benchmarks',330 'polkadot-service/runtime-benchmarks',331]332try-runtime = [333 'unique-runtime?/try-runtime',334 'quartz-runtime?/try-runtime',335 'opal-runtime?/try-runtime',336]node/cli/src/service.rsdiffbeforeafterboth--- a/node/cli/src/service.rs
+++ b/node/cli/src/service.rs
@@ -364,6 +364,7 @@
+ pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi<Block, Balance>
+ sp_api::ApiExt<Block, StateBackend = sc_client_api::StateBackendFor<FullBackend, Block>>
+ up_rpc::UniqueApi<Block, BlockNumber, Runtime::CrossAccountId, AccountId>
+ + app_promotion_rpc::AppPromotionApi<Block, BlockNumber, Runtime::CrossAccountId, AccountId>
+ rmrk_rpc::RmrkApi<
Block,
AccountId,
@@ -665,6 +666,7 @@
+ pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi<Block, Balance>
+ sp_api::ApiExt<Block, StateBackend = sc_client_api::StateBackendFor<FullBackend, Block>>
+ up_rpc::UniqueApi<Block, BlockNumber, Runtime::CrossAccountId, AccountId>
+ + app_promotion_rpc::AppPromotionApi<Block, BlockNumber, Runtime::CrossAccountId, AccountId>
+ rmrk_rpc::RmrkApi<
Block,
AccountId,
@@ -809,6 +811,7 @@
+ pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi<Block, Balance>
+ sp_api::ApiExt<Block, StateBackend = sc_client_api::StateBackendFor<FullBackend, Block>>
+ up_rpc::UniqueApi<Block, BlockNumber, Runtime::CrossAccountId, AccountId>
+ + app_promotion_rpc::AppPromotionApi<Block, BlockNumber, Runtime::CrossAccountId, AccountId>
+ rmrk_rpc::RmrkApi<
Block,
AccountId,
node/rpc/Cargo.tomldiffbeforeafterboth--- a/node/rpc/Cargo.toml
+++ b/node/rpc/Cargo.toml
@@ -53,6 +53,7 @@
pallet-unique = { path = "../../pallets/unique" }
uc-rpc = { path = "../../client/rpc" }
up-rpc = { path = "../../primitives/rpc" }
+app-promotion-rpc = { path = "../../primitives/app_promotion_rpc"}
rmrk-rpc = { path = "../../primitives/rmrk-rpc" }
up-data-structs = { default-features = false, path = "../../primitives/data-structs" }
node/rpc/src/lib.rsdiffbeforeafterboth--- a/node/rpc/src/lib.rs
+++ b/node/rpc/src/lib.rs
@@ -38,6 +38,7 @@
use sp_block_builder::BlockBuilder;
use sp_blockchain::{Error as BlockChainError, HeaderBackend, HeaderMetadata};
use sc_service::TransactionPool;
+use uc_rpc::AppPromotion;
use std::{collections::BTreeMap, sync::Arc};
use up_common::types::opaque::{Hash, AccountId, RuntimeInstance, Index, Block, BlockNumber, Balance};
@@ -147,6 +148,7 @@
C::Api: fp_rpc::ConvertTransactionRuntimeApi<Block>,
C::Api:
up_rpc::UniqueApi<Block, BlockNumber, <R as RuntimeInstance>::CrossAccountId, AccountId>,
+ C::Api: app_promotion_rpc::AppPromotionApi<Block, BlockNumber, <R as RuntimeInstance>::CrossAccountId, AccountId>,
C::Api: rmrk_rpc::RmrkApi<
Block,
AccountId,
@@ -171,6 +173,7 @@
EthPubSubApiServer, EthSigner, Net, NetApiServer, Web3, Web3ApiServer,
};
use uc_rpc::{UniqueApiServer, Unique};
+ use uc_rpc::{AppPromotionApiServer, AppPromotion};
#[cfg(not(feature = "unique-runtime"))]
use uc_rpc::{RmrkApiServer, Rmrk};
@@ -229,6 +232,9 @@
io.merge(Unique::new(client.clone()).into_rpc())?;
+ // #[cfg(not(feature = "unique-runtime"))]
+ io.merge(AppPromotion::new(client.clone()).into_rpc())?;
+
#[cfg(not(feature = "unique-runtime"))]
io.merge(Rmrk::new(client.clone()).into_rpc())?;
primitives/app_promotion_rpc/CHANGELOG.mddiffbeforeafterboth--- /dev/null
+++ b/primitives/app_promotion_rpc/CHANGELOG.md
@@ -0,0 +1,5 @@
+# Change Log
+
+All notable changes to this project will be documented in this file.
+
+<!-- bureaucrate goes here -->
primitives/app_promotion_rpc/Cargo.tomldiffbeforeafterboth--- /dev/null
+++ b/primitives/app_promotion_rpc/Cargo.toml
@@ -0,0 +1,29 @@
+[package]
+name = "app-promotion-rpc"
+version = "0.1.0"
+license = "GPLv3"
+edition = "2021"
+
+[dependencies]
+pallet-common = { default-features = false, path = '../../pallets/common' }
+up-data-structs = { default-features = false, path = '../data-structs' }
+codec = { package = "parity-scale-codec", version = "3.1.2", default-features = false, features = [
+ "derive",
+] }
+sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }
+sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }
+sp-api = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }
+sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }
+pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }
+
+[features]
+default = ["std"]
+std = [
+ "codec/std",
+ "sp-core/std",
+ "sp-std/std",
+ "sp-api/std",
+ "sp-runtime/std",
+ "pallet-common/std",
+ "up-data-structs/std",
+]
primitives/app_promotion_rpc/src/lib.rsdiffbeforeafterboth--- /dev/null
+++ b/primitives/app_promotion_rpc/src/lib.rs
@@ -0,0 +1,47 @@
+// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.
+// This file is part of Unique Network.
+
+// Unique Network is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// Unique Network is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
+
+#![cfg_attr(not(feature = "std"), no_std)]
+
+use up_data_structs::{
+ CollectionId, TokenId, RpcCollection, CollectionStats, CollectionLimits, Property,
+ PropertyKeyPermission, TokenData, TokenChild,
+};
+
+use sp_std::vec::Vec;
+use codec::Decode;
+use sp_runtime::{
+ DispatchError,
+ traits::{AtLeast32BitUnsigned, Member},
+};
+
+type Result<T> = core::result::Result<T, DispatchError>;
+
+sp_api::decl_runtime_apis! {
+ #[api_version(2)]
+ /// Trait for generate rpc.
+ pub trait AppPromotionApi<BlockNumber ,CrossAccountId, AccountId> where
+ BlockNumber: Decode + Member + AtLeast32BitUnsigned,
+ AccountId: Decode,
+ CrossAccountId: pallet_evm::account::CrossAccountId<AccountId>,
+ {
+ fn total_staked(staker: Option<CrossAccountId>) -> Result<u128>;
+ fn total_staked_per_block(staker: CrossAccountId) -> Result<Vec<(BlockNumber, u128)>>;
+ fn total_staking_locked(staker: CrossAccountId) -> Result<u128>;
+ fn pending_unstake(staker: Option<CrossAccountId>) -> Result<u128>;
+ fn pending_unstake_per_block(staker: CrossAccountId) -> Result<Vec<(BlockNumber, u128)>>;
+ }
+}
primitives/rpc/src/lib.rsdiffbeforeafterboth--- a/primitives/rpc/src/lib.rs
+++ b/primitives/rpc/src/lib.rs
@@ -127,11 +127,5 @@
fn total_pieces(collection_id: CollectionId, token_id: TokenId) -> Result<Option<u128>>;
fn token_owners(collection: CollectionId, token: TokenId) -> Result<Vec<CrossAccountId>>;
- fn total_staked(staker: Option<CrossAccountId>) -> Result<u128>;
- fn total_staked_per_block(staker: CrossAccountId) -> Result<Vec<(BlockNumber, u128)>>;
- fn total_staking_locked(staker: CrossAccountId) -> Result<u128>;
- fn pending_unstake(staker: Option<CrossAccountId>) -> Result<u128>;
- fn pending_unstake_per_block(staker: CrossAccountId) -> Result<Vec<(BlockNumber, u128)>>;
-
}
}
runtime/common/runtime_apis.rsdiffbeforeafterboth--- a/runtime/common/runtime_apis.rs
+++ b/runtime/common/runtime_apis.rs
@@ -187,25 +187,47 @@
fn total_pieces(collection: CollectionId, token_id: TokenId) -> Result<Option<u128>, DispatchError> {
dispatch_unique_runtime!(collection.total_pieces(token_id))
}
+ }
+ impl app_promotion_rpc::AppPromotionApi<Block, BlockNumber, CrossAccountId, AccountId> for Runtime {
fn total_staked(staker: Option<CrossAccountId>) -> Result<u128, DispatchError> {
- Ok(<pallet_app_promotion::Pallet<Runtime>>::cross_id_total_staked(staker).unwrap_or_default())
- }
+ #[cfg(not(feature = "app-promotion"))]
+ return unsupported!();
+ #[cfg(feature = "app-promotion")]
+ return Ok(<pallet_app_promotion::Pallet<Runtime>>::cross_id_total_staked(staker).unwrap_or_default());
+ }
+
fn total_staked_per_block(staker: CrossAccountId) -> Result<Vec<(BlockNumber, u128)>, DispatchError> {
- Ok(<pallet_app_promotion::Pallet<Runtime>>::cross_id_total_staked_per_block(staker))
+ #[cfg(not(feature = "app-promotion"))]
+ return unsupported!();
+
+ #[cfg(feature = "app-promotion")]
+ return Ok(<pallet_app_promotion::Pallet<Runtime>>::cross_id_total_staked_per_block(staker));
}
fn total_staking_locked(staker: CrossAccountId) -> Result<u128, DispatchError> {
- Ok(<pallet_app_promotion::Pallet<Runtime>>::cross_id_locked_balance(staker))
+ #[cfg(not(feature = "app-promotion"))]
+ return unsupported!();
+
+ #[cfg(feature = "app-promotion")]
+ return Ok(<pallet_app_promotion::Pallet<Runtime>>::cross_id_locked_balance(staker));
}
fn pending_unstake(staker: Option<CrossAccountId>) -> Result<u128, DispatchError> {
- Ok(<pallet_app_promotion::Pallet<Runtime>>::cross_id_pending_unstake(staker))
+ #[cfg(not(feature = "app-promotion"))]
+ return unsupported!();
+
+ #[cfg(feature = "app-promotion")]
+ return Ok(<pallet_app_promotion::Pallet<Runtime>>::cross_id_pending_unstake(staker));
}
fn pending_unstake_per_block(staker: CrossAccountId) -> Result<Vec<(BlockNumber, u128)>, DispatchError> {
- Ok(<pallet_app_promotion::Pallet<Runtime>>::cross_id_pending_unstake_per_block(staker))
+ #[cfg(not(feature = "app-promotion"))]
+ return unsupported!();
+
+ #[cfg(feature = "app-promotion")]
+ return Ok(<pallet_app_promotion::Pallet<Runtime>>::cross_id_pending_unstake_per_block(staker))
}
}
runtime/opal/Cargo.tomldiffbeforeafterboth--- a/runtime/opal/Cargo.toml
+++ b/runtime/opal/Cargo.toml
@@ -83,6 +83,7 @@
'pallet-base-fee/std',
'fp-rpc/std',
'up-rpc/std',
+ 'app-promotion-rpc/std',
'fp-evm-mapping/std',
'fp-self-contained/std',
'parachain-info/std',
@@ -414,6 +415,7 @@
derivative = "2.2.0"
pallet-unique = { path = '../../pallets/unique', default-features = false }
up-rpc = { path = "../../primitives/rpc", default-features = false }
+app-promotion-rpc = { path = "../../primitives/app_promotion_rpc", default-features = false}
rmrk-rpc = { path = "../../primitives/rmrk-rpc", default-features = false }
fp-evm-mapping = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }
pallet-inflation = { path = '../../pallets/inflation', default-features = false }
runtime/quartz/Cargo.tomldiffbeforeafterboth--- a/runtime/quartz/Cargo.toml
+++ b/runtime/quartz/Cargo.toml
@@ -82,6 +82,7 @@
'pallet-base-fee/std',
'fp-rpc/std',
'up-rpc/std',
+ 'app-promotion-rpc/std',
'fp-evm-mapping/std',
'fp-self-contained/std',
'parachain-info/std',
@@ -416,8 +417,10 @@
derivative = "2.2.0"
pallet-unique = { path = '../../pallets/unique', default-features = false }
up-rpc = { path = "../../primitives/rpc", default-features = false }
+app-promotion-rpc = { path = "../../primitives/app_promotion_rpc", default-features = false}
fp-evm-mapping = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }
pallet-inflation = { path = '../../pallets/inflation', default-features = false }
+pallet-app-promotion = { path = '../../pallets/app-promotion', default-features = false }
up-data-structs = { path = '../../primitives/data-structs', default-features = false }
pallet-configuration = { default-features = false, path = "../../pallets/configuration" }
pallet-common = { default-features = false, path = "../../pallets/common" }
runtime/unique/Cargo.tomldiffbeforeafterboth--- a/runtime/unique/Cargo.toml
+++ b/runtime/unique/Cargo.toml
@@ -83,6 +83,7 @@
'pallet-base-fee/std',
'fp-rpc/std',
'up-rpc/std',
+ 'app-promotion-rpc/std',
'fp-evm-mapping/std',
'fp-self-contained/std',
'parachain-info/std',
@@ -409,8 +410,10 @@
derivative = "2.2.0"
pallet-unique = { path = '../../pallets/unique', default-features = false }
up-rpc = { path = "../../primitives/rpc", default-features = false }
+app-promotion-rpc = { path = "../../primitives/app_promotion_rpc", default-features = false}
rmrk-rpc = { path = "../../primitives/rmrk-rpc", default-features = false }
pallet-inflation = { path = '../../pallets/inflation', default-features = false }
+pallet-app-promotion = { path = '../../pallets/app-promotion', default-features = false }
up-data-structs = { path = '../../primitives/data-structs', default-features = false }
pallet-configuration = { default-features = false, path = "../../pallets/configuration" }
pallet-common = { default-features = false, path = "../../pallets/common" }
tests/src/interfaces/appPromotion/definitions.tsdiffbeforeafterboth--- /dev/null
+++ b/tests/src/interfaces/appPromotion/definitions.ts
@@ -0,0 +1,66 @@
+// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.
+// This file is part of Unique Network.
+
+// Unique Network is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// Unique Network is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
+
+type RpcParam = {
+ name: string;
+ type: string;
+ isOptional?: true;
+};
+
+const CROSS_ACCOUNT_ID_TYPE = 'PalletEvmAccountBasicCrossAccountIdRepr';
+
+const collectionParam = {name: 'collection', type: 'u32'};
+const tokenParam = {name: 'tokenId', type: 'u32'};
+const propertyKeysParam = {name: 'propertyKeys', type: 'Vec<String>', isOptional: true};
+const crossAccountParam = (name = 'account') => ({name, type: CROSS_ACCOUNT_ID_TYPE});
+const atParam = {name: 'at', type: 'Hash', isOptional: true};
+
+const fun = (description: string, params: RpcParam[], type: string) => ({
+ description,
+ params: [...params, atParam],
+ type,
+});
+
+export default {
+ types: {},
+ rpc: {
+ totalStaked: fun(
+ 'Returns the total amount of staked tokens',
+ [{name: 'staker', type: CROSS_ACCOUNT_ID_TYPE, isOptional: true}],
+ 'u128',
+ ),
+ totalStakedPerBlock: fun(
+ 'Returns the total amount of staked tokens per block when staked',
+ [crossAccountParam('staker')],
+ 'Vec<(u32, u128)>',
+ ),
+ totalStakingLocked: fun(
+ 'Return the total amount locked by staking tokens',
+ [crossAccountParam('staker')],
+ 'u128',
+ ),
+ pendingUnstake: fun(
+ 'Returns the total amount of unstaked tokens',
+ [{name: 'staker', type: CROSS_ACCOUNT_ID_TYPE, isOptional: true}],
+ 'u128',
+ ),
+ pendingUnstakePerBlock: fun(
+ 'Returns the total amount of unstaked tokens per block',
+ [crossAccountParam('staker')],
+ 'Vec<(u32, u128)>',
+ ),
+ },
+};
tests/src/interfaces/appPromotion/index.tsdiffbeforeafterboth--- /dev/null
+++ b/tests/src/interfaces/appPromotion/index.ts
@@ -0,0 +1,4 @@
+// Auto-generated via `yarn polkadot-types-from-defs`, do not edit
+/* eslint-disable */
+
+export * from './types';
tests/src/interfaces/appPromotion/types.tsdiffbeforeafterboth--- /dev/null
+++ b/tests/src/interfaces/appPromotion/types.ts
@@ -0,0 +1,4 @@
+// Auto-generated via `yarn polkadot-types-from-defs`, do not edit
+/* eslint-disable */
+
+export type PHANTOM_APPPROMOTION = 'appPromotion';
tests/src/interfaces/augment-api-errors.tsdiffbeforeafterboth--- a/tests/src/interfaces/augment-api-errors.ts
+++ b/tests/src/interfaces/augment-api-errors.ts
@@ -269,7 +269,7 @@
**/
NoPendingSponsor: AugmentedError<ApiType>;
/**
- * This method is only executable by owner.
+ * This method is only executable by contract owner
**/
NoPermission: AugmentedError<ApiType>;
/**
@@ -278,7 +278,13 @@
[key: string]: AugmentedError<ApiType>;
};
evmMigration: {
+ /**
+ * Migration of this account is not yet started, or already finished.
+ **/
AccountIsNotMigrating: AugmentedError<ApiType>;
+ /**
+ * Can only migrate to empty address.
+ **/
AccountNotEmpty: AugmentedError<ApiType>;
/**
* Generic error
tests/src/interfaces/augment-api-query.tsdiffbeforeafterboth--- a/tests/src/interfaces/augment-api-query.ts
+++ b/tests/src/interfaces/augment-api-query.ts
@@ -335,7 +335,7 @@
*
* Currently used to store RMRK data.
**/
- tokenAuxProperties: AugmentedQuery<ApiType, (arg1: u32 | AnyNumber | Uint8Array, arg2: u32 | AnyNumber | Uint8Array, arg3: UpDataStructsPropertyScope | 'None' | 'Rmrk' | 'Eth' | number | Uint8Array, arg4: Bytes | string | Uint8Array) => Observable<Option<Bytes>>, [u32, u32, UpDataStructsPropertyScope, Bytes]> & QueryableStorageEntry<ApiType, [u32, u32, UpDataStructsPropertyScope, Bytes]>;
+ tokenAuxProperties: AugmentedQuery<ApiType, (arg1: u32 | AnyNumber | Uint8Array, arg2: u32 | AnyNumber | Uint8Array, arg3: UpDataStructsPropertyScope | 'None' | 'Rmrk' | number | Uint8Array, arg4: Bytes | string | Uint8Array) => Observable<Option<Bytes>>, [u32, u32, UpDataStructsPropertyScope, Bytes]> & QueryableStorageEntry<ApiType, [u32, u32, UpDataStructsPropertyScope, Bytes]>;
/**
* Used to enumerate token's children.
**/
tests/src/interfaces/augment-api-rpc.tsdiffbeforeafterboth--- a/tests/src/interfaces/augment-api-rpc.ts
+++ b/tests/src/interfaces/augment-api-rpc.ts
@@ -35,6 +35,28 @@
declare module '@polkadot/rpc-core/types/jsonrpc' {
interface RpcInterface {
+ appPromotion: {
+ /**
+ * Returns the total amount of unstaked tokens
+ **/
+ pendingUnstake: AugmentedRpc<(staker?: PalletEvmAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array, at?: Hash | string | Uint8Array) => Observable<u128>>;
+ /**
+ * Returns the total amount of unstaked tokens per block
+ **/
+ pendingUnstakePerBlock: AugmentedRpc<(staker: PalletEvmAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array, at?: Hash | string | Uint8Array) => Observable<Vec<ITuple<[u32, u128]>>>>;
+ /**
+ * Returns the total amount of staked tokens
+ **/
+ totalStaked: AugmentedRpc<(staker?: PalletEvmAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array, at?: Hash | string | Uint8Array) => Observable<u128>>;
+ /**
+ * Returns the total amount of staked tokens per block when staked
+ **/
+ totalStakedPerBlock: AugmentedRpc<(staker: PalletEvmAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array, at?: Hash | string | Uint8Array) => Observable<Vec<ITuple<[u32, u128]>>>>;
+ /**
+ * Return the total amount locked by staking tokens
+ **/
+ totalStakingLocked: AugmentedRpc<(staker: PalletEvmAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array, at?: Hash | string | Uint8Array) => Observable<u128>>;
+ };
author: {
/**
* Returns true if the keystore has private keys for the given public key and key type.
@@ -702,15 +724,7 @@
* Get the number of blocks until sponsoring a transaction is available
**/
nextSponsored: AugmentedRpc<(collection: u32 | AnyNumber | Uint8Array, account: PalletEvmAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array, tokenId: u32 | AnyNumber | Uint8Array, at?: Hash | string | Uint8Array) => Observable<Option<u64>>>;
- /**
- * Returns the total amount of unstaked tokens
- **/
- pendingUnstake: AugmentedRpc<(staker?: PalletEvmAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array, at?: Hash | string | Uint8Array) => Observable<u128>>;
/**
- * Returns the total amount of unstaked tokens per block
- **/
- pendingUnstakePerBlock: AugmentedRpc<(staker: PalletEvmAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array, at?: Hash | string | Uint8Array) => Observable<Vec<ITuple<[u32, u128]>>>>;
- /**
* Get property permissions, optionally limited to the provided keys
**/
propertyPermissions: AugmentedRpc<(collection: u32 | AnyNumber | Uint8Array, propertyKeys?: Vec<Text> | (Text | string)[], at?: Hash | string | Uint8Array) => Observable<Vec<UpDataStructsPropertyKeyPermission>>>;
@@ -746,18 +760,6 @@
* Get the total amount of pieces of an RFT
**/
totalPieces: AugmentedRpc<(collection: u32 | AnyNumber | Uint8Array, tokenId: u32 | AnyNumber | Uint8Array, at?: Hash | string | Uint8Array) => Observable<Option<u128>>>;
- /**
- * Returns the total amount of staked tokens
- **/
- totalStaked: AugmentedRpc<(staker?: PalletEvmAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array, at?: Hash | string | Uint8Array) => Observable<u128>>;
- /**
- * Returns the total amount of staked tokens per block when staked
- **/
- totalStakedPerBlock: AugmentedRpc<(staker: PalletEvmAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array, at?: Hash | string | Uint8Array) => Observable<Vec<ITuple<[u32, u128]>>>>;
- /**
- * Return the total amount locked by staking tokens
- **/
- totalStakingLocked: AugmentedRpc<(staker: PalletEvmAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array, at?: Hash | string | Uint8Array) => Observable<u128>>;
/**
* Get the amount of distinctive tokens present in a collection
**/
tests/src/interfaces/augment-api-tx.tsdiffbeforeafterboth--- a/tests/src/interfaces/augment-api-tx.ts
+++ b/tests/src/interfaces/augment-api-tx.ts
@@ -181,8 +181,21 @@
[key: string]: SubmittableExtrinsicFunction<ApiType>;
};
evmMigration: {
+ /**
+ * Start contract migration, inserts contract stub at target address,
+ * and marks account as pending, allowing to insert storage
+ **/
begin: AugmentedSubmittable<(address: H160 | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [H160]>;
+ /**
+ * Finish contract migration, allows it to be called.
+ * It is not possible to alter contract storage via [`Self::set_data`]
+ * after this call.
+ **/
finish: AugmentedSubmittable<(address: H160 | string | Uint8Array, code: Bytes | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [H160, Bytes]>;
+ /**
+ * Insert items into contract storage, this method can be called
+ * multiple times
+ **/
setData: AugmentedSubmittable<(address: H160 | string | Uint8Array, data: Vec<ITuple<[H256, H256]>> | ([H256 | string | Uint8Array, H256 | string | Uint8Array])[]) => SubmittableExtrinsic<ApiType>, [H160, Vec<ITuple<[H256, H256]>>]>;
/**
* Generic tx
@@ -372,7 +385,7 @@
stopAppPromotion: AugmentedSubmittable<() => SubmittableExtrinsic<ApiType>, []>;
stopSponsoringCollection: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32]>;
stopSponsoringContract: AugmentedSubmittable<(contractId: H160 | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [H160]>;
- unstake: AugmentedSubmittable<(amount: u128 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [u128]>;
+ unstake: AugmentedSubmittable<() => SubmittableExtrinsic<ApiType>, []>;
/**
* Generic tx
**/
tests/src/interfaces/default/types.tsdiffbeforeafterboth--- a/tests/src/interfaces/default/types.ts
+++ b/tests/src/interfaces/default/types.ts
@@ -822,9 +822,6 @@
readonly amount: u128;
} & Struct;
readonly isUnstake: boolean;
- readonly asUnstake: {
- readonly amount: u128;
- } & Struct;
readonly isSponsorCollection: boolean;
readonly asSponsorCollection: {
readonly collectionId: u32;
@@ -2639,8 +2636,7 @@
export interface UpDataStructsPropertyScope extends Enum {
readonly isNone: boolean;
readonly isRmrk: boolean;
- readonly isEth: boolean;
- readonly type: 'None' | 'Rmrk' | 'Eth';
+ readonly type: 'None' | 'Rmrk';
}
/** @name UpDataStructsRpcCollection */
tests/src/interfaces/definitions.tsdiffbeforeafterboth--- a/tests/src/interfaces/definitions.ts
+++ b/tests/src/interfaces/definitions.ts
@@ -15,5 +15,6 @@
// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
export {default as unique} from './unique/definitions';
+export {default as appPromotion} from './appPromotion/definitions';
export {default as rmrk} from './rmrk/definitions';
export {default as default} from './default/definitions';
\ No newline at end of file
tests/src/interfaces/lookup.tsdiffbeforeafterboth--- a/tests/src/interfaces/lookup.ts
+++ b/tests/src/interfaces/lookup.ts
@@ -2467,9 +2467,7 @@
stake: {
amount: 'u128',
},
- unstake: {
- amount: 'u128',
- },
+ unstake: 'Null',
sponsor_collection: {
collectionId: 'u32',
},
@@ -3078,7 +3076,7 @@
* Lookup403: up_data_structs::PropertyScope
**/
UpDataStructsPropertyScope: {
- _enum: ['None', 'Rmrk', 'Eth']
+ _enum: ['None', 'Rmrk']
},
/**
* Lookup405: pallet_nonfungible::pallet::Error<T>
tests/src/interfaces/types-lookup.tsdiffbeforeafterboth--- a/tests/src/interfaces/types-lookup.ts
+++ b/tests/src/interfaces/types-lookup.ts
@@ -2675,9 +2675,6 @@
readonly amount: u128;
} & Struct;
readonly isUnstake: boolean;
- readonly asUnstake: {
- readonly amount: u128;
- } & Struct;
readonly isSponsorCollection: boolean;
readonly asSponsorCollection: {
readonly collectionId: u32;
@@ -3238,8 +3235,7 @@
interface UpDataStructsPropertyScope extends Enum {
readonly isNone: boolean;
readonly isRmrk: boolean;
- readonly isEth: boolean;
- readonly type: 'None' | 'Rmrk' | 'Eth';
+ readonly type: 'None' | 'Rmrk';
}
/** @name PalletNonfungibleError (405) */
tests/src/interfaces/types.tsdiffbeforeafterboth--- a/tests/src/interfaces/types.ts
+++ b/tests/src/interfaces/types.ts
@@ -2,5 +2,6 @@
/* eslint-disable */
export * from './unique/types';
+export * from './appPromotion/types';
export * from './rmrk/types';
export * from './default/types';
tests/src/interfaces/unique/definitions.tsdiffbeforeafterboth--- a/tests/src/interfaces/unique/definitions.ts
+++ b/tests/src/interfaces/unique/definitions.ts
@@ -175,30 +175,5 @@
[collectionParam, tokenParam],
'Option<u128>',
),
- totalStaked: fun(
- 'Returns the total amount of staked tokens',
- [{name: 'staker', type: CROSS_ACCOUNT_ID_TYPE, isOptional: true}],
- 'u128',
- ),
- totalStakedPerBlock: fun(
- 'Returns the total amount of staked tokens per block when staked',
- [crossAccountParam('staker')],
- 'Vec<(u32, u128)>',
- ),
- totalStakingLocked: fun(
- 'Return the total amount locked by staking tokens',
- [crossAccountParam('staker')],
- 'u128',
- ),
- pendingUnstake: fun(
- 'Returns the total amount of unstaked tokens',
- [{name: 'staker', type: CROSS_ACCOUNT_ID_TYPE, isOptional: true}],
- 'u128',
- ),
- pendingUnstakePerBlock: fun(
- 'Returns the total amount of unstaked tokens per block',
- [crossAccountParam('staker')],
- 'Vec<(u32, u128)>',
- ),
},
};
tests/src/substrate/substrate-api.tsdiffbeforeafterboth--- a/tests/src/substrate/substrate-api.ts
+++ b/tests/src/substrate/substrate-api.ts
@@ -42,6 +42,7 @@
},
rpc: {
unique: defs.unique.rpc,
+ appPromotion: defs.appPromotion.rpc,
rmrk: defs.rmrk.rpc,
eth: {
feeHistory: {
tests/src/util/playgrounds/unique.dev.tsdiffbeforeafterboth--- a/tests/src/util/playgrounds/unique.dev.ts
+++ b/tests/src/util/playgrounds/unique.dev.ts
@@ -35,6 +35,7 @@
},
rpc: {
unique: defs.unique.rpc,
+ appPromotion: defs.appPromotion.rpc,
rmrk: defs.rmrk.rpc,
eth: {
feeHistory: {
tests/src/util/playgrounds/unique.tsdiffbeforeafterboth--- a/tests/src/util/playgrounds/unique.ts
+++ b/tests/src/util/playgrounds/unique.ts
@@ -2027,24 +2027,24 @@
}
async getTotalStaked(address?: ICrossAccountId): Promise<bigint> {
- if (address) return (await this.helper.callRpc('api.rpc.unique.totalStaked', [address])).toBigInt();
- return (await this.helper.callRpc('api.rpc.unique.totalStaked')).toBigInt();
+ if (address) return (await this.helper.callRpc('api.rpc.appPromotion.totalStaked', [address])).toBigInt();
+ return (await this.helper.callRpc('api.rpc.appPromotion.totalStaked')).toBigInt();
}
async getTotalStakingLocked(address: ICrossAccountId): Promise<bigint> {
- return (await this.helper.callRpc('api.rpc.unique.totalStakingLocked', [address])).toBigInt();
+ return (await this.helper.callRpc('api.rpc.appPromotion.totalStakingLocked', [address])).toBigInt();
}
async getTotalStakedPerBlock(address: ICrossAccountId): Promise<bigint[][]> {
- return (await this.helper.callRpc('api.rpc.unique.totalStakedPerBlock', [address])).map(([block, amount]: any[]) => [block.toBigInt(), amount.toBigInt()]);
+ return (await this.helper.callRpc('api.rpc.appPromotion.totalStakedPerBlock', [address])).map(([block, amount]: any[]) => [block.toBigInt(), amount.toBigInt()]);
}
async getPendingUnstake(address: ICrossAccountId): Promise<bigint> {
- return (await this.helper.callRpc('api.rpc.unique.pendingUnstake', [address])).toBigInt();
+ return (await this.helper.callRpc('api.rpc.appPromotion.pendingUnstake', [address])).toBigInt();
}
async getPendingUnstakePerBlock(address: ICrossAccountId): Promise<bigint[][]> {
- return (await this.helper.callRpc('api.rpc.unique.pendingUnstakePerBlock', [address])).map(([block, amount]: any[]) => [block.toBigInt(), amount.toBigInt()]);
+ return (await this.helper.callRpc('api.rpc.appPromotion.pendingUnstakePerBlock', [address])).map(([block, amount]: any[]) => [block.toBigInt(), amount.toBigInt()]);
}
}