[#355] innerring: Add fee to NoFee
wrappers
There is no point of making separate `Fee` and `NoFee` wrappers because all reading operations are free disregarding of fee value in static client. However we can use these same wrappers so send transaction. Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
parent
70aa73cbd2
commit
402192c8c4
3 changed files with 14 additions and 16 deletions
|
@ -220,17 +220,17 @@ func New(ctx context.Context, log *zap.Logger, cfg *viper.Viper) (*Server, error
|
|||
return nil, err
|
||||
}
|
||||
|
||||
server.auditClient, err = invoke.NewNoFeeAuditClient(server.morphClient, server.contracts.audit)
|
||||
server.auditClient, err = invoke.NewAuditClient(server.morphClient, server.contracts.audit)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
cnrClient, err := invoke.NewNoFeeContainerClient(server.morphClient, server.contracts.container)
|
||||
cnrClient, err := invoke.NewContainerClient(server.morphClient, server.contracts.container)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
nmClient, err := invoke.NewNoFeeNetmapClient(server.morphClient, server.contracts.netmap)
|
||||
nmClient, err := invoke.NewNetmapClient(server.morphClient, server.contracts.netmap)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
@ -16,11 +16,9 @@ import (
|
|||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
const readOnlyFee = 0
|
||||
|
||||
// NewNoFeeContainerClient creates wrapper to access data from container contract.
|
||||
func NewNoFeeContainerClient(cli *client.Client, contract util.Uint160) (*wrapContainer.Wrapper, error) {
|
||||
staticClient, err := client.NewStatic(cli, contract, readOnlyFee)
|
||||
// NewContainerClient creates wrapper to access data from container contract.
|
||||
func NewContainerClient(cli *client.Client, contract util.Uint160) (*wrapContainer.Wrapper, error) {
|
||||
staticClient, err := client.NewStatic(cli, contract, extraFee)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("can't create container static client: %w", err)
|
||||
}
|
||||
|
@ -33,9 +31,9 @@ func NewNoFeeContainerClient(cli *client.Client, contract util.Uint160) (*wrapCo
|
|||
return wrapContainer.New(enhancedContainerClient)
|
||||
}
|
||||
|
||||
// NewNoFeeNetmapClient creates wrapper to access data from netmap contract.
|
||||
func NewNoFeeNetmapClient(cli *client.Client, contract util.Uint160) (*wrapNetmap.Wrapper, error) {
|
||||
staticClient, err := client.NewStatic(cli, contract, readOnlyFee)
|
||||
// NewNetmapClient creates wrapper to access data from netmap contract.
|
||||
func NewNetmapClient(cli *client.Client, contract util.Uint160) (*wrapNetmap.Wrapper, error) {
|
||||
staticClient, err := client.NewStatic(cli, contract, extraFee)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("can't create netmap static client: %w", err)
|
||||
}
|
||||
|
@ -48,9 +46,9 @@ func NewNoFeeNetmapClient(cli *client.Client, contract util.Uint160) (*wrapNetma
|
|||
return wrapNetmap.New(enhancedNetmapClient)
|
||||
}
|
||||
|
||||
// NewNoFeeAuditClient creates wrapper to work with Audit contract.
|
||||
func NewNoFeeAuditClient(cli *client.Client, contract util.Uint160) (*auditWrapper.ClientWrapper, error) {
|
||||
staticClient, err := client.NewStatic(cli, contract, readOnlyFee)
|
||||
// NewAuditClient creates wrapper to work with Audit contract.
|
||||
func NewAuditClient(cli *client.Client, contract util.Uint160) (*auditWrapper.ClientWrapper, error) {
|
||||
staticClient, err := client.NewStatic(cli, contract, extraFee)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
@ -105,13 +105,13 @@ func New(p *Params) (*Processor, error) {
|
|||
}
|
||||
|
||||
// creating enhanced client for getting network map
|
||||
netmapClient, err := invoke.NewNoFeeNetmapClient(p.MorphClient, p.NetmapContract)
|
||||
netmapClient, err := invoke.NewNetmapClient(p.MorphClient, p.NetmapContract)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// creating enhanced client for getting containers
|
||||
containerClient, err := invoke.NewNoFeeContainerClient(p.MorphClient, p.ContainerContract)
|
||||
containerClient, err := invoke.NewContainerClient(p.MorphClient, p.ContainerContract)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue