[chainid] Check if node input is an harmony api endpoint

pull/179/head
Janet Liang 5 years ago
parent 39c24c5ac6
commit 26fd14dce6
  1. 4
      cmd/subcommands/root.go

@ -5,6 +5,7 @@ import (
"fmt"
"os"
"path"
"regexp"
"strings"
color "github.com/fatih/color"
@ -24,6 +25,7 @@ var (
node string
keyStoreDir string
givenFilePath string
endpoint = regexp.MustCompile(`https://api\.s[0-9]\..*\.hmny\.io`)
request = func(method string, params []interface{}) error {
if !noLatest {
params = append(params, "latest")
@ -65,7 +67,7 @@ var (
}
}
if targetChain == "" {
if targetChain == "" && endpoint.Match([]byte(node)) {
if strings.Contains(node, ".t.") {
chainName = chainIDWrapper{chainID: &common.Chain.MainNet}
} else if strings.Contains(node, ".b.") {

Loading…
Cancel
Save