Commit a29fddf3 authored by jiangpeng's avatar jiangpeng

update chain33 wallet func invoke

parent 6cefc773
......@@ -65,15 +65,15 @@ func testTicket(t *testing.T) {
//fmt.Println(string(js))
_, err = mock33.GetAPI().ExecWalletFunc("ticket", "WalletAutoMiner", &ty.MinerFlag{Flag: 0})
assert.Nil(t, err)
status, err := mock33.GetAPI().GetWalletStatus()
status, err := mock33.GetAPI().ExecWalletFunc("wallet", "GetWalletStatus", &types.ReqNil{})
assert.Nil(t, err)
assert.Equal(t, false, status.IsAutoMining)
assert.Equal(t, false, status.(*types.WalletStatus).IsAutoMining)
assert.Equal(t, int32(2), detail.Receipt.Ty)
_, err = mock33.GetAPI().ExecWalletFunc("ticket", "WalletAutoMiner", &ty.MinerFlag{Flag: 1})
assert.Nil(t, err)
status, err = mock33.GetAPI().GetWalletStatus()
status, err = mock33.GetAPI().ExecWalletFunc("wallet", "GetWalletStatus", &types.ReqNil{})
assert.Nil(t, err)
assert.Equal(t, true, status.IsAutoMining)
assert.Equal(t, true, status.(*types.WalletStatus).IsAutoMining)
start := time.Now()
height := int64(0)
hastclose := false
......@@ -84,7 +84,8 @@ func testTicket(t *testing.T) {
assert.Nil(t, err)
//查询票是否自动close,并且购买了新的票
req := &types.ReqWalletTransactionList{Count: 1000}
list, err := mock33.GetAPI().WalletTransactionList(req)
resp, err := mock33.GetAPI().ExecWalletFunc("wallet", "WalletTransactionList", req)
list := resp.(*types.WalletTxDetails)
assert.Nil(t, err)
for _, tx := range list.TxDetails {
if tx.ActionName == "tclose" && tx.Receipt.Ty == 2 {
......
......@@ -70,7 +70,7 @@ func TestMultiSigAccount(t *testing.T) {
//导入私钥到钱包
for i, priv := range TestPrivkeyHex {
privkey := &types.ReqWalletImportPrivkey{Privkey: priv, Label: fmt.Sprintf("heyubin%d", i)}
_, err := mocker.GetAPI().WalletImportprivkey(privkey)
_, err := mocker.GetAPI().ExecWalletFunc("wallet", "WalletImportPrivkey", privkey)
if err != nil {
panic(err)
}
......
......@@ -23,13 +23,12 @@ func TestParaQuery(t *testing.T) {
var param types.ReqWalletImportPrivkey
param.Label = "Importprivkey"
param.Privkey = "CC38546E9E659D15E6B4893F0AB32A06D103931A8230B0BDE71459D2B27D6944"
para.Para.GetAPI().WalletImportprivkey(&param)
para.Para.GetAPI().ExecWalletFunc("wallet", "WalletImportPrivkey", &param)
var param1 types.ReqNewAccount
param1.Label = "NewAccount"
para.Para.GetAPI().NewAccount(&param1)
para.Para.GetAPI().WalletLock()
para.Para.GetAPI().ExecWalletFunc("wallet", "NewAccount", &param1)
para.Para.GetAPI().ExecWalletFunc("wallet", "WalletLock", &types.ReqNil{})
//通过rpc 发生信息
tx := util.CreateTxWithExecer(paraCfg, para.Para.GetGenesisKey(), "user.p.test.none")
......
......@@ -84,22 +84,23 @@ func TestTicket(t *testing.T) {
//fmt.Println(string(js))
_, err = mock33.GetAPI().ExecWalletFunc("ticket", "WalletAutoMiner", &ty.MinerFlag{Flag: 0})
assert.Nil(t, err)
status, err := mock33.GetAPI().GetWalletStatus()
status, err := mock33.GetAPI().ExecWalletFunc("wallet", "GetWalletStatus", &types.ReqNil{})
assert.Nil(t, err)
assert.Equal(t, false, status.IsAutoMining)
assert.Equal(t, false, status.(*types.WalletStatus).IsAutoMining)
assert.Equal(t, int32(2), detail.Receipt.Ty)
_, err = mock33.GetAPI().ExecWalletFunc("ticket", "WalletAutoMiner", &ty.MinerFlag{Flag: 1})
assert.Nil(t, err)
status, err = mock33.GetAPI().GetWalletStatus()
status, err = mock33.GetAPI().ExecWalletFunc("wallet", "GetWalletStatus", &types.ReqNil{})
assert.Nil(t, err)
assert.Equal(t, true, status.IsAutoMining)
assert.Equal(t, true, status.(*types.WalletStatus).IsAutoMining)
for i := mock33.GetLastBlock().Height; i < 100; i++ {
err = mock33.WaitHeight(i)
assert.Nil(t, err)
//查询票是否自动close,并且购买了新的票
req := &types.ReqWalletTransactionList{Count: 1000}
list, err := mock33.GetAPI().WalletTransactionList(req)
resp, err := mock33.GetAPI().ExecWalletFunc("wallet", "WalletTransactionList", req)
assert.Nil(t, err)
list := resp.(*types.WalletTxDetails)
hastclose := false
hastopen := false
for _, tx := range list.TxDetails {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment