Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EncodeInput ¶
EncodeInput encodes the input data according to the contract ABI
Types ¶
type Config ¶
type Config struct { // ResubmissionTimeout is the interval at which, if no previously // published transaction has been mined, the new tx with a bumped gas // price will be published. Only one publication at MaxGasPrice will be // attempted. ResubmissionTimeout time.Duration // The multiplier applied to fee suggestions to put a hard limit on fee increases. FeeLimitMultiplier uint64 // TxSendTimeout is how long to wait for sending a transaction. // By default it is unbounded. If set, this is recommended to be at least 20 minutes. TxSendTimeout time.Duration // TxNotInMempoolTimeout is how long to wait before aborting a transaction send if the transaction does not // make it to the mempool. If the tx is in the mempool, TxSendTimeout is used instead. TxNotInMempoolTimeout time.Duration // NetworkTimeout is the allowed duration for a single network request. // This is intended to be used for network requests that can be replayed. NetworkTimeout time.Duration // RequireQueryInterval is the interval at which the tx manager will // query the backend to check for confirmations after a tx at a // specific gas price has been published. ReceiptQueryInterval time.Duration // NumConfirmations specifies how many blocks are need to consider a // transaction confirmed. NumConfirmations uint64 // SafeAbortNonceTooLowCount specifies how many ErrNonceTooLow observations // are required to give up on a tx at a particular nonce without receiving // confirmation. SafeAbortNonceTooLowCount uint64 }
Config houses parameters for altering the behavior of a SimpleTxManager.
type SendState ¶
type SendState struct {
// contains filtered or unexported fields
}
func NewSendState ¶
NewSendState creates a new send state
func NewSendStateWithNow ¶
func NewSendStateWithNow(safeAbortNonceTooLowCount uint64, unableToSendTimeout time.Duration, now func() time.Time) *SendState
NewSendStateWithNow creates a new send state with the provided clock.
func (*SendState) IsWaitingForConfirmation ¶
IsWaitingForConfirmation returns true if we have at least one confirmation on one of our txs.
func (*SendState) ProcessSendError ¶
ProcessSendError should be invoked with the error returned for each publication. It is safe to call this method with nil or arbitrary errors.
func (*SendState) ShouldAbortImmediately ¶
ShouldAbortImmediately returns true if the txmgr should give up on trying a given txn with the target nonce. This occurs when the set of errors recorded indicates that no further progress can be made on this transaction.
func (*SendState) TxMined ¶
TxMined records that the txn with txnHash has been mined and is await confirmation. It is safe to call this function multiple times.
func (*SendState) TxNotMined ¶
TxNotMined records that the txn with txnHash has not been mined or has been reorg'd out. It is safe to call this function multiple times.
type SimpleTxManager ¶
type SimpleTxManager struct {
// contains filtered or unexported fields
}
func NewSimpleTxManager ¶
func (*SimpleTxManager) Send ¶
func (m *SimpleTxManager) Send(ctx context.Context, candidate TxCandidate) (*types.Receipt, error)
Send sends a candidate to the chain.
type TxCandidate ¶
type TxCandidate struct { // TxData is the transaction data to be used in the constructed tx. TxData []byte // To is the recipient of the constructed tx. Nil means contract creation. To *common.Address // GasLimit is the gas limit to be used in the constructed tx. GasLimit uint64 // Value is the value to be used in the constructed tx. Value *big.Int }