import { BscScan } from "../client"; import { GetBNBLastPriceResponse, GetBNBTotalSupplyResponse, GetValidatorsResponse } from "../typings/stats"; class Stats { /** * Represents the BscScan client * * @private * @type {BscScan} * @memberof Stats */ private client: BscScan; /** * Creates an instance of Stats. * @param {BscScan} client * @memberof Stats */ constructor(client: BscScan) { this.client = client; } /** * Get BNB Last Price * https://docs.bscscan.com/api-endpoints/stats-1#get-bnb-last-price * @returns {Promise} * @memberof Stats */ async getBNBLastPrice(): Promise { return this.do("bnbprice"); } /** * Get Total Supply of BNB on the Binance Smart Chain * https://docs.bscscan.com/api-endpoints/stats-1#get-total-supply-of-bnb-on-the-binance-smart-chain * @returns {Promise} * @memberof Stats */ async getBNBTotalSupply(): Promise { return this.do("bnbsupply"); } /** * Get Validators List on the Binance Smart Chain * https://docs.bscscan.com/api-endpoints/stats-1#get-validators-list-on-the-binance-smart-chain * @returns {Promise} * @memberof Stats */ async getValidators(): Promise { return this.do("validators"); } private async do(action: string, opts?: Record): Promise { return this.client.query("stats", action, opts); } // todo: dailytxnfee // todo: dailynewaddress // todo: dailynetutilization // todo: dailytx // todo: bnbdailyprice } export { Stats };