erigon-pulse/cmd/devnettest/services/account.go
leonardchinonso 3102a04d7f
Draft PR for the devnet automation (#4057)
* Draft PR for the devnet automation

* Committing to save for later edit

* Finished creating shells, to test

* Changes:
* Added a shell for picking eth commands
* Implemented erigon node running with the --http flag to save processes
* Shell commands for get-balance and send-tx implemented
TODO:
* Make UX more friendly by adding start, stop and exit commands
* Add progress bar to show wait in progress
* Add flag or input to enable mining option for erigon node
* Implemented stress tests for other eth methods

* Experimenting

* little clean up

* lint

* Transitioned to static runs and tests from shell

* Finished stress test methods

* Rendering fixes

* save

* Cleanup

* Fixed lint

* Still fixing lint

* Removed args append ineffect

* Removed println in genesis init.go

* Removed println in genesis init.go

Co-authored-by: Alexey Sharp <alexeysharp@Alexeys-iMac.local>
Co-authored-by: Enrique Avila <eavilaasapche@gmail.com>
2022-05-26 13:08:25 +01:00

21 lines
551 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
}