[#625] morph/client: make method names constant

We don't use custom names and the only place where custom method option
is used it provides the default name and can be omitted.

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
Evgenii Stratonikov 2022-01-29 16:06:36 +03:00 committed by LeL
parent 35dec2f494
commit 3c5b62d839
44 changed files with 249 additions and 1097 deletions

View file

@ -49,15 +49,15 @@ func (g GetResult) Reputations() [][]byte {
func (c *Client) Get(args GetArgs) (*GetResult, error) {
invokePrm := client.TestInvokePrm{}
invokePrm.SetMethod(c.getMethod)
invokePrm.SetMethod(getMethod)
invokePrm.SetArgs(int64(args.epoch), args.peerID)
prms, err := c.client.TestInvoke(invokePrm)
if err != nil {
return nil, fmt.Errorf("could not perform test invocation (%s): %w", c.getMethod, err)
return nil, fmt.Errorf("could not perform test invocation (%s): %w", getMethod, err)
}
return parseReputations(prms, c.getMethod)
return parseReputations(prms, getMethod)
}
// GetByID invokes the call of "get reputation value by reputation id" method
@ -65,15 +65,15 @@ func (c *Client) Get(args GetArgs) (*GetResult, error) {
func (c *Client) GetByID(args GetByIDArgs) (*GetResult, error) {
invokePrm := client.TestInvokePrm{}
invokePrm.SetMethod(c.getByIDMethod)
invokePrm.SetMethod(getByIDMethod)
invokePrm.SetArgs(args.id)
prms, err := c.client.TestInvoke(invokePrm)
if err != nil {
return nil, fmt.Errorf("could not perform test invocation (%s): %w", c.getByIDMethod, err)
return nil, fmt.Errorf("could not perform test invocation (%s): %w", getByIDMethod, err)
}
return parseReputations(prms, c.getByIDMethod)
return parseReputations(prms, getByIDMethod)
}
func parseReputations(items []stackitem.Item, method string) (*GetResult, error) {