balance

package
v0.21.0-rc.3 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2024 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

Package balance contains RPC wrappers for Balance contract.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Actor

type Actor interface {
	Invoker

	nep17.Actor

	MakeCall(contract util.Uint160, method string, params ...any) (*transaction.Transaction, error)
	MakeRun(script []byte) (*transaction.Transaction, error)
	MakeUnsignedCall(contract util.Uint160, method string, attrs []transaction.Attribute, params ...any) (*transaction.Transaction, error)
	MakeUnsignedRun(script []byte, attrs []transaction.Attribute) (*transaction.Transaction, error)
	SendCall(contract util.Uint160, method string, params ...any) (util.Uint256, uint32, error)
	SendRun(script []byte) (util.Uint256, uint32, error)
}

Actor is used by Contract to call state-changing methods.

type BurnEvent

type BurnEvent struct {
	From   util.Uint160
	Amount *big.Int
}

BurnEvent represents "Burn" event emitted by the contract.

func BurnEventsFromApplicationLog

func BurnEventsFromApplicationLog(log *result.ApplicationLog) ([]*BurnEvent, error)

BurnEventsFromApplicationLog retrieves a set of all emitted events with "Burn" name from the provided result.ApplicationLog.

func (*BurnEvent) FromStackItem

func (e *BurnEvent) FromStackItem(item *stackitem.Array) error

FromStackItem converts provided stackitem.Array to BurnEvent or returns an error if it's not possible to do to so.

type Contract

type Contract struct {
	ContractReader
	nep17.TokenWriter
	// contains filtered or unexported fields
}

Contract implements all contract methods.

func New

func New(actor Actor, hash util.Uint160) *Contract

New creates an instance of Contract using provided contract hash and the given Actor.

func (*Contract) Burn

func (c *Contract) Burn(from util.Uint160, amount *big.Int, txDetails []byte) (util.Uint256, uint32, error)

Burn creates a transaction invoking `burn` method of the contract. This transaction is signed and immediately sent to the network. The values returned are its hash, ValidUntilBlock value and error if any.

func (*Contract) BurnTransaction

func (c *Contract) BurnTransaction(from util.Uint160, amount *big.Int, txDetails []byte) (*transaction.Transaction, error)

BurnTransaction creates a transaction invoking `burn` method of the contract. This transaction is signed, but not sent to the network, instead it's returned to the caller.

func (*Contract) BurnUnsigned

func (c *Contract) BurnUnsigned(from util.Uint160, amount *big.Int, txDetails []byte) (*transaction.Transaction, error)

BurnUnsigned creates a transaction invoking `burn` method of the contract. This transaction is not signed, it's simply returned to the caller. Any fields of it that do not affect fees can be changed (ValidUntilBlock, Nonce), fee values (NetworkFee, SystemFee) can be increased as well.

func (*Contract) Lock

func (c *Contract) Lock(txDetails []byte, from util.Uint160, to util.Uint160, amount *big.Int, until *big.Int) (util.Uint256, uint32, error)

Lock creates a transaction invoking `lock` method of the contract. This transaction is signed and immediately sent to the network. The values returned are its hash, ValidUntilBlock value and error if any.

func (*Contract) LockTransaction

func (c *Contract) LockTransaction(txDetails []byte, from util.Uint160, to util.Uint160, amount *big.Int, until *big.Int) (*transaction.Transaction, error)

LockTransaction creates a transaction invoking `lock` method of the contract. This transaction is signed, but not sent to the network, instead it's returned to the caller.

func (*Contract) LockUnsigned

func (c *Contract) LockUnsigned(txDetails []byte, from util.Uint160, to util.Uint160, amount *big.Int, until *big.Int) (*transaction.Transaction, error)

LockUnsigned creates a transaction invoking `lock` method of the contract. This transaction is not signed, it's simply returned to the caller. Any fields of it that do not affect fees can be changed (ValidUntilBlock, Nonce), fee values (NetworkFee, SystemFee) can be increased as well.

func (*Contract) Mint

func (c *Contract) Mint(to util.Uint160, amount *big.Int, txDetails []byte) (util.Uint256, uint32, error)

Mint creates a transaction invoking `mint` method of the contract. This transaction is signed and immediately sent to the network. The values returned are its hash, ValidUntilBlock value and error if any.

func (*Contract) MintTransaction

func (c *Contract) MintTransaction(to util.Uint160, amount *big.Int, txDetails []byte) (*transaction.Transaction, error)

MintTransaction creates a transaction invoking `mint` method of the contract. This transaction is signed, but not sent to the network, instead it's returned to the caller.

func (*Contract) MintUnsigned

func (c *Contract) MintUnsigned(to util.Uint160, amount *big.Int, txDetails []byte) (*transaction.Transaction, error)

MintUnsigned creates a transaction invoking `mint` method of the contract. This transaction is not signed, it's simply returned to the caller. Any fields of it that do not affect fees can be changed (ValidUntilBlock, Nonce), fee values (NetworkFee, SystemFee) can be increased as well.

func (*Contract) NewEpoch

func (c *Contract) NewEpoch(epochNum *big.Int) (util.Uint256, uint32, error)

NewEpoch creates a transaction invoking `newEpoch` method of the contract. This transaction is signed and immediately sent to the network. The values returned are its hash, ValidUntilBlock value and error if any.

func (*Contract) NewEpochTransaction

func (c *Contract) NewEpochTransaction(epochNum *big.Int) (*transaction.Transaction, error)

NewEpochTransaction creates a transaction invoking `newEpoch` method of the contract. This transaction is signed, but not sent to the network, instead it's returned to the caller.

func (*Contract) NewEpochUnsigned

func (c *Contract) NewEpochUnsigned(epochNum *big.Int) (*transaction.Transaction, error)

NewEpochUnsigned creates a transaction invoking `newEpoch` method of the contract. This transaction is not signed, it's simply returned to the caller. Any fields of it that do not affect fees can be changed (ValidUntilBlock, Nonce), fee values (NetworkFee, SystemFee) can be increased as well.

func (*Contract) TransferX

func (c *Contract) TransferX(from util.Uint160, to util.Uint160, amount *big.Int, details []byte) (util.Uint256, uint32, error)

TransferX creates a transaction invoking `transferX` method of the contract. This transaction is signed and immediately sent to the network. The values returned are its hash, ValidUntilBlock value and error if any.

func (*Contract) TransferXTransaction

func (c *Contract) TransferXTransaction(from util.Uint160, to util.Uint160, amount *big.Int, details []byte) (*transaction.Transaction, error)

TransferXTransaction creates a transaction invoking `transferX` method of the contract. This transaction is signed, but not sent to the network, instead it's returned to the caller.

func (*Contract) TransferXUnsigned

func (c *Contract) TransferXUnsigned(from util.Uint160, to util.Uint160, amount *big.Int, details []byte) (*transaction.Transaction, error)

TransferXUnsigned creates a transaction invoking `transferX` method of the contract. This transaction is not signed, it's simply returned to the caller. Any fields of it that do not affect fees can be changed (ValidUntilBlock, Nonce), fee values (NetworkFee, SystemFee) can be increased as well.

func (*Contract) Update

func (c *Contract) Update(script []byte, manifest []byte, data any) (util.Uint256, uint32, error)

Update creates a transaction invoking `update` method of the contract. This transaction is signed and immediately sent to the network. The values returned are its hash, ValidUntilBlock value and error if any.

func (*Contract) UpdateTransaction

func (c *Contract) UpdateTransaction(script []byte, manifest []byte, data any) (*transaction.Transaction, error)

UpdateTransaction creates a transaction invoking `update` method of the contract. This transaction is signed, but not sent to the network, instead it's returned to the caller.

func (*Contract) UpdateUnsigned

func (c *Contract) UpdateUnsigned(script []byte, manifest []byte, data any) (*transaction.Transaction, error)

UpdateUnsigned creates a transaction invoking `update` method of the contract. This transaction is not signed, it's simply returned to the caller. Any fields of it that do not affect fees can be changed (ValidUntilBlock, Nonce), fee values (NetworkFee, SystemFee) can be increased as well.

type ContractReader

type ContractReader struct {
	nep17.TokenReader
	// contains filtered or unexported fields
}

ContractReader implements safe contract methods.

func NewReader

func NewReader(invoker Invoker, hash util.Uint160) *ContractReader

NewReader creates an instance of ContractReader using provided contract hash and the given Invoker.

func (*ContractReader) Version

func (c *ContractReader) Version() (*big.Int, error)

Version invokes `version` method of contract.

type Invoker

type Invoker interface {
	nep17.Invoker
}

Invoker is used by ContractReader to call various safe methods.

type LockEvent

type LockEvent struct {
	TxID   []byte
	From   util.Uint160
	To     util.Uint160
	Amount *big.Int
	Until  *big.Int
}

LockEvent represents "Lock" event emitted by the contract.

func LockEventsFromApplicationLog

func LockEventsFromApplicationLog(log *result.ApplicationLog) ([]*LockEvent, error)

LockEventsFromApplicationLog retrieves a set of all emitted events with "Lock" name from the provided result.ApplicationLog.

func (*LockEvent) FromStackItem

func (e *LockEvent) FromStackItem(item *stackitem.Array) error

FromStackItem converts provided stackitem.Array to LockEvent or returns an error if it's not possible to do to so.

type MintEvent

type MintEvent struct {
	To     util.Uint160
	Amount *big.Int
}

MintEvent represents "Mint" event emitted by the contract.

func MintEventsFromApplicationLog

func MintEventsFromApplicationLog(log *result.ApplicationLog) ([]*MintEvent, error)

MintEventsFromApplicationLog retrieves a set of all emitted events with "Mint" name from the provided result.ApplicationLog.

func (*MintEvent) FromStackItem

func (e *MintEvent) FromStackItem(item *stackitem.Array) error

FromStackItem converts provided stackitem.Array to MintEvent or returns an error if it's not possible to do to so.

type TransferXEvent

type TransferXEvent struct {
	From    util.Uint160
	To      util.Uint160
	Amount  *big.Int
	Details []byte
}

TransferXEvent represents "TransferX" event emitted by the contract.

func TransferXEventsFromApplicationLog

func TransferXEventsFromApplicationLog(log *result.ApplicationLog) ([]*TransferXEvent, error)

TransferXEventsFromApplicationLog retrieves a set of all emitted events with "TransferX" name from the provided result.ApplicationLog.

func (*TransferXEvent) FromStackItem

func (e *TransferXEvent) FromStackItem(item *stackitem.Array) error

FromStackItem converts provided stackitem.Array to TransferXEvent or returns an error if it's not possible to do to so.

Jump to

Keyboard shortcuts

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