commonclient

package
v0.21.1 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2024 License: GPL-3.0 Imports: 18 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrTransactionTooLarge = errors.New("transaction/script size limit exceeded")

Functions

func ReadIteratorItems

func ReadIteratorItems(inv Invoker, batchSize int, contract util.Uint160, method string, params ...any) ([]stackitem.Item, error)

ReadIteratorItems calls method that returns iterator and traverses the iterator until all items are read into array.

Types

type Invoker

type Invoker interface {
	Run([]byte) (*result.Invoke, error)
	Call(contract util.Uint160, method string, params ...any) (*result.Invoke, error)
	TraverseIterator(sessionID uuid.UUID, iterator *result.Iterator, num int) ([]stackitem.Item, error)
	TerminateSession(sessionID uuid.UUID) error
}

Invoker is a subset of methods provided by struct invoker.Invoker. The subset contains only those methods that are used by ActorWrapper and clients of the contracts.

type Transaction

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

Transaction allows to invoke several contract method at once.

func NewTransaction

func NewTransaction(contractHash util.Uint160) *Transaction

NewTransaction creates new transaction to accumulate contract invocations.

func (Transaction) Bytes

func (t Transaction) Bytes() ([]byte, error)

Bytes returns the resulting buffer and makes future writes return an error.

func (Transaction) WrapCall

func (t Transaction) WrapCall(method string, args []any) error

WrapCall accept methods and arguments to invoke. Should be used with method on clients like Client.MethodNameCall.

func (Transaction) WrapCallErr

func (t Transaction) WrapCallErr(method string, args []any, err error) error

WrapCallErr accept methods, arguments and error to handle and invoke. Should be used with method on clients like *CallErr.

type Waiter added in v0.21.0

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

Waiter is a decorator on top of the standard waiter.Waiter. It provides additional behavior (controlled by WaiterOptions) on top of the standard functionality of awaiting transactions.

func NewWaiter added in v0.21.0

func NewWaiter(waiter waiter.Waiter, options WaiterOptions) *Waiter

NewWaiter decorates the specified waiter in a new Waiter instance.

func (*Waiter) Wait added in v0.21.0

func (w *Waiter) Wait(h util.Uint256, vub uint32, err error) (*state.AppExecResult, error)

Wait allows to wait until transaction will be accepted to the chain.

func (*Waiter) WaitAny added in v0.21.0

func (w *Waiter) WaitAny(ctx context.Context, vub uint32, hashes ...util.Uint256) (*state.AppExecResult, error)

WaitAny waits until at least one of the specified transactions will be accepted to the chain.

type WaiterOptions added in v0.21.0

type WaiterOptions struct {
	// IgnoreAlreadyExistsError controls behavior for "already exists" error:
	// - If set to true, it indicates that "already exists" error is not a problem, we should
	//   wait for transaction as usual (this is the behavior of neo-go [waiter.PollingBased]).
	// - If set to false, it indicates that "already exists" should be reported as an error.
	IgnoreAlreadyExistsError bool

	// VerifyExecResults controls whether waiter should ensure that transaction successfully
	// enters blockchain block.
	VerifyExecResults bool
}

Jump to

Keyboard shortcuts

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