godprotocol 1.0.839 → 1.0.841

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,32 +1,49 @@
1
- class Repository {
2
- constructor(main) {
3
- this.main = main;
4
- this.oracle = this.main.account.manager.oracle;
5
- this.gds = this.oracle.gds;
6
- this.programs = this.gds.folder("programs");
7
- this.codes = this.gds.folder("codes");
8
- }
1
+ "use strict";
9
2
 
10
- add_program = (config) => {
11
- let code_hash = this.oracle.hash(config.codes);
12
- let code_exist = this.codes.readone({ hash: code_hash });
13
-
14
- let code = this.codes.write({
15
- body: config.codes,
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = void 0;
7
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
8
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
9
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
10
+ function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
11
+ function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
12
+ function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
13
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
14
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
15
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
16
+ var Repository = /*#__PURE__*/_createClass(function Repository(main) {
17
+ var _this = this;
18
+ _classCallCheck(this, Repository);
19
+ _defineProperty(this, "add_program", function (config) {
20
+ var codes = config.codes.filter(function (line) {
21
+ return !!line.trim();
22
+ });
23
+ var code_hash = _this.oracle.hash(codes);
24
+ var code_exist = _this.codes.readone({
25
+ hash: code_hash
26
+ });
27
+ var code = _this.codes.write({
28
+ body: codes,
16
29
  hash: code_hash,
17
- _id: code_exist && code_exist._id,
30
+ _id: code_exist && code_exist._id
18
31
  });
19
32
  config.codes = code._id;
20
-
21
- let program_hash = this.oracle.hash(JSON.stringify(config));
22
- let program_exist = this.programs.readone({ hash: program_hash });
23
-
24
- this.programs.write({
25
- ...config,
26
- hash: program_hash,
27
- _id: program_exist && program_exist._id,
33
+ var program_hash = _this.oracle.hash(JSON.stringify(config));
34
+ var program_exist = _this.programs.readone({
35
+ hash: program_hash
28
36
  });
29
- };
30
- }
31
-
32
- export default Repository;
37
+ _this.programs.write(_objectSpread(_objectSpread({}, config), {}, {
38
+ hash: program_hash,
39
+ _id: program_exist && program_exist._id
40
+ }));
41
+ });
42
+ this.main = main;
43
+ this.oracle = this.main.account.manager.oracle;
44
+ this.gds = this.oracle.gds;
45
+ this.programs = this.gds.folder("programs");
46
+ this.codes = this.gds.folder("codes");
47
+ });
48
+ var _default = Repository;
49
+ exports["default"] = _default;
@@ -1,282 +1,257 @@
1
- import Loader_sequence from "../Loader_sequence/main";
2
- import validate_signature from "../utils/privacy";
3
- import { post_request } from "../utils/services";
4
- import Filesystem from "./Filesystem";
5
- import Virtual_machine from "./Virtual_machine";
6
-
7
- class Account extends Filesystem {
8
- constructor(name, meta = {}) {
9
- super();
10
-
11
- meta = meta || {};
12
-
13
- this.name = name;
14
- this.private = meta.private;
15
- this.manager = meta.manager;
16
- this.account = this;
17
- this.stdin = new Array();
18
- this.stdout = new Array();
19
-
20
- if (!this.manager) throw new Error("Manager instance missing.");
21
-
22
- this.name_hash();
23
- this.physical_address = `${this.base_address}/${this.name}`;
24
- this.set_paths(this);
25
-
26
- this.assembler = new Loader_sequence(this);
27
-
28
- this.chain = this.account_chain(this);
29
- this.vm = new Virtual_machine(this.chain);
30
-
31
- this.mine_buffer = {};
32
- this.privileges = new Object();
33
-
34
- this.events = new Object();
35
-
36
- console.log(`Account Instance: ${this.name}`);
37
- }
38
-
39
- on = (event, handler) => {
40
- let handlers = this.events[event];
41
- if (!handlers) {
42
- handlers = new Array();
43
- this.events[event] = handlers;
44
- }
45
- handlers.push(handler);
46
- };
47
-
48
- emit = (event, data) => {
49
- let handlers = this.events[event];
50
- Array.isArray(handlers) &&
51
- handlers.map((handle) => this.run_callback(handle, data));
52
- };
53
-
54
- propagate = (data, endpoint) => {
55
- if (data.is_propagated) return;
56
-
57
- let servers = this.privileges[endpoint];
58
-
59
- if (data.exclusive) {
60
- if (typeof data.exclusive === "boolean") return;
61
- else if (Array.isArray(data.exclusive)) {
62
- servers =
63
- servers &&
64
- servers.filter((serv) => {
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = void 0;
7
+ var _main = _interopRequireDefault(require("../Loader_sequence/main"));
8
+ var _privacy = _interopRequireDefault(require("../utils/privacy"));
9
+ var _services = require("../utils/services");
10
+ var _Filesystem2 = _interopRequireDefault(require("./Filesystem"));
11
+ var _Virtual_machine = _interopRequireDefault(require("./Virtual_machine"));
12
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
13
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
14
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
15
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
16
+ function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
17
+ function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
18
+ function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
19
+ function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
20
+ function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
21
+ function _createSuper(t) { var r = _isNativeReflectConstruct(); return function () { var e, o = _getPrototypeOf(t); if (r) { var s = _getPrototypeOf(this).constructor; e = Reflect.construct(o, arguments, s); } else e = o.apply(this, arguments); return _possibleConstructorReturn(this, e); }; }
22
+ function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
23
+ function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
24
+ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
25
+ function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
26
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
27
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
28
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
29
+ var Account = /*#__PURE__*/function (_Filesystem) {
30
+ _inherits(Account, _Filesystem);
31
+ var _super = _createSuper(Account);
32
+ function Account(_name) {
33
+ var _this;
34
+ var _meta = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
35
+ _classCallCheck(this, Account);
36
+ _this = _super.call(this);
37
+ _defineProperty(_assertThisInitialized(_this), "on", function (event, handler) {
38
+ var handlers = _this.events[event];
39
+ if (!handlers) {
40
+ handlers = new Array();
41
+ _this.events[event] = handlers;
42
+ }
43
+ handlers.push(handler);
44
+ });
45
+ _defineProperty(_assertThisInitialized(_this), "emit", function (event, data) {
46
+ var handlers = _this.events[event];
47
+ Array.isArray(handlers) && handlers.map(function (handle) {
48
+ return _this.run_callback(handle, data);
49
+ });
50
+ });
51
+ _defineProperty(_assertThisInitialized(_this), "propagate", function (data, endpoint) {
52
+ if (data.is_propagated) return;
53
+ var servers = _this.privileges[endpoint];
54
+ if (data.exclusive) {
55
+ if (typeof data.exclusive === "boolean") return;else if (Array.isArray(data.exclusive)) {
56
+ servers = servers && servers.filter(function (serv) {
65
57
  return data.exclusive.includes(serv.domain);
66
58
  });
59
+ }
67
60
  }
68
- }
69
-
70
- data.is_propagated = true;
71
- data = JSON.stringify(data);
72
-
73
- if (servers && servers.length) {
74
- servers.map((serv) => {
75
- post_request({
76
- options: {
77
- ...serv,
78
- path: `/${endpoint}`,
79
- },
80
- data,
61
+ data.is_propagated = true;
62
+ data = JSON.stringify(data);
63
+ if (servers && servers.length) {
64
+ servers.map(function (serv) {
65
+ (0, _services.post_request)({
66
+ options: _objectSpread(_objectSpread({}, serv), {}, {
67
+ path: "/".concat(endpoint)
68
+ }),
69
+ data: data
70
+ });
81
71
  });
82
- });
83
- }
84
- };
85
-
86
- add_server = ({ server, privileges }) => {
87
- if (!Array.isArray(privileges) && privileges)
88
- privileges = ["load", "parse", "run", "create_account"];
89
-
90
- privileges.map((privilege) => {
91
- let priv = this.privileges[privilege];
92
- if (!priv) {
93
- priv = [];
94
- this.privileges[privilege] = priv;
95
72
  }
96
- if (!priv.find((serv) => serv.domain === server.domain))
97
- priv.push(server);
98
73
  });
99
- };
100
-
101
- get_account = (name) => {
102
- return this.manager.get_account(name) || this;
103
- };
104
-
105
- manage_buffer = (callback) => {
106
- let call_session = `${Date.now()}-${Math.random()}`;
107
- this.mine_buffer[call_session] = { blocks: [], callback };
108
-
109
- return call_session;
110
- };
111
-
112
- buff = (block, pid) => {
113
- let buffer = this.mine_buffer[pid];
114
- if (!buffer) return;
115
-
116
- buffer.blocks.push(block.stringify());
117
- };
118
-
119
- flush_buffer = (pid, payload) => {
120
- let buff = this.mine_buffer[pid];
121
- if (!buff) return;
122
-
123
- buff.callback && this.run_callback(buff.callback, payload || buff.blocks);
124
- delete this.mine_buffer[pid];
125
- };
126
-
127
- load = (payload) => {
128
- let { program, callback } = payload;
129
- let { instructions, assemble } = program;
130
-
131
- this.propagate(payload, "load");
132
-
133
- if (assemble) {
134
- this.assembler.run(instructions, { cb: callback });
135
- } else {
136
- let pid = this.manage_buffer(callback);
137
-
138
- this.manager.push({ sequence: instructions, account: this, pid });
139
- }
140
- };
141
-
142
- parse = (program) => {
143
- let { payload, callback, signature } = program;
144
-
145
- this.propagate(program, "parse");
146
-
147
- this.manager.oracle.fetch({ ...payload, signature }, (result) =>
148
- this.run_callback(callback, result)
149
- );
150
- };
151
-
152
- run = (request) => {
153
- let { payload, callback } = request;
154
-
155
- let { physical_address, query, history } = payload;
156
-
157
- history = Math.abs(Number(history)) || 0;
158
-
159
- this.propagate(request, "run");
160
-
161
- let pid = this.manage_buffer(callback);
162
-
163
- let context = physical_address
164
- ? this.manager.web.get(physical_address)
165
- : this.vm.get_context();
166
-
167
- if (!context) {
168
- if (physical_address)
169
- context = this.manager.web.split_set(physical_address);
170
- else return this.flush_buffer(pid);
171
- }
172
-
173
- let blk = query ? context.explore(query) : context.get_latest_block();
174
-
175
- if (!query) {
176
- let index = context.height;
177
- index -= 2;
178
-
179
- if (blk && blk.metadata.program) {
180
- if (history) {
181
- history--;
182
- blk = null;
74
+ _defineProperty(_assertThisInitialized(_this), "add_server", function (_ref) {
75
+ var server = _ref.server,
76
+ privileges = _ref.privileges;
77
+ if (!Array.isArray(privileges) && privileges) privileges = ["load", "parse", "run", "create_account"];
78
+ privileges.map(function (privilege) {
79
+ var priv = _this.privileges[privilege];
80
+ if (!priv) {
81
+ priv = [];
82
+ _this.privileges[privilege] = priv;
183
83
  }
84
+ if (!priv.find(function (serv) {
85
+ return serv.domain === server.domain;
86
+ })) priv.push(server);
87
+ });
88
+ });
89
+ _defineProperty(_assertThisInitialized(_this), "get_account", function (name) {
90
+ return _this.manager.get_account(name) || _assertThisInitialized(_this);
91
+ });
92
+ _defineProperty(_assertThisInitialized(_this), "manage_buffer", function (callback) {
93
+ var call_session = "".concat(Date.now(), "-").concat(Math.random());
94
+ _this.mine_buffer[call_session] = {
95
+ blocks: [],
96
+ callback: callback
97
+ };
98
+ return call_session;
99
+ });
100
+ _defineProperty(_assertThisInitialized(_this), "buff", function (block, pid) {
101
+ var buffer = _this.mine_buffer[pid];
102
+ if (!buffer) return;
103
+ buffer.blocks.push(block.stringify());
104
+ });
105
+ _defineProperty(_assertThisInitialized(_this), "flush_buffer", function (pid, payload) {
106
+ var buff = _this.mine_buffer[pid];
107
+ if (!buff) return;
108
+ buff.callback && _this.run_callback(buff.callback, payload || buff.blocks);
109
+ delete _this.mine_buffer[pid];
110
+ });
111
+ _defineProperty(_assertThisInitialized(_this), "load", function (payload) {
112
+ var program = payload.program,
113
+ callback = payload.callback;
114
+ var instructions = program.instructions,
115
+ assemble = program.assemble;
116
+ _this.propagate(payload, "load");
117
+ if (assemble) {
118
+ _this.assembler.spawn().run(instructions, {
119
+ cb: callback
120
+ });
121
+ } else {
122
+ var pid = _this.manage_buffer(callback);
123
+ _this.manager.push({
124
+ sequence: instructions,
125
+ account: _assertThisInitialized(_this),
126
+ pid: pid
127
+ });
184
128
  }
185
-
186
- while (!blk && index >= 0) {
187
- index--;
188
- blk = context.get_block(index);
189
-
129
+ });
130
+ _defineProperty(_assertThisInitialized(_this), "parse", function (program) {
131
+ var payload = program.payload,
132
+ callback = program.callback,
133
+ signature = program.signature;
134
+ _this.propagate(program, "parse");
135
+ _this.manager.oracle.fetch(_objectSpread(_objectSpread({}, payload), {}, {
136
+ signature: signature
137
+ }), function (result) {
138
+ return _this.run_callback(callback, result);
139
+ });
140
+ });
141
+ _defineProperty(_assertThisInitialized(_this), "run", function (request) {
142
+ var payload = request.payload,
143
+ callback = request.callback;
144
+ var physical_address = payload.physical_address,
145
+ query = payload.query,
146
+ history = payload.history;
147
+ history = Math.abs(Number(history)) || 0;
148
+ _this.propagate(request, "run");
149
+ var pid = _this.manage_buffer(callback);
150
+ var context = physical_address ? _this.manager.web.get(physical_address) : _this.vm.get_context();
151
+ if (!context) {
152
+ if (physical_address) context = _this.manager.web.split_set(physical_address);else return _this.flush_buffer(pid);
153
+ }
154
+ var blk = query ? context.explore(query) : context.get_latest_block();
155
+ if (!query) {
156
+ var index = context.height;
157
+ index -= 2;
190
158
  if (blk && blk.metadata.program) {
191
159
  if (history) {
192
160
  history--;
193
161
  blk = null;
194
162
  }
195
163
  }
164
+ while (!blk && index >= 0) {
165
+ index--;
166
+ blk = context.get_block(index);
167
+ if (blk && blk.metadata.program) {
168
+ if (history) {
169
+ history--;
170
+ blk = null;
171
+ }
172
+ }
173
+ }
196
174
  }
197
- }
198
-
199
- if (blk && blk.metadata && blk.metadata.program) {
200
- let program = this.read(blk.metadata.program);
201
-
202
- this.vm.contexts.push(context);
203
- program.push("pop");
204
-
205
- Array.isArray(program) &&
206
- program.length &&
207
- this.manager.push({
175
+ if (blk && blk.metadata && blk.metadata.program) {
176
+ var program = _this.read(blk.metadata.program);
177
+ _this.vm.contexts.push(context);
178
+ program.push("pop");
179
+ Array.isArray(program) && program.length && _this.manager.push({
208
180
  sequence: program,
209
- account: this,
210
- pid,
181
+ account: _assertThisInitialized(_this),
182
+ pid: pid
211
183
  });
212
- } else this.flush_buffer(pid);
213
- };
214
-
215
- run_callback = (callback, payload) => {
216
- setTimeout(() => {
217
- if (!callback) return;
218
-
219
- if (typeof callback === "function") return callback(payload);
220
-
221
- callback.payload &&
222
- callback.payload.physical_address &&
223
- this.vm.stdin(payload, () => this.run(callback));
224
- }, 0);
225
- };
226
-
227
- flush_stdout = (block) => {
228
- if (
229
- block.chain.physical_address === `${this.physical_address}/Opcodes/stdout`
230
- )
231
- return;
232
-
233
- for (let s = 0; s < this.stdout.length; s++) {
234
- let out = this.stdout[s];
235
- if (out.pid === this.vm.track.pid) {
236
- block.metadata.stdout.push(out.data);
237
- this.stdout[s] = null;
184
+ } else _this.flush_buffer(pid);
185
+ });
186
+ _defineProperty(_assertThisInitialized(_this), "run_callback", function (callback, payload) {
187
+ setTimeout(function () {
188
+ if (!callback) return;
189
+ if (typeof callback === "function") return callback(payload);
190
+ callback.payload && callback.payload.physical_address && _this.vm.stdin(payload, function () {
191
+ return _this.run(callback);
192
+ });
193
+ }, 0);
194
+ });
195
+ _defineProperty(_assertThisInitialized(_this), "flush_stdout", function (block) {
196
+ if (block.chain.physical_address === "".concat(_this.physical_address, "/Opcodes/stdout")) return;
197
+ for (var s = 0; s < _this.stdout.length; s++) {
198
+ var out = _this.stdout[s];
199
+ if (out.pid === _this.vm.track.pid) {
200
+ block.metadata.stdout.push(out.data);
201
+ _this.stdout[s] = null;
202
+ }
238
203
  }
239
- }
240
- this.stdout = this.stdout.filter((out) => !!out);
241
- };
242
-
243
- validate = (payload, signature, callback) => {
244
- if (!this.private) return true;
245
-
246
- let valid = validate_signature(
247
- this.name,
248
- JSON.stringify(payload),
249
- signature
250
- );
251
- if (!valid && callback)
252
- this.run_callback(callback, {
253
- private: this.private,
204
+ _this.stdout = _this.stdout.filter(function (out) {
205
+ return !!out;
206
+ });
207
+ });
208
+ _defineProperty(_assertThisInitialized(_this), "validate", function (payload, signature, callback) {
209
+ if (!_this["private"]) return true;
210
+ var valid = (0, _privacy["default"])(_this.name, JSON.stringify(payload), signature);
211
+ if (!valid && callback) _this.run_callback(callback, {
212
+ "private": _this["private"],
254
213
  error: true,
255
- error_message: "Invalid signature",
214
+ error_message: "Invalid signature"
256
215
  });
257
-
258
- return valid;
259
- };
260
-
261
- stringify = (str) => {
262
- let obj = {};
263
-
264
- obj.name = this.name;
265
- obj.hash = this.hash;
266
- obj.path = this.path;
267
- obj.private = this.private;
268
- obj.chain = this.chain.stringify();
269
- obj.physical_address = this.physical_address;
270
-
271
- return str ? JSON.stringify(obj) : obj;
272
- };
273
-
274
- create_account = (payload) => {
275
- this.propagate(payload, "create_account");
276
- let { name, meta } = payload;
277
-
278
- return this.manager.add_account(name, meta);
279
- };
280
- }
281
-
282
- export default Account;
216
+ return valid;
217
+ });
218
+ _defineProperty(_assertThisInitialized(_this), "stringify", function (str) {
219
+ var obj = {};
220
+ obj.name = _this.name;
221
+ obj.hash = _this.hash;
222
+ obj.path = _this.path;
223
+ obj["private"] = _this["private"];
224
+ obj.chain = _this.chain.stringify();
225
+ obj.physical_address = _this.physical_address;
226
+ return str ? JSON.stringify(obj) : obj;
227
+ });
228
+ _defineProperty(_assertThisInitialized(_this), "create_account", function (payload) {
229
+ _this.propagate(payload, "create_account");
230
+ var name = payload.name,
231
+ meta = payload.meta;
232
+ return _this.manager.add_account(name, meta);
233
+ });
234
+ _meta = _meta || {};
235
+ _this.name = _name;
236
+ _this["private"] = _meta["private"];
237
+ _this.manager = _meta.manager;
238
+ _this.account = _assertThisInitialized(_this);
239
+ _this.stdin = new Array();
240
+ _this.stdout = new Array();
241
+ if (!_this.manager) throw new Error("Manager instance missing.");
242
+ _this.name_hash();
243
+ _this.physical_address = "".concat(_this.base_address, "/").concat(_this.name);
244
+ _this.set_paths(_assertThisInitialized(_this));
245
+ _this.assembler = new _main["default"](_assertThisInitialized(_this));
246
+ _this.chain = _this.account_chain(_assertThisInitialized(_this));
247
+ _this.vm = new _Virtual_machine["default"](_this.chain);
248
+ _this.mine_buffer = {};
249
+ _this.privileges = new Object();
250
+ _this.events = new Object();
251
+ console.log("Account Instance: ".concat(_this.name));
252
+ return _this;
253
+ }
254
+ return _createClass(Account);
255
+ }(_Filesystem2["default"]);
256
+ var _default = Account;
257
+ exports["default"] = _default;