forked from TrueCloudLab/frostfs-api-go
[#128] sdk: Use owner ID instead of NEO3Wallet
Replace owner.NEO3Wallet usage with owner.ID usage. Functions that process the wallet address convert it to the owner identifier through the public method. Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
c9d38aa2e1
commit
63c8d6e9ea
8 changed files with 101 additions and 89 deletions
|
@ -2,7 +2,6 @@ package container
|
|||
|
||||
import (
|
||||
"github.com/nspcc-dev/neofs-api-go/v2/container"
|
||||
"github.com/nspcc-dev/neofs-api-go/v2/refs"
|
||||
)
|
||||
|
||||
type Container struct {
|
||||
|
@ -24,10 +23,7 @@ func New(opts ...NewOption) (*Container, error) {
|
|||
}
|
||||
|
||||
if cnrOptions.owner != nil {
|
||||
owner := new(refs.OwnerID)
|
||||
owner.SetValue(cnrOptions.owner[:])
|
||||
|
||||
cnr.SetOwnerID(owner)
|
||||
cnr.SetOwnerID(cnrOptions.owner.ToV2())
|
||||
}
|
||||
|
||||
attributes := make([]*container.Attribute, len(cnrOptions.attributes))
|
||||
|
|
|
@ -3,7 +3,7 @@ package container
|
|||
import (
|
||||
"github.com/google/uuid"
|
||||
"github.com/nspcc-dev/neofs-api-go/pkg/acl"
|
||||
"github.com/nspcc-dev/neofs-api-go/pkg/refs"
|
||||
"github.com/nspcc-dev/neofs-api-go/pkg/owner"
|
||||
)
|
||||
|
||||
type (
|
||||
|
@ -20,7 +20,7 @@ type (
|
|||
acl uint32
|
||||
policy string
|
||||
attributes []attribute
|
||||
owner *refs.NEO3Wallet
|
||||
owner *owner.ID
|
||||
nonce uuid.UUID
|
||||
}
|
||||
)
|
||||
|
@ -75,9 +75,19 @@ func WithNonce(nonce uuid.UUID) NewOption {
|
|||
})
|
||||
}
|
||||
|
||||
func WithOwner(owner refs.NEO3Wallet) NewOption {
|
||||
func WithOwnerID(id *owner.ID) NewOption {
|
||||
return newFuncContainerOption(func(option *containerOptions) {
|
||||
option.owner = &owner
|
||||
option.owner = id
|
||||
})
|
||||
}
|
||||
|
||||
func WithNEO3Wallet(w *owner.NEO3Wallet) NewOption {
|
||||
return newFuncContainerOption(func(option *containerOptions) {
|
||||
if option.owner == nil {
|
||||
option.owner = new(owner.ID)
|
||||
}
|
||||
|
||||
option.owner.SetNeo3Wallet(w)
|
||||
})
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue