2020-08-22 15:20:47 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
accountingGRPC "github.com/nspcc-dev/neofs-api-go/v2/accounting/grpc"
|
2020-09-01 14:33:26 +00:00
|
|
|
"github.com/nspcc-dev/neofs-node/pkg/morph/client/balance/wrapper"
|
2020-08-22 15:20:47 +00:00
|
|
|
accountingTransportGRPC "github.com/nspcc-dev/neofs-node/pkg/network/transport/accounting/grpc"
|
|
|
|
accountingService "github.com/nspcc-dev/neofs-node/pkg/services/accounting"
|
|
|
|
accounting "github.com/nspcc-dev/neofs-node/pkg/services/accounting/morph"
|
|
|
|
)
|
|
|
|
|
|
|
|
func initAccountingService(c *cfg) {
|
2020-08-24 09:40:32 +00:00
|
|
|
if c.cfgMorph.client == nil {
|
2020-08-22 15:20:47 +00:00
|
|
|
initMorphComponents(c)
|
|
|
|
}
|
|
|
|
|
2021-05-21 11:02:46 +00:00
|
|
|
balanceMorphWrapper, err := wrapper.NewFromMorph(c.cfgMorph.client, c.cfgAccounting.scriptHash, 0)
|
2020-09-01 14:33:26 +00:00
|
|
|
fatalOnErr(err)
|
|
|
|
|
2020-08-24 09:40:32 +00:00
|
|
|
accountingGRPC.RegisterAccountingServiceServer(c.cfgGRPC.server,
|
2020-08-22 15:20:47 +00:00
|
|
|
accountingTransportGRPC.New(
|
|
|
|
accountingService.NewSignService(
|
2021-05-31 08:55:38 +00:00
|
|
|
&c.key.PrivateKey,
|
2020-10-22 11:07:06 +00:00
|
|
|
accountingService.NewResponseService(
|
|
|
|
accountingService.NewExecutionService(
|
|
|
|
accounting.NewExecutor(balanceMorphWrapper),
|
|
|
|
),
|
|
|
|
c.respSvc,
|
2020-08-22 15:20:47 +00:00
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
}
|