-
Notifications
You must be signed in to change notification settings - Fork 18
/
cmd.go
72 lines (60 loc) · 1.67 KB
/
cmd.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
package coins
import (
"fmt"
"github.com/QOSGroup/qstars/config"
"github.com/QOSGroup/qstars/wire"
"github.com/spf13/cobra"
"github.com/spf13/viper"
)
const (
flag_address="address"
flag_acoin="coin"
flag_causecode="causecode"
flag_causestrings="causestrings"
flag_tx="tx"
)
// SendTxCmd will create a send tx and sign it with the given key.
func DispatchAOECmd(cdc *wire.Codec) *cobra.Command {
cmd := &cobra.Command{
Use: "DispatchAoe",
Short: "Dispatch AOE and send tx",
RunE: func(cmd *cobra.Command, args []string) error {
defer func() {
if r := recover(); r != nil {
fmt.Println(r)
}
}()
toStr := viper.GetString("address")
coin := viper.GetString("coin")
causecode:=viper.GetString("causecode")
causestrings:=viper.GetString("causestrings")
result := DispatchAOE(cdc,config.GetCLIContext().Config,toStr,coin,causecode,causestrings,"0")
fmt.Println(result)
return nil
},
}
cmd.Flags().String(flag_address, "", "Address to send coins")
cmd.Flags().String(flag_acoin, "", "Address to send coins")
cmd.Flags().String(flag_causecode, "", "Address to send coins")
cmd.Flags().String(flag_causestrings, "", "Address to send coins")
return cmd
}
func QueryCoinsCmd(cdc *wire.Codec) *cobra.Command {
cmd := &cobra.Command{
Use: "QueryCoins",
Short: "query coins and send tx",
RunE: func(cmd *cobra.Command, args []string) error {
defer func() {
if r := recover(); r != nil {
fmt.Println(r)
}
}()
tx := viper.GetString(flag_tx)
result:= GetCoins(cdc,config.GetCLIContext().QSCCliContext,tx)
fmt.Println(result)
return nil
},
}
cmd.Flags().String(flag_tx, "", "query coins by tx")
return cmd
}