models

package
v0.0.0-...-26d7e6f Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2021 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TxStateUnstarted               = TxState("unstarted")
	TxStateInProgress              = TxState("in_progress")
	TxStateFatalError              = TxState("fatal_error")
	TxStateUnconfirmed             = TxState("unconfirmed")
	TxStateConfirmed               = TxState("confirmed")
	TxStateConfirmedMissingReceipt = TxState("confirmed_missing_receipt")

	TxAttemptStateInProgress      = TxAttemptState("in_progress")
	TxAttemptStateInsufficientEth = TxAttemptState("insufficient_eth")
	TxAttemptStateBroadcast       = TxAttemptState("broadcast")

	JobStateUnhandled = JobState("unhandled")
	JobStateHandled   = JobState("handled")
)

Variables

View Source
var WeiPerEth = new(big.Int).Exp(big.NewInt(10), big.NewInt(18), nil)

WeiPerEth is amount of Wei currency units in one Eth.

Functions

func ReceiptIsUnconfirmed

func ReceiptIsUnconfirmed(txr *types.Receipt) bool

ReceiptIsUnconfirmed returns true if the transaction is not confirmed.

Types

type Account

type Account struct {
	Address common.Address
	// This is the nonce that should be used for the next transaction.
	// Conceptually equivalent to geth's `PendingNonceAt` but more reliable
	// because we have a better view of our own transactions
	NextNonce int64
	TxIDs     []uuid.UUID
}
type Head struct {
	Hash       common.Hash
	Number     int64
	ParentHash common.Hash
	Timestamp  time.Time

	Parent *Head // not persisted, filled in Chain()
}

Head represents a BlockNumber, BlockHash.

func NewHead

func NewHead(number *big.Int, blockHash common.Hash, parentHash common.Hash, timestamp uint64) *Head

NewHead returns a Head instance.

func (*Head) ChainLength

func (h *Head) ChainLength() int64

ChainLength returns the length of the chain by following the parents.

func (*Head) EarliestInChain

func (h *Head) EarliestInChain() *Head

EarliestInChain traces through parents until it finds the earliest one.

func (*Head) GreaterThan

func (h *Head) GreaterThan(r *Head) bool

GreaterThan compares BlockNumbers and returns true if the receiver BlockNumber is greater than the supplied BlockNumber.

func (*Head) MarshalJSON

func (h *Head) MarshalJSON() ([]byte, error)

func (*Head) NextInt

func (h *Head) NextInt() *big.Int

NextInt returns the next BlockNumber as big.int, or nil if nil to represent latest.

func (*Head) String

func (h *Head) String() string

String returns a string representation of this number.

func (*Head) ToInt

func (h *Head) ToInt() *big.Int

ToInt return the height as a *big.Int. Also handles nil by returning nil.

func (*Head) UnmarshalJSON

func (h *Head) UnmarshalJSON(bs []byte) error

type Job

type Job struct {
	ID       uuid.UUID
	TxID     uuid.UUID
	Metadata []byte
	State    JobState
}

type JobState

type JobState string

type Log

type Log = types.Log

type Tx

type Tx struct {
	ID             uuid.UUID
	Nonce          int64
	FromAddress    common.Address
	ToAddress      common.Address
	EncodedPayload []byte
	Value          *big.Int
	GasLimit       uint64
	State          TxState
	Error          string
	TxAttemptIDs   []uuid.UUID
}

func (*Tx) GetError

func (tx *Tx) GetError() error

func (*Tx) GetID

func (tx *Tx) GetID() string

GetID allows Tx to be used as jsonapi.MarshalIdentifier

type TxAttempt

type TxAttempt struct {
	ID                      uuid.UUID
	TxID                    uuid.UUID
	GasPrice                *big.Int
	SignedRawTx             []byte
	Hash                    common.Hash
	BroadcastBeforeBlockNum int64
	State                   TxAttemptState
	TxReceiptIDs            []uuid.UUID
}

func (*TxAttempt) GetSignedTx

func (a *TxAttempt) GetSignedTx() (*types.Transaction, error)

GetSignedTx decodes the SignedRawTx into a types.Transaction struct

type TxAttemptState

type TxAttemptState string

type TxReceipt

type TxReceipt struct {
	ID               uuid.UUID
	TxHash           common.Hash
	BlockHash        common.Hash
	BlockNumber      int64
	TransactionIndex uint
	Receipt          []byte
}

type TxState

type TxState string

Jump to

Keyboard shortcuts

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