Skip to content

Commit

Permalink
Fix linter error (#124)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mihajlo-Pavlovic authored Dec 21, 2023
1 parent 5f09a73 commit 99e1aec
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 18 deletions.
1 change: 0 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ module.exports = {
node: true,
},
extends: ['airbnb/base', 'prettier'],
parser: 'babel-eslint',
parserOptions: {
sourceType: 'module',
ecmaVersion: 'latest',
Expand Down
2 changes: 1 addition & 1 deletion managers/blockchain-operations-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class BlockchainOperationsManager {
*/
async getGasPrice(options = {}) {
const blockchain = this.inputService.getBlockchain(options);
return await this.blockchainService.getGasPrice(blockchain);
return this.blockchainService.getGasPrice(blockchain);
}

/**
Expand Down
6 changes: 3 additions & 3 deletions services/base-service-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ const { BLOCKCHAINS_RENAME_PAIRS } = require('../constants');
class BaseServiceManager {
constructor(config) {
const blockchainName = config.blockchain?.name;

const configWithNewBlockchainName = config;
if (blockchainName && Object.keys(BLOCKCHAINS_RENAME_PAIRS).includes(blockchainName))
config.blockchain.name = BLOCKCHAINS_RENAME_PAIRS[blockchainName];
configWithNewBlockchainName.blockchain.name = BLOCKCHAINS_RENAME_PAIRS[blockchainName];

this.initializeServices(config);
this.initializeServices(configWithNewBlockchainName);
}

initializeServices(config) {
Expand Down
6 changes: 1 addition & 5 deletions services/blockchain-service/blockchain-service-base.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,7 @@ class BlockchainServiceBase {

async callContractFunction(contractName, functionName, args, blockchain) {
const contractInstance = await this.getContractInstance(contractName, blockchain);
try {
return contractInstance.methods[functionName](...args).call();
} catch (error) {
throw error;
}
return contractInstance.methods[functionName](...args).call();
}

async prepareTransaction(contractInstance, functionName, args, blockchain) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,7 @@ class BrowserBlockchainService extends BlockchainServiceBase {
const contractInstance = await this.getContractInstance(contractName, blockchain);
const tx = await this.prepareTransaction(contractInstance, functionName, args, blockchain);

try {
return contractInstance.methods[functionName](...args).send(tx);
} catch (error) {
throw error;
}
return contractInstance.methods[functionName](...args).send(tx);
}

async getPublicKey() {
Expand Down
3 changes: 1 addition & 2 deletions services/utilities.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
const jsonld = require('jsonld');
const BlockchainError = require('./custom-errors');
const {
GRAPH_LOCATIONS,
GRAPH_STATES,
Expand All @@ -23,7 +22,7 @@ module.exports = {
},
resolveUAL(ual) {
const segments = ual.split(':');
const argsString = segments.length === 3 ? segments[2] : segments[2] + ':' + segments[3];
const argsString = segments.length === 3 ? segments[2] : `${segments[2]}:${segments[3]}`;
const args = argsString.split('/');

if (args.length !== 3) {
Expand Down
2 changes: 1 addition & 1 deletion services/validation-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ class ValidationService {
this.validateParamType('UAL', ual, 'string');

const segments = ual.split(':');
const argsString = segments.length === 3 ? segments[2] : segments[2] + ':' + segments[3];
const argsString = segments.length === 3 ? segments[2] : `${segments[2]}:${segments[3]}`;
const args = argsString.split('/');

if (!(args?.length === 3)) throw Error('Invalid UAL.');
Expand Down

0 comments on commit 99e1aec

Please sign in to comment.