@siglesiasg/node-red-hyperledger-fabric-gateway
Version:
Hyperledger Fabric 2.x nodes for node-red with latest fabric-gateway library
14 lines (12 loc) • 397 B
text/typescript
import { BlockchainInfo } from '@hyperledger/fabric-protos/lib/common';
export class ChannelInfoModel {
height: number;
lastBlockHash: string;
}
export function buildChannelInfoModel(chainInfoBin: Uint8Array): ChannelInfoModel {
const info = BlockchainInfo.deserializeBinary(chainInfoBin);
return {
height: info.getHeight(),
lastBlockHash: info.getCurrentblockhash_asB64()
};
}