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



# Class: Web3EventService


Support for working with events that originate from Arc contracts and are served up by Web3.

See [Arc Web3 Events in Arc.js](/Events#web3events).

## Index

### Methods

* [createEntityFetcherFactory](Web3EventService.md#createEntityFetcherFactory)
* [createEventFetcherFactory](Web3EventService.md#createEventFetcherFactory)
* [pipeEntityFetcherFactory](Web3EventService.md#pipeEntityFetcherFactory)



---
## Methods
<a id="createEntityFetcherFactory"></a>

###  createEntityFetcherFactory

► **createEntityFetcherFactory**TEntity,TEventArgs(eventFetcherFactory: *[EventFetcherFactory](../#EventFetcherFactory)`TEventArgs`*, transformEventCallback: *[TransformEventCallback](../#TransformEventCallback)`TEntity`, `TEventArgs`*, baseArgFilter?: *`any`*): [EntityFetcherFactory](../#EntityFetcherFactory)`TEntity`, `TEventArgs`



*Defined in [web3EventService.ts:142](https://github.com/daostack/arc.js/blob/f779630e/lib/web3EventService.ts#L142)*



Converts a `EventFetcherFactory<TEventArgs>` into a `EntityFetcherFactory<TEntity, TEventArgs>`. So whenever a web3 event is received by the given `EventFetcherFactory`, we transform the `TEventArgs` into `TEntities`.

Note that the callback parameter of `EntityFetcher.get` is optional; you may alternatively obtain the promise of a `Array<TEntity>` from the return value of `get`.

See [Arc Web3 Events in Arc.js](/Events#web3events).


**Type parameters:**

#### TEntity 
#### TEventArgs 
**Parameters:**

| Param | Type | Default value | Description |
| ------ | ------ | ------ | ------ |
| eventFetcherFactory | [EventFetcherFactory](../#EventFetcherFactory)`TEventArgs`  | - |   - |
| transformEventCallback | [TransformEventCallback](../#TransformEventCallback)`TEntity`, `TEventArgs`  | - |   Function to convert an instance of TEventArgs intothe promise of an instance of TEntity. If it returns `undefined` then no entityis returned for that event, so this is a programatic way in which eventscan be filtered. |
| baseArgFilter | `any`  |  {} |   arg filter to always merge into any supplied argFilter. |





**Returns:** [EntityFetcherFactory](../#EntityFetcherFactory)`TEntity`, `TEventArgs`





___

<a id="createEventFetcherFactory"></a>

###  createEventFetcherFactory

► **createEventFetcherFactory**TEventArgs(baseEvent: *`any`*, preProcessEvent?: *[PreProcessEventCallback](../#PreProcessEventCallback)`TEventArgs`*, baseArgFilter?: *`any`*): [EventFetcherFactory](../#EventFetcherFactory)`TEventArgs`



*Defined in [web3EventService.ts:30](https://github.com/daostack/arc.js/blob/f779630e/lib/web3EventService.ts#L30)*



Returns a function that creates an EventFetcher<teventargs>. For subclasses to use to create their event handlers. This is identical to what you get with Truffle, except with enhancements.</teventargs>

Note that the callback parameter of `EventFetcher.get` is optional; you may alternatively obtain the promise of a `Array<TEventArgs>` from the return value of `get`.

See [Arc Web3 Events in Arc.js](/Events#web3events).
*__type__*: TEventArgs - name of the event args (EventResult) interface, like NewProposalEventResult



**Type parameters:**

#### TEventArgs 
**Parameters:**

| Param | Type | Default value | Description |
| ------ | ------ | ------ | ------ |
| baseEvent | `any`  | - |   the event from the Truffle contract. |
| preProcessEvent | [PreProcessEventCallback](../#PreProcessEventCallback)`TEventArgs`  | - |   optionally supply this to modify the err and log arguments before they arepassed to the `get`/`watch` callback. |
| baseArgFilter | `any`  |  {} |   arg filter to always merge into any supplied argFilter. |





**Returns:** [EventFetcherFactory](../#EventFetcherFactory)`TEventArgs`





___

<a id="pipeEntityFetcherFactory"></a>

###  pipeEntityFetcherFactory

► **pipeEntityFetcherFactory**TEntityDest,TEntitySrc,TEntityOriginalSrc(entityFetcherFactory: *[EntityFetcherFactory](../#EntityFetcherFactory)`TEntitySrc`, `TEntityOriginalSrc`*, transformEventCallback: *[TransformEventCallback](../#TransformEventCallback)`TEntityDest`, `TEntitySrc`*): [EntityFetcherFactory](../#EntityFetcherFactory)`TEntityDest`, `TEntitySrc`



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



Convert the EntityFetcherFactory<TEntitySrc, TEntityOriginalSrc> into an EntityFetcherFactory<TEntityDest, TEntitySrc>.


**Type parameters:**

#### TEntityDest 
#### TEntitySrc 
#### TEntityOriginalSrc 
**Parameters:**

| Param | Type | Description |
| ------ | ------ | ------ |
| entityFetcherFactory | [EntityFetcherFactory](../#EntityFetcherFactory)`TEntitySrc`, `TEntityOriginalSrc`   |  The source EntityFetcherFactory |
| transformEventCallback | [TransformEventCallback](../#TransformEventCallback)`TEntityDest`, `TEntitySrc`   |  Converts TEntitySrc into TEntityDest |





**Returns:** [EntityFetcherFactory](../#EntityFetcherFactory)`TEntityDest`, `TEntitySrc`





___


