forked from eoscanada/eosc
/
systemUndelegateBW.go
35 lines (28 loc) · 1.07 KB
/
systemUndelegateBW.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
package cmd
import (
"context"
"github.com/sebastianmontero/eos-go/system"
"github.com/spf13/cobra"
)
var systemUndelegateBWCmd = &cobra.Command{
Use: "undelegatebw [from] [receiver] [network bw unstake qty] [cpu bw unstake qty]",
Short: "Undelegate some CPU and Network bandwidth.",
Long: `Undelegate some CPU and Network bandwidth.
When undelegating bandwidth, a "refund" action will automatically be
triggered and delayed for 72 hours. This means it takes 3 days for
you to get your EOS back and being able to transfer it. However, your
voting power is immediately altered.
See also: the "system delegatebw" command.
`,
Args: cobra.ExactArgs(4),
Run: func(cmd *cobra.Command, args []string) {
from := toAccount(args[0], "from")
receiver := toAccount(args[1], "receiver")
netStake := toCoreAsset(args[2], "network bw unstake qty")
cpuStake := toCoreAsset(args[3], "cpu bw unstake qty")
pushEOSCActions(context.Background(), getAPI(), system.NewUndelegateBW(from, receiver, cpuStake, netStake))
},
}
func init() {
systemCmd.AddCommand(systemUndelegateBWCmd)
}