Documentation
¶
Index ¶
- Constants
- type BlockInfo
- type Client
- func (client *Client) GetBalanceAt(ctx context.Context, wallet common.Address) (*big.Int, error)
- func (client *Client) GetBlockHeight(ctx context.Context) (uint64, error)
- func (client *Client) GetChainId(ctx context.Context) (*big.Int, error)
- func (client *Client) GetClientGroup() string
- func (client *Client) GetClientVersion(ctx context.Context) (string, error)
- func (client *Client) GetEthClient() *ethclient.Client
- func (client *Client) GetLastBlockHeight() (uint64, time.Time)
- func (client *Client) GetName() string
- func (client *Client) GetNonceAt(ctx context.Context, wallet common.Address, blockNumber *big.Int) (uint64, error)
- func (client *Client) GetPendingNonceAt(ctx context.Context, wallet common.Address) (uint64, error)
- func (client *Client) GetRPCHost() string
- func (client *Client) GetSuggestedFee(ctx context.Context) (*big.Int, *big.Int, error)
- func (client *Client) GetTransactionReceiptCtx(ctx context.Context, txHash common.Hash) (*types.Receipt, error)
- func (client *Client) SendRawTransactionCtx(ctx context.Context, tx []byte) error
- func (client *Client) SendTransaction2(ctx context.Context, tx *types.Transaction) error
- func (client *Client) SendTransactionCtx(ctx context.Context, tx *types.Transaction) error
- func (client *Client) UpdateWallet(ctx context.Context, wallet *Wallet) error
- type ClientPool
- type ClientSelectionMode
- type FundingRequest
- type RootWallet
- type SendTransactionOptions
- type TxBatcher
- type TxConfirmFn
- type TxInfo
- type TxLogFn
- type TxPool
- func (pool *TxPool) AwaitTransaction(ctx context.Context, wallet *Wallet, tx *types.Transaction) (*types.Receipt, error)
- func (pool *TxPool) SendAndAwaitTxRange(ctx context.Context, wallet *Wallet, txs []*types.Transaction, ...) error
- func (pool *TxPool) SendTransaction(ctx context.Context, wallet *Wallet, tx *types.Transaction, ...) error
- type TxPoolOptions
- type TxRebroadcastFn
- type Wallet
- func (wallet *Wallet) AddBalance(amount *big.Int)
- func (wallet *Wallet) BuildBlobTx(txData *types.BlobTx) (*types.Transaction, error)
- func (wallet *Wallet) BuildBoundTx(ctx context.Context, txData *txbuilder.TxMetadata, ...) (*types.Transaction, error)
- func (wallet *Wallet) BuildDynamicFeeTx(txData *types.DynamicFeeTx) (*types.Transaction, error)
- func (wallet *Wallet) BuildSetCodeTx(txData *types.SetCodeTx) (*types.Transaction, error)
- func (wallet *Wallet) GetAddress() common.Address
- func (wallet *Wallet) GetBalance() *big.Int
- func (wallet *Wallet) GetChainId() *big.Int
- func (wallet *Wallet) GetConfirmedNonce() uint64
- func (wallet *Wallet) GetNextNonce() uint64
- func (wallet *Wallet) GetNonce() uint64
- func (wallet *Wallet) GetPrivateKey() *ecdsa.PrivateKey
- func (wallet *Wallet) ReplaceBlobTx(txData *types.BlobTx, nonce uint64) (*types.Transaction, error)
- func (wallet *Wallet) ReplaceDynamicFeeTx(txData *types.DynamicFeeTx, nonce uint64) (*types.Transaction, error)
- func (wallet *Wallet) ResetPendingNonce(ctx context.Context, client *Client)
- func (wallet *Wallet) SetAddress(address common.Address)
- func (wallet *Wallet) SetBalance(balance *big.Int)
- func (wallet *Wallet) SetChainId(chainid *big.Int)
- func (wallet *Wallet) SetNonce(nonce uint64)
- func (wallet *Wallet) SubBalance(amount *big.Int)
- type WalletPool
- func (pool *WalletPool) AddWellKnownWallet(config *WellKnownWalletConfig)
- func (pool *WalletPool) CheckChildWalletBalance(childWallet *Wallet) error
- func (pool *WalletPool) GetAllWallets() []*Wallet
- func (pool *WalletPool) GetChainId() *big.Int
- func (pool *WalletPool) GetClient(mode ClientSelectionMode, input int, group string) *Client
- func (pool *WalletPool) GetClientPool() *ClientPool
- func (pool *WalletPool) GetConfiguredWalletCount() uint64
- func (pool *WalletPool) GetContext() context.Context
- func (pool *WalletPool) GetRootWallet() *RootWallet
- func (pool *WalletPool) GetTxPool() *TxPool
- func (pool *WalletPool) GetWallet(mode WalletSelectionMode, input int) *Wallet
- func (pool *WalletPool) GetWalletCount() uint64
- func (pool *WalletPool) GetWalletName(address common.Address) string
- func (pool *WalletPool) GetWellKnownWallet(name string) *Wallet
- func (pool *WalletPool) LoadConfig(configYaml string) error
- func (pool *WalletPool) MarshalConfig() (string, error)
- func (pool *WalletPool) PrepareWallets(runFundings bool) error
- func (pool *WalletPool) SetRefillAmount(amount *uint256.Int)
- func (pool *WalletPool) SetRefillBalance(balance *uint256.Int)
- func (pool *WalletPool) SetRefillInterval(interval uint64)
- func (pool *WalletPool) SetWalletCount(count uint64)
- func (pool *WalletPool) SetWalletSeed(seed string)
- type WalletPoolConfig
- type WalletSelectionMode
- type WellKnownWalletConfig
Constants ¶
View Source
const ( BatcherTxLimit = 50 BatcherBaseGas = 50000 BatcherGasPerTx = 35000 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶ added in v1.1.3
func (*Client) GetBalanceAt ¶ added in v1.1.3
func (*Client) GetBlockHeight ¶ added in v1.1.3
func (*Client) GetChainId ¶ added in v1.1.3
func (*Client) GetClientGroup ¶ added in v1.1.3
func (*Client) GetClientVersion ¶ added in v1.1.3
func (*Client) GetEthClient ¶ added in v1.1.3
func (*Client) GetLastBlockHeight ¶ added in v1.1.3
func (*Client) GetNonceAt ¶ added in v1.1.3
func (*Client) GetPendingNonceAt ¶ added in v1.1.3
func (*Client) GetRPCHost ¶ added in v1.1.3
func (*Client) GetSuggestedFee ¶ added in v1.1.3
func (*Client) GetTransactionReceiptCtx ¶ added in v1.1.3
func (*Client) SendRawTransactionCtx ¶ added in v1.1.3
func (*Client) SendTransaction2 ¶ added in v1.1.3
func (*Client) SendTransactionCtx ¶ added in v1.1.3
type ClientPool ¶
type ClientPool struct {
// contains filtered or unexported fields
}
func NewClientPool ¶
func NewClientPool(ctx context.Context, rpcHosts []string, logger logrus.FieldLogger) *ClientPool
func (*ClientPool) GetAllClients ¶
func (pool *ClientPool) GetAllClients() []*Client
func (*ClientPool) GetAllGoodClients ¶
func (pool *ClientPool) GetAllGoodClients() []*Client
func (*ClientPool) GetClient ¶
func (pool *ClientPool) GetClient(mode ClientSelectionMode, input int, group string) *Client
func (*ClientPool) PrepareClients ¶
func (pool *ClientPool) PrepareClients() error
type ClientSelectionMode ¶
type ClientSelectionMode uint8
var ( SelectClientByIndex ClientSelectionMode = 0 SelectClientRandom ClientSelectionMode = 1 SelectClientRoundRobin ClientSelectionMode = 2 )
type FundingRequest ¶ added in v1.1.3
type RootWallet ¶ added in v1.1.3
type RootWallet struct {
// contains filtered or unexported fields
}
func InitRootWallet ¶
func InitRootWallet(ctx context.Context, privkey string, client *Client, logger logrus.FieldLogger) (*RootWallet, error)
func (*RootWallet) GetTxBatcher ¶ added in v1.1.3
func (wallet *RootWallet) GetTxBatcher() *TxBatcher
func (*RootWallet) GetWallet ¶ added in v1.1.3
func (wallet *RootWallet) GetWallet() *Wallet
func (*RootWallet) InitTxBatcher ¶ added in v1.1.3
func (wallet *RootWallet) InitTxBatcher(ctx context.Context, txpool *TxPool)
func (*RootWallet) WithWalletLock ¶ added in v1.1.3
type SendTransactionOptions ¶ added in v1.1.3
type SendTransactionOptions struct {
Client *Client
ClientGroup string
ClientsStartOffset int
OnConfirm TxConfirmFn
LogFn TxLogFn
OnRebroadcast TxRebroadcastFn
MaxRebroadcasts int
RebroadcastInterval time.Duration
TransactionBytes []byte
}
type TxBatcher ¶ added in v1.1.3
type TxBatcher struct {
// contains filtered or unexported fields
}
func NewTxBatcher ¶ added in v1.1.3
func (*TxBatcher) GetAddress ¶ added in v1.1.3
func (*TxBatcher) GetRequestCalldata ¶ added in v1.1.3
func (b *TxBatcher) GetRequestCalldata(requests []*FundingRequest) ([]byte, error)
type TxConfirmFn ¶ added in v1.1.3
type TxConfirmFn func(tx *types.Transaction, receipt *types.Receipt, err error)
type TxInfo ¶ added in v1.1.3
type TxInfo struct {
TxHash common.Hash
From common.Address
To *common.Address
Tx *types.Transaction
FromWallet *Wallet
ToWallet *Wallet
Options *SendTransactionOptions
}
TxInfo represents information about a confirmed transaction
type TxPool ¶ added in v1.1.3
type TxPool struct {
// contains filtered or unexported fields
}
func NewTxPool ¶ added in v1.1.3
func NewTxPool(options *TxPoolOptions) *TxPool
func (*TxPool) AwaitTransaction ¶ added in v1.1.3
func (*TxPool) SendAndAwaitTxRange ¶ added in v1.1.3
func (pool *TxPool) SendAndAwaitTxRange(ctx context.Context, wallet *Wallet, txs []*types.Transaction, options *SendTransactionOptions) error
func (*TxPool) SendTransaction ¶ added in v1.1.3
func (pool *TxPool) SendTransaction(ctx context.Context, wallet *Wallet, tx *types.Transaction, options *SendTransactionOptions) error
type TxPoolOptions ¶ added in v1.1.3
type TxPoolOptions struct {
Context context.Context
ClientPool *ClientPool
ReorgDepth int // Number of blocks to keep in memory for reorg tracking
GetActiveWalletPools func() []*WalletPool
}
type TxRebroadcastFn ¶ added in v1.1.3
type TxRebroadcastFn func(tx *types.Transaction, options *SendTransactionOptions, client *Client)
type Wallet ¶ added in v1.1.3
type Wallet struct {
// contains filtered or unexported fields
}
func (*Wallet) AddBalance ¶ added in v1.1.3
func (*Wallet) BuildBlobTx ¶ added in v1.1.3
func (*Wallet) BuildBoundTx ¶ added in v1.1.3
func (wallet *Wallet) BuildBoundTx(ctx context.Context, txData *txbuilder.TxMetadata, buildFn func(transactOpts *bind.TransactOpts) (*types.Transaction, error)) (*types.Transaction, error)
func (*Wallet) BuildDynamicFeeTx ¶ added in v1.1.3
func (wallet *Wallet) BuildDynamicFeeTx(txData *types.DynamicFeeTx) (*types.Transaction, error)
func (*Wallet) BuildSetCodeTx ¶ added in v1.1.3
func (*Wallet) GetAddress ¶ added in v1.1.3
func (*Wallet) GetBalance ¶ added in v1.1.3
func (*Wallet) GetChainId ¶ added in v1.1.3
func (*Wallet) GetConfirmedNonce ¶ added in v1.1.3
func (*Wallet) GetNextNonce ¶ added in v1.1.3
func (*Wallet) GetPrivateKey ¶ added in v1.1.3
func (wallet *Wallet) GetPrivateKey() *ecdsa.PrivateKey
func (*Wallet) ReplaceBlobTx ¶ added in v1.1.3
func (*Wallet) ReplaceDynamicFeeTx ¶ added in v1.1.3
func (wallet *Wallet) ReplaceDynamicFeeTx(txData *types.DynamicFeeTx, nonce uint64) (*types.Transaction, error)
func (*Wallet) ResetPendingNonce ¶ added in v1.1.3
func (*Wallet) SetAddress ¶ added in v1.1.3
func (*Wallet) SetBalance ¶ added in v1.1.3
func (*Wallet) SetChainId ¶ added in v1.1.3
func (*Wallet) SubBalance ¶ added in v1.1.3
type WalletPool ¶
type WalletPool struct {
// contains filtered or unexported fields
}
func NewWalletPool ¶
func NewWalletPool(ctx context.Context, logger logrus.FieldLogger, rootWallet *RootWallet, clientPool *ClientPool, txpool *TxPool) *WalletPool
func (*WalletPool) AddWellKnownWallet ¶ added in v1.1.1
func (pool *WalletPool) AddWellKnownWallet(config *WellKnownWalletConfig)
func (*WalletPool) CheckChildWalletBalance ¶
func (pool *WalletPool) CheckChildWalletBalance(childWallet *Wallet) error
func (*WalletPool) GetAllWallets ¶
func (pool *WalletPool) GetAllWallets() []*Wallet
func (*WalletPool) GetChainId ¶ added in v1.1.3
func (pool *WalletPool) GetChainId() *big.Int
func (*WalletPool) GetClient ¶
func (pool *WalletPool) GetClient(mode ClientSelectionMode, input int, group string) *Client
func (*WalletPool) GetClientPool ¶
func (pool *WalletPool) GetClientPool() *ClientPool
func (*WalletPool) GetConfiguredWalletCount ¶ added in v1.1.3
func (pool *WalletPool) GetConfiguredWalletCount() uint64
func (*WalletPool) GetContext ¶
func (pool *WalletPool) GetContext() context.Context
func (*WalletPool) GetRootWallet ¶
func (pool *WalletPool) GetRootWallet() *RootWallet
func (*WalletPool) GetTxPool ¶
func (pool *WalletPool) GetTxPool() *TxPool
func (*WalletPool) GetWallet ¶
func (pool *WalletPool) GetWallet(mode WalletSelectionMode, input int) *Wallet
func (*WalletPool) GetWalletCount ¶
func (pool *WalletPool) GetWalletCount() uint64
func (*WalletPool) GetWalletName ¶ added in v1.1.1
func (pool *WalletPool) GetWalletName(address common.Address) string
func (*WalletPool) GetWellKnownWallet ¶ added in v1.1.1
func (pool *WalletPool) GetWellKnownWallet(name string) *Wallet
func (*WalletPool) LoadConfig ¶
func (pool *WalletPool) LoadConfig(configYaml string) error
func (*WalletPool) MarshalConfig ¶
func (pool *WalletPool) MarshalConfig() (string, error)
func (*WalletPool) PrepareWallets ¶
func (pool *WalletPool) PrepareWallets(runFundings bool) error
func (*WalletPool) SetRefillAmount ¶
func (pool *WalletPool) SetRefillAmount(amount *uint256.Int)
func (*WalletPool) SetRefillBalance ¶
func (pool *WalletPool) SetRefillBalance(balance *uint256.Int)
func (*WalletPool) SetRefillInterval ¶
func (pool *WalletPool) SetRefillInterval(interval uint64)
func (*WalletPool) SetWalletCount ¶
func (pool *WalletPool) SetWalletCount(count uint64)
func (*WalletPool) SetWalletSeed ¶
func (pool *WalletPool) SetWalletSeed(seed string)
type WalletPoolConfig ¶
type WalletPoolConfig struct {
WalletCount uint64 `yaml:"wallet_count,omitempty"`
RefillAmount *uint256.Int `yaml:"refill_amount"`
RefillBalance *uint256.Int `yaml:"refill_balance"`
RefillInterval uint64 `yaml:"refill_interval"`
WalletSeed string `yaml:"seed"`
}
func GetDefaultWalletConfig ¶ added in v1.1.1
func GetDefaultWalletConfig(scenarioName string) *WalletPoolConfig
type WalletSelectionMode ¶
type WalletSelectionMode uint8
var ( SelectWalletByIndex WalletSelectionMode = 0 SelectWalletRandom WalletSelectionMode = 1 SelectWalletRoundRobin WalletSelectionMode = 2 )
Click to show internal directories.
Click to hide internal directories.