UNPKG

tokamak-staking-lib

Version:
34 lines (33 loc) 1.24 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const { toBN } = require("web3-utils"); const web3_connector_1 = __importDefault(require("../common/web3-connector")); const AutoRefactorCoinageABI = require("./abi/AutoRefactorCoinage.json"); const seig_manager_1 = __importDefault(require("./seig-manager")); class Tot { constructor(address) { Tot._address = address; const web3 = web3_connector_1.default.instance().web3; this._contract = new web3.eth.Contract(AutoRefactorCoinageABI, address); } static async instance() { if (!Tot._instance) { const address = await seig_manager_1.default.instance().totAddress(); Tot._instance = new Tot(address); } return Tot._instance; } static get address() { return Tot._address; } async totalSupply() { return toBN(await this._contract.methods.totalSupply().call()); } async balanceOf(account) { return toBN(await this._contract.methods.balanceOf(account).call()); } } exports.default = Tot;