Skip to content

Commit 98f0b0a

Browse files
committed
Uncomment custom RPCs
1 parent ab15a64 commit 98f0b0a

File tree

6 files changed

+74
-75
lines changed

6 files changed

+74
-75
lines changed

Cargo.lock

Lines changed: 3 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ categories = ["cryptography::cryptocurrencies"]
1414
[dependencies]
1515
clap = { version = "4.3.12", features = ["derive"] }
1616
log = "0.4.19"
17-
codec = { package = "parity-scale-codec", version = "3.0.0" }
1817
serde = { version = "1.0.171", features = ["derive"] }
1918
hex-literal = "0.4.1"
2019
jsonrpsee = { version = "0.16.2", features = ["server"] }

node/src/rpc.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,27 +48,27 @@ where
4848
+ Sync
4949
+ 'static,
5050
C::Api: pallet_transaction_payment_rpc::TransactionPaymentRuntimeApi<Block, Balance>,
51-
// C::Api: pallet_creator_staking_rpc::CreatorStakingRuntimeApi<Block, AccountId, Balance>,
52-
// C::Api: pallet_domains_rpc::DomainsRuntimeApi<Block, Balance>,
53-
// C::Api: pallet_posts_rpc::PostsRuntimeApi<Block, AccountId>,
51+
C::Api: pallet_creator_staking_rpc::CreatorStakingRuntimeApi<Block, AccountId, Balance>,
52+
C::Api: pallet_domains_rpc::DomainsRuntimeApi<Block, Balance>,
53+
C::Api: pallet_posts_rpc::PostsRuntimeApi<Block, AccountId>,
5454
C::Api: substrate_frame_rpc_system::AccountNonceApi<Block, AccountId, Nonce>,
5555
C::Api: BlockBuilder<Block>,
5656
P: TransactionPool + Sync + Send + 'static,
5757
{
5858
use pallet_transaction_payment_rpc::{TransactionPayment, TransactionPaymentApiServer};
59-
// use pallet_creator_staking_rpc::{CreatorStaking, CreatorStakingApiServer};
60-
// use pallet_domains_rpc::{Domains, DomainsApiServer};
61-
// use pallet_posts_rpc::{Posts, PostsApiServer};
59+
use pallet_creator_staking_rpc::{CreatorStaking, CreatorStakingApiServer};
60+
use pallet_domains_rpc::{Domains, DomainsApiServer};
61+
use pallet_posts_rpc::{Posts, PostsApiServer};
6262
use substrate_frame_rpc_system::{System, SystemApiServer};
6363

6464
let mut module = RpcExtension::new(());
6565
let FullDeps { client, pool, deny_unsafe } = deps;
6666

6767
module.merge(System::new(client.clone(), pool, deny_unsafe).into_rpc())?;
6868
module.merge(TransactionPayment::new(client.clone()).into_rpc())?;
69-
// module.merge(CreatorStaking::new(client.clone()).into_rpc())?;
70-
// module.merge(Domains::new(client.clone()).into_rpc())?;
71-
// module.merge(Posts::new(client).into_rpc())?;
69+
module.merge(CreatorStaking::new(client.clone()).into_rpc())?;
70+
module.merge(Domains::new(client.clone()).into_rpc())?;
71+
module.merge(Posts::new(client).into_rpc())?;
7272

7373
Ok(module)
7474
}

pallets/domains/rpc/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,5 @@ jsonrpsee = { version = "0.16.2", features = ["client-core", "server", "macros"]
1919
pallet-domains-rpc-runtime-api = { path = "./runtime-api" }
2020
sp-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" }
2121
sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" }
22-
sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" }
2322
sp-rpc = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" }
2423
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" }

runtime/Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,9 @@ pallet-collator-selection = { git = "https://github.com/paritytech/cumulus", def
100100
parachain-info = { git = "https://github.com/paritytech/cumulus", default-features = false, branch = "polkadot-v1.0.0" }
101101

102102
# Custom Runtime API
103-
#pallet-creator-staking-rpc-runtime-api = { path = "../pallets/creator-staking/rpc/runtime-api", default-features = false }
104-
#pallet-domains-rpc-runtime-api = { path = "../pallets/domains/rpc/runtime-api", default-features = false }
105-
#pallet-posts-rpc-runtime-api = { path = "../pallets/posts/rpc/runtime-api", default-features = false }
103+
pallet-creator-staking-rpc-runtime-api = { path = "../pallets/creator-staking/rpc/runtime-api", default-features = false }
104+
pallet-domains-rpc-runtime-api = { path = "../pallets/domains/rpc/runtime-api", default-features = false }
105+
pallet-posts-rpc-runtime-api = { path = "../pallets/posts/rpc/runtime-api", default-features = false }
106106

107107
[features]
108108
default = [

runtime/src/lib.rs

Lines changed: 59 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1099,65 +1099,65 @@ impl_runtime_apis! {
10991099
}
11001100
}
11011101

1102-
// impl pallet_creator_staking_rpc_runtime_api::CreatorStakingApi<Block, AccountId, Balance>
1103-
// for Runtime
1104-
// {
1105-
// fn estimated_backer_rewards_by_creators(
1106-
// backer: AccountId,
1107-
// creators: Vec<CreatorId>,
1108-
// ) -> Vec<(CreatorId, Balance)> {
1109-
// CreatorStaking::estimated_backer_rewards_by_creators(backer, creators)
1110-
// }
1111-
//
1112-
// fn withdrawable_amounts_from_inactive_creators(
1113-
// backer: AccountId,
1114-
// ) -> Vec<(CreatorId, Balance)> {
1115-
// CreatorStaking::withdrawable_amounts_from_inactive_creators(backer)
1116-
// }
1117-
//
1118-
// fn available_claims_by_backer(
1119-
// backer: AccountId,
1120-
// ) -> Vec<(CreatorId, u32)> {
1121-
// CreatorStaking::available_claims_by_backer(backer)
1122-
// }
1123-
//
1124-
// fn estimated_creator_rewards(
1125-
// creator: CreatorId,
1126-
// ) -> Balance {
1127-
// CreatorStaking::estimated_creator_rewards(creator)
1128-
// }
1129-
//
1130-
// fn available_claims_by_creator(
1131-
// creator: CreatorId,
1132-
// ) -> Vec<EraIndex> {
1133-
// CreatorStaking::available_claims_by_creator(creator)
1134-
// }
1135-
// }
1136-
//
1137-
// impl pallet_domains_rpc_runtime_api::DomainsApi<Block, Balance> for Runtime {
1138-
// fn calculate_price(subdomain: Vec<u8>) -> Option<Balance> {
1139-
// Domains::calculate_price(&subdomain)
1140-
// }
1141-
// }
1142-
//
1143-
// impl pallet_posts_rpc_runtime_api::PostsApi<Block, AccountId> for Runtime {
1144-
// fn can_create_post(
1145-
// account: AccountId,
1146-
// space_id: SpaceId,
1147-
// content_opt: Option<Content>,
1148-
// ) -> DispatchResult {
1149-
// Posts::can_create_regular_post(account, space_id, content_opt)
1150-
// }
1151-
//
1152-
// fn can_create_comment(
1153-
// account: AccountId,
1154-
// root_post_id: PostId,
1155-
// parent_id_opt: Option<PostId>,
1156-
// content_opt: Option<Content>
1157-
// ) -> DispatchResult {
1158-
// Posts::can_create_comment(account, root_post_id, parent_id_opt, content_opt)
1159-
// }
1160-
// }
1102+
impl pallet_creator_staking_rpc_runtime_api::CreatorStakingApi<Block, AccountId, Balance>
1103+
for Runtime
1104+
{
1105+
fn estimated_backer_rewards_by_creators(
1106+
backer: AccountId,
1107+
creators: Vec<CreatorId>,
1108+
) -> Vec<(CreatorId, Balance)> {
1109+
CreatorStaking::estimated_backer_rewards_by_creators(backer, creators)
1110+
}
1111+
1112+
fn withdrawable_amounts_from_inactive_creators(
1113+
backer: AccountId,
1114+
) -> Vec<(CreatorId, Balance)> {
1115+
CreatorStaking::withdrawable_amounts_from_inactive_creators(backer)
1116+
}
1117+
1118+
fn available_claims_by_backer(
1119+
backer: AccountId,
1120+
) -> Vec<(CreatorId, u32)> {
1121+
CreatorStaking::available_claims_by_backer(backer)
1122+
}
1123+
1124+
fn estimated_creator_rewards(
1125+
creator: CreatorId,
1126+
) -> Balance {
1127+
CreatorStaking::estimated_creator_rewards(creator)
1128+
}
1129+
1130+
fn available_claims_by_creator(
1131+
creator: CreatorId,
1132+
) -> Vec<EraIndex> {
1133+
CreatorStaking::available_claims_by_creator(creator)
1134+
}
1135+
}
1136+
1137+
impl pallet_domains_rpc_runtime_api::DomainsApi<Block, Balance> for Runtime {
1138+
fn calculate_price(subdomain: Vec<u8>) -> Option<Balance> {
1139+
Domains::calculate_price(&subdomain)
1140+
}
1141+
}
1142+
1143+
impl pallet_posts_rpc_runtime_api::PostsApi<Block, AccountId> for Runtime {
1144+
fn can_create_post(
1145+
account: AccountId,
1146+
space_id: SpaceId,
1147+
content_opt: Option<Content>,
1148+
) -> DispatchResult {
1149+
Posts::can_create_regular_post(account, space_id, content_opt)
1150+
}
1151+
1152+
fn can_create_comment(
1153+
account: AccountId,
1154+
root_post_id: PostId,
1155+
parent_id_opt: Option<PostId>,
1156+
content_opt: Option<Content>
1157+
) -> DispatchResult {
1158+
Posts::can_create_comment(account, root_post_id, parent_id_opt, content_opt)
1159+
}
1160+
}
11611161

11621162
#[cfg(feature = "try-runtime")]
11631163
impl frame_try_runtime::TryRuntime<Block> for Runtime {

0 commit comments

Comments
 (0)