@eosrio/node-abieos 3.3.3-23007ce → 3.3.4-97af3fd
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/.cache/jb/compilation_graph.txt +2 -0
- package/.cache/jb/module.modulemap +0 -0
- package/.cache/jb/modules_graph.txt +3 -0
- package/.cache/jb/version.txt +1 -1
- package/.gitmodules +3 -3
- package/README.md +59 -58
- package/dist/_tsup-dts-rollup.d.cts +0 -2
- package/dist/_tsup-dts-rollup.d.ts +0 -2
- package/dist/abieos.node +0 -0
- package/dist/abieos.ts +99 -99
- package/lib/abieos.node +0 -0
- package/lib/abieos.ts +99 -99
- package/package.json +8 -6
- package/tsup.config.ts +11 -11
- package/update-version.mjs +31 -0
|
File without changes
|
package/.cache/jb/version.txt
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(ssh://git@git.jetbrains.team/llvm/llvm-project.git
|
|
1
|
+
(ssh://git@git.jetbrains.team/llvm/llvm-project.git f4157ca9dd49181f6d35eaf6d324ffa84a40f01b based on LLVM 31f1590e4fb324c43dc36199587c453e27b6f6fa revision)
|
package/.gitmodules
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
[submodule "abieos"]
|
|
2
|
-
path = abieos
|
|
3
|
-
url = https://github.com/
|
|
1
|
+
[submodule "abieos"]
|
|
2
|
+
path = abieos
|
|
3
|
+
url = https://github.com/igorls/abieos.git
|
package/README.md
CHANGED
|
@@ -1,58 +1,59 @@
|
|
|
1
|
-
# node-abieos
|
|
2
|
-
|
|
3
|
-

|
|
4
|
-

|
|
5
|
-
[](https://www.npmjs.com/package/@eosrio/node-abieos)
|
|
6
|
-
|
|
7
|
-
Node.js native binding for [abieos](https://github.com/
|
|
8
|
-
|
|
9
|
-
- Contracts can be directly updated on the map
|
|
10
|
-
- Added `abieos_delete_contract`
|
|
11
|
-
|
|
12
|
-
Made with ♥ by [EOS Rio](https://eosrio.io/)
|
|
13
|
-
|
|
14
|
-
----
|
|
15
|
-
**Only Linux is supported for now**
|
|
16
|
-
|
|
17
|
-
- Typescript typings included
|
|
18
|
-
- Prebuilt binary included (Clang 18 required to build)
|
|
19
|
-
|
|
20
|
-
### Install
|
|
21
|
-
|
|
22
|
-
```shell script
|
|
23
|
-
npm i @eosrio/node-abieos --save
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
### Usage
|
|
27
|
-
|
|
28
|
-
CommonJS
|
|
29
|
-
```js
|
|
30
|
-
const nodeAbieos = require('@eosrio/node-abieos');
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
ES Modules
|
|
34
|
-
```typescript
|
|
35
|
-
import
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
npm
|
|
57
|
-
npm run build
|
|
58
|
-
|
|
1
|
+
# node-abieos
|
|
2
|
+
|
|
3
|
+

|
|
4
|
+

|
|
5
|
+
[](https://www.npmjs.com/package/@eosrio/node-abieos)
|
|
6
|
+
|
|
7
|
+
Node.js native binding for [abieos](https://github.com/AntelopeIO/abieos), with some improvements:
|
|
8
|
+
|
|
9
|
+
- Contracts can be directly updated on the map
|
|
10
|
+
- Added `abieos_delete_contract`
|
|
11
|
+
|
|
12
|
+
Made with ♥ by [EOS Rio](https://eosrio.io/)
|
|
13
|
+
|
|
14
|
+
----
|
|
15
|
+
**Only Linux is supported for now**
|
|
16
|
+
|
|
17
|
+
- Typescript typings included
|
|
18
|
+
- Prebuilt binary included (Clang 18 required to build)
|
|
19
|
+
|
|
20
|
+
### Install
|
|
21
|
+
|
|
22
|
+
```shell script
|
|
23
|
+
npm i @eosrio/node-abieos --save
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### Usage
|
|
27
|
+
|
|
28
|
+
CommonJS
|
|
29
|
+
```js
|
|
30
|
+
const nodeAbieos = require('@eosrio/node-abieos');
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
ES Modules
|
|
34
|
+
```typescript
|
|
35
|
+
import {Abieos} from "@eosrio/node-abieos";
|
|
36
|
+
const abieos = Abieos.getInstance();
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Check the [/examples](https://github.com/eosrio/node-abieos/tree/master/examples) folder for implementation examples
|
|
40
|
+
|
|
41
|
+
### Building
|
|
42
|
+
|
|
43
|
+
Make sure you have Clang installed on your system:
|
|
44
|
+
We recommend using Clang 18 to build the `abieos` C++ library.
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
wget https://apt.llvm.org/llvm.sh
|
|
48
|
+
chmod +x llvm.sh
|
|
49
|
+
sudo ./llvm.sh 18
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Clone and Build
|
|
53
|
+
```shell script
|
|
54
|
+
git clone https://github.com/eosrio/node-abieos.git --recursive
|
|
55
|
+
cd node-abieos
|
|
56
|
+
npm install
|
|
57
|
+
npm run build:linux
|
|
58
|
+
npm run build
|
|
59
|
+
```
|
package/dist/abieos.node
CHANGED
|
Binary file
|
package/dist/abieos.ts
CHANGED
|
@@ -1,100 +1,100 @@
|
|
|
1
|
-
import { createRequire } from "module";
|
|
2
|
-
const abieos = createRequire(import.meta.url)('./abieos.node');
|
|
3
|
-
|
|
4
|
-
export class Abieos {
|
|
5
|
-
|
|
6
|
-
private static instance: Abieos;
|
|
7
|
-
public static native: typeof abieos;
|
|
8
|
-
|
|
9
|
-
private constructor() {
|
|
10
|
-
if (Abieos.instance) {
|
|
11
|
-
throw new Error("This class is a Singleton!");
|
|
12
|
-
}
|
|
13
|
-
Abieos.native = abieos;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
public static getInstance(): Abieos {
|
|
17
|
-
if (!Abieos.instance) {
|
|
18
|
-
Abieos.instance = new Abieos();
|
|
19
|
-
}
|
|
20
|
-
return Abieos.instance;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
public stringToName(nameString: string): BigInteger {
|
|
24
|
-
return Abieos.native.string_to_name(nameString) as BigInteger;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
public jsonToHex(contractName: string, type: string, json: string | object): string {
|
|
28
|
-
const jsonData = typeof json === 'object' ? JSON.stringify(json) : json
|
|
29
|
-
const data: string = Abieos.native.json_to_hex(contractName, type, jsonData);
|
|
30
|
-
if (data === 'PARSING_ERROR') {
|
|
31
|
-
throw new Error('failed to parse data');
|
|
32
|
-
} else {
|
|
33
|
-
return data;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
public hexToJson(contractName: string, type: string, hex: string): any {
|
|
38
|
-
const data = Abieos.native.hex_to_json(contractName, type, hex);
|
|
39
|
-
if (data) {
|
|
40
|
-
try {
|
|
41
|
-
return JSON.parse(data);
|
|
42
|
-
} catch (e) {
|
|
43
|
-
throw new Error('failed to parse json string: ' + data);
|
|
44
|
-
}
|
|
45
|
-
} else {
|
|
46
|
-
throw new Error('failed to parse hex data');
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
public binToJson(contractName: string, type: string, buffer: Buffer): any {
|
|
51
|
-
const data = Abieos.native.bin_to_json(contractName, type, buffer);
|
|
52
|
-
if (data[0] === '{' || data[0] === '[') {
|
|
53
|
-
try {
|
|
54
|
-
return JSON.parse(data);
|
|
55
|
-
} catch (e) {
|
|
56
|
-
throw new Error('json parse error');
|
|
57
|
-
}
|
|
58
|
-
} else {
|
|
59
|
-
throw new Error(data);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
public loadAbi(contractName: string, abi: string | object): boolean {
|
|
64
|
-
if (typeof abi === 'string') {
|
|
65
|
-
return Abieos.native.load_abi(contractName, abi) as boolean;
|
|
66
|
-
} else {
|
|
67
|
-
if (typeof abi === 'object') {
|
|
68
|
-
return Abieos.native.load_abi(contractName, JSON.stringify(abi)) as boolean;
|
|
69
|
-
} else {
|
|
70
|
-
throw new Error('ABI must be a String or Object');
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
public loadAbiHex(contractName: string, abihex: string): boolean {
|
|
76
|
-
return Abieos.native.load_abi_hex(contractName, abihex) as boolean;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
public getTypeForAction(contractName: string, actionName: string): string {
|
|
80
|
-
const result = Abieos.native.get_type_for_action(contractName, actionName);
|
|
81
|
-
if (result === 'NOT_FOUND') {
|
|
82
|
-
throw new Error(`[node-abieos] action ` + actionName + ' not found on contract ' + contractName);
|
|
83
|
-
} else {
|
|
84
|
-
return result;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
public getTypeForTable(contractName: string, table_name: string): string {
|
|
89
|
-
const result = Abieos.native.get_type_for_table(contractName, table_name);
|
|
90
|
-
if (result === 'NOT_FOUND') {
|
|
91
|
-
throw new Error(`[node-abieos] table ` + table_name + ' not found on contract ' + contractName);
|
|
92
|
-
} else {
|
|
93
|
-
return result;
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
public deleteContract(contractName: string): boolean {
|
|
98
|
-
return Abieos.native.delete_contract(contractName) as boolean;
|
|
99
|
-
}
|
|
1
|
+
import { createRequire } from "module";
|
|
2
|
+
const abieos = createRequire(import.meta.url)('./abieos.node');
|
|
3
|
+
|
|
4
|
+
export class Abieos {
|
|
5
|
+
|
|
6
|
+
private static instance: Abieos;
|
|
7
|
+
public static native: typeof abieos;
|
|
8
|
+
|
|
9
|
+
private constructor() {
|
|
10
|
+
if (Abieos.instance) {
|
|
11
|
+
throw new Error("This class is a Singleton!");
|
|
12
|
+
}
|
|
13
|
+
Abieos.native = abieos;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
public static getInstance(): Abieos {
|
|
17
|
+
if (!Abieos.instance) {
|
|
18
|
+
Abieos.instance = new Abieos();
|
|
19
|
+
}
|
|
20
|
+
return Abieos.instance;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
public stringToName(nameString: string): BigInteger {
|
|
24
|
+
return Abieos.native.string_to_name(nameString) as BigInteger;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
public jsonToHex(contractName: string, type: string, json: string | object): string {
|
|
28
|
+
const jsonData = typeof json === 'object' ? JSON.stringify(json) : json
|
|
29
|
+
const data: string = Abieos.native.json_to_hex(contractName, type, jsonData);
|
|
30
|
+
if (data === 'PARSING_ERROR') {
|
|
31
|
+
throw new Error('failed to parse data');
|
|
32
|
+
} else {
|
|
33
|
+
return data;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
public hexToJson(contractName: string, type: string, hex: string): any {
|
|
38
|
+
const data = Abieos.native.hex_to_json(contractName, type, hex);
|
|
39
|
+
if (data) {
|
|
40
|
+
try {
|
|
41
|
+
return JSON.parse(data);
|
|
42
|
+
} catch (e) {
|
|
43
|
+
throw new Error('failed to parse json string: ' + data);
|
|
44
|
+
}
|
|
45
|
+
} else {
|
|
46
|
+
throw new Error('failed to parse hex data');
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
public binToJson(contractName: string, type: string, buffer: Buffer): any {
|
|
51
|
+
const data = Abieos.native.bin_to_json(contractName, type, buffer);
|
|
52
|
+
if (data[0] === '{' || data[0] === '[') {
|
|
53
|
+
try {
|
|
54
|
+
return JSON.parse(data);
|
|
55
|
+
} catch (e) {
|
|
56
|
+
throw new Error('json parse error');
|
|
57
|
+
}
|
|
58
|
+
} else {
|
|
59
|
+
throw new Error(data);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
public loadAbi(contractName: string, abi: string | object): boolean {
|
|
64
|
+
if (typeof abi === 'string') {
|
|
65
|
+
return Abieos.native.load_abi(contractName, abi) as boolean;
|
|
66
|
+
} else {
|
|
67
|
+
if (typeof abi === 'object') {
|
|
68
|
+
return Abieos.native.load_abi(contractName, JSON.stringify(abi)) as boolean;
|
|
69
|
+
} else {
|
|
70
|
+
throw new Error('ABI must be a String or Object');
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
public loadAbiHex(contractName: string, abihex: string): boolean {
|
|
76
|
+
return Abieos.native.load_abi_hex(contractName, abihex) as boolean;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
public getTypeForAction(contractName: string, actionName: string): string {
|
|
80
|
+
const result = Abieos.native.get_type_for_action(contractName, actionName);
|
|
81
|
+
if (result === 'NOT_FOUND') {
|
|
82
|
+
throw new Error(`[node-abieos] action ` + actionName + ' not found on contract ' + contractName);
|
|
83
|
+
} else {
|
|
84
|
+
return result;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
public getTypeForTable(contractName: string, table_name: string): string {
|
|
89
|
+
const result = Abieos.native.get_type_for_table(contractName, table_name);
|
|
90
|
+
if (result === 'NOT_FOUND') {
|
|
91
|
+
throw new Error(`[node-abieos] table ` + table_name + ' not found on contract ' + contractName);
|
|
92
|
+
} else {
|
|
93
|
+
return result;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
public deleteContract(contractName: string): boolean {
|
|
98
|
+
return Abieos.native.delete_contract(contractName) as boolean;
|
|
99
|
+
}
|
|
100
100
|
}
|
package/lib/abieos.node
CHANGED
|
Binary file
|
package/lib/abieos.ts
CHANGED
|
@@ -1,100 +1,100 @@
|
|
|
1
|
-
import { createRequire } from "module";
|
|
2
|
-
const abieos = createRequire(import.meta.url)('./abieos.node');
|
|
3
|
-
|
|
4
|
-
export class Abieos {
|
|
5
|
-
|
|
6
|
-
private static instance: Abieos;
|
|
7
|
-
public static native: typeof abieos;
|
|
8
|
-
|
|
9
|
-
private constructor() {
|
|
10
|
-
if (Abieos.instance) {
|
|
11
|
-
throw new Error("This class is a Singleton!");
|
|
12
|
-
}
|
|
13
|
-
Abieos.native = abieos;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
public static getInstance(): Abieos {
|
|
17
|
-
if (!Abieos.instance) {
|
|
18
|
-
Abieos.instance = new Abieos();
|
|
19
|
-
}
|
|
20
|
-
return Abieos.instance;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
public stringToName(nameString: string): BigInteger {
|
|
24
|
-
return Abieos.native.string_to_name(nameString) as BigInteger;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
public jsonToHex(contractName: string, type: string, json: string | object): string {
|
|
28
|
-
const jsonData = typeof json === 'object' ? JSON.stringify(json) : json
|
|
29
|
-
const data: string = Abieos.native.json_to_hex(contractName, type, jsonData);
|
|
30
|
-
if (data === 'PARSING_ERROR') {
|
|
31
|
-
throw new Error('failed to parse data');
|
|
32
|
-
} else {
|
|
33
|
-
return data;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
public hexToJson(contractName: string, type: string, hex: string): any {
|
|
38
|
-
const data = Abieos.native.hex_to_json(contractName, type, hex);
|
|
39
|
-
if (data) {
|
|
40
|
-
try {
|
|
41
|
-
return JSON.parse(data);
|
|
42
|
-
} catch (e) {
|
|
43
|
-
throw new Error('failed to parse json string: ' + data);
|
|
44
|
-
}
|
|
45
|
-
} else {
|
|
46
|
-
throw new Error('failed to parse hex data');
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
public binToJson(contractName: string, type: string, buffer: Buffer): any {
|
|
51
|
-
const data = Abieos.native.bin_to_json(contractName, type, buffer);
|
|
52
|
-
if (data[0] === '{' || data[0] === '[') {
|
|
53
|
-
try {
|
|
54
|
-
return JSON.parse(data);
|
|
55
|
-
} catch (e) {
|
|
56
|
-
throw new Error('json parse error');
|
|
57
|
-
}
|
|
58
|
-
} else {
|
|
59
|
-
throw new Error(data);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
public loadAbi(contractName: string, abi: string | object): boolean {
|
|
64
|
-
if (typeof abi === 'string') {
|
|
65
|
-
return Abieos.native.load_abi(contractName, abi) as boolean;
|
|
66
|
-
} else {
|
|
67
|
-
if (typeof abi === 'object') {
|
|
68
|
-
return Abieos.native.load_abi(contractName, JSON.stringify(abi)) as boolean;
|
|
69
|
-
} else {
|
|
70
|
-
throw new Error('ABI must be a String or Object');
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
public loadAbiHex(contractName: string, abihex: string): boolean {
|
|
76
|
-
return Abieos.native.load_abi_hex(contractName, abihex) as boolean;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
public getTypeForAction(contractName: string, actionName: string): string {
|
|
80
|
-
const result = Abieos.native.get_type_for_action(contractName, actionName);
|
|
81
|
-
if (result === 'NOT_FOUND') {
|
|
82
|
-
throw new Error(`[node-abieos] action ` + actionName + ' not found on contract ' + contractName);
|
|
83
|
-
} else {
|
|
84
|
-
return result;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
public getTypeForTable(contractName: string, table_name: string): string {
|
|
89
|
-
const result = Abieos.native.get_type_for_table(contractName, table_name);
|
|
90
|
-
if (result === 'NOT_FOUND') {
|
|
91
|
-
throw new Error(`[node-abieos] table ` + table_name + ' not found on contract ' + contractName);
|
|
92
|
-
} else {
|
|
93
|
-
return result;
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
public deleteContract(contractName: string): boolean {
|
|
98
|
-
return Abieos.native.delete_contract(contractName) as boolean;
|
|
99
|
-
}
|
|
1
|
+
import { createRequire } from "module";
|
|
2
|
+
const abieos = createRequire(import.meta.url)('./abieos.node');
|
|
3
|
+
|
|
4
|
+
export class Abieos {
|
|
5
|
+
|
|
6
|
+
private static instance: Abieos;
|
|
7
|
+
public static native: typeof abieos;
|
|
8
|
+
|
|
9
|
+
private constructor() {
|
|
10
|
+
if (Abieos.instance) {
|
|
11
|
+
throw new Error("This class is a Singleton!");
|
|
12
|
+
}
|
|
13
|
+
Abieos.native = abieos;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
public static getInstance(): Abieos {
|
|
17
|
+
if (!Abieos.instance) {
|
|
18
|
+
Abieos.instance = new Abieos();
|
|
19
|
+
}
|
|
20
|
+
return Abieos.instance;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
public stringToName(nameString: string): BigInteger {
|
|
24
|
+
return Abieos.native.string_to_name(nameString) as BigInteger;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
public jsonToHex(contractName: string, type: string, json: string | object): string {
|
|
28
|
+
const jsonData = typeof json === 'object' ? JSON.stringify(json) : json
|
|
29
|
+
const data: string = Abieos.native.json_to_hex(contractName, type, jsonData);
|
|
30
|
+
if (data === 'PARSING_ERROR') {
|
|
31
|
+
throw new Error('failed to parse data');
|
|
32
|
+
} else {
|
|
33
|
+
return data;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
public hexToJson(contractName: string, type: string, hex: string): any {
|
|
38
|
+
const data = Abieos.native.hex_to_json(contractName, type, hex);
|
|
39
|
+
if (data) {
|
|
40
|
+
try {
|
|
41
|
+
return JSON.parse(data);
|
|
42
|
+
} catch (e) {
|
|
43
|
+
throw new Error('failed to parse json string: ' + data);
|
|
44
|
+
}
|
|
45
|
+
} else {
|
|
46
|
+
throw new Error('failed to parse hex data');
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
public binToJson(contractName: string, type: string, buffer: Buffer): any {
|
|
51
|
+
const data = Abieos.native.bin_to_json(contractName, type, buffer);
|
|
52
|
+
if (data[0] === '{' || data[0] === '[') {
|
|
53
|
+
try {
|
|
54
|
+
return JSON.parse(data);
|
|
55
|
+
} catch (e) {
|
|
56
|
+
throw new Error('json parse error');
|
|
57
|
+
}
|
|
58
|
+
} else {
|
|
59
|
+
throw new Error(data);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
public loadAbi(contractName: string, abi: string | object): boolean {
|
|
64
|
+
if (typeof abi === 'string') {
|
|
65
|
+
return Abieos.native.load_abi(contractName, abi) as boolean;
|
|
66
|
+
} else {
|
|
67
|
+
if (typeof abi === 'object') {
|
|
68
|
+
return Abieos.native.load_abi(contractName, JSON.stringify(abi)) as boolean;
|
|
69
|
+
} else {
|
|
70
|
+
throw new Error('ABI must be a String or Object');
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
public loadAbiHex(contractName: string, abihex: string): boolean {
|
|
76
|
+
return Abieos.native.load_abi_hex(contractName, abihex) as boolean;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
public getTypeForAction(contractName: string, actionName: string): string {
|
|
80
|
+
const result = Abieos.native.get_type_for_action(contractName, actionName);
|
|
81
|
+
if (result === 'NOT_FOUND') {
|
|
82
|
+
throw new Error(`[node-abieos] action ` + actionName + ' not found on contract ' + contractName);
|
|
83
|
+
} else {
|
|
84
|
+
return result;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
public getTypeForTable(contractName: string, table_name: string): string {
|
|
89
|
+
const result = Abieos.native.get_type_for_table(contractName, table_name);
|
|
90
|
+
if (result === 'NOT_FOUND') {
|
|
91
|
+
throw new Error(`[node-abieos] table ` + table_name + ' not found on contract ' + contractName);
|
|
92
|
+
} else {
|
|
93
|
+
return result;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
public deleteContract(contractName: string): boolean {
|
|
98
|
+
return Abieos.native.delete_contract(contractName) as boolean;
|
|
99
|
+
}
|
|
100
100
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eosrio/node-abieos",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.4-97af3fd",
|
|
4
4
|
"description": "Node Bindings for abieos: Binary <> JSON conversion using ABIs.",
|
|
5
5
|
"main": "./dist/abieos.js",
|
|
6
6
|
"types": "./dist/abieos.d.ts",
|
|
@@ -20,7 +20,8 @@
|
|
|
20
20
|
"build": "tsup",
|
|
21
21
|
"build:linux": "cmake-js compile --cc /usr/bin/clang-18 --cxx /usr/bin/clang++-18 && cp build/Release/node_abieos.node lib/abieos.node",
|
|
22
22
|
"build:linux:ci": "cmake-js compile && cp build/Release/node_abieos.node lib/abieos.node",
|
|
23
|
-
"build:win": "cmake-js"
|
|
23
|
+
"build:win": "cmake-js",
|
|
24
|
+
"update_version": "node update-version.mjs"
|
|
24
25
|
},
|
|
25
26
|
"repository": {
|
|
26
27
|
"type": "git",
|
|
@@ -33,12 +34,13 @@
|
|
|
33
34
|
},
|
|
34
35
|
"homepage": "https://github.com/eosrio/node-abieos#readme",
|
|
35
36
|
"devDependencies": {
|
|
36
|
-
"@microsoft/api-extractor": "7.
|
|
37
|
-
"@
|
|
37
|
+
"@microsoft/api-extractor": "7.48.1",
|
|
38
|
+
"@wharfkit/antelope": "^1.0.13",
|
|
39
|
+
"@types/node": "22.10.2",
|
|
38
40
|
"cmake-js": "7.3.0",
|
|
39
|
-
"node-addon-api": "8.
|
|
41
|
+
"node-addon-api": "8.3.0",
|
|
40
42
|
"tsup": "^8.3.5",
|
|
41
|
-
"typescript": "5.
|
|
43
|
+
"typescript": "5.7.2"
|
|
42
44
|
},
|
|
43
45
|
"binary": {
|
|
44
46
|
"napi_versions": [
|
package/tsup.config.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { defineConfig } from 'tsup';
|
|
2
|
-
|
|
3
|
-
export default defineConfig({
|
|
4
|
-
entry: ["lib/abieos.ts"],
|
|
5
|
-
publicDir: "lib",
|
|
6
|
-
format: ["cjs", "esm"],
|
|
7
|
-
shims: true,
|
|
8
|
-
minify: false,
|
|
9
|
-
sourcemap: false,
|
|
10
|
-
clean: true,
|
|
11
|
-
experimentalDts: "lib/abieos.ts"
|
|
1
|
+
import { defineConfig } from 'tsup';
|
|
2
|
+
|
|
3
|
+
export default defineConfig({
|
|
4
|
+
entry: ["lib/abieos.ts"],
|
|
5
|
+
publicDir: "lib",
|
|
6
|
+
format: ["cjs", "esm"],
|
|
7
|
+
shims: true,
|
|
8
|
+
minify: false,
|
|
9
|
+
sourcemap: false,
|
|
10
|
+
clean: true,
|
|
11
|
+
experimentalDts: "lib/abieos.ts"
|
|
12
12
|
})
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import {promises} from "node:fs";
|
|
2
|
+
import {exec} from "node:child_process";
|
|
3
|
+
|
|
4
|
+
const oldPackageJson = await promises.readFile('package.json', 'utf8');
|
|
5
|
+
if (!oldPackageJson) {
|
|
6
|
+
console.error('Failed to read package.json');
|
|
7
|
+
process.exit(1);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const parsed = JSON.parse(oldPackageJson.toString());
|
|
11
|
+
const [version, hash] = parsed.version.split('-');
|
|
12
|
+
console.log(`Old version: ${version}`);
|
|
13
|
+
console.log(`Old hash: ${hash}`);
|
|
14
|
+
|
|
15
|
+
exec('git rev-parse --short HEAD', {
|
|
16
|
+
cwd: './abieos',
|
|
17
|
+
}, (error, stdout) => {
|
|
18
|
+
if (error) {
|
|
19
|
+
console.error('Failed to get git hash');
|
|
20
|
+
process.exit(1);
|
|
21
|
+
}
|
|
22
|
+
console.log(`New hash: ${stdout.trim()}`);
|
|
23
|
+
const newVersion = `${version}-${stdout.trim()}`;
|
|
24
|
+
console.log(`New version: ${newVersion}`);
|
|
25
|
+
parsed.version = newVersion;
|
|
26
|
+
const newPackageJson = JSON.stringify(parsed, null, 2);
|
|
27
|
+
promises.writeFile('package.json', newPackageJson).catch((err) => {
|
|
28
|
+
console.error('Failed to write package.json');
|
|
29
|
+
process.exit(1);
|
|
30
|
+
});
|
|
31
|
+
});
|