txmanager

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: AGPL-3.0, AGPL-3.0-or-later Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client for eth tx manager

func New

New creates new eth tx manager

func (*Client) Add

func (c *Client) Add(ctx context.Context, owner, id string, from common.Address, to *common.Address, value *big.Int, data []byte, gasOffset uint64, dbTx pgx.Tx) error

Add a transaction to be sent and monitored

func (*Client) Result

func (c *Client) Result(ctx context.Context, owner, id string, dbTx pgx.Tx) (txmTypes.MonitoredTxResult, error)

Result returns the current result of the transaction execution with all the details

func (*Client) Start

func (c *Client) Start()

Start will start the tx management, reading txs from storage, send then to the blockchain and keep monitoring them until they get mined

func (*Client) Stop

func (c *Client) Stop()

Stop will stops the monitored tx management

type PostgresStorage

type PostgresStorage struct {
	*pgxpool.Pool
}

PostgresStorage hold txs to be managed

func NewPostgresStorage

func NewPostgresStorage(dbCfg db.Config) (*PostgresStorage, error)

NewPostgresStorage creates a new instance of storage that use postgres to store data

func (*PostgresStorage) Add

func (s *PostgresStorage) Add(ctx context.Context, mTx txmTypes.MonitoredTx, dbTx pgx.Tx) error

Add persist a monitored tx

func (*PostgresStorage) Get

func (s *PostgresStorage) Get(ctx context.Context, owner, id string, dbTx pgx.Tx) (txmTypes.MonitoredTx, error)

Get loads a persisted monitored tx

func (*PostgresStorage) GetBySenderAndStatus

func (s *PostgresStorage) GetBySenderAndStatus(
	ctx context.Context, sender common.Address,
	statuses []txmTypes.MonitoredTxStatus, dbTx pgx.Tx) ([]txmTypes.MonitoredTx, error)

GetBySenderAndStatus loads all monitored txs of the given sender that match the provided status

func (*PostgresStorage) GetByStatus

func (s *PostgresStorage) GetByStatus(ctx context.Context, owner *string, statuses []txmTypes.MonitoredTxStatus, dbTx pgx.Tx) ([]txmTypes.MonitoredTx, error)

GetByStatus loads all monitored tx that match the provided status

func (*PostgresStorage) Update

func (s *PostgresStorage) Update(ctx context.Context, mTx txmTypes.MonitoredTx, dbTx pgx.Tx) error

Update a persisted monitored tx

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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