From 7d57d06ef4f5ed4d4c6a2e63b24bdc99ce764ddd Mon Sep 17 00:00:00 2001 From: Zachary Belford Date: Wed, 13 Jul 2022 12:58:03 -0700 Subject: [PATCH] fix: ethjsquery prefix missing space at the end --- app/scripts/controllers/transactions/index.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/app/scripts/controllers/transactions/index.js b/app/scripts/controllers/transactions/index.js index 5fb1ba53f886..6b52487d5ed9 100644 --- a/app/scripts/controllers/transactions/index.js +++ b/app/scripts/controllers/transactions/index.js @@ -1453,7 +1453,8 @@ export default class TransactionController extends EventEmitter { try { txHash = await this.query.sendRawTransaction(rawTx); } catch (error) { - const ethjsQueryErrorPrefix = "[ethjs-query] while formatting outputs from RPC"; + const ethjsQueryErrorPrefix = + '[ethjs-query] while formatting outputs from RPC '; if (error.message.toLowerCase().includes('known transaction')) { txHash = keccak(toBuffer(addHexPrefix(rawTx), 'hex')).toString('hex'); txHash = addHexPrefix(txHash); @@ -1464,8 +1465,14 @@ export default class TransactionController extends EventEmitter { // https://github.com/ethjs/ethjs-query/blob/master/src/index.js#L78 let unwrapped; try { - const withoutPrefix = error.message.replace(ethjsQueryErrorPrefix, ""); - const errorJsonString = withoutPrefix.substring(1, withoutPrefix.length - 1); + const withoutPrefix = error.message.replace( + ethjsQueryErrorPrefix, + '', + ); + const errorJsonString = withoutPrefix.substring( + 1, + withoutPrefix.length - 1, + ); const errorJson = JSON.parse(errorJsonString); unwrapped = new Error(errorJson.value.data.message); unwrapped.code = errorJson.value.data.code;