git.delta.rocks / unique-network / refs/commits / 081dbb6ae4fb

difftreelog

feat Separate rpc calls to own group

Trubnikov Sergey2022-09-01parent: #33ed679.patch.diff
in: master

31 files changed

modifiedCargo.lockdiffbeforeafterboth
112source = "registry+https://github.com/rust-lang/crates.io-index"112source = "registry+https://github.com/rust-lang/crates.io-index"
113checksum = "508b352bb5c066aac251f6daf6b36eccd03e8a88e8081cd44959ea277a3af9a8"113checksum = "508b352bb5c066aac251f6daf6b36eccd03e8a88e8081cd44959ea277a3af9a8"
114
115[[package]]
116name = "app-promotion-rpc"
117version = "0.1.0"
118dependencies = [
119 "pallet-common",
120 "pallet-evm",
121 "parity-scale-codec 3.1.5",
122 "sp-api",
123 "sp-core",
124 "sp-runtime",
125 "sp-std",
126 "up-data-structs",
127]
114128
115[[package]]129[[package]]
116name = "approx"130name = "approx"
5127name = "opal-runtime"5141name = "opal-runtime"
5128version = "0.9.27"5142version = "0.9.27"
5129dependencies = [5143dependencies = [
5144 "app-promotion-rpc",
5130 "cumulus-pallet-aura-ext",5145 "cumulus-pallet-aura-ext",
5131 "cumulus-pallet-dmp-queue",5146 "cumulus-pallet-dmp-queue",
5132 "cumulus-pallet-parachain-system",5147 "cumulus-pallet-parachain-system",
8358name = "quartz-runtime"8373name = "quartz-runtime"
8359version = "0.9.27"8374version = "0.9.27"
8360dependencies = [8375dependencies = [
8376 "app-promotion-rpc",
8361 "cumulus-pallet-aura-ext",8377 "cumulus-pallet-aura-ext",
8362 "cumulus-pallet-dmp-queue",8378 "cumulus-pallet-dmp-queue",
8363 "cumulus-pallet-parachain-system",8379 "cumulus-pallet-parachain-system",
8381 "hex-literal",8397 "hex-literal",
8382 "log",8398 "log",
8383 "orml-vesting",8399 "orml-vesting",
8400 "pallet-app-promotion",
8384 "pallet-aura",8401 "pallet-aura",
8385 "pallet-balances",8402 "pallet-balances",
8386 "pallet-base-fee",8403 "pallet-base-fee",
12132version = "0.1.3"12149version = "0.1.3"
12133dependencies = [12150dependencies = [
12134 "anyhow",12151 "anyhow",
12152 "app-promotion-rpc",
12135 "jsonrpsee",12153 "jsonrpsee",
12136 "pallet-common",12154 "pallet-common",
12137 "pallet-evm",12155 "pallet-evm",
12210name = "unique-node"12228name = "unique-node"
12211version = "0.9.27"12229version = "0.9.27"
12212dependencies = [12230dependencies = [
12231 "app-promotion-rpc",
12213 "clap",12232 "clap",
12214 "cumulus-client-cli",12233 "cumulus-client-cli",
12215 "cumulus-client-collator",12234 "cumulus-client-collator",
12298name = "unique-rpc"12317name = "unique-rpc"
12299version = "0.1.1"12318version = "0.1.1"
12300dependencies = [12319dependencies = [
12320 "app-promotion-rpc",
12301 "fc-db",12321 "fc-db",
12302 "fc-mapping-sync",12322 "fc-mapping-sync",
12303 "fc-rpc",12323 "fc-rpc",
12347name = "unique-runtime"12367name = "unique-runtime"
12348version = "0.9.27"12368version = "0.9.27"
12349dependencies = [12369dependencies = [
12370 "app-promotion-rpc",
12350 "cumulus-pallet-aura-ext",12371 "cumulus-pallet-aura-ext",
12351 "cumulus-pallet-dmp-queue",12372 "cumulus-pallet-dmp-queue",
12352 "cumulus-pallet-parachain-system",12373 "cumulus-pallet-parachain-system",
12370 "hex-literal",12391 "hex-literal",
12371 "log",12392 "log",
12372 "orml-vesting",12393 "orml-vesting",
12394 "pallet-app-promotion",
12373 "pallet-aura",12395 "pallet-aura",
12374 "pallet-balances",12396 "pallet-balances",
12375 "pallet-base-fee",12397 "pallet-base-fee",
modifiedclient/rpc/Cargo.tomldiffbeforeafterboth
8pallet-common = { default-features = false, path = '../../pallets/common' }8pallet-common = { default-features = false, path = '../../pallets/common' }
9up-data-structs = { default-features = false, path = '../../primitives/data-structs' }9up-data-structs = { default-features = false, path = '../../primitives/data-structs' }
10up-rpc = { path = "../../primitives/rpc" }10up-rpc = { path = "../../primitives/rpc" }
11app-promotion-rpc = { path = "../../primitives/app_promotion_rpc"}
11rmrk-rpc = { path = "../../primitives/rmrk-rpc" }12rmrk-rpc = { path = "../../primitives/rmrk-rpc" }
12codec = { package = "parity-scale-codec", version = "3.1.2" }13codec = { package = "parity-scale-codec", version = "3.1.2" }
13jsonrpsee = { version = "0.14.0", features = ["server", "macros"] }14jsonrpsee = { version = "0.14.0", features = ["server", "macros"] }
modifiedclient/rpc/src/lib.rsdiffbeforeafterboth
31use sp_api::{BlockId, BlockT, ProvideRuntimeApi, ApiExt};31use sp_api::{BlockId, BlockT, ProvideRuntimeApi, ApiExt};
32use sp_blockchain::HeaderBackend;32use sp_blockchain::HeaderBackend;
33use up_rpc::UniqueApi as UniqueRuntimeApi;33use up_rpc::UniqueApi as UniqueRuntimeApi;
34use app_promotion_rpc::AppPromotionApi as AppPromotionRuntimeApi;
3435
35// RMRK36// RMRK
36use rmrk_rpc::RmrkApi as RmrkRuntimeApi;37use rmrk_rpc::RmrkApi as RmrkRuntimeApi;
37use up_data_structs::{38use up_data_structs::{
38 RmrkCollectionId, RmrkNftId, RmrkBaseId, RmrkNftChild, RmrkThemeName, RmrkResourceId,39 RmrkCollectionId, RmrkNftId, RmrkBaseId, RmrkNftChild, RmrkThemeName, RmrkResourceId,
39};40};
4041
42pub use app_promotion_unique_rpc::AppPromotionApiServer;
41pub use rmrk_unique_rpc::RmrkApiServer;43pub use rmrk_unique_rpc::RmrkApiServer;
4244
43#[rpc(server)]45#[rpc(server)]
44#[async_trait]46#[async_trait]
45pub trait UniqueApi<BlockHash, BlockNumber, CrossAccountId, AccountId> {47pub trait UniqueApi<BlockHash, BlockNumber, CrossAccountId, AccountId> {
46 /// Get tokens owned by account.48 /// Get tokens owned by account.
47 #[method(name = "unique_accountTokens")]49 #[method(name = "unique_accountTokens")]
48 fn account_tokens(50 fn account_tokens(
244 token_id: TokenId,246 token_id: TokenId,
245 at: Option<BlockHash>,247 at: Option<BlockHash>,
246 ) -> Result<Option<String>>;248 ) -> Result<Option<String>>;
247249}
248 /// Returns the total amount of staked tokens.250
249 #[method(name = "unique_totalStaked")]251mod app_promotion_unique_rpc {
250 fn total_staked(&self, staker: Option<CrossAccountId>, at: Option<BlockHash>)
251 -> Result<String>;252 use super::*;
252253
253 ///Returns the total amount of staked tokens per block when staked.254 #[rpc(server)]
254 #[method(name = "unique_totalStakedPerBlock")]255 #[async_trait]
255 fn total_staked_per_block(256 pub trait AppPromotionApi<BlockHash, BlockNumber, CrossAccountId, AccountId> {
256 &self,257 /// Returns the total amount of staked tokens.
257 staker: CrossAccountId,258 #[method(name = "appPromotion_totalStaked")]
258 at: Option<BlockHash>,259 fn total_staked(&self, staker: Option<CrossAccountId>, at: Option<BlockHash>)
259 ) -> Result<Vec<(BlockNumber, String)>>;260 -> Result<String>;
261
262 ///Returns the total amount of staked tokens per block when staked.
263 #[method(name = "appPromotion_totalStakedPerBlock")]
264 fn total_staked_per_block(
265 &self,
266 staker: CrossAccountId,
267 at: Option<BlockHash>,
268 ) -> Result<Vec<(BlockNumber, String)>>;
260269
261 /// Returns the total amount locked by staking tokens.270 /// Returns the total amount locked by staking tokens.
262 #[method(name = "unique_totalStakingLocked")]271 #[method(name = "appPromotion_totalStakingLocked")]
263 fn total_staking_locked(&self, staker: CrossAccountId, at: Option<BlockHash>)272 fn total_staking_locked(&self, staker: CrossAccountId, at: Option<BlockHash>)
264 -> Result<String>;273 -> Result<String>;
265274
266 /// Returns the total amount of tokens pending withdrawal from staking.275 /// Returns the total amount of tokens pending withdrawal from staking.
267 #[method(name = "unique_pendingUnstake")]276 #[method(name = "appPromotion_pendingUnstake")]
268 fn pending_unstake(277 fn pending_unstake(
269 &self,278 &self,
270 staker: Option<CrossAccountId>,279 staker: Option<CrossAccountId>,
271 at: Option<BlockHash>,280 at: Option<BlockHash>,
272 ) -> Result<String>;281 ) -> Result<String>;
282
273 /// Returns the total amount of tokens pending withdrawal from staking per block.283 /// Returns the total amount of tokens pending withdrawal from staking per block.
274 #[method(name = "unique_pendingUnstakePerBlock")]284 #[method(name = "appPromotion_pendingUnstakePerBlock")]
275 fn pending_unstake_per_block(285 fn pending_unstake_per_block(
276 &self,286 &self,
277 staker: CrossAccountId,287 staker: CrossAccountId,
278 at: Option<BlockHash>,288 at: Option<BlockHash>,
279 ) -> Result<Vec<(BlockNumber, String)>>;289 ) -> Result<Vec<(BlockNumber, String)>>;
280}290 }
291}
281292
282mod rmrk_unique_rpc {293mod rmrk_unique_rpc {
283 use super::*;294 use super::*;
415 }426 }
416}427}
428
429pub struct AppPromotion<C, P> {
430 client: Arc<C>,
431 _marker: std::marker::PhantomData<P>,
432}
433
434impl<C, P> AppPromotion<C, P> {
435 pub fn new(client: Arc<C>) -> Self {
436 Self {
437 client,
438 _marker: Default::default(),
439 }
440 }
441}
417442
418pub struct Rmrk<C, P> {443pub struct Rmrk<C, P> {
419 client: Arc<C>,444 client: Arc<C>,
474 };499 };
475}500}
501
502macro_rules! app_promotion_api {
503 () => {
504 dyn AppPromotionRuntimeApi<Block, BlockNumber, CrossAccountId, AccountId>
505 };
506}
476507
477macro_rules! rmrk_api {508macro_rules! rmrk_api {
478 () => {509 () => {
479 dyn RmrkRuntimeApi<Block, AccountId, CollectionInfo, NftInfo, ResourceInfo, PropertyInfo, BaseInfo, PartType, Theme>510 dyn RmrkRuntimeApi<Block, AccountId, CollectionInfo, NftInfo, ResourceInfo, PropertyInfo, BaseInfo, PartType, Theme>
480 };511 };
481}512}
482513
483#[allow(deprecated)]514#[allow(deprecated)]
515impl<C, Block, BlockNumber, CrossAccountId, AccountId>
516 UniqueApiServer<<Block as BlockT>::Hash, BlockNumber, CrossAccountId, AccountId>
517 for Unique<C, Block>
518where
519 Block: BlockT,
520 BlockNumber: Decode + Member + AtLeast32BitUnsigned,
521 AccountId: Decode,
522 C: 'static + ProvideRuntimeApi<Block> + HeaderBackend<Block>,
523 C::Api: UniqueRuntimeApi<Block, BlockNumber, CrossAccountId, AccountId>,
524 CrossAccountId: pallet_evm::account::CrossAccountId<AccountId>,
525{
526 pass_method!(
527 account_tokens(collection: CollectionId, account: CrossAccountId) -> Vec<TokenId>, unique_api
528 );
529 pass_method!(
530 collection_tokens(collection: CollectionId) -> Vec<TokenId>, unique_api
531 );
532 pass_method!(
533 token_exists(collection: CollectionId, token: TokenId) -> bool, unique_api
534 );
535 pass_method!(
536 token_owner(collection: CollectionId, token: TokenId) -> Option<CrossAccountId>, unique_api
537 );
538 pass_method!(
539 topmost_token_owner(collection: CollectionId, token: TokenId) -> Option<CrossAccountId>, unique_api
540 );
541 pass_method!(token_children(collection: CollectionId, token: TokenId) -> Vec<TokenChild>, unique_api);
542 pass_method!(total_supply(collection: CollectionId) -> u32, unique_api);
543 pass_method!(account_balance(collection: CollectionId, account: CrossAccountId) -> u32, unique_api);
544 pass_method!(balance(collection: CollectionId, account: CrossAccountId, token: TokenId) -> String => |v| v.to_string(), unique_api);
545 pass_method!(
546 allowance(collection: CollectionId, sender: CrossAccountId, spender: CrossAccountId, token: TokenId) -> String => |v| v.to_string(),
547 unique_api
548 );
549
550 pass_method!(collection_properties(
551 collection: CollectionId,
552
553 #[map(|keys| string_keys_to_bytes_keys(keys))]
554 keys: Option<Vec<String>>
555 ) -> Vec<Property>, unique_api);
556
557 pass_method!(token_properties(
558 collection: CollectionId,
559 token_id: TokenId,
560
561 #[map(|keys| string_keys_to_bytes_keys(keys))]
562 keys: Option<Vec<String>>
563 ) -> Vec<Property>, unique_api);
564
565 pass_method!(property_permissions(
566 collection: CollectionId,
567
568 #[map(|keys| string_keys_to_bytes_keys(keys))]
569 keys: Option<Vec<String>>
570 ) -> Vec<PropertyKeyPermission>, unique_api);
571
572 pass_method!(token_data(
573 collection: CollectionId,
574 token_id: TokenId,
575
576 #[map(|keys| string_keys_to_bytes_keys(keys))]
577 keys: Option<Vec<String>>,
578 ) -> TokenData<CrossAccountId>, unique_api);
579
580 pass_method!(adminlist(collection: CollectionId) -> Vec<CrossAccountId>, unique_api);
581 pass_method!(allowlist(collection: CollectionId) -> Vec<CrossAccountId>, unique_api);
582 pass_method!(allowed(collection: CollectionId, user: CrossAccountId) -> bool, unique_api);
583 pass_method!(last_token_id(collection: CollectionId) -> TokenId, unique_api);
584 pass_method!(collection_by_id(collection: CollectionId) -> Option<RpcCollection<AccountId>>, unique_api);
585 pass_method!(collection_stats() -> CollectionStats, unique_api);
586 pass_method!(next_sponsored(collection: CollectionId, account: CrossAccountId, token: TokenId) -> Option<u64>, unique_api);
587 pass_method!(effective_collection_limits(collection_id: CollectionId) -> Option<CollectionLimits>, unique_api);
588 pass_method!(total_pieces(collection_id: CollectionId, token_id: TokenId) -> Option<String> => |o| o.map(|number| number.to_string()) , unique_api);
589 pass_method!(token_owners(collection: CollectionId, token: TokenId) -> Vec<CrossAccountId>, unique_api);
590}
591
484impl<C, Block, BlockNumber, CrossAccountId, AccountId>592impl<C, Block, BlockNumber, CrossAccountId, AccountId>
485 UniqueApiServer<<Block as BlockT>::Hash, BlockNumber, CrossAccountId, AccountId>593 app_promotion_unique_rpc::AppPromotionApiServer<<Block as BlockT>::Hash, BlockNumber, CrossAccountId, AccountId>
486 for Unique<C, Block>594 for AppPromotion<C, Block>
487where595where
488 Block: BlockT,596 Block: BlockT,
489 BlockNumber: Decode + Member + AtLeast32BitUnsigned,597 BlockNumber: Decode + Member + AtLeast32BitUnsigned,
490 AccountId: Decode,598 AccountId: Decode,
491 C: 'static + ProvideRuntimeApi<Block> + HeaderBackend<Block>,599 C: 'static + ProvideRuntimeApi<Block> + HeaderBackend<Block>,
492 C::Api: UniqueRuntimeApi<Block, BlockNumber, CrossAccountId, AccountId>,600 C::Api: AppPromotionRuntimeApi<Block, BlockNumber, CrossAccountId, AccountId>,
493 CrossAccountId: pallet_evm::account::CrossAccountId<AccountId>,601 CrossAccountId: pallet_evm::account::CrossAccountId<AccountId>,
494{602{
495 pass_method!(
496 account_tokens(collection: CollectionId, account: CrossAccountId) -> Vec<TokenId>, unique_api
497 );
498 pass_method!(
499 collection_tokens(collection: CollectionId) -> Vec<TokenId>, unique_api
500 );
501 pass_method!(
502 token_exists(collection: CollectionId, token: TokenId) -> bool, unique_api
503 );
504 pass_method!(
505 token_owner(collection: CollectionId, token: TokenId) -> Option<CrossAccountId>, unique_api
506 );
507 pass_method!(
508 topmost_token_owner(collection: CollectionId, token: TokenId) -> Option<CrossAccountId>, unique_api
509 );
510 pass_method!(token_children(collection: CollectionId, token: TokenId) -> Vec<TokenChild>, unique_api);
511 pass_method!(total_supply(collection: CollectionId) -> u32, unique_api);
512 pass_method!(account_balance(collection: CollectionId, account: CrossAccountId) -> u32, unique_api);
513 pass_method!(balance(collection: CollectionId, account: CrossAccountId, token: TokenId) -> String => |v| v.to_string(), unique_api);
514 pass_method!(
515 allowance(collection: CollectionId, sender: CrossAccountId, spender: CrossAccountId, token: TokenId) -> String => |v| v.to_string(),
516 unique_api
517 );
518
519 pass_method!(collection_properties(
520 collection: CollectionId,
521
522 #[map(|keys| string_keys_to_bytes_keys(keys))]
523 keys: Option<Vec<String>>
524 ) -> Vec<Property>, unique_api);
525
526 pass_method!(token_properties(
527 collection: CollectionId,
528 token_id: TokenId,
529
530 #[map(|keys| string_keys_to_bytes_keys(keys))]
531 keys: Option<Vec<String>>
532 ) -> Vec<Property>, unique_api);
533
534 pass_method!(property_permissions(
535 collection: CollectionId,
536
537 #[map(|keys| string_keys_to_bytes_keys(keys))]
538 keys: Option<Vec<String>>
539 ) -> Vec<PropertyKeyPermission>, unique_api);
540
541 pass_method!(token_data(
542 collection: CollectionId,
543 token_id: TokenId,
544
545 #[map(|keys| string_keys_to_bytes_keys(keys))]
546 keys: Option<Vec<String>>,
547 ) -> TokenData<CrossAccountId>, unique_api);
548
549 pass_method!(adminlist(collection: CollectionId) -> Vec<CrossAccountId>, unique_api);
550 pass_method!(allowlist(collection: CollectionId) -> Vec<CrossAccountId>, unique_api);
551 pass_method!(allowed(collection: CollectionId, user: CrossAccountId) -> bool, unique_api);
552 pass_method!(last_token_id(collection: CollectionId) -> TokenId, unique_api);
553 pass_method!(collection_by_id(collection: CollectionId) -> Option<RpcCollection<AccountId>>, unique_api);
554 pass_method!(collection_stats() -> CollectionStats, unique_api);
555 pass_method!(next_sponsored(collection: CollectionId, account: CrossAccountId, token: TokenId) -> Option<u64>, unique_api);
556 pass_method!(effective_collection_limits(collection_id: CollectionId) -> Option<CollectionLimits>, unique_api);
557 pass_method!(total_pieces(collection_id: CollectionId, token_id: TokenId) -> Option<String> => |o| o.map(|number| number.to_string()) , unique_api);
558 pass_method!(token_owners(collection: CollectionId, token: TokenId) -> Vec<CrossAccountId>, unique_api);
559 pass_method!(total_staked(staker: Option<CrossAccountId>) -> String => |v| v.to_string(), unique_api);603 pass_method!(total_staked(staker: Option<CrossAccountId>) -> String => |v| v.to_string(), app_promotion_api);
560 pass_method!(total_staked_per_block(staker: CrossAccountId) -> Vec<(BlockNumber, String)> =>604 pass_method!(total_staked_per_block(staker: CrossAccountId) -> Vec<(BlockNumber, String)> =>
561 |v| v605 |v| v
562 .into_iter()606 .into_iter()
modifiednode/cli/Cargo.tomldiffbeforeafterboth
318pallet-ethereum = { 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" }
319319
320unique-rpc = { default-features = false, path = "../rpc" }320unique-rpc = { default-features = false, path = "../rpc" }
321app-promotion-rpc = { path = "../../primitives/app_promotion_rpc", default-features = false}
321rmrk-rpc = { path = "../../primitives/rmrk-rpc" }322rmrk-rpc = { path = "../../primitives/rmrk-rpc" }
322323
323[features]324[features]
modifiednode/cli/src/service.rsdiffbeforeafterboth
364 + pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi<Block, Balance>364 + pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi<Block, Balance>
365 + sp_api::ApiExt<Block, StateBackend = sc_client_api::StateBackendFor<FullBackend, Block>>365 + sp_api::ApiExt<Block, StateBackend = sc_client_api::StateBackendFor<FullBackend, Block>>
366 + up_rpc::UniqueApi<Block, BlockNumber, Runtime::CrossAccountId, AccountId>366 + up_rpc::UniqueApi<Block, BlockNumber, Runtime::CrossAccountId, AccountId>
367 + app_promotion_rpc::AppPromotionApi<Block, BlockNumber, Runtime::CrossAccountId, AccountId>
367 + rmrk_rpc::RmrkApi<368 + rmrk_rpc::RmrkApi<
368 Block,369 Block,
369 AccountId,370 AccountId,
665 + pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi<Block, Balance>666 + pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi<Block, Balance>
666 + sp_api::ApiExt<Block, StateBackend = sc_client_api::StateBackendFor<FullBackend, Block>>667 + sp_api::ApiExt<Block, StateBackend = sc_client_api::StateBackendFor<FullBackend, Block>>
667 + up_rpc::UniqueApi<Block, BlockNumber, Runtime::CrossAccountId, AccountId>668 + up_rpc::UniqueApi<Block, BlockNumber, Runtime::CrossAccountId, AccountId>
669 + app_promotion_rpc::AppPromotionApi<Block, BlockNumber, Runtime::CrossAccountId, AccountId>
668 + rmrk_rpc::RmrkApi<670 + rmrk_rpc::RmrkApi<
669 Block,671 Block,
670 AccountId,672 AccountId,
809 + pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi<Block, Balance>811 + pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi<Block, Balance>
810 + sp_api::ApiExt<Block, StateBackend = sc_client_api::StateBackendFor<FullBackend, Block>>812 + sp_api::ApiExt<Block, StateBackend = sc_client_api::StateBackendFor<FullBackend, Block>>
811 + up_rpc::UniqueApi<Block, BlockNumber, Runtime::CrossAccountId, AccountId>813 + up_rpc::UniqueApi<Block, BlockNumber, Runtime::CrossAccountId, AccountId>
814 + app_promotion_rpc::AppPromotionApi<Block, BlockNumber, Runtime::CrossAccountId, AccountId>
812 + rmrk_rpc::RmrkApi<815 + rmrk_rpc::RmrkApi<
813 Block,816 Block,
814 AccountId,817 AccountId,
modifiednode/rpc/Cargo.tomldiffbeforeafterboth
53pallet-unique = { path = "../../pallets/unique" }53pallet-unique = { path = "../../pallets/unique" }
54uc-rpc = { path = "../../client/rpc" }54uc-rpc = { path = "../../client/rpc" }
55up-rpc = { path = "../../primitives/rpc" }55up-rpc = { path = "../../primitives/rpc" }
56app-promotion-rpc = { path = "../../primitives/app_promotion_rpc"}
56rmrk-rpc = { path = "../../primitives/rmrk-rpc" }57rmrk-rpc = { path = "../../primitives/rmrk-rpc" }
57up-data-structs = { default-features = false, path = "../../primitives/data-structs" }58up-data-structs = { default-features = false, path = "../../primitives/data-structs" }
5859
modifiednode/rpc/src/lib.rsdiffbeforeafterboth
38use sp_block_builder::BlockBuilder;38use sp_block_builder::BlockBuilder;
39use sp_blockchain::{Error as BlockChainError, HeaderBackend, HeaderMetadata};39use sp_blockchain::{Error as BlockChainError, HeaderBackend, HeaderMetadata};
40use sc_service::TransactionPool;40use sc_service::TransactionPool;
41use uc_rpc::AppPromotion;
41use std::{collections::BTreeMap, sync::Arc};42use std::{collections::BTreeMap, sync::Arc};
4243
43use up_common::types::opaque::{Hash, AccountId, RuntimeInstance, Index, Block, BlockNumber, Balance};44use up_common::types::opaque::{Hash, AccountId, RuntimeInstance, Index, Block, BlockNumber, Balance};
147 C::Api: fp_rpc::ConvertTransactionRuntimeApi<Block>,148 C::Api: fp_rpc::ConvertTransactionRuntimeApi<Block>,
148 C::Api:149 C::Api:
149 up_rpc::UniqueApi<Block, BlockNumber, <R as RuntimeInstance>::CrossAccountId, AccountId>,150 up_rpc::UniqueApi<Block, BlockNumber, <R as RuntimeInstance>::CrossAccountId, AccountId>,
151 C::Api: app_promotion_rpc::AppPromotionApi<Block, BlockNumber, <R as RuntimeInstance>::CrossAccountId, AccountId>,
150 C::Api: rmrk_rpc::RmrkApi<152 C::Api: rmrk_rpc::RmrkApi<
151 Block,153 Block,
152 AccountId,154 AccountId,
171 EthPubSubApiServer, EthSigner, Net, NetApiServer, Web3, Web3ApiServer,173 EthPubSubApiServer, EthSigner, Net, NetApiServer, Web3, Web3ApiServer,
172 };174 };
173 use uc_rpc::{UniqueApiServer, Unique};175 use uc_rpc::{UniqueApiServer, Unique};
176 use uc_rpc::{AppPromotionApiServer, AppPromotion};
174177
175 #[cfg(not(feature = "unique-runtime"))]178 #[cfg(not(feature = "unique-runtime"))]
176 use uc_rpc::{RmrkApiServer, Rmrk};179 use uc_rpc::{RmrkApiServer, Rmrk};
229232
230 io.merge(Unique::new(client.clone()).into_rpc())?;233 io.merge(Unique::new(client.clone()).into_rpc())?;
234
235 // #[cfg(not(feature = "unique-runtime"))]
236 io.merge(AppPromotion::new(client.clone()).into_rpc())?;
231237
232 #[cfg(not(feature = "unique-runtime"))]238 #[cfg(not(feature = "unique-runtime"))]
233 io.merge(Rmrk::new(client.clone()).into_rpc())?;239 io.merge(Rmrk::new(client.clone()).into_rpc())?;
addedprimitives/app_promotion_rpc/CHANGELOG.mddiffbeforeafterboth

no changes

addedprimitives/app_promotion_rpc/Cargo.tomldiffbeforeafterboth

no changes

addedprimitives/app_promotion_rpc/src/lib.rsdiffbeforeafterboth

no changes

modifiedprimitives/rpc/src/lib.rsdiffbeforeafterboth
127 fn total_pieces(collection_id: CollectionId, token_id: TokenId) -> Result<Option<u128>>;127 fn total_pieces(collection_id: CollectionId, token_id: TokenId) -> Result<Option<u128>>;
128128
129 fn token_owners(collection: CollectionId, token: TokenId) -> Result<Vec<CrossAccountId>>;129 fn token_owners(collection: CollectionId, token: TokenId) -> Result<Vec<CrossAccountId>>;
130 fn total_staked(staker: Option<CrossAccountId>) -> Result<u128>;
131 fn total_staked_per_block(staker: CrossAccountId) -> Result<Vec<(BlockNumber, u128)>>;
132 fn total_staking_locked(staker: CrossAccountId) -> Result<u128>;
133 fn pending_unstake(staker: Option<CrossAccountId>) -> Result<u128>;
134 fn pending_unstake_per_block(staker: CrossAccountId) -> Result<Vec<(BlockNumber, u128)>>;
135
136 }130 }
137}131}
modifiedruntime/common/runtime_apis.rsdiffbeforeafterboth
188 dispatch_unique_runtime!(collection.total_pieces(token_id))188 dispatch_unique_runtime!(collection.total_pieces(token_id))
189 }189 }
190
191 fn total_staked(staker: Option<CrossAccountId>) -> Result<u128, DispatchError> {
192 Ok(<pallet_app_promotion::Pallet<Runtime>>::cross_id_total_staked(staker).unwrap_or_default())
193 }
194
195 fn total_staked_per_block(staker: CrossAccountId) -> Result<Vec<(BlockNumber, u128)>, DispatchError> {
196 Ok(<pallet_app_promotion::Pallet<Runtime>>::cross_id_total_staked_per_block(staker))
197 }
198
199 fn total_staking_locked(staker: CrossAccountId) -> Result<u128, DispatchError> {
200 Ok(<pallet_app_promotion::Pallet<Runtime>>::cross_id_locked_balance(staker))
201 }
202
203 fn pending_unstake(staker: Option<CrossAccountId>) -> Result<u128, DispatchError> {
204 Ok(<pallet_app_promotion::Pallet<Runtime>>::cross_id_pending_unstake(staker))
205 }
206
207 fn pending_unstake_per_block(staker: CrossAccountId) -> Result<Vec<(BlockNumber, u128)>, DispatchError> {
208 Ok(<pallet_app_promotion::Pallet<Runtime>>::cross_id_pending_unstake_per_block(staker))
209 }
210 }190 }
191
192 impl app_promotion_rpc::AppPromotionApi<Block, BlockNumber, CrossAccountId, AccountId> for Runtime {
193 fn total_staked(staker: Option<CrossAccountId>) -> Result<u128, DispatchError> {
194 #[cfg(not(feature = "app-promotion"))]
195 return unsupported!();
196
197 #[cfg(feature = "app-promotion")]
198 return Ok(<pallet_app_promotion::Pallet<Runtime>>::cross_id_total_staked(staker).unwrap_or_default());
199 }
200
201 fn total_staked_per_block(staker: CrossAccountId) -> Result<Vec<(BlockNumber, u128)>, DispatchError> {
202 #[cfg(not(feature = "app-promotion"))]
203 return unsupported!();
204
205 #[cfg(feature = "app-promotion")]
206 return Ok(<pallet_app_promotion::Pallet<Runtime>>::cross_id_total_staked_per_block(staker));
207 }
208
209 fn total_staking_locked(staker: CrossAccountId) -> Result<u128, DispatchError> {
210 #[cfg(not(feature = "app-promotion"))]
211 return unsupported!();
212
213 #[cfg(feature = "app-promotion")]
214 return Ok(<pallet_app_promotion::Pallet<Runtime>>::cross_id_locked_balance(staker));
215 }
216
217 fn pending_unstake(staker: Option<CrossAccountId>) -> Result<u128, DispatchError> {
218 #[cfg(not(feature = "app-promotion"))]
219 return unsupported!();
220
221 #[cfg(feature = "app-promotion")]
222 return Ok(<pallet_app_promotion::Pallet<Runtime>>::cross_id_pending_unstake(staker));
223 }
224
225 fn pending_unstake_per_block(staker: CrossAccountId) -> Result<Vec<(BlockNumber, u128)>, DispatchError> {
226 #[cfg(not(feature = "app-promotion"))]
227 return unsupported!();
228
229 #[cfg(feature = "app-promotion")]
230 return Ok(<pallet_app_promotion::Pallet<Runtime>>::cross_id_pending_unstake_per_block(staker))
231 }
232 }
211233
212 impl rmrk_rpc::RmrkApi<234 impl rmrk_rpc::RmrkApi<
213 Block,235 Block,
modifiedruntime/opal/Cargo.tomldiffbeforeafterboth
83 'pallet-base-fee/std',83 'pallet-base-fee/std',
84 'fp-rpc/std',84 'fp-rpc/std',
85 'up-rpc/std',85 'up-rpc/std',
86 'app-promotion-rpc/std',
86 'fp-evm-mapping/std',87 'fp-evm-mapping/std',
87 'fp-self-contained/std',88 'fp-self-contained/std',
88 'parachain-info/std',89 'parachain-info/std',
414derivative = "2.2.0"415derivative = "2.2.0"
415pallet-unique = { path = '../../pallets/unique', default-features = false }416pallet-unique = { path = '../../pallets/unique', default-features = false }
416up-rpc = { path = "../../primitives/rpc", default-features = false }417up-rpc = { path = "../../primitives/rpc", default-features = false }
418app-promotion-rpc = { path = "../../primitives/app_promotion_rpc", default-features = false}
417rmrk-rpc = { path = "../../primitives/rmrk-rpc", default-features = false }419rmrk-rpc = { path = "../../primitives/rmrk-rpc", default-features = false }
418fp-evm-mapping = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }420fp-evm-mapping = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }
419pallet-inflation = { path = '../../pallets/inflation', default-features = false }421pallet-inflation = { path = '../../pallets/inflation', default-features = false }
modifiedruntime/quartz/Cargo.tomldiffbeforeafterboth
82 'pallet-base-fee/std',82 'pallet-base-fee/std',
83 'fp-rpc/std',83 'fp-rpc/std',
84 'up-rpc/std',84 'up-rpc/std',
85 'app-promotion-rpc/std',
85 'fp-evm-mapping/std',86 'fp-evm-mapping/std',
86 'fp-self-contained/std',87 'fp-self-contained/std',
87 'parachain-info/std',88 'parachain-info/std',
416derivative = "2.2.0"417derivative = "2.2.0"
417pallet-unique = { path = '../../pallets/unique', default-features = false }418pallet-unique = { path = '../../pallets/unique', default-features = false }
418up-rpc = { path = "../../primitives/rpc", default-features = false }419up-rpc = { path = "../../primitives/rpc", default-features = false }
420app-promotion-rpc = { path = "../../primitives/app_promotion_rpc", default-features = false}
419fp-evm-mapping = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }421fp-evm-mapping = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }
420pallet-inflation = { path = '../../pallets/inflation', default-features = false }422pallet-inflation = { path = '../../pallets/inflation', default-features = false }
423pallet-app-promotion = { path = '../../pallets/app-promotion', default-features = false }
421up-data-structs = { path = '../../primitives/data-structs', default-features = false }424up-data-structs = { path = '../../primitives/data-structs', default-features = false }
422pallet-configuration = { default-features = false, path = "../../pallets/configuration" }425pallet-configuration = { default-features = false, path = "../../pallets/configuration" }
423pallet-common = { default-features = false, path = "../../pallets/common" }426pallet-common = { default-features = false, path = "../../pallets/common" }
modifiedruntime/unique/Cargo.tomldiffbeforeafterboth
83 'pallet-base-fee/std',83 'pallet-base-fee/std',
84 'fp-rpc/std',84 'fp-rpc/std',
85 'up-rpc/std',85 'up-rpc/std',
86 'app-promotion-rpc/std',
86 'fp-evm-mapping/std',87 'fp-evm-mapping/std',
87 'fp-self-contained/std',88 'fp-self-contained/std',
88 'parachain-info/std',89 'parachain-info/std',
409derivative = "2.2.0"410derivative = "2.2.0"
410pallet-unique = { path = '../../pallets/unique', default-features = false }411pallet-unique = { path = '../../pallets/unique', default-features = false }
411up-rpc = { path = "../../primitives/rpc", default-features = false }412up-rpc = { path = "../../primitives/rpc", default-features = false }
413app-promotion-rpc = { path = "../../primitives/app_promotion_rpc", default-features = false}
412rmrk-rpc = { path = "../../primitives/rmrk-rpc", default-features = false }414rmrk-rpc = { path = "../../primitives/rmrk-rpc", default-features = false }
413pallet-inflation = { path = '../../pallets/inflation', default-features = false }415pallet-inflation = { path = '../../pallets/inflation', default-features = false }
416pallet-app-promotion = { path = '../../pallets/app-promotion', default-features = false }
414up-data-structs = { path = '../../primitives/data-structs', default-features = false }417up-data-structs = { path = '../../primitives/data-structs', default-features = false }
415pallet-configuration = { default-features = false, path = "../../pallets/configuration" }418pallet-configuration = { default-features = false, path = "../../pallets/configuration" }
416pallet-common = { default-features = false, path = "../../pallets/common" }419pallet-common = { default-features = false, path = "../../pallets/common" }
addedtests/src/interfaces/appPromotion/definitions.tsdiffbeforeafterboth

no changes

addedtests/src/interfaces/appPromotion/index.tsdiffbeforeafterboth

no changes

addedtests/src/interfaces/appPromotion/types.tsdiffbeforeafterboth

no changes

modifiedtests/src/interfaces/augment-api-errors.tsdiffbeforeafterboth
268 * No pending sponsor for contract.268 * No pending sponsor for contract.
269 **/269 **/
270 NoPendingSponsor: AugmentedError<ApiType>;270 NoPendingSponsor: AugmentedError<ApiType>;
271 /**271 /**
272 * This method is only executable by owner.272 * This method is only executable by contract owner
273 **/273 **/
274 NoPermission: AugmentedError<ApiType>;274 NoPermission: AugmentedError<ApiType>;
275 /**275 /**
276 * Generic error276 * Generic error
277 **/277 **/
278 [key: string]: AugmentedError<ApiType>;278 [key: string]: AugmentedError<ApiType>;
279 };279 };
280 evmMigration: {280 evmMigration: {
281 /**
282 * Migration of this account is not yet started, or already finished.
283 **/
281 AccountIsNotMigrating: AugmentedError<ApiType>;284 AccountIsNotMigrating: AugmentedError<ApiType>;
285 /**
286 * Can only migrate to empty address.
287 **/
282 AccountNotEmpty: AugmentedError<ApiType>;288 AccountNotEmpty: AugmentedError<ApiType>;
283 /**289 /**
284 * Generic error290 * Generic error
modifiedtests/src/interfaces/augment-api-query.tsdiffbeforeafterboth
335 * 335 *
336 * Currently used to store RMRK data.336 * Currently used to store RMRK data.
337 **/337 **/
338 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]>;338 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]>;
339 /**339 /**
340 * Used to enumerate token's children.340 * Used to enumerate token's children.
341 **/341 **/
modifiedtests/src/interfaces/augment-api-rpc.tsdiffbeforeafterboth
3535
36declare module '@polkadot/rpc-core/types/jsonrpc' {36declare module '@polkadot/rpc-core/types/jsonrpc' {
37 interface RpcInterface {37 interface RpcInterface {
38 appPromotion: {
39 /**
40 * Returns the total amount of unstaked tokens
41 **/
42 pendingUnstake: AugmentedRpc<(staker?: PalletEvmAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array, at?: Hash | string | Uint8Array) => Observable<u128>>;
43 /**
44 * Returns the total amount of unstaked tokens per block
45 **/
46 pendingUnstakePerBlock: AugmentedRpc<(staker: PalletEvmAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array, at?: Hash | string | Uint8Array) => Observable<Vec<ITuple<[u32, u128]>>>>;
47 /**
48 * Returns the total amount of staked tokens
49 **/
50 totalStaked: AugmentedRpc<(staker?: PalletEvmAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array, at?: Hash | string | Uint8Array) => Observable<u128>>;
51 /**
52 * Returns the total amount of staked tokens per block when staked
53 **/
54 totalStakedPerBlock: AugmentedRpc<(staker: PalletEvmAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array, at?: Hash | string | Uint8Array) => Observable<Vec<ITuple<[u32, u128]>>>>;
55 /**
56 * Return the total amount locked by staking tokens
57 **/
58 totalStakingLocked: AugmentedRpc<(staker: PalletEvmAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array, at?: Hash | string | Uint8Array) => Observable<u128>>;
59 };
38 author: {60 author: {
39 /**61 /**
40 * Returns true if the keystore has private keys for the given public key and key type.62 * Returns true if the keystore has private keys for the given public key and key type.
702 * Get the number of blocks until sponsoring a transaction is available724 * Get the number of blocks until sponsoring a transaction is available
703 **/725 **/
704 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>>>;726 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>>>;
705 /**
706 * Returns the total amount of unstaked tokens
707 **/
708 pendingUnstake: AugmentedRpc<(staker?: PalletEvmAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array, at?: Hash | string | Uint8Array) => Observable<u128>>;
709 /**
710 * Returns the total amount of unstaked tokens per block
711 **/
712 pendingUnstakePerBlock: AugmentedRpc<(staker: PalletEvmAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array, at?: Hash | string | Uint8Array) => Observable<Vec<ITuple<[u32, u128]>>>>;
713 /**727 /**
714 * Get property permissions, optionally limited to the provided keys728 * Get property permissions, optionally limited to the provided keys
715 **/729 **/
746 * Get the total amount of pieces of an RFT760 * Get the total amount of pieces of an RFT
747 **/761 **/
748 totalPieces: AugmentedRpc<(collection: u32 | AnyNumber | Uint8Array, tokenId: u32 | AnyNumber | Uint8Array, at?: Hash | string | Uint8Array) => Observable<Option<u128>>>;762 totalPieces: AugmentedRpc<(collection: u32 | AnyNumber | Uint8Array, tokenId: u32 | AnyNumber | Uint8Array, at?: Hash | string | Uint8Array) => Observable<Option<u128>>>;
749 /**
750 * Returns the total amount of staked tokens
751 **/
752 totalStaked: AugmentedRpc<(staker?: PalletEvmAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array, at?: Hash | string | Uint8Array) => Observable<u128>>;
753 /**
754 * Returns the total amount of staked tokens per block when staked
755 **/
756 totalStakedPerBlock: AugmentedRpc<(staker: PalletEvmAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array, at?: Hash | string | Uint8Array) => Observable<Vec<ITuple<[u32, u128]>>>>;
757 /**
758 * Return the total amount locked by staking tokens
759 **/
760 totalStakingLocked: AugmentedRpc<(staker: PalletEvmAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array, at?: Hash | string | Uint8Array) => Observable<u128>>;
761 /**763 /**
762 * Get the amount of distinctive tokens present in a collection764 * Get the amount of distinctive tokens present in a collection
763 **/765 **/
modifiedtests/src/interfaces/augment-api-tx.tsdiffbeforeafterboth
181 [key: string]: SubmittableExtrinsicFunction<ApiType>;181 [key: string]: SubmittableExtrinsicFunction<ApiType>;
182 };182 };
183 evmMigration: {183 evmMigration: {
184 /**
185 * Start contract migration, inserts contract stub at target address,
186 * and marks account as pending, allowing to insert storage
187 **/
184 begin: AugmentedSubmittable<(address: H160 | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [H160]>;188 begin: AugmentedSubmittable<(address: H160 | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [H160]>;
189 /**
190 * Finish contract migration, allows it to be called.
191 * It is not possible to alter contract storage via [`Self::set_data`]
192 * after this call.
193 **/
185 finish: AugmentedSubmittable<(address: H160 | string | Uint8Array, code: Bytes | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [H160, Bytes]>;194 finish: AugmentedSubmittable<(address: H160 | string | Uint8Array, code: Bytes | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [H160, Bytes]>;
195 /**
196 * Insert items into contract storage, this method can be called
197 * multiple times
198 **/
186 setData: AugmentedSubmittable<(address: H160 | string | Uint8Array, data: Vec<ITuple<[H256, H256]>> | ([H256 | string | Uint8Array, H256 | string | Uint8Array])[]) => SubmittableExtrinsic<ApiType>, [H160, Vec<ITuple<[H256, H256]>>]>;199 setData: AugmentedSubmittable<(address: H160 | string | Uint8Array, data: Vec<ITuple<[H256, H256]>> | ([H256 | string | Uint8Array, H256 | string | Uint8Array])[]) => SubmittableExtrinsic<ApiType>, [H160, Vec<ITuple<[H256, H256]>>]>;
187 /**200 /**
188 * Generic tx201 * Generic tx
372 stopAppPromotion: AugmentedSubmittable<() => SubmittableExtrinsic<ApiType>, []>;385 stopAppPromotion: AugmentedSubmittable<() => SubmittableExtrinsic<ApiType>, []>;
373 stopSponsoringCollection: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32]>;386 stopSponsoringCollection: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32]>;
374 stopSponsoringContract: AugmentedSubmittable<(contractId: H160 | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [H160]>;387 stopSponsoringContract: AugmentedSubmittable<(contractId: H160 | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [H160]>;
375 unstake: AugmentedSubmittable<(amount: u128 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [u128]>;388 unstake: AugmentedSubmittable<() => SubmittableExtrinsic<ApiType>, []>;
376 /**389 /**
377 * Generic tx390 * Generic tx
378 **/391 **/
modifiedtests/src/interfaces/default/types.tsdiffbeforeafterboth
822 readonly amount: u128;822 readonly amount: u128;
823 } & Struct;823 } & Struct;
824 readonly isUnstake: boolean;824 readonly isUnstake: boolean;
825 readonly asUnstake: {
826 readonly amount: u128;
827 } & Struct;
828 readonly isSponsorCollection: boolean;825 readonly isSponsorCollection: boolean;
829 readonly asSponsorCollection: {826 readonly asSponsorCollection: {
830 readonly collectionId: u32;827 readonly collectionId: u32;
2639export interface UpDataStructsPropertyScope extends Enum {2636export interface UpDataStructsPropertyScope extends Enum {
2640 readonly isNone: boolean;2637 readonly isNone: boolean;
2641 readonly isRmrk: boolean;2638 readonly isRmrk: boolean;
2642 readonly isEth: boolean;
2643 readonly type: 'None' | 'Rmrk' | 'Eth';2639 readonly type: 'None' | 'Rmrk';
2644}2640}
26452641
2646/** @name UpDataStructsRpcCollection */2642/** @name UpDataStructsRpcCollection */
modifiedtests/src/interfaces/definitions.tsdiffbeforeafterboth
15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
1616
17export {default as unique} from './unique/definitions';17export {default as unique} from './unique/definitions';
18export {default as appPromotion} from './appPromotion/definitions';
18export {default as rmrk} from './rmrk/definitions';19export {default as rmrk} from './rmrk/definitions';
19export {default as default} from './default/definitions';20export {default as default} from './default/definitions';
modifiedtests/src/interfaces/lookup.tsdiffbeforeafterboth
2467 stake: {2467 stake: {
2468 amount: 'u128',2468 amount: 'u128',
2469 },2469 },
2470 unstake: {2470 unstake: 'Null',
2471 amount: 'u128',
2472 },
2473 sponsor_collection: {2471 sponsor_collection: {
2474 collectionId: 'u32',2472 collectionId: 'u32',
2475 },2473 },
3078 * Lookup403: up_data_structs::PropertyScope3076 * Lookup403: up_data_structs::PropertyScope
3079 **/3077 **/
3080 UpDataStructsPropertyScope: {3078 UpDataStructsPropertyScope: {
3081 _enum: ['None', 'Rmrk', 'Eth']3079 _enum: ['None', 'Rmrk']
3082 },3080 },
3083 /**3081 /**
3084 * Lookup405: pallet_nonfungible::pallet::Error<T>3082 * Lookup405: pallet_nonfungible::pallet::Error<T>
modifiedtests/src/interfaces/types-lookup.tsdiffbeforeafterboth
2675 readonly amount: u128;2675 readonly amount: u128;
2676 } & Struct;2676 } & Struct;
2677 readonly isUnstake: boolean;2677 readonly isUnstake: boolean;
2678 readonly asUnstake: {
2679 readonly amount: u128;
2680 } & Struct;
2681 readonly isSponsorCollection: boolean;2678 readonly isSponsorCollection: boolean;
2682 readonly asSponsorCollection: {2679 readonly asSponsorCollection: {
2683 readonly collectionId: u32;2680 readonly collectionId: u32;
3238 interface UpDataStructsPropertyScope extends Enum {3235 interface UpDataStructsPropertyScope extends Enum {
3239 readonly isNone: boolean;3236 readonly isNone: boolean;
3240 readonly isRmrk: boolean;3237 readonly isRmrk: boolean;
3241 readonly isEth: boolean;
3242 readonly type: 'None' | 'Rmrk' | 'Eth';3238 readonly type: 'None' | 'Rmrk';
3243 }3239 }
32443240
3245 /** @name PalletNonfungibleError (405) */3241 /** @name PalletNonfungibleError (405) */
modifiedtests/src/interfaces/types.tsdiffbeforeafterboth
2/* eslint-disable */2/* eslint-disable */
33
4export * from './unique/types';4export * from './unique/types';
5export * from './appPromotion/types';
5export * from './rmrk/types';6export * from './rmrk/types';
6export * from './default/types';7export * from './default/types';
78
modifiedtests/src/interfaces/unique/definitions.tsdiffbeforeafterboth
175 [collectionParam, tokenParam], 175 [collectionParam, tokenParam],
176 'Option<u128>',176 'Option<u128>',
177 ),177 ),
178 totalStaked: fun(
179 'Returns the total amount of staked tokens',
180 [{name: 'staker', type: CROSS_ACCOUNT_ID_TYPE, isOptional: true}],
181 'u128',
182 ),
183 totalStakedPerBlock: fun(
184 'Returns the total amount of staked tokens per block when staked',
185 [crossAccountParam('staker')],
186 'Vec<(u32, u128)>',
187 ),
188 totalStakingLocked: fun(
189 'Return the total amount locked by staking tokens',
190 [crossAccountParam('staker')],
191 'u128',
192 ),
193 pendingUnstake: fun(
194 'Returns the total amount of unstaked tokens',
195 [{name: 'staker', type: CROSS_ACCOUNT_ID_TYPE, isOptional: true}],
196 'u128',
197 ),
198 pendingUnstakePerBlock: fun(
199 'Returns the total amount of unstaked tokens per block',
200 [crossAccountParam('staker')],
201 'Vec<(u32, u128)>',
202 ),
203 },178 },
204};179};
205180
modifiedtests/src/substrate/substrate-api.tsdiffbeforeafterboth
42 },42 },
43 rpc: {43 rpc: {
44 unique: defs.unique.rpc,44 unique: defs.unique.rpc,
45 appPromotion: defs.appPromotion.rpc,
45 rmrk: defs.rmrk.rpc,46 rmrk: defs.rmrk.rpc,
46 eth: {47 eth: {
47 feeHistory: {48 feeHistory: {
modifiedtests/src/util/playgrounds/unique.dev.tsdiffbeforeafterboth
35 },35 },
36 rpc: {36 rpc: {
37 unique: defs.unique.rpc,37 unique: defs.unique.rpc,
38 appPromotion: defs.appPromotion.rpc,
38 rmrk: defs.rmrk.rpc,39 rmrk: defs.rmrk.rpc,
39 eth: {40 eth: {
40 feeHistory: {41 feeHistory: {
modifiedtests/src/util/playgrounds/unique.tsdiffbeforeafterboth
2027 }2027 }
20282028
2029 async getTotalStaked(address?: ICrossAccountId): Promise<bigint> {2029 async getTotalStaked(address?: ICrossAccountId): Promise<bigint> {
2030 if (address) return (await this.helper.callRpc('api.rpc.unique.totalStaked', [address])).toBigInt();2030 if (address) return (await this.helper.callRpc('api.rpc.appPromotion.totalStaked', [address])).toBigInt();
2031 return (await this.helper.callRpc('api.rpc.unique.totalStaked')).toBigInt();2031 return (await this.helper.callRpc('api.rpc.appPromotion.totalStaked')).toBigInt();
2032 }2032 }
20332033
2034 async getTotalStakingLocked(address: ICrossAccountId): Promise<bigint> {2034 async getTotalStakingLocked(address: ICrossAccountId): Promise<bigint> {
2035 return (await this.helper.callRpc('api.rpc.unique.totalStakingLocked', [address])).toBigInt();2035 return (await this.helper.callRpc('api.rpc.appPromotion.totalStakingLocked', [address])).toBigInt();
2036 }2036 }
20372037
2038 async getTotalStakedPerBlock(address: ICrossAccountId): Promise<bigint[][]> {2038 async getTotalStakedPerBlock(address: ICrossAccountId): Promise<bigint[][]> {
2039 return (await this.helper.callRpc('api.rpc.unique.totalStakedPerBlock', [address])).map(([block, amount]: any[]) => [block.toBigInt(), amount.toBigInt()]);2039 return (await this.helper.callRpc('api.rpc.appPromotion.totalStakedPerBlock', [address])).map(([block, amount]: any[]) => [block.toBigInt(), amount.toBigInt()]);
2040 }2040 }
20412041
2042 async getPendingUnstake(address: ICrossAccountId): Promise<bigint> {2042 async getPendingUnstake(address: ICrossAccountId): Promise<bigint> {
2043 return (await this.helper.callRpc('api.rpc.unique.pendingUnstake', [address])).toBigInt();2043 return (await this.helper.callRpc('api.rpc.appPromotion.pendingUnstake', [address])).toBigInt();
2044 }2044 }
2045 2045
2046 async getPendingUnstakePerBlock(address: ICrossAccountId): Promise<bigint[][]> {2046 async getPendingUnstakePerBlock(address: ICrossAccountId): Promise<bigint[][]> {
2047 return (await this.helper.callRpc('api.rpc.unique.pendingUnstakePerBlock', [address])).map(([block, amount]: any[]) => [block.toBigInt(), amount.toBigInt()]);2047 return (await this.helper.callRpc('api.rpc.appPromotion.pendingUnstakePerBlock', [address])).map(([block, amount]: any[]) => [block.toBigInt(), amount.toBigInt()]);
2048 }2048 }
2049}2049}
20502050