godprotocol 1.0.788 → 1.0.791
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.
- package/Objects/Account.js +260 -80
- package/Objects/Manager.js +2 -3
- package/Objects/Opcodes.js +75 -12
- package/Objects/Virtual_machine.js +242 -105
- package/build/Account.js +173 -0
- package/build/Block.js +103 -0
- package/build/Blockweb.js +78 -0
- package/build/Chain.js +205 -0
- package/build/Explorer.js +85 -0
- package/build/Filesystem.js +165 -0
- package/build/Frame.js +108 -0
- package/build/Index.js +19 -0
- package/build/Manager.js +178 -0
- package/build/Opcodes.js +102 -0
- package/build/Oracle.js +84 -0
- package/build/Virtual_machine.js +128 -0
- package/build/add.js +41 -0
- package/build/create_server.js +495 -0
- package/build/framer.js +88 -0
- package/build/functions.js +127 -0
- package/build/hash.js +14 -0
- package/build/jmp.js +19 -0
- package/build/main.js +339 -0
- package/build/opcodes.js +42 -0
- package/build/privacy.js +27 -0
- package/build/services.js +96 -0
- package/build/std.js +11 -0
- package/package.json +1 -1
- package/readme.md +94 -71
package/Objects/Account.js
CHANGED
|
@@ -1,58 +1,196 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
4
|
+
value: true,
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = void 0;
|
|
7
7
|
var _main = _interopRequireDefault(require("../Loader_sequence/main"));
|
|
8
8
|
var _privacy = _interopRequireDefault(require("../utils/privacy"));
|
|
9
9
|
var _Filesystem2 = _interopRequireDefault(require("./Filesystem"));
|
|
10
10
|
var _Virtual_machine = _interopRequireDefault(require("./Virtual_machine"));
|
|
11
|
-
function _interopRequireDefault(e) {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
function
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
function
|
|
19
|
-
function
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
function
|
|
25
|
-
|
|
26
|
-
|
|
11
|
+
function _interopRequireDefault(e) {
|
|
12
|
+
return e && e.__esModule ? e : { default: e };
|
|
13
|
+
}
|
|
14
|
+
function _typeof(o) {
|
|
15
|
+
"@babel/helpers - typeof";
|
|
16
|
+
return (
|
|
17
|
+
(_typeof =
|
|
18
|
+
"function" == typeof Symbol && "symbol" == typeof Symbol.iterator
|
|
19
|
+
? function (o) {
|
|
20
|
+
return typeof o;
|
|
21
|
+
}
|
|
22
|
+
: function (o) {
|
|
23
|
+
return o &&
|
|
24
|
+
"function" == typeof Symbol &&
|
|
25
|
+
o.constructor === Symbol &&
|
|
26
|
+
o !== Symbol.prototype
|
|
27
|
+
? "symbol"
|
|
28
|
+
: typeof o;
|
|
29
|
+
}),
|
|
30
|
+
_typeof(o)
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
function _defineProperties(e, r) {
|
|
34
|
+
for (var t = 0; t < r.length; t++) {
|
|
35
|
+
var o = r[t];
|
|
36
|
+
(o.enumerable = o.enumerable || !1),
|
|
37
|
+
(o.configurable = !0),
|
|
38
|
+
"value" in o && (o.writable = !0),
|
|
39
|
+
Object.defineProperty(e, _toPropertyKey(o.key), o);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
function _createClass(e, r, t) {
|
|
43
|
+
return (
|
|
44
|
+
r && _defineProperties(e.prototype, r),
|
|
45
|
+
t && _defineProperties(e, t),
|
|
46
|
+
Object.defineProperty(e, "prototype", { writable: !1 }),
|
|
47
|
+
e
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
function _classCallCheck(a, n) {
|
|
51
|
+
if (!(a instanceof n))
|
|
52
|
+
throw new TypeError("Cannot call a class as a function");
|
|
53
|
+
}
|
|
54
|
+
function _inherits(t, e) {
|
|
55
|
+
if ("function" != typeof e && null !== e)
|
|
56
|
+
throw new TypeError("Super expression must either be null or a function");
|
|
57
|
+
(t.prototype = Object.create(e && e.prototype, {
|
|
58
|
+
constructor: { value: t, writable: !0, configurable: !0 },
|
|
59
|
+
})),
|
|
60
|
+
Object.defineProperty(t, "prototype", { writable: !1 }),
|
|
61
|
+
e && _setPrototypeOf(t, e);
|
|
62
|
+
}
|
|
63
|
+
function _setPrototypeOf(t, e) {
|
|
64
|
+
return (
|
|
65
|
+
(_setPrototypeOf = Object.setPrototypeOf
|
|
66
|
+
? Object.setPrototypeOf.bind()
|
|
67
|
+
: function (t, e) {
|
|
68
|
+
return (t.__proto__ = e), t;
|
|
69
|
+
}),
|
|
70
|
+
_setPrototypeOf(t, e)
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
function _createSuper(t) {
|
|
74
|
+
var r = _isNativeReflectConstruct();
|
|
75
|
+
return function () {
|
|
76
|
+
var e,
|
|
77
|
+
o = _getPrototypeOf(t);
|
|
78
|
+
if (r) {
|
|
79
|
+
var s = _getPrototypeOf(this).constructor;
|
|
80
|
+
e = Reflect.construct(o, arguments, s);
|
|
81
|
+
} else e = o.apply(this, arguments);
|
|
82
|
+
return _possibleConstructorReturn(this, e);
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
function _possibleConstructorReturn(t, e) {
|
|
86
|
+
if (e && ("object" == _typeof(e) || "function" == typeof e)) return e;
|
|
87
|
+
if (void 0 !== e)
|
|
88
|
+
throw new TypeError(
|
|
89
|
+
"Derived constructors may only return object or undefined"
|
|
90
|
+
);
|
|
91
|
+
return _assertThisInitialized(t);
|
|
92
|
+
}
|
|
93
|
+
function _assertThisInitialized(e) {
|
|
94
|
+
if (void 0 === e)
|
|
95
|
+
throw new ReferenceError(
|
|
96
|
+
"this hasn't been initialised - super() hasn't been called"
|
|
97
|
+
);
|
|
98
|
+
return e;
|
|
99
|
+
}
|
|
100
|
+
function _isNativeReflectConstruct() {
|
|
101
|
+
try {
|
|
102
|
+
var t = !Boolean.prototype.valueOf.call(
|
|
103
|
+
Reflect.construct(Boolean, [], function () {})
|
|
104
|
+
);
|
|
105
|
+
} catch (t) {}
|
|
106
|
+
return (_isNativeReflectConstruct = function _isNativeReflectConstruct() {
|
|
107
|
+
return !!t;
|
|
108
|
+
})();
|
|
109
|
+
}
|
|
110
|
+
function _getPrototypeOf(t) {
|
|
111
|
+
return (
|
|
112
|
+
(_getPrototypeOf = Object.setPrototypeOf
|
|
113
|
+
? Object.getPrototypeOf.bind()
|
|
114
|
+
: function (t) {
|
|
115
|
+
return t.__proto__ || Object.getPrototypeOf(t);
|
|
116
|
+
}),
|
|
117
|
+
_getPrototypeOf(t)
|
|
118
|
+
);
|
|
119
|
+
}
|
|
120
|
+
function _defineProperty(e, r, t) {
|
|
121
|
+
return (
|
|
122
|
+
(r = _toPropertyKey(r)) in e
|
|
123
|
+
? Object.defineProperty(e, r, {
|
|
124
|
+
value: t,
|
|
125
|
+
enumerable: !0,
|
|
126
|
+
configurable: !0,
|
|
127
|
+
writable: !0,
|
|
128
|
+
})
|
|
129
|
+
: (e[r] = t),
|
|
130
|
+
e
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
function _toPropertyKey(t) {
|
|
134
|
+
var i = _toPrimitive(t, "string");
|
|
135
|
+
return "symbol" == _typeof(i) ? i : i + "";
|
|
136
|
+
}
|
|
137
|
+
function _toPrimitive(t, r) {
|
|
138
|
+
if ("object" != _typeof(t) || !t) return t;
|
|
139
|
+
var e = t[Symbol.toPrimitive];
|
|
140
|
+
if (void 0 !== e) {
|
|
141
|
+
var i = e.call(t, r || "default");
|
|
142
|
+
if ("object" != _typeof(i)) return i;
|
|
143
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
144
|
+
}
|
|
145
|
+
return ("string" === r ? String : Number)(t);
|
|
146
|
+
}
|
|
147
|
+
var Account = /*#__PURE__*/ (function (_Filesystem) {
|
|
27
148
|
_inherits(Account, _Filesystem);
|
|
28
149
|
var _super = _createSuper(Account);
|
|
29
150
|
function Account(_name) {
|
|
30
151
|
var _this;
|
|
31
|
-
var _meta =
|
|
152
|
+
var _meta =
|
|
153
|
+
arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
32
154
|
_classCallCheck(this, Account);
|
|
33
155
|
_this = _super.call(this);
|
|
34
|
-
_defineProperty(
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
156
|
+
_defineProperty(
|
|
157
|
+
_assertThisInitialized(_this),
|
|
158
|
+
"get_account",
|
|
159
|
+
function (name) {
|
|
160
|
+
return _this.manager.get_account(name) || _assertThisInitialized(_this);
|
|
161
|
+
}
|
|
162
|
+
);
|
|
163
|
+
_defineProperty(
|
|
164
|
+
_assertThisInitialized(_this),
|
|
165
|
+
"manage_buffer",
|
|
166
|
+
function (callback) {
|
|
167
|
+
var call_session = "".concat(Date.now(), "-").concat(Math.random());
|
|
168
|
+
_this.mine_buffer[call_session] = {
|
|
169
|
+
blocks: [],
|
|
170
|
+
callback: callback,
|
|
171
|
+
};
|
|
172
|
+
return call_session;
|
|
173
|
+
}
|
|
174
|
+
);
|
|
175
|
+
_defineProperty(
|
|
176
|
+
_assertThisInitialized(_this),
|
|
177
|
+
"buff",
|
|
178
|
+
function (block, pid) {
|
|
179
|
+
var buffer = _this.mine_buffer[pid];
|
|
180
|
+
if (!buffer) return;
|
|
181
|
+
buffer.blocks.push(block.stringify());
|
|
182
|
+
}
|
|
183
|
+
);
|
|
184
|
+
_defineProperty(
|
|
185
|
+
_assertThisInitialized(_this),
|
|
186
|
+
"flush_buffer",
|
|
187
|
+
function (pid) {
|
|
188
|
+
var buff = _this.mine_buffer[pid];
|
|
189
|
+
if (!buff) return;
|
|
190
|
+
buff.callback && _this.run_callback(buff.callback, buff.blocks);
|
|
191
|
+
delete _this.mine_buffer[pid];
|
|
192
|
+
}
|
|
193
|
+
);
|
|
56
194
|
_defineProperty(_assertThisInitialized(_this), "load", function (_ref) {
|
|
57
195
|
var program = _ref.program,
|
|
58
196
|
signature = _ref.signature,
|
|
@@ -60,12 +198,12 @@ var Account = /*#__PURE__*/function (_Filesystem) {
|
|
|
60
198
|
var instructions = program.instructions,
|
|
61
199
|
account = program.account;
|
|
62
200
|
account = _this.get_account(account);
|
|
63
|
-
if (!account.validate(
|
|
201
|
+
if (!account.validate(payload, signature, callback)) return;
|
|
64
202
|
var pid = account.manage_buffer(callback);
|
|
65
203
|
_this.manager.push({
|
|
66
204
|
sequence: instructions,
|
|
67
205
|
account: account,
|
|
68
|
-
pid: pid
|
|
206
|
+
pid: pid,
|
|
69
207
|
});
|
|
70
208
|
});
|
|
71
209
|
_defineProperty(_assertThisInitialized(_this), "parse", function (_ref2) {
|
|
@@ -76,12 +214,18 @@ var Account = /*#__PURE__*/function (_Filesystem) {
|
|
|
76
214
|
account = payload.account,
|
|
77
215
|
query = payload.query;
|
|
78
216
|
account = _this.get_account(account);
|
|
79
|
-
if (!account.validate(payload, signature))
|
|
217
|
+
if (!account.validate(payload, signature))
|
|
218
|
+
return _this.run_callback(callback, {
|
|
219
|
+
private: account["private"],
|
|
220
|
+
error: true,
|
|
221
|
+
error_message: "Invalid signature",
|
|
222
|
+
});
|
|
80
223
|
var chain = account.manager.web.get(physical_address);
|
|
81
|
-
if (!chain)
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
224
|
+
if (!chain)
|
|
225
|
+
return _this.run_callback(callback, {
|
|
226
|
+
error: true,
|
|
227
|
+
error_message: "Address not found",
|
|
228
|
+
});
|
|
85
229
|
var data = query ? chain.explore(query) : chain;
|
|
86
230
|
_this.run_callback(callback, data && data.stringify());
|
|
87
231
|
});
|
|
@@ -93,34 +237,60 @@ var Account = /*#__PURE__*/function (_Filesystem) {
|
|
|
93
237
|
account = payload.account,
|
|
94
238
|
query = payload.query;
|
|
95
239
|
account = _this.get_account(account);
|
|
96
|
-
if (!account.validate(payload, signature)) return;
|
|
240
|
+
if (!account.validate(payload, signature, callback)) return;
|
|
97
241
|
var pid = account.manage_buffer(callback);
|
|
98
|
-
var context = physical_address
|
|
242
|
+
var context = physical_address
|
|
243
|
+
? _this.manager.web.get(physical_address)
|
|
244
|
+
: account.vm.get_context();
|
|
99
245
|
if (!context) return account.flush_buffer(pid);
|
|
100
246
|
var blk = query ? context.explore(query) : context.get_latest_block();
|
|
101
247
|
if (blk && blk.metadata && blk.metadata.program) {
|
|
102
248
|
var program = _this.read(blk.metadata.program);
|
|
103
249
|
account.vm.contexts.push(context);
|
|
104
250
|
program.push("pop");
|
|
105
|
-
Array.isArray(program) &&
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
setTimeout(function () {
|
|
114
|
-
if (!callback) return;
|
|
115
|
-
if (typeof callback === "function") return callback(payload);
|
|
116
|
-
_this.vm.stdin(payload);
|
|
117
|
-
callback.payload && callback.payload.physical_address && _this.run(callback);
|
|
118
|
-
}, 0);
|
|
119
|
-
});
|
|
120
|
-
_defineProperty(_assertThisInitialized(_this), "validate", function (payload, signature) {
|
|
121
|
-
if (!_this["private"]) return true;
|
|
122
|
-
return (0, _privacy["default"])(_this.name, JSON.stringify(payload), signature);
|
|
251
|
+
Array.isArray(program) &&
|
|
252
|
+
program.length &&
|
|
253
|
+
_this.manager.push({
|
|
254
|
+
sequence: program,
|
|
255
|
+
account: account,
|
|
256
|
+
pid: pid,
|
|
257
|
+
});
|
|
258
|
+
} else account.flush_buffer(pid);
|
|
123
259
|
});
|
|
260
|
+
_defineProperty(
|
|
261
|
+
_assertThisInitialized(_this),
|
|
262
|
+
"run_callback",
|
|
263
|
+
function (callback, payload) {
|
|
264
|
+
setTimeout(function () {
|
|
265
|
+
if (!callback) return;
|
|
266
|
+
if (typeof callback === "function") return callback(payload);
|
|
267
|
+
callback.payload &&
|
|
268
|
+
callback.payload.physical_address &&
|
|
269
|
+
_this.vm.stdin(payload, function () {
|
|
270
|
+
return _this.run(callback);
|
|
271
|
+
});
|
|
272
|
+
}, 0);
|
|
273
|
+
}
|
|
274
|
+
);
|
|
275
|
+
_defineProperty(
|
|
276
|
+
_assertThisInitialized(_this),
|
|
277
|
+
"validate",
|
|
278
|
+
function (payload, signature, callback) {
|
|
279
|
+
if (!_this["private"]) return true;
|
|
280
|
+
var valid = (0, _privacy["default"])(
|
|
281
|
+
_this.name,
|
|
282
|
+
JSON.stringify(payload),
|
|
283
|
+
signature
|
|
284
|
+
);
|
|
285
|
+
if (!valid)
|
|
286
|
+
_this.run_callback(callback, {
|
|
287
|
+
private: _this["private"],
|
|
288
|
+
error: true,
|
|
289
|
+
error_message: "Invalid signature",
|
|
290
|
+
});
|
|
291
|
+
return valid;
|
|
292
|
+
}
|
|
293
|
+
);
|
|
124
294
|
_defineProperty(_assertThisInitialized(_this), "stringify", function (str) {
|
|
125
295
|
var obj = {};
|
|
126
296
|
obj.name = _this.name;
|
|
@@ -131,15 +301,23 @@ var Account = /*#__PURE__*/function (_Filesystem) {
|
|
|
131
301
|
obj.physical_address = _this.physical_address;
|
|
132
302
|
return str ? JSON.stringify(obj) : obj;
|
|
133
303
|
});
|
|
134
|
-
_defineProperty(
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
304
|
+
_defineProperty(
|
|
305
|
+
_assertThisInitialized(_this),
|
|
306
|
+
"create_account",
|
|
307
|
+
function (payload) {
|
|
308
|
+
var name = payload.name,
|
|
309
|
+
meta = payload.meta;
|
|
310
|
+
return _this.manager.add_account(name, meta);
|
|
311
|
+
}
|
|
312
|
+
);
|
|
313
|
+
_defineProperty(
|
|
314
|
+
_assertThisInitialized(_this),
|
|
315
|
+
"endpoint",
|
|
316
|
+
function (endpoint, payload) {
|
|
317
|
+
var method = _this[endpoint];
|
|
318
|
+
typeof method === "function" && method(payload);
|
|
319
|
+
}
|
|
320
|
+
);
|
|
143
321
|
_meta = _meta || {};
|
|
144
322
|
_this.name = _name;
|
|
145
323
|
_this["private"] = _meta["private"];
|
|
@@ -147,9 +325,11 @@ var Account = /*#__PURE__*/function (_Filesystem) {
|
|
|
147
325
|
_this.account = _assertThisInitialized(_this);
|
|
148
326
|
if (!_this.manager) throw new Error("Manager instance missing.");
|
|
149
327
|
_this.name_hash();
|
|
150
|
-
_this.physical_address = ""
|
|
328
|
+
_this.physical_address = ""
|
|
329
|
+
.concat(_this.base_address, "/")
|
|
330
|
+
.concat(_this.name);
|
|
151
331
|
_this.set_paths(_assertThisInitialized(_this));
|
|
152
|
-
_this.
|
|
332
|
+
_this.assembler = new _main["default"](_assertThisInitialized(_this));
|
|
153
333
|
_this.chain = _this.account_chain(_assertThisInitialized(_this));
|
|
154
334
|
_this.vm = new _Virtual_machine["default"](_this.chain);
|
|
155
335
|
_this.mine_buffer = {};
|
|
@@ -157,6 +337,6 @@ var Account = /*#__PURE__*/function (_Filesystem) {
|
|
|
157
337
|
return _this;
|
|
158
338
|
}
|
|
159
339
|
return _createClass(Account);
|
|
160
|
-
}(_Filesystem2["default"]);
|
|
340
|
+
})(_Filesystem2["default"]);
|
|
161
341
|
var _default = Account;
|
|
162
|
-
exports["default"] = _default;
|
|
342
|
+
exports["default"] = _default;
|
package/Objects/Manager.js
CHANGED
|
@@ -43,8 +43,7 @@ var Manager = /*#__PURE__*/_createClass(function Manager() {
|
|
|
43
43
|
delete _this.tracks[account];
|
|
44
44
|
}
|
|
45
45
|
if (track.breakpoint.slice(-1)[0] === track.pointer) {
|
|
46
|
-
track.account.flush_buffer(track.pids.
|
|
47
|
-
track.pid = track.pids.splice(-1)[0];
|
|
46
|
+
track.account.flush_buffer(track.pids.splice(-1)[0]);
|
|
48
47
|
}
|
|
49
48
|
}
|
|
50
49
|
!_this.running && clearInterval(_this.clock);
|
|
@@ -71,7 +70,7 @@ var Manager = /*#__PURE__*/_createClass(function Manager() {
|
|
|
71
70
|
var track = _this.tracks[program.account.name];
|
|
72
71
|
if (track) {
|
|
73
72
|
var _track$sequence;
|
|
74
|
-
track.breakpoint.push(track.pointer);
|
|
73
|
+
track.breakpoint.push(track.pointer + program.sequence.length + 1);
|
|
75
74
|
(_track$sequence = track.sequence).splice.apply(_track$sequence, [track.pointer + 1, 0].concat(_toConsumableArray(program.sequence)));
|
|
76
75
|
track.pids.push(program.pid);
|
|
77
76
|
if (!_this.running) {
|
package/Objects/Opcodes.js
CHANGED
|
@@ -1,18 +1,78 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
4
|
+
value: true,
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = void 0;
|
|
7
7
|
var _functions = require("../utils/functions");
|
|
8
|
-
function _typeof(o) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
function
|
|
13
|
-
function
|
|
14
|
-
|
|
15
|
-
|
|
8
|
+
function _typeof(o) {
|
|
9
|
+
"@babel/helpers - typeof";
|
|
10
|
+
return (
|
|
11
|
+
(_typeof =
|
|
12
|
+
"function" == typeof Symbol && "symbol" == typeof Symbol.iterator
|
|
13
|
+
? function (o) {
|
|
14
|
+
return typeof o;
|
|
15
|
+
}
|
|
16
|
+
: function (o) {
|
|
17
|
+
return o &&
|
|
18
|
+
"function" == typeof Symbol &&
|
|
19
|
+
o.constructor === Symbol &&
|
|
20
|
+
o !== Symbol.prototype
|
|
21
|
+
? "symbol"
|
|
22
|
+
: typeof o;
|
|
23
|
+
}),
|
|
24
|
+
_typeof(o)
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
function _defineProperties(e, r) {
|
|
28
|
+
for (var t = 0; t < r.length; t++) {
|
|
29
|
+
var o = r[t];
|
|
30
|
+
(o.enumerable = o.enumerable || !1),
|
|
31
|
+
(o.configurable = !0),
|
|
32
|
+
"value" in o && (o.writable = !0),
|
|
33
|
+
Object.defineProperty(e, _toPropertyKey(o.key), o);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
function _createClass(e, r, t) {
|
|
37
|
+
return (
|
|
38
|
+
r && _defineProperties(e.prototype, r),
|
|
39
|
+
t && _defineProperties(e, t),
|
|
40
|
+
Object.defineProperty(e, "prototype", { writable: !1 }),
|
|
41
|
+
e
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
function _classCallCheck(a, n) {
|
|
45
|
+
if (!(a instanceof n))
|
|
46
|
+
throw new TypeError("Cannot call a class as a function");
|
|
47
|
+
}
|
|
48
|
+
function _defineProperty(e, r, t) {
|
|
49
|
+
return (
|
|
50
|
+
(r = _toPropertyKey(r)) in e
|
|
51
|
+
? Object.defineProperty(e, r, {
|
|
52
|
+
value: t,
|
|
53
|
+
enumerable: !0,
|
|
54
|
+
configurable: !0,
|
|
55
|
+
writable: !0,
|
|
56
|
+
})
|
|
57
|
+
: (e[r] = t),
|
|
58
|
+
e
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
function _toPropertyKey(t) {
|
|
62
|
+
var i = _toPrimitive(t, "string");
|
|
63
|
+
return "symbol" == _typeof(i) ? i : i + "";
|
|
64
|
+
}
|
|
65
|
+
function _toPrimitive(t, r) {
|
|
66
|
+
if ("object" != _typeof(t) || !t) return t;
|
|
67
|
+
var e = t[Symbol.toPrimitive];
|
|
68
|
+
if (void 0 !== e) {
|
|
69
|
+
var i = e.call(t, r || "default");
|
|
70
|
+
if ("object" != _typeof(i)) return i;
|
|
71
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
72
|
+
}
|
|
73
|
+
return ("string" === r ? String : Number)(t);
|
|
74
|
+
}
|
|
75
|
+
var Opcodes = /*#__PURE__*/ _createClass(function Opcodes() {
|
|
16
76
|
var _this = this;
|
|
17
77
|
_classCallCheck(this, Opcodes);
|
|
18
78
|
_defineProperty(this, "set", function (opcode, circuit) {
|
|
@@ -27,13 +87,16 @@ var Opcodes = /*#__PURE__*/_createClass(function Opcodes() {
|
|
|
27
87
|
var res = circ(args);
|
|
28
88
|
_this.stdin(res);
|
|
29
89
|
});
|
|
30
|
-
_defineProperty(this, "stdin", function (object) {
|
|
90
|
+
_defineProperty(this, "stdin", function (object, cb) {
|
|
31
91
|
if (object == null) return;
|
|
32
92
|
var code_string = (0, _functions.transpile_object)(object);
|
|
33
|
-
_this.account.
|
|
93
|
+
_this.account.assembler.run(code_string, {
|
|
94
|
+
cb: cb,
|
|
95
|
+
pure: true,
|
|
96
|
+
});
|
|
34
97
|
// console.log(`Writing in: ${code_string}`);
|
|
35
98
|
});
|
|
36
99
|
this.opcodes = new Object();
|
|
37
100
|
});
|
|
38
101
|
var _default = Opcodes;
|
|
39
|
-
exports["default"] = _default;
|
|
102
|
+
exports["default"] = _default;
|