Versions in this module Expand all Collapse all v0 v0.0.1 Apr 5, 2022 Changes in this version + const DEFAULT_CONFIEMATION_BLOCKS + const DEFAULT_CONFIEMATION_INTERVAL + const DEFAULT_TIMEOUT + const DEFAULT_WORKER_INTERVAL + var DEFAULT_WORKERS = runtime.NumCPU() - 2 + var ErrBeforeConfirmationInterval = errors.New("before confirmation interval") + var ErrQueueIsEmpty = errors.New("queue is empty") + var ErrTxConfirmPending = errors.New("tx confirm pending") + var ErrTxFailed = errors.New("tx failed") + var ErrTxNotFound = errors.New("tx not found") + func DefaultAfterTxConfirmed(hash string) error + func DefaultAfterTxSent(hash string) error + func DefaultErrHandler(hash string, err error) + type AfterTxConfirmed func(string) error + func WithAfterTxConfirmed(f func(string) error) AfterTxConfirmed + func (f AfterTxConfirmed) Apply(c *Confirmer) + type AfterTxSent func(string) error + func WithAfterTxSent(f func(string) error) AfterTxSent + func (f AfterTxSent) Apply(c *Confirmer) + type Client interface + ConfirmTx func(ctx context.Context, hash string, confirmationBlocks uint64) error + SendTx func(ctx context.Context, tx interface{}) (string, error) + type ConfirmationBlocks uint64 + func WithConfirmationBlock(b uint64) ConfirmationBlocks + func (b ConfirmationBlocks) Apply(c *Confirmer) + type ConfirmationInterval int64 + func WithConfirmationInterval(i int64) ConfirmationInterval + func (i ConfirmationInterval) Apply(c *Confirmer) + type Confirmer struct + AfterTxConfirmed HashHandler + AfterTxSent HashHandler + ErrHandler ErrHandler + func NewConfirmer(client Client, queueSize int, opts ...Opt) Confirmer + func (c *Confirmer) Close(canncel context.CancelFunc) + func (c *Confirmer) DequeueTx(ctx context.Context) (string, error) + func (c *Confirmer) EnqueueTx(ctx context.Context, tx interface{}) error + func (c *Confirmer) QueueLen() int + func (c *Confirmer) Start(ctx context.Context) error + type ErrHandler func(string, error) + func WithErrHandler(f func(string, error)) ErrHandler + func (f ErrHandler) Apply(c *Confirmer) + type HashHandler func(string) error + type Opt interface + Apply func(c *Confirmer) + type Timeout int64 + func WithTimeout(t int64) Timeout + func (t Timeout) Apply(c *Confirmer) + type WorkerInterval int64 + func WithWorkerInterval(i int64) WorkerInterval + func (i WorkerInterval) Apply(c *Confirmer) + type Workers int + func WithWorkers(w int) Workers + func (w Workers) Apply(c *Confirmer)