balance

package
v0.23.0 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2021 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) Burn added in v0.22.0

func (c *Client) Burn(to []byte, amount int64, id []byte) error

Burn invokes `burn` method of the 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.

func (*Client) Lock added in v0.22.0

func (c *Client) Lock(id, user, lock []byte, amount, dueEpoch int64) error

Lock invokes `lock` method of the balance contract.

func (*Client) Mint added in v0.22.0

func (c *Client) Mint(to []byte, amount int64, id []byte) error

Mint invokes `mint` method of the balance contract.

func (*Client) TransferX added in v0.15.0

func (c *Client) TransferX(args TransferXArgs) error

TransferX directly invokes the call of "transferX" 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.

func WithTransferXMethod added in v0.15.0

func WithTransferXMethod(n string) Option

WithTransferXMethod returns a client constructor option that specifies the "transferX" method name.

Ignores empty value.

If option not provided, "transferX" is used.

type TransferXArgs added in v0.15.0

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

TransferXArgs groups the arguments of "transferX" invocation call.

func (*TransferXArgs) SetAmount added in v0.15.0

func (t *TransferXArgs) SetAmount(v int64)

SetAmount sets amount of funds to transfer in GASe-12.

func (*TransferXArgs) SetDetails added in v0.15.0

func (t *TransferXArgs) SetDetails(v []byte)

SetDetails sets details of the money transaction in a binary format.

func (*TransferXArgs) SetRecipient added in v0.15.0

func (t *TransferXArgs) SetRecipient(v []byte)

SetRecipient sets wallet script hash of the recipient of funds in a binary format.

func (*TransferXArgs) SetSender added in v0.15.0

func (t *TransferXArgs) SetSender(v []byte)

SetSender sets wallet script hash of the sender of funds in a binary format.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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