godprotocol 1.0.77 → 1.0.79

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.
Files changed (71) hide show
  1. package/Index.js +3 -15
  2. package/Loader_sequence/main.js +255 -55
  3. package/Objects/Account.js +24 -21
  4. package/Objects/Block.js +4 -1
  5. package/Objects/Chain.js +8 -1
  6. package/Objects/Filesystem.js +11 -15
  7. package/Objects/Manager.js +19 -8
  8. package/Objects/Opcodes.js +5 -3
  9. package/Objects/Oracle.js +10 -0
  10. package/Objects/Virtual_machine.js +1 -7
  11. package/framer.js +2 -4
  12. package/opcodes/std.js +2 -1
  13. package/opcodes.js +6 -4
  14. package/package.json +13 -3
  15. package/readme.md +2 -2
  16. package/utils/create_server.js +23 -3
  17. package/.github/workflows/npm-publish-github-packages.yml +0 -36
  18. package/Accounts/59eb3cb130074f7b1ddb99c8fe14f27e1dbca735bb3da82e1ff0305340a32419/0ee263de3fb9e3e08e7d5abe21db8c0fe66188829979996dcddd3533d855a817/30dc10d3485923c0c19083559094fe636f9491bff9c997306ffdbf3e1618a402/74234e98afe7498fb5daf1f36ac2d78acc339464f950703b8c019892f982b90b +0 -1
  19. package/Accounts/59eb3cb130074f7b1ddb99c8fe14f27e1dbca735bb3da82e1ff0305340a32419/0ee263de3fb9e3e08e7d5abe21db8c0fe66188829979996dcddd3533d855a817/4dc569813ce0a2f446a3eec01358f5774f8564641ef8d579ff5b6d94b4d031a7/74234e98afe7498fb5daf1f36ac2d78acc339464f950703b8c019892f982b90b +0 -1
  20. package/Accounts/59eb3cb130074f7b1ddb99c8fe14f27e1dbca735bb3da82e1ff0305340a32419/0ee263de3fb9e3e08e7d5abe21db8c0fe66188829979996dcddd3533d855a817/74234e98afe7498fb5daf1f36ac2d78acc339464f950703b8c019892f982b90b +0 -1
  21. package/Accounts/59eb3cb130074f7b1ddb99c8fe14f27e1dbca735bb3da82e1ff0305340a32419/0ee263de3fb9e3e08e7d5abe21db8c0fe66188829979996dcddd3533d855a817/a965464a6d9f981543ce3aede226bd0fb989d9300cd8468f41cd1fc0139c8f44/74234e98afe7498fb5daf1f36ac2d78acc339464f950703b8c019892f982b90b +0 -1
  22. package/Accounts/59eb3cb130074f7b1ddb99c8fe14f27e1dbca735bb3da82e1ff0305340a32419/12cd650efa4f63b7c61c3345db3daa0534f4c370a003ea6d8ae0d29a49f6f928/74234e98afe7498fb5daf1f36ac2d78acc339464f950703b8c019892f982b90b +0 -1
  23. package/Accounts/59eb3cb130074f7b1ddb99c8fe14f27e1dbca735bb3da82e1ff0305340a32419/3ff3661353ccadcaf9c6759a539d8d31e19c07ed0dd888170b9e55c7a18721da/74234e98afe7498fb5daf1f36ac2d78acc339464f950703b8c019892f982b90b +0 -1
  24. package/Accounts/59eb3cb130074f7b1ddb99c8fe14f27e1dbca735bb3da82e1ff0305340a32419/3ff3661353ccadcaf9c6759a539d8d31e19c07ed0dd888170b9e55c7a18721da/de551b5a493859e532316cbbf1e4a14eb06e0512556b1c1295ad60ffe07c185b/19270ea4f98808a63fbb99bc26a5ee6f0fe8df9c8182cf1d710b115d57250578 +0 -1
  25. package/Accounts/59eb3cb130074f7b1ddb99c8fe14f27e1dbca735bb3da82e1ff0305340a32419/3ff3661353ccadcaf9c6759a539d8d31e19c07ed0dd888170b9e55c7a18721da/f8a165e3f556ca2ea189f4d4401d139b22a6f19d0b38329fe4a5f14599840634/4f52f1dc77e0233034c6566fc73c30234de85d2298ff90885a7c56502dffa0b2 +0 -1
  26. package/Accounts/59eb3cb130074f7b1ddb99c8fe14f27e1dbca735bb3da82e1ff0305340a32419/3ff3661353ccadcaf9c6759a539d8d31e19c07ed0dd888170b9e55c7a18721da/f8a165e3f556ca2ea189f4d4401d139b22a6f19d0b38329fe4a5f14599840634/8d3c916f9c93a6f4c8be9c3f4493b1c02d3eb7516eac153a98320924b27739d8 +0 -1
  27. package/Accounts/59eb3cb130074f7b1ddb99c8fe14f27e1dbca735bb3da82e1ff0305340a32419/f968ed8cf7958218d4604b3de0bf074f09bac7925e86f7d1f495f8b2c67f31a7/61bdf0593cd727752cb917ab968a08853d45142b8a8e4cdcd0fe03d1616f3586/74234e98afe7498fb5daf1f36ac2d78acc339464f950703b8c019892f982b90b +0 -1
  28. package/Accounts/59eb3cb130074f7b1ddb99c8fe14f27e1dbca735bb3da82e1ff0305340a32419/f968ed8cf7958218d4604b3de0bf074f09bac7925e86f7d1f495f8b2c67f31a7/74234e98afe7498fb5daf1f36ac2d78acc339464f950703b8c019892f982b90b +0 -1
  29. package/Loader_sequence/functions/parse_expression.js +0 -107
  30. package/Loader_sequence/functions/parse_to_obj.js +0 -38
  31. package/Loader_sequence/functions/parse_variable.js +0 -38
  32. package/Loader_sequence/functions/tokenise.js +0 -135
  33. package/Loader_sequence/functions/utils.js +0 -14
  34. package/Loader_sequence/keywords/parse.js +0 -23
  35. package/Loader_sequence/native_classes/Variable.js +0 -49
  36. package/Loader_sequence/native_classes/datatypes/Array.js +0 -56
  37. package/Loader_sequence/native_classes/datatypes/Boolean.js +0 -42
  38. package/Loader_sequence/native_classes/datatypes/Number.js +0 -42
  39. package/Loader_sequence/native_classes/datatypes/String.js +0 -42
  40. package/Loader_sequence/native_classes/datatypes/Twain.js +0 -65
  41. package/Loader_sequence/native_classes/datatypes/Void.js +0 -42
  42. package/Loader_sequence/native_classes/global.js +0 -48
  43. package/Loader_sequence/native_classes/native.js +0 -63
  44. package/Loader_sequence/native_classes/operators.js +0 -64
  45. package/Loader_sequence/native_classes/parse.js +0 -54
  46. package/Loader_sequence/utils/format_instructions.js +0 -52
  47. package/build/Account.js +0 -245
  48. package/build/Array.js +0 -142
  49. package/build/Block.js +0 -100
  50. package/build/Blockweb.js +0 -78
  51. package/build/Boolean.js +0 -128
  52. package/build/Chain.js +0 -198
  53. package/build/Explorer.js +0 -85
  54. package/build/Filesystem.js +0 -173
  55. package/build/Frame.js +0 -108
  56. package/build/Index.js +0 -31
  57. package/build/Manager.js +0 -167
  58. package/build/Number.js +0 -128
  59. package/build/Opcodes.js +0 -75
  60. package/build/Oracle.js +0 -70
  61. package/build/String.js +0 -128
  62. package/build/Twain.js +0 -151
  63. package/build/Variable.js +0 -135
  64. package/build/Virtual_machine.js +0 -220
  65. package/build/Void.js +0 -128
  66. package/build/format_instructions.js +0 -52
  67. package/build/framer.js +0 -90
  68. package/build/global.js +0 -134
  69. package/build/main.js +0 -83
  70. package/build/native.js +0 -101
  71. package/build/operators.js +0 -150
@@ -1,52 +0,0 @@
1
- "use strict";
2
-
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 _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
9
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
10
- function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
11
- function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
12
- function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
13
- function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
14
- 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); } }
15
- function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
16
- function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
17
- 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; }
18
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
19
- 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); }
20
- var Tree_node = /*#__PURE__*/_createClass(function Tree_node(value) {
21
- var _this = this;
22
- _classCallCheck(this, Tree_node);
23
- _defineProperty(this, "add_child", function (childNode) {
24
- _this.children.push(childNode);
25
- });
26
- this.value = value;
27
- this.children = [];
28
- });
29
- var format_instructions = function format_instructions(instructions, no) {
30
- if (no) return instructions;
31
- var root = new Tree_node("air");
32
- var current = root;
33
- var node_stack = [];
34
- instructions.forEach(function (instruction) {
35
- var _instruction$split = instruction.split(" ", 2),
36
- _instruction$split2 = _slicedToArray(_instruction$split, 2),
37
- opcode = _instruction$split2[0],
38
- operand = _instruction$split2[1];
39
- if (opcode === "chain" || opcode === "link") {
40
- var new_node = new Tree_node(instruction);
41
- current.add_child(new_node);
42
- node_stack.push(current);
43
- current = new_node;
44
- } else if (opcode === "pop") {
45
- current.add_child(instruction);
46
- current = node_stack.pop();
47
- } else current.add_child(instruction);
48
- });
49
- return JSON.stringify(root, null, 2);
50
- };
51
- var _default = format_instructions;
52
- exports["default"] = _default;
package/build/Account.js DELETED
@@ -1,245 +0,0 @@
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 _Filesystem2 = _interopRequireDefault(require("./Filesystem"));
10
- var _Virtual_machine = _interopRequireDefault(require("./Virtual_machine"));
11
- function _interopRequireDefault(e) {
12
- return e && e.__esModule ? e : {
13
- "default": e
14
- };
15
- }
16
- function _typeof(o) {
17
- "@babel/helpers - typeof";
18
-
19
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
20
- return typeof o;
21
- } : function (o) {
22
- return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
23
- }, _typeof(o);
24
- }
25
- function _defineProperties(e, r) {
26
- for (var t = 0; t < r.length; t++) {
27
- var o = r[t];
28
- o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o);
29
- }
30
- }
31
- function _createClass(e, r, t) {
32
- return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", {
33
- writable: !1
34
- }), e;
35
- }
36
- function _classCallCheck(a, n) {
37
- if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
38
- }
39
- function _inherits(t, e) {
40
- if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function");
41
- t.prototype = Object.create(e && e.prototype, {
42
- constructor: {
43
- value: t,
44
- writable: !0,
45
- configurable: !0
46
- }
47
- }), Object.defineProperty(t, "prototype", {
48
- writable: !1
49
- }), e && _setPrototypeOf(t, e);
50
- }
51
- function _setPrototypeOf(t, e) {
52
- return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {
53
- return t.__proto__ = e, t;
54
- }, _setPrototypeOf(t, e);
55
- }
56
- function _createSuper(t) {
57
- var r = _isNativeReflectConstruct();
58
- return function () {
59
- var e,
60
- o = _getPrototypeOf(t);
61
- if (r) {
62
- var s = _getPrototypeOf(this).constructor;
63
- e = Reflect.construct(o, arguments, s);
64
- } else e = o.apply(this, arguments);
65
- return _possibleConstructorReturn(this, e);
66
- };
67
- }
68
- function _possibleConstructorReturn(t, e) {
69
- if (e && ("object" == _typeof(e) || "function" == typeof e)) return e;
70
- if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined");
71
- return _assertThisInitialized(t);
72
- }
73
- function _assertThisInitialized(e) {
74
- if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
75
- return e;
76
- }
77
- function _isNativeReflectConstruct() {
78
- try {
79
- var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
80
- } catch (t) {}
81
- return (_isNativeReflectConstruct = function _isNativeReflectConstruct() {
82
- return !!t;
83
- })();
84
- }
85
- function _getPrototypeOf(t) {
86
- return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) {
87
- return t.__proto__ || Object.getPrototypeOf(t);
88
- }, _getPrototypeOf(t);
89
- }
90
- function _defineProperty(e, r, t) {
91
- return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
92
- value: t,
93
- enumerable: !0,
94
- configurable: !0,
95
- writable: !0
96
- }) : e[r] = t, e;
97
- }
98
- function _toPropertyKey(t) {
99
- var i = _toPrimitive(t, "string");
100
- return "symbol" == _typeof(i) ? i : i + "";
101
- }
102
- function _toPrimitive(t, r) {
103
- if ("object" != _typeof(t) || !t) return t;
104
- var e = t[Symbol.toPrimitive];
105
- if (void 0 !== e) {
106
- var i = e.call(t, r || "default");
107
- if ("object" != _typeof(i)) return i;
108
- throw new TypeError("@@toPrimitive must return a primitive value.");
109
- }
110
- return ("string" === r ? String : Number)(t);
111
- }
112
- var Account = /*#__PURE__*/function (_Filesystem) {
113
- _inherits(Account, _Filesystem);
114
- var _super = _createSuper(Account);
115
- function Account(_name) {
116
- var _this;
117
- var _meta = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
118
- _classCallCheck(this, Account);
119
- _this = _super.call(this);
120
- _defineProperty(_assertThisInitialized(_this), "get_account", function (name) {
121
- return _this.manager.get_account(name) || _assertThisInitialized(_this);
122
- });
123
- _defineProperty(_assertThisInitialized(_this), "manage_buffer", function (callback) {
124
- var call_session = "".concat(Date.now(), "-").concat(Math.random());
125
- _this.mine_buffer[call_session] = {
126
- blocks: [],
127
- callback: callback
128
- };
129
- return call_session;
130
- });
131
- _defineProperty(_assertThisInitialized(_this), "buff", function (block, pid) {
132
- var bf = _this.mine_buffer[pid];
133
- if (!bf) return;
134
- bf.blocks.push(block.stringify());
135
- });
136
- _defineProperty(_assertThisInitialized(_this), "flush_buffer", function (pid) {
137
- var buff = _this.mine_buffer[pid];
138
- buff.callback && buff.callback(buff.blocks);
139
- delete _this.mine_buffer[pid];
140
- });
141
- _defineProperty(_assertThisInitialized(_this), "load", function (_ref) {
142
- var program = _ref.program,
143
- signature = _ref.signature,
144
- callback = _ref.callback;
145
- var instructions = program.instructions,
146
- account = program.account;
147
- account = _this.get_account(account);
148
- if (!account.validate(program, signature)) return;
149
- var pid = account.manage_buffer(callback);
150
- _this.manager.push({
151
- sequence: instructions,
152
- account: account,
153
- pid: pid
154
- });
155
- });
156
- _defineProperty(_assertThisInitialized(_this), "parse", function (_ref2) {
157
- var payload = _ref2.payload,
158
- signature = _ref2.signature,
159
- callback = _ref2.callback;
160
- var physical_address = payload.physical_address,
161
- account = payload.account,
162
- query = payload.query;
163
- account = _this.get_account(account);
164
- if (!account.validate(payload, signature)) return;
165
- var chain = account.manager.web.get(physical_address);
166
- if (!chain) return _this.run_callback(callback, {
167
- error: true,
168
- error_message: "Address not found"
169
- });
170
- var data = query ? chain.explore(query) : chain;
171
- _this.run_callback(callback, data && data.stringify());
172
- });
173
- _defineProperty(_assertThisInitialized(_this), "run", function (_ref3) {
174
- var payload = _ref3.payload,
175
- signature = _ref3.signature,
176
- callback = _ref3.callback;
177
- var physical_address = payload.physical_address,
178
- account = payload.account,
179
- query = payload.query;
180
- account = _this.get_account(account);
181
- if (!account.validate(payload, signature)) return;
182
- var pid = account.manage_buffer(callback);
183
- var context = physical_address ? _this.manager.web.get({
184
- physical_address: physical_address
185
- }, true) : account.vm.get_context();
186
- if (!context) return account.flush_buffer(pid);
187
- var blk = query ? context.explore(query) : context.get_block(0);
188
- if (blk) {
189
- _this.vm.stack.push(blk.hash);
190
- _this.manager.push({
191
- sequence: blk.data,
192
- account: account,
193
- pid: pid
194
- });
195
- }
196
- });
197
- _defineProperty(_assertThisInitialized(_this), "run_callback", function (callback, payload) {
198
- if (!callback) return;
199
- if (typeof callback === "function") return callback(payload);
200
- _this.vm.stdin(payload);
201
- callback.physical_address && _this.run(callback);
202
- });
203
- _defineProperty(_assertThisInitialized(_this), "validate", function (payload, signature) {
204
- if (!_this["private"]) return true;
205
- return (0, _privacy["default"])(_this.name, JSON.stringify(payload), signature);
206
- });
207
- _defineProperty(_assertThisInitialized(_this), "stringify", function (str) {
208
- var obj = {};
209
- obj.name = _this.name;
210
- obj.hash = _this.hash;
211
- obj.path = _this.path;
212
- obj["private"] = _this["private"];
213
- obj.chain = _this.chain.stringify();
214
- obj.physical_address = _this.physical_address;
215
- return str ? JSON.stringify(obj) : obj;
216
- });
217
- _defineProperty(_assertThisInitialized(_this), "create_account", function (payload) {
218
- var name = payload.name,
219
- meta = payload.meta;
220
- return _this.manager.add_account(name, meta);
221
- });
222
- _defineProperty(_assertThisInitialized(_this), "endpoint", function (endpoint, payload) {
223
- var method = _this[endpoint];
224
- typeof method === "function" && method(payload);
225
- });
226
- _meta = _meta || {};
227
- _this.name = _name;
228
- _this["private"] = _meta["private"];
229
- _this.manager = _meta.manager;
230
- _this.account = _assertThisInitialized(_this);
231
- if (!_this.manager) throw new Error("Manager instance missing.");
232
- _this.name_hash();
233
- _this.physical_address = "".concat(_this.base_address, "/").concat(_this.name);
234
- _this.set_paths(_assertThisInitialized(_this));
235
- _this.compiler = new _main["default"](_assertThisInitialized(_this));
236
- _this.chain = _this.account_chain(_assertThisInitialized(_this));
237
- _this.vm = new _Virtual_machine["default"](_this.chain);
238
- _this.mine_buffer = {};
239
- console.log("Account Instance: ".concat(_this.name));
240
- return _this;
241
- }
242
- return _createClass(Account);
243
- }(_Filesystem2["default"]);
244
- var _default = Account;
245
- exports["default"] = _default;
package/build/Array.js DELETED
@@ -1,142 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports["default"] = void 0;
7
- var _utils = require("../../functions/utils");
8
- var _native = _interopRequireDefault(require("../native"));
9
- var _Boolean = _interopRequireDefault(require("./Boolean"));
10
- var _Number = _interopRequireDefault(require("./Number"));
11
- var _String = _interopRequireDefault(require("./String"));
12
- var _Twain = _interopRequireDefault(require("./Twain"));
13
- var _Void = _interopRequireDefault(require("./Void"));
14
- function _interopRequireDefault(e) {
15
- return e && e.__esModule ? e : {
16
- "default": e
17
- };
18
- }
19
- function _typeof(o) {
20
- "@babel/helpers - typeof";
21
-
22
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
23
- return typeof o;
24
- } : function (o) {
25
- return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
26
- }, _typeof(o);
27
- }
28
- function _defineProperties(e, r) {
29
- for (var t = 0; t < r.length; t++) {
30
- var o = r[t];
31
- o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o);
32
- }
33
- }
34
- function _createClass(e, r, t) {
35
- return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", {
36
- writable: !1
37
- }), e;
38
- }
39
- function _classCallCheck(a, n) {
40
- if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
41
- }
42
- function _inherits(t, e) {
43
- if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function");
44
- t.prototype = Object.create(e && e.prototype, {
45
- constructor: {
46
- value: t,
47
- writable: !0,
48
- configurable: !0
49
- }
50
- }), Object.defineProperty(t, "prototype", {
51
- writable: !1
52
- }), e && _setPrototypeOf(t, e);
53
- }
54
- function _setPrototypeOf(t, e) {
55
- return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {
56
- return t.__proto__ = e, t;
57
- }, _setPrototypeOf(t, e);
58
- }
59
- function _createSuper(t) {
60
- var r = _isNativeReflectConstruct();
61
- return function () {
62
- var e,
63
- o = _getPrototypeOf(t);
64
- if (r) {
65
- var s = _getPrototypeOf(this).constructor;
66
- e = Reflect.construct(o, arguments, s);
67
- } else e = o.apply(this, arguments);
68
- return _possibleConstructorReturn(this, e);
69
- };
70
- }
71
- function _possibleConstructorReturn(t, e) {
72
- if (e && ("object" == _typeof(e) || "function" == typeof e)) return e;
73
- if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined");
74
- return _assertThisInitialized(t);
75
- }
76
- function _assertThisInitialized(e) {
77
- if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
78
- return e;
79
- }
80
- function _isNativeReflectConstruct() {
81
- try {
82
- var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
83
- } catch (t) {}
84
- return (_isNativeReflectConstruct = function _isNativeReflectConstruct() {
85
- return !!t;
86
- })();
87
- }
88
- function _getPrototypeOf(t) {
89
- return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) {
90
- return t.__proto__ || Object.getPrototypeOf(t);
91
- }, _getPrototypeOf(t);
92
- }
93
- function _defineProperty(e, r, t) {
94
- return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
95
- value: t,
96
- enumerable: !0,
97
- configurable: !0,
98
- writable: !0
99
- }) : e[r] = t, e;
100
- }
101
- function _toPropertyKey(t) {
102
- var i = _toPrimitive(t, "string");
103
- return "symbol" == _typeof(i) ? i : i + "";
104
- }
105
- function _toPrimitive(t, r) {
106
- if ("object" != _typeof(t) || !t) return t;
107
- var e = t[Symbol.toPrimitive];
108
- if (void 0 !== e) {
109
- var i = e.call(t, r || "default");
110
- if ("object" != _typeof(i)) return i;
111
- throw new TypeError("@@toPrimitive must return a primitive value.");
112
- }
113
- return ("string" === r ? String : Number)(t);
114
- }
115
- var Arr = /*#__PURE__*/function (_Native) {
116
- _inherits(Arr, _Native);
117
- var _super = _createSuper(Arr);
118
- function Arr(token) {
119
- var _this;
120
- _classCallCheck(this, Arr);
121
- _this = _super.call(this);
122
- _defineProperty(_assertThisInitialized(_this), "generate_assembly", function (sequence) {
123
- sequence.push("link ".concat(_this.token.compiler.account.physical_address, "/Datatypes/Array"));
124
- _this.value = _this.value.filter(function (v) {
125
- return !(0, _utils.is_token_value)(v, ",", "separator");
126
- });
127
- _this.token.compiler.parse(_this.value, _assertThisInitialized(_this));
128
- _this.children.map(function (child, i) {
129
- child.generate_assembly(sequence);
130
- sequence.push("cursor ".concat(i));
131
- sequence.push("write {datapath:-1}");
132
- });
133
- sequence.push("pop Datatypes/Array");
134
- });
135
- _this.token = token;
136
- _this.value = _this.token.value;
137
- return _this;
138
- }
139
- return _createClass(Arr);
140
- }(_native["default"]);
141
- var _default = Arr;
142
- exports["default"] = _default;
package/build/Block.js DELETED
@@ -1,100 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports["default"] = void 0;
7
- var _hash = require("../utils/hash");
8
- function _typeof(o) {
9
- "@babel/helpers - typeof";
10
-
11
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
12
- return typeof o;
13
- } : function (o) {
14
- return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
15
- }, _typeof(o);
16
- }
17
- function _defineProperties(e, r) {
18
- for (var t = 0; t < r.length; t++) {
19
- var o = r[t];
20
- o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o);
21
- }
22
- }
23
- function _createClass(e, r, t) {
24
- return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", {
25
- writable: !1
26
- }), e;
27
- }
28
- function _classCallCheck(a, n) {
29
- if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
30
- }
31
- function _defineProperty(e, r, t) {
32
- return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
33
- value: t,
34
- enumerable: !0,
35
- configurable: !0,
36
- writable: !0
37
- }) : e[r] = t, e;
38
- }
39
- function _toPropertyKey(t) {
40
- var i = _toPrimitive(t, "string");
41
- return "symbol" == _typeof(i) ? i : i + "";
42
- }
43
- function _toPrimitive(t, r) {
44
- if ("object" != _typeof(t) || !t) return t;
45
- var e = t[Symbol.toPrimitive];
46
- if (void 0 !== e) {
47
- var i = e.call(t, r || "default");
48
- if ("object" != _typeof(i)) return i;
49
- throw new TypeError("@@toPrimitive must return a primitive value.");
50
- }
51
- return ("string" === r ? String : Number)(t);
52
- }
53
- var Block = /*#__PURE__*/_createClass(function Block(chain) {
54
- var _this = this;
55
- _classCallCheck(this, Block);
56
- _defineProperty(this, "generate_hash", function () {
57
- _this.previous_hash = _this.chain.get_latest_block();
58
- if (_this.previous_hash) _this.previous_hash = _this.previous_hash.hash;
59
- _this.hash = (0, _hash.hash)(JSON.stringify(_this.data));
60
- });
61
- _defineProperty(this, "store", function (no_curs) {
62
- var content = _this.chain.buffs.splice(-1)[0];
63
- if (!no_curs) _this.cursor = _this.chain.cursors.splice(-1)[0];
64
- if (!content) return;
65
- var cursors = Object.keys(content).filter(function (c) {
66
- return c.startsWith("{") && c.endsWith("}");
67
- });
68
- for (var c = 0; c < cursors.length; c++) {
69
- var curs = cursors[c];
70
- _this.metadata[curs.slice(1, -1)] = content[curs];
71
- delete content[curs];
72
- }
73
- var datapath = _this.chain.account.save(content, _this.chain);
74
- _this.datapath = datapath;
75
- });
76
- _defineProperty(this, "stringify", function (str) {
77
- var obj = {};
78
- obj.metadata = _this.metadata;
79
- obj.datapath = _this.datapath;
80
- obj.timelapse = _this.timelapse;
81
- obj.index = _this.index;
82
- obj.hash = _this.hash;
83
- obj.data = _this.data;
84
- obj.children = _this.children.map(function (ch) {
85
- return new Object({
86
- hash: ch.hash,
87
- chain: ch.chain.hash
88
- });
89
- });
90
- obj.chain = _this.chain.hash;
91
- return str ? JSON.stringify(obj) : obj;
92
- });
93
- this.chain = chain;
94
- this.data = this.chain.txs;
95
- this.metadata = {};
96
- this.children = new Array();
97
- this.index = this.chain.blocks.length;
98
- });
99
- var _default = Block;
100
- exports["default"] = _default;
package/build/Blockweb.js DELETED
@@ -1,78 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports["default"] = void 0;
7
- var _Chain = _interopRequireDefault(require("./Chain"));
8
- function _interopRequireDefault(e) {
9
- return e && e.__esModule ? e : {
10
- "default": e
11
- };
12
- }
13
- function _typeof(o) {
14
- "@babel/helpers - typeof";
15
-
16
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
17
- return typeof o;
18
- } : function (o) {
19
- return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
20
- }, _typeof(o);
21
- }
22
- function _defineProperties(e, r) {
23
- for (var t = 0; t < r.length; t++) {
24
- var o = r[t];
25
- o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o);
26
- }
27
- }
28
- function _createClass(e, r, t) {
29
- return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", {
30
- writable: !1
31
- }), e;
32
- }
33
- function _classCallCheck(a, n) {
34
- if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
35
- }
36
- function _defineProperty(e, r, t) {
37
- return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
38
- value: t,
39
- enumerable: !0,
40
- configurable: !0,
41
- writable: !0
42
- }) : e[r] = t, e;
43
- }
44
- function _toPropertyKey(t) {
45
- var i = _toPrimitive(t, "string");
46
- return "symbol" == _typeof(i) ? i : i + "";
47
- }
48
- function _toPrimitive(t, r) {
49
- if ("object" != _typeof(t) || !t) return t;
50
- var e = t[Symbol.toPrimitive];
51
- if (void 0 !== e) {
52
- var i = e.call(t, r || "default");
53
- if ("object" != _typeof(i)) return i;
54
- throw new TypeError("@@toPrimitive must return a primitive value.");
55
- }
56
- return ("string" === r ? String : Number)(t);
57
- }
58
- var Blockweb = /*#__PURE__*/_createClass(function Blockweb(mgr) {
59
- var _this = this;
60
- _classCallCheck(this, Blockweb);
61
- _defineProperty(this, "get", function (addr) {
62
- var hash = _this.physical_addresses[addr];
63
- var chain = _this.chains[hash];
64
- return chain;
65
- });
66
- _defineProperty(this, "set", function (parent, name) {
67
- var chain = new _Chain["default"](parent, name);
68
- _this.chains[chain.hash] = chain;
69
- _this.physical_addresses[chain.physical_address] = chain.hash;
70
- _this.chains[chain.hash] = chain;
71
- return chain;
72
- });
73
- this.mgr = mgr;
74
- this.physical_addresses = new Object();
75
- this.chains = new Object();
76
- });
77
- var _default = Blockweb;
78
- exports["default"] = _default;