[API Reference](../README.md) > [WrapperService](../classes/WrapperService.md)



# Class: WrapperService


Service that provides access to Arc.js contract wrapper classes and class factories.

## Index

### Properties

* [factories](WrapperService.md#factories)
* [wrappers](WrapperService.md#wrappers)
* [wrappersByAddress](WrapperService.md#wrappersByAddress)
* [wrappersByType](WrapperService.md#wrappersByType)


### Methods

* [confirmContractType](WrapperService.md#confirmContractType)
* [getContractWrapper](WrapperService.md#getContractWrapper)
* [initialize](WrapperService.md#initialize)



---
## Properties
<a id="factories"></a>

### «Static» factories

**●  factories**:  *[ArcWrapperFactories](../interfaces/ArcWrapperFactories.md)*  =  {} as ArcWrapperFactories

*Defined in [wrapperService.ts:161](https://github.com/daostack/arc.js/blob/f343aa24/lib/wrapperService.ts#L161)*



Wrapper factories by name. Use these when you want to do `.at()` or `.new()`. You can also use for `deployed()`, but the wrappers for deployed contracts are directly available from the `wrappers` and `wrappersByType` properties.




___

<a id="wrappers"></a>

### «Static» wrappers

**●  wrappers**:  *[ArcWrappers](../interfaces/ArcWrappers.md)*  =  {} as ArcWrappers

*Defined in [wrapperService.ts:151](https://github.com/daostack/arc.js/blob/f343aa24/lib/wrapperService.ts#L151)*



Wrappers by name, hydrated with contracts as deployed by the running version of Arc.js.




___

<a id="wrappersByAddress"></a>

### «Static» wrappersByAddress

**●  wrappersByAddress**:  *`Map`.<[Address](../#Address)>,.<[IContractWrapper](../interfaces/IContractWrapper.md)>*  =  new Map<Address, IContractWrapper>()

*Defined in [wrapperService.ts:171](https://github.com/daostack/arc.js/blob/f343aa24/lib/wrapperService.ts#L171)*



Map of contract wrappers keyed by address. For example:

`const wrapper = WrapperService.wrappersByAddress.get(anAddress);`

Currently only returns the wrappers for contracts that were deployed by the running version of Arc.js.




___

<a id="wrappersByType"></a>

### «Static» wrappersByType

**●  wrappersByType**:  *[ArcWrappersByType](../interfaces/ArcWrappersByType.md)*  =  {} as ArcWrappersByType

*Defined in [wrapperService.ts:155](https://github.com/daostack/arc.js/blob/f343aa24/lib/wrapperService.ts#L155)*



Contract wrapper factories grouped by type




___


## Methods
<a id="confirmContractType"></a>

### «Static» confirmContractType

► **confirmContractType**(contractWrapperFound: *`any`*): `Promise`.<`boolean`>



*Defined in [wrapperService.ts:301](https://github.com/daostack/arc.js/blob/f343aa24/lib/wrapperService.ts#L301)*



Confirm the given contract wrapper wraps the same contract as it purports to, and is the one deployed in the running version of Arc.js.

This will reject wrappers of different versions of contracts with the same name in Arc.


**Parameters:**

| Param | Type | Description |
| ------ | ------ | ------ |
| contractWrapperFound | `any`   |  - |





**Returns:** `Promise`.<`boolean`>





___

<a id="getContractWrapper"></a>

### «Static» getContractWrapper

► **getContractWrapper**(contractName: *`string`*, address?: *`string`*): `Promise`.<[IContractWrapper](../interfaces/IContractWrapper.md)⎮`undefined`>



*Defined in [wrapperService.ts:278](https://github.com/daostack/arc.js/blob/f343aa24/lib/wrapperService.ts#L278)*



Returns the promise of an Arc.js contract wrapper or undefined if not found.

Most useful when you have both contract name and maybe the address and wish to most efficiently return the associated wrapper, or undefined when not found.


**Parameters:**

| Param | Type | Description |
| ------ | ------ | ------ |
| contractName | `string`   |  name of an Arc contract, like "SchemeRegistrar" |
| address | `string`   |  optional |





**Returns:** `Promise`.<[IContractWrapper](../interfaces/IContractWrapper.md)⎮`undefined`>





___

<a id="initialize"></a>

### «Static» initialize

► **initialize**(options?: *[WrapperServiceInitializeOptions](../interfaces/WrapperServiceInitializeOptions.md)*): `Promise`.<`void`>



*Defined in [wrapperService.ts:179](https://github.com/daostack/arc.js/blob/f343aa24/lib/wrapperService.ts#L179)*



initialize() must be called before any of the static properties will have values. It is called by ArcInitialize(), which in tur must be invoked by any application using Arc.js.


**Parameters:**

| Param | Type | Description |
| ------ | ------ | ------ |
| options | [WrapperServiceInitializeOptions](../interfaces/WrapperServiceInitializeOptions.md)   |  - |





**Returns:** `Promise`.<`void`>





___


