added separate interface for WaitMined

This commit is contained in:
Dmitrii Andreev 2025-04-11 03:24:39 +03:00
parent a9444ea312
commit 8f4e068faf
2 changed files with 8 additions and 3 deletions

View file

@ -105,9 +105,14 @@ type ContractTransactor interface {
PendingNonceAt(ctx context.Context, account common.Address) (uint64, error)
}
// DeployBackend wraps the operations needed by WaitMined and WaitDeployed.
type DeployBackend interface {
// TxReceiptBackend wraps the operations needed by WaitMined.
type TxReceiptBackend interface {
TransactionReceipt(ctx context.Context, txHash common.Hash) (*types.Receipt, error)
}
// DeployBackend wraps the operations needed by WaitDeployed.
type DeployBackend interface {
TxReceiptBackend
CodeAt(ctx context.Context, account common.Address, blockNumber *big.Int) ([]byte, error)
}

View file

@ -29,7 +29,7 @@ import (
// WaitMined waits for tx to be mined on the blockchain.
// It stops waiting when the context is canceled.
func WaitMined(ctx context.Context, b DeployBackend, txHash common.Hash) (*types.Receipt, error) {
func WaitMined(ctx context.Context, b TxReceiptBackend, txHash common.Hash) (*types.Receipt, error) {
queryTicker := time.NewTicker(time.Second)
defer queryTicker.Stop()