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.
Trait Implementations§
source§impl<T, C, X> Debug for Signer<T, C, X>where
T: Debug + SigningTypes,
C: Debug + AppCrypto<T::Public, T::Signature>,
X: Debug,
impl<T, C, X> Debug for Signer<T, C, X>where T: Debug + SigningTypes, C: Debug + AppCrypto<T::Public, T::Signature>, X: Debug,
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: 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 + 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§fn send_unsigned_transaction<TPayload, F>(
&self,
f: F,
f2: impl Fn(TPayload, T::Signature) -> LocalCall
) -> Self::Resultwhere
F: Fn(&Account<T>) -> TPayload,
TPayload: SignedPayload<T>,
fn send_unsigned_transaction<TPayload, F>( &self, f: F, f2: impl Fn(TPayload, T::Signature) -> LocalCall ) -> Self::Resultwhere F: Fn(&Account<T>) -> TPayload, TPayload: SignedPayload<T>,
Send an unsigned transaction with a signed payload. Read more
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§fn send_unsigned_transaction<TPayload, F>(
&self,
f: F,
f2: impl Fn(TPayload, T::Signature) -> LocalCall
) -> Self::Resultwhere
F: Fn(&Account<T>) -> TPayload,
TPayload: SignedPayload<T>,
fn send_unsigned_transaction<TPayload, F>( &self, f: F, f2: impl Fn(TPayload, T::Signature) -> LocalCall ) -> Self::Resultwhere F: Fn(&Account<T>) -> TPayload, TPayload: SignedPayload<T>,
Send an unsigned transaction with a signed 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), Global>
type SignatureData = Vec<(Account<T>, <T as SigningTypes>::Signature), Global>
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::SignatureDatawhere
F: Fn(&Account<T>) -> TPayload,
TPayload: SignedPayload<T>,
fn sign<TPayload, F>(&self, f: F) -> Self::SignatureDatawhere F: Fn(&Account<T>) -> TPayload, TPayload: SignedPayload<T>,
Construct and sign given payload. Read more
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::SignatureDatawhere
F: Fn(&Account<T>) -> TPayload,
TPayload: SignedPayload<T>,
fn sign<TPayload, F>(&self, f: F) -> Self::SignatureDatawhere F: Fn(&Account<T>) -> TPayload, TPayload: SignedPayload<T>,
Construct and sign given payload. Read more
Auto Trait Implementations§
impl<T, C, X> RefUnwindSafe for Signer<T, C, X>where C: RefUnwindSafe, X: RefUnwindSafe, <T as SigningTypes>::Public: RefUnwindSafe,
impl<T, C, X> Send for Signer<T, C, X>where C: Send, X: Send, <T as SigningTypes>::Public: Send,
impl<T, C, X> Sync for Signer<T, C, X>where C: Sync, X: Sync, <T as SigningTypes>::Public: Sync,
impl<T, C, X> Unpin for Signer<T, C, X>where C: Unpin, X: Unpin, <T as SigningTypes>::Public: Unpin,
impl<T, C, X> UnwindSafe for Signer<T, C, X>where C: UnwindSafe, X: UnwindSafe, <T as SigningTypes>::Public: UnwindSafe,
Blanket Implementations§
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, Outer> IsWrappedBy<Outer> for Twhere
Outer: AsRef<T> + AsMut<T> + From<T>,
T: From<Outer>,
impl<T, Outer> IsWrappedBy<Outer> for Twhere Outer: AsRef<T> + AsMut<T> + From<T>, T: From<Outer>,
§impl<T> Pointable for T
impl<T> Pointable 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<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 Swhere
T: Bounded,
S: TryInto<T>,
impl<T, S> UniqueSaturatedInto<T> for Swhere T: Bounded, S: TryInto<T>,
source§fn unique_saturated_into(self) -> T
fn unique_saturated_into(self) -> T
Consume self to return an equivalent value of
T
.