interactors

package
v1.3.11 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2023 License: GPL-3.0 Imports: 27 Imported by: 7

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 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 ErrTxWithSameNonceAndGasPriceAlreadySent = errors.New("transaction with the same nonce & gas price was already sent")

ErrTxWithSameNonceAndGasPriceAlreadySent signals that a transaction with the same nonce & gas price 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 GuardedTxBuilder) (*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, tx *transaction.FrontendTransaction) error
	ReSendTransactionsIfRequired(ctx context.Context) error
	SendTransaction(ctx context.Context, tx *transaction.FrontendTransaction) (string, error)
	DropTransactions()
	IsInterfaceNil() bool
}

AddressNonceHandler defines the component able to handler address nonces

type GuardedTxBuilder added in v1.3.3

type GuardedTxBuilder interface {
	ApplyUserSignature(cryptoHolder core.CryptoComponentsHolder, tx *transaction.FrontendTransaction) error
	ApplyGuardianSignature(cryptoHolderGuardian core.CryptoComponentsHolder, tx *transaction.FrontendTransaction) error
	IsInterfaceNil() bool
}

GuardedTxBuilder defines the component able to build and sign a guarded transaction

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 *transaction.FrontendTransaction) (string, error)
	SendTransactions(ctx context.Context, txs []*transaction.FrontendTransaction) ([]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 *transaction.FrontendTransaction) (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, tx *transaction.FrontendTransaction) error
	SendTransaction(ctx context.Context, tx *transaction.FrontendTransaction) (string, error)
	Close() error
	IsInterfaceNil() bool
}

TransactionNonceHandlerV2 defines the component able to apply nonce for a given frontend transaction

type TxBuilder

type TxBuilder interface {
	ApplyUserSignature(cryptoHolder core.CryptoComponentsHolder, tx *transaction.FrontendTransaction) 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