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



# Class: TransactionService


Enables you to track the completion of transactions triggered by Arc.js functions. You can subscribe to events that tell you how many transactions are anticipated when the transactions have completed. For more information, see [subscribe](TransactionService#subscribe).

## Hierarchy


 [EventService](EventService.md)

**↳ TransactionService**







## Index

### Methods

* [clearAllSubscriptions](TransactionService.md#clearAllSubscriptions)
* [generateInvocationKey](TransactionService.md#generateInvocationKey)
* [publish](TransactionService.md#publish)
* [publishKickoffEvent](TransactionService.md#publishKickoffEvent)
* [publishTxEvent](TransactionService.md#publishTxEvent)
* [resendTxEvents](TransactionService.md#resendTxEvents)
* [subscribe](TransactionService.md#subscribe)
* [unsubscribe](TransactionService.md#unsubscribe)



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

### «Static» clearAllSubscriptions

► **clearAllSubscriptions**(): `void`



*Inherited from [EventService](EventService.md).[clearAllSubscriptions](EventService.md#clearAllSubscriptions)*

*Defined in [eventService.ts:32](https://github.com/daostack/arc.js/blob/77005d4/lib/eventService.ts#L32)*



Remove all subscriptions




**Returns:** `void`





___

<a id="generateInvocationKey"></a>

### «Static» generateInvocationKey

► **generateInvocationKey**(topic: *`string`*): `symbol`



*Defined in [transactionService.ts:16](https://github.com/daostack/arc.js/blob/77005d4/lib/transactionService.ts#L16)*



Generate a new invocation key for the given topic and function. Topic should look like "[classname][functionname]".


**Parameters:**

| Param | Type | Description |
| ------ | ------ | ------ |
| topic | `string`   |  - |





**Returns:** `symbol`





___

<a id="publish"></a>

### «Static» publish

► **publish**(topic: *`string`*, payload: *`any`*): `boolean`



*Inherited from [EventService](EventService.md).[publish](EventService.md#publish)*

*Defined in [eventService.ts:12](https://github.com/daostack/arc.js/blob/77005d4/lib/eventService.ts#L12)*



Send the given payload to subscribers of the given topic.


**Parameters:**

| Param | Type | Description |
| ------ | ------ | ------ |
| topic | `string`   |  See [subscribe](EventService#subscribe) |
| payload | `any`   |  Sent in the subscription callback. |





**Returns:** `boolean`
True if there are any subscribers






___

<a id="publishKickoffEvent"></a>

### «Static» publishKickoffEvent

► **publishKickoffEvent**(topic: *`string`*, options: *`any`*, txCount: *`number`*, suppressKickOff?: *`boolean`*): [TransactionReceiptsEventInfo](../interfaces/TransactionReceiptsEventInfo.md)



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



Publish the kick-off event and return the payload that should be used for the ensuing events that will carry an actual tx in the payload for the invoked function. `invocationKey` is a unique key for the returned payload that can be used for scoping the events.


**Parameters:**

| Param | Type | Default value | Description |
| ------ | ------ | ------ | ------ |
| topic | `string`  | - |   - |
| options | `any`  | - |   - |
| txCount | `number`  | - |   - |
| suppressKickOff | `boolean`  | false |   - |





**Returns:** [TransactionReceiptsEventInfo](../interfaces/TransactionReceiptsEventInfo.md)





___

<a id="publishTxEvent"></a>

### «Static» publishTxEvent

► **publishTxEvent**(topic: *`string`*, payload: *[TransactionReceiptsEventInfo](../interfaces/TransactionReceiptsEventInfo.md)*, tx?: *[TransactionReceiptTruffle](../interfaces/TransactionReceiptTruffle.md)*): `boolean`



*Defined in [transactionService.ts:61](https://github.com/daostack/arc.js/blob/77005d4/lib/transactionService.ts#L61)*



Send the given payload to subscribers of the given topic.


**Parameters:**

| Param | Type | Description |
| ------ | ------ | ------ |
| topic | `string`   |  See [subscribe](EventService#subscribe) |
| payload | [TransactionReceiptsEventInfo](../interfaces/TransactionReceiptsEventInfo.md)   |  Sent in the subscription callback. |
| tx | [TransactionReceiptTruffle](../interfaces/TransactionReceiptTruffle.md)   |  the transaction. Don't supply for kick-off event. |





**Returns:** `boolean`
True if there are any subscribers






___

<a id="resendTxEvents"></a>

### «Static» resendTxEvents

► **resendTxEvents**(topics: *`Array`.<`string`>⎮`string`*, superTopic: *`string`*, superPayload: *[TransactionReceiptsEventInfo](../interfaces/TransactionReceiptsEventInfo.md)*): [IEventSubscription](../interfaces/IEventSubscription.md)



*Defined in [transactionService.ts:79](https://github.com/daostack/arc.js/blob/77005d4/lib/transactionService.ts#L79)*



Subscribe to all given topics and resend as the given supertopic with superPayload.


**Parameters:**

| Param | Type | Description |
| ------ | ------ | ------ |
| topics | `Array`.<`string`>⎮`string`   |  topics or topic |
| superTopic | `string`   |  topic to resend as |
| superPayload | [TransactionReceiptsEventInfo](../interfaces/TransactionReceiptsEventInfo.md)   |  payload to send |





**Returns:** [IEventSubscription](../interfaces/IEventSubscription.md)
An interface with `.unsubscribe()`.  Be sure to call it!






___

<a id="subscribe"></a>

### «Static» subscribe

► **subscribe**(topics: *`string`⎮`Array`.<`string`>*, callback: *[EventSubscriptionCallback](../#EventSubscriptionCallback)*): [IEventSubscription](../interfaces/IEventSubscription.md)



*Inherited from [EventService](EventService.md).[subscribe](EventService.md#subscribe)*

*Defined in [eventService.ts:23](https://github.com/daostack/arc.js/blob/77005d4/lib/eventService.ts#L23)*



Subscribe to the given topic or array of topics.


**Parameters:**

| Param | Type | Description |
| ------ | ------ | ------ |
| topics | `string`⎮`Array`.<`string`>   |  Identifies the event(s) to which you wish to subscribe |
| callback | [EventSubscriptionCallback](../#EventSubscriptionCallback)   |  The function to call when the requested events are published |





**Returns:** [IEventSubscription](../interfaces/IEventSubscription.md)
An interface with `.unsubscribe()`.  Be sure to call it!






___

<a id="unsubscribe"></a>

### «Static» unsubscribe

► **unsubscribe**(key: *[EventSubscriptionKey](../#EventSubscriptionKey)*): `void`



*Inherited from [EventService](EventService.md).[unsubscribe](EventService.md#unsubscribe)*

*Defined in [eventService.ts:44](https://github.com/daostack/arc.js/blob/77005d4/lib/eventService.ts#L44)*



Removes a subscription. When passed a token, removes a specific subscription, when passed a callback, removes all subscriptions for that callback, when passed a topic, removes all subscriptions for the topic hierarchy.


**Parameters:**

| Param | Type | Description |
| ------ | ------ | ------ |
| key | [EventSubscriptionKey](../#EventSubscriptionKey)   |  A token, function or topic to unsubscribe. |





**Returns:** `void`





___


