From b8bb6969a75fcee382280300d53b18fb709ecd20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ekiserrep=C3=A9?= <126416117+Ekiserrepe@users.noreply.github.com> Date: Tue, 23 Jun 2026 14:35:26 +0200 Subject: [PATCH] HookOnv2Review --- src/content/docs/docs/features/amendments.mdx | 2 +- src/content/docs/docs/hooks/concepts/hookon-field.mdx | 6 ++++-- .../ledger-data/ledger-objects-types/hook-definition.mdx | 2 -- .../transactions/transaction-types/sethook.mdx | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/content/docs/docs/features/amendments.mdx b/src/content/docs/docs/features/amendments.mdx index 48e86ce..dc027c0 100644 --- a/src/content/docs/docs/features/amendments.mdx +++ b/src/content/docs/docs/features/amendments.mdx @@ -189,7 +189,7 @@ Fixes a bug that currently allows invalid flags to be provided to some transacti ##### HookOnV2 -Hooks may continue to specify `HookOn` with the existing behaviour, or optionally replace it with two separate fields: `HookOnIncoming` and `HookOnOutgoing`. Both use the same bitmask syntax as `HookOn` but differentiate between transactions originating from the Hook account (`HookOnOutgoing`) and transactions originating from another account (`HookOnIncoming`). Additionally, `HookCanEmit` may be specified to control which transaction types the Hook is allowed to emit, using the same syntax as `HookOn`. _(Introduced in 2026.6.21-release+3350)_ +Hooks may continue to specify `HookOn` with the existing behaviour, or optionally replace it with two separate fields: `HookOnIncoming` and `HookOnOutgoing`. Both use the same bitmask syntax as `HookOn` but differentiate between transactions originating from the Hook account (`HookOnOutgoing`) and transactions originating from another account (`HookOnIncoming`). _(Introduced in 2026.6.21-release+3350)_ ##### PriceOracle diff --git a/src/content/docs/docs/hooks/concepts/hookon-field.mdx b/src/content/docs/docs/hooks/concepts/hookon-field.mdx index e988114..ac8ff11 100644 --- a/src/content/docs/docs/hooks/concepts/hookon-field.mdx +++ b/src/content/docs/docs/hooks/concepts/hookon-field.mdx @@ -52,7 +52,7 @@ _(Added by the [HookCanEmit amendment](/docs/features/amendments/#hookcanemit).) - Uses the same active-low semantics as `HookOn`, with bit 22 (`ttHOOK_SET`) being active high. - If `HookCanEmit` is absent, the Hook may emit any transaction type, including `SetHook`. -### HookOnV2: Incoming and Outgoing +### HookOnIncoming and HookOnOutgoing Fields _(Added by the [HookOnV2 amendment](/docs/features/amendments/#hookonv2).)_ @@ -61,6 +61,8 @@ Instead of specifying a single `HookOn` field, Hooks may optionally replace it w - **`HookOnIncoming`** — triggers the Hook on transactions **originating from another account** (the Hook account is not the initiator). - **`HookOnOutgoing`** — triggers the Hook on transactions **originating from the Hook account itself**. -Both fields use the same bit-field syntax as `HookOn`. `HookOnIncoming` and `HookOnOutgoing` are mutually exclusive with `HookOn` — you must use either `HookOn` alone or the `HookOnIncoming`/`HookOnOutgoing` pair, not both. If only one of the pair is specified, the Hook will not fire on the unspecified direction. +Both fields use the same bit-field syntax as `HookOn`. `HookOnIncoming` and `HookOnOutgoing` are mutually exclusive with `HookOn` — you must use either `HookOn` alone or the `HookOnIncoming`/`HookOnOutgoing` pair, not both. If only one of the pair is specified, the Hook will not fire on the unspecified direction. + +_Note: The `HookOnIncoming` and `HookOnOutgoing` cannot be configured with exactly the same settings. If you need a Hook to respond to both directions using identical criteria, use the `HookOn` field instead, as it provides a simpler and more appropriate way to define shared trigger behavior._ Using `HookOn` alone continues to work exactly as before. diff --git a/src/content/docs/docs/protocol-reference/ledger-data/ledger-objects-types/hook-definition.mdx b/src/content/docs/docs/protocol-reference/ledger-data/ledger-objects-types/hook-definition.mdx index b27b23e..47a5ab6 100644 --- a/src/content/docs/docs/protocol-reference/ledger-data/ledger-objects-types/hook-definition.mdx +++ b/src/content/docs/docs/protocol-reference/ledger-data/ledger-objects-types/hook-definition.mdx @@ -13,8 +13,6 @@ A `HookDefinition` object describes a hook, which is a piece of code that is exe { "HookHash": "49647F0D748DC3FE26BDACBC57F251AADEFFF391403EC9BF87C97F67E9977FB0", "HookOn": "0000000000000000000000000000000000000000000000000000000000000000", - "HookOnIncoming": "0000000000000000000000000000000000000000000000000000000000000000", - "HookOnOutgoing": "0000000000000000000000000000000000000000000000000000000000000000", "HookCanEmit": "0000000000000000000000000000000000000000000000000000000000000000", "HookNamespace": "0000000000000000000000000000000000000000000000000000000000000000", "HookParameters": { diff --git a/src/content/docs/docs/protocol-reference/transactions/transaction-types/sethook.mdx b/src/content/docs/docs/protocol-reference/transactions/transaction-types/sethook.mdx index 91368b9..2ba7fc6 100644 --- a/src/content/docs/docs/protocol-reference/transactions/transaction-types/sethook.mdx +++ b/src/content/docs/docs/protocol-reference/transactions/transaction-types/sethook.mdx @@ -313,7 +313,7 @@ The following fields are used in the hook object: | `HookGrants` | Array | Array | The grants associated with the hook. | | `HookNamespace` | String | Hash256 | The namespace of the hook. | | `HookParameters` | Array | Array | The parameters of the hook. | -| `HookOn` | String | Hash256 | The transaction/s on which the hook is triggered. Mutually exclusive with `HookOnIncoming`/`HookOnOutgoing`. | +| `HookOn` | String | Hash256 | _(Optional, HookOnV2)_ The transaction/s on which the hook is triggered. Mutually exclusive with `HookOnIncoming`/`HookOnOutgoing`. | | `HookOnIncoming` | String | Hash256 | _(Optional, HookOnV2)_ Same syntax as `HookOn`. Triggers the hook on transactions originating from **another account**. Mutually exclusive with `HookOn`. | | `HookOnOutgoing` | String | Hash256 | _(Optional, HookOnV2)_ Same syntax as `HookOn`. Triggers the hook on transactions originating from **the Hook account itself**. Mutually exclusive with `HookOn`. | | `HookCanEmit` | String | Hash256 | _(Optional)_ Same syntax as `HookOn`. Controls which transaction types the hook is allowed to emit. If absent, the hook may emit any transaction type. |