limit /tx_search output

Refs #909
This commit is contained in:
Anton Kaliaev
2018-05-14 16:01:49 +04:00
parent b5c4098c53
commit a6b74b82d1
9 changed files with 94 additions and 51 deletions

View File

@ -204,17 +204,19 @@ func (c *HTTP) Tx(hash []byte, prove bool) (*ctypes.ResultTx, error) {
return result, nil
}
func (c *HTTP) TxSearch(query string, prove bool) ([]*ctypes.ResultTx, error) {
results := new([]*ctypes.ResultTx)
func (c *HTTP) TxSearch(query string, prove bool, page, perPage int) (*ctypes.ResultTxSearch, error) {
result := new(ctypes.ResultTxSearch)
params := map[string]interface{}{
"query": query,
"prove": prove,
"query": query,
"prove": prove,
"page": page,
"per_page": perPage,
}
_, err := c.rpc.Call("tx_search", params, results)
_, err := c.rpc.Call("tx_search", params, result)
if err != nil {
return nil, errors.Wrap(err, "TxSearch")
}
return *results, nil
return result, nil
}
func (c *HTTP) Validators(height *int64) (*ctypes.ResultValidators, error) {