-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcli.go
76 lines (62 loc) · 1.5 KB
/
cli.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
73
74
75
76
package main
import (
"./cli"
"github.com/eoscanada/eos-go"
)
var (
api *eos.API
)
func init() {
rpc := "https://api.eosnewyork.io"
key := "5KdB3AtHrJFZez87KHAQej4ucZ7NAwN2VenB1D9fVDSMdGFq4jK"
api = eos.New(rpc)
signer := eos.NewKeyBag()
signer.ImportPrivateKey(key)
api.SetSigner(signer)
}
func main() {
transfer()
}
func transfer() {
from := eos.AN("xxxxxaccount")
to := eos.AN("yyyyyaccount")
quantity, _ := eos.NewEOSAssetFromString("0.0001 EOS")
memo := ""
code := eos.AN("eosio.token")
cli.Transfer(api, from, to, quantity, memo, code)
}
func buyRam() {
cli.BuyRam(api, eos.AN("xxxxxaccount"), eos.AN("xxxxxaccount"), 1*1024)
}
func sellRam() {
cli.SellRam(api, eos.AN("xxxxxaccount"), 1*1024)
}
func delegateBW() {
from := eos.AN("xxxxxaccount")
receiver := eos.AN("xxxxxaccount")
cpuStake, _ := eos.NewAsset("0.0001 EOS")
netStake, _ := eos.NewAsset("0.0001 EOS")
cli.DelegateBW(api, from, receiver, cpuStake, netStake, false)
}
func undelegateBW() {
from := eos.AN("xxxxxaccount")
receiver := eos.AN("xxxxxaccount")
cpuStake, _ := eos.NewAsset("0.0001 EOS")
netStake, _ := eos.NewAsset("0.0001 EOS")
cli.UndelegateBW(api, from, receiver, cpuStake, netStake)
}
func newKeyPair() {
cli.NewKeyPair()
}
func getCurrencyBalance() {
account := eos.AN("xxxxxaccount")
symbol := "EOS"
tokenAccount := eos.AN("eosio.token")
cli.GetCurrencyBalance(api, account, symbol, tokenAccount)
}
func getInfo() {
cli.GetInfo(api)
}
func getAccount() {
cli.GetAccount(api, eos.AN("xxxxxaccount"))
}