use of org.hyperledger.fabric.sdk.transaction.InstallProposalBuilder in project fabric-sdk-java by hyperledger.
the class Channel method sendInstallProposal.
/**
* Send install chaincode request proposal to the channel.
*
* @param installProposalRequest
* @param peers
* @return
* @throws ProposalException
* @throws InvalidArgumentException
*/
Collection<ProposalResponse> sendInstallProposal(InstallProposalRequest installProposalRequest, Collection<Peer> peers) throws ProposalException, InvalidArgumentException {
checkChannelState();
checkPeers(peers);
if (null == installProposalRequest) {
throw new InvalidArgumentException("InstallProposalRequest is null");
}
try {
TransactionContext transactionContext = getTransactionContext(installProposalRequest.getUserContext());
// Install will have no signing cause it's not really targeted to a channel.
transactionContext.verify(false);
transactionContext.setProposalWaitTime(installProposalRequest.getProposalWaitTime());
InstallProposalBuilder installProposalbuilder = InstallProposalBuilder.newBuilder();
installProposalbuilder.context(transactionContext);
installProposalbuilder.setChaincodeLanguage(installProposalRequest.getChaincodeLanguage());
installProposalbuilder.chaincodeName(installProposalRequest.getChaincodeName());
installProposalbuilder.chaincodePath(installProposalRequest.getChaincodePath());
installProposalbuilder.chaincodeVersion(installProposalRequest.getChaincodeVersion());
installProposalbuilder.setChaincodeSource(installProposalRequest.getChaincodeSourceLocation());
installProposalbuilder.setChaincodeInputStream(installProposalRequest.getChaincodeInputStream());
installProposalbuilder.setChaincodeMetaInfLocation(installProposalRequest.getChaincodeMetaInfLocation());
FabricProposal.Proposal deploymentProposal = installProposalbuilder.build();
SignedProposal signedProposal = getSignedProposal(transactionContext, deploymentProposal);
return sendProposalToPeers(peers, signedProposal, transactionContext);
} catch (Exception e) {
throw new ProposalException(e);
}
}
Aggregations