Class: BlockDecoder

BlockDecoder

Utility class to convert a protobuf encoded byte array of a Hyperledger Fabric block message into a pure Javascript object with the key names as they appear in the protobuf defintions (typically snake case)

new BlockDecoder()

Methods


<static> decode(blockBuf)

Constructs a JSON object containing all decoded values from the protobuf encoded `Block` bytes.
Parameters:
Name Type Description
blockBuf Array.<byte> The encoded bytes of a Block protobuf message
Returns:
An object of the Block
Type
Block

<static> decodeBlock(blockProto-)

Constructs an object containing all decoded values from the protobuf `common.Block` object
Parameters:
Name Type Description
blockProto- Object an object that represents the protobuf common.Block
Returns:
An object of the fully decoded protobuf common.Block
Type
Block

<static> decodeBlockWithPrivateData(blockAndPrivateDataProto)

Constructs an object containing all decoded values from the protobuf `BlockAndPrivateData` object
Parameters:
Name Type Description
blockAndPrivateDataProto Object an object that represents the protobuf common.BlockAndPrivateData
Returns:
An object with the fully decoded protobuf common.Block and the private data map
Type
Object

<static> decodeFilteredBlock(filteredBlockProto-)

Constructs an object containing all decoded values from the protobuf `common.Block` object
Parameters:
Name Type Description
filteredBlockProto- Object an object that represents the protobuf protos.FilteredBlock
Returns:
An object of the fully decoded protobuf protos.FilteredBlock
Type
FilteredBlock

<static> decodeTransaction(processedTransactionBuf)

Constructs an object containing all decoded values from the protobuf encoded "ProcessedTransaction" bytes
Parameters:
Name Type Description
processedTransactionBuf Array.<byte> The encode bytes of a protobuf message "ProcessedTransaction"
Returns:
A fully decoded ProcessedTransaction object
Type
ProcessedTransaction