diff --git a/docs/code/README.md b/docs/code/README.md index 9176a070..58207d93 100644 --- a/docs/code/README.md +++ b/docs/code/README.md @@ -44,6 +44,7 @@ - [types/expand](modules/types_expand.md) - [types/indexer](modules/types_indexer.md) - [types/kmd-account-manager](modules/types_kmd_account_manager.md) +- [types/lifecycle-events](modules/types_lifecycle_events.md) - [types/logging](modules/types_logging.md) - [types/logic-error](modules/types_logic_error.md) - [types/network-client](modules/types_network_client.md) diff --git a/docs/code/classes/types_async_event_emitter.AsyncEventEmitter.md b/docs/code/classes/types_async_event_emitter.AsyncEventEmitter.md index 9ca3e4cf..1c739789 100644 --- a/docs/code/classes/types_async_event_emitter.AsyncEventEmitter.md +++ b/docs/code/classes/types_async_event_emitter.AsyncEventEmitter.md @@ -41,7 +41,7 @@ #### Defined in -[src/types/async-event-emitter.ts:18](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/async-event-emitter.ts#L18) +[src/types/async-event-emitter.ts:7](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/async-event-emitter.ts#L7) ___ @@ -51,7 +51,7 @@ ___ #### Defined in -[src/types/async-event-emitter.ts:17](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/async-event-emitter.ts#L17) +[src/types/async-event-emitter.ts:6](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/async-event-emitter.ts#L6) ___ @@ -76,7 +76,7 @@ ___ #### Defined in -[src/types/async-event-emitter.ts:66](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/async-event-emitter.ts#L66) +[src/types/async-event-emitter.ts:55](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/async-event-emitter.ts#L55) ## Methods @@ -88,14 +88,14 @@ ___ | Name | Type | | :------ | :------ | -| `K` | extends [`EventType`](../enums/types_async_event_emitter.EventType.md) | +| `K` | extends [`EventType`](../enums/types_lifecycle_events.EventType.md) | #### Parameters | Name | Type | | :------ | :------ | | `eventName` | `K` | -| `event` | [`EventDataMap`](../modules/types_async_event_emitter.md#eventdatamap)[`K`] | +| `event` | [`EventDataMap`](../modules/types_lifecycle_events.md#eventdatamap)[`K`] | #### Returns @@ -103,7 +103,7 @@ ___ #### Defined in -[src/types/async-event-emitter.ts:20](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/async-event-emitter.ts#L20) +[src/types/async-event-emitter.ts:9](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/async-event-emitter.ts#L9) ▸ **emitAsync**(`eventName`, `event`): `Promise`\<`void`\> @@ -120,7 +120,7 @@ ___ #### Defined in -[src/types/async-event-emitter.ts:21](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/async-event-emitter.ts#L21) +[src/types/async-event-emitter.ts:10](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/async-event-emitter.ts#L10) ___ @@ -132,14 +132,14 @@ ___ | Name | Type | | :------ | :------ | -| `K` | extends [`EventType`](../enums/types_async_event_emitter.EventType.md) | +| `K` | extends [`EventType`](../enums/types_lifecycle_events.EventType.md) | #### Parameters | Name | Type | | :------ | :------ | | `eventName` | `K` | -| `listener` | [`AsyncEventListener`](../modules/types_async_event_emitter.md#asynceventlistener)\<[`EventDataMap`](../modules/types_async_event_emitter.md#eventdatamap)[`K`]\> | +| `listener` | [`AsyncEventListener`](../modules/types_async_event_emitter.md#asynceventlistener)\<[`EventDataMap`](../modules/types_lifecycle_events.md#eventdatamap)[`K`]\> | #### Returns @@ -147,7 +147,7 @@ ___ #### Defined in -[src/types/async-event-emitter.ts:28](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/async-event-emitter.ts#L28) +[src/types/async-event-emitter.ts:17](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/async-event-emitter.ts#L17) ▸ **on**\<`T`\>(`eventName`, `listener`): [`AsyncEventEmitter`](types_async_event_emitter.AsyncEventEmitter.md) @@ -170,7 +170,7 @@ ___ #### Defined in -[src/types/async-event-emitter.ts:29](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/async-event-emitter.ts#L29) +[src/types/async-event-emitter.ts:18](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/async-event-emitter.ts#L18) ___ @@ -182,14 +182,14 @@ ___ | Name | Type | | :------ | :------ | -| `K` | extends [`EventType`](../enums/types_async_event_emitter.EventType.md) | +| `K` | extends [`EventType`](../enums/types_lifecycle_events.EventType.md) | #### Parameters | Name | Type | | :------ | :------ | | `eventName` | `K` | -| `listener` | [`AsyncEventListener`](../modules/types_async_event_emitter.md#asynceventlistener)\<[`EventDataMap`](../modules/types_async_event_emitter.md#eventdatamap)[`K`]\> | +| `listener` | [`AsyncEventListener`](../modules/types_async_event_emitter.md#asynceventlistener)\<[`EventDataMap`](../modules/types_lifecycle_events.md#eventdatamap)[`K`]\> | #### Returns @@ -197,7 +197,7 @@ ___ #### Defined in -[src/types/async-event-emitter.ts:36](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/async-event-emitter.ts#L36) +[src/types/async-event-emitter.ts:25](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/async-event-emitter.ts#L25) ▸ **once**\<`T`\>(`eventName`, `listener`): [`AsyncEventEmitter`](types_async_event_emitter.AsyncEventEmitter.md) @@ -220,7 +220,7 @@ ___ #### Defined in -[src/types/async-event-emitter.ts:37](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/async-event-emitter.ts#L37) +[src/types/async-event-emitter.ts:26](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/async-event-emitter.ts#L26) ___ @@ -241,4 +241,4 @@ ___ #### Defined in -[src/types/async-event-emitter.ts:50](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/async-event-emitter.ts#L50) +[src/types/async-event-emitter.ts:39](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/async-event-emitter.ts#L39) diff --git a/docs/code/enums/types_async_event_emitter.EventType.md b/docs/code/enums/types_async_event_emitter.EventType.md deleted file mode 100644 index aeb5087b..00000000 --- a/docs/code/enums/types_async_event_emitter.EventType.md +++ /dev/null @@ -1,32 +0,0 @@ -[@algorandfoundation/algokit-utils](../README.md) / [types/async-event-emitter](../modules/types_async_event_emitter.md) / EventType - -# Enumeration: EventType - -[types/async-event-emitter](../modules/types_async_event_emitter.md).EventType - -## Table of contents - -### Enumeration Members - -- [AppCompiled](types_async_event_emitter.EventType.md#appcompiled) -- [TxnGroupSimulated](types_async_event_emitter.EventType.md#txngroupsimulated) - -## Enumeration Members - -### AppCompiled - -• **AppCompiled** = ``"AppCompiled"`` - -#### Defined in - -[src/types/async-event-emitter.ts:5](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/async-event-emitter.ts#L5) - -___ - -### TxnGroupSimulated - -• **TxnGroupSimulated** = ``"TxnGroupSimulated"`` - -#### Defined in - -[src/types/async-event-emitter.ts:4](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/async-event-emitter.ts#L4) diff --git a/docs/code/enums/types_lifecycle_events.EventType.md b/docs/code/enums/types_lifecycle_events.EventType.md new file mode 100644 index 00000000..cac1b952 --- /dev/null +++ b/docs/code/enums/types_lifecycle_events.EventType.md @@ -0,0 +1,32 @@ +[@algorandfoundation/algokit-utils](../README.md) / [types/lifecycle-events](../modules/types_lifecycle_events.md) / EventType + +# Enumeration: EventType + +[types/lifecycle-events](../modules/types_lifecycle_events.md).EventType + +## Table of contents + +### Enumeration Members + +- [AppCompiled](types_lifecycle_events.EventType.md#appcompiled) +- [TxnGroupSimulated](types_lifecycle_events.EventType.md#txngroupsimulated) + +## Enumeration Members + +### AppCompiled + +• **AppCompiled** = ``"AppCompiled"`` + +#### Defined in + +[src/types/lifecycle-events.ts:5](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/lifecycle-events.ts#L5) + +___ + +### TxnGroupSimulated + +• **TxnGroupSimulated** = ``"TxnGroupSimulated"`` + +#### Defined in + +[src/types/lifecycle-events.ts:4](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/lifecycle-events.ts#L4) diff --git a/docs/code/modules/index.md b/docs/code/modules/index.md index 9936dfa3..98b9555e 100644 --- a/docs/code/modules/index.md +++ b/docs/code/modules/index.md @@ -10,6 +10,8 @@ - [AVMTracesEventData](index.md#avmtraceseventdata) - [AlgorandClient](index.md#algorandclient) - [DEFAULT\_MAX\_SEARCH\_DEPTH](index.md#default_max_search_depth) +- [EventDataMap](index.md#eventdatamap) +- [EventType](index.md#eventtype) - [SOURCES\_DIR](index.md#sources_dir) - [TEAL\_FILE\_EXT](index.md#teal_file_ext) - [TEAL\_SOURCEMAP\_EXT](index.md#teal_sourcemap_ext) @@ -158,6 +160,18 @@ Re-exports [DEFAULT_MAX_SEARCH_DEPTH](types_debugging.md#default_max_search_dept ___ +### EventDataMap + +Re-exports [EventDataMap](types_lifecycle_events.md#eventdatamap) + +___ + +### EventType + +Re-exports [EventType](../enums/types_lifecycle_events.EventType.md) + +___ + ### SOURCES\_DIR Re-exports [SOURCES_DIR](types_debugging.md#sources_dir) diff --git a/docs/code/modules/types_async_event_emitter.md b/docs/code/modules/types_async_event_emitter.md index 89b27a0f..6fda8746 100644 --- a/docs/code/modules/types_async_event_emitter.md +++ b/docs/code/modules/types_async_event_emitter.md @@ -4,10 +4,6 @@ ## Table of contents -### Enumerations - -- [EventType](../enums/types_async_event_emitter.EventType.md) - ### Classes - [AsyncEventEmitter](../classes/types_async_event_emitter.AsyncEventEmitter.md) @@ -15,7 +11,6 @@ ### Type Aliases - [AsyncEventListener](types_async_event_emitter.md#asynceventlistener) -- [EventDataMap](types_async_event_emitter.md#eventdatamap) ## Type Aliases @@ -46,25 +41,4 @@ #### Defined in -[src/types/async-event-emitter.ts:14](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/async-event-emitter.ts#L14) - -___ - -### EventDataMap - -Ƭ **EventDataMap**: `Object` - -#### Index signature - -▪ [key: `string`]: `unknown` - -#### Type declaration - -| Name | Type | -| :------ | :------ | -| `AppCompiled` | [`TealSourcesDebugEventData`](../interfaces/types_debugging.TealSourcesDebugEventData.md) | -| `TxnGroupSimulated` | [`AVMTracesEventData`](../interfaces/types_debugging.AVMTracesEventData.md) | - -#### Defined in - -[src/types/async-event-emitter.ts:8](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/async-event-emitter.ts#L8) +[src/types/async-event-emitter.ts:3](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/async-event-emitter.ts#L3) diff --git a/docs/code/modules/types_lifecycle_events.md b/docs/code/modules/types_lifecycle_events.md new file mode 100644 index 00000000..f8ef9844 --- /dev/null +++ b/docs/code/modules/types_lifecycle_events.md @@ -0,0 +1,34 @@ +[@algorandfoundation/algokit-utils](../README.md) / types/lifecycle-events + +# Module: types/lifecycle-events + +## Table of contents + +### Enumerations + +- [EventType](../enums/types_lifecycle_events.EventType.md) + +### Type Aliases + +- [EventDataMap](types_lifecycle_events.md#eventdatamap) + +## Type Aliases + +### EventDataMap + +Ƭ **EventDataMap**: `Object` + +#### Index signature + +▪ [key: `string`]: `unknown` + +#### Type declaration + +| Name | Type | +| :------ | :------ | +| `AppCompiled` | [`TealSourcesDebugEventData`](../interfaces/types_debugging.TealSourcesDebugEventData.md) | +| `TxnGroupSimulated` | [`AVMTracesEventData`](../interfaces/types_debugging.AVMTracesEventData.md) | + +#### Defined in + +[src/types/lifecycle-events.ts:8](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/lifecycle-events.ts#L8) diff --git a/src/index.ts b/src/index.ts index be83563c..7e8670fc 100644 --- a/src/index.ts +++ b/src/index.ts @@ -18,3 +18,4 @@ export * as indexer from './indexer-lookup' export * from './transaction' export { AlgorandClient } from './types/algorand-client' export * from './types/debugging' +export * from './types/lifecycle-events' diff --git a/src/transaction/transaction.ts b/src/transaction/transaction.ts index 921a6922..7285b45d 100644 --- a/src/transaction/transaction.ts +++ b/src/transaction/transaction.ts @@ -3,7 +3,7 @@ import { Buffer } from 'buffer' import { Config } from '../config' import { AlgoAmount } from '../types/amount' import { ABIReturn } from '../types/app' -import { EventType } from '../types/async-event-emitter' +import { EventType } from '../types/lifecycle-events' import { AtomicTransactionComposerToSend, SendAtomicTransactionComposerResults, diff --git a/src/types/app-client.ts b/src/types/app-client.ts index 633a6935..f7012629 100644 --- a/src/types/app-client.ts +++ b/src/types/app-client.ts @@ -57,7 +57,6 @@ import { import { AppLookup } from './app-deployer' import { AppManager, BoxIdentifier } from './app-manager' import { AppSpec, arc32ToArc56 } from './app-spec' -import { EventType } from './async-event-emitter' import AlgoKitComposer, { AppCallMethodCall, AppCallParams, @@ -71,6 +70,7 @@ import AlgoKitComposer, { PaymentParams, } from './composer' import { Expand } from './expand' +import { EventType } from './lifecycle-events' import { LogicError } from './logic-error' import { SendParams, SendTransactionFrom, SendTransactionParams, TransactionNote } from './transaction' import ABIMethod = algosdk.ABIMethod diff --git a/src/types/async-event-emitter.ts b/src/types/async-event-emitter.ts index c97e9d84..601635d9 100644 --- a/src/types/async-event-emitter.ts +++ b/src/types/async-event-emitter.ts @@ -1,15 +1,4 @@ -import { AVMTracesEventData, TealSourcesDebugEventData } from './debugging' - -export enum EventType { - TxnGroupSimulated = 'TxnGroupSimulated', - AppCompiled = 'AppCompiled', -} - -export type EventDataMap = { - [EventType.TxnGroupSimulated]: AVMTracesEventData - [EventType.AppCompiled]: TealSourcesDebugEventData - [key: string]: unknown -} +import { EventDataMap, EventType } from './lifecycle-events' export type AsyncEventListener = (event: T, eventName: string | symbol) => Promise | void diff --git a/src/types/composer.ts b/src/types/composer.ts index 4c02ed0d..8c757fb3 100644 --- a/src/types/composer.ts +++ b/src/types/composer.ts @@ -5,8 +5,8 @@ import { TransactionSignerAccount } from './account' import { AlgoAmount } from './amount' import { APP_PAGE_MAX_SIZE } from './app' import { AppManager, BoxIdentifier, BoxReference } from './app-manager' -import { EventType } from './async-event-emitter' import { Expand } from './expand' +import { EventType } from './lifecycle-events' import { genesisIdIsLocalNet } from './network-client' import { Arc2TransactionNote, SendAtomicTransactionComposerResults, SendParams } from './transaction' import AtomicTransactionComposer = algosdk.AtomicTransactionComposer diff --git a/src/types/lifecycle-events.ts b/src/types/lifecycle-events.ts new file mode 100644 index 00000000..6bc06664 --- /dev/null +++ b/src/types/lifecycle-events.ts @@ -0,0 +1,12 @@ +import { AVMTracesEventData, TealSourcesDebugEventData } from './debugging' + +export enum EventType { + TxnGroupSimulated = 'TxnGroupSimulated', + AppCompiled = 'AppCompiled', +} + +export type EventDataMap = { + [EventType.TxnGroupSimulated]: AVMTracesEventData + [EventType.AppCompiled]: TealSourcesDebugEventData + [key: string]: unknown +}