Files
Matthew Little d596fd5cc7 fix: socket-io client should not disconnect with no event reply (#1800)
* fix: socket-io client should not disconnect with no event reply

* ci: disable socket-io per-message timeout test
2024-01-05 18:00:40 +01:00

43 lines
1.5 KiB
TypeScript

import type {
AddressStxBalanceResponse,
AddressTransactionWithTransfers,
Block,
Microblock,
Transaction,
MempoolTransaction,
NftEvent
} from '..';
export type AddressTransactionTopic = `address-transaction:${string}`;
export type AddressStxBalanceTopic = `address-stx-balance:${string}`;
export type TransactionTopic = `transaction:${string}`;
export type NftAssetEventTopic = `nft-asset-event:${string}+${string}`;
export type NftCollectionEventTopic = `nft-collection-event:${string}`;
export type Topic =
| 'block'
| 'microblock'
| 'mempool'
| 'nft-event'
| AddressTransactionTopic
| AddressStxBalanceTopic
| TransactionTopic
| NftAssetEventTopic
| NftCollectionEventTopic;
export interface ClientToServerMessages {
subscribe: (topic: Topic | Topic[], callback: (error: string | null) => void) => void;
unsubscribe: (...topic: Topic[]) => void;
}
export interface ServerToClientMessages {
block: (block: Block) => void;
microblock: (microblock: Microblock) => void;
mempool: (transaction: MempoolTransaction) => void;
'nft-event': (event: NftEvent) => void;
[key: TransactionTopic]: (transaction: Transaction | MempoolTransaction) => void;
[key: NftAssetEventTopic]: (assetIdentifier: string, value: string, event: NftEvent) => void;
[key: NftCollectionEventTopic]: (assetIdentifier: string, event: NftEvent) => void;
[key: AddressTransactionTopic]: (address: string, stxBalance: AddressTransactionWithTransfers) => void;
[key: AddressStxBalanceTopic]: (address: string, stxBalance: AddressStxBalanceResponse) => void;
}