Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrInvalidSendTxArgs is returned when the structure of SendTxArgs is ambigious. ErrInvalidSendTxArgs = errors.New("transaction arguments are invalid") // ErrUnexpectedArgs is returned when args are of unexpected length. ErrUnexpectedArgs = errors.New("unexpected args") //ErrInvalidTxSender is returned when selected account is different tham From field. ErrInvalidTxSender = errors.New("transaction can only be send by its creator") )
Functions ¶
This section is empty.
Types ¶
type AddrLocker ¶
type AddrLocker struct {
// contains filtered or unexported fields
}
AddrLocker provides locks for addresses
func (*AddrLocker) LockAddr ¶
func (l *AddrLocker) LockAddr(address common.Address)
LockAddr locks an account's mutex. This is used to prevent another tx getting the same nonce until the lock is released. The mutex prevents the (an identical nonce) from being read again during the time that the first transaction is being signed.
func (*AddrLocker) UnlockAddr ¶
func (l *AddrLocker) UnlockAddr(address common.Address)
UnlockAddr unlocks the mutex of the given account.
type GasCalculator ¶
type GasCalculator interface { ethereum.GasEstimator ethereum.GasPricer }
GasCalculator provides methods for estimating and pricing gas.
type PendingNonceProvider ¶
type PendingNonceProvider interface {
PendingNonceAt(ctx context.Context, account common.Address) (uint64, error)
}
PendingNonceProvider provides information about nonces.
type SendTxArgs ¶
type SendTxArgs struct { From common.Address `json:"from"` To *common.Address `json:"to"` Gas *hexutil.Uint64 `json:"gas"` GasPrice *hexutil.Big `json:"gasPrice"` Value *hexutil.Big `json:"value"` Nonce *hexutil.Uint64 `json:"nonce"` // We keep both "input" and "data" for backward compatibility. // "input" is a preferred field. // see `vendor/github.com/ethereum/go-ethereum/internal/ethapi/api.go:1107` Input hexutil.Bytes `json:"input"` Data hexutil.Bytes `json:"data"` }
SendTxArgs represents the arguments to submit a new transaction into the transaction pool. This struct is based on go-ethereum's type in internal/ethapi/api.go, but we have freedom over the exact layout of this struct.
func (SendTxArgs) GetInput ¶
func (args SendTxArgs) GetInput() hexutil.Bytes
GetInput returns either Input or Data field's value dependent on what is filled.
func (SendTxArgs) Valid ¶
func (args SendTxArgs) Valid() bool
Valid checks whether this structure is filled in correctly.
type Transactor ¶
type Transactor struct {
// contains filtered or unexported fields
}
Transactor validates, signs transactions. It uses upstream to propagate transactions to the Ethereum network.
func (*Transactor) SendTransaction ¶
func (t *Transactor) SendTransaction(sendArgs SendTxArgs, verifiedAccount *account.SelectedExtKey) (hash gethcommon.Hash, err error)
SendTransaction is an implementation of eth_sendTransaction. It queues the tx to the sign queue.
func (*Transactor) SetNetworkID ¶
func (t *Transactor) SetNetworkID(networkID uint64)
SetNetworkID selects a correct network.