import { EventEmitter } from 'events'; import * as Encryption from './encryption-types'; /** Transaction Manager interface */ export interface ITransactionManager { persistTransaction: (transactionData: ITransactionData, channelId: string, topics?: string[], encryptionParams?: Encryption.IEncryptionParameters[]) => Promise; getTransactionsByChannelId: (channelId: string, timestampBoundaries?: ITimestampBoundaries) => Promise; getChannelsByTopic: (topic: string, updatedBetween?: ITimestampBoundaries, page?: number, pageSize?: number) => Promise; getChannelsByMultipleTopics: (topics: string[], updatedBetween?: ITimestampBoundaries, page?: number, pageSize?: number) => Promise; } /** Restrict the get data research to two timestamp */ export interface ITimestampBoundaries { from?: number; to?: number; } /** return interface for PersistTransaction */ export interface IReturnPersistTransaction extends EventEmitter { /** meta information */ meta: { /** meta-data from the layer below */ dataAccessMeta?: any; /** encryption method used if transaction encrypted */ encryptionMethod?: string; }; /** result of the execution */ result: Record; } /** return interface for getTransactionsByChannelId */ export interface IReturnGetTransactions { /** meta information */ meta: { /** meta-data from the layer below */ dataAccessMeta?: any; /** encryption method used if transaction encrypted */ encryptionMethod?: string; /** Ignored transactions */ ignoredTransactions: Array; }; /** result of the execution */ result: { transactions: Array; }; } /** return interface for getTransactionsByChannelId */ export interface IReturnGetTransactionsByChannels { /** meta information */ meta: { /** meta-data from the layer below */ dataAccessMeta?: any; /** encryption method used if transaction encrypted */ encryptionMethod?: string; /** Ignored transactions */ ignoredTransactions: { [key: string]: Array; }; }; /** result of the execution */ result: { transactions: { [key: string]: Array; }; }; } /** Persisted Transaction in data-access */ export interface IPersistedTransaction { data?: ITransactionData; encryptedData?: ITransactionData; /** Symmetric key encrypted with asymmetric key from the parties keys, indexed by the hash of their identities */ keys?: IKeysDictionary; /** Encryption method */ encryptionMethod?: string; } /** Enum of state possible for an action */ export declare enum TransactionState { PENDING = "pending", CONFIRMED = "confirmed" } /** Transaction confirmed */ export interface ITimestampedTransaction { state: TransactionState; transaction: IPersistedTransaction; timestamp: number; } /** Transaction data */ export type ITransactionData = string; /** Ignored transaction */ export interface IIgnoredTransaction { transaction: ITimestampedTransaction; reason: string; } /** Transaction class */ export interface ITransaction { getData: () => Promise; getHash: () => Promise; getError: () => Promise; } /** Keys dictionary */ export interface IKeysDictionary { [key: string]: string; } /** Channel type */ export declare enum ChannelType { UNKNOWN = 0, CLEAR = 1, ENCRYPTED = 2 } //# sourceMappingURL=transaction-types.d.ts.map