connected stake cli

This commit is contained in:
rigelrozanski 2018-04-06 14:35:54 -04:00
parent f8e44b5b00
commit f7437fd899
7 changed files with 24 additions and 26 deletions

View File

@ -15,6 +15,7 @@ import (
"github.com/cosmos/cosmos-sdk/x/bank"
"github.com/cosmos/cosmos-sdk/x/ibc"
"github.com/cosmos/cosmos-sdk/x/simplestake"
"github.com/cosmos/cosmos-sdk/x/stake"
"github.com/cosmos/cosmos-sdk/examples/basecoin/types"
)
@ -32,7 +33,7 @@ type BasecoinApp struct {
capKeyMainStore *sdk.KVStoreKey
capKeyAccountStore *sdk.KVStoreKey
capKeyIBCStore *sdk.KVStoreKey
capKeyStakingStore *sdk.KVStoreKey
capKeyStakeStore *sdk.KVStoreKey
// Manage getting and setting accounts
accountMapper sdk.AccountMapper
@ -53,7 +54,7 @@ func NewBasecoinApp(logger log.Logger, db dbm.DB) *BasecoinApp {
capKeyMainStore: sdk.NewKVStoreKey("main"),
capKeyAccountStore: sdk.NewKVStoreKey("acc"),
capKeyIBCStore: sdk.NewKVStoreKey("ibc"),
capKeyStakingStore: sdk.NewKVStoreKey("stake"),
capKeyStakeStore: sdk.NewKVStoreKey("stake"),
}
// Define the accountMapper.
@ -70,7 +71,7 @@ func NewBasecoinApp(logger log.Logger, db dbm.DB) *BasecoinApp {
app.Router().
AddRoute("bank", bank.NewHandler(coinKeeper)).
AddRoute("ibc", ibc.NewHandler(ibcMapper, coinKeeper)).
AddRoute("simplestake", simplestake.NewHandler(stakeKeeper))
AddRoute("stake", stake.NewHandler(stakeKeeper))
// Define the feeHandler.
app.feeHandler = auth.BurnFeeHandler

View File

@ -143,7 +143,7 @@ func TestSortGenesis(t *testing.T) {
// Note the order: the coins are unsorted!
coinDenom1, coinDenom2 := "foocoin", "barcoin"
genState := fmt.Sprintf(`{
str := `{
"accounts": [{
"address": "%s",
"coins": [
@ -157,7 +157,8 @@ func TestSortGenesis(t *testing.T) {
}
]
}]
}`, addr1.String(), coinDenom1, coinDenom2)
}`
genState := fmt.Sprintf(str, addr1.String(), coinDenom1, coinDenom2)
// Initialize the chain
vals := []abci.Validator{}

View File

@ -17,7 +17,7 @@ import (
authcmd "github.com/cosmos/cosmos-sdk/x/auth/commands"
bankcmd "github.com/cosmos/cosmos-sdk/x/bank/commands"
ibccmd "github.com/cosmos/cosmos-sdk/x/ibc/commands"
simplestakingcmd "github.com/cosmos/cosmos-sdk/x/simplestake/commands"
stakecmd "github.com/cosmos/cosmos-sdk/x/stake/commands"
"github.com/cosmos/cosmos-sdk/examples/basecoin/app"
"github.com/cosmos/cosmos-sdk/examples/basecoin/types"
@ -52,23 +52,20 @@ func main() {
rootCmd.AddCommand(
client.GetCommands(
authcmd.GetAccountCmd("main", cdc, types.GetAccountDecoder(cdc)),
stakecmd.GetCmdQueryCandidates("stake", cdc),
stakecmd.GetCmdQueryCandidate("stake", cdc),
stakecmd.GetCmdQueryDelegatorBond("stake", cdc),
stakecmd.GetCmdQueryDelegatorBonds("stake", cdc),
)...)
rootCmd.AddCommand(
client.PostCommands(
bankcmd.SendTxCmd(cdc),
)...)
rootCmd.AddCommand(
client.PostCommands(
ibccmd.IBCTransferCmd(cdc),
)...)
rootCmd.AddCommand(
client.PostCommands(
ibccmd.IBCRelayCmd(cdc),
simplestakingcmd.BondTxCmd(cdc),
)...)
rootCmd.AddCommand(
client.PostCommands(
simplestakingcmd.UnbondTxCmd(cdc),
stakecmd.GetCmdDeclareCandidacy(cdc),
stakecmd.GetCmdEditCandidacy(cdc),
stakecmd.GetCmdDelegate(cdc),
stakecmd.GetCmdUnbond(cdc),
)...)
// add proxy, version and key info

View File

@ -38,7 +38,7 @@ func init() {
}
// create command to query for all candidates
func GetCmdQueryCandidates(cdc *wire.Codec, storeName string) *cobra.Command {
func GetCmdQueryCandidates(storeName string, cdc *wire.Codec) *cobra.Command {
cmd := &cobra.Command{
Use: "candidates",
Short: "Query for the set of validator-candidates pubkeys",
@ -74,7 +74,7 @@ func GetCmdQueryCandidates(cdc *wire.Codec, storeName string) *cobra.Command {
}
// get the command to query a candidate
func GetCmdQueryCandidate(cdc *wire.Codec, storeName string) *cobra.Command {
func GetCmdQueryCandidate(storeName string, cdc *wire.Codec) *cobra.Command {
cmd := &cobra.Command{
Use: "candidate",
Short: "Query a validator-candidate account",
@ -116,7 +116,7 @@ func GetCmdQueryCandidate(cdc *wire.Codec, storeName string) *cobra.Command {
}
// get the command to query a single delegator bond
func GetCmdQueryDelegatorBond(cdc *wire.Codec, storeName string) *cobra.Command {
func GetCmdQueryDelegatorBond(storeName string, cdc *wire.Codec) *cobra.Command {
cmd := &cobra.Command{
Use: "delegator-bond",
Short: "Query a delegators bond based on address and candidate pubkey",
@ -165,7 +165,7 @@ func GetCmdQueryDelegatorBond(cdc *wire.Codec, storeName string) *cobra.Command
}
// get the command to query all the candidates bonded to a delegator
func GetCmdQueryDelegatorBonds(cdc *wire.Codec, storeName string) *cobra.Command {
func GetCmdQueryDelegatorBonds(storeName string, cdc *wire.Codec) *cobra.Command {
cmd := &cobra.Command{
Use: "delegator-candidates",
Short: "Query all delegators candidates' pubkeys based on address",

View File

@ -20,8 +20,8 @@ import (
// nolint
const (
FlagAddressDelegator = "addressD"
FlagAddressCandidate = "addressC"
FlagAddressDelegator = "address-delegator"
FlagAddressCandidate = "address-candidate"
FlagPubKey = "pubkey"
FlagAmount = "amount"
FlagShares = "shares"

View File

@ -4,7 +4,6 @@ import (
"bytes"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/bank"
abci "github.com/tendermint/abci/types"
)
@ -18,7 +17,7 @@ const (
//_______________________________________________________________________
func NewHandler(k Keeper, ck bank.CoinKeeper) sdk.Handler {
func NewHandler(k Keeper) sdk.Handler {
return func(ctx sdk.Context, msg sdk.Msg) sdk.Result {
// NOTE msg already has validate basic run
switch msg := msg.(type) {

View File

@ -4,7 +4,7 @@ import (
"github.com/cosmos/cosmos-sdk/wire"
)
// XXX complete
// TODO complete when go-amino is ported
func RegisterWire(cdc *wire.Codec) {
// TODO include option to always include prefix bytes.
//cdc.RegisterConcrete(SendMsg{}, "cosmos-sdk/SendMsg", nil)