From d5de6876c59ca1eb7b58b298745fd94392450c71 Mon Sep 17 00:00:00 2001 From: "deepsource-autofix[bot]" <62050782+deepsource-autofix[bot]@users.noreply.github.com> Date: Fri, 10 May 2024 07:41:06 +0000 Subject: [PATCH] style: format code with Autopep8, Black, ClangFormat, dotnet-format, Go fmt, Gofumpt, Google Java Format, isort, Ktlint, PHP CS Fixer, Prettier, RuboCop, Ruff Formatter, Rustfmt, Scalafmt, StandardJS, StandardRB, swift-format and Yapf This commit fixes the style issues introduced in eb12002 according to the output from Autopep8, Black, ClangFormat, dotnet-format, Go fmt, Gofumpt, Google Java Format, isort, Ktlint, PHP CS Fixer, Prettier, RuboCop, Ruff Formatter, Rustfmt, Scalafmt, StandardJS, StandardRB, swift-format and Yapf. Details: None --- src/middleware/network.js | 42 ++++++++++++++++++++++++--------------- 1 file changed, 26 insertions(+), 16 deletions(-) diff --git a/src/middleware/network.js b/src/middleware/network.js index 8e58f6c1b..636f053e5 100644 --- a/src/middleware/network.js +++ b/src/middleware/network.js @@ -1,30 +1,40 @@ -const { PRIVATE_KEY, PRIVATE_KEY_PASSWORD, PRIVATE_KEY_PASSWORD_SALT, ENDPOINT, CHAIN_ID } = process.env; +const { + PRIVATE_KEY, + PRIVATE_KEY_PASSWORD, + PRIVATE_KEY_PASSWORD_SALT, + ENDPOINT, + CHAIN_ID +} = process.env -const Web3 = require("web3"); -const EthereumTx = require("ethereumjs-tx"); +const Web3 = require('web3') +const EthereumTx = require('ethereumjs-tx') -const web3 = new Web3(new Web3.providers.HttpProvider(ENDPOINT)); +const web3 = new Web3(new Web3.providers.HttpProvider(ENDPOINT)) const createTransaction = async (from, to, value) => { - const nonce = await web3.eth.getTransactionCount(from); - const gasPrice = await web3.eth.getGasPrice(); - const gasLimit = 21000; + const nonce = await web3.eth.getTransactionCount(from) + const gasPrice = await web3.eth.getGasPrice() + const gasLimit = 21000 const tx = new EthereumTx({ nonce, gasPrice, gasLimit, to, - value, - }); + value + }) - const privateKey = web3.utils.sha3(PRIVATE_KEY_PASSWORD + PRIVATE_KEY_PASSWORD_SALT); - tx.sign(privateKey); + const privateKey = web3.utils.sha3( + PRIVATE_KEY_PASSWORD + PRIVATE_KEY_PASSWORD_SALT + ) + tx.sign(privateKey) - const serializedTx = tx.serialize(); - const transactionHash = await web3.eth.sendSignedTransaction("0x" + serializedTx.toString("hex")); + const serializedTx = tx.serialize() + const transactionHash = await web3.eth.sendSignedTransaction( + '0x' + serializedTx.toString('hex') + ) - return transactionHash; -}; + return transactionHash +} -module.exports = createTransaction; +module.exports = createTransaction