> For the complete documentation index, see [llms.txt](https://developers.polymath.network/classic-sdk/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developers.polymath.network/classic-sdk/beta/external-modules/_entities_factories_factory_.factory.md).

# Factory

Factories are tasked with creating instances of their corresponding Entity and managing the internal cache for that Entity type. So, for example, the Security Token Factory is tasked with fetching necessary data to instance a Security Token, as well as fetching/refreshing the internal Security Token cache

## Type parameters

▪ **EntityType**: [*Entity*](broken://pages/-M-tw-_WeBJcuS0_s0nR)*‹T›*

▪ **T**: *any*

▪ **U**: *any*

## Hierarchy

* **Factory**

  ↳ [Erc20TokenBalanceFactory](broken://pages/-M-tw-_vlpN6BgX7CUkB)

  ↳ [InvestmentFactory](broken://pages/-M-tw-_xphdbvw0tTyL4)

  ↳ [SimpleStoFactory](broken://pages/-M-tw-_zYxY1xetBUJBT)

  ↳ [TieredStoFactory](broken://pages/-M-tw-a0EDViQZAPSJ-X)

  ↳ [TokenholderFactory](broken://pages/-M2_0qvIRQjN-fcV8Oms)

  ↳ [TaxWithholdingFactory](broken://pages/-M-tw-a-c2Czzg7ulrlN)

  ↳ [WalletFactory](broken://pages/-M-tw-a1XXn0mCnbfYH6)

## Index

### Constructors

* [constructor](broken://pages/-M-tw-_wrPu6TGwSOUU8#constructor)

### Properties

* [Entity](broken://pages/-M-tw-_wrPu6TGwSOUU8#entity)
* [cache](broken://pages/-M-tw-_wrPu6TGwSOUU8#cache)
* [context](broken://pages/-M-tw-_wrPu6TGwSOUU8#context)

### Methods

* [create](broken://pages/-M-tw-_wrPu6TGwSOUU8#create)
* [fetch](broken://pages/-M-tw-_wrPu6TGwSOUU8#fetch)
* [refresh](broken://pages/-M-tw-_wrPu6TGwSOUU8#refresh)
* [update](broken://pages/-M-tw-_wrPu6TGwSOUU8#update)

## Constructors

### constructor

\+ **new Factory**(`eClass`: [EntityClass](broken://pages/-M-tw-c8bRVlnQqEsaxH)‹T, U›, `context`: [Context](broken://pages/-M-tw-_Q7PZbtE8P8eVD)): [*Factory*](broken://pages/-M-tw-_wrPu6TGwSOUU8)

*Defined in* [*src/entities/factories/Factory.ts:42*](https://github.com/PolymathNetwork/polymath-sdk/blob/550676f/src/entities/factories/Factory.ts#L42)

Create a factory that can generate an entity

**Parameters:**

| Name      | Type                                                     |
| --------- | -------------------------------------------------------- |
| `eClass`  | [EntityClass](broken://pages/-M-tw-c8bRVlnQqEsaxH)‹T, U› |
| `context` | [Context](broken://pages/-M-tw-_Q7PZbtE8P8eVD)           |

**Returns:** [*Factory*](broken://pages/-M-tw-_wrPu6TGwSOUU8)

## Properties

### Entity

• **Entity**: [*EntityClass*](broken://pages/-M-tw-c8bRVlnQqEsaxH)*‹T, U›*

*Defined in* [*src/entities/factories/Factory.ts:37*](https://github.com/PolymathNetwork/polymath-sdk/blob/550676f/src/entities/factories/Factory.ts#L37)

entity class that this Factory is in charge of generating and caching

### cache

• **cache**: *object*

*Defined in* [*src/entities/factories/Factory.ts:28*](https://github.com/PolymathNetwork/polymath-sdk/blob/550676f/src/entities/factories/Factory.ts#L28)

#### Type declaration:

* \[ **key**: *string*]: EntityType | undefined

### context

• **context**: [*Context*](broken://pages/-M-tw-_Q7PZbtE8P8eVD)

*Defined in* [*src/entities/factories/Factory.ts:32*](https://github.com/PolymathNetwork/polymath-sdk/blob/550676f/src/entities/factories/Factory.ts#L32)

## Methods

### create

▸ **create**(`uid`: string, `params`: T): *EntityType*

*Defined in* [*src/entities/factories/Factory.ts:87*](https://github.com/PolymathNetwork/polymath-sdk/blob/550676f/src/entities/factories/Factory.ts#L87)

Get an entity from the cache. Creates it if it isn't cached, updates it if it is

**Parameters:**

| Name     | Type   | Description                      |
| -------- | ------ | -------------------------------- |
| `uid`    | string | unique identifier for the entity |
| `params` | T      | constructor data for the entity  |

**Returns:** *EntityType*

### fetch

▸ **fetch**(`uid`: string): *Promise‹EntityType›*

*Defined in* [*src/entities/factories/Factory.ts:57*](https://github.com/PolymathNetwork/polymath-sdk/blob/550676f/src/entities/factories/Factory.ts#L57)

Get an entity from the cache. Fetches the necessary data to create it if it isn't cached, refreshes it if it is

**Parameters:**

| Name  | Type   | Description                      |
| ----- | ------ | -------------------------------- |
| `uid` | string | unique identifier for the entity |

**Returns:** *Promise‹EntityType›*

### refresh

▸ **refresh**(`uid`: string): *Promise‹void›*

*Defined in* [*src/entities/factories/Factory.ts:108*](https://github.com/PolymathNetwork/polymath-sdk/blob/550676f/src/entities/factories/Factory.ts#L108)

Fetch the data for an entity and updates its properties

**Parameters:**

| Name  | Type   | Description                      |
| ----- | ------ | -------------------------------- |
| `uid` | string | unique identifier for the entity |

**Returns:** *Promise‹void›*

### update

▸ **update**(`uid`: string, `params`: Partial‹T›): *Promise‹void›*

*Defined in* [*src/entities/factories/Factory.ts:126*](https://github.com/PolymathNetwork/polymath-sdk/blob/550676f/src/entities/factories/Factory.ts#L126)

Update an entity's properties in place

**Parameters:**

| Name     | Type       | Description                       |
| -------- | ---------- | --------------------------------- |
| `uid`    | string     | unique identifier for the entity  |
| `params` | Partial‹T› | properties that should be updated |

**Returns:** *Promise‹void›*


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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://developers.polymath.network/classic-sdk/beta/external-modules/_entities_factories_factory_.factory.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.
