# Types

### <mark style="color:purple;">Module</mark>

Represents a module object, compatible with the registry's module objects.

```typescript
{
  name: string; // module's name
  details: string[]; // array of strings representing paragraphs that describe the module to end users.
  links: { // relevant links about the module
    label: string; // link's name
    link: string; // URL
  }[];
  parameters: { // module's dispaly parameters, chosen by its creator as relevant for dispaly to end users
    label: string; // parameter's name
    functionName: string; // name of the view or pure function that gets the parameter value
    displayType: string; // a free-text field that tells front ends how to generate a proper UI component for the parameter
  }[];
  type: { // type of module
    eligibility: boolean;
    toggle: boolean;
    hatter: boolean;
  };
  tags: {
    description: string;
    label: string;
    value: string;
  }[];
  implementationAddress: string; // module's implementation address, equal in every network
  deployments: { // networks the implementation is deployed and supported
    chainId: string; // chain's ID
    block: string; // block number of the deployment transaction
  }[];
  creationArgs: ModuleCreationArgs; // the arguments that are passed to the module factory's creation function
  customRoles: Role[]; // module's custom roles
  writeFunctions: WriteFunction[]; // module's write functions
  abi: Abi; // module's ABI
}
```

### <mark style="color:purple;">Role</mark>

A module's custom role. Each module role is associated with a hat and grants permissions to the hat's wearer(s) to call certain functions on the module contract.

There are two special roles with a reserved ID that are automatically added to each module:

1. `public` role, associated with functions that are permitted to any caller
2. `hatAdmins` role, associated with functions that are permitted to the target hat's admins

```typescript
{
  id: string; // role's ID
  name: string; // role's name
  criteria: string; // The name of the contract function which can be used to retrieve the role's hat
  hatAdminsFallback?: boolean; // 'true' indicates that the role is granted to the target hat's admin(s) if/when the role's criteria function returns zero.
}
```

### <mark style="color:purple;">WriteFunction</mark>

The module's write functions. Each write function is associated with a role and grants permissions to the role's wearer(s) to call the function on the module contract.

```typescript
{
  roles: string[]; // IDs of the roles that have the authority to call the function
  functionName: string; // the name of the function in the contract
  label: string; // the name to be displayed to end users
  description: string; // a description of the function to be displayed to end users
  primary?: boolean; // 'true' indicates that this function is the primary function of the roles it is associated with. Front ends can use this information to display the function more prominently for each role
  args: WriteFunctionArg[]; // the arguments of the function
}
```

### <mark style="color:purple;">WriteFunctionArg</mark>

Module write function argument.

```typescript
{
  name: string; // arg's name 
  description: string; // arg's description
  type: string; // arg's solidity type, e.g. 'uint256'
  displayType: string; // a free-text field that tells front ends how to generate a proper UI component for the parameter
  optional?: boolean; // setting to 'true' indicates that this input is optional
}
```

### <mark style="color:purple;">ModuleCreationArgs</mark>

The arguments that are passed to the module [factory's creation function](/for-developers/hats-modules/modules-sdk/create-new-instance-s.md#createnewinstance). The arguments are divided into two arrays: `immutable` and `mutable`. The `immutable` array contains arguments that are set once when the module instance is created and cannot be changed. The `mutable` array contains arguments that can be changed after the module instance is created.

* `useHatId` - By default, new instances should be created with the `hatId` value set to the target hat's ID.  A `false` value here indicates that the module's `hatId` value should be set to zero.
* In both the `immutable` and `mutable` array properties, the order of the arguments must match the order expected by the contract.

```typescript
{
  useHatId: boolean; 
  immutable: ModuleCreationArg[];
  mutable: ModuleCreationArg[];
}
```

### <mark style="color:purple;">ModuleCreationArg</mark>

Immutable/mutable argument, provided in the module's [creation arguments](#modulecreationargs).

<pre class="language-typescript"><code class="lang-typescript">{
  name: string; // arg's name
  description: string; // arg's description
  type: string; // arg's solidity type, e.g. 'uint256'
  example: unknown; // example value 
  displayType: string; // a free-text field that tells front ends how to generate a proper UI component for the parameter
<strong>  optional?: boolean;
</strong>}
</code></pre>

### <mark style="color:purple;">Registry</mark>

A [Hats Modules Registry](/for-developers/hats-modules/building-hats-modules/modules-registry.md) object.

```typescript
{
  modules: Module[];
}
```

### <mark style="color:purple;">ModuleParameter</mark>

Module parameter object, as returned by the [getInstanceParameters](/for-developers/hats-modules/modules-sdk/interact-with-instances.md#getinstanceparameters) function.

```typescript
{
  label: string;
  value: unknown;
  solidityType: string;
  displayType: string;
}
```

### <mark style="color:purple;">ArgumentTsType</mark>

A Typescript type, as returned by the [solidityToTypescriptType function](/for-developers/hats-modules/modules-sdk/utilities.md#soliditytotypescripttype).

```typescript
| "number"
| "bigint"
| "string"
| "boolean"
| "number[]"
| "bigint[]"
| "string[]"
| "boolean[]"
| "unknown";
```

### <mark style="color:purple;">Ruleset</mark>

A modules ruleset is an array of module instances which are chained together with an 'AND' logical operator.&#x20;

```typescript
{
  module: Module; // the module's object from the registry
  address: `0x${string}`; // the module's instance address
}[]
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.hatsprotocol.xyz/for-developers/hats-modules/modules-sdk/types.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
