Documentation
¶
Index ¶
- Variables
- func GeneratePrefixedHash(data []byte) []byte
- func GetAddrPrivKeyFromKeystore(keyjson, passphrase string) (common.Address, string, error)
- func GetBlockDelay() uint64
- func GetBlockPollingIntervalSec() uint64
- func GetChainId() *big.Int
- func GetMaxGasGwei() uint64
- func GetMinGasGwei() uint64
- func GetQuickCatchBlockDelay() uint64
- func GetTxQueryRetryInterval() time.Duration
- func GetTxQueryTimeout() time.Duration
- func GetTxTimeout() time.Duration
- func RecoverSigner(data []byte, sig []byte) common.Address
- func SetBlockDelay(blockDelay uint64)
- func SetBlockPollingInterval(pollingIntervalSec uint64)
- func SetChainId(chainId *big.Int)
- func SetGasLimit(minGasGwei, maxGasGwei uint64)
- func SetQuickCatchBlockDelay(quickCatchBlockDelay uint64)
- func SetWaitMinedConfig(txTimeoutSec, txQueryTimeoutSec, txQueryRetryIntervalSec uint64)
- func SigIsValid(signer common.Address, data []byte, sig []byte) bool
- func WaitMined(ctx context.Context, ec *ethclient.Client, tx *types.Transaction, ...) (*types.Receipt, error)
- func WaitMinedWithTxHash(ctx context.Context, ec *ethclient.Client, txHash string, blockDelay uint64, ...) (*types.Receipt, error)
- type CelerSigner
- type Signer
- type TransactionStateHandler
- type Transactor
- func (t *Transactor) Address() common.Address
- func (t *Transactor) ContractCaller() bind.ContractCaller
- func (t *Transactor) Transact(handler *TransactionStateHandler, txconfig *TxConfig, method TxMethod) (*types.Transaction, error)
- func (t *Transactor) TransactWaitMined(description string, txconfig *TxConfig, method TxMethod) (*types.Receipt, error)
- func (t *Transactor) WaitMined(txHash string) (*types.Receipt, error)
- type TransactorConfig
- type TransactorPool
- func (p *TransactorPool) ContractCaller() bind.ContractCaller
- func (p *TransactorPool) Submit(handler *TransactionStateHandler, txconfig *TxConfig, method TxMethod) (*types.Transaction, error)
- func (p *TransactorPool) SubmitWaitMined(description string, txconfig *TxConfig, method TxMethod) (*types.Receipt, error)
- func (p *TransactorPool) WaitMined(txHash string) (*types.Receipt, error)
- type TxConfig
- type TxMethod
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrTxDropped = errors.New("onchain transaction dropped") ErrTxTimeout = errors.New("onchain transaction timeout") ErrTxReorg = errors.New("onchain transaction reorg") // an error possibly returned when a transaction is pending ErrMissingField = errors.New("missing required field 'transactionHash' for Log") )
Functions ¶
func GeneratePrefixedHash ¶
func GetBlockDelay ¶ added in v0.1.12
func GetBlockDelay() uint64
func GetBlockPollingIntervalSec ¶ added in v0.1.12
func GetBlockPollingIntervalSec() uint64
func GetChainId ¶ added in v0.1.12
func GetMaxGasGwei ¶ added in v0.1.12
func GetMaxGasGwei() uint64
func GetMinGasGwei ¶ added in v0.1.12
func GetMinGasGwei() uint64
func GetQuickCatchBlockDelay ¶ added in v0.1.12
func GetQuickCatchBlockDelay() uint64
func GetTxQueryRetryInterval ¶ added in v0.1.12
func GetTxQueryTimeout ¶ added in v0.1.12
func GetTxTimeout ¶ added in v0.1.12
func SetBlockDelay ¶
func SetBlockDelay(blockDelay uint64)
func SetBlockPollingInterval ¶
func SetBlockPollingInterval(pollingIntervalSec uint64)
func SetChainId ¶
func SetGasLimit ¶
func SetGasLimit(minGasGwei, maxGasGwei uint64)
func SetQuickCatchBlockDelay ¶
func SetQuickCatchBlockDelay(quickCatchBlockDelay uint64)
func SetWaitMinedConfig ¶
func SetWaitMinedConfig(txTimeoutSec, txQueryTimeoutSec, txQueryRetryIntervalSec uint64)
func WaitMinedWithTxHash ¶
func WaitMinedWithTxHash( ctx context.Context, ec *ethclient.Client, txHash string, blockDelay uint64, pollingIntervalSec uint64) (*types.Receipt, error)
WaitMinedWithTxHash only wait with given txhash, without other info such as nonce. Therefore, it cannot tell if a tx is dropped if not yet mined
Types ¶
type CelerSigner ¶
type CelerSigner struct {
// contains filtered or unexported fields
}
func NewSigner ¶
func NewSigner(privateKey string) (*CelerSigner, error)
func NewSignerFromKeystore ¶
func NewSignerFromKeystore(keyjson, passphrase string) (*CelerSigner, error)
func (*CelerSigner) SignEthMessage ¶
func (s *CelerSigner) SignEthMessage(data []byte) ([]byte, error)
input data: a byte array of raw message to be signed return a byte array signature in the R,S,V format
func (*CelerSigner) SignEthTransaction ¶
func (s *CelerSigner) SignEthTransaction(rawTx []byte) ([]byte, error)
input rawTx: a byte array of a RLP-encoded unsigned Ethereum raw transaction return a byte array signed raw tx in RLP-encoded format
type Signer ¶
type Signer interface {
// input data: a byte array of raw message to be signed
// return a byte array signature in the R,S,V format
// The implementation should hash data w/ keccak256, and add
// "\x19Ethereum Signed Message:\n32" prefix (32 is the length of hash result)
// for ECDSA sign. If some library handles prefix automatically, pass hash
// result is sufficient
SignEthMessage(data []byte) ([]byte, error)
// input rawTx: a byte array of a RLP-encoded unsigned Ethereum raw transaction
// return a byte array signed raw tx in RLP-encoded format
SignEthTransaction(rawTx []byte) ([]byte, error)
}
type TransactionStateHandler ¶
type TransactionStateHandler struct {
OnMined func(receipt *types.Receipt)
OnDropped func(tx *types.Transaction)
OnTimeout func(tx *types.Transaction)
}
type Transactor ¶
type Transactor struct {
// contains filtered or unexported fields
}
func NewTransactor ¶
func (*Transactor) Address ¶
func (t *Transactor) Address() common.Address
func (*Transactor) ContractCaller ¶
func (t *Transactor) ContractCaller() bind.ContractCaller
func (*Transactor) Transact ¶
func (t *Transactor) Transact( handler *TransactionStateHandler, txconfig *TxConfig, method TxMethod) (*types.Transaction, error)
func (*Transactor) TransactWaitMined ¶
type TransactorConfig ¶
func NewTransactorConfig ¶
func NewTransactorConfig(keyjson string, passphrase string) *TransactorConfig
type TransactorPool ¶
type TransactorPool struct {
// contains filtered or unexported fields
}
func NewTransactorPool ¶
func NewTransactorPool(transactors []*Transactor) (*TransactorPool, error)
func NewTransactorPoolFromConfig ¶
func NewTransactorPoolFromConfig( client *ethclient.Client, configs []*TransactorConfig) (*TransactorPool, error)
func (*TransactorPool) ContractCaller ¶
func (p *TransactorPool) ContractCaller() bind.ContractCaller
func (*TransactorPool) Submit ¶
func (p *TransactorPool) Submit( handler *TransactionStateHandler, txconfig *TxConfig, method TxMethod) (*types.Transaction, error)
func (*TransactorPool) SubmitWaitMined ¶
type TxMethod ¶
type TxMethod func(transactor bind.ContractTransactor, opts *bind.TransactOpts) (*types.Transaction, error)
Click to show internal directories.
Click to hide internal directories.