mirror of
https://github.com/alexgo-io/stacks-blockchain-api.git
synced 2026-01-12 22:43:34 +08:00
* fix: socket-io client should not disconnect with no event reply * ci: disable socket-io per-message timeout test
43 lines
1.5 KiB
TypeScript
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;
|
|
}
|