This repository has been archived by the owner on Nov 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 378
Add Transaction Fee RPC to Statemint/Statemine #559
Merged
Merged
Changes from 7 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
87be10d
add payment rpc to parachains
hamidra f12278d
connect payment rpc to parachains clients
hamidra 16fef5b
fix the rumtime_api bound/ add separate start node implementation for…
hamidra 6fb988e
use cumulus/parachain specific primitives
hamidra c817513
Update polkadot-parachains/src/rpc.rs
hamidra 5c2cdc7
rename txpool dependency
hamidra 98e7f50
fix the package name
hamidra 9d3b724
move parachain primitives to separate module
hamidra 069e125
Refactor Shared Primitves for Payment Info (#577)
shawntabrizi 9124f83
Merge branch 'master' into hamidra/payment-info
shawntabrizi 6b5aa52
Update service.rs
shawntabrizi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
// Copyright 2021 Parity Technologies (UK) Ltd. | ||
// This file is part of Cumulus. | ||
|
||
// Cumulus 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. | ||
|
||
// Cumulus 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 Cumulus. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
//! Parachain-specific RPCs implementation. | ||
|
||
#![warn(missing_docs)] | ||
|
||
use std::sync::Arc; | ||
|
||
use sc_client_api::AuxStore; | ||
pub use sc_rpc::{DenyUnsafe, SubscriptionTaskExecutor}; | ||
use sc_transaction_pool_api::TransactionPool; | ||
use sp_api::ProvideRuntimeApi; | ||
use sp_block_builder::BlockBuilder; | ||
use sp_blockchain::{Error as BlockChainError, HeaderBackend, HeaderMetadata}; | ||
|
||
/// 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; | ||
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>; | ||
|
||
/// Full client dependencies | ||
pub struct FullDeps<C, P> { | ||
/// The client instance to use. | ||
pub client: Arc<C>, | ||
/// Transaction pool instance. | ||
pub pool: Arc<P>, | ||
/// Whether to deny unsafe calls | ||
pub deny_unsafe: DenyUnsafe, | ||
} | ||
|
||
/// Instantiate all RPC extensions. | ||
pub fn create_full<C, P>(deps: FullDeps<C, P>) -> RpcExtension | ||
where | ||
C: ProvideRuntimeApi<Block> | ||
+ HeaderBackend<Block> | ||
+ AuxStore | ||
+ HeaderMetadata<Block, Error = BlockChainError> | ||
+ Send | ||
+ Sync | ||
+ 'static, | ||
C::Api: frame_rpc_system::AccountNonceApi<Block, AccountId, Nonce>, | ||
C::Api: pallet_transaction_payment_rpc::TransactionPaymentRuntimeApi<Block, Balance>, | ||
C::Api: BlockBuilder<Block>, | ||
P: TransactionPool + Sync + Send + 'static, | ||
{ | ||
use frame_rpc_system::{FullSystem, SystemApi}; | ||
use pallet_transaction_payment_rpc::{TransactionPayment, TransactionPaymentApi}; | ||
|
||
let mut io = jsonrpc_core::IoHandler::default(); | ||
let FullDeps { | ||
client, | ||
pool, | ||
deny_unsafe, | ||
} = deps; | ||
|
||
io.extend_with(SystemApi::to_delegate(FullSystem::new( | ||
client.clone(), | ||
pool, | ||
deny_unsafe, | ||
))); | ||
io.extend_with(TransactionPaymentApi::to_delegate(TransactionPayment::new( | ||
client.clone(), | ||
))); | ||
|
||
io | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.