forked from eoscanada/eosc
/
systemBidname.go
44 lines (33 loc) · 1.22 KB
/
systemBidname.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
package cmd
import (
"context"
"fmt"
"github.com/sebastianmontero/eos-go/system"
"github.com/spf13/cobra"
)
var systemBidnameCmd = &cobra.Command{
Use: "bidname [bidder_account_name] [premium_account_name] [bid quantity]",
Short: "Bid on a premium account name.",
Long: `Bid on a premium account name
All fields are required. Example usage:
eosc system bidname your_account_name eos "10.0000 EOS"
Please note you could be locking up your funds in the name bidding
auction if you don't intend to go through and being the highest
bidder.
Read https://steemit.com/eos/@eos-canada/everything-you-need-to-know-about-namespace-bidding-on-eos for more infos.
`,
Args: cobra.ExactArgs(3),
Run: func(cmd *cobra.Command, args []string) {
api := getAPI()
bidder := toAccount(args[0], "bidder_account_name")
newname := toAccount(args[1], "premium_account_name")
bidAsset := toCoreAsset(args[2], "bid quantity")
fmt.Printf("[%s] bidding for: %s , amount=%d precision=%d symbol=%s\n", bidder, newname, bidAsset.Amount, bidAsset.Symbol.Precision, bidAsset.Symbol.Symbol)
pushEOSCActions(context.Background(), api,
system.NewBidname(bidder, newname, bidAsset),
)
},
}
func init() {
systemCmd.AddCommand(systemBidnameCmd)
}