-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_helpers.go
45 lines (35 loc) · 1.29 KB
/
test_helpers.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package testutil
import (
"fmt"
"github.com/tendermint/tendermint/libs/cli"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/testutil"
clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli"
htlccli "github.com/furynet/furymod/modules/htlc/client/cli"
)
// MsgRedelegateExec creates a redelegate message.
func CreateHTLCExec(clientCtx client.Context, from string, extraArgs ...string) (testutil.BufferWriter, error) {
args := []string{
fmt.Sprintf("--%s=%s", flags.FlagFrom, from),
}
args = append(args, extraArgs...)
return clitestutil.ExecTestCLICmd(clientCtx, htlccli.GetCmdCreateHTLC(), args)
}
func ClaimHTLCExec(clientCtx client.Context, from string, id string, secret string, extraArgs ...string) (testutil.BufferWriter, error) {
args := []string{
id,
secret,
fmt.Sprintf("--%s=%s", flags.FlagFrom, from),
}
args = append(args, extraArgs...)
return clitestutil.ExecTestCLICmd(clientCtx, htlccli.GetCmdClaimHTLC(), args)
}
func QueryHTLCExec(clientCtx client.Context, id string, extraArgs ...string) (testutil.BufferWriter, error) {
args := []string{
id,
fmt.Sprintf("--%s=json", cli.OutputFlag),
}
args = append(args, extraArgs...)
return clitestutil.ExecTestCLICmd(clientCtx, htlccli.GetCmdQueryHTLC(), args)
}