pub type SignedStatement = Signed<CompactStatement>;
Expand description
A signed compact statement, suitable to be sent to the chain.
Aliased Type§
struct SignedStatement(/* private fields */);
Implementations
Source§impl<Payload, RealPayload> Signed<Payload, RealPayload>
impl<Payload, RealPayload> Signed<Payload, RealPayload>
Sourcepub fn into_unchecked(self) -> UncheckedSigned<Payload, RealPayload>
pub fn into_unchecked(self) -> UncheckedSigned<Payload, RealPayload>
Convert back to an unchecked type.
Source§impl<Payload: EncodeAs<RealPayload>, RealPayload: Encode> Signed<Payload, RealPayload>
impl<Payload: EncodeAs<RealPayload>, RealPayload: Encode> Signed<Payload, RealPayload>
Sourcepub fn new<H: Encode>(
payload: Payload,
validator_index: ValidatorIndex,
signature: ValidatorSignature,
context: &SigningContext<H>,
key: &ValidatorId,
) -> Option<Self>
pub fn new<H: Encode>( payload: Payload, validator_index: ValidatorIndex, signature: ValidatorSignature, context: &SigningContext<H>, key: &ValidatorId, ) -> Option<Self>
Used to create a Signed
from already existing parts.
The signature is checked as part of the process.
Sourcepub fn sign<H: Encode>(
keystore: &KeystorePtr,
payload: Payload,
context: &SigningContext<H>,
validator_index: ValidatorIndex,
key: &ValidatorId,
) -> Result<Option<Self>, KeystoreError>
pub fn sign<H: Encode>( keystore: &KeystorePtr, payload: Payload, context: &SigningContext<H>, validator_index: ValidatorIndex, key: &ValidatorId, ) -> Result<Option<Self>, KeystoreError>
Create a new Signed
by signing data.
Sourcepub fn try_from_unchecked<H: Encode>(
unchecked: UncheckedSigned<Payload, RealPayload>,
context: &SigningContext<H>,
key: &ValidatorId,
) -> Result<Self, UncheckedSigned<Payload, RealPayload>>
pub fn try_from_unchecked<H: Encode>( unchecked: UncheckedSigned<Payload, RealPayload>, context: &SigningContext<H>, key: &ValidatorId, ) -> Result<Self, UncheckedSigned<Payload, RealPayload>>
Try to convert from UncheckedSigned
by checking the signature.
Sourcepub fn as_unchecked(&self) -> &UncheckedSigned<Payload, RealPayload>
pub fn as_unchecked(&self) -> &UncheckedSigned<Payload, RealPayload>
Get a reference to data as unchecked.
Sourcepub fn validator_index(&self) -> ValidatorIndex
pub fn validator_index(&self) -> ValidatorIndex
Immutably access the validator index.
Sourcepub fn signature(&self) -> &ValidatorSignature
pub fn signature(&self) -> &ValidatorSignature
Immutably access the signature.
Sourcepub fn into_payload(self) -> Payload
pub fn into_payload(self) -> Payload
Discard signing data, get the payload
Sourcepub fn convert_payload(&self) -> Signed<RealPayload>where
for<'a> &'a Payload: Into<RealPayload>,
pub fn convert_payload(&self) -> Signed<RealPayload>where
for<'a> &'a Payload: Into<RealPayload>,
Convert Payload
into RealPayload
.
Sourcepub fn convert_to_superpayload<SuperPayload>(
self,
claimed: SuperPayload,
) -> Result<Signed<SuperPayload, RealPayload>, (Self, SuperPayload)>where
SuperPayload: EncodeAs<RealPayload>,
pub fn convert_to_superpayload<SuperPayload>(
self,
claimed: SuperPayload,
) -> Result<Signed<SuperPayload, RealPayload>, (Self, SuperPayload)>where
SuperPayload: EncodeAs<RealPayload>,
Convert Payload
into some claimed SuperPayload
if the encoding matches.
Succeeds if and only if the super-payload provided actually encodes as the expected payload.
Sourcepub fn convert_to_superpayload_with<F, SuperPayload>(
self,
convert: F,
) -> Result<Signed<SuperPayload, RealPayload>, SuperPayload>
pub fn convert_to_superpayload_with<F, SuperPayload>( self, convert: F, ) -> Result<Signed<SuperPayload, RealPayload>, SuperPayload>
Convert Payload
into some converted SuperPayload
if the encoding matches.
This invokes the closure on the current payload, which is irreversible.
Succeeds if and only if the super-payload provided actually encodes as the expected payload.