Struct frame_system::offchain::Signer
source · pub struct Signer<T: SigningTypes, C: AppCrypto<T::Public, T::Signature>, X = ForAny> { /* private fields */ }
Expand description
Provides an implementation for signing transaction payloads.
Keys used for signing are defined when instantiating the signer object. Signing can be done using:
- All supported keys in the keystore
- Any of the supported keys in the keystore
- An intersection of in-keystore keys and the list of provided keys
The signer is then able to:
- Submit a unsigned transaction with a signed payload
- Submit a signed transaction
Implementations§
source§impl<T: SigningTypes, C: AppCrypto<T::Public, T::Signature>, X> Signer<T, C, X>
impl<T: SigningTypes, C: AppCrypto<T::Public, T::Signature>, X> Signer<T, C, X>
sourcepub fn all_accounts() -> Signer<T, C, ForAll>
pub fn all_accounts() -> Signer<T, C, ForAll>
Use all available keys for signing.
sourcepub fn any_account() -> Signer<T, C, ForAny>
pub fn any_account() -> Signer<T, C, ForAny>
Use any of the available keys for signing.
sourcepub fn with_filter(self, accounts: Vec<T::Public>) -> Self
pub fn with_filter(self, accounts: Vec<T::Public>) -> Self
Use provided accounts
for signing.
Note that not all keys will be necessarily used. The provided vector of accounts will be intersected with the supported keys in the keystore and the resulting list will be used for signing.
sourcepub fn accounts_from_keys<'a>(
&'a self,
) -> Box<dyn Iterator<Item = Account<T>> + 'a>
pub fn accounts_from_keys<'a>( &'a self, ) -> Box<dyn Iterator<Item = Account<T>> + 'a>
Return a vector of the intersection between
all available accounts and the provided accounts
in with_filter
. If no accounts are provided,
use all accounts by default.
sourcepub fn keystore_accounts() -> impl Iterator<Item = Account<T>>
pub fn keystore_accounts() -> impl Iterator<Item = Account<T>>
Return all available accounts in keystore.
Trait Implementations§
source§impl<T: CreateSignedTransaction<LocalCall> + SigningTypes, C: AppCrypto<T::Public, T::Signature>, LocalCall> SendSignedTransaction<T, C, LocalCall> for Signer<T, C, ForAny>
impl<T: CreateSignedTransaction<LocalCall> + SigningTypes, C: AppCrypto<T::Public, T::Signature>, LocalCall> SendSignedTransaction<T, C, LocalCall> for Signer<T, C, ForAny>
source§impl<T: SigningTypes + CreateSignedTransaction<LocalCall>, C: AppCrypto<T::Public, T::Signature>, LocalCall> SendSignedTransaction<T, C, LocalCall> for Signer<T, C, ForAll>
impl<T: SigningTypes + CreateSignedTransaction<LocalCall>, C: AppCrypto<T::Public, T::Signature>, LocalCall> SendSignedTransaction<T, C, LocalCall> for Signer<T, C, ForAll>
source§impl<T: SigningTypes + SendTransactionTypes<LocalCall>, C: AppCrypto<T::Public, T::Signature>, LocalCall> SendUnsignedTransaction<T, LocalCall> for Signer<T, C, ForAny>
impl<T: SigningTypes + SendTransactionTypes<LocalCall>, C: AppCrypto<T::Public, T::Signature>, LocalCall> SendUnsignedTransaction<T, LocalCall> for Signer<T, C, ForAny>
source§impl<T: SigningTypes + SendTransactionTypes<LocalCall>, C: AppCrypto<T::Public, T::Signature>, LocalCall> SendUnsignedTransaction<T, LocalCall> for Signer<T, C, ForAll>
impl<T: SigningTypes + SendTransactionTypes<LocalCall>, C: AppCrypto<T::Public, T::Signature>, LocalCall> SendUnsignedTransaction<T, LocalCall> for Signer<T, C, ForAll>
source§impl<T: SigningTypes, C: AppCrypto<T::Public, T::Signature>> SignMessage<T> for Signer<T, C, ForAny>
impl<T: SigningTypes, C: AppCrypto<T::Public, T::Signature>> SignMessage<T> for Signer<T, C, ForAny>
§type SignatureData = Option<(Account<T>, <T as SigningTypes>::Signature)>
type SignatureData = Option<(Account<T>, <T as SigningTypes>::Signature)>
A signature data. Read more
source§fn sign_message(&self, message: &[u8]) -> Self::SignatureData
fn sign_message(&self, message: &[u8]) -> Self::SignatureData
Sign a message. Read more
source§fn sign<TPayload, F>(&self, f: F) -> Self::SignatureData
fn sign<TPayload, F>(&self, f: F) -> Self::SignatureData
Construct and sign given payload. Read more
source§impl<T: SigningTypes, C: AppCrypto<T::Public, T::Signature>> SignMessage<T> for Signer<T, C, ForAll>
impl<T: SigningTypes, C: AppCrypto<T::Public, T::Signature>> SignMessage<T> for Signer<T, C, ForAll>
§type SignatureData = Vec<(Account<T>, <T as SigningTypes>::Signature)>
type SignatureData = Vec<(Account<T>, <T as SigningTypes>::Signature)>
A signature data. Read more
source§fn sign_message(&self, message: &[u8]) -> Self::SignatureData
fn sign_message(&self, message: &[u8]) -> Self::SignatureData
Sign a message. Read more
source§fn sign<TPayload, F>(&self, f: F) -> Self::SignatureData
fn sign<TPayload, F>(&self, f: F) -> Self::SignatureData
Construct and sign given payload. Read more
Auto Trait Implementations§
impl<T, C, X> Freeze for Signer<T, C, X>
impl<T, C, X> RefUnwindSafe for Signer<T, C, X>
impl<T, C, X> Send for Signer<T, C, X>
impl<T, C, X> Sync for Signer<T, C, X>
impl<T, C, X> Unpin for Signer<T, C, X>
impl<T, C, X> UnwindSafe for Signer<T, C, X>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> CheckedConversion for T
impl<T> CheckedConversion for T
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§impl<T, Outer> IsWrappedBy<Outer> for T
impl<T, Outer> IsWrappedBy<Outer> for T
source§impl<T> SaturatedConversion for T
impl<T> SaturatedConversion for T
source§fn saturated_from<T>(t: T) -> Selfwhere
Self: UniqueSaturatedFrom<T>,
fn saturated_from<T>(t: T) -> Selfwhere
Self: UniqueSaturatedFrom<T>,
source§fn saturated_into<T>(self) -> Twhere
Self: UniqueSaturatedInto<T>,
fn saturated_into<T>(self) -> Twhere
Self: UniqueSaturatedInto<T>,
Consume self to return an equivalent value of
T
. Read moresource§impl<T, U> TryIntoKey<U> for Twhere
U: TryFromKey<T>,
impl<T, U> TryIntoKey<U> for Twhere
U: TryFromKey<T>,
type Error = <U as TryFromKey<T>>::Error
fn try_into_key(self) -> Result<U, <U as TryFromKey<T>>::Error>
source§impl<S, T> UncheckedInto<T> for Swhere
T: UncheckedFrom<S>,
impl<S, T> UncheckedInto<T> for Swhere
T: UncheckedFrom<S>,
source§fn unchecked_into(self) -> T
fn unchecked_into(self) -> T
The counterpart to
unchecked_from
.source§impl<T, S> UniqueSaturatedInto<T> for S
impl<T, S> UniqueSaturatedInto<T> for S
source§fn unique_saturated_into(self) -> T
fn unique_saturated_into(self) -> T
Consume self to return an equivalent value of
T
.