pub trait DispatchTransaction<Call>where
Call: Dispatchable,{
type Origin;
type Info;
type Result;
type Val;
type Pre;
// Required methods
fn validate_only(
&self,
origin: Self::Origin,
call: &Call,
info: &Self::Info,
len: usize,
source: TransactionSource,
extension_version: u8,
) -> Result<(ValidTransaction, Self::Val, Self::Origin), TransactionValidityError>;
fn validate_and_prepare(
self,
origin: Self::Origin,
call: &Call,
info: &Self::Info,
len: usize,
extension_version: u8,
) -> Result<(Self::Pre, Self::Origin), TransactionValidityError>;
fn dispatch_transaction(
self,
origin: Self::Origin,
call: Call,
info: &Self::Info,
len: usize,
extension_version: u8,
) -> Self::Result;
fn test_run(
self,
origin: Self::Origin,
call: &Call,
info: &Self::Info,
len: usize,
extension_version: u8,
substitute: impl FnOnce(Self::Origin) -> Result<<Call as Dispatchable>::PostInfo, DispatchErrorWithPostInfo<<Call as Dispatchable>::PostInfo>>,
) -> Self::Result;
}
Expand description
Single-function utility trait with a blanket impl over TransactionExtension
in order to
provide transaction dispatching functionality. We avoid implementing this directly on the trait
since we never want it to be overriden by the trait implementation.
Required Associated Types§
type Origin
type Origin
The origin type of the transaction.
type Info
type Info
The info type.
type Result
type Result
The resultant type.
type Val
type Val
The Val
of the extension.
type Pre
type Pre
The Pre
of the extension.
Required Methods§
fn validate_only(
&self,
origin: Self::Origin,
call: &Call,
info: &Self::Info,
len: usize,
source: TransactionSource,
extension_version: u8,
) -> Result<(ValidTransaction, Self::Val, Self::Origin), TransactionValidityError>
fn validate_only( &self, origin: Self::Origin, call: &Call, info: &Self::Info, len: usize, source: TransactionSource, extension_version: u8, ) -> Result<(ValidTransaction, Self::Val, Self::Origin), TransactionValidityError>
Just validate a transaction.
The is basically the same as validate, except that there is no need to supply the bond data.
fn validate_and_prepare(
self,
origin: Self::Origin,
call: &Call,
info: &Self::Info,
len: usize,
extension_version: u8,
) -> Result<(Self::Pre, Self::Origin), TransactionValidityError>
fn validate_and_prepare( self, origin: Self::Origin, call: &Call, info: &Self::Info, len: usize, extension_version: u8, ) -> Result<(Self::Pre, Self::Origin), TransactionValidityError>
Validate and prepare a transaction, ready for dispatch.
fn dispatch_transaction(
self,
origin: Self::Origin,
call: Call,
info: &Self::Info,
len: usize,
extension_version: u8,
) -> Self::Result
fn dispatch_transaction( self, origin: Self::Origin, call: Call, info: &Self::Info, len: usize, extension_version: u8, ) -> Self::Result
Dispatch a transaction with the given base origin and call.
fn test_run(
self,
origin: Self::Origin,
call: &Call,
info: &Self::Info,
len: usize,
extension_version: u8,
substitute: impl FnOnce(Self::Origin) -> Result<<Call as Dispatchable>::PostInfo, DispatchErrorWithPostInfo<<Call as Dispatchable>::PostInfo>>,
) -> Self::Result
fn test_run( self, origin: Self::Origin, call: &Call, info: &Self::Info, len: usize, extension_version: u8, substitute: impl FnOnce(Self::Origin) -> Result<<Call as Dispatchable>::PostInfo, DispatchErrorWithPostInfo<<Call as Dispatchable>::PostInfo>>, ) -> Self::Result
Do everything which would be done in a dispatch_transaction,
but instead of executing the call, execute substitute
instead. Since this doesn’t actually
dispatch the call, it doesn’t need to consume it and so call
can be passed as a reference.