Skip to content
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
13 changes: 11 additions & 2 deletions pkg/chaincode/gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,10 +191,19 @@ func (g *Gateway) Commit(ctx context.Context, chaincodeDef *Definition) error {
}

// QueryApproved chaincode definition for the user's own organization.
//
// In Fabric v3, this function supports additional query modes:
// - Omit the sequence number (pass 0) to query the latest approved chaincode definition.
// - Omit the chaincode name (pass empty string) to query all approved chaincode definitions on the channel.
func (g *Gateway) QueryApproved(ctx context.Context, channelName string, chaincodeName string, sequence int64) (*lifecycle.QueryApprovedChaincodeDefinitionResult, error) {
queryArgs := &lifecycle.QueryApprovedChaincodeDefinitionArgs{
Name: chaincodeName,
Sequence: sequence,
if chaincodeName != "" {
queryArgs.Name = chaincodeName
}
if sequence != 0 {
queryArgs.Sequence = sequence
}

}
queryArgsBytes, err := proto.Marshal(queryArgs)
if err != nil {
Expand Down