2020-05-04 06:55:16 -07:00
|
|
|
package testutil
|
2020-04-29 08:52:30 -07:00
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
2020-04-29 19:36:34 -07:00
|
|
|
|
2020-08-17 05:47:31 -07:00
|
|
|
"github.com/tendermint/tendermint/libs/cli"
|
|
|
|
|
2020-09-08 09:09:50 -07:00
|
|
|
"github.com/cosmos/cosmos-sdk/client"
|
2020-07-14 11:37:14 -07:00
|
|
|
"github.com/cosmos/cosmos-sdk/testutil"
|
|
|
|
clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli"
|
2020-07-02 06:02:28 -07:00
|
|
|
bankcli "github.com/cosmos/cosmos-sdk/x/bank/client/cli"
|
2020-04-29 08:52:30 -07:00
|
|
|
)
|
|
|
|
|
2020-07-14 11:37:14 -07:00
|
|
|
func MsgSendExec(clientCtx client.Context, from, to, amount fmt.Stringer, extraArgs ...string) (testutil.BufferWriter, error) {
|
2020-07-02 06:02:28 -07:00
|
|
|
args := []string{from.String(), to.String(), amount.String()}
|
|
|
|
args = append(args, extraArgs...)
|
|
|
|
|
2020-07-14 11:37:14 -07:00
|
|
|
return clitestutil.ExecTestCLICmd(clientCtx, bankcli.NewSendTxCmd(), args)
|
|
|
|
}
|
2020-07-02 06:02:28 -07:00
|
|
|
|
2020-07-14 11:37:14 -07:00
|
|
|
func QueryBalancesExec(clientCtx client.Context, address fmt.Stringer, extraArgs ...string) (testutil.BufferWriter, error) {
|
2020-08-17 05:47:31 -07:00
|
|
|
args := []string{address.String(), fmt.Sprintf("--%s=json", cli.OutputFlag)}
|
2020-07-14 11:37:14 -07:00
|
|
|
args = append(args, extraArgs...)
|
2020-07-02 06:02:28 -07:00
|
|
|
|
2020-07-14 11:37:14 -07:00
|
|
|
return clitestutil.ExecTestCLICmd(clientCtx, bankcli.GetBalancesCmd(), args)
|
2020-07-02 06:02:28 -07:00
|
|
|
}
|