godprotocol 1.0.792 → 1.0.793
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/Loader_sequence/main.js +275 -70
- package/package.json +2 -2
- package/readme.md +12 -11
package/Loader_sequence/main.js
CHANGED
|
@@ -1,26 +1,123 @@
|
|
|
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
|
-
function _typeof(o) {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
function
|
|
12
|
-
function
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
function
|
|
16
|
-
|
|
17
|
-
function
|
|
18
|
-
|
|
19
|
-
|
|
7
|
+
function _typeof(o) {
|
|
8
|
+
"@babel/helpers - typeof";
|
|
9
|
+
return (
|
|
10
|
+
(_typeof =
|
|
11
|
+
"function" == typeof Symbol && "symbol" == typeof Symbol.iterator
|
|
12
|
+
? function (o) {
|
|
13
|
+
return typeof o;
|
|
14
|
+
}
|
|
15
|
+
: function (o) {
|
|
16
|
+
return o &&
|
|
17
|
+
"function" == typeof Symbol &&
|
|
18
|
+
o.constructor === Symbol &&
|
|
19
|
+
o !== Symbol.prototype
|
|
20
|
+
? "symbol"
|
|
21
|
+
: typeof o;
|
|
22
|
+
}),
|
|
23
|
+
_typeof(o)
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
function _toConsumableArray(r) {
|
|
27
|
+
return (
|
|
28
|
+
_arrayWithoutHoles(r) ||
|
|
29
|
+
_iterableToArray(r) ||
|
|
30
|
+
_unsupportedIterableToArray(r) ||
|
|
31
|
+
_nonIterableSpread()
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
function _nonIterableSpread() {
|
|
35
|
+
throw new TypeError(
|
|
36
|
+
"Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
function _unsupportedIterableToArray(r, a) {
|
|
40
|
+
if (r) {
|
|
41
|
+
if ("string" == typeof r) return _arrayLikeToArray(r, a);
|
|
42
|
+
var t = {}.toString.call(r).slice(8, -1);
|
|
43
|
+
return (
|
|
44
|
+
"Object" === t && r.constructor && (t = r.constructor.name),
|
|
45
|
+
"Map" === t || "Set" === t
|
|
46
|
+
? Array.from(r)
|
|
47
|
+
: "Arguments" === t ||
|
|
48
|
+
/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)
|
|
49
|
+
? _arrayLikeToArray(r, a)
|
|
50
|
+
: void 0
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
function _iterableToArray(r) {
|
|
55
|
+
if (
|
|
56
|
+
("undefined" != typeof Symbol && null != r[Symbol.iterator]) ||
|
|
57
|
+
null != r["@@iterator"]
|
|
58
|
+
)
|
|
59
|
+
return Array.from(r);
|
|
60
|
+
}
|
|
61
|
+
function _arrayWithoutHoles(r) {
|
|
62
|
+
if (Array.isArray(r)) return _arrayLikeToArray(r);
|
|
63
|
+
}
|
|
64
|
+
function _arrayLikeToArray(r, a) {
|
|
65
|
+
(null == a || a > r.length) && (a = r.length);
|
|
66
|
+
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
67
|
+
return n;
|
|
68
|
+
}
|
|
69
|
+
function _defineProperties(e, r) {
|
|
70
|
+
for (var t = 0; t < r.length; t++) {
|
|
71
|
+
var o = r[t];
|
|
72
|
+
(o.enumerable = o.enumerable || !1),
|
|
73
|
+
(o.configurable = !0),
|
|
74
|
+
"value" in o && (o.writable = !0),
|
|
75
|
+
Object.defineProperty(e, _toPropertyKey(o.key), o);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
function _createClass(e, r, t) {
|
|
79
|
+
return (
|
|
80
|
+
r && _defineProperties(e.prototype, r),
|
|
81
|
+
t && _defineProperties(e, t),
|
|
82
|
+
Object.defineProperty(e, "prototype", { writable: !1 }),
|
|
83
|
+
e
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
function _classCallCheck(a, n) {
|
|
87
|
+
if (!(a instanceof n))
|
|
88
|
+
throw new TypeError("Cannot call a class as a function");
|
|
89
|
+
}
|
|
90
|
+
function _defineProperty(e, r, t) {
|
|
91
|
+
return (
|
|
92
|
+
(r = _toPropertyKey(r)) in e
|
|
93
|
+
? Object.defineProperty(e, r, {
|
|
94
|
+
value: t,
|
|
95
|
+
enumerable: !0,
|
|
96
|
+
configurable: !0,
|
|
97
|
+
writable: !0,
|
|
98
|
+
})
|
|
99
|
+
: (e[r] = t),
|
|
100
|
+
e
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
function _toPropertyKey(t) {
|
|
104
|
+
var i = _toPrimitive(t, "string");
|
|
105
|
+
return "symbol" == _typeof(i) ? i : i + "";
|
|
106
|
+
}
|
|
107
|
+
function _toPrimitive(t, r) {
|
|
108
|
+
if ("object" != _typeof(t) || !t) return t;
|
|
109
|
+
var e = t[Symbol.toPrimitive];
|
|
110
|
+
if (void 0 !== e) {
|
|
111
|
+
var i = e.call(t, r || "default");
|
|
112
|
+
if ("object" != _typeof(i)) return i;
|
|
113
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
114
|
+
}
|
|
115
|
+
return ("string" === r ? String : Number)(t);
|
|
116
|
+
}
|
|
20
117
|
var num_pattern = /^[+-]?\d+(\.\d+)?$/;
|
|
21
118
|
// let str_pattern = /^["'][^"']*["']$/;
|
|
22
119
|
var var_pattern = /^[a-zA-Z_][a-zA-Z0-9_]*$/;
|
|
23
|
-
var Loader = /*#__PURE__*/_createClass(function Loader(account) {
|
|
120
|
+
var Loader = /*#__PURE__*/ _createClass(function Loader(account) {
|
|
24
121
|
var _this = this;
|
|
25
122
|
_classCallCheck(this, Loader);
|
|
26
123
|
_defineProperty(this, "instruction_index", function () {
|
|
@@ -30,18 +127,20 @@ var Loader = /*#__PURE__*/_createClass(function Loader(account) {
|
|
|
30
127
|
return index;
|
|
31
128
|
});
|
|
32
129
|
_defineProperty(this, "stack_instruction", function (instruction) {
|
|
33
|
-
if (Array.isArray(instruction))
|
|
34
|
-
return
|
|
35
|
-
|
|
130
|
+
if (Array.isArray(instruction))
|
|
131
|
+
return instruction.map(function (i) {
|
|
132
|
+
return _this.stack_instruction(i);
|
|
133
|
+
});
|
|
36
134
|
_this.instruction_stacks.slice(-1)[0].push(instruction);
|
|
37
135
|
});
|
|
38
136
|
_defineProperty(this, "new_stack", function (addr) {
|
|
39
137
|
_this.stacks.push(addr);
|
|
40
138
|
});
|
|
41
139
|
_defineProperty(this, "push_instruction", function (instruction) {
|
|
42
|
-
if (Array.isArray(instruction))
|
|
43
|
-
return
|
|
44
|
-
|
|
140
|
+
if (Array.isArray(instruction))
|
|
141
|
+
return instruction.map(function (i) {
|
|
142
|
+
return _this.push_instruction(i);
|
|
143
|
+
});
|
|
45
144
|
if (_this.pure) {
|
|
46
145
|
_this.instructions.push(instruction);
|
|
47
146
|
} else {
|
|
@@ -58,16 +157,17 @@ var Loader = /*#__PURE__*/_createClass(function Loader(account) {
|
|
|
58
157
|
value: value,
|
|
59
158
|
type: type,
|
|
60
159
|
line: line_number,
|
|
61
|
-
pos: pos
|
|
160
|
+
pos: pos,
|
|
62
161
|
});
|
|
63
162
|
};
|
|
64
163
|
line = line.trim();
|
|
65
164
|
while (pos < line.length) {
|
|
66
165
|
var _char = line[pos].trim();
|
|
67
|
-
if (_char === stop_char)
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
166
|
+
if (_char === stop_char)
|
|
167
|
+
return {
|
|
168
|
+
tokens: tokens,
|
|
169
|
+
pos: pos,
|
|
170
|
+
};
|
|
71
171
|
if (!_char) {
|
|
72
172
|
pos++;
|
|
73
173
|
continue;
|
|
@@ -112,7 +212,10 @@ var Loader = /*#__PURE__*/_createClass(function Loader(account) {
|
|
|
112
212
|
} else if (num_pattern.test(_char)) {
|
|
113
213
|
var _acc2 = _char;
|
|
114
214
|
pos++;
|
|
115
|
-
while (
|
|
215
|
+
while (
|
|
216
|
+
num_pattern.test(line[pos]) ||
|
|
217
|
+
(line[pos] === "." && !_acc2.includes(line[pos]))
|
|
218
|
+
) {
|
|
116
219
|
if (!line[pos]) break;
|
|
117
220
|
_acc2 += line[pos];
|
|
118
221
|
pos++;
|
|
@@ -125,42 +228,83 @@ var Loader = /*#__PURE__*/_createClass(function Loader(account) {
|
|
|
125
228
|
_acc3 += line[pos];
|
|
126
229
|
pos++;
|
|
127
230
|
}
|
|
128
|
-
push_token(
|
|
231
|
+
push_token(
|
|
232
|
+
_acc3,
|
|
233
|
+
_this.opcodes.includes(_acc3) ? "opcode" : "variable"
|
|
234
|
+
);
|
|
129
235
|
}
|
|
130
236
|
}
|
|
131
237
|
return tokens;
|
|
132
238
|
});
|
|
133
239
|
_defineProperty(this, "parse", function (token) {
|
|
134
240
|
if (token.type === "string" || token.type === "number") {
|
|
135
|
-
_this.push_instruction([
|
|
241
|
+
_this.push_instruction([
|
|
242
|
+
"link ".concat(
|
|
243
|
+
_this.account.physical_address,
|
|
244
|
+
"/Datatypes/",
|
|
245
|
+
"".concat(token.type[0].toUpperCase()).concat(token.type.slice(1))
|
|
246
|
+
),
|
|
247
|
+
"write ".concat(token.value),
|
|
248
|
+
"pop ".concat(token.type),
|
|
249
|
+
]);
|
|
136
250
|
} else if (token.type === "array") {
|
|
137
|
-
_this.push_instruction(
|
|
251
|
+
_this.push_instruction(
|
|
252
|
+
"link Accounts/".concat(_this.account.name, "/Datatypes/Array")
|
|
253
|
+
);
|
|
138
254
|
token.value.map(function (item, i) {
|
|
139
255
|
_this.parse(item);
|
|
140
|
-
_this.push_instruction([
|
|
256
|
+
_this.push_instruction([
|
|
257
|
+
"cursor ".concat(i),
|
|
258
|
+
"write ".concat(
|
|
259
|
+
_this.is_not_literal(item.type)
|
|
260
|
+
? "{metadata.output:-1}"
|
|
261
|
+
: "{datapath:-1}"
|
|
262
|
+
),
|
|
263
|
+
]);
|
|
141
264
|
});
|
|
142
265
|
_this.push_instruction("pop Array");
|
|
143
266
|
} else if (token.type === "twain") {
|
|
144
|
-
_this.push_instruction(
|
|
267
|
+
_this.push_instruction(
|
|
268
|
+
"link Accounts/".concat(_this.account.name, "/Datatypes/Twain")
|
|
269
|
+
);
|
|
145
270
|
var curs = true;
|
|
146
|
-
if (token.value)
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
_this.parse(entry);
|
|
152
|
-
if (curs) {
|
|
153
|
-
{
|
|
154
|
-
_this.push_instruction("cursor {*".concat(_this.is_not_literal(entry.type) ? "metadata.output:-1" : "datapath:-1", "}"));
|
|
271
|
+
if (token.value)
|
|
272
|
+
token.value.map(function (entry) {
|
|
273
|
+
if (entry.type === "separator") {
|
|
274
|
+
curs = false;
|
|
275
|
+
return;
|
|
155
276
|
}
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
277
|
+
_this.parse(entry);
|
|
278
|
+
if (curs) {
|
|
279
|
+
{
|
|
280
|
+
_this.push_instruction(
|
|
281
|
+
"cursor {*".concat(
|
|
282
|
+
_this.is_not_literal(entry.type)
|
|
283
|
+
? "metadata.output:-1"
|
|
284
|
+
: "datapath:-1",
|
|
285
|
+
"}"
|
|
286
|
+
)
|
|
287
|
+
);
|
|
288
|
+
}
|
|
289
|
+
} else {
|
|
290
|
+
_this.push_instruction(
|
|
291
|
+
"write ".concat(
|
|
292
|
+
_this.is_not_literal(entry.type)
|
|
293
|
+
? "{metadata.output:-1}"
|
|
294
|
+
: "{datapath:-1}"
|
|
295
|
+
)
|
|
296
|
+
);
|
|
297
|
+
curs = true;
|
|
298
|
+
}
|
|
299
|
+
});
|
|
161
300
|
_this.push_instruction("pop Twain");
|
|
162
301
|
} else if (token.type === "variable") {
|
|
163
|
-
_this.push_instruction([
|
|
302
|
+
_this.push_instruction([
|
|
303
|
+
"link ".concat(
|
|
304
|
+
"".concat(_this.stacks.slice(-1)[0], "/").concat(token.value)
|
|
305
|
+
),
|
|
306
|
+
"pop ".concat(token.value),
|
|
307
|
+
]);
|
|
164
308
|
} else if (token.type === "address") _this.parse_assignment(token);
|
|
165
309
|
});
|
|
166
310
|
_defineProperty(this, "is_not_literal", function (type) {
|
|
@@ -170,15 +314,26 @@ var Loader = /*#__PURE__*/_createClass(function Loader(account) {
|
|
|
170
314
|
var tokens = linked || line.type ? line : _this.parse_tokens(line);
|
|
171
315
|
var identifier = tokens[0];
|
|
172
316
|
if (linked || line.type) {
|
|
173
|
-
var line_split = (line.value || line)
|
|
317
|
+
var line_split = (line.value || line)
|
|
318
|
+
.slice(line.value ? null : 1)
|
|
319
|
+
.trim()
|
|
320
|
+
.split(" ");
|
|
174
321
|
var path = line_split[0].split("/");
|
|
175
|
-
_this.push_instruction(
|
|
322
|
+
_this.push_instruction(
|
|
323
|
+
"link ".concat(_this.resolve_addr(path.join("/")))
|
|
324
|
+
);
|
|
176
325
|
tokens = !line.type && _this.parse_tokens(line_split.slice(1).join(" "));
|
|
177
326
|
tokens.unshift && tokens.unshift(null);
|
|
178
|
-
if (line.type === "address")
|
|
327
|
+
if (line.type === "address")
|
|
328
|
+
return _this.push_instruction("pop ".concat(path[path.length - 1]));
|
|
179
329
|
} else {
|
|
180
330
|
_this.push_instruction("chain ".concat(identifier.value));
|
|
181
|
-
_this.stack_instruction([
|
|
331
|
+
_this.stack_instruction([
|
|
332
|
+
"link ".concat(_this.stacks.slice(-1)[0]),
|
|
333
|
+
"chain ".concat(identifier.value),
|
|
334
|
+
"pop ".concat(identifier.value),
|
|
335
|
+
"pop",
|
|
336
|
+
]);
|
|
182
337
|
}
|
|
183
338
|
var prev_token;
|
|
184
339
|
if (tokens[1] && tokens[1].type === "opcode") {
|
|
@@ -191,19 +346,45 @@ var Loader = /*#__PURE__*/_createClass(function Loader(account) {
|
|
|
191
346
|
prev_token = tokens.slice(-1)[0];
|
|
192
347
|
}
|
|
193
348
|
if (tokens.length > 1) {
|
|
194
|
-
_this.push_instruction([
|
|
349
|
+
_this.push_instruction([
|
|
350
|
+
"cursor {output}",
|
|
351
|
+
"write ".concat(
|
|
352
|
+
_this.is_not_literal(prev_token && prev_token.type)
|
|
353
|
+
? "{metadata.output:-1}"
|
|
354
|
+
: "{datapath:-1}"
|
|
355
|
+
),
|
|
356
|
+
"pop ".concat(identifier.value),
|
|
357
|
+
]);
|
|
195
358
|
} else _this.push_instruction("pop ".concat(identifier.value));
|
|
196
359
|
});
|
|
197
360
|
_defineProperty(this, "parse_opcode", function (line) {
|
|
198
361
|
var tokens = Array.isArray(line) ? line : _this.parse_tokens(line);
|
|
199
362
|
var op = tokens[0];
|
|
200
363
|
if (op.type !== "opcode") return _this.parse(op);
|
|
201
|
-
_this.push_instruction([
|
|
364
|
+
_this.push_instruction([
|
|
365
|
+
"link Accounts/".concat(_this.account.name, "/Opcodes/").concat(op.value),
|
|
366
|
+
"link Accounts/".concat(_this.account.name, "/Datatypes/Twain"),
|
|
367
|
+
]);
|
|
202
368
|
tokens.slice(1).map(function (tok, i) {
|
|
203
369
|
_this.parse(tok);
|
|
204
|
-
_this.push_instruction([
|
|
370
|
+
_this.push_instruction([
|
|
371
|
+
"cursor op".concat(i),
|
|
372
|
+
"write ".concat(
|
|
373
|
+
_this.is_not_literal(tok.type)
|
|
374
|
+
? "{metadata.output:-1}"
|
|
375
|
+
: "{datapath:-1}"
|
|
376
|
+
),
|
|
377
|
+
]);
|
|
205
378
|
});
|
|
206
|
-
_this.push_instruction([
|
|
379
|
+
_this.push_instruction([
|
|
380
|
+
"pop Twain",
|
|
381
|
+
"cursor inputs",
|
|
382
|
+
"write {datapath:-1}",
|
|
383
|
+
op.value,
|
|
384
|
+
"cursor {output}",
|
|
385
|
+
"write {datapath:-1}",
|
|
386
|
+
"pop ".concat(op.value),
|
|
387
|
+
]);
|
|
207
388
|
});
|
|
208
389
|
_defineProperty(this, "resolve_addr", function (addr) {
|
|
209
390
|
addr = addr.split("/");
|
|
@@ -224,11 +405,15 @@ var Loader = /*#__PURE__*/_createClass(function Loader(account) {
|
|
|
224
405
|
_defineProperty(this, "new_stack_instructions", function (new_stack) {
|
|
225
406
|
var curr_stack = _this.stacks.slice(-1)[0].split("/");
|
|
226
407
|
new_stack = new_stack.split("/");
|
|
227
|
-
if (curr_stack[1] !== new_stack[1]) {
|
|
408
|
+
if (curr_stack[1] !== new_stack[1]) {
|
|
409
|
+
} else {
|
|
228
410
|
var i = 0;
|
|
229
411
|
while (curr_stack[i] === new_stack[i]) i++;
|
|
230
|
-
for (var j = 2; j < new_stack.length; j++)
|
|
231
|
-
|
|
412
|
+
for (var j = 2; j < new_stack.length; j++)
|
|
413
|
+
_this.stack_instruction("chain ".concat(new_stack[j]));
|
|
414
|
+
_this.stack_instruction(
|
|
415
|
+
"link ".concat(_this.account.physical_address, "/Datatypes/Array")
|
|
416
|
+
);
|
|
232
417
|
}
|
|
233
418
|
});
|
|
234
419
|
_defineProperty(this, "parse_routine", function (line) {
|
|
@@ -241,9 +426,17 @@ var Loader = /*#__PURE__*/_createClass(function Loader(account) {
|
|
|
241
426
|
_defineProperty(this, "pop", function () {
|
|
242
427
|
var _this$instructions;
|
|
243
428
|
var addr = _this.stacks.splice(-1)[0].split("/");
|
|
244
|
-
_this.stack_instruction([
|
|
245
|
-
|
|
246
|
-
|
|
429
|
+
_this.stack_instruction([
|
|
430
|
+
"pop Array",
|
|
431
|
+
"cursor {program}",
|
|
432
|
+
"write {datapath:-1}",
|
|
433
|
+
]);
|
|
434
|
+
for (var j = 2; j < addr.length; j++)
|
|
435
|
+
_this.stack_instruction("pop ".concat(addr[j]));
|
|
436
|
+
(_this$instructions = _this.instructions).push.apply(
|
|
437
|
+
_this$instructions,
|
|
438
|
+
_toConsumableArray(_this.instruction_stacks.splice(-1)[0])
|
|
439
|
+
);
|
|
247
440
|
_this.instruction_indexes.pop();
|
|
248
441
|
});
|
|
249
442
|
_defineProperty(this, "compile", function (codes) {
|
|
@@ -251,23 +444,35 @@ var Loader = /*#__PURE__*/_createClass(function Loader(account) {
|
|
|
251
444
|
for (var c = 0; c < code_array.length; c++) {
|
|
252
445
|
var line = code_array[c].trim();
|
|
253
446
|
if (!line) continue;
|
|
254
|
-
if (line === ";") _this.pop();
|
|
447
|
+
if (line === ";") _this.pop();
|
|
448
|
+
else if (line.startsWith("link ")) _this.parse_routine(line);
|
|
449
|
+
else if (line.startsWith(".") || line.startsWith("@"))
|
|
450
|
+
_this.parse_routine(line);
|
|
451
|
+
else if (line.startsWith("//")) continue;
|
|
452
|
+
else if (line.startsWith(">@")) _this.parse_assignment(line, true);
|
|
453
|
+
else if (line.startsWith(">")) _this.parse_assignment(line);
|
|
454
|
+
else _this.parse_opcode(line);
|
|
255
455
|
}
|
|
256
456
|
});
|
|
257
|
-
_defineProperty(this, "run", function (codes,
|
|
258
|
-
if (
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
457
|
+
_defineProperty(this, "run", function (codes, meta) {
|
|
458
|
+
if (!meta)
|
|
459
|
+
meta = {
|
|
460
|
+
cb: null,
|
|
461
|
+
pure: false,
|
|
462
|
+
};
|
|
463
|
+
var _meta = meta,
|
|
464
|
+
pure = _meta.pure,
|
|
465
|
+
cb = _meta.cb;
|
|
466
|
+
_this.pure = pure;
|
|
262
467
|
_this.compile(codes);
|
|
263
468
|
|
|
264
469
|
// console.log(JSON.stringify(this.instructions, null, 2), "hiya");
|
|
265
470
|
|
|
266
471
|
_this.account.load({
|
|
267
472
|
program: {
|
|
268
|
-
instructions: _toConsumableArray(_this.instructions)
|
|
473
|
+
instructions: _toConsumableArray(_this.instructions),
|
|
269
474
|
},
|
|
270
|
-
callback: cb
|
|
475
|
+
callback: cb,
|
|
271
476
|
});
|
|
272
477
|
_this.instructions = [];
|
|
273
478
|
_this.pure = false;
|
|
@@ -280,4 +485,4 @@ var Loader = /*#__PURE__*/_createClass(function Loader(account) {
|
|
|
280
485
|
this.stacks = new Array(account.physical_address);
|
|
281
486
|
});
|
|
282
487
|
var _default = Loader;
|
|
283
|
-
exports["default"] = _default;
|
|
488
|
+
exports["default"] = _default;
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "godprotocol",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.793",
|
|
4
4
|
"description": "A data mediator.",
|
|
5
5
|
"main": "Index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
9
9
|
"start": "nodemon -r esm Index.js",
|
|
10
|
-
"prepack": "npmignore"
|
|
10
|
+
"prepack": "npmignore --auto"
|
|
11
11
|
},
|
|
12
12
|
"author": "Savvy",
|
|
13
13
|
"license": "ISC",
|
package/readme.md
CHANGED
|
@@ -14,8 +14,8 @@ God Protocol makes data sharing and processing easy for apps. With simple APIs,
|
|
|
14
14
|
|
|
15
15
|
### Endpoints
|
|
16
16
|
|
|
17
|
-
- [**/create_account:**](#create_account) Create a
|
|
18
|
-
- [**/load:**](#load) Load
|
|
17
|
+
- [**/create_account:**](#create_account) Create a machine account.
|
|
18
|
+
- [**/load:**](#load) Load instruction sequence to the server.
|
|
19
19
|
- [**/run:**](#run) Execute the instruction sequence.
|
|
20
20
|
- [**/parse:**](#parse) Retrieve and process results from the server.
|
|
21
21
|
|
|
@@ -64,16 +64,16 @@ account.load({
|
|
|
64
64
|
});
|
|
65
65
|
```
|
|
66
66
|
|
|
67
|
-
| **Paramters** | **Possible Values**
|
|
68
|
-
| ---------------------- |
|
|
69
|
-
| `program` | `{ instructions: [], account: "" }`
|
|
70
|
-
| `program.instructions` | Array of
|
|
71
|
-
| `program.account` | Any string
|
|
72
|
-
| `signature` | String
|
|
73
|
-
| `callback` | Function or `account.run{}`
|
|
67
|
+
| **Paramters** | **Possible Values** | **Default Value** | **Type** | **Description** |
|
|
68
|
+
| ---------------------- | ------------------------------------------------------------------------------------------ | ----------------- | ---------------------- | ----------------------------------------------------------------- |
|
|
69
|
+
| `program` | `{ instructions: [], account: "" }` | None | object | Object containing program instructions and associated account. |
|
|
70
|
+
| `program.instructions` | Array of [`instructions`](https://godprotocol-web.vercel.app/loader_sequence#instructions) | [] | array | Array of program instructions. |
|
|
71
|
+
| `program.account` | Any string | `"initiator"` | string | Associated account for program execution. |
|
|
72
|
+
| `signature` | String | None | string | Optional. Signature for private account access. |
|
|
73
|
+
| `callback` | Function or `account.run{}` | None | `function` or `object` | Optional. Function to call upon completion of the load operation. |
|
|
74
74
|
|
|
75
|
-
Description
|
|
76
|
-
The /load endpoint loads a program with instructions (program.instructions) and links it to an account (program.account). For private accounts, include a signature of the `program` for access. Optionally, provide a callback function to handle completion events, which may
|
|
75
|
+
**Description:**
|
|
76
|
+
The /load endpoint loads a program with instructions (`program.instructions`) and links it to an account (`program.account`). For private accounts, include a `signature` of the `program` for access. Optionally, provide a `callback` function to handle completion events, which may be additional execution payload (`account.run`).
|
|
77
77
|
|
|
78
78
|
## `/run`
|
|
79
79
|
|
|
@@ -106,6 +106,7 @@ account.run({
|
|
|
106
106
|
|
|
107
107
|
**Description:**
|
|
108
108
|
The /run endpoint in the God Protocol framework allows users to execute a program with a specified payload, which includes the physical address (`payload.physical_address`), associated account (`payload.account`), and query (`payload.query`). If the account is private, a payload `signature` is required. An optional `callback` function can be provided to handle completion events, which may include further execution instructions (`account.run`).
|
|
109
|
+
If (`query`) is missing, then the most recent block's program in the chain is executed.
|
|
109
110
|
|
|
110
111
|
## /parse Endpoint
|
|
111
112
|
|