You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/modules/ROOT/pages/index.adoc
+35-1Lines changed: 35 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1075,6 +1075,9 @@ The monitor uses a structured JSON format with nested objects for template varia
1075
1075
| `*events.[index].args.[position]*`
1076
1076
| Event parameters by position
1077
1077
1078
+
| `*events.[index].args.[param]*`
1079
+
| Event parameters by name (only in case the contract supports event parameters name)
1080
+
1078
1081
| `*functions.[index].args.[param]*`
1079
1082
| Function parameters by name
1080
1083
|===
@@ -1603,7 +1606,23 @@ When a Stellar parameter has `kind: "vec"`, its value can be either a CSV string
1603
1606
1604
1607
*Event Parameter Access (Stellar)*
1605
1608
1606
-
Stellar event parameters are typically accessed by their numeric index as the base variable name (e.g., `0`, `1`, `2`). If an indexed event parameter is itself a complex type (like an array or map, represented as a JSON string), you can then apply the respective access methods:
1609
+
Starting with Stellar Protocol 23, Soroban contracts can include event definitions in their contract specifications. This enables two ways to access event parameters:
1610
+
1611
+
*Access by Name (Protocol 23+):*
1612
+
When a contract specification includes event definitions, you can access event parameters by their defined names:
1613
+
1614
+
* If an event has a parameter named `recipient` (kind: "Address"):
1615
+
** `recipient == 'GBBD...ABCD'`
1616
+
* If an event has a parameter named `amount` (kind: "U128"):
1617
+
** `amount > 1000000`
1618
+
* If an event has a parameter named `metadata` (kind: "Map") containing `'{"id": 123, "name": "Test"}'`:
* If an event has a parameter named `items` (kind: "array") containing `'["alpha", "beta"]'`:
1622
+
** `items contains 'beta'` (case-insensitive deep search)
1623
+
1624
+
*Access by Index (Legacy):*
1625
+
For contracts without event definitions in their specification, or when working with older contracts, event parameters can be accessed by their numeric index (e.g., `0`, `1`, `2`):
1607
1626
1608
1627
* If event parameter `0` (kind: "Map") is `'{"id": 123, "name": "Test"}'`:
1609
1628
** `0.id == 123`
@@ -1613,6 +1632,11 @@ Stellar event parameters are typically accessed by their numeric index as the ba
1613
1632
** `1[1].val == 'Beta'` (case-insensitive)
1614
1633
** `1 contains 'beta'` (case-insensitive deep search)
1615
1634
1635
+
[TIP]
1636
+
====
1637
+
Named access is recommended when available as it makes expressions more readable and maintainable. The monitor will automatically use named parameters if they're available in the contract specification, otherwise it falls back to indexed access.
1638
+
====
1639
+
1616
1640
===== EVM Examples
1617
1641
1618
1642
These examples assume common EVM event parameters or transaction fields.
@@ -1738,6 +1762,16 @@ Assume event parameter `0` is `12345` (u64), `1` (kind: "array") is `'["Val1", "
1738
1762
"2.keyB < 1000"
1739
1763
----
1740
1764
1765
+
Now, after Stellar Protocol 23 we can access to Event parameters by name (first, make sure the contract supports the feature)
1766
+
1767
+
----
1768
+
"0 > 10000"
1769
+
"param_name[0] == 'val1'"
1770
+
"param_name contains 'val2'"
1771
+
"param_name.keyA == 'DATAX'"
1772
+
"param_name.keyB < 1000"
1773
+
----
1774
+
1741
1775
[NOTE]
1742
1776
====
1743
1777
With SEP-48 support, Stellar functions can now reference parameters by name (e.g., `amount > 1000`) instead of position (e.g., `2 > 1000`). Events still use indexed parameters until SEP-48 support is added for events.
* The `contract_spec` field is optional for Stellar contracts. If not provided, the monitor automatically fetches the contract's SEP-48 interface from the chain
603
603
* You can explore Stellar contract interfaces using the link:https://lab.stellar.org/smart-contracts/contract-explorer[Stellar Contract Explorer^]
604
604
* The expression `"out_min > 1000000000"` monitors swaps with minimum output over 1 billion tokens
605
+
* Now, you can also filter by parameters event's name (Stellar Protocol 23 has introduced this new feature). See this xref:index.adoc#stellar_specifics[section] for more details
* If you want to include event details in the notification message body, you can also access event parameters by name. Here's an example:
641
+
[source,bash]
642
+
----
643
+
"body": "${monitor.name} triggered because of a large swap from ${events.0.args.from} tokens | https://stellar.expert/explorer/public/tx/${transaction.hash}"
0 commit comments