Select Filter
The Select filter keeps only the events that match a predicate and drops the rest — so a
sink downstream sees just the transactions you care about (by address, asset, datum, or
metadata). It’s the workhorse for “tell me when X happens on chain”.
Select works on structured records, so it needs the
ParseCbor filter earlier in the chain (usually preceded by
SplitBlock for tx-level matching).
Configuration
[[filters]]type = "Select"skip_uncertain = truepredicate = <match>type(required): the literal valueSelect.skip_uncertain(required): whentrue, events that can’t be conclusively evaluated against the predicate are dropped rather than kept.predicate(required): the match expression — see the patterns below.
Simple predicates
The simplest predicate is a single string that matches any transaction touching a given entity.
Match a transaction that interacts with an address:
predicate = "addr1qx2fxv2umyhttkxyxp8x0dlpdt3k6cwng5pxj3jhsydzer3n0d3vllmyqwsx5wktcd8cc3sq835lu7drv2xwl2wywfgse35a3x"Match a stake address:
predicate = "stake178phkx6acpnf78fuvxn0mkew3l0fd058hzquvz7w36x4gtcccycj5"Match an asset:
predicate = "asset17jd78wukhtrnmjh3fngzasxm8rck0l2r4hhyyt"Match a datum:
predicate = "datum1httkxyxp8x0dlpdt3k6cwng5pxj3j"Match a metadata label (prefix the label with #):
predicate = "#127"Combining predicates
Use any (match if any entry matches) or all (match only if every entry matches) to
compose simple predicates.
Match a transaction touching any of these addresses:
[filters.predicate]any = [ "addr1qx2fxv2umyhttkxyxp8x0dlpdt3k6cwng5pxj3jhsydzer3n0d3vllmyqwsx5wktcd8cc3sq835lu7drv2xwl2wywfgse35a3x", "addr1w8phkx6acpnf78fuvxn0mkew3l0fd058hzquvz7w36x4gtcyjy7wx", "addr1vx2fxv2umyhttkxyxp8x0dlpdt3k6cwng5pxj3jhsydzers66hrl8",]Match a transaction touching all of these at once:
[filters.predicate]all = [ "addr1w8phkx6acpnf78fuvxn0mkew3l0fd058hzquvz7w36x4gtcyjy7wx", "stake178phkx6acpnf78fuvxn0mkew3l0fd058hzquvz7w36x4gtcccycj5",]Mix entity types — here, an address that simultaneously holds an asset and carries a metadata label:
[filters.predicate]all = [ "addr1w8phkx6acpnf78fuvxn0mkew3l0fd058hzquvz7w36x4gtcyjy7wx", "asset17jd78wukhtrnmjh3fngzasxm8rck0l2r4hhyyt", "#789",]Match against a single output’s contents (address, assets, and datum together):
[filters.predicate.match.output]address = "addr1w8phkx6acpnf78fuvxn0mkew3l0fd058hzquvz7w36x4gtcyjy7wx"assets = ["asset17jd78wukhtrnmjh3fngzasxm8rck0l2r4hhyyt"]datum = "datum1httkxyxp8x0dlpdt3k6cwng5pxj3j"Metadata patterns
Match any transaction carrying a metadata label:
predicate = "#674"Match on the content of metadata with a regular expression. The match recurses through arrays and maps (including map keys and values) and applies only to text metadata:
[filters.predicate.match.metadata]label = 674
[filters.predicate.match.metadata.value.text]regex = "(?i)hello.*world" # case-insensitive