@walletpack/core
Version:
> TODO: description
63 lines (56 loc) • 1.61 kB
JavaScript
;
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = void 0;
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
var Explorer =
/*#__PURE__*/
function () {
function Explorer() {
(0, _classCallCheck2["default"])(this, Explorer);
this.raw = null;
this.name = null;
this.account = null;
this.transaction = null;
this.block = null;
}
(0, _createClass2["default"])(Explorer, [{
key: "parsed",
value: function parsed() {
return Explorer.fromRaw(this.raw);
}
}], [{
key: "placeholder",
value: function placeholder() {
return new Explorer();
}
}, {
key: "fromJson",
value: function fromJson(json) {
return Object.assign(this.placeholder(), json);
}
}, {
key: "fromRaw",
value: function fromRaw(rawExplorer) {
if (!rawExplorer) return this.placeholder();
return this.fromJson({
raw: rawExplorer,
name: rawExplorer.name,
account: function account(x) {
return rawExplorer.account.replace('{x}', x);
},
transaction: function transaction(x) {
return rawExplorer.transaction.replace('{x}', x);
},
block: function block(x) {
return rawExplorer.block.replace('{x}', x);
}
});
}
}]);
return Explorer;
}();
exports["default"] = Explorer;