Documentation
¶
Index ¶
- Constants
- type Listener
- type Sender
- func (s *Sender) RefreshNonce() error
- func (s *Sender) SendTransaction(tx *Transaction)
- func (s *Sender) SendTransactionData(to string, data []byte) error
- func (s *Sender) SetSigner(signerT signerType, chainID *big.Int) error
- func (s *Sender) Sign(tx *types.Transaction) error
- func (s *Sender) Start()
- func (s *Sender) SuggestGasPrice() (*big.Int, error)
- type Transaction
Constants ¶
const ( // Homestead is an identifier to be used to specify // the sender we want to use homestead signature Homestead signerType = "Homestead" // EIP155 is an identifier to be used to specify // the sender we want to use EIP155 EIP155 signerType = "EIP155" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Listener ¶
type Listener struct {
Notifications []blockchain.Notification
// contains filtered or unexported fields
}
Listener is an implementation of blockchain.Listener
func (*Listener) AddNotification ¶
func (l *Listener) AddNotification(notif blockchain.Notification)
AddNotification registers a new notification in the notification list
func (*Listener) GetBlockNumber ¶
GetBlockNumber returns the latest value of the blocknumber
This is the value you want to use to fetch the latest known block
func (*Listener) ReadThroughNotify ¶
ReadThroughNotify applies the Notifications on all the transaction of a given block
type Sender ¶
type Sender struct {
// contains filtered or unexported fields
}
Sender can be provided a private key and use it to sign
It is responsible for adding
func NewSender ¶
func NewSender( ctx context.Context, priv ecdsa.PrivateKey, client *ethclient.Client, signerT signerType, chainID *big.Int, ) *Sender
NewSender returns a Sender object
It does not include any specific logic aside deriving the adress from the private key
func (*Sender) RefreshNonce ¶
RefreshNonce gets the next nonce to use from the client
It returns an error if the remote client could not be reached
func (*Sender) SendTransaction ¶
func (s *Sender) SendTransaction(tx *Transaction)
SendTransaction sends a transaction on the blockchain
func (*Sender) SendTransactionData ¶
SendTransactionData publish a simple transaction to ethereum
The function completely hides the responsibility to set the nonce, the gas price, the gasLimit and to sign the transaction to the user
func (*Sender) SetSigner ¶
SetSigner fetches the chainID from the client and cache it in the object
It is necessary in order to
func (*Sender) Sign ¶
func (s *Sender) Sign(tx *types.Transaction) error
Sign a transaction in place
type Transaction ¶
type Transaction types.Transaction
Transaction is a wrapper for geth transaction
func NewTransaction ¶
func NewTransaction(nonce uint64, to string, amount *big.Int, gasLimit uint64, gasPrice *big.Int, data []byte) *Transaction
NewTransaction returns an ethereum transaction
func (*Transaction) GetData ¶
func (t *Transaction) GetData() []byte
GetData returns the recipient of the transaction
func (*Transaction) GetTo ¶
func (t *Transaction) GetTo() string
GetTo returns the recipient of the transaction