`IPostDispatchHook` Interface
`IPostDispatchHook` Interface
Post Dispatch
In addition to themessage
dispatched via the Mailbox, the postDispatch
function receives a metadata
parameter. The metadata
parameter is passed from the dispatch
call through the Mailbox unmodified. This allows developers to pass any context they wish through to the hook.
postDispatch
function receives insufficient payment, it may revert.
Post-Dispatch Hooks may be replayable. Developers creating custom hooks should
implement safe checks to prevent this behavior.
Here
is an example implementation.
Quote Dispatch (Fees)
Fees are often charged inpostDispatch
to cover costs such as destination chain transaction submission and security provisioning. To receive a quote for a corresponding postDispatch
call, you can query the quoteDispatch
function.
quoteDispatch
function that returns the aggregate fee required for a dispatch
call to be successful.
Move to implementing a hook guide here.
Overriding default Hook Metadata
To override the default metadata, there is adispatch
overload that takes an optional metadata
parameter.
Hooks currently expect metadata to be formatted with the
StandardHookMetadata
library.metadata
will be passed to the required hook’s quoteDispatch
and postDispatch
functions, before being passed to the default hook’s postDispatch
function.
Examples
Checkout the:
StandardHookMetadata
LibraryCustom hook and metadata
After implementing the above interfaces, you can override default hook along the hook metadata by using the overloadeddispatch
call in our mailbox: