Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Add Transaction Fee RPC to Statemint/Statemine #559

Merged
merged 11 commits into from
Aug 17, 2021
12 changes: 11 additions & 1 deletion polkadot-parachains/src/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,24 @@

use std::sync::Arc;

use polkadot_primitives::v1::{AccountId, Balance, Block, Nonce};
use sc_client_api::AuxStore;
pub use sc_rpc::{DenyUnsafe, SubscriptionTaskExecutor};
use sp_api::ProvideRuntimeApi;
use sp_block_builder::BlockBuilder;
use sp_blockchain::{Error as BlockChainError, HeaderBackend, HeaderMetadata};
use txpool_api::TransactionPool;

/// Alias to 512-bit hash when used in the context of a transaction signature on the chain.
pub type Signature = sp_runtime::MultiSignature;
/// Some way of identifying an account on the chain. We intentionally make it equivalent
/// to the public key of our transaction signing scheme.
pub type AccountId = <<Signature as sp_runtime::traits::Verify>::Signer as sp_runtime::traits::IdentifyAccount>::AccountId;
type BlockNumber = u32;
type Header = sp_runtime::generic::Header<BlockNumber, sp_runtime::traits::BlakeTwo256>;
pub type Block = sp_runtime::generic::Block<Header, sp_runtime::OpaqueExtrinsic>;
type Balance = u128;
type Nonce = u32;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i dont think this is right either. shouldnt be that we are redefining all these types here.

should make the function generic over these types, or properly import them

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved them to primitives module and imported the common primitives in rpc.rs and service.rs.

hamidra marked this conversation as resolved.
Show resolved Hide resolved

/// A type representing all RPC extensions.
pub type RpcExtension = jsonrpc_core::IoHandler<sc_rpc::Metadata>;

Expand Down
10 changes: 9 additions & 1 deletion polkadot-parachains/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ use cumulus_primitives_core::{
relay_chain::v1::{Hash as PHash, PersistedValidationData},
ParaId,
};
pub use polkadot_primitives::v1::{AccountId, Balance, Block, Hash, Nonce};

use crate::rpc as parachain_rpc;
hamidra marked this conversation as resolved.
Show resolved Hide resolved
use cumulus_client_consensus_relay_chain::Verifier as RelayChainVerifier;
Expand All @@ -53,8 +52,17 @@ use sp_runtime::{
use std::sync::Arc;
use substrate_prometheus_endpoint::Registry;

/// Alias to 512-bit hash when used in the context of a transaction signature on the chain.
pub type Signature = sp_runtime::MultiSignature;
/// Some way of identifying an account on the chain. We intentionally make it equivalent
/// to the public key of our transaction signing scheme.
pub type AccountId = <<Signature as sp_runtime::traits::Verify>::Signer as sp_runtime::traits::IdentifyAccount>::AccountId;
type BlockNumber = u32;
type Header = sp_runtime::generic::Header<BlockNumber, sp_runtime::traits::BlakeTwo256>;
pub type Block = sp_runtime::generic::Block<Header, sp_runtime::OpaqueExtrinsic>;
type Hash = sp_core::H256;
type Balance = u128;
type Nonce = u32;

// Native executor instance.
native_executor_instance!(
Expand Down