def getChaincodeSpecUsingTemplate(template_chaincode_spec, args): # make chaincode spec for chaincode to be deployed ccSpec = chaincode_pb2.ChaincodeSpec() input = chaincode_pb2.ChaincodeInput(args=args) ccSpec.CopyFrom(template_chaincode_spec) ccSpec.input.CopyFrom(input) return ccSpec
def getChaincodeSpec(ccType, path, name, args): # make chaincode spec for chaincode to be deployed ccSpec = chaincode_pb2.ChaincodeSpec( type=chaincode_pb2.ChaincodeSpec.Type.Value(ccType), chaincodeID=chaincode_pb2.ChaincodeID(path=path, name=name), ctorMsg=chaincode_pb2.ChaincodeInput(args=args)) return ccSpec
def getChaincodeSpec(cc_type, path, name, args, version='test'): # make chaincode spec for chaincode to be deployed ccSpec = chaincode_pb2.ChaincodeSpec( type=chaincode_pb2.ChaincodeSpec.Type.Value(cc_type), chaincode_id=chaincode_pb2.ChaincodeID(path=path, name=name, version=version), input=chaincode_pb2.ChaincodeInput(args=args)) return ccSpec
def createDeploymentProposalForBDD(ccDeploymentSpec): "Returns a deployment proposal of chaincode type" lc_chaincode_spec = chaincode_pb2.ChaincodeSpec( type=chaincode_pb2.ChaincodeSpec.GOLANG, chaincodeID=chaincode_pb2.ChaincodeID(name="lccc"), ctorMsg=chaincode_pb2.ChaincodeInput( args=['deploy', 'default', ccDeploymentSpec.SerializeToString()])) lc_chaincode_invocation_spec = chaincode_pb2.ChaincodeInvocationSpec( chaincodeSpec=lc_chaincode_spec) # make proposal proposal = fabric_next_pb2.Proposal( type=fabric_next_pb2.Proposal.CHAINCODE, id=createPropsalId()) proposal.payload = lc_chaincode_invocation_spec.SerializeToString() return proposal
def createDeploymentChaincodeSpecForBDD(ccDeploymentSpec, chainID): "Returns a deployment proposal of chaincode type" lc_chaincode_spec = chaincode_pb2.ChaincodeSpec(type = chaincode_pb2.ChaincodeSpec.GOLANG, chaincodeID = chaincode_pb2.ChaincodeID(name="lccc"), input = chaincode_pb2.ChaincodeInput(args = ['deploy', chainID, ccDeploymentSpec.SerializeToString()])) return lc_chaincode_spec