Moved content of txs package to sit next to the handlers

This commit is contained in:
Ethan Frey
2017-07-06 16:33:38 +02:00
parent a047e210fa
commit b757467f7b
18 changed files with 169 additions and 159 deletions
@@ -9,8 +9,9 @@ import (
txcmd "github.com/tendermint/light-client/commands/txs"
"github.com/tendermint/basecoin/docs/guide/counter/plugins/counter"
"github.com/tendermint/basecoin/modules/auth"
"github.com/tendermint/basecoin/modules/base"
"github.com/tendermint/basecoin/modules/coin"
"github.com/tendermint/basecoin/txs"
)
//CounterTxCmd is the CLI command to execute the counter
@@ -56,8 +57,8 @@ func counterTx(cmd *cobra.Command, args []string) error {
// TODO: make this more flexible for middleware
// add the chain info
tx = txs.NewChain(commands.GetChainID(), tx)
stx := txs.NewSig(tx)
tx = base.NewChainTx(commands.GetChainID(), tx)
stx := auth.NewSig(tx)
// Sign if needed and post. This it the work-horse
bres, err := txcmd.SignAndPostTx(stx)
@@ -8,8 +8,9 @@ import (
"github.com/stretchr/testify/require"
abci "github.com/tendermint/abci/types"
"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/txs"
"github.com/tendermint/go-wire"
eyescli "github.com/tendermint/merkleeyes/client"
"github.com/tendermint/tmlibs/log"
@@ -41,9 +42,9 @@ func TestCounterPlugin(t *testing.T) {
// Deliver a CounterTx
DeliverCounterTx := func(valid bool, counterFee coin.Coins, inputSequence int) abci.Result {
tx := NewTx(valid, counterFee, inputSequence)
tx = txs.NewChain(chainID, tx)
stx := txs.NewSig(tx)
txs.Sign(stx, acct.Key)
tx = base.NewChainTx(chainID, tx)
stx := auth.NewSig(tx)
auth.Sign(stx, acct.Key)
txBytes := wire.BinaryBytes(stx.Wrap())
return bcApp.DeliverTx(txBytes)
}