balance

package
v1.22.0 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2020 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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

ErrNilClient is returned by functions that expect a non-nil Client pointer, but received nil.

Functions

This section is empty.

Types

type Client

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

Client is a wrapper over StaticClient which makes calls with the names and arguments of the NeoFS Balance contract.

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

func New

func New(c *client.StaticClient, opts ...Option) (*Client, error)

New creates, initializes and returns the Client instance.

If StaticClient is nil, client.ErrNilStaticClient is returned.

Other values are set according to provided options, or by default:

  • "balance of" method name: balanceOf;
  • decimals method name: decimals.

If desired option satisfies the default value, it can be omitted. If multiple options of the same config value are supplied, the option with the highest index in the arguments will be used.

func (*Client) BalanceOf

func (c *Client) BalanceOf(args GetBalanceOfArgs) (*GetBalanceOfValues, error)

BalanceOf performs the test invoke of "balance of" method of NeoFS Balance contract.

func (*Client) Decimals

func (c *Client) Decimals(args DecimalsArgs) (*DecimalsValues, error)

Decimals performs the test invoke of decimals method of NeoFS Balance contract.

type DecimalsArgs

type DecimalsArgs struct {
}

DecimalsArgs groups the arguments of decimals test invoke call.

type DecimalsValues

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

DecimalsValues groups the stack parameters returned by decimals test invoke.

func (*DecimalsValues) Decimals

func (d *DecimalsValues) Decimals() int64

Decimals returns the decimals value.

type GetBalanceOfArgs

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

GetBalanceOfArgs groups the arguments of "balance of" test invoke call.

func (*GetBalanceOfArgs) SetWallet

func (g *GetBalanceOfArgs) SetWallet(v []byte)

SetWallet sets the wallet script hash in a binary format.

type GetBalanceOfValues

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

GetBalanceOfValues groups the stack parameters returned by "balance of" test invoke.

func (*GetBalanceOfValues) Amount

func (g *GetBalanceOfValues) Amount() *big.Int

Amount returns the amount of funds.

type Option

type Option func(*cfg)

Option is a client configuration change function.

func WithBalanceOfMethod

func WithBalanceOfMethod(n string) Option

WithBalanceOfMethod returns a client constructor option that specifies the "balance of" method name.

Ignores empty value.

If option not provided, "balanceOf" is used.

func WithDecimalsMethod

func WithDecimalsMethod(n string) Option

WithDecimalsMethod returns a client constructor option that specifies the method name of decimals receiving operation.

Ignores empty value.

If option not provided, "decimals" is used.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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