Moved Coins from types -> modules/coin
This commit is contained in:
@@ -9,8 +9,8 @@ import (
|
||||
txcmd "github.com/tendermint/light-client/commands/txs"
|
||||
|
||||
"github.com/tendermint/basecoin/docs/guide/counter/plugins/counter"
|
||||
"github.com/tendermint/basecoin/modules/coin"
|
||||
"github.com/tendermint/basecoin/txs"
|
||||
btypes "github.com/tendermint/basecoin/types"
|
||||
)
|
||||
|
||||
//CounterTxCmd is the CLI command to execute the counter
|
||||
@@ -70,7 +70,7 @@ func counterTx(cmd *cobra.Command, args []string) error {
|
||||
}
|
||||
|
||||
func readCounterTxFlags() (tx basecoin.Tx, err error) {
|
||||
feeCoins, err := btypes.ParseCoins(viper.GetString(FlagCountFee))
|
||||
feeCoins, err := coin.ParseCoins(viper.GetString(FlagCountFee))
|
||||
if err != nil {
|
||||
return tx, err
|
||||
}
|
||||
|
||||
@@ -11,7 +11,6 @@ import (
|
||||
"github.com/tendermint/basecoin/modules/coin"
|
||||
"github.com/tendermint/basecoin/stack"
|
||||
"github.com/tendermint/basecoin/state"
|
||||
"github.com/tendermint/basecoin/types"
|
||||
)
|
||||
|
||||
// Tx
|
||||
@@ -32,13 +31,13 @@ func init() {
|
||||
|
||||
// Tx - struct for all counter transactions
|
||||
type Tx struct {
|
||||
Valid bool `json:"valid"`
|
||||
Fee types.Coins `json:"fee"`
|
||||
Sequence int `json:"sequence"`
|
||||
Valid bool `json:"valid"`
|
||||
Fee coin.Coins `json:"fee"`
|
||||
Sequence int `json:"sequence"`
|
||||
}
|
||||
|
||||
// NewTx - return a new counter transaction struct wrapped as a basecoin transaction
|
||||
func NewTx(valid bool, fee types.Coins, sequence int) basecoin.Tx {
|
||||
func NewTx(valid bool, fee coin.Coins, sequence int) basecoin.Tx {
|
||||
return Tx{
|
||||
Valid: valid,
|
||||
Fee: fee,
|
||||
@@ -183,8 +182,8 @@ func StoreActor() basecoin.Actor {
|
||||
|
||||
// State - state of the counter applicaton
|
||||
type State struct {
|
||||
Counter int `json:"counter"`
|
||||
TotalFees types.Coins `json:"total_fees"`
|
||||
Counter int `json:"counter"`
|
||||
TotalFees coin.Coins `json:"total_fees"`
|
||||
}
|
||||
|
||||
// StateKey - store key for the counter state
|
||||
|
||||
@@ -10,7 +10,6 @@ import (
|
||||
"github.com/tendermint/basecoin/app"
|
||||
"github.com/tendermint/basecoin/modules/coin"
|
||||
"github.com/tendermint/basecoin/txs"
|
||||
"github.com/tendermint/basecoin/types"
|
||||
"github.com/tendermint/go-wire"
|
||||
eyescli "github.com/tendermint/merkleeyes/client"
|
||||
"github.com/tendermint/tmlibs/log"
|
||||
@@ -34,13 +33,13 @@ func TestCounterPlugin(t *testing.T) {
|
||||
bcApp.SetOption("base/chain_id", chainID)
|
||||
|
||||
// Account initialization
|
||||
bal := types.Coins{{"", 1000}, {"gold", 1000}}
|
||||
bal := coin.Coins{{"", 1000}, {"gold", 1000}}
|
||||
acct := coin.NewAccountWithKey(bal)
|
||||
log := bcApp.SetOption("coin/account", acct.MakeOption())
|
||||
require.Equal(t, "Success", log)
|
||||
|
||||
// Deliver a CounterTx
|
||||
DeliverCounterTx := func(valid bool, counterFee types.Coins, inputSequence int) abci.Result {
|
||||
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)
|
||||
@@ -58,10 +57,10 @@ func TestCounterPlugin(t *testing.T) {
|
||||
assert.True(res.IsErr(), res.String())
|
||||
|
||||
// Test the fee (increments sequence)
|
||||
res = DeliverCounterTx(true, types.Coins{{"gold", 100}}, 1)
|
||||
res = DeliverCounterTx(true, coin.Coins{{"gold", 100}}, 1)
|
||||
assert.True(res.IsOK(), res.String())
|
||||
|
||||
// Test unsupported fee
|
||||
res = DeliverCounterTx(true, types.Coins{{"silver", 100}}, 2)
|
||||
res = DeliverCounterTx(true, coin.Coins{{"silver", 100}}, 2)
|
||||
assert.True(res.IsErr(), res.String())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user