Skip to content

Commit

Permalink
test: Refactor filter tests to be an order of magnitude faster to exe…
Browse files Browse the repository at this point in the history
…cute
  • Loading branch information
robdmoore committed Mar 26, 2024
1 parent 57f70f9 commit 999803a
Show file tree
Hide file tree
Showing 8 changed files with 398 additions and 378 deletions.
6 changes: 3 additions & 3 deletions docs/code/interfaces/types_arc_28.Arc28Event.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ 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)
[types/arc-28.ts:14](https://github.com/algorandfoundation/algokit-subscriber-ts/blob/main/src/types/arc-28.ts#L14)

___

Expand All @@ -36,7 +36,7 @@ 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)
[types/arc-28.ts:12](https://github.com/algorandfoundation/algokit-subscriber-ts/blob/main/src/types/arc-28.ts#L12)

___

Expand All @@ -48,4 +48,4 @@ 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)
[types/arc-28.ts:10](https://github.com/algorandfoundation/algokit-subscriber-ts/blob/main/src/types/arc-28.ts#L10)
10 changes: 5 additions & 5 deletions docs/code/interfaces/types_arc_28.Arc28EventGroup.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Whether or not to silently (with warning log) continue if an error is encountere

#### Defined in

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

___

Expand All @@ -38,7 +38,7 @@ The list of ARC-28 event definitions

#### Defined in

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

___

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

#### Defined in

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

___

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

#### Defined in

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

___

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

#### Defined in

[types/arc-28.ts:54](https://github.com/algorandfoundation/algokit-subscriber-ts/blob/main/src/types/arc-28.ts#L54)
[types/arc-28.ts:53](https://github.com/algorandfoundation/algokit-subscriber-ts/blob/main/src/types/arc-28.ts#L53)
10 changes: 5 additions & 5 deletions docs/code/interfaces/types_arc_28.Arc28EventToProcess.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ 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)
[types/arc-28.ts:35](https://github.com/algorandfoundation/algokit-subscriber-ts/blob/main/src/types/arc-28.ts#L35)

___

Expand All @@ -44,7 +44,7 @@ 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)
[types/arc-28.ts:29](https://github.com/algorandfoundation/algokit-subscriber-ts/blob/main/src/types/arc-28.ts#L29)

___

Expand All @@ -56,7 +56,7 @@ 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)
[types/arc-28.ts:33](https://github.com/algorandfoundation/algokit-subscriber-ts/blob/main/src/types/arc-28.ts#L33)

___

Expand All @@ -68,7 +68,7 @@ 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)
[types/arc-28.ts:31](https://github.com/algorandfoundation/algokit-subscriber-ts/blob/main/src/types/arc-28.ts#L31)

___

Expand All @@ -80,4 +80,4 @@ 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)
[types/arc-28.ts:27](https://github.com/algorandfoundation/algokit-subscriber-ts/blob/main/src/types/arc-28.ts#L27)
14 changes: 7 additions & 7 deletions docs/code/interfaces/types_arc_28.EmittedArc28Event.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ 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)
[types/arc-28.ts:41](https://github.com/algorandfoundation/algokit-subscriber-ts/blob/main/src/types/arc-28.ts#L41)

___

Expand All @@ -46,7 +46,7 @@ The named arguments extracted from the event that was emitted (where the argumen

#### Defined in

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

___

Expand All @@ -62,7 +62,7 @@ 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)
[types/arc-28.ts:35](https://github.com/algorandfoundation/algokit-subscriber-ts/blob/main/src/types/arc-28.ts#L35)

___

Expand All @@ -78,7 +78,7 @@ 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)
[types/arc-28.ts:29](https://github.com/algorandfoundation/algokit-subscriber-ts/blob/main/src/types/arc-28.ts#L29)

___

Expand All @@ -94,7 +94,7 @@ 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)
[types/arc-28.ts:33](https://github.com/algorandfoundation/algokit-subscriber-ts/blob/main/src/types/arc-28.ts#L33)

___

Expand All @@ -110,7 +110,7 @@ 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)
[types/arc-28.ts:31](https://github.com/algorandfoundation/algokit-subscriber-ts/blob/main/src/types/arc-28.ts#L31)

___

Expand All @@ -126,4 +126,4 @@ 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)
[types/arc-28.ts:27](https://github.com/algorandfoundation/algokit-subscriber-ts/blob/main/src/types/arc-28.ts#L27)
4 changes: 2 additions & 2 deletions docs/code/modules/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ The blocks

#### Defined in

[subscriptions.ts:867](https://github.com/algorandfoundation/algokit-subscriber-ts/blob/main/src/subscriptions.ts#L867)
[subscriptions.ts:868](https://github.com/algorandfoundation/algokit-subscriber-ts/blob/main/src/subscriptions.ts#L868)

___

Expand All @@ -65,4 +65,4 @@ The result of this subscription pull/poll.

#### Defined in

[subscriptions.ts:53](https://github.com/algorandfoundation/algokit-subscriber-ts/blob/main/src/subscriptions.ts#L53)
[subscriptions.ts:54](https://github.com/algorandfoundation/algokit-subscriber-ts/blob/main/src/subscriptions.ts#L54)
3 changes: 2 additions & 1 deletion src/subscriptions.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as algokit from '@algorandfoundation/algokit-utils'
import type { TransactionResult } from '@algorandfoundation/algokit-utils/types/indexer'
import * as msgpack from 'algorand-msgpack'
import algosdk, { OnApplicationComplete } from 'algosdk'
import algosdk from 'algosdk'
import type SearchForTransactions from 'algosdk/dist/types/client/v2/indexer/searchForTransactions'
import sha512, { sha512_256 } from 'js-sha512'
import {
Expand All @@ -27,6 +27,7 @@ import ABIValue = algosdk.ABIValue
import Algodv2 = algosdk.Algodv2
import Indexer = algosdk.Indexer
import TransactionType = algosdk.TransactionType
import OnApplicationComplete = algosdk.OnApplicationComplete

const deduplicateSubscribedTransactionsReducer = (dedupedTransactions: SubscribedTransaction[], t: SubscribedTransaction) => {
const existing = dedupedTransactions.find((e) => e.id === t.id)
Expand Down
1 change: 0 additions & 1 deletion src/types/arc-28.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import type { TransactionResult } from '@algorandfoundation/algokit-utils/types/indexer'
import algosdk from 'algosdk'
import ABIValue = algosdk.ABIValue
import TransactionType = algosdk.TransactionType

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

0 comments on commit 999803a

Please sign in to comment.