referrerpolicy=no-referrer-when-downgrade
pub trait DispatchTransaction<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: ExtensionVersion,
    ) -> Result<(ValidTransaction, Self::Val, Self::Origin), TransactionValidityError>;
    fn validate_and_prepare(
        self,
        origin: Self::Origin,
        call: &Call,
        info: &Self::Info,
        len: usize,
        extension_version: ExtensionVersion,
    ) -> Result<(Self::Pre, Self::Origin), TransactionValidityError>;
    fn dispatch_transaction(
        self,
        origin: Self::Origin,
        call: Call,
        info: &Self::Info,
        len: usize,
        extension_version: ExtensionVersion,
    ) -> Self::Result;
    fn test_run(
        self,
        origin: Self::Origin,
        call: &Call,
        info: &Self::Info,
        len: usize,
        extension_version: ExtensionVersion,
        substitute: impl FnOnce(Self::Origin) -> DispatchResultWithInfo<<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§

source

type Origin

The origin type of the transaction.

source

type Info

The info type.

source

type Result

The resultant type.

source

type Val

The Val of the extension.

source

type Pre

The Pre of the extension.

Required Methods§

source

fn validate_only( &self, origin: Self::Origin, call: &Call, info: &Self::Info, len: usize, source: TransactionSource, extension_version: ExtensionVersion, ) -> 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.

source

fn validate_and_prepare( self, origin: Self::Origin, call: &Call, info: &Self::Info, len: usize, extension_version: ExtensionVersion, ) -> Result<(Self::Pre, Self::Origin), TransactionValidityError>

Validate and prepare a transaction, ready for dispatch.

source

fn dispatch_transaction( self, origin: Self::Origin, call: Call, info: &Self::Info, len: usize, extension_version: ExtensionVersion, ) -> Self::Result

Dispatch a transaction with the given base origin and call.

source

fn test_run( self, origin: Self::Origin, call: &Call, info: &Self::Info, len: usize, extension_version: ExtensionVersion, substitute: impl FnOnce(Self::Origin) -> DispatchResultWithInfo<<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.

Object Safety§

This trait is not object safe.

Implementors§