Browse Source

add minimal documentation for tx_search RPC method [ci skip]

pull/835/head
Anton Kaliaev 7 years ago
parent
commit
2a5e8c4a47
No known key found for this signature in database GPG Key ID: 7B6881D965918214
1 changed files with 33 additions and 0 deletions
  1. +33
    -0
      rpc/core/tx.go

+ 33
- 0
rpc/core/tx.go View File

@ -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 {


Loading…
Cancel
Save