// TODO: it is unpreferable to mix static and non-static use of Do func GetChainID(do *definitions.Do) error { if do.ChainID == "" { nodeClient := client.NewErisNodeClient(do.Chain) _, chainId, _, err := nodeClient.ChainId() if err != nil { return err } do.ChainID = chainId log.WithField("=>", do.ChainID).Info("Using ChainID from Node") } return nil }
func GetChainID(do *definitions.Do) error { if do.ChainID == "" { status, err := ChainStatus("node_info", do) if err != nil { return err } // Wrangle these returns type NodeInfo struct { ChainID string `mapstructure:"chain_id" json:"chain_id"` } var ret NodeInfo err = json.Unmarshal([]byte(status), &ret) if err != nil { return err } do.ChainID = ret.ChainID logger.Infof("Using ChainID from Node =>\t%s\n", do.ChainID) } return nil }