From 8f4e068fafbcb2c310f0966b28c6057d0dc6325e Mon Sep 17 00:00:00 2001 From: Dmitrii Andreev Date: Fri, 11 Apr 2025 03:24:39 +0300 Subject: [PATCH] added separate interface for WaitMined --- accounts/abi/bind/v2/backend.go | 9 +++++++-- accounts/abi/bind/v2/util.go | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/accounts/abi/bind/v2/backend.go b/accounts/abi/bind/v2/backend.go index 2f5f17b31ebc..fd4f8fb79348 100644 --- a/accounts/abi/bind/v2/backend.go +++ b/accounts/abi/bind/v2/backend.go @@ -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) } diff --git a/accounts/abi/bind/v2/util.go b/accounts/abi/bind/v2/util.go index 438848a753ac..4f69fcd693ea 100644 --- a/accounts/abi/bind/v2/util.go +++ b/accounts/abi/bind/v2/util.go @@ -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()