UNPKG

@helium/http

Version:

HTTP library for interacting with the Helium blockchain API

65 lines 2.83 kB
"use strict"; var __rest = (this && this.__rest) || function (s, e) { var t = {}; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]]; } return t; }; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const camelcase_keys_1 = __importDefault(require("camelcase-keys")); const DataModel_1 = __importDefault(require("./DataModel")); class Witness extends DataModel_1.default { constructor(client, witness) { var _a, _b, _c, _d; super(); this.client = client; this.scoreUpdateHeight = witness.score_update_height; this.score = witness.score; this.rewardScale = witness.reward_scale; this.owner = witness.owner; this.name = witness.name; this.location = witness.location; this.locationHex = witness.location_hex; this.lng = witness.lng; this.lat = witness.lat; this.block = witness.block; this.status = { timestamp: (_a = witness.status) === null || _a === void 0 ? void 0 : _a.timestamp, height: ((_b = witness.status) === null || _b === void 0 ? void 0 : _b.height) || 0, online: ((_c = witness.status) === null || _c === void 0 ? void 0 : _c.online) || '', listenAddrs: ((_d = witness.status) === null || _d === void 0 ? void 0 : _d.listen_addrs) || [], }; this.nonce = witness.nonce; this.blockAdded = witness.block_added; this.timestampAdded = witness.timestamp_added; this.lastPocChallenge = witness.last_poc_challenge; this.lastChangeBlock = witness.last_change_block; this.gain = witness.gain; this.elevation = witness.elevation; if (witness.geocode) { this.geocode = (0, camelcase_keys_1.default)(witness.geocode); } this.address = witness.address; this.witnessFor = witness.witness_for; if (witness.witness_info) { this.witnessInfo = (0, camelcase_keys_1.default)(witness.witness_info); } this.mode = witness.mode; } get data() { // eslint-disable-next-line @typescript-eslint/no-unused-vars const _a = this, { client } = _a, rest = __rest(_a, ["client"]); // @ts-ignore return Object.assign({}, rest); } } exports.default = Witness; //# sourceMappingURL=Witness.js.map