forked from TrueCloudLab/frostfs-node
[#1400] owner: Upgrade SDK package
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
f8ac4632f8
commit
bb25ecbd15
60 changed files with 379 additions and 327 deletions
|
@ -6,13 +6,13 @@ import (
|
|||
|
||||
"github.com/nspcc-dev/neo-go/pkg/encoding/address"
|
||||
"github.com/nspcc-dev/neofs-node/pkg/morph/client"
|
||||
"github.com/nspcc-dev/neofs-sdk-go/owner"
|
||||
"github.com/nspcc-dev/neofs-sdk-go/user"
|
||||
)
|
||||
|
||||
// BalanceOf receives the amount of funds in the client's account
|
||||
// through the Balance contract call, and returns it.
|
||||
func (c *Client) BalanceOf(id *owner.ID) (*big.Int, error) {
|
||||
h, err := address.StringToUint160(id.String())
|
||||
func (c *Client) BalanceOf(id *user.ID) (*big.Int, error) {
|
||||
h, err := address.StringToUint160(id.EncodeToString())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
@ -5,14 +5,14 @@ import (
|
|||
|
||||
"github.com/nspcc-dev/neo-go/pkg/encoding/address"
|
||||
"github.com/nspcc-dev/neofs-node/pkg/morph/client"
|
||||
"github.com/nspcc-dev/neofs-sdk-go/owner"
|
||||
"github.com/nspcc-dev/neofs-sdk-go/user"
|
||||
)
|
||||
|
||||
// TransferPrm groups parameters of TransferX method.
|
||||
type TransferPrm struct {
|
||||
Amount int64
|
||||
|
||||
From, To *owner.ID
|
||||
From, To *user.ID
|
||||
|
||||
Details []byte
|
||||
|
||||
|
@ -24,12 +24,12 @@ type TransferPrm struct {
|
|||
//
|
||||
// If TryNotary is provided, calls notary contract.
|
||||
func (c *Client) TransferX(p TransferPrm) error {
|
||||
from, err := address.StringToUint160(p.From.String())
|
||||
from, err := address.StringToUint160(p.From.EncodeToString())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
to, err := address.StringToUint160(p.To.String())
|
||||
to, err := address.StringToUint160(p.To.EncodeToString())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -5,23 +5,20 @@ import (
|
|||
|
||||
"github.com/nspcc-dev/neofs-node/pkg/morph/client"
|
||||
cid "github.com/nspcc-dev/neofs-sdk-go/container/id"
|
||||
"github.com/nspcc-dev/neofs-sdk-go/owner"
|
||||
"github.com/nspcc-dev/neofs-sdk-go/user"
|
||||
)
|
||||
|
||||
// List returns a list of container identifiers belonging
|
||||
// to the specified owner of NeoFS system. The list is composed
|
||||
// to the specified user of NeoFS system. The list is composed
|
||||
// through Container contract call.
|
||||
//
|
||||
// Returns the identifiers of all NeoFS containers if pointer
|
||||
// to owner identifier is nil.
|
||||
func (c *Client) List(ownerID *owner.ID) ([]*cid.ID, error) {
|
||||
// to user identifier is nil.
|
||||
func (c *Client) List(idUser *user.ID) ([]*cid.ID, error) {
|
||||
var rawID []byte
|
||||
if ownerID == nil {
|
||||
rawID = []byte{}
|
||||
} else if v2 := ownerID.ToV2(); v2 == nil {
|
||||
return nil, errUnsupported // use other major version if there any
|
||||
} else {
|
||||
rawID = v2.GetValue()
|
||||
|
||||
if idUser != nil {
|
||||
rawID = idUser.WalletBytes()
|
||||
}
|
||||
|
||||
prm := client.TestInvokePrm{}
|
||||
|
|
|
@ -6,16 +6,16 @@ import (
|
|||
|
||||
"github.com/nspcc-dev/neo-go/pkg/crypto/keys"
|
||||
"github.com/nspcc-dev/neofs-node/pkg/morph/client"
|
||||
"github.com/nspcc-dev/neofs-sdk-go/owner"
|
||||
"github.com/nspcc-dev/neofs-sdk-go/user"
|
||||
)
|
||||
|
||||
// AccountKeysPrm groups parameters of AccountKeys operation.
|
||||
type AccountKeysPrm struct {
|
||||
id *owner.ID
|
||||
id *user.ID
|
||||
}
|
||||
|
||||
// SetID sets owner ID.
|
||||
func (a *AccountKeysPrm) SetID(id *owner.ID) {
|
||||
func (a *AccountKeysPrm) SetID(id *user.ID) {
|
||||
a.id = id
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,7 @@ func (a *AccountKeysPrm) SetID(id *owner.ID) {
|
|||
func (x *Client) AccountKeys(p AccountKeysPrm) (keys.PublicKeys, error) {
|
||||
prm := client.TestInvokePrm{}
|
||||
prm.SetMethod(keyListingMethod)
|
||||
prm.SetArgs(p.id.ToV2().GetValue())
|
||||
prm.SetArgs(p.id.WalletBytes())
|
||||
|
||||
items, err := x.client.TestInvoke(prm)
|
||||
if err != nil {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue