mirror of
https://github.com/planetmint/planetmint-go.git
synced 2025-11-26 07:25:46 +00:00
add: short description to GetValidatorAddress() cases
Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>
This commit is contained in:
parent
17541e078f
commit
2781522495
@ -82,11 +82,14 @@ func (config *Config) SetPlanetmintConfig(planetmintconfig interface{}) {
|
||||
}
|
||||
|
||||
func (config *Config) GetValidatorAddress() string {
|
||||
// Case: testing
|
||||
if os.Getenv(ValAddr) != "" {
|
||||
return os.Getenv(ValAddr)
|
||||
}
|
||||
|
||||
libConfig := lib.GetConfig()
|
||||
|
||||
// Case: No Trust Wallet connected
|
||||
if libConfig.GetSerialPort() == "" {
|
||||
defaultRecord, err := libConfig.GetDefaultValidatorRecord()
|
||||
if err != nil {
|
||||
@ -102,6 +105,7 @@ func (config *Config) GetValidatorAddress() string {
|
||||
return addr.String()
|
||||
}
|
||||
|
||||
// Case: Trust Wallet connected
|
||||
connector, err := trustwallet.NewTrustWalletConnector(libConfig.GetSerialPort())
|
||||
if err != nil {
|
||||
logger.GetLogger(logger.ERROR).Error("msg", err.Error())
|
||||
|
||||
@ -132,8 +132,12 @@ func (config *Config) GetSerialPort() string {
|
||||
return config.serialPort
|
||||
}
|
||||
|
||||
func (config *Config) getLibKeyring() (keyring.Keyring, error) {
|
||||
return keyring.New("lib", keyring.BackendTest, config.rootDir, os.Stdin, config.encodingConfig.Marshaler, []keyring.Option{}...)
|
||||
}
|
||||
|
||||
func (config *Config) GetDefaultValidatorRecord() (*keyring.Record, error) {
|
||||
keyring, err := keyring.New("lib", keyring.BackendTest, config.rootDir, os.Stdin, config.encodingConfig.Marshaler, []keyring.Option{}...)
|
||||
keyring, err := config.getLibKeyring()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@ -96,7 +96,7 @@ func getClientContext(fromAddress sdk.AccAddress) (clientCtx client.Context, err
|
||||
codec := encodingConfig.Marshaler
|
||||
keyringOptions := []keyring.Option{}
|
||||
|
||||
keyring, err := keyring.New("lib", keyring.BackendTest, rootDir, input, codec, keyringOptions...)
|
||||
keyring, err := GetConfig().getLibKeyring()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user