mirror of
https://github.com/tendermint/tendermint.git
synced 2026-01-05 04:55:18 +00:00
indexer: allow indexing an event at runtime (#4466)
The PR added a new field `index` to event attribute, that will cause indexer service to index the event if set to true.
This commit is contained in:
@@ -76,10 +76,11 @@ func (app *KVStoreApplication) DeliverTx(req types.RequestDeliverTx) types.Resul
|
||||
events := []abci.Event{
|
||||
{
|
||||
Type: "transfer",
|
||||
Attributes: kv.Pairs{
|
||||
kv.Pair{Key: []byte("sender"), Value: []byte("Bob")},
|
||||
kv.Pair{Key: []byte("recipient"), Value: []byte("Alice")},
|
||||
kv.Pair{Key: []byte("balance"), Value: []byte("100")},
|
||||
Attributes: []abci.EventAttribute{
|
||||
{Key: []byte("sender"), Value: []byte("Bob")},
|
||||
{Key: []byte("recipient"), Value: []byte("Alice")},
|
||||
{Key: []byte("balance"), Value: []byte("100")},
|
||||
{Key: []byte("note"), Value: []byte("nothing"), Index: true},
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -98,6 +99,9 @@ Note, there are a few predefined event types:
|
||||
|
||||
Tendermint will throw a warning if you try to use any of the above keys.
|
||||
|
||||
The index will be added if the `Index` field of attribute is set to true. In above example, querying
|
||||
using `transfer.note` will work.
|
||||
|
||||
## Querying Transactions
|
||||
|
||||
You can query the transaction results by calling `/tx_search` RPC endpoint:
|
||||
|
||||
Reference in New Issue
Block a user