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
+3 -3
View File
@@ -10,7 +10,7 @@ import (
"github.com/spf13/cobra"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/core"
"github.com/cosmos/cosmos-sdk/client/context"
)
const (
@@ -32,7 +32,7 @@ func blockCommand() *cobra.Command {
func getBlock(height *int64) ([]byte, error) {
// get the node
ctx := core.NewCoreContextFromViper()
ctx := context.NewCoreContextFromViper()
node, err := ctx.GetNode()
if err != nil {
return nil, err
@@ -57,7 +57,7 @@ func getBlock(height *int64) ([]byte, error) {
}
func GetChainHeight() (int64, error) {
node, err := core.NewCoreContextFromViper().GetNode()
node, err := context.NewCoreContextFromViper().GetNode()
if err != nil {
return -1, err
}
+2 -2
View File
@@ -10,7 +10,7 @@ import (
wire "github.com/tendermint/go-wire"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/core"
"github.com/cosmos/cosmos-sdk/client/context"
ctypes "github.com/tendermint/tendermint/rpc/core/types"
)
@@ -26,7 +26,7 @@ func statusCommand() *cobra.Command {
func getNodeStatus() (*ctypes.ResultStatus, error) {
// get the node
node, err := core.NewCoreContextFromViper().GetNode()
node, err := context.NewCoreContextFromViper().GetNode()
if err != nil {
return &ctypes.ResultStatus{}, err
}
+2 -2
View File
@@ -10,7 +10,7 @@ import (
"github.com/spf13/cobra"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/core"
"github.com/cosmos/cosmos-sdk/client/context"
)
func validatorCommand() *cobra.Command {
@@ -27,7 +27,7 @@ func validatorCommand() *cobra.Command {
func GetValidators(height *int64) ([]byte, error) {
// get the node
node, err := core.NewCoreContextFromViper().GetNode()
node, err := context.NewCoreContextFromViper().GetNode()
if err != nil {
return nil, err
}