Hook Definition
(Added by the [Hooks amendment][].)
A HookDefinition
object describes a hook, which is a piece of code that is executed in response to certain transactions. The hook can modify the transaction, emit new transactions, or perform other actions.
Example JSON
Fields
A HookDefinition
object has the following fields:
HookHash
String
Hash256
Yes
The unique identifier of the hook.
HookOn
String
Hash256
Yes
The account that the hook is attached to.
HookNamespace
String
Hash256
Yes
The namespace of the hook.
HookParameters
String
Vector
Yes
The parameters that the hook accepts.
HookApiVersion
Number
UInt16
Yes
The version of the hook API that the hook uses.
CreateCode
String
VL
Yes
The code that is executed when the hook is created.
HookSetTxnID
String
Hash256
Yes
The ID of the transaction that set the hook.
ReferenceCount
String
UInt64
Yes
The number of references to the hook.
Fee
String
Amount
Yes
The fee for executing the hook.
HookCallbackFee
String
Amount
No
The fee for executing the hook's callback function.
LedgerEntryType
String
UInt16
Yes
The value 0x0043
, mapped to the string HookDefinition
, indicates that this object is a HookDefinition object.
Hook Definition ID Format
The ID of a HookDefinition
object is the [SHA-512Half][] of the following values, concatenated in order:
The HookDefinition space key (
0x0044
)The
HookHash
of the hook
Last updated