[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.

For more information, see [Web3 Events](/Events#web3events).

## Index

### Methods

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



---
## 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:154](https://github.com/daostack/arc.js/blob/f343aa24/lib/web3EventService.ts#L154)*



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:32](https://github.com/daostack/arc.js/blob/f343aa24/lib/web3EventService.ts#L32)*



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`.

For more information, see [Web3 Events](/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`





___


