mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2025-01-03 17:44:29 +00:00
708ea9225d
Co-authored-by: Alex Sharp <alexsharp@Alexs-MacBook-Pro-2.local>
21 lines
573 B
Go
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
|
|
}
|