Skip to content

Commit

Permalink
Merge branch 'master' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
ebuchman committed Apr 9, 2018
2 parents e17f486 + 40ed65d commit 98f7396
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 249 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ BREAKING CHANGES

* Remove go-wire, use go-amino

## 0.14.1 (April 9, 2018)

BUG FIXES

* [gaiacli] Fix all commands (just a duplicate of basecli for now)

## 0.14.0 (April 9, 2018)

BREAKING CHANGES:
Expand Down
131 changes: 0 additions & 131 deletions cmd/gaiacli/client.go

This file was deleted.

77 changes: 0 additions & 77 deletions cmd/gaiacli/key.go

This file was deleted.

93 changes: 52 additions & 41 deletions cmd/gaiacli/main.go
Original file line number Diff line number Diff line change
@@ -1,77 +1,88 @@
package main

import (
"errors"
"os"

"github.com/spf13/cobra"

"github.com/tendermint/tmlibs/cli"

"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/keys"
"github.com/cosmos/cosmos-sdk/client/lcd"
"github.com/cosmos/cosmos-sdk/client/rpc"
"github.com/cosmos/cosmos-sdk/client/tx"

"github.com/cosmos/cosmos-sdk/version"
)
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"

const (
flagTo = "to"
flagAmount = "amount"
flagFee = "fee"
"github.com/cosmos/cosmos-sdk/examples/basecoin/app"
"github.com/cosmos/cosmos-sdk/examples/basecoin/types"
)

// TODO: distinguish from basecli

// rootCmd is the entry point for this binary
var (
rootCmd = &cobra.Command{
Use: "gaiacli",
Short: "Gaia light-client",
}

lineBreak = &cobra.Command{Run: func(*cobra.Command, []string) {}}

getAccountCmd = &cobra.Command{
Use: "account <address>",
Short: "Query account balance",
RunE: todoNotImplemented,
}
)

func todoNotImplemented(_ *cobra.Command, _ []string) error {
return errors.New("TODO: Command not yet implemented")
}

func postSendCommand() *cobra.Command {
cmd := &cobra.Command{
Use: "send",
Short: "Create and sign a send tx",
RunE: todoNotImplemented,
}
cmd.Flags().String(flagTo, "", "Address to send coins")
cmd.Flags().String(flagAmount, "", "Amount of coins to send")
cmd.Flags().String(flagFee, "", "Fee to pay along with transaction")
return cmd
}

func main() {
// disable sorting
cobra.EnableCommandSorting = false

// generic client commands
AddClientCommands(rootCmd)
// query commands (custom to binary)
// get the codec
cdc := app.MakeCodec()

// TODO: setup keybase, viper object, etc. to be passed into
// the below functions and eliminate global vars, like we do
// with the cdc

// add standard rpc, and tx commands
rpc.AddCommands(rootCmd)
rootCmd.AddCommand(client.LineBreak)
tx.AddCommands(rootCmd, cdc)
rootCmd.AddCommand(client.LineBreak)

// add query/post commands (custom to binary)
rootCmd.AddCommand(
client.GetCommands(
authcmd.GetAccountCmd("main", cdc, types.GetAccountDecoder(cdc)),
)...)
rootCmd.AddCommand(
client.PostCommands(
bankcmd.SendTxCmd(cdc),
)...)
rootCmd.AddCommand(
client.PostCommands(
ibccmd.IBCTransferCmd(cdc),
)...)
rootCmd.AddCommand(
GetCommands(getAccountCmd)...)
// post tx commands (custom to binary)
client.PostCommands(
ibccmd.IBCRelayCmd(cdc),
simplestakingcmd.BondTxCmd(cdc),
)...)
rootCmd.AddCommand(
PostCommands(postSendCommand())...)
client.PostCommands(
simplestakingcmd.UnbondTxCmd(cdc),
)...)

// add proxy, version and key info
rootCmd.AddCommand(
lineBreak,
serveCommand(),
KeyCommands(),
lineBreak,
client.LineBreak,
lcd.ServeCommand(cdc),
keys.Commands(),
client.LineBreak,
version.VersionCmd,
)

// prepare and add flags
executor := cli.PrepareBaseCmd(rootCmd, "GA", os.ExpandEnv("$HOME/.gaiacli"))
executor := cli.PrepareMainCmd(rootCmd, "BC", os.ExpandEnv("$HOME/.gaiacli"))
executor.Execute()
}

0 comments on commit 98f7396

Please sign in to comment.