From 2a5e8c4a4749f3dbd4d5c00799a4c3e8fb82557c Mon Sep 17 00:00:00 2001 From: Anton Kaliaev Date: Tue, 28 Nov 2017 21:32:40 -0600 Subject: [PATCH] add minimal documentation for tx_search RPC method [ci skip] --- rpc/core/tx.go | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/rpc/core/tx.go b/rpc/core/tx.go index 20fc2c96..4e4285a2 100644 --- a/rpc/core/tx.go +++ b/rpc/core/tx.go @@ -102,6 +102,39 @@ func Tx(hash []byte, prove bool) (*ctypes.ResultTx, error) { }, nil } +// TxSearch allows you to query for multiple transactions results. +// +// ```shell +// curl "localhost:46657/tx_search?query='account.owner=\'Ivan\''&prove=true" +// ``` +// +// ```go +// client := client.NewHTTP("tcp://0.0.0.0:46657", "/websocket") +// q, err := tmquery.New("account.owner='Ivan'") +// tx, err := client.TxSearch(q, true) +// ``` +// +// > The above command returns JSON structured like this: +// +// ```json +// ``` +// +// Returns transactions matching the given query. +// +// ### Query Parameters +// +// | Parameter | Type | Default | Required | Description | +// |-----------+--------+---------+----------+-----------------------------------------------------------| +// | query | string | "" | true | Query | +// | prove | bool | false | false | Include proofs of the transactions inclusion in the block | +// +// ### Returns +// +// - `proof`: the `types.TxProof` object +// - `tx`: `[]byte` - the transaction +// - `tx_result`: the `abci.Result` object +// - `index`: `int` - index of the transaction +// - `height`: `int` - height of the block where this transaction was in func TxSearch(query string, prove bool) ([]*ctypes.ResultTx, error) { // if index is disabled, return error if _, ok := txIndexer.(*null.TxIndex); ok {