fabric-sdk 0.5.1

Interact and program chaincode for the Hyperledger Fabric blockchain network
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use prost::{DecodeError, Message};

use crate::fabric::{
    common::{Header, Payload},
    protos::Transaction,
};

impl Payload {
    /// Decodes the payload to an transaction
    pub fn get_transaction(&self) -> Result<Transaction, DecodeError> {
        Transaction::decode(self.data.as_slice())
    }

    /// Clones the optional header
    pub fn get_header(&self) -> Option<Header> {
        self.header.clone()
    }
}