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