@@ -64,23 +64,14 @@ func (c *Client) NewChannel(name string) (fab.Channel, error) {
6464 return c .channels [name ], nil
6565}
6666
67- // GetConfig .. .
68- func (c * Client ) GetConfig () config.Config {
67+ // Config returns the configuration of the client .
68+ func (c * Client ) Config () config.Config {
6969 return c .config
7070}
7171
72- // GetChannel ...
73- /*
74- * Get a {@link Channel} instance from the state storage. This allows existing channel instances to be saved
75- * for retrieval later and to be shared among instances of the application. Note that it’s the
76- * application/SDK’s responsibility to record the channel information. If an application is not able
77- * to look up the channel information from storage, it may call another API that queries one or more
78- * Peers for that information.
79- * @param {string} name The name of the channel.
80- * @returns {Channel} The channel instance
81- */
82- func (c * Client ) GetChannel (name string ) fab.Channel {
83- return c .channels [name ]
72+ // Channel returns the channel by ID
73+ func (c * Client ) Channel (id string ) fab.Channel {
74+ return c .channels [id ]
8475}
8576
8677// QueryChannelInfo ...
@@ -107,27 +98,18 @@ func (c *Client) SetStateStore(stateStore fab.KeyValueStore) {
10798 c .stateStore = stateStore
10899}
109100
110- // GetStateStore ...
111- /*
112- * A convenience method for obtaining the state store object in use for this client.
113- */
114- func (c * Client ) GetStateStore () fab.KeyValueStore {
101+ // StateStore is a convenience method for obtaining the state store object in use for this client.
102+ func (c * Client ) StateStore () fab.KeyValueStore {
115103 return c .stateStore
116104}
117105
118- // SetCryptoSuite ...
119- /*
120- * A convenience method for obtaining the state store object in use for this client.
121- */
106+ // SetCryptoSuite is a convenience method for obtaining the state store object in use for this client.
122107func (c * Client ) SetCryptoSuite (cryptoSuite bccsp.BCCSP ) {
123108 c .cryptoSuite = cryptoSuite
124109}
125110
126- // GetCryptoSuite ...
127- /*
128- * A convenience method for obtaining the CryptoSuite object in use for this client.
129- */
130- func (c * Client ) GetCryptoSuite () bccsp.BCCSP {
111+ // CryptoSuite is a convenience method for obtaining the CryptoSuite object in use for this client.
112+ func (c * Client ) CryptoSuite () bccsp.BCCSP {
131113 return c .cryptoSuite
132114}
133115
@@ -280,14 +262,14 @@ func (c *Client) SignChannelConfig(config []byte) (*common.ConfigSignature, erro
280262 return nil , fmt .Errorf ("Error marshalling signatureHeader: %v" , err )
281263 }
282264
283- user := c .GetUserContext ()
265+ user := c .UserContext ()
284266 if user == nil {
285267 return nil , fmt .Errorf ("User is nil" )
286268 }
287269
288270 // get all the bytes to be signed together, then sign
289271 signingBytes := fcutils .ConcatenateBytes (signatureHeaderBytes , config )
290- signature , err := fc .SignObjectWithKey (signingBytes , user .PrivateKey (), & bccsp.SHAOpts {}, nil , c .GetCryptoSuite ())
272+ signature , err := fc .SignObjectWithKey (signingBytes , user .PrivateKey (), & bccsp.SHAOpts {}, nil , c .CryptoSuite ())
291273 if err != nil {
292274 return nil , fmt .Errorf ("error singing config: %v" , err )
293275 }
@@ -416,7 +398,7 @@ func (c *Client) createOrUpdateChannel(request fab.CreateChannelRequest, haveEnv
416398 return fmt .Errorf ("error marshaling payload: %v" , err )
417399 }
418400
419- signature , err = fc .SignObjectWithKey (payloadBytes , c .userContext .PrivateKey (), & bccsp.SHAOpts {}, nil , c .GetCryptoSuite ())
401+ signature , err = fc .SignObjectWithKey (payloadBytes , c .userContext .PrivateKey (), & bccsp.SHAOpts {}, nil , c .CryptoSuite ())
420402 if err != nil {
421403 return fmt .Errorf ("error singing payload: %v" , err )
422404 }
@@ -518,11 +500,11 @@ func (c *Client) InstallChaincode(chaincodeName string, chaincodePath string, ch
518500 if err != nil {
519501 return nil , "" , err
520502 }
521- user := c .GetUserContext ()
503+ user := c .UserContext ()
522504 if user == nil {
523505 return nil , "" , fmt .Errorf ("User is nil" )
524506 }
525- signature , err := fc .SignObjectWithKey (proposalBytes , user .PrivateKey (), & bccsp.SHAOpts {}, nil , c .GetCryptoSuite ())
507+ signature , err := fc .SignObjectWithKey (proposalBytes , user .PrivateKey (), & bccsp.SHAOpts {}, nil , c .CryptoSuite ())
526508 if err != nil {
527509 return nil , "" , err
528510 }
@@ -540,8 +522,8 @@ func (c *Client) InstallChaincode(chaincodeName string, chaincodePath string, ch
540522 return transactionProposalResponse , txID , err
541523}
542524
543- // GetUserContext .. .
544- func (c * Client ) GetUserContext () fab.User {
525+ // UserContext returns the current User .
526+ func (c * Client ) UserContext () fab.User {
545527 return c .userContext
546528}
547529
0 commit comments