Move client context initialization from viper to separate package
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user