Java Code Examples for org.hyperledger.fabric.sdk.TransactionRequest#Type

The following examples show how to use org.hyperledger.fabric.sdk.TransactionRequest#Type . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FabricSDKWrapper.java    From WeEvent with Apache License 2.0 6 votes vote down vote up
public static Collection<ProposalResponse> instantiateProposal(HFClient client, Channel channel, ChaincodeID chaincodeID,
                                                               TransactionRequest.Type chaincodeLang, Long proposalTimeout) throws InvalidArgumentException, ProposalException {
    InstantiateProposalRequest instantiateProposalRequest = client.newInstantiationProposalRequest();
    instantiateProposalRequest.setProposalWaitTime(proposalTimeout);//time in milliseconds
    instantiateProposalRequest.setChaincodeID(chaincodeID);
    instantiateProposalRequest.setChaincodeLanguage(chaincodeLang);
    instantiateProposalRequest.setFcn("init");
    instantiateProposalRequest.setArgs(new String[]{});

    // I do not know the purpose of transient map works for.
    Map<String, byte[]> transientMap = new HashMap<>();
    transientMap.put("HyperLedgerFabric", "InstantiateProposalRequest:JavaSDK".getBytes(UTF_8));
    transientMap.put("method", "InstantiateProposalRequest".getBytes(UTF_8));
    instantiateProposalRequest.setTransientMap(transientMap);
    return channel.sendInstantiationProposal(instantiateProposalRequest, channel.getPeers());
}
 
Example 2
Source File: FabricSDKWrapper.java    From WeEvent with Apache License 2.0 5 votes vote down vote up
public static Collection<ProposalResponse> installProposal(HFClient client, Channel channel, ChaincodeID chaincodeID,
                                                           TransactionRequest.Type chaincodeLang,         // Type.GO_LANG
                                                           String chaincodeVer,        // "v1"
                                                           String chaincodeSourceLoc,  // "/opt/gopath"
                                                           String chaincodePath        // "github.com/hyperledger/fabric/peer/chaincode/go/chaincode_example02
) throws InvalidArgumentException, ProposalException {
    InstallProposalRequest installProposalRequest = client.newInstallProposalRequest();
    installProposalRequest.setChaincodeID(chaincodeID);
    installProposalRequest.setChaincodeVersion(chaincodeVer);
    installProposalRequest.setChaincodeLanguage(chaincodeLang);
    installProposalRequest.setChaincodeSourceLocation(new File(chaincodeSourceLoc));
    installProposalRequest.setChaincodePath(chaincodePath);
    return client.sendInstallProposal(installProposalRequest, channel.getPeers());
}
 
Example 3
Source File: LifecycleInstallProposalBuilder.java    From fabric-sdk-java with Apache License 2.0 4 votes vote down vote up
public void setChaincodeLanguage(TransactionRequest.Type chaincodeLanguage) {
    this.chaincodeLanguage = chaincodeLanguage;
}
 
Example 4
Source File: InstallProposalBuilder.java    From fabric-sdk-java with Apache License 2.0 4 votes vote down vote up
public void setChaincodeLanguage(TransactionRequest.Type chaincodeLanguage) {
    this.chaincodeLanguage = chaincodeLanguage;
}