interactors

package
v1.2.3 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2023 License: GPL-3.0 Imports: 27 Imported by: 10

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrDifferentAccountRecovered = errors.New("different account recovered")

ErrDifferentAccountRecovered signals that a different account was recovered

View Source
var ErrGapNonce = errors.New("gap nonce detected")

ErrGapNonce signals that a gap nonce between the lowest nonce of the transactions from the cache and the blockchain nonce has been detected

View Source
var ErrInvalidPemFile = errors.New("invalid .PEM file")

ErrInvalidPemFile signals that an invalid pem file was provided

View Source
var ErrInvalidValue = errors.New("invalid value")

ErrInvalidValue signals that an invalid value was provided

View Source
var ErrNilAddress = errors.New("nil address")

ErrNilAddress signals that the provided address is nil

View Source
var ErrNilAddressNonceHandlerCreator = errors.New("nil AddressNonceHandlerCreator")

ErrNilAddressNonceHandlerCreator signals that a nil AddressNonceHandlerCreator was provided

View Source
var ErrNilArgCreateTransaction = errors.New("nil ArgCreateTransaction")

ErrNilArgCreateTransaction signals that the provided ArgCreateTransaction is nil

View Source
var ErrNilProxy = errors.New("nil proxy")

ErrNilProxy signals that a nil proxy was provided

View Source
var ErrNilTransaction = errors.New("nil transaction")

ErrNilTransaction signals that provided transaction is nil

View Source
var ErrNilTxBuilder = errors.New("nil tx builder")

ErrNilTxBuilder signals that a nil transaction builder was provided

View Source
var ErrTxAlreadySent = errors.New("transaction already sent")

ErrTxAlreadySent signals that a transaction was already sent

View Source
var ErrWrongPassword = errors.New("wrong password")

ErrWrongPassword signals that a wrong password was provided

Functions

func NewTransactionInteractor

func NewTransactionInteractor(proxy Proxy, txBuilder TxBuilder) (*transactionInteractor, error)

NewTransactionInteractor will create an interactor that extends the proxy functionality with some transaction-oriented functionality

func NewWallet

func NewWallet() *wallet

NewWallet creates a new wallet instance

Types

type AddressNonceHandler

type AddressNonceHandler interface {
	ApplyNonceAndGasPrice(ctx context.Context, txArgs *data.ArgCreateTransaction) error
	ReSendTransactionsIfRequired(ctx context.Context) error
	SendTransaction(ctx context.Context, tx *data.Transaction) (string, error)
	DropTransactions()
	IsInterfaceNil() bool
}

AddressNonceHandler defines the component able to handler address nonces

type AddressNonceHandlerCreator

type AddressNonceHandlerCreator interface {
	Create(proxy Proxy, address core.AddressHandler) (AddressNonceHandler, error)
	IsInterfaceNil() bool
}

AddressNonceHandlerCreator defines the component able to create AddressNonceHandler instances

type Proxy

type Proxy interface {
	GetNetworkConfig(ctx context.Context) (*data.NetworkConfig, error)
	GetAccount(ctx context.Context, address core.AddressHandler) (*data.Account, error)
	SendTransaction(ctx context.Context, tx *data.Transaction) (string, error)
	SendTransactions(ctx context.Context, txs []*data.Transaction) ([]string, error)
	IsInterfaceNil() bool
}

Proxy holds the primitive functions that the multiversx proxy engine supports & implements dependency inversion: blockchain package is considered inner business logic, this package is considered "plugin"

type TransactionNonceHandlerV1

type TransactionNonceHandlerV1 interface {
	GetNonce(ctx context.Context, address core.AddressHandler) (uint64, error)
	SendTransaction(ctx context.Context, tx *data.Transaction) (string, error)
	ForceNonceReFetch(address core.AddressHandler) error
	Close() error
	IsInterfaceNil() bool
}

TransactionNonceHandlerV1 defines the component able to manage transaction nonces

type TransactionNonceHandlerV2

type TransactionNonceHandlerV2 interface {
	ApplyNonceAndGasPrice(ctx context.Context, address core.AddressHandler, txArgs *data.ArgCreateTransaction) error
	SendTransaction(ctx context.Context, tx *data.Transaction) (string, error)
	Close() error
	IsInterfaceNil() bool
}

TransactionNonceHandlerV2 defines the component able to apply nonce for a given ArgCreateTransaction

type TxBuilder

type TxBuilder interface {
	ApplySignatureAndGenerateTx(cryptoHolder core.CryptoComponentsHolder, arg data.ArgCreateTransaction) (*data.Transaction, error)
	IsInterfaceNil() bool
}

TxBuilder defines the component able to build & sign a transaction

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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