frostfs-node/pkg/morph/client/neofsid/wrapper/client.go
Leonard Lyubich a306eb9ce7 [#505] ir: Process set eACL notifications from Container contract
Add `setEACL` notification event parser (handler) to the return of the
`ListenerParsers` (`ListenerHandlers`) method. Read address of NeoFS ID
contract from `contracts.neofsid` config. Implement `NewNeoFSIDClient`
constructor in `invoke` package and use it in IR application.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-05-25 16:35:52 +03:00

27 lines
826 B
Go

package neofsid
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"
"github.com/nspcc-dev/neofs-node/pkg/morph/client/neofsid"
)
// ClientWrapper is a wrapper over NeoFS ID contract
// client which provides convenient methods for
// working with a contract.
//
// Working ClientWrapper must be created via Wrap.
type ClientWrapper neofsid.Client
// NewFromMorph wraps client to work with NeoFS ID contract.
func NewFromMorph(cli *client.Client, contract util.Uint160, fee fixedn.Fixed8) (*ClientWrapper, error) {
sc, err := client.NewStatic(cli, contract, fee)
if err != nil {
return nil, fmt.Errorf("could not create client of NeoFS ID contract: %w", err)
}
return (*ClientWrapper)(neofsid.New(sc)), nil
}