@eosrio/node-abieos 2.1.1 → 2.2.0
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/README.md +4 -1
- package/dist/abieos.node +0 -0
- package/lib/abieos.d.ts +19 -0
- package/lib/abieos.d.ts.map +1 -0
- package/lib/abieos.js +100 -0
- package/lib/abieos.ts +107 -0
- package/package.json +13 -8
- package/.idea/modules.xml +0 -8
- package/.idea/node-abieos.iml +0 -12
- package/.idea/vcs.xml +0 -9
- package/.idea/workspace.xml +0 -66
- package/CMakeLists.txt +0 -35
- package/abieos.d.ts +0 -21
- package/abieos.js +0 -59
- package/eosio.json +0 -1596
- package/include/.clang-format +0 -76
- package/include/eosio/abi.hpp +0 -393
- package/include/eosio/asset.hpp +0 -458
- package/include/eosio/bytes.hpp +0 -27
- package/include/eosio/chain_conversions.hpp +0 -450
- package/include/eosio/chain_types.hpp +0 -14
- package/include/eosio/check.hpp +0 -178
- package/include/eosio/convert.hpp +0 -95
- package/include/eosio/crypto.hpp +0 -148
- package/include/eosio/eosio_outcome.hpp +0 -41
- package/include/eosio/fixed_bytes.hpp +0 -250
- package/include/eosio/float.hpp +0 -35
- package/include/eosio/for_each_field.hpp +0 -48
- package/include/eosio/fpconv.c +0 -336
- package/include/eosio/fpconv.h +0 -41
- package/include/eosio/fpconv.license +0 -23
- package/include/eosio/from_bin.hpp +0 -272
- package/include/eosio/from_json.hpp +0 -749
- package/include/eosio/from_string.hpp +0 -28
- package/include/eosio/map_macro.h +0 -64
- package/include/eosio/murmur.hpp +0 -55
- package/include/eosio/name.hpp +0 -178
- package/include/eosio/opaque.hpp +0 -184
- package/include/eosio/operators.hpp +0 -71
- package/include/eosio/powers.h +0 -76
- package/include/eosio/reflection.hpp +0 -61
- package/include/eosio/ship_protocol.hpp +0 -971
- package/include/eosio/stream.hpp +0 -235
- package/include/eosio/symbol.hpp +0 -300
- package/include/eosio/time.hpp +0 -264
- package/include/eosio/to_bin.hpp +0 -189
- package/include/eosio/to_json.hpp +0 -334
- package/include/eosio/to_key.hpp +0 -305
- package/include/eosio/types.hpp +0 -103
- package/include/eosio/varint.hpp +0 -452
- package/include/outcome-basic.hpp +0 -6836
- package/include/rapidjson/allocators.h +0 -284
- package/include/rapidjson/cursorstreamwrapper.h +0 -78
- package/include/rapidjson/document.h +0 -2646
- package/include/rapidjson/encodedstream.h +0 -299
- package/include/rapidjson/encodings.h +0 -716
- package/include/rapidjson/error/en.h +0 -74
- package/include/rapidjson/error/error.h +0 -161
- package/include/rapidjson/filereadstream.h +0 -99
- package/include/rapidjson/filewritestream.h +0 -104
- package/include/rapidjson/fwd.h +0 -151
- package/include/rapidjson/internal/biginteger.h +0 -290
- package/include/rapidjson/internal/diyfp.h +0 -271
- package/include/rapidjson/internal/dtoa.h +0 -245
- package/include/rapidjson/internal/ieee754.h +0 -78
- package/include/rapidjson/internal/itoa.h +0 -308
- package/include/rapidjson/internal/meta.h +0 -186
- package/include/rapidjson/internal/pow10.h +0 -55
- package/include/rapidjson/internal/regex.h +0 -732
- package/include/rapidjson/internal/stack.h +0 -231
- package/include/rapidjson/internal/strfunc.h +0 -69
- package/include/rapidjson/internal/strtod.h +0 -290
- package/include/rapidjson/internal/swap.h +0 -46
- package/include/rapidjson/istreamwrapper.h +0 -113
- package/include/rapidjson/memorybuffer.h +0 -70
- package/include/rapidjson/memorystream.h +0 -71
- package/include/rapidjson/msinttypes/inttypes.h +0 -316
- package/include/rapidjson/msinttypes/stdint.h +0 -300
- package/include/rapidjson/ostreamwrapper.h +0 -81
- package/include/rapidjson/pointer.h +0 -1357
- package/include/rapidjson/prettywriter.h +0 -277
- package/include/rapidjson/rapidjson.h +0 -654
- package/include/rapidjson/reader.h +0 -2230
- package/include/rapidjson/schema.h +0 -2494
- package/include/rapidjson/stream.h +0 -223
- package/include/rapidjson/stringbuffer.h +0 -121
- package/include/rapidjson/writer.h +0 -710
- package/src/abi.cpp +0 -274
- package/src/abieos.cpp +0 -334
- package/src/abieos.h +0 -91
- package/src/abieos.hpp +0 -1011
- package/src/abieos_exception.hpp +0 -89
- package/src/abieos_numeric.hpp +0 -94
- package/src/abieos_ripemd160.hpp +0 -417
- package/src/crypto.cpp +0 -215
- package/src/main.cpp +0 -242
- package/src/ship.abi.cpp +0 -695
- package/tools/CMakeLists.txt +0 -9
- package/tools/name.cpp +0 -86
package/README.md
CHANGED
package/dist/abieos.node
CHANGED
|
Binary file
|
package/lib/abieos.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
declare let abieos: any | null;
|
|
3
|
+
export declare class Abieos {
|
|
4
|
+
private static instance;
|
|
5
|
+
static native: typeof abieos;
|
|
6
|
+
private constructor();
|
|
7
|
+
static getInstance(): Abieos;
|
|
8
|
+
stringToName(nameString: string): BigInteger;
|
|
9
|
+
jsonToHex(contractName: string, type: string, json: string | object): string;
|
|
10
|
+
hexToJson(contractName: string, type: string, hex: string): string;
|
|
11
|
+
binToJson(contractName: string, type: string, buffer: Buffer): string;
|
|
12
|
+
loadAbi(contractName: string, abi: string | object): boolean;
|
|
13
|
+
loadAbiHex(contractName: string, abihex: string): boolean;
|
|
14
|
+
getTypeForAction(contractName: string, actionName: string): string;
|
|
15
|
+
getTypeForTable(contractName: string, table_name: string): string;
|
|
16
|
+
deleteContract(contractName: string): boolean;
|
|
17
|
+
}
|
|
18
|
+
export {};
|
|
19
|
+
//# sourceMappingURL=abieos.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"abieos.d.ts","sourceRoot":"","sources":["abieos.ts"],"names":[],"mappings":";AAMA,QAAA,IAAI,MAAM,EAAE,GAAG,GAAG,IAAW,CAAC;AAQ9B,qBAAa,MAAM;IACf,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAS;IAChC,OAAc,MAAM,EAAE,OAAO,MAAM,CAAC;IAEpC,OAAO;WAIO,WAAW,IAAI,MAAM;IAO5B,YAAY,CAAC,UAAU,EAAE,MAAM,GAAG,UAAU;IAI5C,SAAS,CAAC,YAAY,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM;IAU5E,SAAS,CAAC,YAAY,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM;IAalE,SAAS,CAAC,YAAY,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM;IAarE,OAAO,CAAC,YAAY,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO;IAY5D,UAAU,CAAC,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO;IAIzD,gBAAgB,CAAC,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM;IASlE,eAAe,CAAC,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM;IASjE,cAAc,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO;CAGvD"}
|
package/lib/abieos.js
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { createRequire } from 'module';
|
|
2
|
+
const require = createRequire(import.meta.url);
|
|
3
|
+
let modulePath = "../dist/abieos.node";
|
|
4
|
+
let abieos = null;
|
|
5
|
+
if (process.platform === 'linux') {
|
|
6
|
+
abieos = require(modulePath);
|
|
7
|
+
}
|
|
8
|
+
else if (process.platform === 'win32') {
|
|
9
|
+
throw new Error(`${process.platform} is not supported by node-abieos`);
|
|
10
|
+
abieos = null;
|
|
11
|
+
}
|
|
12
|
+
export class Abieos {
|
|
13
|
+
constructor() {
|
|
14
|
+
Abieos.native = abieos;
|
|
15
|
+
}
|
|
16
|
+
static getInstance() {
|
|
17
|
+
if (!Abieos.instance) {
|
|
18
|
+
Abieos.instance = new Abieos();
|
|
19
|
+
}
|
|
20
|
+
return Abieos.instance;
|
|
21
|
+
}
|
|
22
|
+
stringToName(nameString) {
|
|
23
|
+
return Abieos.native.string_to_name(nameString);
|
|
24
|
+
}
|
|
25
|
+
jsonToHex(contractName, type, json) {
|
|
26
|
+
const jsonData = typeof json === 'object' ? JSON.stringify(json) : json;
|
|
27
|
+
const data = Abieos.native.json_to_hex(contractName, type, jsonData);
|
|
28
|
+
if (data === 'PARSING_ERROR') {
|
|
29
|
+
throw new Error('failed to parse data');
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
return data;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
hexToJson(contractName, type, hex) {
|
|
36
|
+
const data = Abieos.native.hex_to_json(contractName, type, hex);
|
|
37
|
+
if (data) {
|
|
38
|
+
try {
|
|
39
|
+
return JSON.parse(data);
|
|
40
|
+
}
|
|
41
|
+
catch (e) {
|
|
42
|
+
throw new Error('failed to parse json string: ' + data);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
throw new Error('failed to parse hex data');
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
binToJson(contractName, type, buffer) {
|
|
50
|
+
const data = Abieos.native.bin_to_json(contractName, type, buffer);
|
|
51
|
+
if (data[0] === '{' || data[0] === '[') {
|
|
52
|
+
try {
|
|
53
|
+
return JSON.parse(data);
|
|
54
|
+
}
|
|
55
|
+
catch (e) {
|
|
56
|
+
throw new Error('json parse error');
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
throw new Error(data);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
loadAbi(contractName, abi) {
|
|
64
|
+
if (typeof abi === 'string') {
|
|
65
|
+
return Abieos.native.load_abi(contractName, abi);
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
if (typeof abi === 'object') {
|
|
69
|
+
return Abieos.native.load_abi(contractName, JSON.stringify(abi));
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
throw new Error('ABI must be a String or Object');
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
loadAbiHex(contractName, abihex) {
|
|
77
|
+
return Abieos.native.load_abi_hex(contractName, abihex);
|
|
78
|
+
}
|
|
79
|
+
getTypeForAction(contractName, actionName) {
|
|
80
|
+
const result = Abieos.native.get_type_for_action(contractName, actionName);
|
|
81
|
+
if (result === 'NOT_FOUND') {
|
|
82
|
+
throw new Error('action ' + actionName + ' not found on contract ' + contractName);
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
return result;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
getTypeForTable(contractName, table_name) {
|
|
89
|
+
const result = Abieos.native.get_type_for_table(contractName, table_name);
|
|
90
|
+
if (result === 'NOT_FOUND') {
|
|
91
|
+
throw new Error('table ' + table_name + ' not found on contract ' + contractName);
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
return result;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
deleteContract(contractName) {
|
|
98
|
+
return Abieos.native.delete_contract(contractName);
|
|
99
|
+
}
|
|
100
|
+
}
|
package/lib/abieos.ts
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import {createRequire} from 'module';
|
|
2
|
+
import {type} from "os";
|
|
3
|
+
|
|
4
|
+
const require = createRequire(import.meta.url);
|
|
5
|
+
|
|
6
|
+
let modulePath = "../dist/abieos.node";
|
|
7
|
+
let abieos: any | null = null;
|
|
8
|
+
if (process.platform === 'linux') {
|
|
9
|
+
abieos = require(modulePath);
|
|
10
|
+
} else if (process.platform === 'win32') {
|
|
11
|
+
throw new Error(`${process.platform} is not supported by node-abieos`);
|
|
12
|
+
abieos = null;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export class Abieos {
|
|
16
|
+
private static instance: Abieos;
|
|
17
|
+
public static native: typeof abieos;
|
|
18
|
+
|
|
19
|
+
private constructor() {
|
|
20
|
+
Abieos.native = abieos;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
public static getInstance(): Abieos {
|
|
24
|
+
if (!Abieos.instance) {
|
|
25
|
+
Abieos.instance = new Abieos();
|
|
26
|
+
}
|
|
27
|
+
return Abieos.instance;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
public stringToName(nameString: string): BigInteger {
|
|
31
|
+
return Abieos.native.string_to_name(nameString) as BigInteger;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
public jsonToHex(contractName: string, type: string, json: string | object): string {
|
|
35
|
+
const jsonData = typeof json === 'object' ? JSON.stringify(json) : json
|
|
36
|
+
const data: string = Abieos.native.json_to_hex(contractName, type, jsonData);
|
|
37
|
+
if (data === 'PARSING_ERROR') {
|
|
38
|
+
throw new Error('failed to parse data');
|
|
39
|
+
} else {
|
|
40
|
+
return data;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
public hexToJson(contractName: string, type: string, hex: string): string {
|
|
45
|
+
const data = Abieos.native.hex_to_json(contractName, type, hex);
|
|
46
|
+
if (data) {
|
|
47
|
+
try {
|
|
48
|
+
return JSON.parse(data);
|
|
49
|
+
} catch (e) {
|
|
50
|
+
throw new Error('failed to parse json string: ' + data);
|
|
51
|
+
}
|
|
52
|
+
} else {
|
|
53
|
+
throw new Error('failed to parse hex data');
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
public binToJson(contractName: string, type: string, buffer: Buffer): string {
|
|
58
|
+
const data = Abieos.native.bin_to_json(contractName, type, buffer);
|
|
59
|
+
if (data[0] === '{' || data[0] === '[') {
|
|
60
|
+
try {
|
|
61
|
+
return JSON.parse(data);
|
|
62
|
+
} catch (e) {
|
|
63
|
+
throw new Error('json parse error');
|
|
64
|
+
}
|
|
65
|
+
} else {
|
|
66
|
+
throw new Error(data);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
public loadAbi(contractName: string, abi: string | object): boolean {
|
|
71
|
+
if (typeof abi === 'string') {
|
|
72
|
+
return Abieos.native.load_abi(contractName, abi) as boolean;
|
|
73
|
+
} else {
|
|
74
|
+
if (typeof abi === 'object') {
|
|
75
|
+
return Abieos.native.load_abi(contractName, JSON.stringify(abi)) as boolean;
|
|
76
|
+
} else {
|
|
77
|
+
throw new Error('ABI must be a String or Object');
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
public loadAbiHex(contractName: string, abihex: string): boolean {
|
|
83
|
+
return Abieos.native.load_abi_hex(contractName, abihex) as boolean;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
public getTypeForAction(contractName: string, actionName: string): string {
|
|
87
|
+
const result = Abieos.native.get_type_for_action(contractName, actionName);
|
|
88
|
+
if (result === 'NOT_FOUND') {
|
|
89
|
+
throw new Error('action ' + actionName + ' not found on contract ' + contractName);
|
|
90
|
+
} else {
|
|
91
|
+
return result;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
public getTypeForTable(contractName: string, table_name: string): string {
|
|
96
|
+
const result = Abieos.native.get_type_for_table(contractName, table_name);
|
|
97
|
+
if (result === 'NOT_FOUND') {
|
|
98
|
+
throw new Error('table ' + table_name + ' not found on contract ' + contractName);
|
|
99
|
+
} else {
|
|
100
|
+
return result;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
public deleteContract(contractName: string): boolean {
|
|
105
|
+
return Abieos.native.delete_contract(contractName) as boolean;
|
|
106
|
+
}
|
|
107
|
+
}
|
package/package.json
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eosrio/node-abieos",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"description": "Node Bindings for abieos: Binary <> JSON conversion using ABIs.",
|
|
5
|
-
"main": "abieos.js",
|
|
6
|
-
"typings": "abieos.d.ts",
|
|
5
|
+
"main": "./lib/abieos.js",
|
|
6
|
+
"typings": "./lib/abieos.d.ts",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"install": "node -e 'process.exit(0)'",
|
|
9
|
-
"
|
|
9
|
+
"test": "cd examples && node basic.js",
|
|
10
|
+
"tsc:watch": "tsc --watch",
|
|
11
|
+
"build:linux": "cmake-js compile --cc /usr/bin/clang --cxx /usr/bin/clang++ && cp build/Release/node_abieos.node dist/abieos.node",
|
|
12
|
+
"build:win": "cmake-js"
|
|
10
13
|
},
|
|
14
|
+
"type": "module",
|
|
11
15
|
"repository": {
|
|
12
16
|
"type": "git",
|
|
13
17
|
"url": "git+https://github.com/eosrio/node-abieos.git"
|
|
@@ -19,13 +23,14 @@
|
|
|
19
23
|
},
|
|
20
24
|
"homepage": "https://github.com/eosrio/node-abieos#readme",
|
|
21
25
|
"devDependencies": {
|
|
22
|
-
"node-addon-api": "^
|
|
23
|
-
"cmake-js": "^
|
|
24
|
-
"@types/node": "^
|
|
26
|
+
"node-addon-api": "^5.0.0",
|
|
27
|
+
"cmake-js": "^7.0.0",
|
|
28
|
+
"@types/node": "^18.11.0",
|
|
29
|
+
"typescript": "^4.8.4"
|
|
25
30
|
},
|
|
26
31
|
"cmake-js": {
|
|
27
32
|
"runtime": "node",
|
|
28
|
-
"runtimeVersion": "
|
|
33
|
+
"runtimeVersion": "18.0.0",
|
|
29
34
|
"arch": "x64"
|
|
30
35
|
}
|
|
31
36
|
}
|
package/.idea/modules.xml
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<project version="4">
|
|
3
|
-
<component name="ProjectModuleManager">
|
|
4
|
-
<modules>
|
|
5
|
-
<module fileurl="file://$PROJECT_DIR$/.idea/node-abieos.iml" filepath="$PROJECT_DIR$/.idea/node-abieos.iml" />
|
|
6
|
-
</modules>
|
|
7
|
-
</component>
|
|
8
|
-
</project>
|
package/.idea/node-abieos.iml
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<module type="WEB_MODULE" version="4">
|
|
3
|
-
<component name="NewModuleRootManager">
|
|
4
|
-
<content url="file://$MODULE_DIR$">
|
|
5
|
-
<excludeFolder url="file://$MODULE_DIR$/temp" />
|
|
6
|
-
<excludeFolder url="file://$MODULE_DIR$/.tmp" />
|
|
7
|
-
<excludeFolder url="file://$MODULE_DIR$/tmp" />
|
|
8
|
-
</content>
|
|
9
|
-
<orderEntry type="inheritedJdk" />
|
|
10
|
-
<orderEntry type="sourceFolder" forTests="false" />
|
|
11
|
-
</component>
|
|
12
|
-
</module>
|
package/.idea/vcs.xml
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<project version="4">
|
|
3
|
-
<component name="VcsDirectoryMappings">
|
|
4
|
-
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
|
5
|
-
<mapping directory="$PROJECT_DIR$/external/date" vcs="Git" />
|
|
6
|
-
<mapping directory="$PROJECT_DIR$/external/rapidjson" vcs="Git" />
|
|
7
|
-
<mapping directory="$PROJECT_DIR$/external/rapidjson/thirdparty/gtest" vcs="Git" />
|
|
8
|
-
</component>
|
|
9
|
-
</project>
|
package/.idea/workspace.xml
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<project version="4">
|
|
3
|
-
<component name="ChangeListManager">
|
|
4
|
-
<list default="true" id="24cd1727-69ec-448f-8093-325f7373674c" name="Changes" comment="">
|
|
5
|
-
<change beforePath="$PROJECT_DIR$/package.json" beforeDir="false" afterPath="$PROJECT_DIR$/package.json" afterDir="false" />
|
|
6
|
-
</list>
|
|
7
|
-
<option name="SHOW_DIALOG" value="false" />
|
|
8
|
-
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
|
9
|
-
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
|
10
|
-
<option name="LAST_RESOLUTION" value="IGNORE" />
|
|
11
|
-
</component>
|
|
12
|
-
<component name="Git.Settings">
|
|
13
|
-
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
|
14
|
-
<option name="ROOT_SYNC" value="DONT_SYNC" />
|
|
15
|
-
</component>
|
|
16
|
-
<component name="MacroExpansionManager">
|
|
17
|
-
<option name="directoryName" value="p126c0rw" />
|
|
18
|
-
</component>
|
|
19
|
-
<component name="ProjectId" id="1tcablyCLJIu0scVOq9ZAxLEPB7" />
|
|
20
|
-
<component name="ProjectLevelVcsManager" settingsEditedManually="true" />
|
|
21
|
-
<component name="ProjectViewState">
|
|
22
|
-
<option name="hideEmptyMiddlePackages" value="true" />
|
|
23
|
-
<option name="showLibraryContents" value="true" />
|
|
24
|
-
</component>
|
|
25
|
-
<component name="PropertiesComponent">
|
|
26
|
-
<property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
|
|
27
|
-
<property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
|
|
28
|
-
<property name="WebServerToolWindowFactoryState" value="false" />
|
|
29
|
-
<property name="last_opened_file_path" value="$PROJECT_DIR$/external/rapid_json" />
|
|
30
|
-
<property name="node.js.detected.package.eslint" value="true" />
|
|
31
|
-
<property name="node.js.detected.package.tslint" value="true" />
|
|
32
|
-
<property name="node.js.selected.package.eslint" value="(autodetect)" />
|
|
33
|
-
<property name="node.js.selected.package.tslint" value="(autodetect)" />
|
|
34
|
-
<property name="nodejs_package_manager_path" value="npm" />
|
|
35
|
-
<property name="vue.rearranger.settings.migration" value="true" />
|
|
36
|
-
</component>
|
|
37
|
-
<component name="RecentsManager">
|
|
38
|
-
<key name="CopyFile.RECENT_KEYS">
|
|
39
|
-
<recent name="C:\GitHub\node-abieos\external\rapid_json" />
|
|
40
|
-
<recent name="C:\GitHub\node-abieos\src" />
|
|
41
|
-
<recent name="C:\GitHub\node-abieos" />
|
|
42
|
-
</key>
|
|
43
|
-
<key name="MoveFile.RECENT_KEYS">
|
|
44
|
-
<recent name="C:\GitHub\node-abieos\include" />
|
|
45
|
-
<recent name="C:\GitHub\node-abieos\external_includes" />
|
|
46
|
-
</key>
|
|
47
|
-
</component>
|
|
48
|
-
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
|
|
49
|
-
<component name="TaskManager">
|
|
50
|
-
<task active="true" id="Default" summary="Default task">
|
|
51
|
-
<changelist id="24cd1727-69ec-448f-8093-325f7373674c" name="Changes" comment="" />
|
|
52
|
-
<created>1623070905388</created>
|
|
53
|
-
<option name="number" value="Default" />
|
|
54
|
-
<option name="presentableId" value="Default" />
|
|
55
|
-
<updated>1623070905388</updated>
|
|
56
|
-
<workItem from="1623070906565" duration="179000" />
|
|
57
|
-
<workItem from="1623071181018" duration="5026000" />
|
|
58
|
-
<workItem from="1623138029252" duration="11000" />
|
|
59
|
-
<workItem from="1623321973087" duration="130000" />
|
|
60
|
-
</task>
|
|
61
|
-
<servers />
|
|
62
|
-
</component>
|
|
63
|
-
<component name="TypeScriptGeneratedFilesManager">
|
|
64
|
-
<option name="version" value="3" />
|
|
65
|
-
</component>
|
|
66
|
-
</project>
|
package/CMakeLists.txt
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
cmake_minimum_required (VERSION 3.11)
|
|
2
|
-
project(node_abieos VERSION 2.1 LANGUAGES CXX C)
|
|
3
|
-
|
|
4
|
-
add_definitions(-DNAPI_VERSION=6)
|
|
5
|
-
add_definitions(-DNAPI_EXPERIMENTAL)
|
|
6
|
-
|
|
7
|
-
include_directories(${CMAKE_JS_INC})
|
|
8
|
-
|
|
9
|
-
set(default_build_type "Release")
|
|
10
|
-
set(CMAKE_CXX_STANDARD 17)
|
|
11
|
-
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
12
|
-
set(CMAKE_CXX_EXTENSIONS ON)
|
|
13
|
-
|
|
14
|
-
option(ABIEOS_NO_INT128 "disable use of __int128" OFF)
|
|
15
|
-
|
|
16
|
-
find_package(Threads)
|
|
17
|
-
|
|
18
|
-
add_library(abieos STATIC src/abi.cpp src/crypto.cpp include/eosio/fpconv.c)
|
|
19
|
-
target_include_directories(abieos PUBLIC include)
|
|
20
|
-
|
|
21
|
-
if(ABIEOS_NO_INT128)
|
|
22
|
-
target_compile_definitions(abieos PUBLIC ABIEOS_NO_INT128)
|
|
23
|
-
endif()
|
|
24
|
-
|
|
25
|
-
set_target_properties(abieos PROPERTIES POSITION_INDEPENDENT_CODE ON)
|
|
26
|
-
|
|
27
|
-
add_library(${PROJECT_NAME} SHARED src/main.cpp src/abieos.cpp)
|
|
28
|
-
set_target_properties(${PROJECT_NAME} PROPERTIES PREFIX "" SUFFIX ".node")
|
|
29
|
-
target_link_libraries(${PROJECT_NAME} ${CMAKE_JS_LIB};abieos;${CMAKE_THREAD_LIBS_INIT})
|
|
30
|
-
target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wextra -Wno-unused-parameter -fcolor-diagnostics)
|
|
31
|
-
|
|
32
|
-
execute_process(COMMAND node -p "require('node-addon-api').include" WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} OUTPUT_VARIABLE NODE_ADDON_API_DIR)
|
|
33
|
-
string(REPLACE "\n" "" NODE_ADDON_API_DIR ${NODE_ADDON_API_DIR})
|
|
34
|
-
string(REPLACE "\"" "" NODE_ADDON_API_DIR ${NODE_ADDON_API_DIR})
|
|
35
|
-
target_include_directories(${PROJECT_NAME} PRIVATE ${NODE_ADDON_API_DIR})
|
package/abieos.d.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
declare namespace abieos {
|
|
2
|
-
function string_to_name(name_string: string): BigInteger;
|
|
3
|
-
|
|
4
|
-
function json_to_hex(contract_name: string, type: string, json: string | object): string;
|
|
5
|
-
|
|
6
|
-
function hex_to_json(contract_name: string, type: string, hex: string): string;
|
|
7
|
-
|
|
8
|
-
function bin_to_json(contract_name: string, type: string, buffer: Buffer): string;
|
|
9
|
-
|
|
10
|
-
function load_abi(contract_name: string, abi: string): boolean;
|
|
11
|
-
|
|
12
|
-
function load_abi_hex(contract_name: string, abihex: string): boolean;
|
|
13
|
-
|
|
14
|
-
function get_type_for_action(contract_name: string, action_name: string): string;
|
|
15
|
-
|
|
16
|
-
function get_type_for_table(contract_name: string, table_name: string): string;
|
|
17
|
-
|
|
18
|
-
function delete_contract(contract_name: string): boolean;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export = abieos;
|
package/abieos.js
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
if (process.platform === 'linux') {
|
|
2
|
-
const abieos = require('./dist/abieos.node');
|
|
3
|
-
module.exports = {
|
|
4
|
-
json_to_hex: (contract_name, type, json) => {
|
|
5
|
-
const data = abieos.json_to_hex(contract_name, type, typeof json === 'object' ? JSON.stringify(json) : json);
|
|
6
|
-
if (data === 'PARSING_ERROR') {
|
|
7
|
-
throw new Error('failed to parse data');
|
|
8
|
-
} else {
|
|
9
|
-
return data;
|
|
10
|
-
}
|
|
11
|
-
},
|
|
12
|
-
string_to_name: abieos.string_to_name,
|
|
13
|
-
hex_to_json: (contract_name, type, hex) => {
|
|
14
|
-
const data = abieos.hex_to_json(contract_name, type, hex);
|
|
15
|
-
if (data) {
|
|
16
|
-
try {
|
|
17
|
-
return JSON.parse(data);
|
|
18
|
-
} catch (e) {
|
|
19
|
-
throw new Error('failed to parse json string: ' + data);
|
|
20
|
-
}
|
|
21
|
-
} else {
|
|
22
|
-
throw new Error('failed to parse hex data');
|
|
23
|
-
}
|
|
24
|
-
},
|
|
25
|
-
bin_to_json: (contract_name, type, buffer) => {
|
|
26
|
-
const data = abieos.bin_to_json(contract_name, type, buffer);
|
|
27
|
-
if (data[0] === '{' || data[0] === '[') {
|
|
28
|
-
try {
|
|
29
|
-
return JSON.parse(data);
|
|
30
|
-
} catch (e) {
|
|
31
|
-
throw new Error('json parse error');
|
|
32
|
-
}
|
|
33
|
-
} else {
|
|
34
|
-
throw new Error(data);
|
|
35
|
-
}
|
|
36
|
-
},
|
|
37
|
-
load_abi: abieos.load_abi,
|
|
38
|
-
load_abi_hex: abieos.load_abi_hex,
|
|
39
|
-
get_type_for_action: (contract_name, action_name) => {
|
|
40
|
-
const result = abieos.get_type_for_action(contract_name, action_name);
|
|
41
|
-
if (result === 'NOT_FOUND') {
|
|
42
|
-
throw new Error('action ' + action_name + ' not found on contract ' + contract_name);
|
|
43
|
-
} else {
|
|
44
|
-
return result;
|
|
45
|
-
}
|
|
46
|
-
},
|
|
47
|
-
get_type_for_table: (contract_name, table_name) => {
|
|
48
|
-
const result = abieos.get_type_for_table(contract_name, table_name);
|
|
49
|
-
if (result === 'NOT_FOUND') {
|
|
50
|
-
throw new Error('table ' + table_name + ' not found on contract ' + contract_name);
|
|
51
|
-
} else {
|
|
52
|
-
return result;
|
|
53
|
-
}
|
|
54
|
-
},
|
|
55
|
-
delete_contract: abieos.delete_contract,
|
|
56
|
-
};
|
|
57
|
-
} else {
|
|
58
|
-
module.exports = null;
|
|
59
|
-
}
|