RPC to query transaction fee + weight + info (#3876)

* initial version for testing

* New version that compiles

* optional at block parameter

* Fix some more view grumbles.

* Update srml/transaction-payment/src/lib.rs
This commit is contained in:
Kian Paimani
2019-10-28 16:04:45 +01:00
committed by Gavin Wood
parent 9b1dd268bf
commit 7e87dfdc07
15 changed files with 359 additions and 21 deletions
@@ -23,6 +23,7 @@ use codec::{Decode, Encode, EncodeLike, Input, Error};
use crate::{
traits::{self, Member, MaybeDisplay, SignedExtension, Checkable, Extrinsic, IdentifyAccount},
generic::CheckedExtrinsic, transaction_validity::{TransactionValidityError, InvalidTransaction},
weights::{GetDispatchInfo, DispatchInfo},
};
const TRANSACTION_VERSION: u8 = 4;
@@ -280,6 +281,17 @@ where
}
}
impl<Address, Call, Signature, Extra> GetDispatchInfo
for UncheckedExtrinsic<Address, Call, Signature, Extra>
where
Call: GetDispatchInfo,
Extra: SignedExtension,
{
fn get_dispatch_info(&self) -> DispatchInfo {
self.function.get_dispatch_info()
}
}
#[cfg(test)]
mod tests {
use super::*;
+8 -4
View File
@@ -35,9 +35,13 @@
//! Note that the decl_module macro _cannot_ enforce this and will simply fail if an invalid struct
//! (something that does not implement `Weighable`) is passed in.
#[cfg(feature = "std")]
use serde::{Serialize, Deserialize};
use codec::{Encode, Decode};
use arithmetic::traits::Bounded;
use crate::RuntimeDebug;
/// Re-export priority as type
pub use crate::transaction_validity::TransactionPriority;
/// Numeric range of a transaction weight.
@@ -58,10 +62,10 @@ pub trait ClassifyDispatch<T> {
fn classify_dispatch(&self, target: T) -> DispatchClass;
}
/// A generalized group of dispatch types. This is only distinguishing normal, user-triggered
/// transactions (`Normal`) and anything beyond which serves a higher purpose to the system
/// (`Operational`).
#[derive(PartialEq, Eq, Clone, Copy, RuntimeDebug)]
/// A generalized group of dispatch types. This is only distinguishing normal, user-triggered transactions
/// (`Normal`) and anything beyond which serves a higher purpose to the system (`Operational`).
#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
#[derive(PartialEq, Eq, Clone, Copy, Encode, Decode, RuntimeDebug)]
pub enum DispatchClass {
/// A normal dispatch.
Normal,