Skip to content
This repository was archived by the owner on Apr 25, 2025. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions pkg/gateway/gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -259,13 +259,21 @@ func WithBlockNum(from uint64) Option {
// Returns:
// A Network object representing the channel
func (gw *Gateway) GetNetwork(name string) (*Network, error) {
var channelProvider context.ChannelProvider
channelProvider := gw.GetChannelProvider(name)
return newNetwork(gw, channelProvider)
}

// GetChannelProvider returns a ChannelProvider function.
// Parameters:
// name is the name of the network channel
//
// Returns:
// A function returning a Channel client context
func (gw *Gateway) GetChannelProvider(name string) context.ChannelProvider {
if gw.options.Identity != nil {
channelProvider = gw.sdk.ChannelContext(name, fabsdk.WithIdentity(gw.options.Identity), fabsdk.WithOrg(gw.org))
} else {
channelProvider = gw.sdk.ChannelContext(name, fabsdk.WithUser(gw.options.User), fabsdk.WithOrg(gw.org))
return gw.sdk.ChannelContext(name, fabsdk.WithIdentity(gw.options.Identity), fabsdk.WithOrg(gw.org))
}
return newNetwork(gw, channelProvider)
return gw.sdk.ChannelContext(name, fabsdk.WithUser(gw.options.User), fabsdk.WithOrg(gw.org))
}

// Close the gateway connection and all associated resources, including removing listeners attached to networks and
Expand Down