[#625] client/audit: remove intermediate wrapper

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
Evgenii Stratonikov 2022-01-31 15:32:51 +03:00 committed by Alex Vanin
parent 767ee5c0cd
commit 819d80a7a9
10 changed files with 97 additions and 327 deletions

View file

@ -1,6 +1,10 @@
package audit
import (
"fmt"
"github.com/nspcc-dev/neo-go/pkg/encoding/fixedn"
"github.com/nspcc-dev/neo-go/pkg/util"
"github.com/nspcc-dev/neofs-node/pkg/morph/client"
)
@ -25,7 +29,12 @@ const (
listByNodeResultsMethod = "listByNode"
)
// New creates, initializes and returns the Client instance.
func New(c *client.StaticClient) *Client {
return &Client{client: c}
// NewFromMorph returns the wrapper instance from the raw morph client.
func NewFromMorph(cli *client.Client, contract util.Uint160, fee fixedn.Fixed8, opts ...client.StaticClientOption) (*Client, error) {
sc, err := client.NewStatic(cli, contract, fee, opts...)
if err != nil {
return nil, fmt.Errorf("could not create static client of audit contract: %w", err)
}
return &Client{client: sc}, nil
}