@eosrio/node-abieos 3.3.1 → 3.3.3-23007ce

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 CHANGED
@@ -54,5 +54,5 @@ git clone https://github.com/eosrio/node-abieos.git
54
54
  cd node-abieos
55
55
  npm install
56
56
  npm run build:linux
57
- npm run build:tsc
57
+ npm run build
58
58
  ```
@@ -1,9 +1,8 @@
1
1
  /// <reference types="node" />
2
- declare const abieos: any;
2
+
3
3
  export declare class Abieos {
4
4
  private static instance;
5
5
  static native: typeof abieos;
6
- private static instanceId;
7
6
  private constructor();
8
7
  static getInstance(): Abieos;
9
8
  stringToName(nameString: string): BigInteger;
@@ -16,5 +15,7 @@ export declare class Abieos {
16
15
  getTypeForTable(contractName: string, table_name: string): string;
17
16
  deleteContract(contractName: string): boolean;
18
17
  }
19
- export {};
20
- //# sourceMappingURL=abieos.d.ts.map
18
+
19
+ declare const abieos: any;
20
+
21
+ export { }
@@ -0,0 +1,21 @@
1
+ /// <reference types="node" />
2
+
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): any;
11
+ binToJson(contractName: string, type: string, buffer: Buffer): any;
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
+
19
+ declare const abieos: any;
20
+
21
+ export { }
@@ -0,0 +1,122 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // lib/abieos.ts
21
+ var abieos_exports = {};
22
+ __export(abieos_exports, {
23
+ Abieos: () => Abieos
24
+ });
25
+ module.exports = __toCommonJS(abieos_exports);
26
+
27
+ // node_modules/tsup/assets/cjs_shims.js
28
+ var getImportMetaUrl = () => typeof document === "undefined" ? new URL(`file:${__filename}`).href : document.currentScript && document.currentScript.src || new URL("main.js", document.baseURI).href;
29
+ var importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
30
+
31
+ // lib/abieos.ts
32
+ var import_module = require("module");
33
+ var abieos = (0, import_module.createRequire)(importMetaUrl)("./abieos.node");
34
+ var Abieos = class _Abieos {
35
+ static instance;
36
+ static native;
37
+ constructor() {
38
+ if (_Abieos.instance) {
39
+ throw new Error("This class is a Singleton!");
40
+ }
41
+ _Abieos.native = abieos;
42
+ }
43
+ static getInstance() {
44
+ if (!_Abieos.instance) {
45
+ _Abieos.instance = new _Abieos();
46
+ }
47
+ return _Abieos.instance;
48
+ }
49
+ stringToName(nameString) {
50
+ return _Abieos.native.string_to_name(nameString);
51
+ }
52
+ jsonToHex(contractName, type, json) {
53
+ const jsonData = typeof json === "object" ? JSON.stringify(json) : json;
54
+ const data = _Abieos.native.json_to_hex(contractName, type, jsonData);
55
+ if (data === "PARSING_ERROR") {
56
+ throw new Error("failed to parse data");
57
+ } else {
58
+ return data;
59
+ }
60
+ }
61
+ hexToJson(contractName, type, hex) {
62
+ const data = _Abieos.native.hex_to_json(contractName, type, hex);
63
+ if (data) {
64
+ try {
65
+ return JSON.parse(data);
66
+ } catch (e) {
67
+ throw new Error("failed to parse json string: " + data);
68
+ }
69
+ } else {
70
+ throw new Error("failed to parse hex data");
71
+ }
72
+ }
73
+ binToJson(contractName, type, buffer) {
74
+ const data = _Abieos.native.bin_to_json(contractName, type, buffer);
75
+ if (data[0] === "{" || data[0] === "[") {
76
+ try {
77
+ return JSON.parse(data);
78
+ } catch (e) {
79
+ throw new Error("json parse error");
80
+ }
81
+ } else {
82
+ throw new Error(data);
83
+ }
84
+ }
85
+ loadAbi(contractName, abi) {
86
+ if (typeof abi === "string") {
87
+ return _Abieos.native.load_abi(contractName, abi);
88
+ } else {
89
+ if (typeof abi === "object") {
90
+ return _Abieos.native.load_abi(contractName, JSON.stringify(abi));
91
+ } else {
92
+ throw new Error("ABI must be a String or Object");
93
+ }
94
+ }
95
+ }
96
+ loadAbiHex(contractName, abihex) {
97
+ return _Abieos.native.load_abi_hex(contractName, abihex);
98
+ }
99
+ getTypeForAction(contractName, actionName) {
100
+ const result = _Abieos.native.get_type_for_action(contractName, actionName);
101
+ if (result === "NOT_FOUND") {
102
+ throw new Error(`[node-abieos] action ` + actionName + " not found on contract " + contractName);
103
+ } else {
104
+ return result;
105
+ }
106
+ }
107
+ getTypeForTable(contractName, table_name) {
108
+ const result = _Abieos.native.get_type_for_table(contractName, table_name);
109
+ if (result === "NOT_FOUND") {
110
+ throw new Error(`[node-abieos] table ` + table_name + " not found on contract " + contractName);
111
+ } else {
112
+ return result;
113
+ }
114
+ }
115
+ deleteContract(contractName) {
116
+ return _Abieos.native.delete_contract(contractName);
117
+ }
118
+ };
119
+ // Annotate the CommonJS export names for ESM import in node:
120
+ 0 && (module.exports = {
121
+ Abieos
122
+ });
@@ -0,0 +1 @@
1
+ export { Abieos } from './_tsup-dts-rollup.cjs';
@@ -0,0 +1 @@
1
+ export { Abieos } from './_tsup-dts-rollup.js';
package/dist/abieos.js ADDED
@@ -0,0 +1,91 @@
1
+ // lib/abieos.ts
2
+ import { createRequire } from "module";
3
+ var abieos = createRequire(import.meta.url)("./abieos.node");
4
+ var Abieos = class _Abieos {
5
+ static instance;
6
+ static native;
7
+ constructor() {
8
+ if (_Abieos.instance) {
9
+ throw new Error("This class is a Singleton!");
10
+ }
11
+ _Abieos.native = abieos;
12
+ }
13
+ static getInstance() {
14
+ if (!_Abieos.instance) {
15
+ _Abieos.instance = new _Abieos();
16
+ }
17
+ return _Abieos.instance;
18
+ }
19
+ stringToName(nameString) {
20
+ return _Abieos.native.string_to_name(nameString);
21
+ }
22
+ jsonToHex(contractName, type, json) {
23
+ const jsonData = typeof json === "object" ? JSON.stringify(json) : json;
24
+ const data = _Abieos.native.json_to_hex(contractName, type, jsonData);
25
+ if (data === "PARSING_ERROR") {
26
+ throw new Error("failed to parse data");
27
+ } else {
28
+ return data;
29
+ }
30
+ }
31
+ hexToJson(contractName, type, hex) {
32
+ const data = _Abieos.native.hex_to_json(contractName, type, hex);
33
+ if (data) {
34
+ try {
35
+ return JSON.parse(data);
36
+ } catch (e) {
37
+ throw new Error("failed to parse json string: " + data);
38
+ }
39
+ } else {
40
+ throw new Error("failed to parse hex data");
41
+ }
42
+ }
43
+ binToJson(contractName, type, buffer) {
44
+ const data = _Abieos.native.bin_to_json(contractName, type, buffer);
45
+ if (data[0] === "{" || data[0] === "[") {
46
+ try {
47
+ return JSON.parse(data);
48
+ } catch (e) {
49
+ throw new Error("json parse error");
50
+ }
51
+ } else {
52
+ throw new Error(data);
53
+ }
54
+ }
55
+ loadAbi(contractName, abi) {
56
+ if (typeof abi === "string") {
57
+ return _Abieos.native.load_abi(contractName, abi);
58
+ } else {
59
+ if (typeof abi === "object") {
60
+ return _Abieos.native.load_abi(contractName, JSON.stringify(abi));
61
+ } else {
62
+ throw new Error("ABI must be a String or Object");
63
+ }
64
+ }
65
+ }
66
+ loadAbiHex(contractName, abihex) {
67
+ return _Abieos.native.load_abi_hex(contractName, abihex);
68
+ }
69
+ getTypeForAction(contractName, actionName) {
70
+ const result = _Abieos.native.get_type_for_action(contractName, actionName);
71
+ if (result === "NOT_FOUND") {
72
+ throw new Error(`[node-abieos] action ` + actionName + " not found on contract " + contractName);
73
+ } else {
74
+ return result;
75
+ }
76
+ }
77
+ getTypeForTable(contractName, table_name) {
78
+ const result = _Abieos.native.get_type_for_table(contractName, table_name);
79
+ if (result === "NOT_FOUND") {
80
+ throw new Error(`[node-abieos] table ` + table_name + " not found on contract " + contractName);
81
+ } else {
82
+ return result;
83
+ }
84
+ }
85
+ deleteContract(contractName) {
86
+ return _Abieos.native.delete_contract(contractName);
87
+ }
88
+ };
89
+ export {
90
+ Abieos
91
+ };
Binary file
package/dist/abieos.ts ADDED
@@ -0,0 +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
+ }
100
+ }
package/lib/abieos.node CHANGED
Binary file
package/lib/abieos.ts CHANGED
@@ -1,17 +1,16 @@
1
- const abieos = require("./abieos.node");
2
- const {randomUUID} = require("node:crypto");
1
+ import { createRequire } from "module";
2
+ const abieos = createRequire(import.meta.url)('./abieos.node');
3
3
 
4
4
  export class Abieos {
5
+
5
6
  private static instance: Abieos;
6
7
  public static native: typeof abieos;
7
- private static instanceId: any;
8
8
 
9
9
  private constructor() {
10
10
  if (Abieos.instance) {
11
11
  throw new Error("This class is a Singleton!");
12
12
  }
13
13
  Abieos.native = abieos;
14
- Abieos.instanceId = randomUUID();
15
14
  }
16
15
 
17
16
  public static getInstance(): Abieos {
@@ -80,7 +79,7 @@ export class Abieos {
80
79
  public getTypeForAction(contractName: string, actionName: string): string {
81
80
  const result = Abieos.native.get_type_for_action(contractName, actionName);
82
81
  if (result === 'NOT_FOUND') {
83
- throw new Error(`[${Abieos.instanceId}] action ` + actionName + ' not found on contract ' + contractName);
82
+ throw new Error(`[node-abieos] action ` + actionName + ' not found on contract ' + contractName);
84
83
  } else {
85
84
  return result;
86
85
  }
@@ -89,7 +88,7 @@ export class Abieos {
89
88
  public getTypeForTable(contractName: string, table_name: string): string {
90
89
  const result = Abieos.native.get_type_for_table(contractName, table_name);
91
90
  if (result === 'NOT_FOUND') {
92
- throw new Error(`[${Abieos.instanceId}] table ` + table_name + ' not found on contract ' + contractName);
91
+ throw new Error(`[node-abieos] table ` + table_name + ' not found on contract ' + contractName);
93
92
  } else {
94
93
  return result;
95
94
  }
package/package.json CHANGED
@@ -1,13 +1,15 @@
1
1
  {
2
2
  "name": "@eosrio/node-abieos",
3
- "version": "3.3.1",
3
+ "version": "3.3.3-23007ce",
4
4
  "description": "Node Bindings for abieos: Binary <> JSON conversion using ABIs.",
5
- "main": "./lib/abieos.js",
6
- "types": "./lib/abieos.d.ts",
5
+ "main": "./dist/abieos.js",
6
+ "types": "./dist/abieos.d.ts",
7
+ "type": "module",
7
8
  "exports": {
8
9
  ".": {
9
- "require": "./lib/abieos.js",
10
- "types": "./lib/abieos.d.ts"
10
+ "types": "./dist/abieos.d.ts",
11
+ "import": "./dist/abieos.js",
12
+ "require": "./dist/abieos.cjs"
11
13
  }
12
14
  },
13
15
  "scripts": {
@@ -15,8 +17,7 @@
15
17
  "test": "cd examples && node basic.mjs",
16
18
  "tsc:watch": "tsc --watch",
17
19
  "clean": "cmake-js clean",
18
- "bundle": "tsup lib/abieos.ts --format cjs,esm --dts --clean",
19
- "build:tsc": "tsc",
20
+ "build": "tsup",
20
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",
21
22
  "build:linux:ci": "cmake-js compile && cp build/Release/node_abieos.node lib/abieos.node",
22
23
  "build:win": "cmake-js"
@@ -32,11 +33,12 @@
32
33
  },
33
34
  "homepage": "https://github.com/eosrio/node-abieos#readme",
34
35
  "devDependencies": {
35
- "@types/node": "20.12.7",
36
+ "@microsoft/api-extractor": "7.47.11",
37
+ "@types/node": "22.8.1",
36
38
  "cmake-js": "7.3.0",
37
- "node-addon-api": "8.0.0",
38
- "tsup": "^8.0.2",
39
- "typescript": "5.4.5"
39
+ "node-addon-api": "8.2.1",
40
+ "tsup": "^8.3.5",
41
+ "typescript": "5.4.2"
40
42
  },
41
43
  "binary": {
42
44
  "napi_versions": [
@@ -45,7 +47,7 @@
45
47
  },
46
48
  "cmake-js": {
47
49
  "runtime": "node",
48
- "runtimeVersion": "20.0.0",
50
+ "runtimeVersion": "22.0.0",
49
51
  "arch": "x64"
50
52
  }
51
- }
53
+ }
package/tsup.config.ts ADDED
@@ -0,0 +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"
12
+ })
@@ -1,34 +0,0 @@
1
- name: Node.js Addon with CMake
2
-
3
- on:
4
- push:
5
- branches: [ "master", "3.3-staging" ]
6
- pull_request:
7
- branches: [ "master" ]
8
-
9
- env:
10
- BUILD_TYPE: Release
11
-
12
- jobs:
13
- build:
14
- runs-on: ubuntu-latest
15
- strategy:
16
- matrix:
17
- node-version: [20.x]
18
-
19
- steps:
20
- # Checkout repo and submodules
21
- - uses: actions/checkout@v4
22
- with:
23
- submodules: recursive
24
-
25
- # Setup Node.js
26
- - name: Use Node.js ${{ matrix.node-version }}
27
- uses: actions/setup-node@v4
28
- with:
29
- node-version: ${{ matrix.node-version }}
30
- cache: 'npm'
31
- - run: npm ci
32
- - run: npm run build:linux:ci
33
- - run: npm run build:tsc
34
- - run: npm run test
@@ -1,6 +0,0 @@
1
- {
2
- "files.associations": {
3
- "*.toml": "toml",
4
- "utility": "cpp"
5
- }
6
- }
package/bun.lockb DELETED
Binary file
@@ -1 +0,0 @@
1
- {"version":3,"file":"abieos.d.ts","sourceRoot":"","sources":["abieos.ts"],"names":[],"mappings":";AAAA,QAAA,MAAM,MAAM,KAA2B,CAAC;AAGxC,qBAAa,MAAM;IACf,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAS;IAChC,OAAc,MAAM,EAAE,OAAO,MAAM,CAAC;IACpC,OAAO,CAAC,MAAM,CAAC,UAAU,CAAM;IAE/B,OAAO;WAQO,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,GAAG;IAa/D,SAAS,CAAC,YAAY,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,GAAG;IAalE,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 DELETED
@@ -1,99 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Abieos = void 0;
4
- const abieos = require("./abieos.node");
5
- const { randomUUID } = require("node:crypto");
6
- class Abieos {
7
- constructor() {
8
- if (Abieos.instance) {
9
- throw new Error("This class is a Singleton!");
10
- }
11
- Abieos.native = abieos;
12
- Abieos.instanceId = randomUUID();
13
- }
14
- static getInstance() {
15
- if (!Abieos.instance) {
16
- Abieos.instance = new Abieos();
17
- }
18
- return Abieos.instance;
19
- }
20
- stringToName(nameString) {
21
- return Abieos.native.string_to_name(nameString);
22
- }
23
- jsonToHex(contractName, type, json) {
24
- const jsonData = typeof json === 'object' ? JSON.stringify(json) : json;
25
- const data = Abieos.native.json_to_hex(contractName, type, jsonData);
26
- if (data === 'PARSING_ERROR') {
27
- throw new Error('failed to parse data');
28
- }
29
- else {
30
- return data;
31
- }
32
- }
33
- hexToJson(contractName, type, hex) {
34
- const data = Abieos.native.hex_to_json(contractName, type, hex);
35
- if (data) {
36
- try {
37
- return JSON.parse(data);
38
- }
39
- catch (e) {
40
- throw new Error('failed to parse json string: ' + data);
41
- }
42
- }
43
- else {
44
- throw new Error('failed to parse hex data');
45
- }
46
- }
47
- binToJson(contractName, type, buffer) {
48
- const data = Abieos.native.bin_to_json(contractName, type, buffer);
49
- if (data[0] === '{' || data[0] === '[') {
50
- try {
51
- return JSON.parse(data);
52
- }
53
- catch (e) {
54
- throw new Error('json parse error');
55
- }
56
- }
57
- else {
58
- throw new Error(data);
59
- }
60
- }
61
- loadAbi(contractName, abi) {
62
- if (typeof abi === 'string') {
63
- return Abieos.native.load_abi(contractName, abi);
64
- }
65
- else {
66
- if (typeof abi === 'object') {
67
- return Abieos.native.load_abi(contractName, JSON.stringify(abi));
68
- }
69
- else {
70
- throw new Error('ABI must be a String or Object');
71
- }
72
- }
73
- }
74
- loadAbiHex(contractName, abihex) {
75
- return Abieos.native.load_abi_hex(contractName, abihex);
76
- }
77
- getTypeForAction(contractName, actionName) {
78
- const result = Abieos.native.get_type_for_action(contractName, actionName);
79
- if (result === 'NOT_FOUND') {
80
- throw new Error(`[${Abieos.instanceId}] action ` + actionName + ' not found on contract ' + contractName);
81
- }
82
- else {
83
- return result;
84
- }
85
- }
86
- getTypeForTable(contractName, table_name) {
87
- const result = Abieos.native.get_type_for_table(contractName, table_name);
88
- if (result === 'NOT_FOUND') {
89
- throw new Error(`[${Abieos.instanceId}] table ` + table_name + ' not found on contract ' + contractName);
90
- }
91
- else {
92
- return result;
93
- }
94
- }
95
- deleteContract(contractName) {
96
- return Abieos.native.delete_contract(contractName);
97
- }
98
- }
99
- exports.Abieos = Abieos;