Commit 29be8f80 authored by vipwzw's avatar vipwzw

fix rpc request

parent 526392a7
......@@ -87,7 +87,7 @@ func testRoundInfoCmd(t *testing.T, jrpc *jsonclient.JSONClient) error {
var params rpctypes.Query4Jrpc
req := &pty.ReqBlackwhiteRoundInfo{}
params.FuncName = pty.GetBlackwhiteRoundInfo
params.Payload = req
params.Payload = types.MustPBToJSON(req)
rep = &pty.ReplyBlackwhiteRoundInfo{}
return jrpc.Call("Chain33.Query", params, rep)
}
......
......@@ -10,6 +10,7 @@ import (
commonlog "github.com/33cn/chain33/common/log"
"github.com/33cn/chain33/rpc/jsonclient"
rpctypes "github.com/33cn/chain33/rpc/types"
"github.com/33cn/chain33/types"
"github.com/33cn/chain33/util/testnode"
pty "github.com/33cn/plugin/plugin/dapp/pokerbull/types"
......@@ -79,7 +80,7 @@ func testQueryGameByID(t *testing.T, jrpc *jsonclient.JSONClient) error {
req := &pty.QueryPBGameInfo{}
params.Execer = "pokerbull"
params.FuncName = "QueryGameByID"
params.Payload = req
params.Payload = types.MustPBToJSON(req)
rep = &pty.ReplyPBGame{}
return jrpc.Call("Chain33.Query", params, rep)
}
......@@ -90,7 +91,7 @@ func testQueryGameByAddr(t *testing.T, jrpc *jsonclient.JSONClient) error {
req := &pty.QueryPBGameInfo{}
params.Execer = "pokerbull"
params.FuncName = "QueryGameByAddr"
params.Payload = req
params.Payload = types.MustPBToJSON(req)
rep = &pty.PBGameRecords{}
return jrpc.Call("Chain33.Query", params, rep)
}
......@@ -148,7 +148,7 @@ func testShowAmountsOfUTXO(t *testing.T, jrpc *jsonclient.JSONClient) error {
var params rpctypes.Query4Jrpc
params.Execer = pty.PrivacyX
params.FuncName = "ShowAmountsOfUTXO"
params.Payload = reqPrivacyToken
params.Payload = types.MustPBToJSON(&reqPrivacyToken)
var res pty.ReplyPrivacyAmounts
err := jrpc.Call("Chain33.Query", params, &res)
......@@ -163,7 +163,7 @@ func testShowUTXOs4SpecifiedAmount(t *testing.T, jrpc *jsonclient.JSONClient) er
var params rpctypes.Query4Jrpc
params.Execer = pty.PrivacyX
params.FuncName = "ShowUTXOs4SpecifiedAmount"
params.Payload = reqPrivacyToken
params.Payload = types.MustPBToJSON(&reqPrivacyToken)
var res pty.ReplyUTXOsOfAmount
err := jrpc.Call("Chain33.Query", params, &res)
......
......@@ -68,7 +68,7 @@ func testShowOnesCreateRelayOrdersCmd(t *testing.T, jrpc *jsonclient.JSONClient)
req := &pty.ReqRelayAddrCoins{}
params.Execer = "relay"
params.FuncName = "GetSellRelayOrder"
params.Payload = req
params.Payload = types.MustPBToJSON(req)
rep = &pty.ReplyRelayOrders{}
return jrpc.Call("Chain33.Query", params, rep)
}
......@@ -79,7 +79,7 @@ func testShowOnesAcceptRelayOrdersCmd(t *testing.T, jrpc *jsonclient.JSONClient)
req := &pty.ReqRelayAddrCoins{}
params.Execer = "relay"
params.FuncName = "GetBuyRelayOrder"
params.Payload = req
params.Payload = types.MustPBToJSON(req)
rep = &pty.ReplyRelayOrders{}
return jrpc.Call("Chain33.Query", params, rep)
}
......@@ -90,7 +90,7 @@ func testShowOnesStatusOrdersCmd(t *testing.T, jrpc *jsonclient.JSONClient) erro
req := &pty.ReqRelayAddrCoins{}
params.Execer = "relay"
params.FuncName = "GetRelayOrderByStatus"
params.Payload = req
params.Payload = types.MustPBToJSON(req)
rep = &pty.ReplyRelayOrders{}
return jrpc.Call("Chain33.Query", params, rep)
}
......@@ -101,7 +101,7 @@ func testShowBTCHeadHeightListCmd(t *testing.T, jrpc *jsonclient.JSONClient) err
req := &pty.ReqRelayBtcHeaderHeightList{}
params.Execer = "relay"
params.FuncName = "GetBTCHeaderList"
params.Payload = req
params.Payload = types.MustPBToJSON(req)
rep = &pty.ReplyRelayBtcHeadHeightList{}
return jrpc.Call("Chain33.Query", params, rep)
}
......
......@@ -10,6 +10,7 @@ import (
commonlog "github.com/33cn/chain33/common/log"
"github.com/33cn/chain33/rpc/jsonclient"
rpctypes "github.com/33cn/chain33/rpc/types"
"github.com/33cn/chain33/types"
"github.com/33cn/chain33/util/testnode"
"github.com/33cn/plugin/plugin/dapp/retrieve/rpc"
......@@ -81,7 +82,7 @@ func testRetrieveQueryCmd(t *testing.T, jrpc *jsonclient.JSONClient) error {
req := &pty.ReqRetrieveInfo{}
params.Execer = "retrieve"
params.FuncName = "GetRetrieveInfo"
params.Payload = req
params.Payload = types.MustPBToJSON(req)
rep = &pty.RetrieveQuery{}
return jrpc.Call("Chain33.Query", params, rep)
}
......@@ -9,6 +9,7 @@ import (
"testing"
"github.com/33cn/chain33/rpc/jsonclient"
rpctypes "github.com/33cn/chain33/rpc/types"
_ "github.com/33cn/chain33/system"
"github.com/33cn/chain33/types"
"github.com/33cn/chain33/util/testnode"
......@@ -60,7 +61,7 @@ func testGetColdAddrByMinerCmd(t *testing.T, jrpc *jsonclient.JSONClient) error
req := &types.ReqString{}
params.Execer = "ticket"
params.FuncName = "MinerSourceList"
params.Payload = req
params.Payload = types.MustPBToJSON(req)
rep = &types.ReplyStrings{}
return jrpc.Call("Chain33.Query", params, rep)
}
......@@ -10,6 +10,7 @@ import (
commonlog "github.com/33cn/chain33/common/log"
"github.com/33cn/chain33/rpc/jsonclient"
rpctypes "github.com/33cn/chain33/rpc/types"
"github.com/33cn/chain33/types"
"github.com/33cn/chain33/util/testnode"
pty "github.com/33cn/plugin/plugin/dapp/trade/types"
......@@ -78,7 +79,7 @@ func testShowOnesSellOrdersCmd(t *testing.T, jrpc *jsonclient.JSONClient) error
params := rpctypes.Query4Jrpc{
Execer: "trade",
FuncName: "GetOnesSellOrder",
Payload: pty.ReqAddrAssets{},
Payload: types.MustPBToJSON(&pty.ReqAddrAssets{}),
}
var res pty.ReplySellOrders
return jrpc.Call("Chain33.Query", params, &res)
......@@ -90,7 +91,7 @@ func testShowOnesSellOrdersStatusCmd(t *testing.T, jrpc *jsonclient.JSONClient)
req := &pty.ReqAddrAssets{}
params.Execer = "trade"
params.FuncName = "GetOnesSellOrderWithStatus"
params.Payload = req
params.Payload = types.MustPBToJSON(req)
rep = &pty.ReplySellOrders{}
return jrpc.Call("Chain33.Query", params, rep)
}
......@@ -101,7 +102,7 @@ func testShowTokenSellOrdersStatusCmd(t *testing.T, jrpc *jsonclient.JSONClient)
req := &pty.ReqTokenSellOrder{}
params.Execer = "trade"
params.FuncName = "GetTokenSellOrderByStatus"
params.Payload = req
params.Payload = types.MustPBToJSON(req)
rep = &pty.ReplySellOrders{}
return jrpc.Call("Chain33.Query", params, rep)
......@@ -113,7 +114,7 @@ func testShowOnesBuyOrderCmd(t *testing.T, jrpc *jsonclient.JSONClient) error {
req := &pty.ReqAddrAssets{}
params.Execer = "trade"
params.FuncName = "GetOnesBuyOrder"
params.Payload = req
params.Payload = types.MustPBToJSON(req)
rep = &pty.ReplyBuyOrders{}
return jrpc.Call("Chain33.Query", params, rep)
......@@ -125,7 +126,7 @@ func testShowOnesBuyOrdersStatusCmd(t *testing.T, jrpc *jsonclient.JSONClient) e
req := &pty.ReqAddrAssets{}
params.Execer = "trade"
params.FuncName = "GetOnesBuyOrderWithStatus"
params.Payload = req
params.Payload = types.MustPBToJSON(req)
rep = &pty.ReplyBuyOrders{}
return jrpc.Call("Chain33.Query", params, rep)
......@@ -137,7 +138,7 @@ func testShowTokenBuyOrdersStatusCmd(t *testing.T, jrpc *jsonclient.JSONClient)
req := &pty.ReqTokenBuyOrder{}
params.Execer = "trade"
params.FuncName = "GetTokenBuyOrderByStatus"
params.Payload = req
params.Payload = types.MustPBToJSON(req)
rep = &pty.ReplyBuyOrders{}
return jrpc.Call("Chain33.Query", params, rep)
......@@ -149,7 +150,7 @@ func testShowOnesOrdersStatusCmd(t *testing.T, jrpc *jsonclient.JSONClient) erro
req := &pty.ReqAddrAssets{}
params.Execer = "trade"
params.FuncName = "GetOnesOrderWithStatus"
params.Payload = req
params.Payload = types.MustPBToJSON(req)
rep = &pty.ReplyTradeOrders{}
return jrpc.Call("Chain33.Query", params, rep)
......
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