Skip to content

Commit 8242bcb

Browse files
committed
Add missing docs for public functions
1 parent 6ee886a commit 8242bcb

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

seth/client.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,11 @@ func NewClientWithConfig(cfg *Config) (*Client, error) {
155155
)
156156
}
157157

158+
// ValidateConfig checks and validates the provided Config struct.
159+
// It ensures essential fields have valid values or default to appropriate values
160+
// when necessary. This function performs validation on gas price estimation,
161+
// gas limit, tracing level, trace outputs, network dial timeout, and pending nonce protection timeout.
162+
// If any configuration is invalid, it returns an error.
158163
func ValidateConfig(cfg *Config) error {
159164
if cfg.Network.GasPriceEstimationEnabled {
160165
if cfg.Network.GasPriceEstimationBlocks == 0 {
@@ -454,6 +459,10 @@ func (m *Client) checkRPCHealth() error {
454459
return nil
455460
}
456461

462+
// TransferETHFromKey initiates a transfer of Ether from a specified key to a recipient address.
463+
// It validates the private key index, estimates gas limit if not provided, and sends the transaction.
464+
// The function signs and sends an Ethereum transaction using the specified fromKeyNum and recipient address,
465+
// with the specified amount and gas price.
457466
func (m *Client) TransferETHFromKey(ctx context.Context, fromKeyNum int, to string, value *big.Int, gasPrice *big.Int) error {
458467
if err := m.validatePrivateKeysKeyNum(fromKeyNum); err != nil {
459468
return err

seth/decode.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,7 @@ func (m *Client) handleDisabledTracing(l zerolog.Logger, decoded DecodedTransact
337337
}
338338
}
339339

340+
// MergeEventData merges new event data into the existing EventData map in the DecodedTransactionLog.
340341
func (d *DecodedCommonLog) MergeEventData(newEventData map[string]interface{}) {
341342
if d.EventData == nil {
342343
d.EventData = make(map[string]interface{})
@@ -541,6 +542,8 @@ func (m *Client) CallMsgFromTx(tx *types.Transaction) (ethereum.CallMsg, error)
541542
}, nil
542543
}
543544

545+
// DownloadContractAndGetPragma retrieves the bytecode of a contract at a specified address and block,
546+
// then decodes it to extract the pragma version. Returns the pragma version or an error if retrieval or decoding fails.
544547
func (m *Client) DownloadContractAndGetPragma(address common.Address, block *big.Int) (Pragma, error) {
545548
bytecode, err := m.Client.CodeAt(context.Background(), address, block)
546549
if err != nil {

seth/gas.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ func NewGasEstimator(c *Client) *GasEstimator {
1919
return &GasEstimator{Client: c}
2020
}
2121

22-
// Stats prints gas stats
22+
// Stats calculates gas price and tip cap suggestions based on historical fee data over a specified number of blocks.
23+
// It computes quantiles for base fees and tip caps and provides suggested gas price and tip cap values.
2324
func (m *GasEstimator) Stats(fromNumber uint64, priorityPerc float64) (GasSuggestions, error) {
2425
bn, err := m.Client.Client.BlockNumber(context.Background())
2526
if err != nil {

0 commit comments

Comments
 (0)