Get A Hook

Get hook information based on hook ID

🚧

This is a SDK for Alpha

This SDK is alpha and not production complete yet, which means that we could change the schemas, smart contract deployment and backend endpoints that at any time without warning or notice to you. When this SDK is production ready, we will remove this warning and will endeavor to ensure the production quality of the SDK and update the SDK in regular basis with formal notice.

Developers can use the HookClient to get the hook information by providing hookId.

Usage

const { hook } = await client.hook.get({ hookId });

Parameters

  • hookId: string: The identifier of the module.

Response

  • data: Hook: An object with module information. Here is the definition of Hook.
{
	id: string						// The ID of the hook
	moduleId: string			// The module ID of the hook 
	hookType: number			// The hook type: 0 - pre-action hook, 1 - post-action hook
  registryKey: string		// The registry key of the hook
	registeredAt: string  // ISO 8601 timestamp for when the hook is registered
  txHash: string				// The transaction hash of registrating the hook
}

Example

You can refer to the source code below to call get function of HookClient.

client.hook.get({hookId: "0xa26ba8224fb6173063f63388685f80708a6f4d96"})
  .then(({hook}) => {
    console.log(hook);
  });

Here is the output of above example:

{
  id: '0xa26ba8224fb6173063f63388685f80708a6f4d96',
  moduleId: '0x948f67e1c4f75bc89c5fb42147d96356fb4b359f',
  hookType: 0,
  registryKey: '0xbb9865c425894992b86e1f8d42992d7a745943a192f77cd2036c9dbba7dd48b5',
  registeredAt: '2023-11-28T20:13:00Z',
  txHash: '0xa371bdedda0daee685913fc35ba544635eef8eb5bcdfc27f2d0668e313a47f82'
}

You can refer to the code of above example at here.