Beispiel #1
0
// initCmdFactory init the ChaincodeCmdFactory with default clients
func initCmdFactory() (*JoinCmdFactory, error) {
	endorserClient, err := common.GetEndorserClient()
	if err != nil {
		return nil, fmt.Errorf("Error getting endorser client : %s", err)
	}

	signer, err := common.GetDefaultSigner()
	if err != nil {
		return nil, fmt.Errorf("Error getting default signer: %s", err)
	}

	return &JoinCmdFactory{
		EndorserClient: endorserClient,
		Signer:         signer,
	}, nil
}
Beispiel #2
0
// InitCmdFactory init the ChaincodeCmdFactory with default clients
func InitCmdFactory() (*ChaincodeCmdFactory, error) {
	endorserClient, err := common.GetEndorserClient()
	if err != nil {
		return nil, fmt.Errorf("Error getting endorser client %s: %s", chainFuncName, err)
	}

	signer, err := common.GetDefaultSigner()
	if err != nil {
		return nil, fmt.Errorf("Error getting default signer: %s", err)
	}

	broadcastClient, err := common.GetBroadcastClient()
	if err != nil {
		return nil, fmt.Errorf("Error getting broadcast client: %s", err)
	}

	return &ChaincodeCmdFactory{
		EndorserClient:  endorserClient,
		Signer:          signer,
		BroadcastClient: broadcastClient,
	}, nil
}