HookOnv2Review

This commit is contained in:
Ekiserrepé
2026-06-23 14:35:26 +02:00
parent 6eb3f34e3c
commit b8bb6969a7
4 changed files with 6 additions and 6 deletions

View File

@@ -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

View File

@@ -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.

View File

@@ -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": {

View File

@@ -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. |