Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: Add examples of complex selection filters #185

Merged
merged 1 commit into from
Mar 2, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 32 additions & 2 deletions book/src/filters/selection.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ argument = <predicate argument>

Allowing only block and transaction events to pass:

```
```toml
[[filters]]
type = "Selection"

Expand All @@ -55,7 +55,7 @@ argument = ["Block", "Transaction"]

Using the `not` predicate to allow all events except the variant `Transaction`:

```
```toml
[[filters]]
type = "Selection"

Expand All @@ -66,3 +66,33 @@ predicate = "not"
predicate = "variant_in"
argument = ["Transaction"]
```

Using the `any_of` (aka: "or") predicate to filter events presenting any of two different policies:

```toml
[filters.check]
predicate = "any_of"

[[filters.check.argument]]
predicate = "policy_equals"
argument = "4bf184e01e0f163296ab253edd60774e2d34367d0e7b6cbc689b567d"

[[filters.check.argument]]
predicate = "policy_equals"
argument = "a5bb0e5bb275a573d744a021f9b3bff73595468e002755b447e01559"
```

Using the `all_of` (aka: "and") to filter only "asset" events presenting a particular policy:

```toml
[filters.check]
predicate = "all_of"

[[filters.check.argument]]
predicate = "variant_in"
argument = ["OutputAsset"]

[[filters.check.argument]]
predicate = "policy_equals"
argument = "a5bb0e5bb275a573d744a021f9b3bff73595468e002755b447e01559"
```