Commit 1ba67897 authored by linj's avatar linj

jrpc test more field

parent 05a5231c
...@@ -8,11 +8,14 @@ import ( ...@@ -8,11 +8,14 @@ import (
"strings" "strings"
"testing" "testing"
"github.com/33cn/chain33/common"
commonlog "github.com/33cn/chain33/common/log" commonlog "github.com/33cn/chain33/common/log"
"github.com/33cn/chain33/rpc/jsonclient" "github.com/33cn/chain33/rpc/jsonclient"
rpctypes "github.com/33cn/chain33/rpc/types" rpctypes "github.com/33cn/chain33/rpc/types"
"github.com/33cn/chain33/types" "github.com/33cn/chain33/types"
"github.com/33cn/chain33/util/testnode" "github.com/33cn/chain33/util/testnode"
"github.com/33cn/plugin/plugin/dapp/retrieve/rpc" "github.com/33cn/plugin/plugin/dapp/retrieve/rpc"
pty "github.com/33cn/plugin/plugin/dapp/retrieve/types" pty "github.com/33cn/plugin/plugin/dapp/retrieve/types"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
...@@ -67,8 +70,28 @@ func testPrepareCmd(t *testing.T, jrpc *jsonclient.JSONClient) error { ...@@ -67,8 +70,28 @@ func testPrepareCmd(t *testing.T, jrpc *jsonclient.JSONClient) error {
} }
func testPerformCmd(t *testing.T, jrpc *jsonclient.JSONClient) error { func testPerformCmd(t *testing.T, jrpc *jsonclient.JSONClient) error {
params := rpc.RetrievePerformTx{} params := rpc.RetrievePerformTx{
return jrpc.Call("retrieve.CreateRawRetrievePerformTx", params, nil) BackupAddr: "b",
DefaultAddr: "d",
Assets: []rpc.Asset{{"e", "s"}},
}
var txS string
t.Log("tx info", "x", params.Assets)
err := jrpc.Call("retrieve.CreateRawRetrievePerformTx", &params, &txS)
var tx types.Transaction
bytes, err := common.FromHex(txS)
if err != nil {
return err
}
err = types.Decode(bytes, &tx)
if err != nil {
return err
}
var p2 pty.RetrieveAction
err = types.Decode(tx.Payload, &p2)
t.Log("asset", p2.GetPerform().GetAssets())
return err
} }
func testCancelCmd(t *testing.T, jrpc *jsonclient.JSONClient) error { func testCancelCmd(t *testing.T, jrpc *jsonclient.JSONClient) error {
......
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