Skip to content

Commit

Permalink
fix(lint): fix issue #1359
Browse files Browse the repository at this point in the history
Signed-off-by: katherine <krosenk729@gmail.com>
  • Loading branch information
krosenk729 authored and petermetz committed Oct 27, 2021
1 parent d067df2 commit f7eb39b
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 34 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
const tap = require("tap");
import * as publicApi from "../../../main/typescript/public-api";
import test, { Test } from "tape-promise/tape";
import * as apiSurface from "../../../main/typescript/public-api";

tap.pass("Test file can be executed");

tap.test("Library can be loaded", (assert: any) => {
assert.plan(1);
assert.ok(publicApi);
test("Library can be loaded", (t: Test) => {
t.ok(apiSurface, "apiSurface truthy OK");
t.end();
});
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ import {
Web3SigningCredentialType,
} from "./generated/openapi/typescript-axios/api";

export function isWeb3SigningCredentialPrivateKeyHex(
x: any,
): x is Web3SigningCredentialPrivateKeyHex {
return x?.type && x?.type === Web3SigningCredentialType.PrivateKeyHex;
export function isWeb3SigningCredentialPrivateKeyHex(x?: {
type?: Web3SigningCredentialType;
}): x is Web3SigningCredentialPrivateKeyHex {
return x?.type === Web3SigningCredentialType.PrivateKeyHex;
}

export function isWeb3SigningCredentialNone(
x: any,
): x is Web3SigningCredentialNone {
return x?.type && x?.type === Web3SigningCredentialType.None;
export function isWeb3SigningCredentialNone(x?: {
type?: Web3SigningCredentialType;
}): x is Web3SigningCredentialNone {
return x?.type === Web3SigningCredentialType.None;
}
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ import { GetPastLogsEndpoint } from "./web-services/get-past-logs-endpoint";
import { RunTransactionEndpoint } from "./web-services/run-transaction-endpoint";
import { GetBlockEndpoint } from "./web-services/get-block-v1-endpoint-";
import { GetBesuRecordEndpointV1 } from "./web-services/get-besu-record-endpoint-v1";
import { AbiItem } from "web3-utils";

export const E_KEYCHAIN_NOT_FOUND = "cactus.connector.besu.keychain_not_found";

Expand Down Expand Up @@ -416,7 +417,8 @@ export class PluginLedgerConnectorBesu
);
privKey = await keychainPlugin?.get(keychainEntryKey);
} else {
privKey = (req.signingCredential as any).secret;
privKey = (req.signingCredential as Web3SigningCredentialPrivateKeyHex)
.secret;
}

const fnParams = {
Expand All @@ -442,7 +444,7 @@ export class PluginLedgerConnectorBesu
success = true;
this.log.debug(`Web3 EEA Call output: `, callOutput);
} else {
callOutput = await (method as any).call();
callOutput = await method.call();
success = true;
}
return { success, callOutput };
Expand Down Expand Up @@ -542,7 +544,7 @@ export class PluginLedgerConnectorBesu

public async getTxReceipt(
request: RunTransactionRequest,
txPoolReceipt: any,
txPoolReceipt: TransactionReceipt,
): Promise<RunTransactionResponse> {
const fnTag = `${this.className}#getTxReceipt()`;

Expand Down Expand Up @@ -915,7 +917,7 @@ export class PluginLedgerConnectorBesu
): Promise<GetBesuRecordV1Response> {
const fnTag = `${this.className}#getBesuRecord()`;
//////////////////////////////////////////////
let abi: any = undefined;
let abi: AbiItem[] | AbiItem = [];
const resp: GetBesuRecordV1Response = {};
const txHash = request.transactionHash;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,29 @@ import {
Web3SigningCredentialType,
} from "./generated/openapi/typescript-axios/api";

export function isWeb3SigningCredentialPrivateKeyHex(
x: any,
): x is Web3SigningCredentialPrivateKeyHex {
return x?.type && x?.type === Web3SigningCredentialType.PrivateKeyHex;
export function isWeb3SigningCredentialPrivateKeyHex(x?: {
type?: Web3SigningCredentialType;
}): x is Web3SigningCredentialPrivateKeyHex {
return x?.type === Web3SigningCredentialType.PrivateKeyHex;
}

export function isWeb3SigningCredentialNone(
x: any,
): x is Web3SigningCredentialNone {
return x?.type && x?.type === Web3SigningCredentialType.None;
export function isWeb3SigningCredentialNone(x?: {
type?: Web3SigningCredentialType;
}): x is Web3SigningCredentialNone {
return x?.type === Web3SigningCredentialType.None;
}

export function isWeb3SigningCredentialGethKeychainPassword(
x: any,
): x is Web3SigningCredentialGethKeychainPassword {
return x?.type && x?.type === Web3SigningCredentialType.GethKeychainPassword;
export function isWeb3SigningCredentialGethKeychainPassword(x?: {
type?: Web3SigningCredentialType;
}): x is Web3SigningCredentialGethKeychainPassword {
return x?.type === Web3SigningCredentialType.GethKeychainPassword;
}

export function isWeb3SigningCredentialCactusKeychainRef(
x: any,
): x is Web3SigningCredentialCactusKeychainRef {
export function isWeb3SigningCredentialCactusKeychainRef(x?: {
type?: Web3SigningCredentialType;
keychainEntryKey?: string | unknown;
keychainId?: string | unknown;
}): x is Web3SigningCredentialCactusKeychainRef {
return (
!!x?.type &&
x?.type === Web3SigningCredentialType.CactusKeychainRef &&
Expand Down

0 comments on commit f7eb39b

Please sign in to comment.