Rename all packages and imports to cosmos-sdk

This commit is contained in:
Ethan Frey
2017-08-21 22:15:15 +01:00
parent 8a430648e4
commit 041943c441
140 changed files with 1016 additions and 1016 deletions
+3 -3
View File
@@ -7,9 +7,9 @@ import (
"github.com/tendermint/tmlibs/cli"
client "github.com/tendermint/basecoin/client/commands"
"github.com/tendermint/basecoin/cmd/basecoin/commands"
"github.com/tendermint/basecoin/docs/guide/counter/plugins/counter"
client "github.com/cosmos/cosmos-sdk/client/commands"
"github.com/cosmos/cosmos-sdk/cmd/basecoin/commands"
"github.com/cosmos/cosmos-sdk/docs/guide/counter/plugins/counter"
)
func main() {
@@ -4,10 +4,10 @@ import (
"github.com/spf13/cobra"
"github.com/spf13/viper"
"github.com/tendermint/basecoin"
txcmd "github.com/tendermint/basecoin/client/commands/txs"
"github.com/tendermint/basecoin/docs/guide/counter/plugins/counter"
"github.com/tendermint/basecoin/modules/coin"
sdk "github.com/cosmos/cosmos-sdk"
txcmd "github.com/cosmos/cosmos-sdk/client/commands/txs"
"github.com/cosmos/cosmos-sdk/docs/guide/counter/plugins/counter"
"github.com/cosmos/cosmos-sdk/modules/coin"
)
//CounterTxCmd is the CLI command to execute the counter
@@ -41,7 +41,7 @@ func counterTx(cmd *cobra.Command, args []string) error {
return txcmd.DoTx(tx)
}
func readCounterTxFlags() (tx basecoin.Tx, err error) {
func readCounterTxFlags() (tx sdk.Tx, err error) {
feeCoins, err := coin.ParseCoins(viper.GetString(FlagCountFee))
if err != nil {
return tx, err
@@ -4,11 +4,11 @@ import (
"github.com/spf13/cobra"
"github.com/spf13/viper"
"github.com/tendermint/basecoin/client/commands"
"github.com/tendermint/basecoin/client/commands/query"
"github.com/cosmos/cosmos-sdk/client/commands"
"github.com/cosmos/cosmos-sdk/client/commands/query"
"github.com/tendermint/basecoin/docs/guide/counter/plugins/counter"
"github.com/tendermint/basecoin/stack"
"github.com/cosmos/cosmos-sdk/docs/guide/counter/plugins/counter"
"github.com/cosmos/cosmos-sdk/stack"
)
//CounterQueryCmd - CLI command to query the counter state
+11 -11
View File
@@ -8,17 +8,17 @@ import (
keycmd "github.com/tendermint/go-crypto/cmd"
"github.com/tendermint/tmlibs/cli"
"github.com/tendermint/basecoin/client/commands"
"github.com/tendermint/basecoin/client/commands/proxy"
"github.com/tendermint/basecoin/client/commands/query"
"github.com/tendermint/basecoin/client/commands/seeds"
txcmd "github.com/tendermint/basecoin/client/commands/txs"
bcount "github.com/tendermint/basecoin/docs/guide/counter/cmd/countercli/commands"
authcmd "github.com/tendermint/basecoin/modules/auth/commands"
basecmd "github.com/tendermint/basecoin/modules/base/commands"
coincmd "github.com/tendermint/basecoin/modules/coin/commands"
feecmd "github.com/tendermint/basecoin/modules/fee/commands"
noncecmd "github.com/tendermint/basecoin/modules/nonce/commands"
"github.com/cosmos/cosmos-sdk/client/commands"
"github.com/cosmos/cosmos-sdk/client/commands/proxy"
"github.com/cosmos/cosmos-sdk/client/commands/query"
"github.com/cosmos/cosmos-sdk/client/commands/seeds"
txcmd "github.com/cosmos/cosmos-sdk/client/commands/txs"
bcount "github.com/cosmos/cosmos-sdk/docs/guide/counter/cmd/countercli/commands"
authcmd "github.com/cosmos/cosmos-sdk/modules/auth/commands"
basecmd "github.com/cosmos/cosmos-sdk/modules/base/commands"
coincmd "github.com/cosmos/cosmos-sdk/modules/coin/commands"
feecmd "github.com/cosmos/cosmos-sdk/modules/fee/commands"
noncecmd "github.com/cosmos/cosmos-sdk/modules/nonce/commands"
)
// BaseCli represents the base command when called without any subcommands
+21 -21
View File
@@ -6,17 +6,17 @@ import (
abci "github.com/tendermint/abci/types"
"github.com/tendermint/go-wire"
"github.com/tendermint/basecoin"
"github.com/tendermint/basecoin/errors"
"github.com/tendermint/basecoin/modules/auth"
"github.com/tendermint/basecoin/modules/base"
"github.com/tendermint/basecoin/modules/coin"
"github.com/tendermint/basecoin/modules/fee"
"github.com/tendermint/basecoin/modules/ibc"
"github.com/tendermint/basecoin/modules/nonce"
"github.com/tendermint/basecoin/modules/roles"
"github.com/tendermint/basecoin/stack"
"github.com/tendermint/basecoin/state"
sdk "github.com/cosmos/cosmos-sdk"
"github.com/cosmos/cosmos-sdk/errors"
"github.com/cosmos/cosmos-sdk/modules/auth"
"github.com/cosmos/cosmos-sdk/modules/base"
"github.com/cosmos/cosmos-sdk/modules/coin"
"github.com/cosmos/cosmos-sdk/modules/fee"
"github.com/cosmos/cosmos-sdk/modules/ibc"
"github.com/cosmos/cosmos-sdk/modules/nonce"
"github.com/cosmos/cosmos-sdk/modules/roles"
"github.com/cosmos/cosmos-sdk/stack"
"github.com/cosmos/cosmos-sdk/state"
)
// Tx
@@ -32,7 +32,7 @@ const (
)
func init() {
basecoin.TxMapper.RegisterImplementation(Tx{}, TypeTx, ByteTx)
sdk.TxMapper.RegisterImplementation(Tx{}, TypeTx, ByteTx)
}
// Tx - struct for all counter transactions
@@ -42,7 +42,7 @@ type Tx struct {
}
// NewTx - return a new counter transaction struct wrapped as a basecoin transaction
func NewTx(valid bool, fee coin.Coins) basecoin.Tx {
func NewTx(valid bool, fee coin.Coins) sdk.Tx {
return Tx{
Valid: valid,
Fee: fee,
@@ -50,8 +50,8 @@ func NewTx(valid bool, fee coin.Coins) basecoin.Tx {
}
// Wrap - Wrap a Tx as a Basecoin Tx, used to satisfy the XXX interface
func (c Tx) Wrap() basecoin.Tx {
return basecoin.Tx{TxInner: c}
func (c Tx) Wrap() sdk.Tx {
return sdk.Tx{TxInner: c}
}
// ValidateBasic just makes sure the Fee is a valid, non-negative value
@@ -91,7 +91,7 @@ func ErrDecoding() error {
//--------------------------------------------------------------------------------
// NewHandler returns a new counter transaction processing handler
func NewHandler(feeDenom string) basecoin.Handler {
func NewHandler(feeDenom string) sdk.Handler {
return stack.New(
base.Logger{},
stack.Recovery{},
@@ -129,13 +129,13 @@ func (Handler) Name() string {
func (Handler) AssertDispatcher() {}
// CheckTx checks if the tx is properly structured
func (h Handler) CheckTx(ctx basecoin.Context, store state.SimpleDB, tx basecoin.Tx, _ basecoin.Checker) (res basecoin.CheckResult, err error) {
func (h Handler) CheckTx(ctx sdk.Context, store state.SimpleDB, tx sdk.Tx, _ sdk.Checker) (res sdk.CheckResult, err error) {
_, err = checkTx(ctx, tx)
return
}
// DeliverTx executes the tx if valid
func (h Handler) DeliverTx(ctx basecoin.Context, store state.SimpleDB, tx basecoin.Tx, dispatch basecoin.Deliver) (res basecoin.DeliverResult, err error) {
func (h Handler) DeliverTx(ctx sdk.Context, store state.SimpleDB, tx sdk.Tx, dispatch sdk.Deliver) (res sdk.DeliverResult, err error) {
ctr, err := checkTx(ctx, tx)
if err != nil {
return res, err
@@ -175,7 +175,7 @@ func (h Handler) DeliverTx(ctx basecoin.Context, store state.SimpleDB, tx baseco
return res, err
}
func checkTx(ctx basecoin.Context, tx basecoin.Tx) (ctr Tx, err error) {
func checkTx(ctx sdk.Context, tx sdk.Tx) (ctr Tx, err error) {
ctr, ok := tx.Unwrap().(Tx)
if !ok {
return ctr, errors.ErrInvalidFormat(TypeTx, tx)
@@ -191,8 +191,8 @@ func checkTx(ctx basecoin.Context, tx basecoin.Tx) (ctr Tx, err error) {
//--------------------------------------------------------------------------------
// StoreActor - return the basecoin actor for the account
func StoreActor() basecoin.Actor {
return basecoin.Actor{App: NameCounter, Address: []byte{0x04, 0x20}} //XXX what do these bytes represent? - should use typebyte variables
func StoreActor() sdk.Actor {
return sdk.Actor{App: NameCounter, Address: []byte{0x04, 0x20}} //XXX what do these bytes represent? - should use typebyte variables
}
// State - state of the counter applicaton
@@ -10,12 +10,12 @@ import (
"github.com/tendermint/go-wire"
"github.com/tendermint/tmlibs/log"
"github.com/tendermint/basecoin"
"github.com/tendermint/basecoin/app"
"github.com/tendermint/basecoin/modules/auth"
"github.com/tendermint/basecoin/modules/base"
"github.com/tendermint/basecoin/modules/coin"
"github.com/tendermint/basecoin/modules/nonce"
sdk "github.com/cosmos/cosmos-sdk"
"github.com/cosmos/cosmos-sdk/app"
"github.com/cosmos/cosmos-sdk/modules/auth"
"github.com/cosmos/cosmos-sdk/modules/base"
"github.com/cosmos/cosmos-sdk/modules/coin"
"github.com/cosmos/cosmos-sdk/modules/nonce"
)
func TestCounterPlugin(t *testing.T) {
@@ -47,7 +47,7 @@ func TestCounterPlugin(t *testing.T) {
// Deliver a CounterTx
DeliverCounterTx := func(valid bool, counterFee coin.Coins, sequence uint32) abci.Result {
tx := NewTx(valid, counterFee)
tx = nonce.NewTx(sequence, []basecoin.Actor{acct.Actor()}, tx)
tx = nonce.NewTx(sequence, []sdk.Actor{acct.Actor()}, tx)
tx = base.NewChainTx(chainID, 0, tx)
stx := auth.NewSig(tx)
auth.Sign(stx, acct.Key)