Skip to content

Commit 3a46879

Browse files
committed
3.3.1
1 parent a31b07e commit 3a46879

File tree

7 files changed

+49
-7
lines changed

7 files changed

+49
-7
lines changed

examples/spring.mjs

Lines changed: 30 additions & 0 deletions
Large diffs are not rendered by default.

lib/abieos.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ declare const abieos: any;
33
export declare class Abieos {
44
private static instance;
55
static native: typeof abieos;
6+
private static instanceId;
67
private constructor();
78
static getInstance(): Abieos;
89
stringToName(nameString: string): BigInteger;

lib/abieos.d.ts.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/abieos.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,14 @@
22
Object.defineProperty(exports, "__esModule", { value: true });
33
exports.Abieos = void 0;
44
const abieos = require("./abieos.node");
5+
const { randomUUID } = require("node:crypto");
56
class Abieos {
67
constructor() {
8+
if (Abieos.instance) {
9+
throw new Error("This class is a Singleton!");
10+
}
711
Abieos.native = abieos;
12+
Abieos.instanceId = randomUUID();
813
}
914
static getInstance() {
1015
if (!Abieos.instance) {
@@ -72,7 +77,7 @@ class Abieos {
7277
getTypeForAction(contractName, actionName) {
7378
const result = Abieos.native.get_type_for_action(contractName, actionName);
7479
if (result === 'NOT_FOUND') {
75-
throw new Error('action ' + actionName + ' not found on contract ' + contractName);
80+
throw new Error(`[${Abieos.instanceId}] action ` + actionName + ' not found on contract ' + contractName);
7681
}
7782
else {
7883
return result;
@@ -81,7 +86,7 @@ class Abieos {
8186
getTypeForTable(contractName, table_name) {
8287
const result = Abieos.native.get_type_for_table(contractName, table_name);
8388
if (result === 'NOT_FOUND') {
84-
throw new Error('table ' + table_name + ' not found on contract ' + contractName);
89+
throw new Error(`[${Abieos.instanceId}] table ` + table_name + ' not found on contract ' + contractName);
8590
}
8691
else {
8792
return result;

lib/abieos.node

6.21 MB
Binary file not shown.

lib/abieos.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
11
const abieos = require("./abieos.node");
2+
const {randomUUID} = require("node:crypto");
23

34
export class Abieos {
45
private static instance: Abieos;
56
public static native: typeof abieos;
7+
private static instanceId: any;
68

79
private constructor() {
10+
if (Abieos.instance) {
11+
throw new Error("This class is a Singleton!");
12+
}
813
Abieos.native = abieos;
14+
Abieos.instanceId = randomUUID();
915
}
1016

1117
public static getInstance(): Abieos {
@@ -74,7 +80,7 @@ export class Abieos {
7480
public getTypeForAction(contractName: string, actionName: string): string {
7581
const result = Abieos.native.get_type_for_action(contractName, actionName);
7682
if (result === 'NOT_FOUND') {
77-
throw new Error('action ' + actionName + ' not found on contract ' + contractName);
83+
throw new Error(`[${Abieos.instanceId}] action ` + actionName + ' not found on contract ' + contractName);
7884
} else {
7985
return result;
8086
}
@@ -83,7 +89,7 @@ export class Abieos {
8389
public getTypeForTable(contractName: string, table_name: string): string {
8490
const result = Abieos.native.get_type_for_table(contractName, table_name);
8591
if (result === 'NOT_FOUND') {
86-
throw new Error('table ' + table_name + ' not found on contract ' + contractName);
92+
throw new Error(`[${Abieos.instanceId}] table ` + table_name + ' not found on contract ' + contractName);
8793
} else {
8894
return result;
8995
}

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)