[#971] morph/client: Adapt signature changes in wrappers
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru> Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
parent
3849d13e0b
commit
1db6d316c2
28 changed files with 301 additions and 193 deletions
|
@ -31,10 +31,12 @@ func (v *GetAuditResultValue) Result() []byte {
|
|||
// GetAuditResult invokes the call of "get audit result" method
|
||||
// of NeoFS Audit contract.
|
||||
func (c *Client) GetAuditResult(args GetAuditResultArgs) (*GetAuditResultValue, error) {
|
||||
prms, err := c.client.TestInvoke(
|
||||
c.getResultMethod,
|
||||
args.id,
|
||||
)
|
||||
invokePrm := client.TestInvokePrm{}
|
||||
|
||||
invokePrm.SetMethod(c.getResultMethod)
|
||||
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.getResultMethod, err)
|
||||
} else if ln := len(prms); ln != 1 {
|
||||
|
|
|
@ -63,9 +63,11 @@ func (v *ListResultsByNodeArgs) SetNodeKey(key []byte) {
|
|||
// ListAuditResults performs the test invoke of "list all audit result IDs"
|
||||
// method of NeoFS Audit contract.
|
||||
func (c *Client) ListAuditResults(args ListResultsArgs) (*ListResultsValues, error) {
|
||||
items, err := c.client.TestInvoke(
|
||||
c.listResultsMethod,
|
||||
)
|
||||
invokePrm := client.TestInvokePrm{}
|
||||
|
||||
invokePrm.SetMethod(c.listResultsMethod)
|
||||
|
||||
items, err := c.client.TestInvoke(invokePrm)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("could not perform test invocation (%s): %w", c.listResultsMethod, err)
|
||||
}
|
||||
|
@ -76,10 +78,12 @@ func (c *Client) ListAuditResults(args ListResultsArgs) (*ListResultsValues, err
|
|||
// ListAuditResultsByEpoch performs the test invoke of "list audit result IDs
|
||||
// by epoch" method of NeoFS Audit contract.
|
||||
func (c *Client) ListAuditResultsByEpoch(args ListResultsByEpochArgs) (*ListResultsValues, error) {
|
||||
items, err := c.client.TestInvoke(
|
||||
c.listByEpochResultsMethod,
|
||||
args.epoch,
|
||||
)
|
||||
invokePrm := client.TestInvokePrm{}
|
||||
|
||||
invokePrm.SetMethod(c.listByEpochResultsMethod)
|
||||
invokePrm.SetArgs(args.epoch)
|
||||
|
||||
items, err := c.client.TestInvoke(invokePrm)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("could not perform test invocation (%s): %w", c.listByEpochResultsMethod, err)
|
||||
}
|
||||
|
@ -90,11 +94,12 @@ func (c *Client) ListAuditResultsByEpoch(args ListResultsByEpochArgs) (*ListResu
|
|||
// ListAuditResultsByCID performs the test invoke of "list audit result IDs
|
||||
// by epoch and CID" method of NeoFS Audit contract.
|
||||
func (c *Client) ListAuditResultsByCID(args ListResultsByCIDArgs) (*ListResultsValues, error) {
|
||||
items, err := c.client.TestInvoke(
|
||||
c.listByCIDResultsMethod,
|
||||
args.epoch,
|
||||
args.cid,
|
||||
)
|
||||
invokePrm := client.TestInvokePrm{}
|
||||
|
||||
invokePrm.SetMethod(c.listByCIDResultsMethod)
|
||||
invokePrm.SetArgs(args.epoch, args.cid)
|
||||
|
||||
items, err := c.client.TestInvoke(invokePrm)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("could not perform test invocation (%s): %w", c.listByCIDResultsMethod, err)
|
||||
}
|
||||
|
@ -105,12 +110,12 @@ func (c *Client) ListAuditResultsByCID(args ListResultsByCIDArgs) (*ListResultsV
|
|||
// ListAuditResultsByNode performs the test invoke of "list audit result IDs
|
||||
// by epoch, CID, and node key" method of NeoFS Audit contract.
|
||||
func (c *Client) ListAuditResultsByNode(args ListResultsByNodeArgs) (*ListResultsValues, error) {
|
||||
items, err := c.client.TestInvoke(
|
||||
c.listByNodeResultsMethod,
|
||||
args.epoch,
|
||||
args.cid,
|
||||
args.nodeKey,
|
||||
)
|
||||
invokePrm := client.TestInvokePrm{}
|
||||
|
||||
invokePrm.SetMethod(c.listByNodeResultsMethod)
|
||||
invokePrm.SetArgs(args.epoch, args.cid, args.nodeKey)
|
||||
|
||||
items, err := c.client.TestInvoke(invokePrm)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("could not perform test invocation (%s): %w", c.listByNodeResultsMethod, err)
|
||||
}
|
||||
|
|
|
@ -2,6 +2,8 @@ package audit
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/nspcc-dev/neofs-node/pkg/morph/client"
|
||||
)
|
||||
|
||||
// PutAuditResultArgs groups the arguments
|
||||
|
@ -19,10 +21,12 @@ func (g *PutAuditResultArgs) SetRawResult(v []byte) {
|
|||
// PutAuditResult invokes the call of "put audit result" method
|
||||
// of NeoFS Audit contract.
|
||||
func (c *Client) PutAuditResult(args PutAuditResultArgs) error {
|
||||
err := c.client.Invoke(
|
||||
c.putResultMethod,
|
||||
args.rawResult,
|
||||
)
|
||||
prm := client.InvokePrm{}
|
||||
|
||||
prm.SetMethod(c.putResultMethod)
|
||||
prm.SetArgs(args.rawResult)
|
||||
|
||||
err := c.client.Invoke(prm)
|
||||
|
||||
if err != nil {
|
||||
return fmt.Errorf("could not invoke method (%s): %w", c.putResultMethod, err)
|
||||
|
|
|
@ -33,10 +33,12 @@ func (g *GetBalanceOfValues) Amount() *big.Int {
|
|||
// BalanceOf performs the test invoke of "balance of"
|
||||
// method of NeoFS Balance contract.
|
||||
func (c *Client) BalanceOf(args GetBalanceOfArgs) (*GetBalanceOfValues, error) {
|
||||
prms, err := c.client.TestInvoke(
|
||||
c.balanceOfMethod,
|
||||
args.wallet,
|
||||
)
|
||||
invokePrm := client.TestInvokePrm{}
|
||||
|
||||
invokePrm.SetMethod(c.balanceOfMethod)
|
||||
invokePrm.SetArgs(args.wallet)
|
||||
|
||||
prms, err := c.client.TestInvoke(invokePrm)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("could not perform test invocation (%s): %w", c.balanceOfMethod, err)
|
||||
} else if ln := len(prms); ln != 1 {
|
||||
|
|
|
@ -25,9 +25,11 @@ func (d *DecimalsValues) Decimals() int64 {
|
|||
// Decimals performs the test invoke of decimals
|
||||
// method of NeoFS Balance contract.
|
||||
func (c *Client) Decimals(args DecimalsArgs) (*DecimalsValues, error) {
|
||||
prms, err := c.client.TestInvoke(
|
||||
c.decimalsMethod,
|
||||
)
|
||||
invokePrm := client.TestInvokePrm{}
|
||||
|
||||
invokePrm.SetMethod(c.decimalsMethod)
|
||||
|
||||
prms, err := c.client.TestInvoke(invokePrm)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("could not perform test invocation (%s): %w", c.decimalsMethod, err)
|
||||
} else if ln := len(prms); ln != 1 {
|
||||
|
|
|
@ -2,6 +2,8 @@ package balance
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/nspcc-dev/neofs-node/pkg/morph/client"
|
||||
)
|
||||
|
||||
// TransferXArgs groups the arguments
|
||||
|
@ -43,13 +45,12 @@ func (t *TransferXArgs) SetDetails(v []byte) {
|
|||
// TransferX directly invokes the call of "transferX" method
|
||||
// of NeoFS Balance contract.
|
||||
func (c *Client) TransferX(args TransferXArgs) error {
|
||||
err := c.client.Invoke(
|
||||
c.transferXMethod,
|
||||
args.sender,
|
||||
args.recipient,
|
||||
args.amount,
|
||||
args.details,
|
||||
)
|
||||
prm := client.InvokePrm{}
|
||||
|
||||
prm.SetMethod(c.transferXMethod)
|
||||
prm.SetArgs(args.sender, args.recipient, args.amount, args.details)
|
||||
|
||||
err := c.client.Invoke(prm)
|
||||
if err != nil {
|
||||
return fmt.Errorf("could not invoke method (%s): %w", c.transferXMethod, err)
|
||||
}
|
||||
|
@ -59,15 +60,30 @@ func (c *Client) TransferX(args TransferXArgs) error {
|
|||
|
||||
// Mint invokes `mint` method of the balance contract.
|
||||
func (c *Client) Mint(to []byte, amount int64, id []byte) error {
|
||||
return c.client.Invoke(c.mintMethod, to, amount, id)
|
||||
prm := client.InvokePrm{}
|
||||
|
||||
prm.SetMethod(c.mintMethod)
|
||||
prm.SetArgs(to, amount, id)
|
||||
|
||||
return c.client.Invoke(prm)
|
||||
}
|
||||
|
||||
// Burn invokes `burn` method of the balance contract.
|
||||
func (c *Client) Burn(to []byte, amount int64, id []byte) error {
|
||||
return c.client.Invoke(c.burnMethod, to, amount, id)
|
||||
prm := client.InvokePrm{}
|
||||
|
||||
prm.SetMethod(c.burnMethod)
|
||||
prm.SetArgs(to, amount, id)
|
||||
|
||||
return c.client.Invoke(prm)
|
||||
}
|
||||
|
||||
// Lock invokes `lock` method of the balance contract.
|
||||
func (c *Client) Lock(id, user, lock []byte, amount, dueEpoch int64) error {
|
||||
return c.client.Invoke(c.lockMethod, id, user, lock, amount, dueEpoch)
|
||||
prm := client.InvokePrm{}
|
||||
|
||||
prm.SetMethod(c.lockMethod)
|
||||
prm.SetArgs(id, user, lock, amount, dueEpoch)
|
||||
|
||||
return c.client.Invoke(prm)
|
||||
}
|
||||
|
|
|
@ -2,6 +2,8 @@ package container
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/nspcc-dev/neofs-node/pkg/morph/client"
|
||||
)
|
||||
|
||||
// DeleteArgs groups the arguments
|
||||
|
@ -36,12 +38,12 @@ func (p *DeleteArgs) SetSessionToken(v []byte) {
|
|||
// Delete invokes the call of delete container
|
||||
// method of NeoFS Container contract.
|
||||
func (c *Client) Delete(args DeleteArgs) error {
|
||||
err := c.client.Invoke(
|
||||
c.deleteMethod,
|
||||
args.cid,
|
||||
args.sig,
|
||||
args.token,
|
||||
)
|
||||
prm := client.InvokePrm{}
|
||||
|
||||
prm.SetMethod(c.deleteMethod)
|
||||
prm.SetArgs(args.cid, args.sig, args.token)
|
||||
|
||||
err := c.client.Invoke(prm)
|
||||
|
||||
if err != nil {
|
||||
return fmt.Errorf("could not invoke method (%s): %w", c.deleteMethod, err)
|
||||
|
|
|
@ -55,10 +55,12 @@ func (g *EACLValues) SessionToken() []byte {
|
|||
// EACL performs the test invoke of get eACL
|
||||
// method of NeoFS Container contract.
|
||||
func (c *Client) EACL(args EACLArgs) (*EACLValues, error) {
|
||||
prms, err := c.client.TestInvoke(
|
||||
c.eaclMethod,
|
||||
args.cid,
|
||||
)
|
||||
invokePrm := client.TestInvokePrm{}
|
||||
|
||||
invokePrm.SetMethod(c.eaclMethod)
|
||||
invokePrm.SetArgs(args.cid)
|
||||
|
||||
prms, err := c.client.TestInvoke(invokePrm)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("could not perform test invocation (%s): %w", c.eaclMethod, err)
|
||||
} else if ln := len(prms); ln != 1 {
|
||||
|
|
|
@ -2,6 +2,8 @@ package container
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/nspcc-dev/neofs-node/pkg/morph/client"
|
||||
)
|
||||
|
||||
// SetEACLArgs groups the arguments
|
||||
|
@ -44,13 +46,12 @@ func (p *SetEACLArgs) SetSessionToken(v []byte) {
|
|||
// SetEACL invokes the call of set eACL method
|
||||
// of NeoFS Container contract.
|
||||
func (c *Client) SetEACL(args SetEACLArgs) error {
|
||||
err := c.client.Invoke(
|
||||
c.setEACLMethod,
|
||||
args.eacl,
|
||||
args.sig,
|
||||
args.pubkey,
|
||||
args.token,
|
||||
)
|
||||
prm := client.InvokePrm{}
|
||||
|
||||
prm.SetMethod(c.setEACLMethod)
|
||||
prm.SetArgs(args.eacl, args.sig, args.pubkey, args.token)
|
||||
|
||||
err := c.client.Invoke(prm)
|
||||
|
||||
if err != nil {
|
||||
return fmt.Errorf("could not invoke method (%s): %w", c.setEACLMethod, err)
|
||||
|
|
|
@ -2,6 +2,8 @@ package container
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/nspcc-dev/neofs-node/pkg/morph/client"
|
||||
)
|
||||
|
||||
type StartEstimation struct {
|
||||
|
@ -21,14 +23,24 @@ func (e *StopEstimation) SetEpoch(v int64) {
|
|||
}
|
||||
|
||||
func (c *Client) StartEstimation(args StartEstimation) error {
|
||||
if err := c.client.Invoke(c.startEstimation, args.epoch); err != nil {
|
||||
prm := client.InvokePrm{}
|
||||
|
||||
prm.SetMethod(c.startEstimation)
|
||||
prm.SetArgs(args.epoch)
|
||||
|
||||
if err := c.client.Invoke(prm); err != nil {
|
||||
return fmt.Errorf("could not invoke method (%s): %w", c.startEstimation, err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Client) StopEstimation(args StopEstimation) error {
|
||||
if err := c.client.Invoke(c.stopEstimation, args.epoch); err != nil {
|
||||
prm := client.InvokePrm{}
|
||||
|
||||
prm.SetMethod(c.stopEstimation)
|
||||
prm.SetArgs(args.epoch)
|
||||
|
||||
if err := c.client.Invoke(prm); err != nil {
|
||||
return fmt.Errorf("could not invoke method (%s): %w", c.stopEstimation, err)
|
||||
}
|
||||
return nil
|
||||
|
|
|
@ -55,10 +55,12 @@ func (g *GetValues) SessionToken() []byte {
|
|||
// Get performs the test invoke of get container
|
||||
// method of NeoFS Container contract.
|
||||
func (c *Client) Get(args GetArgs) (*GetValues, error) {
|
||||
prms, err := c.client.TestInvoke(
|
||||
c.getMethod,
|
||||
args.cid,
|
||||
)
|
||||
invokePrm := client.TestInvokePrm{}
|
||||
|
||||
invokePrm.SetMethod(c.getMethod)
|
||||
invokePrm.SetArgs(args.cid)
|
||||
|
||||
prms, err := c.client.TestInvoke(invokePrm)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("could not perform test invocation (%s): %w", c.getMethod, err)
|
||||
} else if ln := len(prms); ln != 1 {
|
||||
|
|
|
@ -33,14 +33,12 @@ func (l *ListValues) CIDList() [][]byte {
|
|||
// List performs the test invoke of list container
|
||||
// method of NeoFS Container contract.
|
||||
func (c *Client) List(args ListArgs) (*ListValues, error) {
|
||||
invokeArgs := make([]interface{}, 0, 1)
|
||||
invokePrm := client.TestInvokePrm{}
|
||||
|
||||
invokeArgs = append(invokeArgs, args.ownerID)
|
||||
invokePrm.SetMethod(c.listMethod)
|
||||
invokePrm.SetArgs(args.ownerID)
|
||||
|
||||
prms, err := c.client.TestInvoke(
|
||||
c.listMethod,
|
||||
invokeArgs...,
|
||||
)
|
||||
prms, err := c.client.TestInvoke(invokePrm)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("could not perform test invocation (%s): %w", c.listMethod, err)
|
||||
} else if ln := len(prms); ln != 1 {
|
||||
|
|
|
@ -44,13 +44,12 @@ func (p *PutSizeArgs) SetReporterKey(v []byte) {
|
|||
// PutSize invokes the call of put container size method
|
||||
// of NeoFS Container contract.
|
||||
func (c *Client) PutSize(args PutSizeArgs) error {
|
||||
err := c.client.Invoke(
|
||||
c.putSizeMethod,
|
||||
args.epoch,
|
||||
args.cid,
|
||||
args.size,
|
||||
args.reporterKey,
|
||||
)
|
||||
prm := client.InvokePrm{}
|
||||
|
||||
prm.SetMethod(c.putSizeMethod)
|
||||
prm.SetArgs(args.epoch, args.cid, args.size, args.reporterKey)
|
||||
|
||||
err := c.client.Invoke(prm)
|
||||
|
||||
if err != nil {
|
||||
return fmt.Errorf("could not invoke method (%s): %w", c.putSizeMethod, err)
|
||||
|
@ -76,19 +75,21 @@ type ListSizesValues struct {
|
|||
ids [][]byte
|
||||
}
|
||||
|
||||
// Announcements returns list of identifiers of the
|
||||
// IDList returns list of identifiers of the
|
||||
// container load estimations.
|
||||
func (v *ListSizesValues) IDList() [][]byte {
|
||||
return v.ids
|
||||
}
|
||||
|
||||
// List performs the test invoke of "list container sizes"
|
||||
// ListSizes performs the test invoke of "list container sizes"
|
||||
// method of NeoFS Container contract.
|
||||
func (c *Client) ListSizes(args ListSizesArgs) (*ListSizesValues, error) {
|
||||
prms, err := c.client.TestInvoke(
|
||||
c.listSizesMethod,
|
||||
args.epoch,
|
||||
)
|
||||
invokePrm := client.TestInvokePrm{}
|
||||
|
||||
invokePrm.SetMethod(c.listSizesMethod)
|
||||
invokePrm.SetArgs(args.epoch)
|
||||
|
||||
prms, err := c.client.TestInvoke(invokePrm)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("could not perform test invocation (%s): %w", c.listSizesMethod, err)
|
||||
} else if ln := len(prms); ln != 1 {
|
||||
|
@ -153,10 +154,12 @@ func (v *GetSizeValues) Estimations() Estimations {
|
|||
// GetContainerSize performs the test invoke of "get container size"
|
||||
// method of NeoFS Container contract.
|
||||
func (c *Client) GetContainerSize(args GetSizeArgs) (*GetSizeValues, error) {
|
||||
prms, err := c.client.TestInvoke(
|
||||
c.getSizeMethod,
|
||||
args.id,
|
||||
)
|
||||
invokePrm := client.TestInvokePrm{}
|
||||
|
||||
invokePrm.SetMethod(c.getSizeMethod)
|
||||
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.getSizeMethod, err)
|
||||
} else if ln := len(prms); ln != 1 {
|
||||
|
|
|
@ -2,6 +2,8 @@ package container
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/nspcc-dev/neofs-node/pkg/morph/client"
|
||||
)
|
||||
|
||||
// PutArgs groups the arguments
|
||||
|
@ -52,34 +54,23 @@ func (p *PutArgs) SetNativeNameWithZone(name, zone string) {
|
|||
// of NeoFS Container contract.
|
||||
func (c *Client) Put(args PutArgs) error {
|
||||
var (
|
||||
err error
|
||||
method string
|
||||
prm client.InvokePrm
|
||||
)
|
||||
|
||||
if args.name != "" {
|
||||
err = c.client.Invoke(
|
||||
c.putNamedMethod,
|
||||
args.cnr,
|
||||
args.sig,
|
||||
args.publicKey,
|
||||
args.token,
|
||||
args.name,
|
||||
args.zone,
|
||||
)
|
||||
|
||||
method = c.putNamedMethod
|
||||
} else {
|
||||
err = c.client.Invoke(
|
||||
c.putMethod,
|
||||
args.cnr,
|
||||
args.sig,
|
||||
args.publicKey,
|
||||
args.token,
|
||||
)
|
||||
|
||||
prm.SetArgs(args.cnr, args.sig, args.publicKey, args.token, args.name, args.zone)
|
||||
} else {
|
||||
method = c.putMethod
|
||||
|
||||
prm.SetArgs(args.cnr, args.sig, args.publicKey, args.token)
|
||||
}
|
||||
|
||||
prm.SetMethod(method)
|
||||
|
||||
err := c.client.Invoke(prm)
|
||||
if err != nil {
|
||||
return fmt.Errorf("could not invoke method (%s): %w", method, err)
|
||||
}
|
||||
|
|
|
@ -2,6 +2,8 @@ package neofscontract
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/nspcc-dev/neofs-node/pkg/morph/client"
|
||||
)
|
||||
|
||||
// BindKeysArgs groups the arguments
|
||||
|
@ -35,11 +37,12 @@ func (x *commonBindArgs) SetKeys(v [][]byte) {
|
|||
// BindKeys invokes the call of key binding method
|
||||
// of NeoFS contract.
|
||||
func (x *Client) BindKeys(args BindKeysArgs) error {
|
||||
err := x.client.Invoke(
|
||||
x.bindKeysMethod,
|
||||
args.scriptHash,
|
||||
args.keys,
|
||||
)
|
||||
prm := client.InvokePrm{}
|
||||
|
||||
prm.SetMethod(x.bindKeysMethod)
|
||||
prm.SetArgs(args.scriptHash, args.keys)
|
||||
|
||||
err := x.client.Invoke(prm)
|
||||
if err != nil {
|
||||
return fmt.Errorf("could not invoke method (%s): %w", x.bindKeysMethod, err)
|
||||
}
|
||||
|
@ -50,11 +53,12 @@ func (x *Client) BindKeys(args BindKeysArgs) error {
|
|||
// UnbindKeys invokes the call of key unbinding method
|
||||
// of NeoFS contract.
|
||||
func (x *Client) UnbindKeys(args UnbindKeysArgs) error {
|
||||
err := x.client.Invoke(
|
||||
x.unbindKeysMethod,
|
||||
args.scriptHash,
|
||||
args.keys,
|
||||
)
|
||||
prm := client.InvokePrm{}
|
||||
|
||||
prm.SetMethod(x.unbindKeysMethod)
|
||||
prm.SetArgs(args.scriptHash, args.keys)
|
||||
|
||||
err := x.client.Invoke(prm)
|
||||
if err != nil {
|
||||
return fmt.Errorf("could not invoke method (%s): %w", x.unbindKeysMethod, err)
|
||||
}
|
||||
|
|
|
@ -3,14 +3,25 @@ package neofscontract
|
|||
import (
|
||||
"github.com/nspcc-dev/neo-go/pkg/crypto/keys"
|
||||
"github.com/nspcc-dev/neo-go/pkg/util"
|
||||
"github.com/nspcc-dev/neofs-node/pkg/morph/client"
|
||||
)
|
||||
|
||||
// Cheque invokes `cheque` method of NeoFS contract.
|
||||
func (x *Client) Cheque(id []byte, user util.Uint160, amount int64, lock util.Uint160) error {
|
||||
return x.client.Invoke(x.chequeMethod, id, user.BytesBE(), amount, lock.BytesBE())
|
||||
prm := client.InvokePrm{}
|
||||
|
||||
prm.SetMethod(x.chequeMethod)
|
||||
prm.SetArgs(id, user.BytesBE(), amount, lock.BytesBE())
|
||||
|
||||
return x.client.Invoke(prm)
|
||||
}
|
||||
|
||||
// AlphabetUpdate update list of alphabet nodes.
|
||||
func (x *Client) AlphabetUpdate(id []byte, pubs keys.PublicKeys) error {
|
||||
return x.client.Invoke(x.alphabetUpdateMethod, id, pubs)
|
||||
prm := client.InvokePrm{}
|
||||
|
||||
prm.SetMethod(x.alphabetUpdateMethod)
|
||||
prm.SetArgs(id, pubs)
|
||||
|
||||
return x.client.Invoke(prm)
|
||||
}
|
||||
|
|
|
@ -2,6 +2,8 @@ package neofsid
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/nspcc-dev/neofs-node/pkg/morph/client"
|
||||
)
|
||||
|
||||
// AddKeysArgs groups the arguments
|
||||
|
@ -35,11 +37,12 @@ func (x *commonBindArgs) SetKeys(v [][]byte) {
|
|||
// AddKeys invokes the call of key adding method
|
||||
// of NeoFS contract.
|
||||
func (x *Client) AddKeys(args AddKeysArgs) error {
|
||||
err := x.client.Invoke(
|
||||
x.addKeysMethod,
|
||||
args.ownerID,
|
||||
args.keys,
|
||||
)
|
||||
prm := client.InvokePrm{}
|
||||
|
||||
prm.SetMethod(x.addKeysMethod)
|
||||
prm.SetArgs(args.ownerID, args.keys)
|
||||
|
||||
err := x.client.Invoke(prm)
|
||||
if err != nil {
|
||||
return fmt.Errorf("could not invoke method (%s): %w", x.addKeysMethod, err)
|
||||
}
|
||||
|
@ -50,11 +53,12 @@ func (x *Client) AddKeys(args AddKeysArgs) error {
|
|||
// RemoveKeys invokes the call of key removing method
|
||||
// of NeoFS contract.
|
||||
func (x *Client) RemoveKeys(args RemoveKeysArgs) error {
|
||||
err := x.client.Invoke(
|
||||
x.removeKeysMethod,
|
||||
args.ownerID,
|
||||
args.keys,
|
||||
)
|
||||
prm := client.InvokePrm{}
|
||||
|
||||
prm.SetMethod(x.removeKeysMethod)
|
||||
prm.SetArgs(args.ownerID, args.keys)
|
||||
|
||||
err := x.client.Invoke(prm)
|
||||
if err != nil {
|
||||
return fmt.Errorf("could not invoke method (%s): %w", x.removeKeysMethod, err)
|
||||
}
|
||||
|
|
|
@ -33,14 +33,12 @@ func (l *KeyListingValues) Keys() [][]byte {
|
|||
// AccountKeys requests public keys of NeoFS account
|
||||
// through method of NeoFS ID contract.
|
||||
func (x *Client) AccountKeys(args KeyListingArgs) (*KeyListingValues, error) {
|
||||
invokeArgs := make([]interface{}, 0, 1)
|
||||
invokePrm := client.TestInvokePrm{}
|
||||
|
||||
invokeArgs = append(invokeArgs, args.ownerID)
|
||||
invokePrm.SetMethod(x.keyListingMethod)
|
||||
invokePrm.SetArgs(args.ownerID)
|
||||
|
||||
items, err := x.client.TestInvoke(
|
||||
x.keyListingMethod,
|
||||
invokeArgs...,
|
||||
)
|
||||
items, err := x.client.TestInvoke(invokePrm)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("could not perform test invocation (%s): %w", x.keyListingMethod, err)
|
||||
} else if ln := len(items); ln != 1 {
|
||||
|
|
|
@ -2,6 +2,8 @@ package netmap
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/nspcc-dev/neofs-node/pkg/morph/client"
|
||||
)
|
||||
|
||||
// AddPeerArgs groups the arguments
|
||||
|
@ -18,7 +20,12 @@ func (a *AddPeerArgs) SetInfo(v []byte) {
|
|||
// AddPeer invokes the call of add peer method
|
||||
// of NeoFS Netmap contract.
|
||||
func (c *Client) AddPeer(args AddPeerArgs) error {
|
||||
if err := c.client.Invoke(c.addPeerMethod, args.info); err != nil {
|
||||
prm := client.InvokePrm{}
|
||||
|
||||
prm.SetMethod(c.addPeerMethod)
|
||||
prm.SetArgs(args.info)
|
||||
|
||||
if err := c.client.Invoke(prm); err != nil {
|
||||
return fmt.Errorf("could not invoke method (%s): %w", c.addPeerMethod, err)
|
||||
}
|
||||
return nil
|
||||
|
|
|
@ -32,10 +32,12 @@ func (c ConfigValues) Value() interface{} {
|
|||
// Config performs the test invoke of get config value
|
||||
// method of NeoFS Netmap contract.
|
||||
func (c *Client) Config(args ConfigArgs, assert func(stackitem.Item) (interface{}, error)) (*ConfigValues, error) {
|
||||
items, err := c.client.TestInvoke(
|
||||
c.configMethod,
|
||||
args.key,
|
||||
)
|
||||
prm := client.TestInvokePrm{}
|
||||
|
||||
prm.SetMethod(c.configMethod)
|
||||
prm.SetArgs(args.key)
|
||||
|
||||
items, err := c.client.TestInvoke(prm)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("could not perform test invocation (%s): %w",
|
||||
c.configMethod, err)
|
||||
|
@ -58,7 +60,12 @@ func (c *Client) Config(args ConfigArgs, assert func(stackitem.Item) (interface{
|
|||
|
||||
// SetConfig invokes `setConfig` method of NeoFS Netmap contract.
|
||||
func (c *Client) SetConfig(id, key []byte, value interface{}) error {
|
||||
return c.client.Invoke(c.setConfigMethod, id, key, value)
|
||||
prm := client.InvokePrm{}
|
||||
|
||||
prm.SetMethod(c.setConfigMethod)
|
||||
prm.SetArgs(id, key, value)
|
||||
|
||||
return c.client.Invoke(prm)
|
||||
}
|
||||
|
||||
func IntegerAssert(item stackitem.Item) (interface{}, error) {
|
||||
|
@ -74,7 +81,7 @@ func StringAssert(item stackitem.Item) (interface{}, error) {
|
|||
type ListConfigArgs struct {
|
||||
}
|
||||
|
||||
// ConfigValues groups the stack parameters
|
||||
// ListConfigValues groups the stack parameters
|
||||
// returned by config listing test invoke.
|
||||
type ListConfigValues struct {
|
||||
rs []stackitem.Item
|
||||
|
@ -114,9 +121,11 @@ func (x ListConfigValues) IterateRecords(f func(key, value []byte) error) error
|
|||
|
||||
// ListConfig performs the test invoke of config listing method of NeoFS Netmap contract.
|
||||
func (c *Client) ListConfig(args ListConfigArgs) (*ListConfigValues, error) {
|
||||
items, err := c.client.TestInvoke(
|
||||
c.configListMethod,
|
||||
)
|
||||
prm := client.TestInvokePrm{}
|
||||
|
||||
prm.SetMethod(c.configListMethod)
|
||||
|
||||
items, err := c.client.TestInvoke(prm)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("could not perform test invocation (%s): %w",
|
||||
c.configListMethod, err)
|
||||
|
|
|
@ -41,9 +41,10 @@ func (e EpochBlockValues) Block() int64 {
|
|||
// Epoch performs the test invoke of get epoch number
|
||||
// method of NeoFS Netmap contract.
|
||||
func (c *Client) Epoch(_ EpochArgs) (*EpochValues, error) {
|
||||
items, err := c.client.TestInvoke(
|
||||
c.epochMethod,
|
||||
)
|
||||
prm := client.TestInvokePrm{}
|
||||
prm.SetMethod(c.epochMethod)
|
||||
|
||||
items, err := c.client.TestInvoke(prm)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("could not perform test invocation (%s): %w",
|
||||
c.epochMethod, err)
|
||||
|
@ -67,7 +68,10 @@ func (c *Client) Epoch(_ EpochArgs) (*EpochValues, error) {
|
|||
// LastEpochBlock performs the test invoke of get epoch block number
|
||||
// method of NeoFS Netmap contract.
|
||||
func (c *Client) LastEpochBlock(_ EpochBlockArgs) (*EpochBlockValues, error) {
|
||||
items, err := c.client.TestInvoke(c.lastEpochBlockMethod)
|
||||
prm := client.TestInvokePrm{}
|
||||
prm.SetMethod(c.lastEpochBlockMethod)
|
||||
|
||||
items, err := c.client.TestInvoke(prm)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("could not perform test invocation (%s): %w",
|
||||
c.lastEpochBlockMethod, err)
|
||||
|
|
|
@ -16,15 +16,21 @@ func (c *Client) UpdateInnerRing(keys keys.PublicKeys) error {
|
|||
args[i] = keys[i].Bytes()
|
||||
}
|
||||
|
||||
return c.client.Invoke(c.updateInnerRing, args)
|
||||
prm := client.InvokePrm{}
|
||||
|
||||
prm.SetMethod(c.updateInnerRing)
|
||||
prm.SetArgs(args)
|
||||
|
||||
return c.client.Invoke(prm)
|
||||
}
|
||||
|
||||
// InnerRingList returns public keys of inner ring members in
|
||||
// netmap contract.
|
||||
func (c *Client) InnerRingList() (keys.PublicKeys, error) {
|
||||
prms, err := c.client.TestInvoke(
|
||||
c.innerRingList,
|
||||
)
|
||||
invokePrm := client.TestInvokePrm{}
|
||||
invokePrm.SetMethod(c.innerRingList)
|
||||
|
||||
prms, err := c.client.TestInvoke(invokePrm)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("could not perform test invocation (%s): %w", c.innerRingList, err)
|
||||
}
|
||||
|
|
|
@ -106,9 +106,10 @@ func (g GetNetMapValues) Peers() [][]byte {
|
|||
// NetMap performs the test invoke of get network map
|
||||
// method of NeoFS Netmap contract.
|
||||
func (c *Client) NetMap(_ GetNetMapArgs) (*GetNetMapValues, error) {
|
||||
prms, err := c.client.TestInvoke(
|
||||
c.netMapMethod,
|
||||
)
|
||||
invokePrm := client.TestInvokePrm{}
|
||||
invokePrm.SetMethod(c.netMapMethod)
|
||||
|
||||
prms, err := c.client.TestInvoke(invokePrm)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("could not perform test invocation (%s): %w",
|
||||
c.netMapMethod, err)
|
||||
|
@ -121,10 +122,12 @@ func (c *Client) NetMap(_ GetNetMapArgs) (*GetNetMapValues, error) {
|
|||
// from NeoFS Netmap contract. Contract saves only one previous epoch,
|
||||
// so all invokes with diff > 1 return error.
|
||||
func (c *Client) Snapshot(a GetSnapshotArgs) (*GetNetMapValues, error) {
|
||||
prms, err := c.client.TestInvoke(
|
||||
c.snapshotMethod,
|
||||
int64(a.diff),
|
||||
)
|
||||
invokePrm := client.TestInvokePrm{}
|
||||
|
||||
invokePrm.SetMethod(c.snapshotMethod)
|
||||
invokePrm.SetArgs(int64(a.diff))
|
||||
|
||||
prms, err := c.client.TestInvoke(invokePrm)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("could not perform test invocation (%s): %w",
|
||||
c.netMapMethod, err)
|
||||
|
@ -136,10 +139,12 @@ func (c *Client) Snapshot(a GetSnapshotArgs) (*GetNetMapValues, error) {
|
|||
// EpochSnapshot performs the test invoke of get snapshot of network map by epoch
|
||||
// from NeoFS Netmap contract.
|
||||
func (c *Client) EpochSnapshot(args EpochSnapshotArgs) (*EpochSnapshotValues, error) {
|
||||
prms, err := c.client.TestInvoke(
|
||||
c.epochSnapshotMethod,
|
||||
int64(args.epoch),
|
||||
)
|
||||
invokePrm := client.TestInvokePrm{}
|
||||
|
||||
invokePrm.SetMethod(c.epochSnapshotMethod)
|
||||
invokePrm.SetArgs(int64(args.epoch))
|
||||
|
||||
prms, err := c.client.TestInvoke(invokePrm)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("could not perform test invocation (%s): %w",
|
||||
c.epochSnapshotMethod, err)
|
||||
|
@ -156,9 +161,10 @@ func (c *Client) EpochSnapshot(args EpochSnapshotArgs) (*EpochSnapshotValues, er
|
|||
}
|
||||
|
||||
func (c *Client) Candidates(_ GetNetMapCandidatesArgs) (*GetNetMapCandidatesValues, error) {
|
||||
prms, err := c.client.TestInvoke(
|
||||
c.netMapCandidatesMethod,
|
||||
)
|
||||
invokePrm := client.TestInvokePrm{}
|
||||
invokePrm.SetMethod(c.netMapCandidatesMethod)
|
||||
|
||||
prms, err := c.client.TestInvoke(invokePrm)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("could not perform test invocation (%s): %w", c.netMapCandidatesMethod, err)
|
||||
}
|
||||
|
|
|
@ -2,6 +2,8 @@ package netmap
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/nspcc-dev/neofs-node/pkg/morph/client"
|
||||
)
|
||||
|
||||
// NewEpochArgs groups the arguments
|
||||
|
@ -18,7 +20,12 @@ func (a *NewEpochArgs) SetEpochNumber(v int64) {
|
|||
// NewEpoch invokes the call of new epoch method
|
||||
// of NeoFS Netmap contract.
|
||||
func (c *Client) NewEpoch(args NewEpochArgs) error {
|
||||
if err := c.client.Invoke(c.newEpochMethod, args.number); err != nil {
|
||||
prm := client.InvokePrm{}
|
||||
|
||||
prm.SetMethod(c.newEpochMethod)
|
||||
prm.SetArgs(args.number)
|
||||
|
||||
if err := c.client.Invoke(prm); err != nil {
|
||||
return fmt.Errorf("could not invoke method (%s): %w", c.newEpochMethod, err)
|
||||
}
|
||||
return nil
|
||||
|
|
|
@ -2,6 +2,8 @@ package netmap
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/nspcc-dev/neofs-node/pkg/morph/client"
|
||||
)
|
||||
|
||||
// UpdateStateArgs groups the arguments
|
||||
|
@ -26,11 +28,12 @@ func (u *UpdateStateArgs) SetState(v int64) {
|
|||
// UpdateState invokes the call of update state method
|
||||
// of NeoFS Netmap contract.
|
||||
func (c *Client) UpdateState(args UpdateStateArgs) error {
|
||||
err := c.client.Invoke(
|
||||
c.updateStateMethod,
|
||||
args.state,
|
||||
args.key,
|
||||
)
|
||||
prm := client.InvokePrm{}
|
||||
|
||||
prm.SetMethod(c.updateStateMethod)
|
||||
prm.SetArgs(args.state, args.key)
|
||||
|
||||
err := c.client.Invoke(prm)
|
||||
|
||||
if err != nil {
|
||||
return fmt.Errorf("could not invoke method (%s): %w", c.updateStateMethod, err)
|
||||
|
|
|
@ -47,11 +47,12 @@ func (g GetResult) Reputations() [][]byte {
|
|||
|
||||
// Get invokes the call of "get reputation value" method of reputation contract.
|
||||
func (c *Client) Get(args GetArgs) (*GetResult, error) {
|
||||
prms, err := c.client.TestInvoke(
|
||||
c.getMethod,
|
||||
int64(args.epoch),
|
||||
args.peerID,
|
||||
)
|
||||
invokePrm := client.TestInvokePrm{}
|
||||
|
||||
invokePrm.SetMethod(c.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)
|
||||
}
|
||||
|
@ -62,10 +63,12 @@ func (c *Client) Get(args GetArgs) (*GetResult, error) {
|
|||
// GetByID invokes the call of "get reputation value by reputation id" method
|
||||
// of reputation contract.
|
||||
func (c *Client) GetByID(args GetByIDArgs) (*GetResult, error) {
|
||||
prms, err := c.client.TestInvoke(
|
||||
c.getByIDMethod,
|
||||
args.id,
|
||||
)
|
||||
invokePrm := client.TestInvokePrm{}
|
||||
|
||||
invokePrm.SetMethod(c.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)
|
||||
}
|
||||
|
|
|
@ -31,10 +31,12 @@ func (l ListByEpochResult) IDs() [][]byte {
|
|||
// ListByEpoch invokes the call of "list reputation ids by epoch" method of
|
||||
// reputation contract.
|
||||
func (c *Client) ListByEpoch(args ListByEpochArgs) (*ListByEpochResult, error) {
|
||||
prms, err := c.client.TestInvoke(
|
||||
c.listByEpochMethod,
|
||||
int64(args.epoch),
|
||||
)
|
||||
invokePrm := client.TestInvokePrm{}
|
||||
|
||||
invokePrm.SetMethod(c.listByEpochMethod)
|
||||
invokePrm.SetArgs(int64(args.epoch))
|
||||
|
||||
prms, err := c.client.TestInvoke(invokePrm)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("could not perform test invocation (%s): %w", c.listByEpochMethod, err)
|
||||
} else if ln := len(prms); ln != 1 {
|
||||
|
|
|
@ -2,6 +2,8 @@ package reputation
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/nspcc-dev/neofs-node/pkg/morph/client"
|
||||
)
|
||||
|
||||
// PutArgs groups the arguments of "put reputation value" invocation call.
|
||||
|
@ -28,12 +30,12 @@ func (p *PutArgs) SetValue(v []byte) {
|
|||
|
||||
// Put invokes direct call of "put reputation value" method of reputation contract.
|
||||
func (c *Client) Put(args PutArgs) error {
|
||||
err := c.client.Invoke(
|
||||
c.putMethod,
|
||||
int64(args.epoch),
|
||||
args.peerID,
|
||||
args.value,
|
||||
)
|
||||
prm := client.InvokePrm{}
|
||||
|
||||
prm.SetMethod(c.putMethod)
|
||||
prm.SetArgs(int64(args.epoch), args.peerID, args.value)
|
||||
|
||||
err := c.client.Invoke(prm)
|
||||
|
||||
if err != nil {
|
||||
return fmt.Errorf("could not invoke method (%s): %w", c.putMethod, err)
|
||||
|
|
Loading…
Reference in a new issue