-
Notifications
You must be signed in to change notification settings - Fork 2
/
sdkv2_test.go
67 lines (61 loc) · 1.88 KB
/
sdkv2_test.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
package CocosSDK
import (
//"encoding/json"
//"CocosSDK/type"
//"CocosSDK/rpc"
"testing"
)
func TestInitSdk2(t *testing.T) {
InitSDK("test.cocosbcx.net", true)
}
func TestWallet(t *testing.T) {
//导入账户
Wallet.ImportAccount("ggggxxx", "12345678")
//设置默认账户
t.Log(Wallet.SetDefaultAccount("ggggxxx", "12345678"))
}
func TestTransfer(t *testing.T) {
t.Log(Wallet.Default.GetActiveKey().GetPublicKey().ToBase58String())
t.Log(Wallet.Default.GetOwnerKey().GetPublicKey().ToBase58String())
t.Log(Wallet.Transfer("test1", "COCOS", 1))
t.Log(Wallet.Transfer("test1", "COCOS", 1, "xxxx"))
t.Log(Wallet.TransferEncodeMemo("test1", "COCOS", 1, "xxxx"))
//查询投票信息
//vote_info := GetVotingInfo()
//t.Log(vote_info)
//Wallet.Transfer("ximenyan1111", "COCOS", 1, "xixixi")
//Wallet.UpgradeAccount("ximenyan1111")
//Wallet.RegisterNhAssetCreator("ximenyan1111")
//CreateToken("C5C5S", 1000000, 3)
//IssueToken("C4C4S", "gggg2", 1000)
//ReserveToken("C4C4S", 1)
//Wallet.RegisterNhAssetCreator("gggg2")
UpdateToken("C5C5S", 10000000, 7)
//CreateWorldView("BCX")
//CreateNhAsset("COCOS", "BCX", "gggg1", `{"name":"乾坤大挪移"}`)
//SellNhAsset("ximenyan1111", "4.2.1", "便宜货...", COCOS_ID, COCOS_ID, 5, 100)
//CancelNhAssetOrder("4.3.0")
//FillNhAsset("4.3.1")
//DeleteNhAsset("4.2.0")
//ReviseContractByFile("contract.test12343", "./test.lua")
//TransferNhAsset("gggg2", "4.2.2")
//t.Log(wallet.CreateKey().GetPublicKey().ToBase58String())
/*
//质押gas
hash, err := Pledgegas("gggg2", 100)
t.Log(hash, err)
//赎回
hash, err = Pledgegas("gggg2", 0)
t.Log(hash, err)
//投票
hash, err = Vote("1.5.6", 100)
t.Log(hash, err)
//投票赎回
hash, err = Vote("1.5.6", 0)
t.Log(hash, err)
//查询可领取的冻结资产
GetVestingBalances()
//领取冻结资产
hash, err = WithdrawVestingBalance("1.13.30")
t.Log(hash, err)*/
}