Skip to content

Commit

Permalink
fix(cactus-example-discounted-asset-trade): enable
Browse files Browse the repository at this point in the history
...tsconfig strict flag and fix all the warnings

- Fixed all warnings when strict flag is enabled

Closes: hyperledger#2145

Signed-off-by: Tomasz Awramski <tomasz.awramski@fujitsu.com>
  • Loading branch information
rwat17 committed Aug 31, 2022
1 parent ee99c87 commit b8c9c4d
Show file tree
Hide file tree
Showing 20 changed files with 539 additions and 367 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@ import {
VerifierFactoryConfig,
} from "@hyperledger/cactus-verifier-client";

const fs = require("fs");
const path = require("path");
const config: any = ConfigUtil.getConfig();
// const fs = require("fs");

This comment has been minimized.

Copy link
@outSH

outSH Aug 31, 2022

usun te zakomentowane linie z nie uzywanym kodem

// const path = require("path");
const config: any = ConfigUtil.getConfig() as any;
import { getLogger } from "log4js";
const moduleName = "BalanceManagement";
const logger = getLogger(`${moduleName}`);
logger.level = config.logLevel;

export class BalanceManagement {
private connectInfo: LPInfoHolder = null; // connection information
private connectInfo: LPInfoHolder | null = null; // connection information
private readonly verifierFactory: VerifierFactory;

constructor() {
Expand All @@ -32,7 +32,12 @@ export class BalanceManagement {
);
}

getBalance(account: string): Promise<any> {
getBalance(
account: string,
): Promise<{
status: number;
amount: number;
}> {
return new Promise((resolve, reject) => {
// for LedgerOperation
// const execData = {"referedAddress": account};
Expand All @@ -41,7 +46,7 @@ export class BalanceManagement {
// for Neo
const contract = {}; // NOTE: Since contract does not need to be specified, specify an empty object.
const method = { type: "web3Eth", command: "getBalance" };
const template = "default";
// const template = "default";
const args = { args: [account] };
// const method = "default";
// const args = {"method": {type: "web3Eth", command: "getBalance"},"args": {"args": [account]}};
Expand Down
8 changes: 5 additions & 3 deletions examples/cactus-example-discounted-asset-trade/balance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import { ConfigUtil } from "@hyperledger/cactus-cmd-socketio-server";
import { RIFError } from "@hyperledger/cactus-cmd-socketio-server";
import { BalanceManagement } from "./balance-management";

const fs = require("fs");
const path = require("path");
// const fs = require("fs");
// const path = require("path");
const config: any = ConfigUtil.getConfig();
import { getLogger } from "log4js";
const moduleName = "balance";
Expand All @@ -35,7 +35,9 @@ router.get("/:account", (req: Request, res: Response, next: NextFunction) => {
logger.error(err);
});
} catch (err) {
logger.error(`##err name: ${err.constructor.name}`);
if (err instanceof Error) {
logger.error(`##err name: ${err.constructor.name}`);
}

if (err instanceof RIFError) {
logger.debug(`##catch RIFError, ${err.statusCode}, ${err.message}`);
Expand Down
Loading

0 comments on commit b8c9c4d

Please sign in to comment.