godprotocol 1.0.79 → 1.0.82
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/Index.js +8 -14
- package/Loader_sequence/main.js +384 -206
- package/Objects/Account.js +191 -157
- package/Objects/Block.js +60 -58
- package/Objects/Blockweb.js +27 -34
- package/Objects/Chain.js +115 -118
- package/Objects/Explorer.js +30 -37
- package/Objects/Filesystem.js +95 -80
- package/Objects/Frame.js +43 -48
- package/Objects/Manager.js +67 -89
- package/Objects/Opcodes.js +43 -36
- package/Objects/Oracle.js +63 -40
- package/Objects/Virtual_machine.js +135 -127
- package/build/Account.js +187 -0
- package/build/Block.js +68 -0
- package/build/Blockweb.js +36 -0
- package/build/Chain.js +119 -0
- package/build/Explorer.js +47 -0
- package/build/Filesystem.js +127 -0
- package/build/Frame.js +52 -0
- package/build/Index.js +20 -0
- package/build/Manager.js +86 -0
- package/build/Opcodes.js +109 -0
- package/build/Oracle.js +81 -0
- package/build/Virtual_machine.js +136 -0
- package/build/add.js +26 -0
- package/build/create_server.js +132 -0
- package/build/framer.js +59 -0
- package/build/functions.js +82 -0
- package/build/hash.js +14 -0
- package/build/indices.js +31 -0
- package/build/jmp.js +19 -0
- package/build/main.js +327 -0
- package/build/opcodes.js +60 -0
- package/build/privacy.js +27 -0
- package/build/services.js +50 -0
- package/build/std.js +15 -0
- package/framer.js +58 -54
- package/opcodes/add.js +9 -40
- package/opcodes/indices.js +28 -0
- package/opcodes/jmp.js +12 -17
- package/opcodes/std.js +7 -9
- package/opcodes.js +36 -28
- package/package.json +4 -3
- package/tsconfig.json +8 -0
- package/types/Account.d.ts +73 -0
- package/types/Block.d.ts +22 -0
- package/types/Blockweb.d.ts +14 -0
- package/types/Chain.d.ts +35 -0
- package/types/Explorer.d.ts +9 -0
- package/types/Filesystem.d.ts +23 -0
- package/types/Frame.d.ts +14 -0
- package/types/Manager.d.ts +21 -0
- package/types/Opcodes.d.ts +11 -0
- package/types/Oracle.d.ts +17 -0
- package/types/Virtual_machine.d.ts +20 -0
- package/types/index.d.ts +4 -0
- package/utils/create_server.js +88 -108
- package/utils/functions.js +31 -43
- package/utils/hash.js +10 -11
- package/utils/privacy.js +10 -15
- package/utils/services.js +32 -33
package/build/std.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.stdout = void 0;
|
|
7
|
+
var stdout = function stdout(args, vm) {
|
|
8
|
+
if (!args) return;
|
|
9
|
+
vm.account.stdout.push({
|
|
10
|
+
data: args,
|
|
11
|
+
pid: vm.track.pid
|
|
12
|
+
});
|
|
13
|
+
for (var v in args) console.log(args[v]);
|
|
14
|
+
};
|
|
15
|
+
exports.stdout = stdout;
|
package/framer.js
CHANGED
|
@@ -1,57 +1,61 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
1
|
+
import Frame from "./Objects/Frame";
|
|
2
|
+
|
|
3
|
+
let obj = {
|
|
4
|
+
Opcodes: {
|
|
5
|
+
add: null,
|
|
6
|
+
equal: null,
|
|
7
|
+
multiply: null,
|
|
8
|
+
subtract: null,
|
|
9
|
+
divide: null,
|
|
10
|
+
exp: null,
|
|
11
|
+
equal: null,
|
|
12
|
+
|
|
13
|
+
send: null,
|
|
14
|
+
readonly: null,
|
|
15
|
+
socket_send: null,
|
|
16
|
+
|
|
17
|
+
jmp: null,
|
|
18
|
+
|
|
19
|
+
stdout: null,
|
|
20
|
+
stdin: null,
|
|
21
|
+
|
|
22
|
+
run: null,
|
|
23
|
+
load: null,
|
|
24
|
+
parse: null,
|
|
25
|
+
create_account: null,
|
|
26
|
+
},
|
|
27
|
+
Datatypes: {
|
|
28
|
+
Number: null,
|
|
29
|
+
String: null,
|
|
30
|
+
Twain: null,
|
|
31
|
+
Array: null,
|
|
32
|
+
},
|
|
33
|
+
Objects: {
|
|
34
|
+
Blockchain: {
|
|
35
|
+
Chain: null,
|
|
36
|
+
Block: null,
|
|
37
|
+
},
|
|
38
|
+
Folder: {
|
|
39
|
+
active_file: null,
|
|
40
|
+
folder: null,
|
|
41
|
+
file: null,
|
|
29
42
|
},
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
row: null,
|
|
42
|
-
parse: null,
|
|
43
|
-
column: null,
|
|
44
|
-
write: null
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
});
|
|
43
|
+
File: {
|
|
44
|
+
row: null,
|
|
45
|
+
parse: null,
|
|
46
|
+
column: null,
|
|
47
|
+
write: null,
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const framer = (initiator) => {
|
|
53
|
+
let frame = new Frame(obj);
|
|
48
54
|
frame.to_instruction();
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
instructions: instructions
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
+
let instructions = frame.flatten_instructions();
|
|
56
|
+
|
|
57
|
+
initiator.load({ program: { instructions } });
|
|
55
58
|
};
|
|
56
|
-
|
|
57
|
-
|
|
59
|
+
|
|
60
|
+
export default framer;
|
|
61
|
+
export { obj };
|
package/opcodes/add.js
CHANGED
|
@@ -1,41 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
let ops = [
|
|
2
|
+
{ name: "add", sign: "+" },
|
|
3
|
+
{ name: "multiply", sign: "*" },
|
|
4
|
+
{ name: "subtract", sign: "-" },
|
|
5
|
+
{ name: "divide", sign: "/" },
|
|
6
|
+
{ name: "exp", sign: "**" },
|
|
7
|
+
{ name: "equal", sign: "==" },
|
|
8
|
+
];
|
|
2
9
|
|
|
3
|
-
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.ops = void 0;
|
|
7
|
-
var ops = [{
|
|
8
|
-
name: "add",
|
|
9
|
-
sign: "+"
|
|
10
|
-
}, {
|
|
11
|
-
name: "multiply",
|
|
12
|
-
sign: "*"
|
|
13
|
-
}, {
|
|
14
|
-
name: "subtract",
|
|
15
|
-
sign: "-"
|
|
16
|
-
}, {
|
|
17
|
-
name: "divide",
|
|
18
|
-
sign: "/"
|
|
19
|
-
}, {
|
|
20
|
-
name: "exp",
|
|
21
|
-
sign: "**"
|
|
22
|
-
}, {
|
|
23
|
-
name: "equal",
|
|
24
|
-
sign: "=="
|
|
25
|
-
}, {
|
|
26
|
-
name: "not_equal",
|
|
27
|
-
sign: "!="
|
|
28
|
-
}, {
|
|
29
|
-
name: "greater_than",
|
|
30
|
-
sign: ">"
|
|
31
|
-
}, {
|
|
32
|
-
name: "less_than",
|
|
33
|
-
sign: "<"
|
|
34
|
-
}, {
|
|
35
|
-
name: "gte",
|
|
36
|
-
sign: ">="
|
|
37
|
-
}, {
|
|
38
|
-
name: "lte",
|
|
39
|
-
sign: "<="
|
|
40
|
-
}];
|
|
41
|
-
exports.ops = ops;
|
|
10
|
+
export { ops };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
const getter = (args) => {
|
|
2
|
+
let base = args.op0;
|
|
3
|
+
if (typeof base === "number") return base;
|
|
4
|
+
|
|
5
|
+
if (typeof base === "string") return base[args.op1];
|
|
6
|
+
|
|
7
|
+
if (Array.isArray(base)) return base.slice(args.op1)[0];
|
|
8
|
+
|
|
9
|
+
return base[args.op1];
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const setter = (args) => {
|
|
13
|
+
let base = args.op0;
|
|
14
|
+
if (typeof base === "number") return base;
|
|
15
|
+
|
|
16
|
+
if (typeof base === "string") {
|
|
17
|
+
base = `${base.slice(0, args.op2)}${args.op1}${base.slice(args.op2 + 1)}`;
|
|
18
|
+
} else {
|
|
19
|
+
if (Array.isArray(base)) {
|
|
20
|
+
if (args.op2 == null || args.op2 >= base.length) base.push(args.op1);
|
|
21
|
+
else base[args.op2] = args.op1;
|
|
22
|
+
} else base[args.op2] = args.op1;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return base;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export { setter, getter };
|
package/opcodes/jmp.js
CHANGED
|
@@ -1,19 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
const jmp = (args, vm, meta) => {
|
|
2
|
+
meta = meta || {};
|
|
3
|
+
let { flag, inverse } = meta;
|
|
2
4
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
exports.jmp = jmp;
|
|
11
|
-
var jmp_if = function jmp_if(args, vm) {
|
|
12
|
-
if (args.passed) vm.account.manager.tracker[vm.mgr_index].pointer += args.index;
|
|
13
|
-
};
|
|
14
|
-
exports.jmp_if = jmp_if;
|
|
15
|
-
var hold = function hold(args, vm) {
|
|
16
|
-
var track = vm.account.manager.tracker[vm.mgr_index];
|
|
17
|
-
track.hold = args.hold;
|
|
5
|
+
let condition;
|
|
6
|
+
if (flag) condition = vm.flags[flag];
|
|
7
|
+
if (inverse) condition = !!!condition;
|
|
8
|
+
|
|
9
|
+
if ((condition || !flag) && typeof args.op0 === "number") {
|
|
10
|
+
vm.track.pointer = args.op0;
|
|
11
|
+
}
|
|
18
12
|
};
|
|
19
|
-
|
|
13
|
+
|
|
14
|
+
export { jmp };
|
package/opcodes/std.js
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.stdout = void 0;
|
|
7
|
-
var stdout = function stdout(args) {
|
|
1
|
+
const stdout = (args, vm) => {
|
|
8
2
|
if (!args) return;
|
|
9
|
-
|
|
3
|
+
|
|
4
|
+
vm.account.stdout.push({ data: args, pid: vm.track.pid });
|
|
5
|
+
|
|
6
|
+
for (let v in args) console.log(args[v]);
|
|
10
7
|
};
|
|
11
|
-
|
|
8
|
+
|
|
9
|
+
export { stdout };
|
package/opcodes.js
CHANGED
|
@@ -1,42 +1,50 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports["default"] = void 0;
|
|
7
|
-
var _add = require("./opcodes/add");
|
|
8
|
-
var _jmp = require("./opcodes/jmp");
|
|
9
|
-
var _std = require("./opcodes/std");
|
|
10
|
-
var _services = require("./utils/services");
|
|
11
1
|
// import { socket_send } from "./Socket";
|
|
2
|
+
import { ops } from "./opcodes/add";
|
|
3
|
+
import { getter, setter } from "./opcodes/indices";
|
|
4
|
+
import { jmp } from "./opcodes/jmp";
|
|
5
|
+
import { stdout } from "./opcodes/std";
|
|
6
|
+
import { post_request } from "./utils/services";
|
|
12
7
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
8
|
+
const opcodes = (account) => {
|
|
9
|
+
let set = account.vm.set;
|
|
10
|
+
|
|
11
|
+
ops.map((op) => {
|
|
12
|
+
set(op.name, (args) => {
|
|
17
13
|
if (!args) return;
|
|
14
|
+
|
|
18
15
|
try {
|
|
19
|
-
|
|
16
|
+
let result = eval(`${args.op0} ${op.sign} ${args.op1}`);
|
|
17
|
+
if (op.sign === "==") {
|
|
18
|
+
account.vm.flags.equal = !!result;
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
|
|
20
22
|
return result;
|
|
21
23
|
} catch (e) {
|
|
22
24
|
console.log(e.message);
|
|
23
25
|
}
|
|
24
26
|
});
|
|
25
27
|
});
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
|
|
29
|
+
Object.keys(account.vm.flags).map((flag) => {
|
|
30
|
+
set(`jmp_${flag}`, (args, vm) => jmp(args, vm, { flag }));
|
|
31
|
+
set(`jmp_not_${flag}`, (args, vm) =>
|
|
32
|
+
jmp(args, vm, { flag, inverse: true })
|
|
33
|
+
);
|
|
31
34
|
});
|
|
35
|
+
set("jmp", jmp);
|
|
36
|
+
|
|
37
|
+
set("setter", setter);
|
|
38
|
+
set("getter", getter);
|
|
39
|
+
|
|
40
|
+
set("send", (data) => post_request(data, account.vm.stdin));
|
|
32
41
|
// set("socket_send", socket_send);
|
|
33
42
|
|
|
34
|
-
set("stdout",
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
});
|
|
43
|
+
set("stdout", stdout);
|
|
44
|
+
|
|
45
|
+
["run", "load", "parse", "create_account"].map((op) =>
|
|
46
|
+
set(op, (arg) => arg && arg.op0 && account[op](arg && arg.op0))
|
|
47
|
+
);
|
|
40
48
|
};
|
|
41
|
-
|
|
42
|
-
|
|
49
|
+
|
|
50
|
+
export default opcodes;
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "godprotocol",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.82",
|
|
4
4
|
"description": "A data mediator.",
|
|
5
5
|
"main": "Index.js",
|
|
6
|
-
"types": "index.d.ts",
|
|
6
|
+
"types": "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",
|
|
@@ -45,7 +45,8 @@
|
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"crypto": "^1.0.1",
|
|
47
47
|
"elliptic": "^6.5.5",
|
|
48
|
-
"fs": "^0.0.1-security"
|
|
48
|
+
"fs": "^0.0.1-security",
|
|
49
|
+
"generalised-datastore": "^1.7.85"
|
|
49
50
|
},
|
|
50
51
|
"publishConfig": {
|
|
51
52
|
"ignore": [
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import Loader_sequence from "../Loader_sequence/main";
|
|
2
|
+
import Filesystem from "./Filesystem";
|
|
3
|
+
import Virtual_machine from "./Virtual_machine";
|
|
4
|
+
|
|
5
|
+
interface Meta {
|
|
6
|
+
private?: boolean;
|
|
7
|
+
manager?: any;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
interface Program {
|
|
11
|
+
instructions: string[];
|
|
12
|
+
account: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
interface LoadPayload {
|
|
16
|
+
program: Program;
|
|
17
|
+
signature: string;
|
|
18
|
+
callback?: (data: any) => void;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
interface ParsePayload {
|
|
22
|
+
payload: any;
|
|
23
|
+
signature: string;
|
|
24
|
+
callback?: (data: any) => void;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
interface RunRequest {
|
|
28
|
+
payload: any;
|
|
29
|
+
signature: string;
|
|
30
|
+
callback?: (data: any) => void;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
interface AccountPayload {
|
|
34
|
+
name: string;
|
|
35
|
+
meta?: Meta;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
interface EndpointPayload {
|
|
39
|
+
[key: string]: any;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
declare class Account extends Filesystem {
|
|
43
|
+
name: string;
|
|
44
|
+
private: boolean;
|
|
45
|
+
manager: any;
|
|
46
|
+
account: Account;
|
|
47
|
+
physical_address: string;
|
|
48
|
+
compiler: Loader_sequence;
|
|
49
|
+
chain: any;
|
|
50
|
+
vm: Virtual_machine;
|
|
51
|
+
mine_buffer: Record<string, any>;
|
|
52
|
+
|
|
53
|
+
constructor(name: string, meta?: Meta);
|
|
54
|
+
|
|
55
|
+
get_account(name: string): Account;
|
|
56
|
+
manage_buffer(callback?: (data: any) => void): string;
|
|
57
|
+
buff(block: any, pid: string): void;
|
|
58
|
+
flush_buffer(pid: string): void;
|
|
59
|
+
load(payload: LoadPayload): void;
|
|
60
|
+
parse(payload: ParsePayload): void;
|
|
61
|
+
run(request: RunRequest): void;
|
|
62
|
+
run_callback(callback: any, payload: any): void;
|
|
63
|
+
validate(
|
|
64
|
+
payload: any,
|
|
65
|
+
signature: string,
|
|
66
|
+
callback?: (data: any) => void
|
|
67
|
+
): boolean;
|
|
68
|
+
stringify(str?: boolean): string | object;
|
|
69
|
+
create_account(payload: AccountPayload): Account;
|
|
70
|
+
endpoint(endpoint: string, payload: EndpointPayload): void;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export default Account;
|
package/types/Block.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import Chain from "./Chain"; // Adjust the import according to your project structure
|
|
2
|
+
|
|
3
|
+
declare class Block {
|
|
4
|
+
chain: Chain;
|
|
5
|
+
data: any;
|
|
6
|
+
metadata: Record<string, any>;
|
|
7
|
+
children: Block[];
|
|
8
|
+
index: number;
|
|
9
|
+
previous_hash?: string;
|
|
10
|
+
hash?: string;
|
|
11
|
+
cursor?: any;
|
|
12
|
+
datapath?: string;
|
|
13
|
+
timelapse?: any;
|
|
14
|
+
|
|
15
|
+
constructor(chain: Chain);
|
|
16
|
+
|
|
17
|
+
generate_hash(): void;
|
|
18
|
+
store(no_curs?: boolean): void;
|
|
19
|
+
stringify(str?: boolean): string | object;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export default Block;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import Chain from "./Chain";
|
|
2
|
+
|
|
3
|
+
declare class Blockweb {
|
|
4
|
+
mgr: any;
|
|
5
|
+
physical_addresses: Record<string, string>;
|
|
6
|
+
chains: Record<string, Chain>;
|
|
7
|
+
|
|
8
|
+
constructor(mgr: any);
|
|
9
|
+
|
|
10
|
+
get(addr: string): Chain | undefined;
|
|
11
|
+
set(parent: any, name: string): Chain;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export default Blockweb;
|
package/types/Chain.d.ts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import Block from "./Block";
|
|
2
|
+
import Explorer from "./Explorer";
|
|
3
|
+
|
|
4
|
+
declare class Chain extends Explorer {
|
|
5
|
+
parent: any;
|
|
6
|
+
account: any;
|
|
7
|
+
name: string;
|
|
8
|
+
physical_address: string;
|
|
9
|
+
pending_children: Block[];
|
|
10
|
+
connections: Block[];
|
|
11
|
+
blocks: Block[];
|
|
12
|
+
txs: any[];
|
|
13
|
+
height: number;
|
|
14
|
+
cursor: number;
|
|
15
|
+
cursors: number[];
|
|
16
|
+
buffs: any[];
|
|
17
|
+
start_time?: number;
|
|
18
|
+
hash: string;
|
|
19
|
+
|
|
20
|
+
constructor(parent: any, name?: string);
|
|
21
|
+
|
|
22
|
+
append_buffer(): void;
|
|
23
|
+
set_cursor(cursor: number): void;
|
|
24
|
+
get_buffer(): any;
|
|
25
|
+
generate_hash(): void;
|
|
26
|
+
get_block(index: number): Block | undefined;
|
|
27
|
+
add_tx(instruction: any): void;
|
|
28
|
+
mine(vm: any, no_curs?: boolean): Block;
|
|
29
|
+
add_block(block: Block): void;
|
|
30
|
+
get_latest_block(): Block | undefined;
|
|
31
|
+
stringify(str?: boolean): string | Record<string, any>;
|
|
32
|
+
add_chain(name: string): Chain;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export default Chain;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
declare class Filesystem {
|
|
2
|
+
base_address: string;
|
|
3
|
+
physical_address: string;
|
|
4
|
+
name: string;
|
|
5
|
+
hash: string;
|
|
6
|
+
account: any;
|
|
7
|
+
manager: any;
|
|
8
|
+
|
|
9
|
+
constructor();
|
|
10
|
+
|
|
11
|
+
parse_path(path: string): any;
|
|
12
|
+
read(datapath: string): any;
|
|
13
|
+
save(content: any, chain: any, just_obj?: boolean): string | object;
|
|
14
|
+
data_addr(type: string): string;
|
|
15
|
+
get_type(chain: any): string;
|
|
16
|
+
write(arg: any, context: any): void;
|
|
17
|
+
name_hash(): void;
|
|
18
|
+
set_paths(chain: any): void;
|
|
19
|
+
add_chain(name: string, parent: any): any;
|
|
20
|
+
account_chain(account: any): any;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export default Filesystem;
|
package/types/Frame.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
declare class Frame {
|
|
2
|
+
parent: Frame | null;
|
|
3
|
+
object: any;
|
|
4
|
+
children: Frame[];
|
|
5
|
+
instructions: (string | Frame)[];
|
|
6
|
+
|
|
7
|
+
constructor(object: any, parent?: Frame | null);
|
|
8
|
+
|
|
9
|
+
frame(object: any): Frame;
|
|
10
|
+
to_instruction(): void;
|
|
11
|
+
flatten_instructions(): string[];
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export default Frame;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import Account from "./Account";
|
|
2
|
+
import Blockweb from "./Blockweb";
|
|
3
|
+
import Oracle from "./Oracle";
|
|
4
|
+
|
|
5
|
+
declare class Manager {
|
|
6
|
+
accounts: { [key: string]: Account };
|
|
7
|
+
running: number;
|
|
8
|
+
tracks: { [key: string]: any };
|
|
9
|
+
web: Blockweb;
|
|
10
|
+
oracle: Oracle;
|
|
11
|
+
clock: NodeJS.Timeout | null;
|
|
12
|
+
|
|
13
|
+
constructor();
|
|
14
|
+
|
|
15
|
+
start_clock(): void;
|
|
16
|
+
get_account(name: string): Account | undefined;
|
|
17
|
+
add_account(name: string, meta?: { private?: boolean }): Account;
|
|
18
|
+
push(program: { sequence: string[]; account: Account; pid: string }): void;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export default Manager;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
declare class Opcodes {
|
|
2
|
+
opcodes: { [key: string]: (args?: any) => any };
|
|
3
|
+
|
|
4
|
+
constructor();
|
|
5
|
+
|
|
6
|
+
set(opcode: string, circuit: (args?: any) => any): void;
|
|
7
|
+
prepare_operation(opcode: string, context: any): void;
|
|
8
|
+
stdin(object: any, cb?: () => void): void;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export default Opcodes;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// import fs from "fs";
|
|
2
|
+
|
|
3
|
+
declare class Oracle {
|
|
4
|
+
// fs: typeof fs;
|
|
5
|
+
mgr: any;
|
|
6
|
+
datapaths: { [key: string]: { type: string; obj: any } };
|
|
7
|
+
|
|
8
|
+
constructor(mgr: any);
|
|
9
|
+
|
|
10
|
+
set(path: string, data: { type: string; obj: any }): void;
|
|
11
|
+
|
|
12
|
+
get(path: string): { type: string; obj: any } | undefined;
|
|
13
|
+
|
|
14
|
+
write(addr: string, data: any, meta?: { encoding: string }): void;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export default Oracle;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import Opcodes from "./Opcodes";
|
|
2
|
+
|
|
3
|
+
declare class Virtual_machine extends Opcodes {
|
|
4
|
+
account: any;
|
|
5
|
+
contexts: any[];
|
|
6
|
+
stack: any[];
|
|
7
|
+
track: any;
|
|
8
|
+
|
|
9
|
+
constructor(context: any);
|
|
10
|
+
|
|
11
|
+
get_context(index?: number): any;
|
|
12
|
+
|
|
13
|
+
parse_arg(arg: string, is_cursor: boolean): any;
|
|
14
|
+
|
|
15
|
+
split_instruction(instruction: string): { opcode: string; args: string };
|
|
16
|
+
|
|
17
|
+
execute(instruction: string, track: any): void;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export default Virtual_machine;
|
package/types/index.d.ts
ADDED