import BlockchainTimeModel from './models/BlockchainTimeModel'; import IBlockchain from './interfaces/IBlockchain'; import ServiceVersionModel from '../common/models/ServiceVersionModel'; import TransactionModel from '../common/models/TransactionModel'; /** * Class that communicates with the underlying blockchain using REST API defined by the protocol document. */ export default class Blockchain implements IBlockchain { uri: string; /** Interval for refreshing the cached blockchain time. */ static readonly cachedBlockchainTimeRefreshInSeconds = 60; /** Used for caching the blockchain time to avoid excessive time fetching over network. */ private cachedBlockchainTime; private serviceVersionFetcher; private fetch; /** URI that handles transaction operations. */ private transactionsUri; private timeUri; constructor(uri: string); /** * Initializes the blockchain client by initializing the cached blockchain time. */ initialize(): Promise; /** * The function that starts periodically anchoring operation batches to blockchain. */ startPeriodicCachedBlockchainTimeRefresh(): void; write(anchorString: string): Promise; read(sinceTransactionNumber?: number, transactionTimeHash?: string): Promise<{ moreTransactions: boolean; transactions: TransactionModel[]; }>; getFirstValidTransaction(transactions: TransactionModel[]): Promise; readonly approximateTime: BlockchainTimeModel; /** * Gets the version of the bitcoin service. */ getServiceVersion(): Promise; /** * Gets the latest blockchain time and updates the cached time. */ getLatestTime(): Promise; }