Move client context initialization from viper to separate package

This commit is contained in:
Christopher Goes
2018-04-03 22:16:03 +02:00
parent 0888096677
commit 7214149f1d
19 changed files with 67 additions and 68 deletions
-20
View File
@@ -1,14 +1,5 @@
package core
import (
// "fmt"
// "github.com/pkg/errors"
"github.com/spf13/viper"
"github.com/cosmos/cosmos-sdk/client"
)
type CoreContext struct {
ChainID string
Height int64
@@ -18,17 +9,6 @@ type CoreContext struct {
Sequence int64
}
func NewCoreContextFromViper() CoreContext {
return CoreContext{
ChainID: viper.GetString(client.FlagChainID),
Height: viper.GetInt64(client.FlagHeight),
TrustNode: viper.GetBool(client.FlagTrustNode),
NodeURI: viper.GetString(client.FlagNode),
FromAddressName: viper.GetString(client.FlagName),
Sequence: viper.GetInt64(client.FlagSequence),
}
}
func (c CoreContext) WithChainID(chainID string) CoreContext {
c.ChainID = chainID
return c