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
|
@ -2,11 +2,13 @@ package accounting
|
|||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
"github.com/nspcc-dev/neofs-api-go/v2/accounting"
|
||||
"github.com/nspcc-dev/neofs-node/pkg/morph/client/balance"
|
||||
accountingSvc "github.com/nspcc-dev/neofs-node/pkg/services/accounting"
|
||||
"github.com/nspcc-dev/neofs-sdk-go/owner"
|
||||
"github.com/nspcc-dev/neofs-sdk-go/user"
|
||||
)
|
||||
|
||||
type morphExecutor struct {
|
||||
|
@ -20,7 +22,19 @@ func NewExecutor(client *balance.Client) accountingSvc.ServiceExecutor {
|
|||
}
|
||||
|
||||
func (s *morphExecutor) Balance(ctx context.Context, body *accounting.BalanceRequestBody) (*accounting.BalanceResponseBody, error) {
|
||||
amount, err := s.client.BalanceOf(owner.NewIDFromV2(body.GetOwnerID()))
|
||||
idV2 := body.GetOwnerID()
|
||||
if idV2 == nil {
|
||||
return nil, errors.New("missing account")
|
||||
}
|
||||
|
||||
var id user.ID
|
||||
|
||||
err := id.ReadFromV2(*idV2)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("invalid account: %w", err)
|
||||
}
|
||||
|
||||
amount, err := s.client.BalanceOf(&id)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue