tokamak-staking-lib
Version:
tokamak staking library
34 lines (33 loc) • 1.12 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const web3_1 = __importDefault(require("web3"));
class Web3Connector {
constructor() {
this._web3 = new web3_1.default(Web3Connector._provider);
}
static instance() {
if (!Web3Connector._instance) {
Web3Connector._instance = new Web3Connector();
}
return Web3Connector._instance;
}
static setNetwork(provider) {
Web3Connector._provider = provider;
provider["host"] ? Web3Connector._host = provider["host"] : Web3Connector._host = String(provider);
}
setProvider(provider) {
Web3Connector._provider = provider;
provider["host"] ? Web3Connector._host = provider["host"] : Web3Connector._host = String(provider);
this._web3.setProvider(provider);
}
get web3() {
return this._web3;
}
static get host() {
return this._host;
}
}
exports.default = Web3Connector;