Get Available Modules

The following functions are used in order to get available modules, as exist in the Modules Registry.

See the Module type here.

getModules

Get all available modules, optionally use a filter function in order to retrieve only a subset of the modules.

const modules = hatsModulesClient.getAllModules();

Arguments:

filter?: (module: Module) => boolean

An optional filter function. For each Module, should return true if the module should be included, false otherwise.

Response:

{ [id: string]: Module }

An object that maps between module IDs and the corresponding module objects. A module ID is its implementation address.

getModuleById

Get a module object by its ID.

const module = hatsModulesClient.getModuleById(moduleId);

Arguments:

string

Module's ID (implementation address).

Response:

Module | undefined

The module that matches the provided ID, or undefined in case no matching module was found.

getModuleByImplementation

Get a module object by its implementation address.

const module = hatsModulesClient.getModuleByImplementation(address);

Arguments:

`0x${string}`

Module's implementation address.

Response:

Module | undefined

The module that matches the provided address, or undefined in case no matching module was found.

getModuleByInstance

Get the module object of an instance.

const module = await hatsModulesClient.getModuleByInstance(address);

Arguments:

`0x${string}`

Module's instance address.

Response:

Module | undefined

The module that matches the provided address, or undefined in case no matching module was found.

getModulesByInstances

Get the module objects of instances.

const modules = await hatsModulesClient.getModulesByInstances(addresses);

Arguments:

`0x${string}`[]

Addresses of the module instances.

Response:

(Module | undefined)[]

The modules matching the provided addresses. For every address that is not an instance of a registry module, the corresponding return value in the array will be undefined.

Last updated