func (f *FabricProvider) CreatePeerFromConfig(peerCfg *apiconfig.NetworkPeer) (apifabclient.Peer, error) {
	return peerImpl.New(f.providerContext.Config(), peerImpl.FromPeerConfig(peerCfg))
}
CreatePeerFromConfig returns a new default implementation of Peer based configuration
package fabpvdr
import (
	"github.com/hyperledger/fabric-sdk-go/api/apiconfig"
	"github.com/hyperledger/fabric-sdk-go/api/apifabca"
	"github.com/hyperledger/fabric-sdk-go/api/apifabclient"
	fabricCAClient "github.com/hyperledger/fabric-sdk-go/pkg/fabric-ca-client"
	channelImpl "github.com/hyperledger/fabric-sdk-go/pkg/fabric-client/channel"
	"github.com/hyperledger/fabric-sdk-go/pkg/fabric-client/chconfig"
	"github.com/hyperledger/fabric-sdk-go/pkg/fabric-client/events"
	identityImpl "github.com/hyperledger/fabric-sdk-go/pkg/fabric-client/identity"
	"github.com/hyperledger/fabric-sdk-go/pkg/fabric-client/orderer"
	peerImpl "github.com/hyperledger/fabric-sdk-go/pkg/fabric-client/peer"
	clientImpl "github.com/hyperledger/fabric-sdk-go/pkg/fabric-client/resource"
	"github.com/pkg/errors"
)
type FabricProvider struct {
	providerContext apifabclient.ProviderContext
}
type fabContext struct {
	apifabclient.ProviderContext
	apifabclient.IdentityContext
}
func New(ctx apifabclient.ProviderContext) *FabricProvider {
	f := FabricProvider{
		providerContext: ctx,
	}
	return &f
}
func (f *FabricProvider) CreateResourceClient(ic apifabclient.IdentityContext) (apifabclient.Resource, error) {
	ctx := &fabContext{
		ProviderContext: f.providerContext,
		IdentityContext: ic,
	}
	client := clientImpl.New(ctx)
	return client, nil
}
func (f *FabricProvider) CreateChannelClient(ic apifabclient.IdentityContext, cfg apifabclient.ChannelCfg) (apifabclient.Channel, error) {
	ctx := &fabContext{
		ProviderContext: f.providerContext,
		IdentityContext: ic,
	}
	channel, err := channelImpl.New(ctx, cfg)
	if err != nil {
		return nil, errors.WithMessage(err, "NewChannel failed")
	}
	return channel, nil
}
func (f *FabricProvider) CreateChannelLedger(ic apifabclient.IdentityContext, channelName string) (apifabclient.ChannelLedger, error) {
	ctx := &fabContext{
		ProviderContext: f.providerContext,
		IdentityContext: ic,
	}
	ledger, err := channelImpl.NewLedger(ctx, channelName)
	if err != nil {
		return nil, errors.WithMessage(err, "NewLedger failed")
	}
	return ledger, nil
}
func (f *FabricProvider) CreateEventHub(ic apifabclient.IdentityContext, channelID string) (apifabclient.EventHub, error) {
	peerConfig, err := f.providerContext.Config().ChannelPeers(channelID)
	if err != nil {
		return nil, errors.WithMessage(err, "read configuration for channel peers failed")
	}
	var eventSource *apiconfig.ChannelPeer
	for _, p := range peerConfig {
		if p.EventSource && p.MspID == ic.MspID() {
			eventSource = &p
			break
		}
	}
	if eventSource == nil {
		return nil, errors.New("unable to find event source for channel")
	}
	eventCtx := events.Context{
		ProviderContext: f.providerContext,
		IdentityContext: ic,
	}
	return events.FromConfig(eventCtx, &eventSource.PeerConfig)
}
func (f *FabricProvider) CreateChannelConfig(ic apifabclient.IdentityContext, channelID string) (apifabclient.ChannelConfig, error) {
	ctx := chconfig.Context{
		ProviderContext: f.providerContext,
		IdentityContext: ic,
	}
	return chconfig.New(ctx, channelID)
}
func (f *FabricProvider) CreateCAClient(orgID string) (apifabca.FabricCAClient, error) {
	return fabricCAClient.NewFabricCAClient(orgID, f.providerContext.Config(), f.providerContext.CryptoSuite())
}
func (f *FabricProvider) CreateUser(name string, signingIdentity *apifabclient.SigningIdentity) (apifabclient.User, error) {
	user := identityImpl.NewUser(name, signingIdentity.MspID)
	user.SetPrivateKey(signingIdentity.PrivateKey)
	user.SetEnrollmentCertificate(signingIdentity.EnrollmentCert)
	return user, nil
}