From 68ed407761dbe53db11923b4d808152924bf39e3 Mon Sep 17 00:00:00 2001 From: Uladzislau Hubar Date: Thu, 7 Sep 2023 11:11:36 +0100 Subject: [PATCH] Resolved linter errors --- .eslintrc.js | 2 +- managers/asset-operations-manager.js | 5 ++--- services/blockchain-service/blockchain-service-base.js | 5 ++--- .../implementations/browser-blockchain-service.js | 5 ++++- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index af4ad93..d862e74 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -30,5 +30,5 @@ module.exports = { }, }, ], - ignorePatterns: ['/dist/*'], + ignorePatterns: ['/dist/*', '/examples/*'], }; diff --git a/managers/asset-operations-manager.js b/managers/asset-operations-manager.js index 40edfb2..4c5d298 100644 --- a/managers/asset-operations-manager.js +++ b/managers/asset-operations-manager.js @@ -18,7 +18,6 @@ const { DEFAULT_GET_LOCAL_STORE_RESULT_FREQUENCY, PRIVATE_ASSERTION_PREDICATE, QUERY_TYPES, - DEFAULT_PARAMETERS, OT_NODE_TRIPLE_STORE_REPOSITORIES, } = require('../constants.js'); const emptyHooks = require('../util/empty-hooks'); @@ -363,8 +362,8 @@ class AssetOperationsManager { const { tokenId } = resolveUAL(UAL); - let publicAssertionId, - stateFinalized = false; + let publicAssertionId; + let stateFinalized = false; if (state === ASSET_STATES.LATEST) { const unfinalizedState = await this.blockchainService.getUnfinalizedState( tokenId, diff --git a/services/blockchain-service/blockchain-service-base.js b/services/blockchain-service/blockchain-service-base.js index 5f1fe1b..e696422 100644 --- a/services/blockchain-service/blockchain-service-base.js +++ b/services/blockchain-service/blockchain-service-base.js @@ -39,14 +39,12 @@ class BlockchainServiceBase { return {}; } - async decodeEventLogs(receipt, eventName, blockchain) { + async decodeEventLogs() { // overridden by subclasses - return; } async getPublicKey() { // overridden by subclasses - return; } async getNetworkGasPrice(blockchain) { @@ -55,6 +53,7 @@ class BlockchainServiceBase { try { return await web3Instance.eth.getGasPrice(); } catch (error) { + // eslint-disable-next-line no-console console.warn(`Failed to fetch the gas price from the network: ${error}. Using default value: 100 Gwei.`); return Web3.utils.toWei('100', 'Gwei'); } diff --git a/services/blockchain-service/implementations/browser-blockchain-service.js b/services/blockchain-service/implementations/browser-blockchain-service.js index 9953a23..732c7ce 100644 --- a/services/blockchain-service/implementations/browser-blockchain-service.js +++ b/services/blockchain-service/implementations/browser-blockchain-service.js @@ -8,8 +8,9 @@ class BrowserBlockchainService extends BlockchainServiceBase { this.config = config; } - async initializeWeb3(blockchainName, blockchainRpc, blockchainOptions) { + async initializeWeb3(blockchainName, blockchainRpc) { if (typeof window.web3 === 'undefined' || !window.web3) { + // eslint-disable-next-line no-console console.error( 'No web3 implementation injected, please inject your own Web3 implementation.', ); @@ -21,6 +22,7 @@ class BrowserBlockchainService extends BlockchainServiceBase { // Request account access if needed await window.ethereum.enable(); } catch (error) { + // eslint-disable-next-line no-console console.error(error); } } else if (blockchainRpc.startsWith('ws')) { @@ -69,6 +71,7 @@ class BrowserBlockchainService extends BlockchainServiceBase { .request({ method: 'eth_requestAccounts', }) + // eslint-disable-next-line no-console .catch(() => console.error('There was an error fetching your accounts')); [this.account] = accounts;