workflows

package
v1.3.8 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2023 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidAvailableBalanceValue = errors.New("invalid available balance value")

ErrInvalidAvailableBalanceValue signals that an invalid available balance value was provided

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

ErrInvalidTransactionValue signals that an invalid transaction value was provided

View Source
var ErrNilLastProcessedNonceHandler = errors.New("nil last processed nonce handler")

ErrNilLastProcessedNonceHandler signals that a nil last processed nonce handler was provided

View Source
var ErrNilMinimumBalance = errors.New("nil minimum balance")

ErrNilMinimumBalance signals that a nil minimum balance was provided

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

ErrNilProxy signals that a nil proxy has been provided

View Source
var ErrNilTrackableAddressesProvider = errors.New("nil trackable address provider")

ErrNilTrackableAddressesProvider signals that a nil trackable address provider was used

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

ErrNilTransactionInteractor signals that a nil transaction interactor was provided

Functions

func NewMoveBalanceHandler

func NewMoveBalanceHandler(args MoveBalanceHandlerArgs) (*moveBalanceHandler, error)

NewMoveBalanceHandler creates a new instance of the moveBalanceHandler struct

func NewWalletTracker

func NewWalletTracker(args WalletTrackerArgs) (*walletTracker, error)

NewWalletTracker will create a new walletTracker instance. It automatically starts an inner processLoop go routine that can be stopped by calling the Close method

Types

type LastProcessedNonceHandler

type LastProcessedNonceHandler interface {
	ProcessedNonce(nonce uint64)
	GetLastProcessedNonce() uint64
	IsInterfaceNil() bool
}

LastProcessedNonceHandler will keep track of the last processed hyper block nonce. fraction of hyper blocks sets after an application restart

type MoveBalanceHandlerArgs

type MoveBalanceHandlerArgs struct {
	Proxy                      ProxyHandler
	TxInteractor               TransactionInteractor
	ReceiverAddress            string
	TrackableAddressesProvider TrackableAddressesProvider
	MinimumBalance             *big.Int
}

MoveBalanceHandlerArgs is the argument DTO for the NewMoveBalanceHandler constructor function

type ProxyHandler

type ProxyHandler interface {
	GetLatestHyperBlockNonce(ctx context.Context) (uint64, error)
	GetHyperBlockByNonce(ctx context.Context, nonce uint64) (*data.HyperBlock, error)
	GetDefaultTransactionArguments(ctx context.Context, address sdkCore.AddressHandler, networkConfigs *data.NetworkConfig) (transaction.FrontendTransaction, string, error)
	GetNetworkConfig(ctx context.Context) (*data.NetworkConfig, error)
	IsInterfaceNil() bool
}

ProxyHandler defines the behavior of a proxy handler that can process requests

type TrackableAddressesProvider

type TrackableAddressesProvider interface {
	IsTrackableAddresses(addressAsBech32 string) bool
	PrivateKeyOfBech32Address(addressAsBech32 string) []byte
	IsInterfaceNil() bool
}

TrackableAddressesProvider defines the behavior for a component that can determine if one address is tracked or not

type TransactionInteractor

type TransactionInteractor interface {
	AddTransaction(tx *transaction.FrontendTransaction)
	ApplySignature(cryptoHolder sdkCore.CryptoComponentsHolder, tx *transaction.FrontendTransaction) error
	IsInterfaceNil() bool
}

TransactionInteractor defines the transaction interactor behavior used in workflows

type WalletTrackerArgs

type WalletTrackerArgs struct {
	TrackableAddressesProvider TrackableAddressesProvider
	Proxy                      ProxyHandler
	NonceHandler               LastProcessedNonceHandler
	CheckInterval              time.Duration
	MinimumBalance             *big.Int
}

WalletTrackerArgs is the argument DTO for the NewWalletTracker constructor function

Jump to

Keyboard shortcuts

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