frostfs

package
v0.19.2 Latest Latest
Warning

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

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

Documentation

Overview

Package frostfs contains RPC wrappers for FrostFS contract.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Actor

type Actor interface {
	Invoker

	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 AlphabetUpdateEvent

type AlphabetUpdateEvent struct {
	Id       []byte
	Alphabet []any
}

AlphabetUpdateEvent represents "AlphabetUpdate" event emitted by the contract.

func AlphabetUpdateEventsFromApplicationLog

func AlphabetUpdateEventsFromApplicationLog(log *result.ApplicationLog) ([]*AlphabetUpdateEvent, error)

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

func (*AlphabetUpdateEvent) FromStackItem

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

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

type BindEvent

type BindEvent struct {
	User []byte
	Keys []any
}

BindEvent represents "Bind" event emitted by the contract.

func BindEventsFromApplicationLog

func BindEventsFromApplicationLog(log *result.ApplicationLog) ([]*BindEvent, error)

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

func (*BindEvent) FromStackItem

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

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

type ChequeEvent

type ChequeEvent struct {
	Id          []byte
	User        util.Uint160
	Amount      *big.Int
	LockAccount []byte
}

ChequeEvent represents "Cheque" event emitted by the contract.

func ChequeEventsFromApplicationLog

func ChequeEventsFromApplicationLog(log *result.ApplicationLog) ([]*ChequeEvent, error)

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

func (*ChequeEvent) FromStackItem

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

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

type Contract

type Contract struct {
	ContractReader
	// 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) Bind

func (c *Contract) Bind(user []byte, keys []any) (util.Uint256, uint32, error)

Bind creates a transaction invoking `bind` 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) BindTransaction

func (c *Contract) BindTransaction(user []byte, keys []any) (*transaction.Transaction, error)

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

func (*Contract) BindUnsigned

func (c *Contract) BindUnsigned(user []byte, keys []any) (*transaction.Transaction, error)

BindUnsigned creates a transaction invoking `bind` 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) Cheque

func (c *Contract) Cheque(id []byte, user util.Uint160, amount *big.Int, lockAcc []byte) (util.Uint256, uint32, error)

Cheque creates a transaction invoking `cheque` 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) ChequeTransaction

func (c *Contract) ChequeTransaction(id []byte, user util.Uint160, amount *big.Int, lockAcc []byte) (*transaction.Transaction, error)

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

func (*Contract) ChequeUnsigned

func (c *Contract) ChequeUnsigned(id []byte, user util.Uint160, amount *big.Int, lockAcc []byte) (*transaction.Transaction, error)

ChequeUnsigned creates a transaction invoking `cheque` 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) InnerRingCandidateAdd

func (c *Contract) InnerRingCandidateAdd(key *keys.PublicKey) (util.Uint256, uint32, error)

InnerRingCandidateAdd creates a transaction invoking `innerRingCandidateAdd` 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) InnerRingCandidateAddTransaction

func (c *Contract) InnerRingCandidateAddTransaction(key *keys.PublicKey) (*transaction.Transaction, error)

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

func (*Contract) InnerRingCandidateAddUnsigned

func (c *Contract) InnerRingCandidateAddUnsigned(key *keys.PublicKey) (*transaction.Transaction, error)

InnerRingCandidateAddUnsigned creates a transaction invoking `innerRingCandidateAdd` 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) InnerRingCandidateRemove

func (c *Contract) InnerRingCandidateRemove(key *keys.PublicKey) (util.Uint256, uint32, error)

InnerRingCandidateRemove creates a transaction invoking `innerRingCandidateRemove` 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) InnerRingCandidateRemoveTransaction

func (c *Contract) InnerRingCandidateRemoveTransaction(key *keys.PublicKey) (*transaction.Transaction, error)

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

func (*Contract) InnerRingCandidateRemoveUnsigned

func (c *Contract) InnerRingCandidateRemoveUnsigned(key *keys.PublicKey) (*transaction.Transaction, error)

InnerRingCandidateRemoveUnsigned creates a transaction invoking `innerRingCandidateRemove` 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) SetConfig

func (c *Contract) SetConfig(id []byte, key []byte, val []byte) (util.Uint256, uint32, error)

SetConfig creates a transaction invoking `setConfig` 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) SetConfigTransaction

func (c *Contract) SetConfigTransaction(id []byte, key []byte, val []byte) (*transaction.Transaction, error)

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

func (*Contract) SetConfigUnsigned

func (c *Contract) SetConfigUnsigned(id []byte, key []byte, val []byte) (*transaction.Transaction, error)

SetConfigUnsigned creates a transaction invoking `setConfig` 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) Unbind

func (c *Contract) Unbind(user []byte, keys []any) (util.Uint256, uint32, error)

Unbind creates a transaction invoking `unbind` 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) UnbindTransaction

func (c *Contract) UnbindTransaction(user []byte, keys []any) (*transaction.Transaction, error)

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

func (*Contract) UnbindUnsigned

func (c *Contract) UnbindUnsigned(user []byte, keys []any) (*transaction.Transaction, error)

UnbindUnsigned creates a transaction invoking `unbind` 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.

func (*Contract) Withdraw

func (c *Contract) Withdraw(user util.Uint160, amount *big.Int) (util.Uint256, uint32, error)

Withdraw creates a transaction invoking `withdraw` 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) WithdrawTransaction

func (c *Contract) WithdrawTransaction(user util.Uint160, amount *big.Int) (*transaction.Transaction, error)

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

func (*Contract) WithdrawUnsigned

func (c *Contract) WithdrawUnsigned(user util.Uint160, amount *big.Int) (*transaction.Transaction, error)

WithdrawUnsigned creates a transaction invoking `withdraw` 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 {
	// 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) Config

func (c *ContractReader) Config(key []byte) (any, error)

Config invokes `config` method of contract.

func (*ContractReader) InnerRingCandidates

func (c *ContractReader) InnerRingCandidates() ([]stackitem.Item, error)

InnerRingCandidates invokes `innerRingCandidates` method of contract.

func (*ContractReader) ListConfig

func (c *ContractReader) ListConfig() ([]stackitem.Item, error)

ListConfig invokes `listConfig` method of contract.

func (*ContractReader) Version

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

Version invokes `version` method of contract.

type DepositEvent

type DepositEvent struct {
	From     util.Uint160
	Amount   *big.Int
	Receiver util.Uint160
	TxHash   util.Uint256
}

DepositEvent represents "Deposit" event emitted by the contract.

func DepositEventsFromApplicationLog

func DepositEventsFromApplicationLog(log *result.ApplicationLog) ([]*DepositEvent, error)

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

func (*DepositEvent) FromStackItem

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

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

type Invoker

type Invoker interface {
	Call(contract util.Uint160, operation string, params ...any) (*result.Invoke, error)
}

Invoker is used by ContractReader to call various safe methods.

type SetConfigEvent

type SetConfigEvent struct {
	Id    []byte
	Key   []byte
	Value []byte
}

SetConfigEvent represents "SetConfig" event emitted by the contract.

func SetConfigEventsFromApplicationLog

func SetConfigEventsFromApplicationLog(log *result.ApplicationLog) ([]*SetConfigEvent, error)

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

func (*SetConfigEvent) FromStackItem

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

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

type UnbindEvent

type UnbindEvent struct {
	User []byte
	Keys []any
}

UnbindEvent represents "Unbind" event emitted by the contract.

func UnbindEventsFromApplicationLog

func UnbindEventsFromApplicationLog(log *result.ApplicationLog) ([]*UnbindEvent, error)

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

func (*UnbindEvent) FromStackItem

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

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

type WithdrawEvent

type WithdrawEvent struct {
	User   util.Uint160
	Amount *big.Int
	TxHash util.Uint256
}

WithdrawEvent represents "Withdraw" event emitted by the contract.

func WithdrawEventsFromApplicationLog

func WithdrawEventsFromApplicationLog(log *result.ApplicationLog) ([]*WithdrawEvent, error)

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

func (*WithdrawEvent) FromStackItem

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

FromStackItem converts provided stackitem.Array to WithdrawEvent 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