Parameters
Install-time parameters allow Hooks to be generic and flexible
Last updated
Was this helpful?
Install-time parameters allow Hooks to be generic and flexible
Last updated
Was this helpful?
Hook developers may opt to use install-time parameters (called Hook Parameters) in their Hook. This allows subsequent installers of the Hook to change certain behaviours the programmer defines without recompiling or re-uploading the Hook (assuming at least one account still the existing Hook Definition.)
Hook Parameters are a set of Key-Value pairs set during the and retrievable by the Hook during runtime. Both the ParameterName
(key) and the ParameterValue
are set as hex blobs, and have a maximum length of 32 bytes and 256 bytes respectively.
A may define up to 16 Hook Parameters per installed Hook.
The HookParameters
array is optionally defined inside each Hook
in the Hooks
array as shown below:
The subsequent user may specify their own Parameters, overriding the Default Parameters for their installation.
To erase a Parameter in a subsequent installation, specify the ParameterName
key without specifying a ParameterValue
key.
The first user to may define Hook Parameters which then become the Default Parameters for that Hook. This means any subsequent users who will receive these originally set Hook Parameters by default.
Parameters can be read by the Hooks they are set on using .
If more than one Hook is installed in a Hook Chain, then can be used in limited circumstances to modify the Hook Parameters of a Hook further down the chain on the same account.
On Xahau and the Xahau testnet, HookParameters may also be included at the top level of any transaction type according to the foregoing rules and size limits. These parameters can be accessed inside a hook using the API.