erigon-pulse/cmd/devnet/services/account.go
ledgerwatch 708ea9225d
[devnet tool] single request generator (#7600)
Co-authored-by: Alex Sharp <alexsharp@Alexs-MacBook-Pro-2.local>
2023-05-29 20:35:45 +01:00

21 lines
573 B
Go

package services
import (
"fmt"
libcommon "github.com/ledgerwatch/erigon-lib/common"
"github.com/ledgerwatch/log/v3"
"github.com/ledgerwatch/erigon/cmd/devnet/models"
"github.com/ledgerwatch/erigon/cmd/devnet/requests"
)
func GetNonce(reqGen *requests.RequestGenerator, address libcommon.Address, logger log.Logger) (uint64, error) {
res, err := requests.GetTransactionCount(reqGen, address, models.Latest, logger)
if err != nil {
return 0, fmt.Errorf("failed to get transaction count for address 0x%x: %v", address, err)
}
return uint64(res.Result), nil
}