types

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2024 License: AGPL-3.0, AGPL-3.0-or-later Imports: 5 Imported by: 2

Documentation

Index

Constants

View Source
const (
	// MonitoredTxStatusCreated mean the tx was just added to the storage
	MonitoredTxStatusCreated = MonitoredTxStatus("created")

	// MonitoredTxStatusFailed means the tx was already mined and failed with an
	// error that can't be recovered automatically, ex: the data in the tx is invalid
	// and the tx gets reverted
	MonitoredTxStatusFailed = MonitoredTxStatus("failed")

	// MonitoredTxStatusConfirmed means the tx was already mined and the receipt
	// status is Successful
	MonitoredTxStatusConfirmed = MonitoredTxStatus("confirmed")
)

Variables

View Source
var (
	// ErrAlreadyExists when the object already exists
	ErrAlreadyExists = errors.New("already exists")
)

Functions

This section is empty.

Types

type MonitoredTx

type MonitoredTx struct {
	// DepositID is the tx identifier controller by the caller
	DepositID uint

	// From is a sender of the tx, used to identify which private key should be used to sing the tx
	From common.Address

	// To is a receiver of the tx
	To *common.Address

	// Nonce used to create the tx
	Nonce uint64

	// Value is a tx value
	Value *big.Int

	// Data is a tx data
	Data []byte

	// Gas is a tx gas
	Gas uint64

	// GasPrice is the tx gas price
	GasPrice *big.Int

	// Status of this monitoring
	Status MonitoredTxStatus

	// History represent all transaction hashes from
	// transactions created using this struct data and
	// sent to the network
	History map[common.Hash]bool

	// CreatedAt date time it was created
	CreatedAt time.Time

	// UpdatedAt last date time it was updated
	UpdatedAt time.Time
}

MonitoredTx represents a set of information used to build tx plus information to monitor if the transactions was sent successfully

func (MonitoredTx) AddHistory

func (mTx MonitoredTx) AddHistory(tx *types.Transaction) error

AddHistory adds a transaction to the monitoring history

func (*MonitoredTx) HistoryHashSlice

func (mTx *MonitoredTx) HistoryHashSlice() [][]byte

HistoryHashSlice returns the current history field as a string slice

func (MonitoredTx) RemoveHistory

func (mTx MonitoredTx) RemoveHistory(tx *types.Transaction)

RemoveHistory removes a transaction from the monitoring history

func (MonitoredTx) Tx

func (mTx MonitoredTx) Tx() *types.Transaction

Tx uses the current information to build a tx

type MonitoredTxStatus

type MonitoredTxStatus string

MonitoredTxStatus represents the status of a monitored tx

func (MonitoredTxStatus) String

func (s MonitoredTxStatus) String() string

String returns a string representation of the status

Jump to

Keyboard shortcuts

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