mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2025-01-06 02:52:19 +00:00
22 lines
552 B
Go
22 lines
552 B
Go
package services
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/ledgerwatch/erigon/cmd/devnettest/requests"
|
|
"github.com/ledgerwatch/erigon/common"
|
|
)
|
|
|
|
// GetNonce fetches the latest nonce of the developer account by making an JSONRPC request
|
|
func GetNonce(reqId int) (uint64, error) {
|
|
blockNum := "latest"
|
|
address := common.HexToAddress(DevAddress)
|
|
|
|
res, err := requests.GetTransactionCount(reqId, address, blockNum)
|
|
if err != nil {
|
|
return 0, fmt.Errorf("failed to get transaction count for address 0x%x: %v", address, err)
|
|
}
|
|
|
|
return uint64(res.Result), nil
|
|
}
|