diff --git a/src/RPC/Network.ts b/src/RPC/Network.ts index 62aeeda..657e8e3 100644 --- a/src/RPC/Network.ts +++ b/src/RPC/Network.ts @@ -1,4 +1,5 @@ import { Block, BlockWithTX } from '../contracts/block'; +import { BlockchainInfo } from '../contracts/blockchainInfo'; import { CurrentTime } from '../contracts/currentTime'; import { RPCBase } from '../RPCBase'; @@ -109,4 +110,14 @@ export class Network extends RPCBase { ): Promise { return this.call('getblockbynumber', number, txinfo); } + + /** + * Displays data on current blockchain + * + * @returns {Promise} + * @memberof Network + */ + public async getBlockchainInfo(): Promise { + return this.call('getblockchaininfo'); + } } diff --git a/src/contracts/blockChainInfo.ts b/src/contracts/blockChainInfo.ts deleted file mode 100644 index ea29549..0000000 --- a/src/contracts/blockChainInfo.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { Difficulty } from './difficulty'; - -export interface IBlockChainInfo { - /** - * the current number of blocks processed in the server - * - * @type {number} - * @memberof IBlockChainInfo - */ - blocks: number; - moneysupply: number; - difficulty: Difficulty; - testnet: boolean; - errors: string; -} diff --git a/src/contracts/blockchainInfo.ts b/src/contracts/blockchainInfo.ts new file mode 100644 index 0000000..f3cd37f --- /dev/null +++ b/src/contracts/blockchainInfo.ts @@ -0,0 +1,19 @@ +export interface BlockchainDifficulty { + current: number; + target: number; +} + +export interface BlockchainInfo { + /** + * the current number of blocks processed in the server + * + * @type {number} + * @memberof BlockchainInfo + */ + blocks: number; + inSync: boolean; + moneysupply: number; + difficulty: BlockchainDifficulty; + testnet: boolean; + errors: string; +}