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 9bc856e
Show file tree
Hide file tree
Showing 20 changed files with 483 additions and 366 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,14 @@ import {
VerifierFactoryConfig,
} from "@hyperledger/cactus-verifier-client";

const fs = require("fs");
const path = require("path");
const config: any = ConfigUtil.getConfig();
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 +30,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 +44,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
7 changes: 4 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,7 @@ 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 config: any = ConfigUtil.getConfig();
import { getLogger } from "log4js";
const moduleName = "balance";
Expand All @@ -35,7 +34,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 9bc856e

Please sign in to comment.