godprotocol 1.0.840 → 1.0.842

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.
@@ -229,7 +229,9 @@ class Loader {
229
229
  if (line.type === "address")
230
230
  return this.push_instruction(`pop ${path[path.length - 1]}`);
231
231
  } else {
232
- this.current_program().dimensions.push({ name: identifier.value });
232
+ let curr_program = this.current_program();
233
+ curr_program && curr_program.dimensions.push({ name: identifier.value });
234
+
233
235
  this.push_instruction(`chain ${identifier.value}`);
234
236
  this.stack_instruction([
235
237
  `link ${this.stacks.slice(-1)[0]}`,
@@ -542,7 +544,8 @@ class Loader {
542
544
  callback: cb,
543
545
  });
544
546
 
545
- this.program_configs[0].main = this.repository.oracle.hash(codes);
547
+ let pragma = this.program_configs[0];
548
+ if (pragma) pragma.main = this.repository.oracle.hash(codes);
546
549
  console.log(this.program_configs);
547
550
  this.program_configs.map((config) => this.repository.add_program(config));
548
551
 
@@ -18,11 +18,25 @@ class Explorer {
18
18
 
19
19
  let obj;
20
20
  if (isNaN(q2)) {
21
- obj = this[prop || "connections"].find((c) => c.hash === query[1]);
21
+ let arr = this[prop || "connections"];
22
+ for (let b = 0; b < arr.length; b++) {
23
+ let blk = this.build_block(arr[b]);
24
+ if (blk.hash === query[1]) {
25
+ obj = blk;
26
+ break;
27
+ }
28
+ }
22
29
  } else if (q2 >= 0) {
23
- obj = this[prop || "connections"].find((q) => q.index === q2);
30
+ let arr = this[prop || "connections"];
31
+ for (let b = 0; b < arr.length; b++) {
32
+ let blk = this.build_block(arr[b]);
33
+ if (blk.index === q2) {
34
+ obj = blk;
35
+ break;
36
+ }
37
+ }
24
38
  } else {
25
- obj = this[prop || "connections"].slice(q2)[0];
39
+ obj = this.build_block(this[prop || "connections"].slice(q2)[0]);
26
40
  }
27
41
 
28
42
  if (!prop)
@@ -2,6 +2,7 @@ import { hash } from "../utils/hash";
2
2
 
3
3
  class Filesystem {
4
4
  constructor() {
5
+ this.root = process.env.ROOT || __dirname;
5
6
  this.base_address = process.env.BASE_ADDRESS || "Accounts";
6
7
  }
7
8
 
@@ -116,8 +117,8 @@ class Filesystem {
116
117
 
117
118
  let fs = this.manager.oracle.fs;
118
119
 
119
- if (!fs.existsSync(chain.path)) {
120
- fs.mkdirSync(chain.path, { recursive: true });
120
+ if (!fs.existsSync(`${this.root}/${chain.path}`)) {
121
+ fs.mkdirSync(`${this.root}/${chain.path}`, { recursive: true });
121
122
  }
122
123
  };
123
124
 
package/Objects/Oracle.js CHANGED
@@ -36,9 +36,9 @@ class Oracle {
36
36
 
37
37
  if (!obj) {
38
38
  try {
39
- obj = this.fs.readFileSync(path);
40
- obj = JSON.parse(obj).data;
41
- let type = obj && obj.data && typeof obj.data;
39
+ obj = this.fs.readFileSync(`${this.mgr.initiator.root}/${path}`);
40
+ obj = JSON.parse(obj).payload;
41
+ let type = obj && obj.payload && typeof obj.payload;
42
42
  type =
43
43
  type === "object" ? (Array.isArray(obj) ? "array" : "twain") : type;
44
44
 
@@ -73,7 +73,9 @@ class Oracle {
73
73
  data: payload,
74
74
  });
75
75
 
76
- this.fs.writeFileSync(address, data, { encoding: "utf-8" });
76
+ this.fs.writeFileSync(`${this.mgr.initiator.root}/${address}`, data, {
77
+ encoding: "utf-8",
78
+ });
77
79
  };
78
80
 
79
81
  fetch = async (payload, callback) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "godprotocol",
3
- "version": "1.0.840",
3
+ "version": "1.0.842",
4
4
  "description": "A data mediator.",
5
5
  "main": "Index.js",
6
6
  "types": "types/index.d.ts",
@@ -46,7 +46,7 @@
46
46
  "crypto": "^1.0.1",
47
47
  "elliptic": "^6.5.5",
48
48
  "fs": "^0.0.1-security",
49
- "generalised-datastore": "^2.0.112"
49
+ "generalised-datastore": "^2.0.13"
50
50
  },
51
51
  "publishConfig": {
52
52
  "ignore": [