balance

package
v0.27.0 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 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 BurnPrm added in v0.27.0

type BurnPrm struct {
	client.InvokePrmOptional
	// contains filtered or unexported fields
}

BurnPrm groups parameters of Burn operation.

func (*BurnPrm) SetAmount added in v0.27.0

func (b *BurnPrm) SetAmount(amount int64)

SetAmount sets amount.

func (*BurnPrm) SetID added in v0.27.0

func (b *BurnPrm) SetID(id []byte)

SetID sets ID.

func (*BurnPrm) SetTo added in v0.27.0

func (b *BurnPrm) SetTo(to []byte)

SetTo sets receiver.

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(args BurnPrm) 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(args LockPrm) error

Lock invokes `lock` method of the balance contract.

func (*Client) Mint added in v0.22.0

func (c *Client) Mint(args MintPrm) 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 LockPrm added in v0.27.0

type LockPrm struct {
	client.InvokePrmOptional
	// contains filtered or unexported fields
}

LockPrm groups parameters of Lock operation.

func (*LockPrm) SetAmount added in v0.27.0

func (l *LockPrm) SetAmount(amount int64)

SetAmount sets amount.

func (*LockPrm) SetDueEpoch added in v0.27.0

func (l *LockPrm) SetDueEpoch(dueEpoch int64)

SetDueEpoch sets end of the lock.

func (*LockPrm) SetID added in v0.27.0

func (l *LockPrm) SetID(id []byte)

SetID sets ID.

func (*LockPrm) SetLock added in v0.27.0

func (l *LockPrm) SetLock(lock []byte)

SetLock sets lock.

func (*LockPrm) SetUser added in v0.27.0

func (l *LockPrm) SetUser(user []byte)

SetUser set user.

type MintPrm added in v0.27.0

type MintPrm struct {
	client.InvokePrmOptional
	// contains filtered or unexported fields
}

MintPrm groups parameters of Mint operation.

func (*MintPrm) SetAmount added in v0.27.0

func (m *MintPrm) SetAmount(amount int64)

SetAmount sets amount of the transfer.

func (*MintPrm) SetID added in v0.27.0

func (m *MintPrm) SetID(id []byte)

SetID sets ID.

func (*MintPrm) SetTo added in v0.27.0

func (m *MintPrm) SetTo(to []byte)

SetTo sets receiver of the transfer.

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 {
	client.InvokePrmOptional
	// 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