Skip to content

Commit

Permalink
refactor: Tweaking the types to reduce maintenance burden
Browse files Browse the repository at this point in the history
Breaking chnge to type import paths. Import everything from @algorandfoundation/algokit-subscriber/types now
  • Loading branch information
robdmoore committed Mar 22, 2024
1 parent d7d922a commit d3bf82b
Show file tree
Hide file tree
Showing 33 changed files with 926 additions and 570 deletions.
2 changes: 2 additions & 0 deletions docs/code/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
### Modules

- [index](modules/index.md)
- [types](modules/types.md)
- [types/arc-28](modules/types_arc_28.md)
- [types/async-event-emitter](modules/types_async_event_emitter.md)
- [types/block](modules/types_block.md)
- [types/subscription](modules/types_subscription.md)
6 changes: 3 additions & 3 deletions docs/code/classes/index.AlgorandSubscriber.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ Handles the logic for subscribing to the Algorand blockchain and emitting events

### constructor

**new AlgorandSubscriber**(`subscription`, `algod`, `indexer?`): [`AlgorandSubscriber`](index.AlgorandSubscriber.md)
**new AlgorandSubscriber**(`config`, `algod`, `indexer?`): [`AlgorandSubscriber`](index.AlgorandSubscriber.md)

Create a new `AlgorandSubscriber`.

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `subscription` | [`SubscriptionConfig`](../interfaces/types_subscription.SubscriptionConfig.md) | The subscription configuration |
| `config` | [`AlgorandSubscriberConfig`](../interfaces/types_subscription.AlgorandSubscriberConfig.md) | The subscriber configuration |
| `algod` | `default` | An algod client |
| `indexer?` | `default` | An (optional) indexer client; only needed if `subscription.syncBehaviour` is `catchup-with-indexer` |

Expand Down Expand Up @@ -129,7 +129,7 @@ ___

### subscription

`Private` **subscription**: [`SubscriptionConfig`](../interfaces/types_subscription.SubscriptionConfig.md)
`Private` **subscription**: [`AlgorandSubscriberConfig`](../interfaces/types_subscription.AlgorandSubscriberConfig.md)

#### Defined in

Expand Down
51 changes: 51 additions & 0 deletions docs/code/interfaces/types_arc_28.Arc28Event.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
[@algorandfoundation/algokit-subscriber](../README.md) / [types/arc-28](../modules/types_arc_28.md) / Arc28Event

# Interface: Arc28Event

[types/arc-28](../modules/types_arc_28.md).Arc28Event

The definition of metadata for an ARC-28 event per https://github.com/algorandfoundation/ARCs/blob/main/ARCs/arc-0028.md#event.

## Table of contents

### Properties

- [args](types_arc_28.Arc28Event.md#args)
- [desc](types_arc_28.Arc28Event.md#desc)
- [name](types_arc_28.Arc28Event.md#name)

## Properties

### args

**args**: \{ `desc?`: `string` ; `name?`: `string` ; `type`: `string` }[]

The arguments of the event, in order

#### Defined in

[types/arc-28.ts:15](https://github.com/algorandfoundation/algokit-subscriber-ts/blob/main/src/types/arc-28.ts#L15)

___

### desc

`Optional` **desc**: `string`

Optional, user-friendly description for the event

#### Defined in

[types/arc-28.ts:13](https://github.com/algorandfoundation/algokit-subscriber-ts/blob/main/src/types/arc-28.ts#L13)

___

### name

**name**: `string`

The name of the event

#### Defined in

[types/arc-28.ts:11](https://github.com/algorandfoundation/algokit-subscriber-ts/blob/main/src/types/arc-28.ts#L11)
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
[@algorandfoundation/algokit-subscriber](../README.md) / [types/subscription](../modules/types_subscription.md) / Arc28EventGroup
[@algorandfoundation/algokit-subscriber](../README.md) / [types/arc-28](../modules/types_arc_28.md) / Arc28EventGroup

# Interface: Arc28EventGroup

[types/subscription](../modules/types_subscription.md).Arc28EventGroup
[types/arc-28](../modules/types_arc_28.md).Arc28EventGroup

Specifies a group of ARC-28 event definitions along with instructions for when to attempt to process the events.

## Table of contents

### Properties

- [continueOnError](types_subscription.Arc28EventGroup.md#continueonerror)
- [events](types_subscription.Arc28EventGroup.md#events)
- [groupName](types_subscription.Arc28EventGroup.md#groupname)
- [processForAppIds](types_subscription.Arc28EventGroup.md#processforappids)
- [processTransaction](types_subscription.Arc28EventGroup.md#processtransaction)
- [continueOnError](types_arc_28.Arc28EventGroup.md#continueonerror)
- [events](types_arc_28.Arc28EventGroup.md#events)
- [groupName](types_arc_28.Arc28EventGroup.md#groupname)
- [processForAppIds](types_arc_28.Arc28EventGroup.md#processforappids)
- [processTransaction](types_arc_28.Arc28EventGroup.md#processtransaction)

## Properties

Expand All @@ -26,19 +26,19 @@ Whether or not to silently (with warning log) continue if an error is encountere

#### Defined in

[types/subscription.ts:56](https://github.com/algorandfoundation/algokit-subscriber-ts/blob/main/src/types/subscription.ts#L56)
[types/arc-28.ts:56](https://github.com/algorandfoundation/algokit-subscriber-ts/blob/main/src/types/arc-28.ts#L56)

___

### events

**events**: [`Arc28Event`](types_subscription.Arc28Event.md)[]
**events**: [`Arc28Event`](types_arc_28.Arc28Event.md)[]

The list of ARC-28 event definitions

#### Defined in

[types/subscription.ts:58](https://github.com/algorandfoundation/algokit-subscriber-ts/blob/main/src/types/subscription.ts#L58)
[types/arc-28.ts:58](https://github.com/algorandfoundation/algokit-subscriber-ts/blob/main/src/types/arc-28.ts#L58)

___

Expand All @@ -50,7 +50,7 @@ The name to designate for this group of events.

#### Defined in

[types/subscription.ts:50](https://github.com/algorandfoundation/algokit-subscriber-ts/blob/main/src/types/subscription.ts#L50)
[types/arc-28.ts:50](https://github.com/algorandfoundation/algokit-subscriber-ts/blob/main/src/types/arc-28.ts#L50)

___

Expand All @@ -62,7 +62,7 @@ Optional list of app IDs that this event should apply to

#### Defined in

[types/subscription.ts:52](https://github.com/algorandfoundation/algokit-subscriber-ts/blob/main/src/types/subscription.ts#L52)
[types/arc-28.ts:52](https://github.com/algorandfoundation/algokit-subscriber-ts/blob/main/src/types/arc-28.ts#L52)

___

Expand All @@ -88,4 +88,4 @@ Optional predicate to indicate if these ARC-28 events should be processed for th

#### Defined in

[types/subscription.ts:54](https://github.com/algorandfoundation/algokit-subscriber-ts/blob/main/src/types/subscription.ts#L54)
[types/arc-28.ts:54](https://github.com/algorandfoundation/algokit-subscriber-ts/blob/main/src/types/arc-28.ts#L54)
83 changes: 83 additions & 0 deletions docs/code/interfaces/types_arc_28.Arc28EventToProcess.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
[@algorandfoundation/algokit-subscriber](../README.md) / [types/arc-28](../modules/types_arc_28.md) / Arc28EventToProcess

# Interface: Arc28EventToProcess

[types/arc-28](../modules/types_arc_28.md).Arc28EventToProcess

An ARC-28 event to be processed

## Hierarchy

- **`Arc28EventToProcess`**

[`EmittedArc28Event`](types_arc_28.EmittedArc28Event.md)

## Table of contents

### Properties

- [eventDefinition](types_arc_28.Arc28EventToProcess.md#eventdefinition)
- [eventName](types_arc_28.Arc28EventToProcess.md#eventname)
- [eventPrefix](types_arc_28.Arc28EventToProcess.md#eventprefix)
- [eventSignature](types_arc_28.Arc28EventToProcess.md#eventsignature)
- [groupName](types_arc_28.Arc28EventToProcess.md#groupname)

## Properties

### eventDefinition

**eventDefinition**: [`Arc28Event`](types_arc_28.Arc28Event.md)

The ARC-28 definition of the event

#### Defined in

[types/arc-28.ts:36](https://github.com/algorandfoundation/algokit-subscriber-ts/blob/main/src/types/arc-28.ts#L36)

___

### eventName

**eventName**: `string`

The name of the ARC-28 event that was triggered

#### Defined in

[types/arc-28.ts:30](https://github.com/algorandfoundation/algokit-subscriber-ts/blob/main/src/types/arc-28.ts#L30)

___

### eventPrefix

**eventPrefix**: `string`

The 4-byte hex prefix for the event

#### Defined in

[types/arc-28.ts:34](https://github.com/algorandfoundation/algokit-subscriber-ts/blob/main/src/types/arc-28.ts#L34)

___

### eventSignature

**eventSignature**: `string`

The signature of the event e.g. `EventName(type1,type2)`

#### Defined in

[types/arc-28.ts:32](https://github.com/algorandfoundation/algokit-subscriber-ts/blob/main/src/types/arc-28.ts#L32)

___

### groupName

**groupName**: `string`

The name of the ARC-28 event group the event belongs to

#### Defined in

[types/arc-28.ts:28](https://github.com/algorandfoundation/algokit-subscriber-ts/blob/main/src/types/arc-28.ts#L28)
129 changes: 129 additions & 0 deletions docs/code/interfaces/types_arc_28.EmittedArc28Event.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
[@algorandfoundation/algokit-subscriber](../README.md) / [types/arc-28](../modules/types_arc_28.md) / EmittedArc28Event

# Interface: EmittedArc28Event

[types/arc-28](../modules/types_arc_28.md).EmittedArc28Event

An emitted ARC-28 event extracted from an app call log.

## Hierarchy

- [`Arc28EventToProcess`](types_arc_28.Arc28EventToProcess.md)

**`EmittedArc28Event`**

## Table of contents

### Properties

- [args](types_arc_28.EmittedArc28Event.md#args)
- [argsByName](types_arc_28.EmittedArc28Event.md#argsbyname)
- [eventDefinition](types_arc_28.EmittedArc28Event.md#eventdefinition)
- [eventName](types_arc_28.EmittedArc28Event.md#eventname)
- [eventPrefix](types_arc_28.EmittedArc28Event.md#eventprefix)
- [eventSignature](types_arc_28.EmittedArc28Event.md#eventsignature)
- [groupName](types_arc_28.EmittedArc28Event.md#groupname)

## Properties

### args

**args**: `ABIValue`[]

The ordered arguments extracted from the event that was emitted

#### Defined in

[types/arc-28.ts:42](https://github.com/algorandfoundation/algokit-subscriber-ts/blob/main/src/types/arc-28.ts#L42)

___

### argsByName

**argsByName**: `Record`\<`string`, `ABIValue`\>

The named arguments extracted from the event that was emitted (where the arguments had a name defined)

#### Defined in

[types/arc-28.ts:44](https://github.com/algorandfoundation/algokit-subscriber-ts/blob/main/src/types/arc-28.ts#L44)

___

### eventDefinition

**eventDefinition**: [`Arc28Event`](types_arc_28.Arc28Event.md)

The ARC-28 definition of the event

#### Inherited from

[Arc28EventToProcess](types_arc_28.Arc28EventToProcess.md).[eventDefinition](types_arc_28.Arc28EventToProcess.md#eventdefinition)

#### Defined in

[types/arc-28.ts:36](https://github.com/algorandfoundation/algokit-subscriber-ts/blob/main/src/types/arc-28.ts#L36)

___

### eventName

**eventName**: `string`

The name of the ARC-28 event that was triggered

#### Inherited from

[Arc28EventToProcess](types_arc_28.Arc28EventToProcess.md).[eventName](types_arc_28.Arc28EventToProcess.md#eventname)

#### Defined in

[types/arc-28.ts:30](https://github.com/algorandfoundation/algokit-subscriber-ts/blob/main/src/types/arc-28.ts#L30)

___

### eventPrefix

**eventPrefix**: `string`

The 4-byte hex prefix for the event

#### Inherited from

[Arc28EventToProcess](types_arc_28.Arc28EventToProcess.md).[eventPrefix](types_arc_28.Arc28EventToProcess.md#eventprefix)

#### Defined in

[types/arc-28.ts:34](https://github.com/algorandfoundation/algokit-subscriber-ts/blob/main/src/types/arc-28.ts#L34)

___

### eventSignature

**eventSignature**: `string`

The signature of the event e.g. `EventName(type1,type2)`

#### Inherited from

[Arc28EventToProcess](types_arc_28.Arc28EventToProcess.md).[eventSignature](types_arc_28.Arc28EventToProcess.md#eventsignature)

#### Defined in

[types/arc-28.ts:32](https://github.com/algorandfoundation/algokit-subscriber-ts/blob/main/src/types/arc-28.ts#L32)

___

### groupName

**groupName**: `string`

The name of the ARC-28 event group the event belongs to

#### Inherited from

[Arc28EventToProcess](types_arc_28.Arc28EventToProcess.md).[groupName](types_arc_28.Arc28EventToProcess.md#groupname)

#### Defined in

[types/arc-28.ts:28](https://github.com/algorandfoundation/algokit-subscriber-ts/blob/main/src/types/arc-28.ts#L28)
Loading

0 comments on commit d3bf82b

Please sign in to comment.