frostfs-node/pkg/morph/client/balance/wrapper/decimals.go
Alex Vanin 80f10dab7b [#16] Fix balanceOf wrapper for api request
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2020-10-02 11:25:35 +03:00

21 lines
533 B
Go

package wrapper
import (
"github.com/nspcc-dev/neofs-node/pkg/morph/client/balance"
"github.com/pkg/errors"
)
// Decimals decimal precision of currency transactions
// through the Balance contract call, and returns it.
func (w *Wrapper) Decimals() (uint32, error) {
// prepare invocation arguments
args := balance.DecimalsArgs{}
// invoke smart contract call
values, err := w.client.Decimals(args)
if err != nil {
return 0, errors.Wrap(err, "could not invoke smart contract")
}
return uint32(values.Decimals()), nil
}