mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2025-01-04 01:54:28 +00:00
3102a04d7f
* 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>
37 lines
927 B
Go
37 lines
927 B
Go
package utils
|
|
|
|
import (
|
|
"encoding/json"
|
|
"fmt"
|
|
"strconv"
|
|
"strings"
|
|
)
|
|
|
|
// HexToInt converts a hex string to a type uint64
|
|
func HexToInt(hexStr string) uint64 {
|
|
// Remove the 0x prefix
|
|
cleaned := strings.ReplaceAll(hexStr, "0x", "")
|
|
|
|
result, _ := strconv.ParseUint(cleaned, 16, 64)
|
|
return result
|
|
}
|
|
|
|
// ParseResponse converts any of the rpctest interfaces to a string for readability
|
|
func ParseResponse(resp interface{}) (string, error) {
|
|
result, err := json.Marshal(resp)
|
|
if err != nil {
|
|
return "", fmt.Errorf("error trying to marshal response: %v", err)
|
|
}
|
|
|
|
return string(result), nil
|
|
}
|
|
|
|
// NamespaceAndSubMethodFromMethod splits a parent method into namespace and the actual method
|
|
func NamespaceAndSubMethodFromMethod(method string) (string, string, error) {
|
|
parts := strings.SplitN(method, "_", 2)
|
|
if len(parts) != 2 {
|
|
return "", "", fmt.Errorf("invalid string to split")
|
|
}
|
|
return parts[0], parts[1], nil
|
|
}
|