npm.io
0.2.2 • Published 1 year ago

@hyperledger/fabric-protos

Licence
Apache-2.0
Version
0.2.2
Deps
2
Size
2.3 MB
Vulns
0
Weekly
0
Stars
42

fabric-protos

Node bindings for Hyperledger Fabric protocol buffers

Usage

Import the packages you need from the protos, following the same structure as the protos themselves. For example:

import { common, ledger, msp, orderer, peer } from '@hyperledger/fabric-protos';

Then refer to the implementations you want within those packages. For example:

const proposal = peer.Proposal.deserializeBinary(bytes);
const header = common.Header.deserializeBinary(proposal.getHeader_asU8());
const channelHeader = common.ChannelHeader.deserializeBinary(header.getChannelHeader_asU8());
const channelName = channelHeader.getChannelId();

See JavaScript Generated Code for more details.