wrapper

package
v0.14.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 15, 2021 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNilWrapper = errors.New("balance contract client wrapper is nil")

ErrNilWrapper is returned by functions that expect a non-nil Wrapper pointer, but received nil.

Functions

This section is empty.

Types

type Client

type Client = balance.Client

Client represents the Balance contract client.

It is a type alias of github.com/nspcc-dev/neofs-node/pkg/morph/client/balance.Client.

type Wrapper

type Wrapper struct {
	// contains filtered or unexported fields
}

Wrapper is a wrapper over balance contract client which implements:

  • tool for obtaining the amount of funds in the client's account;
  • tool for obtaining decimal precision of currency transactions.

Working wrapper must be created via constructor New. Using the Wrapper that has been created with new(Wrapper) expression (or just declaring a Wrapper variable) is unsafe and can lead to panic.

func New

func New(c *Client) (*Wrapper, error)

New creates, initializes and returns the Wrapper instance.

If Client is nil, balance.ErrNilClient is returned.

func (*Wrapper) BalanceOf

func (w *Wrapper) BalanceOf(id *owner.ID) (*big.Int, error)

BalanceOf receives the amount of funds in the client's account through the Balance contract call, and returns it.

func (*Wrapper) Decimals

func (w *Wrapper) Decimals() (uint32, error)

Decimals decimal precision of currency transactions through the Balance contract call, and returns it.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL