referrerpolicy=no-referrer-when-downgrade

Trait polkadot_sdk_frame::traits::OriginTrait

pub trait OriginTrait: Sized {
    type Call;
    type PalletsOrigin: Send + Sync + Into<Self> + CallerTrait<Self::AccountId> + MaxEncodedLen;
    type AccountId;

Show 16 methods // Required methods fn add_filter(&mut self, filter: impl Fn(&Self::Call) -> bool + 'static); fn reset_filter(&mut self); fn set_caller_from(&mut self, other: impl Into<Self>); fn set_caller(&mut self, caller: Self::PalletsOrigin); fn filter_call(&self, call: &Self::Call) -> bool; fn caller(&self) -> &Self::PalletsOrigin; fn into_caller(self) -> Self::PalletsOrigin; fn try_with_caller<R>( self, f: impl FnOnce(Self::PalletsOrigin) -> Result<R, Self::PalletsOrigin>, ) -> Result<R, Self>; fn none() -> Self; fn root() -> Self; fn signed(by: Self::AccountId) -> Self; // Provided methods fn set_caller_from_signed(&mut self, caller_account: Self::AccountId) { ... } fn as_signed(self) -> Option<Self::AccountId> { ... } fn into_signer(self) -> Option<Self::AccountId> { ... } fn as_system_ref(&self) -> Option<&RawOrigin<Self::AccountId>> { ... } fn as_signer(&self) -> Option<&Self::AccountId> { ... }
}
Expand description

Methods available on frame_system::Config::RuntimeOrigin.

Required Associated Types§

type Call

Runtime call type, as in frame_system::Config::Call

type PalletsOrigin: Send + Sync + Into<Self> + CallerTrait<Self::AccountId> + MaxEncodedLen

The caller origin, overarching type of all pallets origins.

type AccountId

The AccountId used across the system.

Required Methods§

fn add_filter(&mut self, filter: impl Fn(&Self::Call) -> bool + 'static)

Add a filter to the origin.

fn reset_filter(&mut self)

Reset origin filters to default one, i.e frame_system::1fig::BaseCallFilter.

fn set_caller_from(&mut self, other: impl Into<Self>)

Replace the caller with caller from the other origin

fn set_caller(&mut self, caller: Self::PalletsOrigin)

Replace the caller with caller from the other origin

fn filter_call(&self, call: &Self::Call) -> bool

Filter the call if caller is not root, if false is returned then the call must be filtered out.

For root origin caller, the filters are bypassed and true is returned.

fn caller(&self) -> &Self::PalletsOrigin

Get a reference to the caller (CallerTrait impl).

fn into_caller(self) -> Self::PalletsOrigin

Consume self and return the caller.

fn try_with_caller<R>( self, f: impl FnOnce(Self::PalletsOrigin) -> Result<R, Self::PalletsOrigin>, ) -> Result<R, Self>

Do something with the caller, consuming self but returning it if the caller was unused.

fn none() -> Self

Create with system none origin and frame_system::Config::BaseCallFilter.

fn root() -> Self

Create with system root origin and frame_system::Config::BaseCallFilter.

fn signed(by: Self::AccountId) -> Self

Create with system signed origin and frame_system::Config::BaseCallFilter.

Provided Methods§

fn set_caller_from_signed(&mut self, caller_account: Self::AccountId)

Replace the caller with caller from the other origin

fn as_signed(self) -> Option<Self::AccountId>

👎Deprecated: Use into_signer instead

Extract the signer from the message if it is a Signed origin.

fn into_signer(self) -> Option<Self::AccountId>

Extract the signer from the message if it is a Signed origin.

fn as_system_ref(&self) -> Option<&RawOrigin<Self::AccountId>>

Extract a reference to the system origin, if that’s what the caller is.

fn as_signer(&self) -> Option<&Self::AccountId>

Extract a reference to the signer, if that’s what the caller is.

Object Safety§

This trait is not object safe.

Implementors§