Skip to content

Commit

Permalink
3.3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
igorls committed May 17, 2024
1 parent a31b07e commit 3a46879
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 7 deletions.
30 changes: 30 additions & 0 deletions examples/spring.mjs

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions lib/abieos.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ declare const abieos: any;
export declare class Abieos {
private static instance;
static native: typeof abieos;
private static instanceId;
private constructor();
static getInstance(): Abieos;
stringToName(nameString: string): BigInteger;
Expand Down
2 changes: 1 addition & 1 deletion lib/abieos.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 7 additions & 2 deletions lib/abieos.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,14 @@
Object.defineProperty(exports, "__esModule", { value: true });
exports.Abieos = void 0;
const abieos = require("./abieos.node");
const { randomUUID } = require("node:crypto");
class Abieos {
constructor() {
if (Abieos.instance) {
throw new Error("This class is a Singleton!");
}
Abieos.native = abieos;
Abieos.instanceId = randomUUID();
}
static getInstance() {
if (!Abieos.instance) {
Expand Down Expand Up @@ -72,7 +77,7 @@ class Abieos {
getTypeForAction(contractName, actionName) {
const result = Abieos.native.get_type_for_action(contractName, actionName);
if (result === 'NOT_FOUND') {
throw new Error('action ' + actionName + ' not found on contract ' + contractName);
throw new Error(`[${Abieos.instanceId}] action ` + actionName + ' not found on contract ' + contractName);
}
else {
return result;
Expand All @@ -81,7 +86,7 @@ class Abieos {
getTypeForTable(contractName, table_name) {
const result = Abieos.native.get_type_for_table(contractName, table_name);
if (result === 'NOT_FOUND') {
throw new Error('table ' + table_name + ' not found on contract ' + contractName);
throw new Error(`[${Abieos.instanceId}] table ` + table_name + ' not found on contract ' + contractName);
}
else {
return result;
Expand Down
Binary file modified lib/abieos.node
Binary file not shown.
10 changes: 8 additions & 2 deletions lib/abieos.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
const abieos = require("./abieos.node");
const {randomUUID} = require("node:crypto");

export class Abieos {
private static instance: Abieos;
public static native: typeof abieos;
private static instanceId: any;

private constructor() {
if (Abieos.instance) {
throw new Error("This class is a Singleton!");
}
Abieos.native = abieos;
Abieos.instanceId = randomUUID();
}

public static getInstance(): Abieos {
Expand Down Expand Up @@ -74,7 +80,7 @@ export class Abieos {
public getTypeForAction(contractName: string, actionName: string): string {
const result = Abieos.native.get_type_for_action(contractName, actionName);
if (result === 'NOT_FOUND') {
throw new Error('action ' + actionName + ' not found on contract ' + contractName);
throw new Error(`[${Abieos.instanceId}] action ` + actionName + ' not found on contract ' + contractName);
} else {
return result;
}
Expand All @@ -83,7 +89,7 @@ export class Abieos {
public getTypeForTable(contractName: string, table_name: string): string {
const result = Abieos.native.get_type_for_table(contractName, table_name);
if (result === 'NOT_FOUND') {
throw new Error('table ' + table_name + ' not found on contract ' + contractName);
throw new Error(`[${Abieos.instanceId}] table ` + table_name + ' not found on contract ' + contractName);
} else {
return result;
}
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 3a46879

Please sign in to comment.