[][src]Struct exonum::runtime::AnyTx

#[non_exhaustive]pub struct AnyTx {
    pub call_info: CallInfo,
    pub arguments: Vec<u8>,
}

Transaction with the information required to dispatch it to a service.

Examples

Creates a new signed transaction.

use exonum::{
    crypto,
    messages::Verified,
    runtime::{AnyTx, CallInfo},
};

let keypair = crypto::KeyPair::random();
// Service instance which we want to call.
let instance_id = 1024;
// Specific method of the service interface.
let method_id = 0;
let call_info = CallInfo::new(instance_id, method_id);

// `AnyTx` object created from `CallInfo` and payload.
let arguments = "Talk is cheap. Show me the code. – Linus Torvalds".to_owned().into_bytes();
let any_tx = AnyTx::new(call_info, arguments);
let transaction = any_tx.sign_with_keypair(&keypair);

Fields (Non-exhaustive)

Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
call_info: CallInfo

Information required for the call of the corresponding executor.

arguments: Vec<u8>

Serialized transaction arguments.

Methods

impl AnyTx[src]

pub fn new(call_info: CallInfo, arguments: Vec<u8>) -> Self[src]

Creates a new AnyTx object.

pub fn sign(
    self,
    public_key: PublicKey,
    secret_key: &SecretKey
) -> Verified<Self>
[src]

Signs a transaction with the specified Ed25519 keys.

pub fn sign_with_keypair(self, keypair: &KeyPair) -> Verified<Self>[src]

Signs a transaction with the specified Ed25519 keypair.

pub fn parse<T: BinaryValue>(&self) -> Result<T>[src]

Parse transaction arguments as a specific type.

Trait Implementations

impl BinaryValue for AnyTx[src]

impl Clone for AnyTx[src]

impl Debug for AnyTx[src]

impl<'de> Deserialize<'de> for AnyTx[src]

impl Eq for AnyTx[src]

impl From<AnyTx> for CoreMessage[src]

impl IntoMessage for AnyTx[src]

type Container = CoreMessage

Container for the message.

impl Ord for AnyTx[src]

impl PartialEq<AnyTx> for AnyTx[src]

impl PartialOrd<AnyTx> for AnyTx[src]

impl ProtobufConvert for AnyTx[src]

type ProtoStruct = AnyTx

Type generated from the Protobuf definition.

impl Serialize for AnyTx[src]

impl StructuralEq for AnyTx[src]

impl StructuralPartialEq for AnyTx[src]

impl<'_> TryFrom<&'_ SignedMessage> for AnyTx[src]

type Error = Error

The type returned in the event of a conversion error.

impl TryFrom<CoreMessage> for AnyTx[src]

type Error = Error

The type returned in the event of a conversion error.

impl TryFrom<SignedMessage> for AnyTx[src]

type Error = Error

The type returned in the event of a conversion error.

Auto Trait Implementations

impl RefUnwindSafe for AnyTx

impl Send for AnyTx

impl Sync for AnyTx

impl Unpin for AnyTx

impl UnwindSafe for AnyTx

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,