referrerpolicy=no-referrer-when-downgrade
frame_support::traits

Trait Authorize

Source
pub trait Authorize {
    // Required methods
    fn authorize(
        &self,
        source: TransactionSource,
    ) -> Option<Result<(ValidTransaction, Weight), TransactionValidityError>>;
    fn weight_of_authorize(&self) -> Weight;
}
Expand description

A trait to allow calls to authorize themselves from the origin None.

It is implemented by the crate::pallet macro and used by the frame_system::AuthorizeCall transaction extension.

Pallet writers can declare the authorization logic for a call using the call attribute: crate::pallet_macros::authorize.

Required Methods§

Source

fn authorize( &self, source: TransactionSource, ) -> Option<Result<(ValidTransaction, Weight), TransactionValidityError>>

The authorize function.

Returns

  • Some(Ok((valid_transaction, unspent weight))) if the call is successfully authorized,
  • Some(Err(error)) if the call authorization is invalid,
  • None if the call doesn’t provide any authorization.
Source

fn weight_of_authorize(&self) -> Weight

The weight of the authorization function.

Implementors§